Rationalised the handling of "Final" solver and relaxation factor settings

Now for transient simulations "Final" solver settings are required for ALL
equations providing consistency between the solution of velocity, energy,
composition and radiation properties.

However "Final" relaxation factors are no longer required for fields or
equations and if not present the standard value for the variable will be
applied.  Given that relaxation factors other than 1 are rarely required for
transient runs and hence the same for all iterations including the final one
this approach provide simpler input while still providing the flexibility to
specify a different value for the final iteration if required.  For steady cases
it is usual to execute just 1 outer iteration per time-step for which the
standard relaxation factors are appropriate, and if more than one iteration is
executed it is common to use the same factors for both.  In the unlikely event
of requiring different relaxation factors for the final iteration this is still
possible to specify via the now optional "Final" specification.
This commit is contained in:
Henry Weller
2018-11-17 19:42:23 +00:00
parent ae28cb34d2
commit ee443e201f
133 changed files with 376 additions and 325 deletions

View File

@ -101,7 +101,7 @@ int main(int argc, char *argv[])
fvm::laplacian(rAUf, p) == fvc::div(phiHbyA)
);
pEqn.solve(mesh.solver(p.select(piso.finalInnerIter())));
pEqn.solve(piso.finalInnerIter());
phi = phiHbyA - pEqn.flux();

View File

@ -27,7 +27,7 @@ if (pimple.transonic())
betav*fvOptions(psi, p, rho.name())
);
pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter())));
pEqn.solve(pimple.finalInnerIter());
if (pimple.finalNonOrthogonalIter())
{
@ -57,7 +57,7 @@ else
betav*fvOptions(psi, p, rho.name())
);
pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter())));
pEqn.solve(pimple.finalInnerIter());
if (pimple.finalNonOrthogonalIter())
{

View File

@ -35,7 +35,7 @@ if (pimple.transonic())
fvOptions(psi, p, rho.name())
);
pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter())));
pEqn.solve(pimple.finalInnerIter());
if (pimple.finalNonOrthogonalIter())
{
@ -71,7 +71,7 @@ else
fvOptions(psi, p, rho.name())
);
pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter())));
pEqn.solve(pimple.finalInnerIter());
if (pimple.finalNonOrthogonalIter())
{

View File

@ -29,7 +29,7 @@ if (pimple.transonic())
fvOptions(psi, p, rho.name())
);
pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter())));
pEqn.solve(pimple.finalInnerIter());
if (pimple.finalNonOrthogonalIter())
{
@ -64,7 +64,7 @@ else
fvOptions(psi, p, rho.name())
);
pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter())));
pEqn.solve(pimple.finalInnerIter());
if (pimple.finalNonOrthogonalIter())
{

View File

@ -3,10 +3,6 @@
{
volScalarField& Yi = Y[specieI];
solve
(
fvm::ddt(rho, Yi) - chemistry.RR(specieI),
mesh.solver("Yi")
);
solve(fvm::ddt(rho, Yi) - chemistry.RR(specieI), "Yi");
}
}

View File

@ -36,7 +36,7 @@ tmp<fv::convectionScheme<scalar>> mvConvection
fvOptions.constrain(YiEqn);
YiEqn.solve(mesh.solver("Yi"));
YiEqn.solve("Yi");
fvOptions.correct(Yi);

View File

