42 namespace functionObjects
60 if (!foundObject<volScalarField>(fieldName_))
75 store(fieldName_, tfldPtr);
78 return lookupObjectRef<volScalarField>(fieldName_);
83 Foam::functionObjects::energyTransport::kappaEff()
const 89 const turbType* turbPtr = findObject<turbType>
96 return tmp<volScalarField>
114 Foam::functionObjects::energyTransport::rho()
const 121 mesh_.time().timeName(),
133 trho.ref() = lookupObject<volScalarField>(rhoName_);
140 Foam::functionObjects::energyTransport::Cp()
const 144 tmp<volScalarField>
tCp(phases_[0]*Cps_[0]);
146 for (label i = 1; i < phases_.size(); i++)
148 tCp.ref() += phases_[i]*Cps_[i];
158 mesh_.time().timeName(),
171 Foam::functionObjects::energyTransport::kappa()
const 175 tmp<volScalarField> tkappa(phases_[0]*kappas_[0]);
177 for (label i = 1; i < phases_.size(); i++)
179 tkappa.ref() += phases_[i]*kappas_[i];
189 mesh_.time().timeName(),
202 Foam::functionObjects::energyTransport::energyTransport
210 fieldName_(
dict.getOrDefault<
word>(
"field",
"T")),
211 phiName_(
dict.getOrDefault<
word>(
"phi",
"phi")),
212 rhoName_(
dict.getOrDefault<
word>(
"rho",
"rho")),
214 schemesField_(
"unknown-schemesField"),
216 multiphaseThermo_(
dict.subOrEmptyDict(
"phaseThermos")),
245 if (!multiphaseThermo_.empty())
247 Cps_.setSize(multiphaseThermo_.size());
248 kappas_.setSize(Cps_.size());
249 phaseNames_.
setSize(Cps_.size());
254 const word&
key = iter().keyword();
261 <<
"Found non-dictionary entry " << iter()
262 <<
" in top-level dictionary " << multiphaseThermo_
295 phases_.setSize(phaseNames_.
size());
310 if (Cp_.
value() == 0.0 || kappa_.
value() == 0.0)
313 <<
" Multiphase thermo dictionary not found and Cp/kappa " 314 <<
" for single phase are zero. Please entry either" 323 s.correctBoundaryConditions();
339 dict.readIfPresent(
"phi", phiName_);
340 dict.readIfPresent(
"rho", rhoName_);
342 schemesField_ =
dict.getOrDefault(
"schemesField", fieldName_);
344 dict.readIfPresent(
"nCorr", nCorr_);
346 if (
dict.found(
"fvOptions"))
348 fvOptions_.reset(
dict.subDict(
"fvOptions"));
367 word divScheme(
"div(phi," + schemesField_ +
")");
370 "laplacian(kappaEff," + schemesField_ +
")" 374 scalar relaxCoeff = 0.0;
375 if (mesh_.relaxEquation(schemesField_))
377 relaxCoeff = mesh_.equationRelaxationFactor(schemesField_);
385 for (label i = 0; i <= nCorr_; i++)
394 fvOptions_(rhoCp_,
s)
397 sEqn.relax(relaxCoeff);
399 fvOptions_.constrain(sEqn);
401 sEqn.solve(mesh_.solverDict(schemesField_));
415 mesh_.time().timeName(),
424 for (label i = 0; i <= nCorr_; i++)
432 fvOptions_(trhoCp.ref(),
s)
435 sEqn.relax(relaxCoeff);
437 fvOptions_.constrain(sEqn);
439 sEqn.solve(mesh_.solverDict(schemesField_));
445 <<
"Incompatible dimensions for phi: " <<
phi.dimensions() <<
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
Calculate the matrix for the laplacian of the field.
virtual bool execute()
Calculate the energyTransport.
virtual bool write()
Do nothing.
IncompressibleTurbulenceModel< transportModel > turbulenceModel
Ignore writing from objectRegistry::writeObject()
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))
virtual ~energyTransport()
Destructor.
void setSize(const label n)
Alias for resize()
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for 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.
Calculate the matrix for the first temporal derivative.
static tmp< T > New(Args &&... args)
Construct tmp with forwarding arguments.
zeroField Sp(const Foam::zero, const GeometricField< Type, fvPatchField, volMesh > &)
A no-op source.
static word timeName(const scalar t, const int precision=precision_)
Return time name of given scalar time 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)
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
Calculate the matrix for the divergence of the given field and flux.
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)
auto key(const Type &t) -> typename std::enable_if< std::is_enum< Type >::value, typename std::underlying_type< Type >::type >::type
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)
Calculate the finiteVolume matrix for implicit and explicit sources.
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 a sub-dictionary) otherwise return nullptr...
static constexpr const zero Zero
Global zero (0)