43 scalar fixedMassOut = 0.0;
44 scalar adjustableMassOut = 0.0;
46 surfaceScalarField::Boundary& bphi =
56 if (Up.
fixesValue() && !isA<inletOutletFvPatchVectorField>(Up))
66 fixedMassOut += phip[i];
80 adjustableMassOut += phip[i];
88 scalar totalFlux = vSmall +
sum(
mag(phi)).value();
94 scalar massCorr = 1.0;
95 scalar magAdjustableMassOut =
mag(adjustableMassOut);
99 magAdjustableMassOut > vSmall
100 && magAdjustableMassOut/totalFlux > small
103 massCorr = (massIn - fixedMassOut)/adjustableMassOut;
105 else if (
mag(fixedMassOut - massIn)/totalFlux > 1
e-8)
108 <<
"Continuity error cannot be removed by adjusting the" 109 " outflow.\nPlease check the velocity boundary conditions" 110 " and/or run potentialFoam to initialise the outflow." <<
nl 111 <<
"Total flux : " << totalFlux <<
nl 112 <<
"Specified mass inflow : " << massIn <<
nl 113 <<
"Specified mass outflow : " << fixedMassOut <<
nl 114 <<
"Adjustable mass outflow : " << adjustableMassOut <<
nl 128 || isA<inletOutletFvPatchVectorField>(Up)
142 return mag(massIn)/totalFlux < small
143 &&
mag(fixedMassOut)/totalFlux < small
144 &&
mag(adjustableMassOut)/totalFlux < small;
#define forAll(list, i)
Loop across all elements in list.
errorManipArg< error, int > exit(error &err, const int errNo=1)
virtual bool fixesValue() const
Return true if this patch field fixes a value.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
const Boundary & boundaryField() const
Return const-reference to the boundary field.
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
bool adjustPhi(surfaceScalarField &phi, const volVectorField &U, volScalarField &p)
Adjust the balance of fluxes to obey continuity.
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &df)
bool needReference() const
Does the field need a reference level for solution.
const dimensionedScalar e
Elementary charge.
virtual bool coupled() const
Return true if this patch field is coupled.
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
Boundary & boundaryFieldRef()
Return a reference to the boundary field.
For cases which do no have a pressure boundary adjust the balance of fluxes to obey continuity...
dimensioned< scalar > mag(const dimensioned< Type > &)
An abstract base class with a fat-interface to all derived classes covering all possible ways in whic...