@ -36,7 +36,7 @@ while (pimple.correctNonOrthogonal())
+ fvOptions(psi, p_rgh, rho.name())
);
p_rghEqn.solve(mesh.solver(p_rgh.select(pimple.finalInnerIter())));
p_rghEqn.solve(pimple.finalInnerIter());
if (pimple.finalNonOrthogonalIter())
{

View File

@ -34,7 +34,7 @@ tmp<fv::convectionScheme<scalar>> mvConvection
fvOptions.constrain(YiEqn);
YiEqn.solve(mesh.solver("Yi"));
YiEqn.solve("Yi");
fvOptions.correct(Yi);

View File

@ -37,7 +37,7 @@ if (pimple.transonic())
fvOptions(psi, p, rho.name())
);
pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter())));
pEqn.solve(pimple.finalInnerIter());
if (pimple.finalNonOrthogonalIter())
{
@ -72,7 +72,7 @@ else
fvOptions(psi, p, rho.name())
);
pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter())));
pEqn.solve(pimple.finalInnerIter());
if (pimple.finalNonOrthogonalIter())
{

View File

@ -49,7 +49,7 @@ if (pimple.transonic())
fvOptions(psi, p, rho.name())
);
pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter())));
pEqn.solve(pimple.finalInnerIter());
if (pimple.finalNonOrthogonalIter())
{
@ -89,7 +89,7 @@ else
fvOptions(psi, p, rho.name())
);
pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter())));
pEqn.solve(pimple.finalInnerIter());
if (pimple.finalNonOrthogonalIter())
{

View File

@ -41,7 +41,7 @@ while (pimple.correctNonOrthogonal())
- fvm::laplacian(rhorAUf, p_rgh)
);
p_rghEqn.solve(mesh.solver(p_rgh.select(pimple.finalInnerIter())));
p_rghEqn.solve(pimple.finalInnerIter());
if (pimple.finalNonOrthogonalIter())
{

View File

@ -54,7 +54,7 @@ if (pimple.transonic())
// Relax the pressure equation to ensure diagonal-dominance
pEqn.relax();
pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter())));
pEqn.solve(pimple.finalInnerIter());
if (pimple.finalNonOrthogonalIter())
{
@ -76,7 +76,7 @@ else
{
fvScalarMatrix pEqn(pDDtEqn - fvm::laplacian(rhorAUf, p));
pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter())));
pEqn.solve(pimple.finalInnerIter());
if (pimple.finalNonOrthogonalIter())
{

View File

@ -65,7 +65,7 @@ if (pimple.transonic())
// Relax the pressure equation to ensure diagonal-dominance
pEqn.relax();
pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter())));
pEqn.solve(pimple.finalInnerIter());
if (pimple.finalNonOrthogonalIter())
{
@ -90,7 +90,7 @@ else
{
fvScalarMatrix pEqn(pDDtEqn - fvm::laplacian(rhorAtU, p));
pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter())));
pEqn.solve(pimple.finalInnerIter());
if (pimple.finalNonOrthogonalIter())
{

View File

@ -114,7 +114,7 @@ int main(int argc, char *argv[])
);
pEqn.setReference(pRefCell, pRefValue);
pEqn.solve(mesh.solver(p.select(piso.finalInnerIter())));
pEqn.solve(piso.finalInnerIter());
if (piso.finalNonOrthogonalIter())
{
@ -154,7 +154,7 @@ int main(int argc, char *argv[])
fvm::laplacian(rABf, pB) == fvc::div(phiB)
);
pBEqn.solve(mesh.solver(pB.select(bpiso.finalInnerIter())));
pBEqn.solve(bpiso.finalInnerIter());
if (bpiso.finalNonOrthogonalIter())
{

View File

@ -27,7 +27,7 @@
p_rghEqn.setReference(pRefCell, getRefCellValue(p_rgh, pRefCell));
p_rghEqn.solve(mesh.solver(p_rgh.select(pimple.finalInnerIter())));
p_rghEqn.solve(pimple.finalInnerIter());
if (pimple.finalNonOrthogonalIter())
{

View File

@ -46,7 +46,7 @@ while (pimple.correctNonOrthogonal())
p_rghEqn.setReference(pRefCell, getRefCellValue(p_rgh, pRefCell));
}
p_rghEqn.solve(mesh.solver(p_rgh.select(pimple.finalInnerIter())));
p_rghEqn.solve(pimple.finalInnerIter());
if (pimple.finalNonOrthogonalIter())
{

View File

@ -52,7 +52,7 @@ if (Y.size())
fvOptions.constrain(YiEqn);
YiEqn.solve(mesh.solver("Yi"));
YiEqn.solve("Yi");
fvOptions.correct(Yi);

View File

@ -69,7 +69,7 @@ constrainPressure(p_rgh, rho, U, phiHbyA, rhorAUf, MRF);
pressureControl.refValue()
);
p_rghEqn.solve(mesh.solver(p_rgh.select(pimple.finalInnerIter())));
p_rghEqn.solve(pimple.finalInnerIter());
if (pimple.finalNonOrthogonalIter())
{

View File

@ -1,4 +1,3 @@
fvMesh& mesh = solidRegions[i];
solidThermo& thermo = thermos[i];
tmp<volScalarField> trho = thermo.rho();

View File

@ -17,7 +17,7 @@
fvOptions.constrain(hEqn);
hEqn.solve(mesh.solver(h.select(pimples.finalIter())));
hEqn.solve(pimples.finalIter());
fvOptions.correct(h);
}

View File

@ -98,7 +98,7 @@ int main(int argc, char *argv[])
pEqn.setReference(pRefCell, pRefValue);
pEqn.solve(mesh.solver(p.select(piso.finalInnerIter())));
pEqn.solve(piso.finalInnerIter());
if (piso.finalNonOrthogonalIter())
{

View File

@ -102,7 +102,7 @@ int main(int argc, char *argv[])
pEqn.setReference(pRefCell, pRefValue);
pEqn.solve(mesh.solver(p.select(piso.finalInnerIter())));
pEqn.solve(piso.finalInnerIter());
if (piso.finalNonOrthogonalIter())
{

View File

@ -40,7 +40,7 @@ while (pimple.correctNonOrthogonal())
pEqn.setReference(pRefCell, pRefValue);
pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter())));
pEqn.solve(pimple.finalInnerIter());
if (pimple.finalNonOrthogonalIter())
{

View File

@ -44,7 +44,7 @@ while (pimple.correctNonOrthogonal())
pEqn.setReference(pRefCell, pRefValue);
pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter())));
pEqn.solve(pimple.finalInnerIter());
if (pimple.finalNonOrthogonalIter())
{

View File

@ -26,7 +26,7 @@ while (piso.correctNonOrthogonal())
pEqn.setReference(pRefCell, pRefValue);
pEqn.solve(mesh.solver(p.select(piso.finalInnerIter())));
pEqn.solve(piso.finalInnerIter());
if (piso.finalNonOrthogonalIter())
{

View File

@ -124,7 +124,7 @@ int main(int argc, char *argv[])
- fvm::laplacian(ghrAUf, h)
);
hEqn.solve(mesh.solver(h.select(pimple.finalInnerIter())));
hEqn.solve(pimple.finalInnerIter());
if (pimple.finalNonOrthogonalIter())
{

View File

@ -34,7 +34,7 @@
pEqn.setReference(pRefCell, pRefValue);
pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter())));
pEqn.solve(pimple.finalInnerIter());
if (pimple.finalNonOrthogonalIter())
{

View File

@ -36,7 +36,7 @@ tmp<fv::convectionScheme<scalar>> mvConvection
fvOptions.constrain(YiEqn);
YiEqn.solve(mesh.solver("Yi"));
YiEqn.solve("Yi");
fvOptions.correct(Yi);

View File

@ -33,7 +33,7 @@ if (pimple.transonic())
+ fvOptions(psi, p, rho.name())
);
pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter())));
pEqn.solve(pimple.finalInnerIter());
if (pimple.finalNonOrthogonalIter())
{
@ -69,7 +69,7 @@ else
+ fvOptions(psi, p, rho.name())
);
pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter())));
pEqn.solve(pimple.finalInnerIter());
if (pimple.finalNonOrthogonalIter())
{

View File

@ -37,7 +37,7 @@ tmp<fv::convectionScheme<scalar>> mvConvection
fvOptions.constrain(YEqn);
YEqn.solve(mesh.solver("Yi"));
YEqn.solve("Yi");
fvOptions.correct(Yi);

View File

@ -46,7 +46,7 @@ while (pimple.correctNonOrthogonal())
- fvm::laplacian(rhorAUf, p_rgh)
);
p_rghEqn.solve(mesh.solver(p_rgh.select(pimple.finalInnerIter())));
p_rghEqn.solve(pimple.finalInnerIter());
if (pimple.finalNonOrthogonalIter())
{

View File

@ -34,7 +34,7 @@ tmp<fv::convectionScheme<scalar>> mvConvection
fvOptions.constrain(YEqn);
YEqn.solve(mesh.solver("Yi"));
YEqn.solve("Yi");
fvOptions.correct(Yi);

View File

@ -35,7 +35,7 @@ tmp<fv::convectionScheme<scalar>> mvConvection
fvOptions.constrain(YEqn);
YEqn.solve(mesh.solver("Yi"));
YEqn.solve("Yi");
fvOptions.correct(Yi);

View File

@ -42,7 +42,7 @@ if (pimple.transonic())
+ fvOptions(psi, p, rho.name())
);
pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter())));
pEqn.solve(pimple.finalInnerIter());
if (pimple.finalNonOrthogonalIter())
{
@ -77,7 +77,7 @@ else
+ fvOptions(psi, p, rho.name())
);
pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter())));
pEqn.solve(pimple.finalInnerIter());
if (pimple.finalNonOrthogonalIter())
{

View File

@ -35,7 +35,7 @@
- fvm::laplacian(rhorAUf, p)
);
pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter())));
pEqn.solve(pimple.finalInnerIter());
if (pimple.finalNonOrthogonalIter())
{

View File

@ -108,7 +108,7 @@
solve
(
p_rghEqnComp1() + p_rghEqnComp2() + p_rghEqnIncomp,
mesh.solver(p_rgh.select(pimple.finalInnerIter()))
pimple.finalInnerIter()
);
if (pimple.finalNonOrthogonalIter())

View File

@ -122,7 +122,7 @@
solve
(
p_rghEqnComp1() + p_rghEqnComp2() + p_rghEqnIncomp,
mesh.solver(p_rgh.select(pimple.finalInnerIter()))
pimple.finalInnerIter()
);
if (pimple.finalNonOrthogonalIter())

View File

@ -90,7 +90,7 @@
(
p_rghEqnComp
+ p_rghEqnIncomp,
mesh.solver(p_rgh.select(pimple.finalInnerIter()))
pimple.finalInnerIter()
);
if (pimple.finalNonOrthogonalIter())

View File

@ -54,7 +54,7 @@
- fvm::laplacian(turbulence->nut(), alpha1)
);
alpha1Eqn.solve(mesh.solver("alpha1Diffusion"));
alpha1Eqn.solve("alpha1Diffusion");
alphaPhi += alpha1Eqn.flux();
alpha2 = 1.0 - alpha1;

