46 incompressiblePrimalSolver,
54 Foam::incompressiblePrimalSolver::incompressiblePrimalSolver
57 const word& managerType,
64 dict.subOrEmptyDict(
"fieldReconstruction").
65 getOrDefault<scalar>(
"tolerance", 5.
e-5)
67 phiReconstructionIters_
69 dict.subOrEmptyDict(
"fieldReconstruction").
70 getOrDefault<label>(
"iters", 10)
81 const word& managerType,
86 auto* ctorPtr = dictionaryConstructorTable(solverType);
93 "incompressiblePrimalSolver",
95 *dictionaryConstructorTablePtr_
100 autoPtr<incompressiblePrimalSolver>
123 DynamicList<objective*> objectives(10);
125 auto adjointSolvers = mesh_.lookupClass<adjointSolver>();
127 for (adjointSolver* adjointPtr : adjointSolvers)
129 adjointSolver& adjoint = *adjointPtr;
131 if (adjoint.primalSolverName() == solverName_)
133 PtrList<objective>& managerObjectives =
134 adjoint.getObjectiveManager().getObjectiveFunctions();
136 for (objective& obj : managerObjectives)
138 objectives.append(&obj);
149 return vars_().useSolverNameForFields();
157 refCast<incompressibleVars>(
const_cast<variablesSet&
>(vars_()));
166 refCast<incompressibleVars>(
const_cast<variablesSet&
>(vars_()));
190 scalar contError(GREAT),
diff(GREAT);
191 for (label iter = 0; iter < phiReconstructionIters_; ++iter)
193 Info<<
"phi correction iteration " << iter <<
endl;
228 scalar contErrorNew =
229 mesh_.time().deltaTValue()*
232 Info<<
"sum local = " << contErrorNew <<
endl;
233 diff =
mag(contErrorNew - contError)/contError;
234 contError = contErrorNew;
236 if (
diff < phiReconstructionTol_)
break;
scalar diff(const triad &A, const triad &B)
Return a quantity of the difference between two triads.
List< objective * > getObjectiveFunctions() const
Return the list of objectives assodicated with this solver.
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...
Base class for primal solvers.
tmp< surfaceScalarField > flux(const volVectorField &vvf)
Return the face-flux field obtained from the given volVectorField.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
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.
virtual 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)
void relax(const scalar alpha)
Relax matrix (for steady-state solution).
addToRunTimeSelectionTable(decompositionMethod, kahipDecomp, dictionary)
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)
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.
bool useSolverNameForFields() const
Should solver name be appended to fields.
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.
static autoPtr< incompressiblePrimalSolver > New(fvMesh &mesh, const word &managerType, const dictionary &dict)
Return a reference to the selected incompressible primal solver.
IOerror FatalIOError
Error stream (stdout output on all processes), with additional 'FOAM FATAL IO ERROR' header text and ...
virtual bool readDict(const dictionary &dict)