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))
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))
75 label hasRef = (refCelli >= 0 ? 1 : 0);
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);
122 const volScalarField&
field,
126 const bool forceReference
135 const volScalarField&
field,
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);
bool needReference() const
Does the field need a reference level for solution.
static bool master(const label communicator=worldComm)
True if process corresponds to the master rank in the communicator.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
A class for handling words, derived from Foam::string.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Find the reference cell nearest (in index) to the given cell but which is not on a cyclic,...
return returnReduce(nRefine-oldNRefine, sumOp< label >())
GeometricField< scalar, fvPatchField, volMesh > volScalarField
IOerror FatalIOError
Error stream (stdout output on all processes), with additional 'FOAM FATAL IO ERROR' header text and ...
vector point
Point is a vector.
scalar getRefCellValue(const volScalarField &field, const label refCelli)
Return the current value of field in the reference cell.
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
errorManipArg< error, int > exit(error &err, const int errNo=1)
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.
constexpr char nl
The newline '\n' character (0x0a).
setRefCell(p, pimple.dict(), pRefCell, pRefValue)