37 namespace functionObjects
55 if (!foundObject<volScalarField>(fieldName_))
70 store(fieldName_, tfldPtr);
73 return lookupObjectRef<volScalarField>(fieldName_);
78 Foam::functionObjects::energyTransport::kappaEff()
const 84 const turbType* turbPtr = findObject<turbType>
110 Foam::functionObjects::energyTransport::rho()
const 122 trho.ref() = lookupObject<volScalarField>(rhoName_);
129 Foam::functionObjects::energyTransport::Cp()
const 133 tmp<volScalarField>
tCp(phases_[0]*Cps_[0]);
135 for (label i = 1; i < phases_.size(); i++)
137 tCp.ref() += phases_[i]*Cps_[i];
153 Foam::functionObjects::energyTransport::kappa()
const 157 tmp<volScalarField> tkappa(phases_[0]*kappas_[0]);
159 for (label i = 1; i < phases_.size(); i++)
161 tkappa.ref() += phases_[i]*kappas_[i];
201 multiphaseThermo_(
dict.subOrEmptyDict(
"phaseThermos")),
212 fieldName_(
dict.getOrDefault<
word>(
"field",
"T")),
213 schemesField_(
"unknown-schemesField"),
214 phiName_(
dict.getOrDefault<
word>(
"phi",
"phi")),
215 rhoName_(
dict.getOrDefault<
word>(
"rho",
"rho")),
222 if (!multiphaseThermo_.empty())
224 Cps_.setSize(multiphaseThermo_.size());
225 kappas_.setSize(Cps_.size());
226 phaseNames_.
setSize(Cps_.size());
231 const word&
key = iter().keyword();
238 <<
"Found non-dictionary entry " << iter()
239 <<
" in top-level dictionary " << multiphaseThermo_
272 phases_.setSize(phaseNames_.
size());
287 if (Cp_.
value() == 0.0 || kappa_.
value() == 0.0)
290 <<
" Multiphase thermo dictionary not found and Cp/kappa " 291 <<
" for single phase are zero. Please entry either" 300 s.correctBoundaryConditions();
313 dict.readIfPresent(
"phi", phiName_);
314 dict.readIfPresent(
"rho", rhoName_);
316 schemesField_ =
dict.getOrDefault(
"schemesField", fieldName_);
318 dict.readIfPresent(
"nCorr", nCorr_);
319 dict.readIfPresent(
"tolerance", tol_);
321 if (
dict.found(
"fvOptions"))
323 fvOptions_.reset(
dict.subDict(
"fvOptions"));
342 word divScheme(
"div(phi," + schemesField_ +
")");
345 "laplacian(kappaEff," + schemesField_ +
")" 349 scalar relaxCoeff = 0;
350 mesh_.relaxEquation(schemesField_, relaxCoeff);
353 bool converged =
false;
361 for (
int i = 0; i <= nCorr_; ++i)
370 fvOptions_(rhoCp_,
s)
373 sEqn.
relax(relaxCoeff);
375 fvOptions_.constrain(sEqn);
378 converged = (sEqn.
solve(schemesField_).initialResidual() < tol_);
379 if (converged)
break;
396 for (
int i = 0; i <= nCorr_; ++i)
404 fvOptions_(trhoCp.ref(),
s)
407 sEqn.relax(relaxCoeff);
409 fvOptions_.constrain(sEqn);
412 converged = (sEqn.solve(schemesField_).initialResidual() < tol_);
413 if (converged)
break;
419 <<
"Incompatible dimensions for phi: " <<
phi.dimensions() <<
nl 427 <<
s.name() <<
" is converged." <<
nl 428 <<
tab <<
"initial-residual tolerance: " << tol_ <<
nl 429 <<
tab <<
"outer iteration: " << iter <<
nl;
const Type & value() const noexcept
Return const reference to value.
void size(const label n)
Older name for setAddressableSize.
defineTypeNameAndDebug(ObukhovLength, 0)
fvMatrix< scalar > fvScalarMatrix
const GeometricField< Type, PatchField, GeoMesh > & oldTime() const
Return old time field.
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.
const tmp< volScalarField > & tCp
tmp< GeometricField< Type, fvPatchField, volMesh > > div(const GeometricField< Type, fvsPatchField, surfaceMesh > &ssf)
constexpr char nl
The newline '\n' character (0x0a)
virtual bool read(const dictionary &)
Read the energyTransport data.
Ostream & endl(Ostream &os)
Add newline and flush stream.
tmp< volScalarField > trho
virtual bool execute()
Calculate the energyTransport.
constexpr char tab
The tab '\t' character(0x09)
virtual bool write()
Do nothing.
IncompressibleTurbulenceModel< transportModel > turbulenceModel
const dimensionSet dimless
Dimensionless.
const Time & time() const
Return the top-level database.
const dimensionedScalar kappa
Coulomb constant: default SI units: [N.m2/C2].
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
const surfaceScalarField rhoCpPhi(fvc::interpolate(fluid.Cp()) *rhoPhi)
Macros for easy insertion into run-time selection tables.
#define forAll(list, i)
Loop across all elements in list.
tmp< GeometricField< Type, fvPatchField, volMesh > > ddt(const dimensioned< Type > dt, const fvMesh &mesh)
GeometricField< scalar, fvPatchField, volMesh > volScalarField
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))
void setSize(const label n)
Alias for resize()
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.
Type * getObjectPtr(const word &name, const bool recursive=false) const
Return non-const pointer to the object of the given Type, using a const-cast to have it behave like a...
const dimensionSet dimTemperature(0, 0, 0, 1, 0, 0, 0)
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.
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.
energyTransport(const word &name, const Time &runTime, const dictionary &dict)
Construct from Time and dictionary.
auto key(const Type &t) -> std::enable_if_t< std::is_enum_v< Type >, std::underlying_type_t< Type > >
zeroField Sp(const Foam::zero, const GeometricField< Type, fvPatchField, volMesh > &)
A no-op source.
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)
const volScalarField & Cp
addToRunTimeSelectionTable(functionObject, ObukhovLength, dictionary)
void relax(const scalar alpha)
Relax matrix (for steady-state solution).
const dimensionSet dimEnergy
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.
const dimensionSet dimDensity
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)
Automatically write from objectRegistry::writeObject()
const dimensionSet dimTime(0, 0, 1, 0, 0, 0, 0)
virtual bool read(const dictionary &dict)
Read optional controls.
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)
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))
Defines the attributes of an object for which implicit objectRegistry management is supported...
Request registration (bool: true)
const fvMesh & mesh_
Reference to the fvMesh.
Do not request registration (bool: false)
forAllConstIters(mixture.phases(), phase)
const dictionary * findDict(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a sub-dictionary pointer if present (and it is a dictionary) otherwise return nullptr...
static constexpr const zero Zero
Global zero (0)