Go to the documentation of this file.
38 const bool pRefRequired
61 if (
dict.found(
"pMax") &&
dict.found(
"pMin"))
63 dict.readEntry(
"pMax", pMax_.value()); limitMaxP_ =
true;
64 dict.readEntry(
"pMin", pMin_.value()); limitMinP_ =
true;
68 const volScalarField::Boundary& pbf =
p.boundaryField();
69 const volScalarField::Boundary& rhobf =
rho.boundaryField();
71 scalar rhoRefMax = -GREAT;
72 scalar rhoRefMin = GREAT;
73 bool rhoLimits =
false;
77 if (pbf[patchi].fixesValue())
82 pMax =
max(pMax,
max(pbf[patchi]));
85 rhoRefMax =
max(rhoRefMax,
max(rhobf[patchi]));
86 rhoRefMin =
min(rhoRefMin,
min(rhobf[patchi]));
100 if (
dict.readIfPresent(
"pMax", pMax_.value()))
104 else if (
dict.found(
"pMaxFactor"))
109 <<
"'pMaxFactor' specified rather than 'pMax'" <<
nl
110 <<
" but the corresponding reference pressure cannot"
111 " be evaluated from the boundary conditions." <<
nl
112 <<
" Please specify 'pMax' rather than 'pMaxFactor'"
116 pMax_.value() = pMax *
dict.get<scalar>(
"pMaxFactor");
119 else if (
dict.found(
"rhoMax"))
124 <<
"'rhoMax' specified rather than 'pMax' or 'pMaxFactor'"
126 <<
" This is supported for backward-compatibility but"
127 " 'pMax' or 'pMaxFactor' are more reliable." <<
endl;
132 <<
"'rhoMax' specified rather than 'pMax'" <<
nl
133 <<
" but the corresponding reference pressure cannot"
134 " be evaluated from the boundary conditions." <<
nl
135 <<
" Please specify 'pMax' rather than 'rhoMax'"
142 <<
"'rhoMax' specified rather than 'pMaxFactor'" <<
nl
143 <<
" but the corresponding reference density cannot"
144 " be evaluated from the boundary conditions." <<
nl
145 <<
" Please specify 'pMaxFactor' rather than 'rhoMax'"
151 pMax_.value() =
max(
rhoMax.value()/rhoRefMax, 1)*pMax;
155 if (
dict.readIfPresent(
"pMin", pMin_.value()))
159 else if (
dict.found(
"pMinFactor"))
164 <<
"'pMinFactor' specified rather than 'pMin'" <<
nl
165 <<
" but the corresponding reference pressure cannot"
166 " be evaluated from the boundary conditions." <<
nl
167 <<
" Please specify 'pMin' rather than 'pMinFactor'"
171 pMin_.value() =
pMin *
dict.get<scalar>(
"pMinFactor");
174 else if (
dict.found(
"rhoMin"))
179 <<
"'rhoMin' specified rather than 'pMin' or 'pMinFactor'" <<
nl
180 <<
" This is supported for backward-compatibility but"
181 " 'pMin' or 'pMinFactor' are more reliable." <<
endl;
186 <<
"'rhoMin' specified rather than 'pMin'" <<
nl
187 <<
" but the corresponding reference pressure cannot"
188 " be evaluated from the boundary conditions." <<
nl
189 <<
" Please specify 'pMin' rather than 'rhoMin'"
196 <<
"'rhoMin' specified rather than 'pMinFactor'" <<
nl
197 <<
" but the corresponding reference density cannot"
198 " be evaluated from the boundary conditions." <<
nl
199 <<
" Please specify 'pMinFactor' rather than 'rhoMin'"
210 if (limitMaxP_ || limitMinP_)
212 Info<<
"pressureControl" <<
nl;
216 Info<<
" pMax " << pMax_.value() <<
nl;
221 Info<<
" pMin " << pMin_.value() <<
nl;
233 if (limitMaxP_ || limitMinP_)
237 const scalar pMax =
max(
p).value();
239 if (pMax > pMax_.
value())
241 Info<<
"pressureControl: p max " << pMax <<
endl;
pressureControl(const volScalarField &p, const volScalarField &rho, const dictionary &dict, const bool pRefRequired=true)
Construct from the SIMPLE/PIMPLE sub-dictionary.
const dimensionSet dimPressure
const dimensionedScalar & pMin
static constexpr const zero Zero
Global zero (0)
const dimensionSet dimDensity
Find the reference cell nearest (in index) to the given cell but which is not on a cyclic,...
Ostream & endl(Ostream &os)
Add newline and flush stream.
const Type & value() const
Return const reference to value.
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
#define forAll(list, i)
Loop across all elements in list.
bool limit(volScalarField &p) const
Limit the pressure if necessary and return true if so.
messageStream Info
Information stream (stdout output on master, null elsewhere)
bool setRefCell(const volScalarField &field, const volScalarField &fieldRef, const dictionary &dict, label &refCelli, scalar &refValue, const bool forceReference=false)
If the field fieldRef needs referencing find the reference cell nearest.
const dimensionedScalar rhoMin
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
reduce(hasMovingMesh, orOp< bool >())
errorManipArg< error, int > exit(error &err, const int errNo=1)
const dimensionedScalar rhoMax
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
#define IOWarningInFunction(ios)
Report an IO warning using Foam::Warning.