Go to the documentation of this file.
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);
A class for handling words, derived from Foam::string.
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
Find the reference cell nearest (in index) to the given cell but which is not on a cyclic,...
bool needReference() const
Does the field need a reference level for solution.
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.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
errorManipArg< error, int > exit(error &err, const int errNo=1)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
scalar getRefCellValue(const volScalarField &field, const label refCelli)
Return the current value of field in the reference cell.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.