43 if (
p.needReference())
46 scalar fixedMassOut = 0.0;
47 scalar adjustableMassOut = 0.0;
50 phi.boundaryFieldRef();
59 if (Up.
fixesValue() && !isA<inletOutletFvPatchVectorField>(Up))
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 131 || isA<inletOutletFvPatchVectorField>(Up)
145 return mag(massIn)/totalFlux < SMALL
146 &&
mag(fixedMassOut)/totalFlux < SMALL
147 &&
mag(adjustableMassOut)/totalFlux < SMALL;
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &f1)
errorManipArg< error, int > exit(error &err, const int errNo=1)
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
constexpr char nl
The newline '\n' character (0x0a)
bool adjustPhi(surfaceScalarField &phi, const volVectorField &U, volScalarField &p)
Adjust the balance of fluxes to obey continuity.
#define forAll(list, i)
Loop across all elements in list.
const dimensionedScalar e
Elementary charge.
virtual bool coupled() const
True if the patch field is coupled.
virtual bool fixesValue() const
True if the patch field fixes a value.
void reduce(const List< UPstream::commsStruct > &comms, T &value, const BinaryOp &bop, const int tag, const label comm)
Reduce inplace (cf. MPI Allreduce) using specified communication schedule.
For cases which do no have a pressure boundary adjust the balance of fluxes to obey continuity...
An abstract base class with a fat-interface to all derived classes covering all possible ways in whic...