View File

@ -32,7 +32,7 @@
p_rghEqn.setReference(pRefCell, getRefCellValue(p_rgh, pRefCell));
p_rghEqn.solve(mesh.solver(p_rgh.select(pimple.finalInnerIter())));
p_rghEqn.solve(pimple.finalInnerIter());
if (pimple.finalNonOrthogonalIter())
{

View File

@ -47,7 +47,7 @@
p_rghEqn.setReference(pRefCell, getRefCellValue(p_rgh, pRefCell));
p_rghEqn.solve(mesh.solver(p_rgh.select(pimple.finalInnerIter())));
p_rghEqn.solve(pimple.finalInnerIter());
if (pimple.finalNonOrthogonalIter())
{

View File

@ -52,7 +52,7 @@
p_rghEqn.setReference(pRefCell, pRefValue);
p_rghEqn.solve(mesh.solver(p_rgh.select(pimple.finalInnerIter())));
p_rghEqn.solve(pimple.finalInnerIter());
if (pimple.finalNonOrthogonalIter())
{

View File

@ -230,7 +230,7 @@
// + (alpha2/rho2)*pEqnComp2()
// ) +
pEqnIncomp,
mesh.solver(p_rgh.select(pimple.finalInnerIter()))
pimple.finalInnerIter()
);
if (pimple.finalNonOrthogonalIter())

View File

@ -36,7 +36,7 @@ while (pimple.correctNonOrthogonal())
p_ghEqn.setReference(p_ghRefCell, p_ghRefValue);
p_ghEqn.solve(mesh.solver(p_gh.select(pimple.finalInnerIter())));
p_ghEqn.solve(pimple.finalInnerIter());
if (pimple.finalNonOrthogonalIter())
{

View File

@ -24,7 +24,7 @@
);
YiEqn.relax();
YiEqn.solve(mesh.solver("Yi"));
YiEqn.solve("Yi");
}
}
}

