diff --git a/src/finiteVolume/fields/fvPatchFields/derived/fanPressure/fanPressureFvPatchScalarField.C b/src/finiteVolume/fields/fvPatchFields/derived/fanPressure/fanPressureFvPatchScalarField.C index d15791ef85..5d7e8c6b4f 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/fanPressure/fanPressureFvPatchScalarField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/fanPressure/fanPressureFvPatchScalarField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -115,10 +115,11 @@ void Foam::fanPressureFvPatchScalarField::updateCoeffs() const fvsPatchField& phip = patch().lookupPatchField(phiName_); + const fvPatchField& Up = patch().lookupPatchField(UName_); - int sign = direction_ ? +1 : -1; + const int sign = direction_ ? +1 : -1; // Get the volumetric flow rate scalar volFlowRate = 0; @@ -149,7 +150,11 @@ void Foam::fanPressureFvPatchScalarField::updateCoeffs() // Pressure drop for this flow rate const scalar dp0 = fanCurve_->value(max(volFlowRate, scalar(0))); - totalPressureFvPatchScalarField::updateCoeffs(p0_ - sign*dp0, Up); + dynamicPressureFvPatchScalarField::updateCoeffs + ( + p0_ - sign*dp0, + 0.5*neg(phip)*magSqr(Up) + ); } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/rotatingTotalPressure/rotatingTotalPressureFvPatchScalarField.C b/src/finiteVolume/fields/fvPatchFields/derived/rotatingTotalPressure/rotatingTotalPressureFvPatchScalarField.C index 48d197fd1d..e0c02d0673 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/rotatingTotalPressure/rotatingTotalPressureFvPatchScalarField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/rotatingTotalPressure/rotatingTotalPressureFvPatchScalarField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -95,13 +95,20 @@ void Foam::rotatingTotalPressureFvPatchScalarField::updateCoeffs() const vector omega = omega_->value(t); const vector axis = omega/mag(omega); + const fvsPatchField& phip = + patch().lookupPatchField(phiName_); + const vectorField Up ( patch().lookupPatchField(UName_) + (omega ^ (patch().Cf() - axis*(axis & patch().Cf()))) ); - totalPressureFvPatchScalarField::updateCoeffs(p0_, Up); + dynamicPressureFvPatchScalarField::updateCoeffs + ( + p0_, + 0.5*neg(phip)*magSqr(Up) + ); } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/totalPressure/totalPressureFvPatchScalarField.C b/src/finiteVolume/fields/fvPatchFields/derived/totalPressure/totalPressureFvPatchScalarField.C index 945189142d..57e1f068f7 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/totalPressure/totalPressureFvPatchScalarField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/totalPressure/totalPressureFvPatchScalarField.C @@ -84,28 +84,16 @@ Foam::totalPressureFvPatchScalarField::totalPressureFvPatchScalarField // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -void Foam::totalPressureFvPatchScalarField::updateCoeffs -( - const scalarField& p0p, - const vectorField& Up -) +void Foam::totalPressureFvPatchScalarField::updateCoeffs() { const fvsPatchField& phip = patch().lookupPatchField(phiName_); - dynamicPressureFvPatchScalarField::updateCoeffs - ( - p0_, - 0.5*neg(phip)*magSqr(Up) - ); -} - - -void Foam::totalPressureFvPatchScalarField::updateCoeffs() -{ const fvPatchField& Up = patch().lookupPatchField(UName_); + scalarField Kp = magSqr(Up); + if (isA(Up)) { const pressureInletOutletVelocityFvPatchVectorField& Upiov = @@ -114,17 +102,15 @@ void Foam::totalPressureFvPatchScalarField::updateCoeffs() if (Upiov.tangentialVelocity().valid()) { const scalar t = this->db().time().userTimeValue(); - updateCoeffs(p0_, Up - Upiov.tangentialVelocity()->value(t)); - } - else - { - updateCoeffs(p0_, Up); + Kp -= magSqr(Upiov.tangentialVelocity()->value(t)); } } - else - { - updateCoeffs(p0_, Up); - } + + dynamicPressureFvPatchScalarField::updateCoeffs + ( + p0_, + 0.5*neg(phip)*Kp + ); } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/totalPressure/totalPressureFvPatchScalarField.H b/src/finiteVolume/fields/fvPatchFields/derived/totalPressure/totalPressureFvPatchScalarField.H index b652811c85..a1122175cb 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/totalPressure/totalPressureFvPatchScalarField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/totalPressure/totalPressureFvPatchScalarField.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -35,7 +35,7 @@ Description where \vartable p_p | incompressible pressure at patch [m^2/s^2] - p_0 | incompressible total pressure [m^2/s^2] + p_0 | incompressible external pressure [m^2/s^2] U | velocity [m/s] \endvartable @@ -46,7 +46,7 @@ Description where \vartable p_p | pressure at patch [Pa] - p_0 | total pressure [Pa] + p_0 | external pressure [Pa] \rho | density [kg/m^3] U | velocity [m/s] \endvartable @@ -58,7 +58,7 @@ Description where \vartable p_p | pressure at patch [Pa] - p_0 | total pressure [Pa] + p_0 | external pressure [Pa] \psi | compressibility [m^2/s^2] U | velocity [m/s] \endvartable @@ -70,7 +70,7 @@ Description where \vartable p_p | pressure at patch [Pa] - p_0 | total pressure [Pa] + p_0 | external pressure [Pa] \psi | compressibility [m^2/s^2] G | coefficient given by \f$\frac{\gamma}{1-\gamma}\f$ [] \gamma | ratio of specific heats (Cp/Cv) [] @@ -96,7 +96,7 @@ Usage rho | Density field name | no | rho psi | Compressibility field name | no | none gamma | (Cp/Cv) | no | 1 - p0 | Total pressure | yes | + p0 | External pressure | yes | \endtable Example of the boundary condition specification: @@ -209,14 +209,6 @@ public: // Evaluation functions - //- Update the coefficients associated with the patch field - // using the given patch total pressure and velocity fields - void updateCoeffs - ( - const scalarField& p0p, - const vectorField& Up - ); - //- Update the coefficients associated with the patch field virtual void updateCoeffs();