40 #define PhiDimensionErrorInFunction(phi) \ 41 FatalErrorInFunction \ 42 << "Incompatible dimensions for " << phi.name() << ": " \ 43 << phi.dimensions() << nl \ 44 << "Dimensions should be " << dimMass/dimTime << " or " \ 45 << dimVolume/dimTime << exit(FatalError) 51 namespace functionObjects
76 wordList PhiPatchFieldTypes(mesh_.boundaryMesh().size());
79 PhiPatchFieldTypes[
patchi] =
80 p.boundaryField()[
patchi].fixesValue()
92 mesh_.time().timeName(),
103 mesh_.setFluxRequired(PhiPtr_->name());
111 Foam::functionObjects::phaseScalarTransport::alphaPhi()
121 << alphaPhiName_ <<
" was not found, so generating it" <<
endl;
129 tmp<surfaceScalarField> tAlphaPhi
143 const word laplacianScheme =
"laplacian(" + pName_ +
")";
149 auto writeDDt = [&](
const label i)
162 Info<<
type() <<
": Writing " << DDtAlpha.name() <<
endl;
165 if (debug && mesh_.time().writeTime())
171 nonOrthogonalSolutionControl& control =
172 mesh_.lookupObjectRef<nonOrthogonalSolutionControl>
174 solutionControl::typeName
180 while (control.correctNonOrthogonal())
189 PhiEqn.solve(pName_);
191 if (control.finalNonOrthogonalIter())
193 alphaPhi += PhiEqn.flux();
202 while (control.correctNonOrthogonal())
211 PhiEqn.solve(pName_);
213 if (control.finalNonOrthogonalIter())
215 alphaPhi += PhiEqn.flux();
225 if (debug && mesh_.time().writeTime())
235 Foam::functionObjects::phaseScalarTransport::D
275 return alphaD_*turbulence.nu() + alphaDt_*turbulence.nut();
279 return alphaD_*turbulence.mu() + alphaDt_*turbulence.mut();
284 return tmp<volScalarField>(
nullptr);
299 fieldName_(dict.
lookup(
"field")),
302 residualAlpha_(rootSmall),
309 mesh_.time().timeName(),
322 <<
"Field \"" << fieldName_ <<
"\" does not have a phase extension " 323 <<
"in its name. If it is associated with \"phaseA\" then it " 324 <<
"should be named \"" << fieldName_ <<
".phaseA\"." 372 writeAlphaField_ = dict.
lookupOrDefault<
bool>(
"writeAlphaField",
true);
374 if (dict.
found(
"fvOptions"))
376 fvOptions_.reset(dict.
subDict(
"fvOptions"));
398 const word divScheme =
399 "div(" + alphaPhi.
name() +
"," + schemesField_ +
")";
400 const word laplacianScheme =
401 "laplacian(" + D.
name() +
"," + schemesField_ +
")";
404 const scalar relaxCoeff =
405 mesh_.relaxEquation(schemesField_)
406 ? mesh_.equationRelaxationFactor(schemesField_)
412 for (
label i = 0; i <= nCorr_; ++ i)
425 fvOptions_(alpha, s_)
430 fieldEqn.
relax(relaxCoeff);
431 fvOptions_.constrain(fieldEqn);
432 fieldEqn.
solve(schemesField_);
440 for (
label i = 0; i <= nCorr_; ++ i)
453 fvOptions_(alpha, rho, s_)
458 fieldEqn.
relax(relaxCoeff);
459 fvOptions_.constrain(fieldEqn);
460 fieldEqn.
solve(schemesField_);
469 if (writeAlphaField_)
471 if (!alphaSPtr_.valid())
480 +
word(toupper(fieldName_[0]))
481 + fieldName_(1, fieldName_.size() - 1),
482 mesh_.time().timeName(),
493 alphaSPtr_() = alpha*s_;
497 if (alphaSPtr_.valid())
499 alphaSPtr_().
clear();
bool found(const word &, bool recursive=false, bool patternMatch=true) const
Search dictionary for given keyword.
fvMatrix< scalar > fvScalarMatrix
#define forAll(list, i)
Loop across all elements in list.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
const word & name() const
Return name.
errorManipArg< error, int > exit(error &err, const int errNo=1)
A list of keyword definitions, which are a keyword followed by any number of values (e...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
static const char *const typeName
tmp< GeometricField< Type, fvPatchField, volMesh > > div(const GeometricField< Type, fvsPatchField, surfaceMesh > &ssf)
addToRunTimeSelectionTable(functionObject, Qdot, dictionary)
ThermalDiffusivity< CompressibleTurbulenceModel< fluidThermo > > turbulenceModel
Ostream & endl(Ostream &os)
Add newline and flush stream.
Calculate the matrix for the laplacian of the field.
word member() const
Return member (name without the extension)
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(dimless, 1.0));surfaceScalarField neg(IOobject("neg", runTime.timeName(), mesh), mesh, dimensionedScalar(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))
word group() const
Return group (extension part of name)
virtual bool read(const dictionary &)
Read the settings from the given dictionary.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Macros for easy insertion into run-time selection tables.
static tmp< GeometricField< scalar, fvPatchField, volMesh > > New(const word &name, const Mesh &, const dimensionSet &, const word &patchFieldType=fvPatchField< scalar >::calculatedType())
Return a temporary field constructed from name, mesh, dimensionSet.
const dictionary & subDict(const word &) const
Find and return a sub-dictionary.
tmp< GeometricField< Type, fvPatchField, volMesh > > ddt(const dimensioned< Type > dt, const fvMesh &mesh)
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Calculate the first temporal derivative.
const dimensionSet dimVolume(pow3(dimLength))
const dimensionSet & dimensions() const
Return dimensions.
virtual bool read(const dictionary &)
Read optional controls.
bool read(const char *, int32_t &)
virtual bool write()
Do nothing. The field is registered and written automatically.
static const word propertiesName
Default name of the turbulence properties dictionary.
void clear()
Clear the list, i.e. set size to zero.
A class for handling words, derived from string.
static word groupName(Name name, const word &group)
#define PhiDimensionErrorInFunction(phi)
tmp< fvMatrix< Type > > ddt(const GeometricField< Type, fvPatchField, volMesh > &vf)
Calculate the matrix for the first temporal derivative.
bool readIfPresent(const word &, T &, bool recursive=false, bool patternMatch=true) const
Find an entry if present, and assign to T.
static const word null
An empty word.
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 ~phaseScalarTransport()
Destructor.
Calculate the divergence of the given field.
SolverPerformance< Type > solve(const dictionary &)
Solve segregated or coupled returning the solution statistics.
tmp< fvMatrix< Type > > div(const surfaceScalarField &flux, const GeometricField< Type, fvPatchField, volMesh > &vf, const word &name)
void relax(const scalar alpha)
Relax matrix (for steady-state solution).
word name(const complex &)
Return a string representation of a complex.
defineTypeNameAndDebug(Qdot, 0)
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.
Calculate the matrix for the divergence of the given field and flux.
List< word > wordList
A List of words.
T lookupOrDefault(const word &, const T &, bool recursive=false, bool patternMatch=true) const
Find and return a T,.
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)
fileType type(const fileName &, const bool checkVariants=true, const bool followLink=true)
Return the file type: directory or file.
const dimensionSet dimTime(0, 0, 1, 0, 0, 0, 0)
virtual Ostream & write(const token &)=0
Write next token to stream.
Specialization of Foam::functionObject for an Foam::fvMesh, providing a reference to the Foam::fvMesh...
const dimensionSet dimMass(1, 0, 0, 0, 0, 0, 0)
volScalarField alpha(IOobject("alpha", runTime.timeName(), mesh, IOobject::READ_IF_PRESENT, IOobject::AUTO_WRITE), lambda *max(Ua &U, zeroSensitivity))
A class for managing temporary objects.
GeometricField< scalar, fvsPatchField, surfaceMesh > surfaceScalarField
virtual bool execute()
Solve for the evolution of the field.
surfaceScalarField alphaPhi(phi.name()+alpha1.name(), fvc::flux(phi, alpha1, alphaScheme))
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
phaseScalarTransport(const word &name, const Time &runTime, const dictionary &dict)
Construct from Time and dictionary.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.