40 if (p.needReference())
43 scalar fixedMassOut = 0.0;
44 scalar adjustableMassOut = 0.0;
46 surfaceScalarField::Boundary& bphi =
47 phi.boundaryFieldRef();
56 if (Up.fixesValue() && !isA<inletOutletFvPatchVectorField>(Up))
66 fixedMassOut += phip[i];
80 adjustableMassOut += phip[i];
88 scalar totalFlux = vSmall +
sum(
mag(phi)).value();
90 reduce(massIn, sumOp<scalar>());
91 reduce(fixedMassOut, sumOp<scalar>());
92 reduce(adjustableMassOut, sumOp<scalar>());
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;
fvsPatchField< scalar > fvsPatchScalarField
#define forAll(list, i)
Loop across all elements in list.
fvPatchField< vector > fvPatchVectorField
errorManipArg< error, int > exit(error &err, const int errNo=1)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
GeometricField< vector, fvPatchField, volMesh > volVectorField
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &df)
GeometricField< scalar, fvPatchField, volMesh > volScalarField
bool adjustPhi(surfaceScalarField &phi, const volVectorField &U, volScalarField &p)
Adjust the balance of fluxes to obey continuity.
volScalarField & e
Elementary charge.
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
For cases which do no have a pressure boundary adjust the balance of fluxes to obey continuity...
dimensioned< scalar > mag(const dimensioned< Type > &)
GeometricField< scalar, fvsPatchField, surfaceMesh > surfaceScalarField