ENH: cloudSolution - updated handling of under-relaxation
- unspecified field names now return a value of 1 by default - new debug switch can be used to see default selections STYLE: Minor code reformatting
This commit is contained in:
parent
9ac7982d64
commit
dfdc2d95a7
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2020-2021 OpenCFD Ltd.
|
||||
Copyright (C) 2020-2023 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -30,6 +30,13 @@ License
|
||||
#include "Time.H"
|
||||
#include "localEulerDdtScheme.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineDebugSwitchWithName(cloudSolution, "cloudSolution", 0);
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::cloudSolution::cloudSolution(const fvMesh& mesh, const dictionary& dict)
|
||||
@ -116,12 +123,6 @@ Foam::cloudSolution::cloudSolution(const fvMesh& mesh)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::cloudSolution::~cloudSolution()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::cloudSolution::read()
|
||||
@ -209,17 +210,20 @@ void Foam::cloudSolution::read()
|
||||
|
||||
Foam::scalar Foam::cloudSolution::relaxCoeff(const word& fieldName) const
|
||||
{
|
||||
forAll(schemes_, i)
|
||||
for (const auto& scheme : schemes_)
|
||||
{
|
||||
if (fieldName == schemes_[i].first())
|
||||
if (fieldName == scheme.first())
|
||||
{
|
||||
return schemes_[i].second().second();
|
||||
return scheme.second().second();
|
||||
}
|
||||
}
|
||||
|
||||
FatalErrorInFunction
|
||||
<< "Field name " << fieldName << " not found in schemes"
|
||||
<< abort(FatalError);
|
||||
if (debug)
|
||||
{
|
||||
WarningInFunction
|
||||
<< "Field name " << fieldName << " not found in schemes. "
|
||||
<< "Setting relaxation factor to 1" << endl;
|
||||
}
|
||||
|
||||
return 1.0;
|
||||
}
|
||||
@ -227,17 +231,20 @@ Foam::scalar Foam::cloudSolution::relaxCoeff(const word& fieldName) const
|
||||
|
||||
bool Foam::cloudSolution::semiImplicit(const word& fieldName) const
|
||||
{
|
||||
forAll(schemes_, i)
|
||||
for (const auto& scheme : schemes_)
|
||||
{
|
||||
if (fieldName == schemes_[i].first())
|
||||
if (fieldName == scheme.first())
|
||||
{
|
||||
return schemes_[i].second().first();
|
||||
return scheme.second().first();
|
||||
}
|
||||
}
|
||||
|
||||
FatalErrorInFunction
|
||||
<< "Field name " << fieldName << " not found in schemes"
|
||||
<< abort(FatalError);
|
||||
if (debug)
|
||||
{
|
||||
WarningInFunction
|
||||
<< "Field name " << fieldName << " not found in schemes. "
|
||||
<< "Setting relaxation factor to 1" << endl;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -120,6 +120,9 @@ class cloudSolution
|
||||
|
||||
public:
|
||||
|
||||
//- Debug switch
|
||||
static int debug;
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct null from mesh reference
|
||||
@ -133,7 +136,7 @@ public:
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~cloudSolution();
|
||||
~cloudSolution() = default;
|
||||
|
||||
|
||||
// Member functions
|
||||
|
Loading…
Reference in New Issue
Block a user