View File

@ -373,7 +373,7 @@ while (pimple.correct())
solve
(
pEqn,
mesh.solver(p_rgh.select(pimple.finalInnerIter()))
pimple.finalInnerIter()
);
}

View File

@ -361,7 +361,7 @@ while (pimple.correct())
solve
(
pEqn,
mesh.solver(p_rgh.select(pimple.finalInnerIter()))
pimple.finalInnerIter()
);
}

View File

@ -20,7 +20,7 @@
);
Y1iEqn.relax();
Y1iEqn.solve(mesh.solver("Yi"));
Y1iEqn.solve("Yi");
}
}
@ -39,7 +39,7 @@
);
Y2iEqn.relax();
Y2iEqn.solve(mesh.solver("Yi"));
Y2iEqn.solve("Yi");
}
}
}

View File

@ -329,7 +329,7 @@ while (pimple.correct())
solve
(
pEqn,
mesh.solver(p_rgh.select(pimple.finalInnerIter()))
pimple.finalInnerIter()
);
}

View File

@ -339,7 +339,7 @@ while (pimple.correct())
solve
(
pEqn,
mesh.solver(p_rgh.select(pimple.finalInnerIter()))
pimple.finalInnerIter()
);
}

View File

@ -29,7 +29,7 @@
p_rghEqn.setReference(pRefCell, getRefCellValue(p_rgh, pRefCell));
p_rghEqn.solve(mesh.solver(p_rgh.select(pimple.finalInnerIter())));
p_rghEqn.solve(pimple.finalInnerIter());
if (pimple.finalNonOrthogonalIter())
{

View File

@ -312,7 +312,7 @@ while (pimple.correct())
solve
(
pEqnComp1() + pEqnComp2() + pEqnIncomp,
mesh.solver(p_rgh.select(pimple.finalInnerIter()))
pimple.finalInnerIter()
);
// Correct fluxes and velocities on last non-orthogonal iteration

View File

@ -291,7 +291,7 @@ while (pimple.correct())
solve
(
pEqnComp1() + pEqnComp2() + pEqnIncomp,
mesh.solver(p_rgh.select(pimple.finalInnerIter()))
pimple.finalInnerIter()
);
if (pimple.finalNonOrthogonalIter())

View File

@ -959,8 +959,6 @@ void Foam::GeometricField<Type, PatchField, GeoMesh>::relax(const scalar alpha)
template<class Type, template<class> class PatchField, class GeoMesh>
void Foam::GeometricField<Type, PatchField, GeoMesh>::relax()
{
word name = this->name();
if
(
this->mesh().data::template lookupOrDefault<bool>
@ -968,14 +966,14 @@ void Foam::GeometricField<Type, PatchField, GeoMesh>::relax()
"finalIteration",
false
)
&& this->mesh().relaxField(this->name() + "Final")
)
{
name += "Final";
relax(this->mesh().fieldRelaxationFactor(this->name() + "Final"));
}
if (this->mesh().relaxField(name))
else if (this->mesh().relaxField(this->name()))
{
relax(this->mesh().fieldRelaxationFactor(name));
relax(this->mesh().fieldRelaxationFactor(this->name()));
}
}

