43 fixedValueFvPatchScalarField(
p, iF),
46 supplyMassFlowRate_(1.0),
47 supplyTotalTemperature_(300.0),
50 plenumDensityOld_(1.0),
51 plenumTemperature_(300.0),
52 plenumTemperatureOld_(300.0),
56 inletDischargeCoefficient_(1.0),
71 fixedValueFvPatchScalarField(
p, iF,
dict),
72 gamma_(
dict.
get<scalar>(
"gamma")),
74 supplyMassFlowRate_(
dict.
get<scalar>(
"supplyMassFlowRate")),
75 supplyTotalTemperature_(
dict.
get<scalar>(
"supplyTotalTemperature")),
76 plenumVolume_(
dict.
get<scalar>(
"plenumVolume")),
77 plenumDensity_(
dict.
get<scalar>(
"plenumDensity")),
78 plenumTemperature_(
dict.
get<scalar>(
"plenumTemperature")),
81 inletAreaRatio_(
dict.
get<scalar>(
"inletAreaRatio")),
82 inletDischargeCoefficient_(
dict.
get<scalar>(
"inletDischargeCoefficient")),
83 timeScale_(
dict.getOrDefault<scalar>(
"timeScale", 0)),
84 phiName_(
dict.getOrDefault<
word>(
"phi",
"phi")),
87 hasRho_ =
dict.readIfPresent(
"rho", rho_);
99 fixedValueFvPatchScalarField(ptf,
p, iF, mapper),
102 supplyMassFlowRate_(ptf.supplyMassFlowRate_),
103 supplyTotalTemperature_(ptf.supplyTotalTemperature_),
104 plenumVolume_(ptf.plenumVolume_),
105 plenumDensity_(ptf.plenumDensity_),
106 plenumTemperature_(ptf.plenumTemperature_),
108 hasRho_(ptf.hasRho_),
109 inletAreaRatio_(ptf.inletAreaRatio_),
110 inletDischargeCoefficient_(ptf.inletDischargeCoefficient_),
111 timeScale_(ptf.timeScale_),
112 phiName_(ptf.phiName_),
122 fixedValueFvPatchScalarField(tppsf),
123 gamma_(tppsf.gamma_),
125 supplyMassFlowRate_(tppsf.supplyMassFlowRate_),
126 supplyTotalTemperature_(tppsf.supplyTotalTemperature_),
127 plenumVolume_(tppsf.plenumVolume_),
128 plenumDensity_(tppsf.plenumDensity_),
129 plenumTemperature_(tppsf.plenumTemperature_),
131 hasRho_(tppsf.hasRho_),
132 inletAreaRatio_(tppsf.inletAreaRatio_),
133 inletDischargeCoefficient_(tppsf.inletDischargeCoefficient_),
134 timeScale_(tppsf.timeScale_),
135 phiName_(tppsf.phiName_),
146 fixedValueFvPatchScalarField(tppsf, iF),
147 gamma_(tppsf.gamma_),
149 supplyMassFlowRate_(tppsf.supplyMassFlowRate_),
150 supplyTotalTemperature_(tppsf.supplyTotalTemperature_),
151 plenumVolume_(tppsf.plenumVolume_),
152 plenumDensity_(tppsf.plenumDensity_),
153 plenumTemperature_(tppsf.plenumTemperature_),
155 hasRho_(tppsf.hasRho_),
156 inletAreaRatio_(tppsf.inletAreaRatio_),
157 inletDischargeCoefficient_(tppsf.inletDischargeCoefficient_),
158 timeScale_(tppsf.timeScale_),
159 phiName_(tppsf.phiName_),
174 const fvPatchField<scalar>&
p = *
this;
175 const fvPatchField<scalar>& p_old =
178 internalField().name()
189 if (timeIndex_ != db().time().
timeIndex())
191 timeIndex_ = db().time().timeIndex();
192 plenumDensityOld_ = plenumDensity_;
193 plenumTemperatureOld_ = plenumTemperature_;
197 scalar massFlowRate(1.0);
202 massFlowRate = -
gSum(rho_*
phi);
207 <<
"The density must be specified when using a volumetric flux." 216 <<
"The density must be not specified when using a mass flux." 227 <<
"dimensions of phi are not correct" 228 <<
"\n on patch " <<
patch().name()
229 <<
" of field " << internalField().name()
230 <<
" in file " << internalField().objectPath() <<
nl 235 const scalar cv = R_/(gamma_ - 1),
cp = R_*gamma_/(gamma_ - 1);
240 + (dt/plenumVolume_)*(supplyMassFlowRate_ - massFlowRate);
242 plenumTemperatureOld_
243 + (dt/(plenumDensity_*cv*plenumVolume_))
246 *(
cp*supplyTotalTemperature_ - cv*plenumTemperature_)
247 - massFlowRate*R_*plenumTemperature_
249 const scalar plenumPressure = plenumDensity_*R_*plenumTemperature_;
257 1.0 - (gamma_ - 1.0)*U_e/(2.0*gamma_*R_*plenumTemperature_)
263 (1.0 - r)/(r*r*inletDischargeCoefficient_*inletDischargeCoefficient_)
278 max(
p, plenumPressure),
284 const scalar oneByFraction = timeScale_/dt;
285 const scalar fraction = oneByFraction < 1.0 ? 1.0 : 1.0/oneByFraction;
289 fixedValueFvPatchScalarField::updateCoeffs();
298 os.
writeEntry(
"supplyMassFlowRate", supplyMassFlowRate_);
299 os.
writeEntry(
"supplyTotalTemperature", supplyTotalTemperature_);
308 os.
writeEntry(
"inletDischargeCoefficient", inletDischargeCoefficient_);
323 plenumPressureFvPatchScalarField
List< ReturnType > get(const UPtrList< T > &list, const AccessOp &aop)
List of values generated by applying the access operation to each list item.
This boundary condition provides a plenum pressure inlet condition. This condition creates a zero-dim...
Info<< "Creating field kinetic energy K\"<< endl;volScalarField K("K", 0.5 *magSqr(U));if(U.nOldTimes()){ volVectorField *Uold=&U.oldTime();volScalarField *Kold=&K.oldTime();*Kold==0.5 *magSqr(*Uold);while(Uold->nOldTimes()) { Uold=&Uold-> oldTime()
scalar deltaTValue() const noexcept
Return time step value.
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.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
constexpr char nl
The newline '\n' character (0x0a)
virtual void write(Ostream &) const
Write.
dimensionedScalar sqrt(const dimensionedScalar &ds)
bool cp(const fileName &src, const fileName &dst, const bool followLink=true)
Copy the source to the destination (recursively if necessary).
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
Ostream & writeEntry(const keyType &key, const T &value)
Write a keyword/value entry.
void writeValueEntry(Ostream &os) const
Write *this field as a "value" entry.
virtual void write(Ostream &) const
Write.
GeometricField< vector, fvPatchField, volMesh > volVectorField
Macros for easy insertion into run-time selection tables.
GeometricField< scalar, fvPatchField, volMesh > volScalarField
const dimensionSet dimVolume(pow3(dimLength))
Type gSum(const FieldField< Field, Type > &f)
fvPatchField< scalar > fvPatchScalarField
A class for handling words, derived from Foam::string.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
A FieldMapper for finite-volume patch fields.
plenumPressureFvPatchScalarField(const fvPatch &, const DimensionedField< scalar, volMesh > &)
Construct from patch and internal field.
Ostream & writeEntryIfDifferent(const word &key, const T &value1, const T &value2)
Write a keyword/value entry only when the two values differ.
const Time & time() const noexcept
Return Time associated with the objectRegistry.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
dimensionedScalar pos0(const dimensionedScalar &ds)
OBJstream os(runTime.globalPath()/outputName)
dimensioned< Type > lerp(const dimensioned< Type > &a, const dimensioned< Type > &b, const scalar t)
dimensionedScalar pow(const dimensionedScalar &ds, const dimensionedScalar &expt)
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
const std::string patch
OpenFOAM patch number as a std::string.
const dimensionSet dimTime(0, 0, 1, 0, 0, 0, 0)
const dimensionSet dimMass(1, 0, 0, 0, 0, 0, 0)
GeometricField< scalar, fvsPatchField, surfaceMesh > surfaceScalarField
tmp< faMatrix< Type > > operator==(const faMatrix< Type > &, const faMatrix< Type > &)
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))
makePatchTypeField(fvPatchScalarField, atmBoundaryLayerInletEpsilonFvPatchScalarField)
dimensioned< typename typeOfMag< Type >::type > magSqr(const dimensioned< Type > &dt)