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")),
73 R_(
dict.get<scalar>(
"R")),
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 plenumDensityOld_(1.0),
79 plenumTemperature_(
dict.get<scalar>(
"plenumTemperature")),
80 plenumTemperatureOld_(300.0),
83 inletAreaRatio_(
dict.get<scalar>(
"inletAreaRatio")),
84 inletDischargeCoefficient_(
dict.get<scalar>(
"inletDischargeCoefficient")),
85 timeScale_(
dict.getOrDefault<scalar>(
"timeScale", 0)),
87 phiName_(
dict.getOrDefault<
word>(
"phi",
"phi")),
88 UName_(
dict.getOrDefault<
word>(
"U",
"U"))
90 hasRho_ =
dict.readIfPresent(
"rho", rho_);
102 fixedValueFvPatchScalarField(ptf,
p, iF, mapper),
105 supplyMassFlowRate_(ptf.supplyMassFlowRate_),
106 supplyTotalTemperature_(ptf.supplyTotalTemperature_),
107 plenumVolume_(ptf.plenumVolume_),
108 plenumDensity_(ptf.plenumDensity_),
109 plenumDensityOld_(ptf.plenumDensityOld_),
110 plenumTemperature_(ptf.plenumTemperature_),
111 plenumTemperatureOld_(ptf.plenumTemperatureOld_),
113 hasRho_(ptf.hasRho_),
114 inletAreaRatio_(ptf.inletAreaRatio_),
115 inletDischargeCoefficient_(ptf.inletDischargeCoefficient_),
116 timeScale_(ptf.timeScale_),
117 timeIndex_(ptf.timeIndex_),
118 phiName_(ptf.phiName_),
128 fixedValueFvPatchScalarField(tppsf),
129 gamma_(tppsf.gamma_),
131 supplyMassFlowRate_(tppsf.supplyMassFlowRate_),
132 supplyTotalTemperature_(tppsf.supplyTotalTemperature_),
133 plenumVolume_(tppsf.plenumVolume_),
134 plenumDensity_(tppsf.plenumDensity_),
135 plenumDensityOld_(tppsf.plenumDensityOld_),
136 plenumTemperature_(tppsf.plenumTemperature_),
137 plenumTemperatureOld_(tppsf.plenumTemperatureOld_),
139 hasRho_(tppsf.hasRho_),
140 inletAreaRatio_(tppsf.inletAreaRatio_),
141 inletDischargeCoefficient_(tppsf.inletDischargeCoefficient_),
142 timeScale_(tppsf.timeScale_),
143 timeIndex_(tppsf.timeIndex_),
144 phiName_(tppsf.phiName_),
155 fixedValueFvPatchScalarField(tppsf, iF),
156 gamma_(tppsf.gamma_),
158 supplyMassFlowRate_(tppsf.supplyMassFlowRate_),
159 supplyTotalTemperature_(tppsf.supplyTotalTemperature_),
160 plenumVolume_(tppsf.plenumVolume_),
161 plenumDensity_(tppsf.plenumDensity_),
162 plenumDensityOld_(tppsf.plenumDensityOld_),
163 plenumTemperature_(tppsf.plenumTemperature_),
164 plenumTemperatureOld_(tppsf.plenumTemperatureOld_),
166 hasRho_(tppsf.hasRho_),
167 inletAreaRatio_(tppsf.inletAreaRatio_),
168 inletDischargeCoefficient_(tppsf.inletDischargeCoefficient_),
169 timeScale_(tppsf.timeScale_),
170 timeIndex_(tppsf.timeIndex_),
171 phiName_(tppsf.phiName_),
186 const fvPatchField<scalar>&
p = *
this;
187 const fvPatchField<scalar>& p_old =
190 internalField().name()
201 if (timeIndex_ != db().time().
timeIndex())
203 timeIndex_ = db().time().timeIndex();
204 plenumDensityOld_ = plenumDensity_;
205 plenumTemperatureOld_ = plenumTemperature_;
209 scalar massFlowRate(1.0);
214 massFlowRate = - rho_*
gSum(
phi);
219 <<
"The density must be specified when using a volumetric flux."
228 <<
"The density must be not specified when using a mass flux."
239 <<
"dimensions of phi are not correct"
240 <<
"\n on patch " <<
patch().name()
241 <<
" of field " << internalField().name()
242 <<
" in file " << internalField().objectPath() <<
nl
247 const scalar cv = R_/(gamma_ - 1),
cp = R_*gamma_/(gamma_ - 1);
252 + (dt/plenumVolume_)*(supplyMassFlowRate_ - massFlowRate);
254 plenumTemperatureOld_
255 + (dt/(plenumDensity_*cv*plenumVolume_))
258 *(
cp*supplyTotalTemperature_ - cv*plenumTemperature_)
259 - massFlowRate*R_*plenumTemperature_
261 const scalar plenumPressure = plenumDensity_*R_*plenumTemperature_;
269 1.0 - (gamma_ - 1.0)*U_e/(2.0*gamma_*R_*plenumTemperature_)
275 (1.0 - r)/(r*r*inletDischargeCoefficient_*inletDischargeCoefficient_)
290 max(
p, plenumPressure),
296 const scalar oneByFraction = timeScale_/dt;
297 const scalar fraction = oneByFraction < 1.0 ? 1.0 : 1.0/oneByFraction;
301 fixedValueFvPatchScalarField::updateCoeffs();
308 os.writeEntry(
"gamma", gamma_);
309 os.writeEntry(
"R", R_);
310 os.writeEntry(
"supplyMassFlowRate", supplyMassFlowRate_);
311 os.writeEntry(
"supplyTotalTemperature", supplyTotalTemperature_);
312 os.writeEntry(
"plenumVolume", plenumVolume_);
313 os.writeEntry(
"plenumDensity", plenumDensity_);
314 os.writeEntry(
"plenumTemperature", plenumTemperature_);
317 os.writeEntry(
"rho", rho_);
319 os.writeEntry(
"inletAreaRatio", inletAreaRatio_);
320 os.writeEntry(
"inletDischargeCoefficient", inletDischargeCoefficient_);
321 os.writeEntryIfDifferent<scalar>(
"timeScale", 0.0, timeScale_);
322 os.writeEntryIfDifferent<word>(
"phi",
"phi", phiName_);
323 os.writeEntryIfDifferent<word>(
"U",
"U", UName_);
335 plenumPressureFvPatchScalarField
Macros for easy insertion into run-time selection tables.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
const Boundary & boundaryField() const noexcept
Return const-reference to the boundary field.
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,...
scalar deltaTValue() const noexcept
Return time step value.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
A FieldMapper for finite-volume patch fields.
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
virtual void write(Ostream &) const
Write.
void writeValueEntry(Ostream &os) const
Write *this field as a "value" entry.
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
This boundary condition provides a plenum pressure inlet condition. This condition creates a zero-dim...
virtual void write(Ostream &) const
Write.
plenumPressureFvPatchScalarField(const fvPatch &, const DimensionedField< scalar, volMesh > &)
Construct from patch and internal field.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
A class for handling words, derived from Foam::string.
Info<< "Creating field kinetic energy K\n"<< 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()
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
OBJstream os(runTime.globalPath()/outputName)
#define makePatchTypeField(PatchTypeField, typePatchTypeField)
Define a concrete fvPatchField type and add to run-time tables Example, (fvPatchScalarField,...
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 std::string patch
OpenFOAM patch number as a std::string.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
Type gSum(const FieldField< Field, Type > &f)
GeometricField< vector, fvPatchField, volMesh > volVectorField
dimensionedScalar pos0(const dimensionedScalar &ds)
const dimensionSet dimTime(0, 0, 1, 0, 0, 0, 0)
GeometricField< scalar, fvPatchField, volMesh > volScalarField
GeometricField< scalar, fvsPatchField, surfaceMesh > surfaceScalarField
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
dimensionedScalar pow(const dimensionedScalar &ds, const dimensionedScalar &expt)
tmp< faMatrix< Type > > operator==(const faMatrix< Type > &, const faMatrix< Type > &)
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).
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
const dimensionSet dimVolume(pow3(dimLength))
errorManipArg< error, int > exit(error &err, const int errNo=1)
dimensioned< typename typeOfMag< Type >::type > magSqr(const dimensioned< Type > &dt)
dimensioned< Type > lerp(const dimensioned< Type > &a, const dimensioned< Type > &b, const scalar t)
const dimensionSet dimMass(1, 0, 0, 0, 0, 0, 0)
fvPatchField< scalar > fvPatchScalarField
constexpr char nl
The newline '\n' character (0x0a).
const volScalarField & cp