View File

@ -350,17 +350,6 @@ const Foam::dictionary& Foam::solution::solverDict(const word& name) const
}
const Foam::dictionary& Foam::solution::solver(const word& name) const
{
if (debug)
{
Info<< "Lookup solver for " << name << endl;
}
return solvers_.subDict(name);
}
bool Foam::solution::read()
{
if (regIOobject::read())

View File

@ -140,9 +140,6 @@ public:
//- Return the solver controls dictionary for the given field
const dictionary& solverDict(const word& name) const;
//- Return the solver controls dictionary for the given field
const dictionary& solver(const word& name) const;
// Read

View File

@ -103,10 +103,7 @@ void Foam::CorrectPhi
pcorrEqn.setReference(0, 0);
pcorrEqn.solve
(
mesh.solver(pcorr.select(pimple.finalNonOrthogonalIter()))
);
pcorrEqn.solve(pimple.finalNonOrthogonalIter());
if (pimple.finalNonOrthogonalIter())
{
@ -178,10 +175,7 @@ void Foam::CorrectPhi
divRhoU
);
pcorrEqn.solve
(
mesh.solver(pcorr.select(pimple.finalNonOrthogonalIter()))
);
pcorrEqn.solve(pimple.finalNonOrthogonalIter());
if (pimple.finalNonOrthogonalIter())
{

View File

@ -673,15 +673,18 @@ void Foam::fvMatrix<Type>::relax(const scalar alpha)
template<class Type>
void Foam::fvMatrix<Type>::relax()
{
word name = psi_.select
if
(
psi_.mesh().data::template lookupOrDefault<bool>
("finalIteration", false)
);
if (psi_.mesh().relaxEquation(name))
&& psi_.mesh().relaxEquation(psi_.name() + "Final")
)
{
relax(psi_.mesh().equationRelaxationFactor(name));
relax(psi_.mesh().equationRelaxationFactor(psi_.name() + "Final"));
}
else if (psi_.mesh().relaxEquation(psi_.name()))
{
relax(psi_.mesh().equationRelaxationFactor(psi_.name()));
}
}
@ -1332,50 +1335,6 @@ void Foam::checkMethod
}
template<class Type>
Foam::SolverPerformance<Type> Foam::solve
(
fvMatrix<Type>& fvm,
const dictionary& solverControls
)
{
return fvm.solve(solverControls);
}
template<class Type>
Foam::SolverPerformance<Type> Foam::solve
(
const tmp<fvMatrix<Type>>& tfvm,
const dictionary& solverControls
)
{
SolverPerformance<Type> solverPerf =
const_cast<fvMatrix<Type>&>(tfvm()).solve(solverControls);
tfvm.clear();
return solverPerf;
}
template<class Type>
Foam::SolverPerformance<Type> Foam::solve(fvMatrix<Type>& fvm)
{
return fvm.solve();
}
template<class Type>
Foam::SolverPerformance<Type> Foam::solve(const tmp<fvMatrix<Type>>& tfvm)
{
SolverPerformance<Type> solverPerf =
const_cast<fvMatrix<Type>&>(tfvm()).solve();
tfvm.clear();
return solverPerf;
}
template<class Type>
Foam::tmp<Foam::fvMatrix<Type>> Foam::correction
(

View File

@ -402,6 +402,19 @@ public:
// Use the given solver controls
SolverPerformance<Type> solveCoupled(const dictionary&);
//- Solve segregated or coupled returning the solution statistics.
// Solver controls read from fvSolution
SolverPerformance<Type> solve(const word& name);
//- Solve segregated or coupled returning the solution statistics.
// Solver controls read from fvSolution
// Required to avoid ambiguity from char* -> bool conversion
SolverPerformance<Type> solve(const char* name);
//- Solve returning the solution statistics.
// Solver controls read from fvSolution
SolverPerformance<Type> solve(const bool final);
//- Solve returning the solution statistics.
// Solver controls read from fvSolution
SolverPerformance<Type> solve();
@ -552,8 +565,13 @@ void checkMethod
//- Solve returning the solution statistics given convergence tolerance
// Use the given solver controls
template<class Type>
SolverPerformance<Type> solve(fvMatrix<Type>&, const dictionary&);
SolverPerformance<Type> solve(fvMatrix<Type>&, const word&);
//- Solve returning the solution statistics given convergence tolerance
// Use the given solver controls
// Required to avoid ambiguity from char* -> bool conversion
template<class Type>
SolverPerformance<Type> solve(fvMatrix<Type>&, const char*);
//- Solve returning the solution statistics given convergence tolerance,
// deleting temporary matrix after solution.
@ -562,29 +580,47 @@ template<class Type>
SolverPerformance<Type> solve
(
const tmp<fvMatrix<Type>>&,
const dictionary&
const word&
);
//- Solve returning the solution statistics given convergence tolerance,
// deleting temporary matrix after solution.
// Use the given solver controls
// Required to avoid ambiguity from char* -> bool conversion
template<class Type>
SolverPerformance<Type> solve
(
const tmp<fvMatrix<Type>>&,
const char*
);
//- Solve returning the solution statistics given convergence tolerance
// Solver controls read fvSolution
template<class Type>
SolverPerformance<Type> solve(fvMatrix<Type>&, const bool final);
//- Solve returning the solution statistics given convergence tolerance,
// deleting temporary matrix after solution.
// Solver controls read fvSolution
template<class Type>
SolverPerformance<Type> solve(const tmp<fvMatrix<Type>>&, const bool final);
//- Solve returning the solution statistics given convergence tolerance
// Solver controls read fvSolution
template<class Type>
SolverPerformance<Type> solve(fvMatrix<Type>&);
//- Solve returning the solution statistics given convergence tolerance,
// deleting temporary matrix after solution.
// Solver controls read fvSolution
template<class Type>
SolverPerformance<Type> solve(const tmp<fvMatrix<Type>>&);
//- Return the correction form of the given matrix
// by subtracting the matrix multiplied by the current field
template<class Type>
tmp<fvMatrix<Type>> correction(const fvMatrix<Type>&);
//- Return the correction form of the given temporary matrix
// by subtracting the matrix multiplied by the current field
template<class Type>

View File

@ -311,17 +311,44 @@ Foam::SolverPerformance<Type> Foam::fvMatrix<Type>::fvSolver::solve()
template<class Type>
Foam::SolverPerformance<Type> Foam::fvMatrix<Type>::solve()
Foam::SolverPerformance<Type> Foam::fvMatrix<Type>::solve(const word& name)
{
return solve
(
psi_.mesh().solverDict
(
psi_.select
(
psi_.mesh().data::template lookupOrDefault<bool>
("finalIteration", false)
)
psi_.mesh().data::template lookupOrDefault<bool>
("finalIteration", false)
? word(name + "Final")
: name
)
);
}
template<class Type>
Foam::SolverPerformance<Type> Foam::fvMatrix<Type>::solve(const char* name)
{
return solve(word(name));
}
template<class Type>
Foam::SolverPerformance<Type> Foam::fvMatrix<Type>::solve(const bool final)
{
return solve(psi_.mesh().solverDict(psi_.select(final)));
}
template<class Type>
Foam::SolverPerformance<Type> Foam::fvMatrix<Type>::solve()
{
return solve
(
psi_.mesh().data::template lookupOrDefault<bool>
(
"finalIteration",
false
)
);
}
@ -366,4 +393,100 @@ Foam::tmp<Foam::Field<Type>> Foam::fvMatrix<Type>::residual() const
}
// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
template<class Type>
Foam::SolverPerformance<Type> Foam::solve
(
fvMatrix<Type>& fvm,
const word& name
)
{
return fvm.solve(name);
}
template<class Type>
Foam::SolverPerformance<Type> Foam::solve
(
fvMatrix<Type>& fvm,
const char* name
)
{
return fvm.solve(name);
}
template<class Type>
Foam::SolverPerformance<Type> Foam::solve
(
const tmp<fvMatrix<Type>>& tfvm,
const word& name
)
{
SolverPerformance<Type> solverPerf =
const_cast<fvMatrix<Type>&>(tfvm()).solve(name);
tfvm.clear();
return solverPerf;
}
template<class Type>
Foam::SolverPerformance<Type> Foam::solve
(
const tmp<fvMatrix<Type>>& tfvm,
const char* name
)
{
SolverPerformance<Type> solverPerf =
const_cast<fvMatrix<Type>&>(tfvm()).solve(name);
tfvm.clear();
return solverPerf;
}
template<class Type>
Foam::SolverPerformance<Type> Foam::solve(fvMatrix<Type>& fvm, const bool final)
{
return fvm.solve(final);
}
template<class Type>
Foam::SolverPerformance<Type> Foam::solve
(
const tmp<fvMatrix<Type>>& tfvm,
const bool final
)
{
SolverPerformance<Type> solverPerf =
const_cast<fvMatrix<Type>&>(tfvm()).solve(final);
tfvm.clear();
return solverPerf;
}
template<class Type>
Foam::SolverPerformance<Type> Foam::solve(fvMatrix<Type>& fvm)
{
return fvm.solve();
}
template<class Type>
Foam::SolverPerformance<Type> Foam::solve(const tmp<fvMatrix<Type>>& tfvm)
{
SolverPerformance<Type> solverPerf =
const_cast<fvMatrix<Type>&>(tfvm()).solve();
tfvm.clear();
return solverPerf;
}
// ************************************************************************* //

