STYLE: simpler mass-flow/volume-flow dimension check
* (dimMass/dimTime) instead of (dimDensity*dimVelocity*dimArea) * (dimVolume/dimTime) instead of (dimVelocity*dimArea)
This commit is contained in:
parent
2db3e2b64f
commit
35dae3fc3b
@ -37,7 +37,7 @@ surfaceScalarField phi
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
mesh,
|
||||
dimensionedScalar(dimArea*dimVelocity, Zero)
|
||||
dimensionedScalar(dimVelocity*dimArea, Zero)
|
||||
);
|
||||
|
||||
multiphaseSystem fluid(U, phi);
|
||||
|
@ -53,7 +53,7 @@
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
mesh,
|
||||
dimensionedScalar(dimArea*dimVelocity, Zero)
|
||||
dimensionedScalar(dimVelocity*dimArea, Zero)
|
||||
);
|
||||
|
||||
volScalarField rho("rho", fluid.rho());
|
||||
|
@ -180,7 +180,7 @@ while (pimple.correct())
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
mesh,
|
||||
dimensionedScalar("phiHbyA", dimArea*dimVelocity, 0)
|
||||
dimensionedScalar(dimVelocity*dimArea, Zero)
|
||||
);
|
||||
|
||||
forAll(phases, phasei)
|
||||
|
@ -165,7 +165,7 @@ while (pimple.correct())
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
mesh,
|
||||
dimensionedScalar("phiHbyA", dimArea*dimVelocity, 0)
|
||||
dimensionedScalar(dimVelocity*dimArea, Zero)
|
||||
);
|
||||
|
||||
forAll(phases, phasei)
|
||||
|
@ -166,7 +166,7 @@ Foam::advectiveFvPatchField<Type>::advectionSpeed() const
|
||||
phiName_
|
||||
);
|
||||
|
||||
if (phi.dimensions() == dimDensity*dimVelocity*dimArea)
|
||||
if (phi.dimensions() == dimMass/dimTime)
|
||||
{
|
||||
const fvPatchScalarField& rhop =
|
||||
this->patch().template lookupPatchField<volScalarField, scalar>
|
||||
|
@ -77,7 +77,7 @@ void Foam::fanFvPatchField<Foam::scalar>::calcFanJump()
|
||||
}
|
||||
}
|
||||
|
||||
if (phi.dimensions() == dimDensity*dimVelocity*dimArea)
|
||||
if (phi.dimensions() == dimMass/dimTime)
|
||||
{
|
||||
Un /= patch().lookupPatchField<volScalarField, scalar>(rhoName_);
|
||||
}
|
||||
|
@ -162,11 +162,11 @@ void Foam::fanPressureFvPatchScalarField::updateCoeffs()
|
||||
// Average volumetric flow rate
|
||||
scalar volFlowRate = 0;
|
||||
|
||||
if (phi.dimensions() == dimVelocity*dimArea)
|
||||
if (phi.dimensions() == dimVolume/dimTime)
|
||||
{
|
||||
volFlowRate = dir*gSum(phip);
|
||||
}
|
||||
else if (phi.dimensions() == dimVelocity*dimArea*dimDensity)
|
||||
else if (phi.dimensions() == dimMass/dimTime)
|
||||
{
|
||||
const scalarField& rhop =
|
||||
patch().lookupPatchField<volScalarField, scalar>(rhoName());
|
||||
|
@ -115,11 +115,11 @@ void Foam::fluxCorrectedVelocityFvPatchVectorField::evaluate
|
||||
const vectorField n(patch().nf());
|
||||
const Field<scalar>& magS = patch().magSf();
|
||||
|
||||
if (phi.dimensions() == dimVelocity*dimArea)
|
||||
if (phi.dimensions() == dimVolume/dimTime)
|
||||
{
|
||||
operator==(*this - n*(n & *this) + n*phip/magS);
|
||||
}
|
||||
else if (phi.dimensions() == dimDensity*dimVelocity*dimArea)
|
||||
else if (phi.dimensions() == dimMass/dimTime)
|
||||
{
|
||||
const fvPatchField<scalar>& rhop =
|
||||
patch().lookupPatchField<volScalarField, scalar>(rhoName_);
|
||||
|
@ -140,12 +140,12 @@ void Foam::mappedFlowRateFvPatchVectorField::updateCoeffs()
|
||||
|
||||
vectorField n(patch().nf());
|
||||
|
||||
if (phiName.dimensions() == dimVelocity*dimArea)
|
||||
if (phiName.dimensions() == dimVolume/dimTime)
|
||||
{
|
||||
// volumetric flow-rate
|
||||
operator==(n*U);
|
||||
}
|
||||
else if (phiName.dimensions() == dimDensity*dimVelocity*dimArea)
|
||||
else if (phiName.dimensions() == dimMass/dimTime)
|
||||
{
|
||||
const fvPatchField<scalar>& rhop =
|
||||
patch().lookupPatchField<volScalarField, scalar>(rhoName_);
|
||||
|
@ -196,7 +196,7 @@ void Foam::plenumPressureFvPatchScalarField::updateCoeffs()
|
||||
|
||||
// Calculate the current mass flow rate
|
||||
scalar massFlowRate(1.0);
|
||||
if (phi.internalField().dimensions() == dimVelocity*dimArea)
|
||||
if (phi.internalField().dimensions() == dimVolume/dimTime)
|
||||
{
|
||||
if (hasRho_)
|
||||
{
|
||||
@ -209,11 +209,7 @@ void Foam::plenumPressureFvPatchScalarField::updateCoeffs()
|
||||
<< exit(FatalError);
|
||||
}
|
||||
}
|
||||
else if
|
||||
(
|
||||
phi.internalField().dimensions()
|
||||
== dimDensity*dimVelocity*dimArea
|
||||
)
|
||||
else if (phi.internalField().dimensions() == dimMass/dimTime)
|
||||
{
|
||||
if (hasRho_)
|
||||
{
|
||||
|
@ -160,11 +160,11 @@ void Foam::pressureDirectedInletOutletVelocityFvPatchVectorField::updateCoeffs()
|
||||
tmp<vectorField> n = patch().nf();
|
||||
tmp<scalarField> ndmagS = (n & inletDir_)*patch().magSf();
|
||||
|
||||
if (phi.dimensions() == dimVelocity*dimArea)
|
||||
if (phi.dimensions() == dimVolume/dimTime)
|
||||
{
|
||||
refValue() = inletDir_*phip/ndmagS;
|
||||
}
|
||||
else if (phi.dimensions() == dimDensity*dimVelocity*dimArea)
|
||||
else if (phi.dimensions() == dimMass/dimTime)
|
||||
{
|
||||
const fvPatchField<scalar>& rhop =
|
||||
patch().lookupPatchField<volScalarField, scalar>(rhoName_);
|
||||
|
@ -150,11 +150,11 @@ void Foam::pressureDirectedInletVelocityFvPatchVectorField::updateCoeffs()
|
||||
tmp<vectorField> n = patch().nf();
|
||||
tmp<scalarField> ndmagS = (n & inletDir_)*patch().magSf();
|
||||
|
||||
if (phi.dimensions() == dimVelocity*dimArea)
|
||||
if (phi.dimensions() == dimVolume/dimTime)
|
||||
{
|
||||
operator==(inletDir_*phip/ndmagS);
|
||||
}
|
||||
else if (phi.dimensions() == dimDensity*dimVelocity*dimArea)
|
||||
else if (phi.dimensions() == dimMass/dimTime)
|
||||
{
|
||||
const fvPatchField<scalar>& rhop =
|
||||
patch().lookupPatchField<volScalarField, scalar>(rhoName_);
|
||||
|
@ -134,11 +134,11 @@ void Foam::pressureInletOutletParSlipVelocityFvPatchVectorField::updateCoeffs()
|
||||
vectorField Ut(patchInternalField());
|
||||
Ut -= n()*(Ut & n());
|
||||
|
||||
if (phi.dimensions() == dimVelocity*dimArea)
|
||||
if (phi.dimensions() == dimVolume/dimTime)
|
||||
{
|
||||
refValue() = Ut + n*phip/magSf;
|
||||
}
|
||||
else if (phi.dimensions() == dimDensity*dimVelocity*dimArea)
|
||||
else if (phi.dimensions() == dimMass/dimTime)
|
||||
{
|
||||
const fvPatchField<scalar>& rhop =
|
||||
patch().lookupPatchField<volScalarField, scalar>(rhoName_);
|
||||
|
@ -118,11 +118,11 @@ void Foam::pressureInletVelocityFvPatchVectorField::updateCoeffs()
|
||||
tmp<vectorField> n = patch().nf();
|
||||
const Field<scalar>& magS = patch().magSf();
|
||||
|
||||
if (phi.dimensions() == dimVelocity*dimArea)
|
||||
if (phi.dimensions() == dimVolume/dimTime)
|
||||
{
|
||||
operator==(n*phip/magS);
|
||||
}
|
||||
else if (phi.dimensions() == dimDensity*dimVelocity*dimArea)
|
||||
else if (phi.dimensions() == dimMass/dimTime)
|
||||
{
|
||||
const fvPatchField<scalar>& rhop =
|
||||
patch().lookupPatchField<volScalarField, scalar>(rhoName_);
|
||||
|
@ -130,11 +130,11 @@ void Foam::pressureNormalInletOutletVelocityFvPatchVectorField::updateCoeffs()
|
||||
tmp<vectorField> n = patch().nf();
|
||||
const Field<scalar>& magS = patch().magSf();
|
||||
|
||||
if (phi.dimensions() == dimVelocity*dimArea)
|
||||
if (phi.dimensions() == dimVolume/dimTime)
|
||||
{
|
||||
refValue() = n*phip/magS;
|
||||
}
|
||||
else if (phi.dimensions() == dimDensity*dimVelocity*dimArea)
|
||||
else if (phi.dimensions() == dimMass/dimTime)
|
||||
{
|
||||
const fvPatchField<scalar>& rhop =
|
||||
patch().lookupPatchField<volScalarField, scalar>(rhoName_);
|
||||
|
@ -238,11 +238,11 @@ void Foam::pressurePIDControlInletVelocityFvPatchVectorField::updateCoeffs()
|
||||
|
||||
// Get the density
|
||||
scalar rho = 1;
|
||||
if (phi.dimensions() == dimVelocity*dimArea)
|
||||
if (phi.dimensions() == dimVolume/dimTime)
|
||||
{
|
||||
// do nothing ...
|
||||
}
|
||||
else if (phi.dimensions() == dimDensity*dimVelocity*dimArea)
|
||||
else if (phi.dimensions() == dimMass/dimTime)
|
||||
{
|
||||
const fvPatchField<scalar>& rhoField =
|
||||
patch().lookupPatchField<volScalarField, scalar>(rhoName_);
|
||||
@ -254,9 +254,9 @@ void Foam::pressurePIDControlInletVelocityFvPatchVectorField::updateCoeffs()
|
||||
FatalErrorInFunction
|
||||
<< "The dimensions of the field " << phiName_
|
||||
<< "are not recognised. The dimensions are " << phi.dimensions()
|
||||
<< ". The dimensions should be either " << dimVelocity*dimArea
|
||||
<< ". The dimensions should be either " << dimVolume/dimTime
|
||||
<< " for an incompressible case, or "
|
||||
<< dimDensity*dimVelocity*dimArea << " for a compressible case."
|
||||
<< dimMass/dimTime << " for a compressible case."
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
|
@ -138,11 +138,11 @@ updateCoeffs()
|
||||
|
||||
const vectorField n(patch().nf());
|
||||
|
||||
if (phi.dimensions() == dimVelocity*dimArea)
|
||||
if (phi.dimensions() == dimVolume/dimTime)
|
||||
{
|
||||
refValue() = (phip/patch().magSf())*n;
|
||||
}
|
||||
else if (phi.dimensions() == dimDensity*dimVelocity*dimArea)
|
||||
else if (phi.dimensions() == dimMass/dimTime)
|
||||
{
|
||||
const fvPatchField<scalar>& rhop =
|
||||
patch().lookupPatchField<volScalarField, scalar>(rhoName_);
|
||||
|
@ -171,12 +171,12 @@ void Foam::swirlFlowRateInletVelocityFvPatchVectorField::updateCoeffs()
|
||||
const surfaceScalarField& phi =
|
||||
db().lookupObject<surfaceScalarField>(phiName_);
|
||||
|
||||
if (phi.dimensions() == dimVelocity*dimArea)
|
||||
if (phi.dimensions() == dimVolume/dimTime)
|
||||
{
|
||||
// volumetric flow-rate
|
||||
operator==(tangentialVelocity + n*avgU);
|
||||
}
|
||||
else if (phi.dimensions() == dimDensity*dimVelocity*dimArea)
|
||||
else if (phi.dimensions() == dimMass/dimTime)
|
||||
{
|
||||
const fvPatchField<scalar>& rhop =
|
||||
patch().lookupPatchField<volScalarField, scalar>(rhoName_);
|
||||
|
@ -206,11 +206,11 @@ void Foam::syringePressureFvPatchScalarField::updateCoeffs()
|
||||
const fvsPatchField<scalar>& phip =
|
||||
patch().patchField<surfaceScalarField, scalar>(phi);
|
||||
|
||||
if (phi.dimensions() == dimVelocity*dimArea)
|
||||
if (phi.dimensions() == dimVolume/dimTime)
|
||||
{
|
||||
ams_ = ams0_ + deltaT*sum((*this*psi_)*phip);
|
||||
}
|
||||
else if (phi.dimensions() == dimDensity*dimVelocity*dimArea)
|
||||
else if (phi.dimensions() == dimMass/dimTime)
|
||||
{
|
||||
ams_ = ams0_ + deltaT*sum(phip);
|
||||
}
|
||||
|
@ -164,7 +164,7 @@ void Foam::waveSurfacePressureFvPatchScalarField::updateCoeffs()
|
||||
// Change in zeta due to flux
|
||||
vectorField dZetap(dt*nf()*phi.boundaryField()[patchi]/patch().magSf());
|
||||
|
||||
if (phi.dimensions() == dimDensity*dimVelocity*dimArea)
|
||||
if (phi.dimensions() == dimMass/dimTime)
|
||||
{
|
||||
const scalarField& rhop =
|
||||
patch().lookupPatchField<volScalarField, scalar>(rhoName_);
|
||||
|
@ -121,7 +121,7 @@ Foam::waveTransmissiveFvPatchField<Type>::advectionSpeed() const
|
||||
this->patch().template
|
||||
lookupPatchField<surfaceScalarField, scalar>(this->phiName_);
|
||||
|
||||
if (phi.dimensions() == dimDensity*dimVelocity*dimArea)
|
||||
if (phi.dimensions() == dimMass/dimTime)
|
||||
{
|
||||
const fvPatchScalarField& rhop =
|
||||
this->patch().template
|
||||
|
@ -68,7 +68,7 @@ Foam::PhiScheme<Type, PhiLimiter>::limiter
|
||||
|
||||
tmp<surfaceScalarField> tUflux = this->faceFlux_;
|
||||
|
||||
if (this->faceFlux_.dimensions() == dimDensity*dimVelocity*dimArea)
|
||||
if (this->faceFlux_.dimensions() == dimMass/dimTime)
|
||||
{
|
||||
const volScalarField& rho =
|
||||
phi.db().objectRegistry::template lookupObject<volScalarField>
|
||||
@ -76,7 +76,7 @@ Foam::PhiScheme<Type, PhiLimiter>::limiter
|
||||
|
||||
tUflux = this->faceFlux_/fvc::interpolate(rho);
|
||||
}
|
||||
else if (this->faceFlux_.dimensions() != dimVelocity*dimArea)
|
||||
else if (this->faceFlux_.dimensions() != dimVolume/dimTime)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "dimensions of faceFlux are not correct"
|
||||
|
@ -199,7 +199,7 @@ public:
|
||||
const fvMesh& mesh = this->mesh();
|
||||
tmp<surfaceScalarField> tUflux = faceFlux_;
|
||||
|
||||
if (faceFlux_.dimensions() == dimDensity*dimVelocity*dimArea)
|
||||
if (faceFlux_.dimensions() == dimMass/dimTime)
|
||||
{
|
||||
// Currently assume that the density field
|
||||
// corresponding to the mass-flux is named "rho"
|
||||
@ -209,7 +209,7 @@ public:
|
||||
|
||||
tUflux = faceFlux_/fvc::interpolate(rho);
|
||||
}
|
||||
else if (faceFlux_.dimensions() != dimVelocity*dimArea)
|
||||
else if (faceFlux_.dimensions() != dimVolume/dimTime)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "dimensions of faceFlux are not correct"
|
||||
|
@ -208,7 +208,7 @@ public:
|
||||
const fvMesh& mesh = this->mesh();
|
||||
tmp<surfaceScalarField> tUflux = faceFlux_;
|
||||
|
||||
if (faceFlux_.dimensions() == dimDensity*dimVelocity*dimArea)
|
||||
if (faceFlux_.dimensions() == dimMass/dimTime)
|
||||
{
|
||||
// Currently assume that the density field
|
||||
// corresponding to the mass-flux is named "rho"
|
||||
@ -218,7 +218,7 @@ public:
|
||||
|
||||
tUflux = faceFlux_/fvc::interpolate(rho);
|
||||
}
|
||||
else if (faceFlux_.dimensions() != dimVelocity*dimArea)
|
||||
else if (faceFlux_.dimensions() != dimVolume/dimTime)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "dimensions of faceFlux are not correct"
|
||||
|
@ -268,7 +268,7 @@ void Foam::fv::directionalPressureGradientExplicitSource::correct
|
||||
{
|
||||
case pDarcyForchheimer:
|
||||
{
|
||||
if (phi.dimensions() == dimVelocity*dimArea)
|
||||
if (phi.dimensions() == dimVolume/dimTime)
|
||||
{
|
||||
const auto& turbModel =
|
||||
mesh().lookupObject<incompressible::turbulenceModel>
|
||||
@ -323,7 +323,7 @@ void Foam::fv::directionalPressureGradientExplicitSource::correct
|
||||
}
|
||||
reduce(totalphi, sumOp<scalar>());
|
||||
|
||||
if (phi.dimensions() == dimVelocity*dimArea)
|
||||
if (phi.dimensions() == dimVolume/dimTime)
|
||||
{
|
||||
volFlowRate = mag(totalphi);
|
||||
}
|
||||
|
@ -133,7 +133,7 @@ Foam::scalar Foam::PatchFlowRateInjection<CloudType>::flowRate() const
|
||||
const scalarField& phip = phi.boundaryField()[patchId_];
|
||||
|
||||
scalar flowRateIn = 0.0;
|
||||
if (phi.dimensions() == dimVelocity*dimArea)
|
||||
if (phi.dimensions() == dimVolume/dimTime)
|
||||
{
|
||||
flowRateIn = max(0.0, -sum(phip));
|
||||
}
|
||||
|
@ -176,9 +176,9 @@ void Foam::filmPyrolysisVelocityCoupledFvPatchVectorField::updateCoeffs()
|
||||
const surfaceScalarField& phi =
|
||||
db().lookupObject<surfaceScalarField>(phiName_);
|
||||
|
||||
if (phi.dimensions() == dimVelocity*dimArea)
|
||||
if (phi.dimensions() == dimVolume/dimTime)
|
||||
{}
|
||||
else if (phi.dimensions() == dimDensity*dimVelocity*dimArea)
|
||||
else if (phi.dimensions() == dimMass/dimTime)
|
||||
{
|
||||
const fvPatchField<scalar>& rhop =
|
||||
patch().lookupPatchField<volScalarField, scalar>(rhoName_);
|
||||
|
@ -160,7 +160,7 @@ void Foam::outletMachNumberPressureFvPatchScalarField::updateCoeffs()
|
||||
patch().lookupPatchField<surfaceScalarField, scalar>(phiName_);
|
||||
|
||||
// Calculate the current mass flow rate
|
||||
if (phi.internalField().dimensions() != dimDensity*dimVelocity*dimArea)
|
||||
if (phi.internalField().dimensions() != dimMass/dimTime)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<<"phi is not a mass flux." << exit(FatalError);
|
||||
|
Loading…
Reference in New Issue
Block a user