From da0b026305e7eaeb9076916b2df6e61056ae1e81 Mon Sep 17 00:00:00 2001 From: Henry <Henry> Date: Sat, 18 Apr 2015 19:31:31 +0100 Subject: [PATCH] prghPressureFvPatchScalarField: Add support for hRef --- .../prghPressure/prghPressureFvPatchScalarField.C | 14 ++++++++++++-- .../prghPressure/prghPressureFvPatchScalarField.H | 7 ++++--- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/finiteVolume/fields/fvPatchFields/derived/prghPressure/prghPressureFvPatchScalarField.C b/src/finiteVolume/fields/fvPatchFields/derived/prghPressure/prghPressureFvPatchScalarField.C index 2338247e788..c86986f7110 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/prghPressure/prghPressureFvPatchScalarField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/prghPressure/prghPressureFvPatchScalarField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2013 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2013-2015 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -152,7 +152,17 @@ void Foam::prghPressureFvPatchScalarField::updateCoeffs() const uniformDimensionedVectorField& g = db().lookupObject<uniformDimensionedVectorField>("g"); - operator==(p_ - rhop*((g.value() & patch().Cf()))); + const uniformDimensionedScalarField& hRef = + db().lookupObject<uniformDimensionedScalarField>("hRef"); + + dimensionedScalar ghRef + ( + mag(g.value()) > SMALL + ? g & (cmptMag(g.value())/mag(g.value()))*hRef + : dimensionedScalar("ghRef", g.dimensions()*dimLength, 0) + ); + + operator==(p_ - rhop*((g.value() & patch().Cf()) - ghRef.value())); fixedValueFvPatchScalarField::updateCoeffs(); } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/prghPressure/prghPressureFvPatchScalarField.H b/src/finiteVolume/fields/fvPatchFields/derived/prghPressure/prghPressureFvPatchScalarField.H index 9431ae325e2..bad53659f00 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/prghPressure/prghPressureFvPatchScalarField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/prghPressure/prghPressureFvPatchScalarField.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2013 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2013-2015 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -32,7 +32,7 @@ Description calculated as: \f[ - p_rgh = p - \rho g h + p_rgh = p - \rho g (h - hRef) \f] where @@ -40,8 +40,9 @@ Description p_rgh | Pseudo hydrostatic pressure [Pa] p | Static pressure [Pa] h | Height in the opposite direction to gravity + hRef | Reference height in the opposite direction to gravity \rho | density - g | acceleration due to gravity [m/s2] + g | acceleration due to gravity [m/s^2] \endtable \heading Patch usage -- GitLab