View File

@ -224,7 +224,7 @@ bool Foam::functionObjects::scalarTransport::execute()
fvOptions_.constrain(sEqn);
sEqn.solve(mesh_.solverDict(schemesField_));
sEqn.solve(schemesField_);
}
}
else if (phi.dimensions() == dimVolume/dimTime)
@ -244,7 +244,7 @@ bool Foam::functionObjects::scalarTransport::execute()
fvOptions_.constrain(sEqn);
sEqn.solve(mesh_.solverDict(schemesField_));
sEqn.solve(schemesField_);
}
}
else

View File

@ -296,13 +296,12 @@ void reactingOneDim::solveSpeciesMass()
}
YiEqn.solve(regionMesh().solver("Yi"));
YiEqn.solve("Yi");
Yi.max(0.0);
Yt += Yi;
}
Ys_[Ys_.size() - 1] = 1.0 - Yt;
}

View File

@ -269,11 +269,7 @@ Foam::scalar Foam::radiation::radiativeIntensityRay::correct()
IiEq.relax();
const solverPerformance ILambdaSol = solve
(
IiEq,
mesh_.solver("Ii")
);
const solverPerformance ILambdaSol = solve(IiEq, "Ii");
const scalar initialRes =
ILambdaSol.initialResidual()*omega_/dom_.omegaMax();

