37 const bool pRefRequired
52 if (pRefRequired &&
setRefCell(p, pRef, dict, refCell_, refValue_))
62 pMax_.value() = dict.
lookup<scalar>(
"pMax");
64 pMin_.value() = dict.
lookup<scalar>(
"pMin");
72 scalar rhoRefMax = -great;
73 scalar rhoRefMin = great;
74 bool rhoLimits =
false;
78 if (pbf[
patchi].fixesValue())
84 pMin =
min(pMin,
min(pbf[patchi]));
86 rhoRefMax =
max(rhoRefMax,
max(rhobf[patchi]));
87 rhoRefMin =
min(rhoRefMin,
min(rhobf[patchi]));
101 if (dict.
found(
"pMax"))
103 pMax_.value() = dict.
lookup<scalar>(
"pMax");
106 else if (dict.
found(
"pMaxFactor"))
111 <<
"'pMaxFactor' specified rather than 'pMax'" <<
nl 112 <<
" but the corresponding reference pressure cannot" 113 " be evaluated from the boundary conditions." <<
nl 114 <<
" Please specify 'pMax' rather than 'pMaxFactor'" 118 const scalar pMaxFactor(dict.
lookup<scalar>(
"pMaxFactor"));
119 pMax_.value() = pMaxFactor*pMax;
122 else if (dict.
found(
"rhoMax"))
127 <<
"'rhoMax' specified rather than 'pMax' or 'pMaxFactor'" 129 <<
" This is supported for backward-compatibility but " 130 "'pMax' or 'pMaxFactor' are more reliable." <<
endl;
135 <<
"'rhoMax' specified rather than 'pMax'" <<
nl 136 <<
" but the corresponding reference pressure cannot" 137 " be evaluated from the boundary conditions." <<
nl 138 <<
" Please specify 'pMax' rather than 'rhoMax'" 145 <<
"'rhoMax' specified rather than 'pMaxFactor'" <<
nl 146 <<
" but the corresponding reference density cannot" 147 " be evaluated from the boundary conditions." <<
nl 148 <<
" Please specify 'pMaxFactor' rather than 'rhoMax'" 154 pMax_.value() =
max(rhoMax.
value()/rhoRefMax, 1)*pMax;
158 if (dict.
found(
"pMin"))
160 pMin_.value() = dict.
lookup<scalar>(
"pMin");
163 else if (dict.
found(
"pMinFactor"))
168 <<
"'pMinFactor' specified rather than 'pMin'" <<
nl 169 <<
" but the corresponding reference pressure cannot" 170 " be evaluated from the boundary conditions." <<
nl 171 <<
" Please specify 'pMin' rather than 'pMinFactor'" 175 const scalar pMinFactor(dict.
lookup<scalar>(
"pMinFactor"));
176 pMin_.value() = pMinFactor*
pMin;
179 else if (dict.
found(
"rhoMin"))
184 <<
"'rhoMin' specified rather than 'pMin' or 'pMinFactor'" <<
nl 185 <<
" This is supported for backward-compatibility but" 186 "'pMin' or 'pMinFactor' are more reliable." <<
endl;
191 <<
"'rhoMin' specified rather than 'pMin'" <<
nl 192 <<
" but the corresponding reference pressure cannot" 193 " be evaluated from the boundary conditions." <<
nl 194 <<
" Please specify 'pMin' rather than 'rhoMin'" 201 <<
"'rhoMin' specified rather than 'pMinFactor'" <<
nl 202 <<
" but the corresponding reference density cannot" 203 " be evaluated from the boundary conditions." <<
nl 204 <<
" Please specify 'pMinFactor' rather than 'rhoMin'" 210 pMin_.value() =
min(rhoMin.
value()/rhoRefMin, 1)*pMin;
215 if (limitMaxP_ || limitMinP_)
217 Info<<
"pressureControl" <<
nl;
221 Info<<
" pMax " << pMax_.value() <<
nl;
226 Info<<
" pMin " << pMin_.value() <<
nl;
239 const bool pRefRequired
250 if (limitMaxP_ || limitMinP_)
254 const scalar pMax =
max(p).value();
256 if (pMax > pMax_.
value())
258 Info<<
"pressureControl: p max " << pMax <<
endl;
265 const scalar
pMin =
min(p).value();
267 if (pMin < pMin_.
value())
269 Info<<
"pressureControl: p min " << pMin <<
endl;
bool found(const word &, bool recursive=false, bool patternMatch=true) const
Search dictionary for given keyword.
#define forAll(list, i)
Loop across all elements in list.
errorManipArg< error, int > exit(error &err, const int errNo=1)
A list of keyword definitions, which are a keyword followed by any number of values (e...
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
const Boundary & boundaryField() const
Return const-reference to the boundary field.
pressureControl(const volScalarField &p, const volScalarField &pRef, const volScalarField &rho, const dictionary &dict, const bool pRefRequired=true)
Construct from the simple/pimple sub-dictionary.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Find the reference cell nearest (in index) to the given cell but which is not on a cyclic...
pressureControl & pressureControl
const Type & value() const
Return const reference to value.
bool limit(volScalarField &p) const
Limit the pressure if necessary and return true if so.
const dimensionSet dimPressure
dimensionedScalar pMin("pMin", dimPressure, fluid)
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
const dimensionSet dimDensity
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
void correctBoundaryConditions()
Correct boundary field.
#define IOWarningInFunction(ios)
Report an IO warning using Foam::Warning.
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.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.