44 namespace functionObjects
62 if (!foundObject<volScalarField>(fieldName_))
77 store(fieldName_, tfldPtr);
79 if (phaseName_ !=
"none")
85 return lookupObjectRef<volScalarField>(fieldName_);
95 const word Dname(
"D" +
s.name());
108 if (nutName_ !=
"none")
119 findObject<incompressible::turbulenceModel>
130 alphaD_ *
turb->nu() + alphaDt_ *
turb->nut()
138 findObject<compressible::turbulenceModel>
149 alphaD_ *
turb->mu() + alphaDt_ *
turb->mut()
167 Foam::functionObjects::scalarTransport::scalarTransport
175 fieldName_(
dict.getOrDefault<
word>(
"field",
"s")),
176 phiName_(
dict.getOrDefault<
word>(
"phi",
"phi")),
177 rhoName_(
dict.getOrDefault<
word>(
"rho",
"rho")),
178 nutName_(
dict.getOrDefault<
word>(
"nut",
"none")),
179 phaseName_(
dict.getOrDefault<
word>(
"phase",
"none")),
180 phasePhiCompressedName_
182 dict.getOrDefault<
word>(
"phasePhiCompressed",
"alphaPhiUn")
187 resetOnStartUp_(false),
188 schemesField_(
"unknown-schemesField"),
190 bounded01_(
dict.getOrDefault(
"bounded01", true))
217 dict.readIfPresent(
"phi", phiName_);
218 dict.readIfPresent(
"rho", rhoName_);
219 dict.readIfPresent(
"nut", nutName_);
220 dict.readIfPresent(
"phase", phaseName_);
221 dict.readIfPresent(
"bounded01", bounded01_);
223 schemesField_ =
dict.getOrDefault(
"schemesField", fieldName_);
224 constantD_ =
dict.readIfPresent(
"D", D_);
225 alphaD_ =
dict.getOrDefault<scalar>(
"alphaD", 1);
226 alphaDt_ =
dict.getOrDefault<scalar>(
"alphaDt", 1);
228 dict.readIfPresent(
"nCorr", nCorr_);
229 dict.readIfPresent(
"resetOnStartUp", resetOnStartUp_);
231 if (
dict.found(
"fvOptions"))
233 fvOptions_.reset(
dict.subDict(
"fvOptions"));
252 word divScheme(
"div(phi," + schemesField_ +
")");
253 word laplacianScheme(
"laplacian(" +
D.name() +
"," + schemesField_ +
")");
256 scalar relaxCoeff = 0;
257 mesh_.relaxEquation(schemesField_, relaxCoeff);
260 if (phaseName_ !=
"none")
271 D.dimensions().reset(limitedPhiAlpha.dimensions()/
dimLength);
275 for (label i = 0; i <= nCorr_; i++)
280 +
fvm::div(limitedPhiAlpha,
s, divScheme)
286 sEqn.
relax(relaxCoeff);
287 fvOptions_.constrain(sEqn);
288 sEqn.
solve(schemesField_);
290 tTPhiUD = sEqn.
flux();
310 for (label i = 0; i <= nCorr_; i++)
322 sEqn.relax(relaxCoeff);
324 fvOptions_.constrain(sEqn);
326 sEqn.solve(schemesField_);
331 for (label i = 0; i <= nCorr_; i++)
342 sEqn.relax(relaxCoeff);
344 fvOptions_.constrain(sEqn);
346 sEqn.solve(schemesField_);
352 <<
"Incompatible dimensions for phi: " <<
phi.dimensions() <<
nl 366 <<
tab << fieldName_ <<
nl
defineTypeNameAndDebug(ObukhovLength, 0)
fvMatrix< scalar > fvScalarMatrix
virtual ~scalarTransport()
Destructor.
errorManipArg< error, int > exit(error &err, const int errNo=1)
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
A list of keyword definitions, which are a keyword followed by a number of values (eg...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
T & ref() const
Return non-const reference to the contents of a non-null managed pointer.
constexpr char nl
The newline '\n' character (0x0a)
compressible::turbulenceModel & turb
Ostream & endl(Ostream &os)
Add newline and flush stream.
Calculate the matrix for the laplacian of the field.
constexpr char tab
The tab '\t' character(0x09)
Ignore writing from objectRegistry::writeObject()
const dimensionSet dimless
Dimensionless.
const Time & time() const
Return the top-level database.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Macros for easy insertion into run-time selection tables.
void setFluxRequired(const word &name) const
Set flux-required for given name (mutable)
virtual bool execute()
Calculate the scalarTransport.
GeometricField< scalar, fvPatchField, volMesh > volScalarField
dimensionedScalar pos(const dimensionedScalar &ds)
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
const dimensionSet dimVolume(pow3(dimLength))
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
static const word propertiesName
Default name of the turbulence properties dictionary.
A class for handling words, derived from Foam::string.
tmp< fvMatrix< Type > > ddt(const GeometricField< Type, fvPatchField, volMesh > &vf)
bool store(word &fieldName, const tmp< ObjectType > &tfield, bool cacheable=false)
Store the field in the (sub) objectRegistry under the given name.
Calculate the matrix for the first temporal derivative.
virtual bool read(const dictionary &)
Read the scalarTransport data.
static tmp< T > New(Args &&... args)
Construct tmp with forwarding arguments.
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.
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())
Return tmp field (NO_READ, NO_WRITE) from name, mesh, dimensions and patch type. [Takes current timeN...
SolverPerformance< Type > solve(const dictionary &)
Solve returning the solution statistics.
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.
tmp< fvMatrix< Type > > div(const surfaceScalarField &flux, const GeometricField< Type, fvPatchField, volMesh > &vf, const word &name)
addToRunTimeSelectionTable(functionObject, ObukhovLength, dictionary)
void relax(const scalar alpha)
Relax matrix (for steady-state solution).
Calculate the matrix for the divergence of the given field and flux.
virtual bool write()
Do nothing.
const dimensionSet dimLength(0, 1, 0, 0, 0, 0, 0)
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
tmp< fvMatrix< Type > > laplacian(const GeometricField< Type, fvPatchField, volMesh > &vf, const word &name)
const dimensionSet dimTime(0, 0, 1, 0, 0, 0, 0)
virtual bool read(const dictionary &dict)
Read optional controls.
tmp< GeometricField< Type, fvsPatchField, surfaceMesh > > flux() const
Return the face-flux field from the matrix.
Specialization of Foam::functionObject for an Foam::fvMesh, providing a reference to the Foam::fvMesh...
const dimensionedScalar & D
const dimensionSet dimMass(1, 0, 0, 0, 0, 0, 0)
A class for managing temporary objects.
GeometricField< scalar, fvsPatchField, surfaceMesh > surfaceScalarField
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))
const dimensionedScalar alpha
Fine-structure constant: default SI units: [].
void explicitSolve(const RdeltaTType &rDeltaT, const RhoType &rho, volScalarField &psi, const surfaceScalarField &phiPsi, const SpType &Sp, const SuType &Su)
Request registration (bool: true)
const fvMesh & mesh_
Reference to the fvMesh.
Do not request registration (bool: false)
CMULES: Multidimensional universal limiter for explicit corrected implicit solution.
Calculate the finiteVolume matrix for implicit and explicit sources.
static constexpr const zero Zero
Global zero (0)