View File

@ -17,7 +17,7 @@ FoamFile
solvers
{
Yi
"Yi.*"
{
solver PBiCGStab;
preconditioner DILU;

View File

@ -17,7 +17,7 @@ FoamFile
solvers
{
Yi
"Yi.*"
{
solver PBiCGStab;
preconditioner DILU;

View File

@ -17,7 +17,7 @@ FoamFile
solvers
{
Yi
"Yi.*"
{
solver PBiCGStab;
preconditioner DILU;

View File

@ -17,7 +17,7 @@ FoamFile
solvers
{
Yi
"Yi.*"
{
solver PBiCGStab;
preconditioner DILU;

View File

@ -17,7 +17,7 @@ FoamFile
solvers
{
Yi
"Yi.*"
{
solver PBiCGStab;
preconditioner DILU;

View File

@ -70,7 +70,7 @@ solvers
relTol 0;
};
Ii
"Ii.*"
{
solver GAMG;
tolerance 1e-4;

View File

@ -60,7 +60,7 @@ solvers
relTol 0;
};
Ii
"Ii.*"
{
solver GAMG;
tolerance 1e-4;

View File

@ -71,7 +71,7 @@ solvers
};
Ii
"Ii.*"
{
solver GAMG;
tolerance 1e-4;
@ -81,7 +81,7 @@ solvers
nPostSweeps 1;
}
G
"G.*"
{
solver PCG;
preconditioner DIC;

View File

@ -62,7 +62,7 @@ solvers
relTol 0;
};
Ii
"Ii.*"
{
solver GAMG;
tolerance 1e-4;
@ -72,7 +72,7 @@ solvers
nPostSweeps 1;
}
G
"G.*"
{
solver PCG;
preconditioner DIC;

View File

@ -49,7 +49,7 @@ solvers
$U;
}
Yi
"Yi.*"
{
solver PBiCG;
preconditioner DILU;

View File

@ -49,7 +49,7 @@ solvers
$U;
}
Yi
"Yi.*"
{
solver PBiCGStab;
preconditioner DILU;
@ -57,7 +57,7 @@ solvers
relTol 0.1;
}
G
"G.*"
{
solver PCG;
preconditioner DIC;

View File

@ -51,7 +51,7 @@ solvers
relTol 0;
}
Yi
"Yi.*"
{
$hFinal;
}

View File

@ -51,7 +51,7 @@ solvers
relTol 0;
}
Yi
"Yi.*"
{
$hFinal;
}

View File

@ -50,7 +50,7 @@ solvers
relTol 0.1;
}
Yi
"Yi.*"
{
$U;
relTol 0.1;

View File

@ -50,7 +50,7 @@ solvers
relTol 0.1;
}
Yi
"Yi.*"
{
$U;
relTol 0.1;

View File

@ -51,7 +51,7 @@ solvers
relTol 0;
}
Yi
"Yi.*"
{
$hFinal;
}

View File

@ -51,7 +51,7 @@ solvers
relTol 0;
}
Yi
"Yi.*"
{
$hFinal;
}

View File

@ -75,14 +75,14 @@ relaxationFactors
{
fields
{
"p.*" 1;
"rho.*" 1;
p 1;
rho 1;
}
equations
{
"U.*" 0.9;
"e.*" 0.7;
"(k|epsilon|omega).*" 0.8;
U 0.9;
e 0.7;
"(k|epsilon|omega)" 0.8;
}
}

View File

@ -97,10 +97,7 @@ relaxationFactors
{
equations
{
"U.*" 1;
"h.*" 1;
"k.*" 1;
"epsilon.*" 1;
".*" 1;
}
}

View File

@ -33,7 +33,7 @@ solvers
relTol 0.1;
}
G
"G.*"
{
$p_rgh;
tolerance 1e-05;

View File

@ -25,7 +25,7 @@ solvers
relTol 0.01;
}
Ii
"Ii.*"
{
solver GAMG;
tolerance 1e-4;

View File

@ -44,16 +44,16 @@ relaxationFactors
{
fields
{
"rho.*" 1;
"p_rgh.*" 0.7;
rho 1;
p_rgh 0.7;
}
equations
{
"U.*" 0.3;
"(h|e).*" 0.3;
"k.*" 0.3;
"epsilon.*" 0.3;
U 0.3;
"(h|e)" 0.3;
k 0.3;
epsilon 0.3;
}
}

View File

@ -44,15 +44,16 @@ relaxationFactors
{
fields
{
"rho.*" 1;
"p_rgh.*" 0.7;
rho 1;
p_rgh 0.7;
}
equations
{
"U.*" 0.3;
"(h|e).*" 0.3;
"k.*" 0.3;
"epsilon.*" 0.3;
U 0.3;
"(h|e)" 0.3;
k 0.3;
epsilon 0.3;
}
}

View File

@ -65,8 +65,8 @@ relaxationFactors
{
equations
{
"h.*" 1;
"U.*" 1;
h 1;
U 1;
}
}

View File

@ -75,8 +75,8 @@ relaxationFactors
{
equations
{
"h.*" 1;
"U.*" 1;
h 1;
U 1;
}
}

View File

@ -47,15 +47,15 @@ relaxationFactors
{
fields
{
"rho.*" 1.0;
"p_rgh.*" 0.7;
rho 1.0;
p_rgh 0.7;
}
equations
{
"U.*" 0.3;
"h.*" 0.7;
"(k|epsilon|omega).*" 0.7;
"qr.*" 0.7;
U 0.3;
h 0.7;
"(k|epsilon|omega)" 0.7;
qr 0.7;
}
}

View File

@ -34,7 +34,7 @@ relaxationFactors
{
equations
{
"h.*" 0.7;
h 0.7;
}
}

View File

@ -73,8 +73,8 @@ relaxationFactors
{
equations
{
"h.*" 1;
"U.*" 1;
h 1;
U 1;
}
}

View File

@ -68,8 +68,8 @@ relaxationFactors
{
equations
{
"h.*" 1;
"U.*" 1;
h 1;
U 1;
}
}

View File

@ -73,9 +73,7 @@ relaxationFactors
{
equations
{
"Urel.*" 1;
"k.*" 1;
"epsilon.*" 1;
".*" 1;
}
}

View File

@ -62,9 +62,7 @@ relaxationFactors
{
equations
{
"U.*" 1;
"k.*" 1;
"epsilon.*" 1;
".*" 1;
}
}

View File

@ -94,7 +94,7 @@ baffles
{
p
{
type fan;
type fanPressureJump;
patchType cyclic;
jump uniform 0;
value uniform 0;

View File

@ -62,9 +62,7 @@ relaxationFactors
{
equations
{
"U.*" 1;
"k.*" 1;
"epsilon.*" 1;
".*" 1;
}
}

View File

@ -80,7 +80,7 @@ relaxationFactors
{
equations
{
"U.*" 1;
".*" 1;
}
}

View File

@ -76,7 +76,7 @@ relaxationFactors
{
equations
{
"U.*" 1;
".*" 1;
}
}

View File

@ -75,11 +75,12 @@ relaxationFactors
{
p 0.3;
}
equations
{
U 0.7;
k 0.7;
"epsilon.*" 0.7;
epsilon 0.7;
}
}

View File

@ -50,7 +50,7 @@ solvers
relTol 0.1;
}
Yi
"Yi.*"
{
$U;
relTol 0.1;

Some files were not shown because too many files have changed in this diff Show More