72 store(fieldName_, tfldPtr);
74 if (phaseName_ !=
"none")
84Foam::tmp<Foam::volScalarField> Foam::functionObjects::scalarTransport::D
90 const word Dname(
"D" +
s.name());
103 if (nutName_ !=
"none")
114 findObject<incompressible::turbulenceModel>
125 alphaD_ *
turb->nu() + alphaDt_ *
turb->nut()
133 findObject<compressible::turbulenceModel>
144 alphaD_ *
turb->mu() + alphaDt_ *
turb->mut()
171 fieldName_(
dict.getOrDefault<
word>(
"field",
"s")),
172 schemesField_(
"unknown-schemesField"),
173 phiName_(
dict.getOrDefault<
word>(
"phi",
"phi")),
174 rhoName_(
dict.getOrDefault<
word>(
"rho",
"rho")),
175 nutName_(
dict.getOrDefault<
word>(
"nut",
"none")),
176 phaseName_(
dict.getOrDefault<
word>(
"phase",
"none")),
177 phasePhiCompressedName_
179 dict.getOrDefault<
word>(
"phasePhiCompressed",
"alphaPhiUn")
186 resetOnStartUp_(false),
188 bounded01_(
dict.getOrDefault(
"bounded01", true))
212 dict.readIfPresent(
"phi", phiName_);
213 dict.readIfPresent(
"rho", rhoName_);
214 dict.readIfPresent(
"nut", nutName_);
215 dict.readIfPresent(
"phase", phaseName_);
216 dict.readIfPresent(
"phasePhiCompressed", phasePhiCompressedName_);
218 schemesField_ =
dict.getOrDefault(
"schemesField", fieldName_);
220 dict.readIfPresent(
"alphaD", alphaD_);
221 dict.readIfPresent(
"alphaDt", alphaDt_);
222 dict.readIfPresent(
"tolerance", tol_);
223 dict.readIfPresent(
"nCorr", nCorr_);
224 dict.readIfPresent(
"resetOnStartUp", resetOnStartUp_);
225 constantD_ =
dict.readIfPresent(
"D", D_);
226 dict.readIfPresent(
"bounded01", bounded01_);
228 if (
dict.found(
"fvOptions"))
230 fvOptions_.reset(
dict.subDict(
"fvOptions"));
249 word divScheme(
"div(phi," + schemesField_ +
")");
250 word laplacianScheme(
"laplacian(" +
D.name() +
"," + schemesField_ +
")");
253 scalar relaxCoeff = 0;
254 mesh_.relaxEquation(schemesField_, relaxCoeff);
257 bool converged =
false;
261 if (phaseName_ !=
"none")
272 D.dimensions().reset(limitedPhiAlpha.dimensions()/
dimLength);
276 for (
int i = 0; i <= nCorr_; ++i)
281 +
fvm::div(limitedPhiAlpha,
s, divScheme)
287 sEqn.
relax(relaxCoeff);
288 fvOptions_.constrain(sEqn);
291 converged = (sEqn.
solve(schemesField_).initialResidual() < tol_);
293 tTPhiUD = sEqn.
flux();
295 if (converged)
break;
315 for (
int i = 0; i <= nCorr_; ++i)
326 sEqn.relax(relaxCoeff);
328 fvOptions_.constrain(sEqn);
331 converged = (sEqn.solve(schemesField_).initialResidual() < tol_);
332 if (converged)
break;
337 for (
int i = 0; i <= nCorr_; ++i)
348 sEqn.relax(relaxCoeff);
350 fvOptions_.constrain(sEqn);
353 converged = (sEqn.solve(schemesField_).initialResidual() < tol_);
354 if (converged)
break;
360 <<
"Incompatible dimensions for phi: " <<
phi.dimensions() <<
nl
368 <<
s.name() <<
" is converged." <<
nl
369 <<
tab <<
"initial-residual tolerance: " << tol_ <<
nl
370 <<
tab <<
"outer iteration: " << iter <<
nl;
382 <<
tab << fieldName_ <<
nl
CMULES: Multidimensional universal limiter for explicit corrected implicit solution.
Macros for easy insertion into run-time selection tables.
#define addToRunTimeSelectionTable(baseType, thisType, argNames)
Add to construction table with typeName as the key.
compressible::turbulenceModel & turb
static tmp< GeometricField< scalar, fvPatchField, volMesh > > New(const word &name, IOobjectOption::registerOption regOpt, const Mesh &mesh, const dimensionSet &dims, const word &patchFieldType=fvPatchField< scalar >::calculatedType())
@ NO_REGISTER
Do not request registration (bool: false).
@ REGISTER
Request registration (bool: true).
@ MUST_READ
Reading required.
@ NO_WRITE
Ignore writing from objectRegistry::writeObject().
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
static word timeName(const scalar t, const int precision=precision_)
Return a time name for the given scalar time value formatted with the given precision.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Abstract base-class for Time/database function objects.
virtual bool read(const dictionary &dict)
Read and set the function object if its data have changed.
Specialization of Foam::functionObject for an Foam::fvMesh, providing a reference to the Foam::fvMesh...
const fvMesh & mesh_
Reference to the fvMesh.
fvMeshFunctionObject(const fvMeshFunctionObject &)=delete
No copy construct.
const ObjectType & lookupObject(const word &fieldName) const
Lookup and return object (eg, a field) from the (sub) objectRegistry.
bool foundObject(const word &fieldName) const
Find object (eg, a field) in the (sub) objectRegistry.
bool store(word &fieldName, const tmp< ObjectType > &tfield, bool cacheable=false)
Store the field in the (sub) objectRegistry under the given name.
ObjectType & lookupObjectRef(const word &fieldName) const
Lookup and return object (eg, a field) from the (sub) objectRegistry.
Computes the transport equation for a passive scalar in single-phase or two-phase flow,...
virtual bool execute()
Execute the function-object operations.
virtual bool write()
Write the function object output.
virtual bool read(const dictionary &)
Read the function-object dictionary.
scalarTransport(const word &name, const Time &runTime, const dictionary &dict)
Construct from name, Time and dictionary.
void relax(const scalar alpha)
Relax matrix (for steady-state solution).
tmp< GeometricField< Type, fvsPatchField, surfaceMesh > > flux() const
Return the face-flux field from the matrix.
SolverPerformance< Type > solve(const dictionary &)
Solve returning the solution statistics.
const Time & time() const
Return the top-level database.
A class representing the concept of a GeometricField of 1 used to avoid unnecessary manipulations for...
A class representing the concept of a field of 1 used to avoid unnecessary manipulations for objects ...
void setFluxRequired(const word &name) const
Set flux-required for given name (mutable).
A class for managing temporary objects.
static tmp< T > New(Args &&... args)
Construct tmp with forwarding arguments.
T & ref() const
Return non-const reference to the contents of a non-null managed pointer.
static const word propertiesName
Default name of the turbulence properties dictionary.
A class for handling words, derived from Foam::string.
A class representing the concept of a field of 0 used to avoid unnecessary manipulations for objects ...
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
void explicitSolve(const RdeltaTType &rDeltaT, const RhoType &rho, volScalarField &psi, const surfaceScalarField &phiPsi, const SpType &Sp, const SuType &Su)
Function objects are OpenFOAM utilities to ease workflow configurations and enhance workflows.
tmp< fvMatrix< Type > > laplacian(const GeometricField< Type, fvPatchField, volMesh > &vf, const word &name)
tmp< fvMatrix< Type > > div(const surfaceScalarField &flux, const GeometricField< Type, fvPatchField, volMesh > &vf, const word &name)
tmp< fvMatrix< Type > > ddt(const GeometricField< Type, fvPatchField, volMesh > &vf)
dimensionedScalar pos(const dimensionedScalar &ds)
const dimensionSet dimLength(0, 1, 0, 0, 0, 0, 0)
fvMatrix< scalar > fvScalarMatrix
const dimensionSet dimTime(0, 0, 1, 0, 0, 0, 0)
GeometricField< scalar, fvPatchField, volMesh > volScalarField
GeometricField< scalar, fvsPatchField, surfaceMesh > surfaceScalarField
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
Ostream & endl(Ostream &os)
Add newline and flush stream.
static constexpr const zero Zero
Global zero (0).
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
const dimensionSet dimVolume(pow3(dimLength))
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
errorManipArg< error, int > exit(error &err, const int errNo=1)
const dimensionSet dimMass(1, 0, 0, 0, 0, 0, 0)
constexpr char nl
The newline '\n' character (0x0a).
constexpr char tab
The tab '\t' character(0x09).
const dimensionedScalar & D