46 incompressiblePrimalSolver,
54 Foam::incompressiblePrimalSolver::incompressiblePrimalSolver
57 const word& managerType,
59 const word& solverName
65 dict.subOrEmptyDict(
"fieldReconstruction").
66 getOrDefault<scalar>(
"tolerance", 5.
e-5)
68 phiReconstructionIters_
70 dict.subOrEmptyDict(
"fieldReconstruction").
71 getOrDefault<label>(
"iters", 10)
82 const word& managerType,
84 const word& solverName
88 auto* ctorPtr = dictionaryConstructorTable(solverType);
95 "incompressiblePrimalSolver",
97 *dictionaryConstructorTablePtr_
102 autoPtr<incompressiblePrimalSolver>
125 DynamicList<objective*> objectives;
127 for (
auto& adjoint : mesh_.sorted<adjointSolver>())
129 if (adjoint.primalSolverName() == solverName_)
131 PtrList<objective>& managerObjectives =
132 adjoint.getObjectiveManager().getObjectiveFunctions();
134 for (objective& obj : managerObjectives)
136 objectives.push_back(&obj);
149 refCast<incompressibleVars>(
const_cast<variablesSet&
>(vars_()));
158 refCast<incompressibleVars>(
const_cast<variablesSet&
>(vars_()));
182 scalar contError(GREAT),
diff(GREAT);
183 for (label iter = 0; iter < phiReconstructionIters_; ++iter)
185 Info<<
"phi correction iteration " << iter <<
endl;
220 scalar contErrorNew =
221 mesh_.time().deltaTValue()*
224 Info<<
"sum local = " << contErrorNew <<
endl;
225 diff =
mag(contErrorNew - contError)/contError;
226 contError = contErrorNew;
228 if (
diff < phiReconstructionTol_)
break;
scalar diff(const triad &A, const triad &B)
Return a quantity of the difference between two triads.
errorManipArg< error, int > exit(error &err, const int errNo=1)
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...
static autoPtr< incompressiblePrimalSolver > New(fvMesh &mesh, const word &managerType, const dictionary &dict, const word &solverName)
Return a reference to the selected incompressible primal solver.
Base class for primal solvers.
tmp< surfaceScalarField > flux(const volVectorField &vvf)
Return the face-flux field obtained from the given volVectorField.
tmp< GeometricField< Type, fvPatchField, volMesh > > div(const GeometricField< Type, fvsPatchField, surfaceMesh > &ssf)
const fvMesh & mesh() const
Return the solver mesh.
Ostream & endl(Ostream &os)
Add newline and flush stream.
tmp< GeometricField< Type, fvPatchField, volMesh > > H() const
Return the H operation source.
tmp< fvVectorMatrix > tUEqn(fvm::ddt(rho, U)+fvm::div(phi, U)+MRF.DDt(rho, U)+turbulence->divDevRhoReff(U)==fvOptions(rho, U))
T get(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a T. FatalIOError if not found, or if the number of tokens is incorrect.
tmp< volScalarField > rAU
bool adjustPhi(surfaceScalarField &phi, const volVectorField &U, volScalarField &p)
Adjust the balance of fluxes to obey continuity.
Macros for easy insertion into run-time selection tables.
const surfaceScalarField & phi() const
Return const reference to volume flux.
Base class for solution control classes.
const dimensionedScalar e
Elementary charge.
A class for handling words, derived from Foam::string.
const volScalarField & p() const
Return const reference to pressure.
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.
virtual void correctBoundaryConditions()
Update boundary conditions.
const word & managerType() const
Return the manager type.
const dictionary & dict() const
Return the solver dictionary.
const volVectorField & U() const
Return const reference to velocity.
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)
defineRunTimeSelectionTable(reactionRateFlameArea, dictionary)
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)
UPtrList< objective > getObjectiveFunctions() const
Return the list of objectives assodicated with this solver.
void relax(const scalar alpha)
Relax matrix (for steady-state solution).
Base class for creating a set of variables.
tmp< volScalarField > A() const
Return the central coefficient.
virtual bool readDict(const dictionary &dict)
Read dict if updated.
tmp< fvMatrix< Type > > laplacian(const GeometricField< Type, fvPatchField, volMesh > &vf, const word &name)
const word & solverName() const
Return the solver name.
Mesh data needed to do the Finite Volume discretisation.
void correctBoundaryConditions()
correct boundaryconditions for all volFields
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.
const autoPtr< incompressible::turbulenceModel > & turbulence() const
Return const reference to the turbulence model.
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
A class for managing temporary objects.
static options & New(const fvMesh &mesh)
Construct fvOptions and register to database if not present.
#define FatalIOErrorInLookup(ios, lookupTag, lookupName, lookupTable)
Report an error message using Foam::FatalIOError.
addToRunTimeSelectionTable(functionObject, pointHistory, dictionary)
IOerror FatalIOError
Error stream (stdout output on all processes), with additional 'FOAM FATAL IO ERROR' header text and ...
virtual bool readDict(const dictionary &dict)