mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: replaced fragile dict interactions by meshState functions
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
if (finalIter)
|
||||
{
|
||||
mesh.data().add("finalIteration", true);
|
||||
mesh.data().setFinalIteration(true);
|
||||
}
|
||||
|
||||
if (frozenFlow)
|
||||
@ -35,5 +35,5 @@ else
|
||||
|
||||
if (finalIter)
|
||||
{
|
||||
mesh.data().remove("finalIteration");
|
||||
mesh.data().setFinalIteration(false);
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
if (finalIter)
|
||||
{
|
||||
mesh.data().add("finalIteration", true);
|
||||
mesh.data().setFinalIteration(true);
|
||||
}
|
||||
|
||||
{
|
||||
@ -35,5 +35,5 @@ if (finalIter)
|
||||
|
||||
if (finalIter)
|
||||
{
|
||||
mesh.data().remove("finalIteration");
|
||||
mesh.data().setFinalIteration(false);
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
if (finalIter)
|
||||
{
|
||||
mesh.data().add("finalIteration", true);
|
||||
mesh.data().setFinalIteration(true);
|
||||
}
|
||||
|
||||
if (frozenFlow)
|
||||
@ -36,5 +36,5 @@ else
|
||||
|
||||
if (finalIter)
|
||||
{
|
||||
mesh.data().remove("finalIteration");
|
||||
mesh.data().setFinalIteration(false);
|
||||
}
|
||||
|
||||
@ -25,7 +25,7 @@
|
||||
|
||||
if (finalIter)
|
||||
{
|
||||
mesh.data().add("finalIteration", true);
|
||||
mesh.data().setFinalIteration(true);
|
||||
}
|
||||
|
||||
hEqn.solve(mesh.solver(h.select(finalIter)));
|
||||
@ -39,7 +39,7 @@
|
||||
|
||||
if (finalIter)
|
||||
{
|
||||
mesh.data().remove("finalIteration");
|
||||
mesh.data().setFinalIteration(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1153,14 +1153,7 @@ void Foam::GeometricField<Type, PatchField, GeoMesh>::relax()
|
||||
{
|
||||
word name = this->name();
|
||||
|
||||
if
|
||||
(
|
||||
this->mesh().data().template getOrDefault<bool>
|
||||
(
|
||||
"finalIteration",
|
||||
false
|
||||
)
|
||||
)
|
||||
if (this->mesh().data().isFinalIteration())
|
||||
{
|
||||
name += "Final";
|
||||
}
|
||||
|
||||
@ -32,6 +32,7 @@ License
|
||||
#include "objectRegistry.H"
|
||||
#include "scalarIOField.H"
|
||||
#include "Time.H"
|
||||
#include "meshState.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
@ -351,12 +352,11 @@ void Foam::lduMatrix::setResidualField
|
||||
|
||||
if (residualPtr)
|
||||
{
|
||||
const IOdictionary* dataPtr =
|
||||
mesh().thisDb().findObject<IOdictionary>("data");
|
||||
const auto* dataPtr = mesh().thisDb().findObject<meshState>("data");
|
||||
|
||||
if (dataPtr)
|
||||
{
|
||||
if (initial && dataPtr->found("firstIteration"))
|
||||
if (initial && dataPtr->isFirstIteration())
|
||||
{
|
||||
*residualPtr = residual;
|
||||
DebugInfo
|
||||
|
||||
@ -219,7 +219,7 @@ bool Foam::pimpleControl::loop()
|
||||
}
|
||||
|
||||
corr_ = 0;
|
||||
mesh_.data().remove("finalIteration");
|
||||
mesh_.data().setFinalIteration(false);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -231,7 +231,7 @@ bool Foam::pimpleControl::loop()
|
||||
Info<< algorithmName_ << ": converged in " << corr_ - 1
|
||||
<< " iterations" << endl;
|
||||
|
||||
mesh_.data().remove("finalIteration");
|
||||
mesh_.data().setFinalIteration(false);
|
||||
corr_ = 0;
|
||||
converged_ = false;
|
||||
|
||||
@ -242,7 +242,7 @@ bool Foam::pimpleControl::loop()
|
||||
Info<< algorithmName_ << ": iteration " << corr_ << endl;
|
||||
storePrevIterFields();
|
||||
|
||||
mesh_.data().add("finalIteration", true);
|
||||
mesh_.data().setFinalIteration(true);
|
||||
converged_ = true;
|
||||
}
|
||||
}
|
||||
@ -250,7 +250,7 @@ bool Foam::pimpleControl::loop()
|
||||
{
|
||||
if (finalIter())
|
||||
{
|
||||
mesh_.data().add("finalIteration", true);
|
||||
mesh_.data().setFinalIteration(true);
|
||||
}
|
||||
|
||||
if (corr_ <= nCorrPIMPLE_)
|
||||
|
||||
@ -42,7 +42,7 @@ Foam::pisoControl::pisoControl(fvMesh& mesh, const word& dictName)
|
||||
:
|
||||
pimpleControl(mesh, dictName)
|
||||
{
|
||||
// mesh_.data::add("finalIteration", true);
|
||||
// mesh_.data().setFinalIteration(true);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -193,12 +193,12 @@ void Foam::solutionControl::setFirstIterFlag
|
||||
if (force || (check && corr_ <= 1 && corrNonOrtho_ == 0))
|
||||
{
|
||||
DebugInfo<< "solutionControl: set firstIteration flag" << endl;
|
||||
mesh_.data().set("firstIteration", true);
|
||||
mesh_.data().setFirstIteration(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
DebugInfo<< "solutionControl: remove firstIteration flag" << endl;
|
||||
mesh_.data().remove("firstIteration");
|
||||
mesh_.data().setFirstIteration(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1257,8 +1257,7 @@ void Foam::fvMatrix<Type>::relax()
|
||||
{
|
||||
word name = psi_.select
|
||||
(
|
||||
psi_.mesh().data().template getOrDefault<bool>
|
||||
("finalIteration", false)
|
||||
psi_.mesh().data().isFinalIteration()
|
||||
);
|
||||
|
||||
if (psi_.mesh().relaxEquation(name))
|
||||
@ -1532,11 +1531,7 @@ const Foam::dictionary& Foam::fvMatrix<Type>::solverDict() const
|
||||
{
|
||||
return psi_.mesh().solverDict
|
||||
(
|
||||
psi_.select
|
||||
(
|
||||
psi_.mesh().data().template getOrDefault<bool>
|
||||
("finalIteration", false)
|
||||
)
|
||||
psi_.select(psi_.mesh().data().isFinalIteration())
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -935,11 +935,7 @@ void Foam::radiation::viewFactor::calculate()
|
||||
const dictionary& solverControls =
|
||||
qr_.mesh().solverDict
|
||||
(
|
||||
qr_.select
|
||||
(
|
||||
qr_.mesh().data::template getOrDefault<bool>
|
||||
("finalIteration", false)
|
||||
)
|
||||
qr_.select(qr_.mesh().data().isFinalIteration())
|
||||
);
|
||||
|
||||
// Solver call
|
||||
|
||||
Reference in New Issue
Block a user