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;
For cases which do no have a pressure boundary adjust the balance of fluxes to obey continuity....
reduce(hasMovingMesh, orOp< bool >())
virtual bool fixesValue() const
Return true if this patch field fixes a value.
virtual bool coupled() const
Return true if this 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.
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &df)
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
errorManipArg< error, int > exit(error &err, const int errNo=1)
constexpr char nl
The newline '\n' character (0x0a)
#define forAll(list, i)
Loop across all elements in list.