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)
|
if (finalIter)
|
||||||
{
|
{
|
||||||
mesh.data().add("finalIteration", true);
|
mesh.data().setFinalIteration(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (frozenFlow)
|
if (frozenFlow)
|
||||||
@ -35,5 +35,5 @@ else
|
|||||||
|
|
||||||
if (finalIter)
|
if (finalIter)
|
||||||
{
|
{
|
||||||
mesh.data().remove("finalIteration");
|
mesh.data().setFinalIteration(false);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
if (finalIter)
|
if (finalIter)
|
||||||
{
|
{
|
||||||
mesh.data().add("finalIteration", true);
|
mesh.data().setFinalIteration(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
@ -35,5 +35,5 @@ if (finalIter)
|
|||||||
|
|
||||||
if (finalIter)
|
if (finalIter)
|
||||||
{
|
{
|
||||||
mesh.data().remove("finalIteration");
|
mesh.data().setFinalIteration(false);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
if (finalIter)
|
if (finalIter)
|
||||||
{
|
{
|
||||||
mesh.data().add("finalIteration", true);
|
mesh.data().setFinalIteration(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (frozenFlow)
|
if (frozenFlow)
|
||||||
@ -36,5 +36,5 @@ else
|
|||||||
|
|
||||||
if (finalIter)
|
if (finalIter)
|
||||||
{
|
{
|
||||||
mesh.data().remove("finalIteration");
|
mesh.data().setFinalIteration(false);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -25,7 +25,7 @@
|
|||||||
|
|
||||||
if (finalIter)
|
if (finalIter)
|
||||||
{
|
{
|
||||||
mesh.data().add("finalIteration", true);
|
mesh.data().setFinalIteration(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
hEqn.solve(mesh.solver(h.select(finalIter)));
|
hEqn.solve(mesh.solver(h.select(finalIter)));
|
||||||
@ -39,7 +39,7 @@
|
|||||||
|
|
||||||
if (finalIter)
|
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();
|
word name = this->name();
|
||||||
|
|
||||||
if
|
if (this->mesh().data().isFinalIteration())
|
||||||
(
|
|
||||||
this->mesh().data().template getOrDefault<bool>
|
|
||||||
(
|
|
||||||
"finalIteration",
|
|
||||||
false
|
|
||||||
)
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
name += "Final";
|
name += "Final";
|
||||||
}
|
}
|
||||||
|
|||||||
@ -32,6 +32,7 @@ License
|
|||||||
#include "objectRegistry.H"
|
#include "objectRegistry.H"
|
||||||
#include "scalarIOField.H"
|
#include "scalarIOField.H"
|
||||||
#include "Time.H"
|
#include "Time.H"
|
||||||
|
#include "meshState.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -351,12 +352,11 @@ void Foam::lduMatrix::setResidualField
|
|||||||
|
|
||||||
if (residualPtr)
|
if (residualPtr)
|
||||||
{
|
{
|
||||||
const IOdictionary* dataPtr =
|
const auto* dataPtr = mesh().thisDb().findObject<meshState>("data");
|
||||||
mesh().thisDb().findObject<IOdictionary>("data");
|
|
||||||
|
|
||||||
if (dataPtr)
|
if (dataPtr)
|
||||||
{
|
{
|
||||||
if (initial && dataPtr->found("firstIteration"))
|
if (initial && dataPtr->isFirstIteration())
|
||||||
{
|
{
|
||||||
*residualPtr = residual;
|
*residualPtr = residual;
|
||||||
DebugInfo
|
DebugInfo
|
||||||
|
|||||||
@ -219,7 +219,7 @@ bool Foam::pimpleControl::loop()
|
|||||||
}
|
}
|
||||||
|
|
||||||
corr_ = 0;
|
corr_ = 0;
|
||||||
mesh_.data().remove("finalIteration");
|
mesh_.data().setFinalIteration(false);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -231,7 +231,7 @@ bool Foam::pimpleControl::loop()
|
|||||||
Info<< algorithmName_ << ": converged in " << corr_ - 1
|
Info<< algorithmName_ << ": converged in " << corr_ - 1
|
||||||
<< " iterations" << endl;
|
<< " iterations" << endl;
|
||||||
|
|
||||||
mesh_.data().remove("finalIteration");
|
mesh_.data().setFinalIteration(false);
|
||||||
corr_ = 0;
|
corr_ = 0;
|
||||||
converged_ = false;
|
converged_ = false;
|
||||||
|
|
||||||
@ -242,7 +242,7 @@ bool Foam::pimpleControl::loop()
|
|||||||
Info<< algorithmName_ << ": iteration " << corr_ << endl;
|
Info<< algorithmName_ << ": iteration " << corr_ << endl;
|
||||||
storePrevIterFields();
|
storePrevIterFields();
|
||||||
|
|
||||||
mesh_.data().add("finalIteration", true);
|
mesh_.data().setFinalIteration(true);
|
||||||
converged_ = true;
|
converged_ = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -250,7 +250,7 @@ bool Foam::pimpleControl::loop()
|
|||||||
{
|
{
|
||||||
if (finalIter())
|
if (finalIter())
|
||||||
{
|
{
|
||||||
mesh_.data().add("finalIteration", true);
|
mesh_.data().setFinalIteration(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (corr_ <= nCorrPIMPLE_)
|
if (corr_ <= nCorrPIMPLE_)
|
||||||
|
|||||||
@ -42,7 +42,7 @@ Foam::pisoControl::pisoControl(fvMesh& mesh, const word& dictName)
|
|||||||
:
|
:
|
||||||
pimpleControl(mesh, 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))
|
if (force || (check && corr_ <= 1 && corrNonOrtho_ == 0))
|
||||||
{
|
{
|
||||||
DebugInfo<< "solutionControl: set firstIteration flag" << endl;
|
DebugInfo<< "solutionControl: set firstIteration flag" << endl;
|
||||||
mesh_.data().set("firstIteration", true);
|
mesh_.data().setFirstIteration(true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DebugInfo<< "solutionControl: remove firstIteration flag" << endl;
|
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
|
word name = psi_.select
|
||||||
(
|
(
|
||||||
psi_.mesh().data().template getOrDefault<bool>
|
psi_.mesh().data().isFinalIteration()
|
||||||
("finalIteration", false)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
if (psi_.mesh().relaxEquation(name))
|
if (psi_.mesh().relaxEquation(name))
|
||||||
@ -1532,11 +1531,7 @@ const Foam::dictionary& Foam::fvMatrix<Type>::solverDict() const
|
|||||||
{
|
{
|
||||||
return psi_.mesh().solverDict
|
return psi_.mesh().solverDict
|
||||||
(
|
(
|
||||||
psi_.select
|
psi_.select(psi_.mesh().data().isFinalIteration())
|
||||||
(
|
|
||||||
psi_.mesh().data().template getOrDefault<bool>
|
|
||||||
("finalIteration", false)
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -935,11 +935,7 @@ void Foam::radiation::viewFactor::calculate()
|
|||||||
const dictionary& solverControls =
|
const dictionary& solverControls =
|
||||||
qr_.mesh().solverDict
|
qr_.mesh().solverDict
|
||||||
(
|
(
|
||||||
qr_.select
|
qr_.select(qr_.mesh().data().isFinalIteration())
|
||||||
(
|
|
||||||
qr_.mesh().data::template getOrDefault<bool>
|
|
||||||
("finalIteration", false)
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
// Solver call
|
// Solver call
|
||||||
|
|||||||
Reference in New Issue
Block a user