43 if (
p.needReference())
46 scalar fixedMassOut = 0.0;
47 scalar adjustableMassOut = 0.0;
50 phi.boundaryFieldRef();
69 fixedMassOut += phip[i];
83 adjustableMassOut += phip[i];
91 scalar totalFlux = VSMALL +
sum(
mag(
phi)).value();
97 scalar massCorr = 1.0;
98 scalar magAdjustableMassOut =
mag(adjustableMassOut);
102 magAdjustableMassOut > VSMALL
103 && magAdjustableMassOut/totalFlux > SMALL
106 massCorr = (massIn - fixedMassOut)/adjustableMassOut;
108 else if (
mag(fixedMassOut - massIn)/totalFlux > 1
e-8)
111 <<
"Continuity error cannot be removed by adjusting the"
112 " outflow.\nPlease check the velocity boundary conditions"
113 " and/or run potentialFoam to initialise the outflow." <<
nl
114 <<
"Total flux : " << totalFlux <<
nl
115 <<
"Specified mass inflow : " << massIn <<
nl
116 <<
"Specified mass outflow : " << fixedMassOut <<
nl
117 <<
"Adjustable mass outflow : " << adjustableMassOut <<
nl
145 return mag(massIn)/totalFlux < SMALL
146 &&
mag(fixedMassOut)/totalFlux < SMALL
147 &&
mag(adjustableMassOut)/totalFlux < SMALL;
For cases which do no have a pressure boundary adjust the balance of fluxes to obey continuity....
GeometricBoundaryField< scalar, fvsPatchField, surfaceMesh > Boundary
virtual bool fixesValue() const
True if the patch field fixes a value.
virtual bool coupled() const
True if the patch field is coupled.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
bool adjustPhi(surfaceScalarField &phi, const volVectorField &U, volScalarField &p)
Adjust the balance of fluxes to obey continuity.
GeometricField< vector, fvPatchField, volMesh > volVectorField
GeometricField< scalar, fvPatchField, volMesh > volScalarField
GeometricField< scalar, fvsPatchField, surfaceMesh > surfaceScalarField
const Type * isA(const U &obj)
Attempt dynamic_cast to Type.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
void reduce(T &value, BinaryOp bop, const int tag=UPstream::msgType(), const int communicator=UPstream::worldComm)
Reduce inplace (cf. MPI Allreduce).
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &f1, const label comm)
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)
fvPatchField< vector > fvPatchVectorField
fvsPatchField< scalar > fvsPatchScalarField
constexpr char nl
The newline '\n' character (0x0a).
#define forAll(list, i)
Loop across all elements in list.