totalPressureFvPatchScalarField: Improved handling of the pressureInletOutletVelocity tangential velocity

This commit is contained in:
Henry Weller
2022-02-04 22:09:13 +00:00
parent a7030ee97e
commit 3f2f3c8a43
4 changed files with 33 additions and 43 deletions

View File

@ -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<scalar>& phip =
patch().lookupPatchField<surfaceScalarField, scalar>(phiName_);
const fvPatchField<vector>& Up =
patch().lookupPatchField<volVectorField, vector>(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)
);
}

View File

@ -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<scalar>& phip =
patch().lookupPatchField<surfaceScalarField, scalar>(phiName_);
const vectorField Up
(
patch().lookupPatchField<volVectorField, vector>(UName_)
+ (omega ^ (patch().Cf() - axis*(axis & patch().Cf())))
);
totalPressureFvPatchScalarField::updateCoeffs(p0_, Up);
dynamicPressureFvPatchScalarField::updateCoeffs
(
p0_,
0.5*neg(phip)*magSqr(Up)
);
}

View File

@ -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<scalar>& phip =
patch().lookupPatchField<surfaceScalarField, scalar>(phiName_);
dynamicPressureFvPatchScalarField::updateCoeffs
(
p0_,
0.5*neg(phip)*magSqr(Up)
);
}
void Foam::totalPressureFvPatchScalarField::updateCoeffs()
{
const fvPatchField<vector>& Up =
patch().lookupPatchField<volVectorField, vector>(UName_);
scalarField Kp = magSqr(Up);
if (isA<pressureInletOutletVelocityFvPatchVectorField>(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
);
}

View File

@ -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();