58 if (incoVars_.useSolverNameForFields())
61 <<
"useSolverNameForFields is set to true for primalSolver " 62 << solverName() <<
nl <<
tab 63 <<
"Appending variable names with the solver name" <<
nl <<
tab 64 <<
"Please adjust the necessary entries in fvSchemes and fvSolution" 76 mag(
contErr)().weightedAverage(mesh_.V()).value();
84 <<
", cumulative = " << cumulativeContErr_
94 const word& managerType,
96 const word& solverName
107 incoVars_(allocateVars()),
108 MRF_(
mesh,
word(useSolverNameForFields() ? solverName_ :
word::null)),
109 cumulativeContErr_(
Zero),
111 allowFunctionObjects_(
dict.getOrDefault(
"allowFunctionObjects", false))
146 Info<<
"Time = " << mesh_.time().timeName() <<
"\n" <<
endl;
157 incoVars_.turbulence();
158 label&
pRefCell = solverControl_().pRefCell();
159 scalar&
pRefValue = solverControl_().pRefValue();
165 MRF_.correctBoundaryVelocity(
U);
199 if (solverControl_().consistent())
213 while (solverControl_().correctNonOrthogonal())
224 if (solverControl_().finalNonOrthogonalIter())
237 U.correctBoundaryConditions();
241 incoVars_.laminarTransport().correct();
250 if (managerType_ ==
"steadyOptimisation" && allowFunctionObjects_)
252 const_cast<Time&
>(mesh_.time()).functionObjects().execute(
false);
255 solverControl_().write();
259 for (
auto& obj : objectives_)
261 Info<< obj.objectiveName() <<
" : " << obj.J() <<
endl;
262 obj.accumulateJMean(solverControl_());
263 obj.writeInstantaneousValue();
267 incoVars_.computeMeanFields();
270 mesh_.time().printExecutionTime(
Info);
280 while (solverControl_().loop())
291 return solverControl_().loop();
297 incoVars_.restoreInitValues();
304 if (objectives_.empty())
306 objectives_ = getObjectiveFunctions();
311 incoVars_.resetMeanFields();
314 incoVars_.turbulence()->validate();
320 for (
auto& obj : objectives_)
322 obj.writeInstantaneousSeparator();
332 os.
writeEntry(
"averageIter", solverControl_().averageIter());
const bool momentumPredictor
void correct(GeometricField< Type, PatchField, GeoMesh > &field)
Apply correction to field.
const volScalarField & pInst() const
Return const reference to pressure.
tmp< GeometricField< typename outerProduct< vector, Type >::type, fvPatchField, volMesh >> grad(const GeometricField< Type, fvsPatchField, surfaceMesh > &ssf)
fvMatrix< scalar > fvScalarMatrix
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
A list of keyword definitions, which are a keyword followed by a number of values (eg...
autoPtr< SIMPLEControl > solverControl_
Solver control.
tmp< surfaceScalarField > flux(const volVectorField &vvf)
Return the face-flux field obtained from the given volVectorField.
virtual void solveIter()
Execute one iteration of the solution algorithm.
tmp< GeometricField< Type, fvPatchField, volMesh > > div(const GeometricField< Type, fvsPatchField, surfaceMesh > &ssf)
constexpr char nl
The newline '\n' character (0x0a)
Ostream & endl(Ostream &os)
Add newline and flush stream.
tmp< GeometricField< Type, fvPatchField, volMesh > > H() const
Return the H operation source.
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tf1, const word &name, const dimensionSet &dimensions, const bool initCopy=false)
Global function forwards to reuseTmpDimensionedField::New.
void continuityErrors()
Compute continuity errors.
tmp< fvVectorMatrix > tUEqn(fvm::ddt(rho, U)+fvm::div(phi, U)+MRF.DDt(rho, U)+turbulence->divDevRhoReff(U)==fvOptions(rho, U))
constexpr char tab
The tab '\t' character(0x09)
Ostream & writeEntry(const keyType &key, const T &value)
Write a keyword/value entry.
autoPtr< variablesSet > vars_
Base variableSet pointer.
tmp< volScalarField > H1() const
Return H(1)
GeometricField< vector, fvPatchField, volMesh > volVectorField
tmp< volScalarField > rAU
bool adjustPhi(surfaceScalarField &phi, const volVectorField &U, volScalarField &p)
Adjust the balance of fluxes to obey continuity.
Find the reference cell nearest (in index) to the given cell but which is not on a cyclic...
virtual void solve()
Main control loop.
virtual bool readDict(const dictionary &dict)
Read dict if updated.
Macros for easy insertion into run-time selection tables.
GeometricField< scalar, fvPatchField, volMesh > volScalarField
volScalarField::Internal contErr((fvc::ddt(rho)+fvc::div(rhoPhi) -(fvOptions(alpha1, mixture.thermo1().rho())&rho1) -(fvOptions(alpha2, mixture.thermo2().rho())&rho2))())
virtual bool writeData(Ostream &os) const
Write average iteration.
Base class for solution control classes.
incompressibleVars & allocateVars()
Protected Member Functions.
virtual void mainIter()
The main SIMPLE iter.
A class for handling words, derived from Foam::string.
virtual void postLoop()
Functions to be called after loop.
virtual void restoreInitValues()
Restore initial field values if necessary.
virtual void postIter()
Steps to be executed before each main SIMPLE iteration.
A special matrix type and solver, designed for finite volume solutions of scalar equations. Face addressing is used to make all matrix assembly and solution loops vectorise.
tmp< volVectorField > constrainHbyA(const tmp< volVectorField > &tHbyA, const volVectorField &U, const volScalarField &p)
virtual bool loop()
Looper (advances iters, time step)
SolverPerformance< Type > solve(faMatrix< Type > &, const dictionary &solverControls)
Solve returning the solution statistics given convergence tolerance.
void constrain(fvMatrix< Type > &eqn)
Apply constraints to equation.
tmp< fvMatrix< Type > > div(const surfaceScalarField &flux, const GeometricField< Type, fvPatchField, volMesh > &vf, const word &name)
void addExtraSchemes()
In case variable names are different than the base ones, add extra schemes and relaxation factors to ...
OBJstream os(runTime.globalPath()/outputName)
Info<< "Reading field U\"<< endl;volVectorField U(IOobject("U", runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::AUTO_WRITE), mesh);volScalarField rho(IOobject("rho", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::AUTO_WRITE), thermo.rho());volVectorField rhoU(IOobject("rhoU", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::NO_WRITE), rho *U);volScalarField rhoE(IOobject("rhoE", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::NO_WRITE), rho *(e+0.5 *magSqr(U)));surfaceScalarField pos(IOobject("pos", runTime.timeName(), mesh), mesh, dimensionedScalar("pos", dimless, 1.0));surfaceScalarField neg(IOobject("neg", runTime.timeName(), mesh), mesh, dimensionedScalar("neg", dimless, -1.0));surfaceScalarField phi("phi", fvc::flux(rhoU));Info<< "Creating turbulence model\"<< endl;autoPtr< compressible::turbulenceModel > turbulence(compressible::turbulenceModel::New(rho, U, phi, thermo))
defineTypeNameAndDebug(combustionModel, 0)
void relax(const scalar alpha)
Relax matrix (for steady-state solution).
void constrainPressure(volScalarField &p, const RhoType &rho, const volVectorField &U, const surfaceScalarField &phiHbyA, const RAUType &rhorAU, const MRFType &MRF)
static tmp< GeometricField< Type, fvsPatchField, surfaceMesh > > interpolate(const GeometricField< Type, fvPatchField, volMesh > &tvf, const surfaceScalarField &faceFlux, Istream &schemeData)
Interpolate field onto faces using scheme given by Istream.
tmp< volScalarField > A() const
Return the central coefficient.
virtual bool readDict(const dictionary &dict)
Read dict if updated.
virtual void preIter()
Steps to be executed before each main SIMPLE iteration.
void relax(const scalar alpha)
Relax field (for steady-state solution).
#define WarningInFunction
Report a warning using Foam::Warning.
tmp< fvMatrix< Type > > laplacian(const GeometricField< Type, fvPatchField, volMesh > &vf, const word &name)
Base class for solution control classes.
Mesh data needed to do the Finite Volume discretisation.
SIMPLE control class to supply convergence information/checks for the SIMPLE loop.
For cases which do no have a pressure boundary adjust the balance of fluxes to obey continuity...
messageStream Info
Information stream (stdout output on master, null elsewhere)
const incompressibleVars & getIncoVars() const
Access to the incompressible variables set.
fvMesh & mesh_
Reference to the mesh database.
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
dimensioned< Type > weightedAverage(const DimensionedField< scalar, GeoMesh > &weightField) const
Calculate and return weighted average.
Base class for primal incompressible solvers.
A class for managing temporary objects.
GeometricField< scalar, fvsPatchField, surfaceMesh > surfaceScalarField
static options & New(const fvMesh &mesh)
Construct fvOptions and register to database if not present.
bool setRefCell(const volScalarField &field, const volScalarField &fieldRef, const dictionary &dict, label &refCelli, scalar &refValue, const bool forceReference=false)
If the field fieldRef needs referencing find the reference cell nearest.
incompressibleVars & incoVars_
Reference to incompressibleVars.
tmp< GeometricField< Type, fvsPatchField, surfaceMesh > > snGrad(const GeometricField< Type, fvPatchField, volMesh > &vf, const word &name)
addToRunTimeSelectionTable(functionObject, pointHistory, dictionary)
virtual void preLoop()
Functions to be called before loop.
volScalarField rAtU(1.0/(1.0/rAU - UEqn.H1()))
static constexpr const zero Zero
Global zero (0)