41 if (
p.needReference())
44 scalar fixedMassOut = 0.0;
45 scalar adjustableMassOut = 0.0;
55 if (!isA<processorFvPatchVectorField>(Up))
57 if (Up.
fixesValue() && !isA<inletOutletFvPatchVectorField>(Up))
67 fixedMassOut += phip[i];
81 adjustableMassOut += phip[i];
89 scalar totalFlux = vSmall +
sum(
mag(phi)).value();
95 scalar massCorr = 1.0;
96 scalar magAdjustableMassOut =
mag(adjustableMassOut);
100 magAdjustableMassOut > vSmall
101 && magAdjustableMassOut/totalFlux > small
104 massCorr = (massIn - fixedMassOut)/adjustableMassOut;
106 else if (
mag(fixedMassOut - massIn)/totalFlux > 1
e-8)
109 <<
"Continuity error cannot be removed by adjusting the"
110 " outflow.\nPlease check the velocity boundary conditions"
111 " and/or run potentialFoam to initialise the outflow." <<
nl
112 <<
"Total flux : " << totalFlux <<
nl
113 <<
"Specified mass inflow : " << massIn <<
nl
114 <<
"Specified mass outflow : " << fixedMassOut <<
nl
115 <<
"Adjustable mass outflow : " << adjustableMassOut <<
nl
129 || isA<inletOutletFvPatchVectorField>(Up)
143 return mag(massIn)/totalFlux < small
144 &&
mag(fixedMassOut)/totalFlux < small
145 &&
mag(adjustableMassOut)/totalFlux < small;
#define forAll(list, i)
Loop across all elements in list.
For cases which do no have a pressure boundary adjust the balance of fluxes to obey continuity....
Generic GeometricBoundaryField class.
Generic GeometricField class.
Boundary & boundaryFieldRef()
Return a reference to the boundary field.
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
virtual bool fixesValue() const
Return true if this patch field fixes a value.
An abstract base class with a fat-interface to all derived classes covering all possible ways in whic...
virtual bool coupled() const
Return true if this patch field is coupled.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
const dimensionedScalar e
Elementary charge.
errorManipArg< error, int > exit(error &err, const int errNo=1)
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)
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
dimensioned< scalar > mag(const dimensioned< Type > &)