40 const bool forceReference
45 const word refCellName =
field.name() +
"RefCell";
46 const word refPointName =
field.name() +
"RefPoint";
47 const word refValueName =
field.name() +
"RefValue";
49 if (
dict.found(refCellName))
51 if (Pstream::master())
53 dict.readEntry(refCellName, refCelli);
55 if (refCelli < 0 || refCelli >=
field.mesh().nCells())
58 <<
"Illegal master cellID " << refCelli
59 <<
". Should be 0.." <<
field.mesh().nCells()
68 else if (
dict.found(refPointName))
73 refCelli =
field.mesh().findCell(refPointi, polyMesh::FACE_PLANES);
75 label hasRef = (refCelli >= 0 ? 1 : 0);
76 label sumHasRef = returnReduce<label>(hasRef,
sumOp<label>());
82 refCelli =
field.mesh().findCell(refPointi);
84 hasRef = (refCelli >= 0 ? 1 : 0);
91 <<
"Unable to set reference cell for field " <<
field.name()
92 <<
nl <<
" Reference point " << refPointName
94 <<
" found on " << sumHasRef <<
" domains (should be one)" 101 <<
"Unable to set reference cell for field " <<
field.name()
103 <<
" Please supply either " << refCellName
107 dict.readEntry(refValueName, refValue);
126 const bool forceReference
140 if (refCelli >=
field.mesh().nCells())
143 <<
"Illegal reference cellID " << refCelli
144 <<
". Mesh has " <<
field.mesh().nCells() <<
". cells." 148 scalar refCellValue = (refCelli >= 0 ?
field[refCelli] : 0.0);
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.
constexpr char nl
The newline '\n' character (0x0a)
scalar getRefCellValue(const volScalarField &field, const label refCelli)
Return the current value of field in the reference cell.
Find the reference cell nearest (in index) to the given cell but which is not on a cyclic...
GeometricField< scalar, fvPatchField, volMesh > volScalarField
bool needReference() const
Does the field need a reference level for solution.
A class for handling words, derived from Foam::string.
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
return returnReduce(nRefine-oldNRefine, sumOp< label >())
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.
IOerror FatalIOError
Error stream (stdout output on all processes), with additional 'FOAM FATAL IO ERROR' header text and ...