View Issue Details

IDProjectCategoryView StatusLast Update
0004229OpenFOAMBugpublic2025-04-12 20:39
Reportermichael_h Assigned Tohenry  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Platformx86_64OSopenSUSEOS VersionLeap 15.6
Product Versiondev 
Fixed in Versiondev 
Summary0004229: waveSurfacePressure applies pRef twice
DescriptionIf a pRef object is defined and the waveSurfacePressure boundary condition is used then the calculated pressure has twice the value it should be.

A possible solution is attached. A different possibility would be to add a new parameter for the ambient pressure at the patch field instead of using pRef for this.
Steps To ReproduceCopy the file
tutorials/fluid/buoyantCavity/constant/pRef
to
tutorials/isothermalFluid/potentialFreeSurfaceOscillatingBox/constant/
and run the potentialFreeSurfaceOscillatingBox tutorial.

Expected is that the pressure is 1e5. In the result the pressure at the water surface is 1.9e5, however.
Additional InformationThis issue applies to dev as well as to OpenFOAM 12.
TagsNo tags attached.

Activities

michael_h

2025-04-12 10:50

reporter  

waveSurfacePressure.diff (2,135 bytes)   
diff --git a/src/finiteVolume/fields/fvPatchFields/derived/waveSurfacePressure/waveSurfacePressureFvPatchScalarField.C b/src/finiteVolume/fields/fvPatchFields/derived/waveSurfacePressure/waveSurfacePressureFvPatchScalarField.C
index 1656d3b67a..2d804a6513 100644
--- a/src/finiteVolume/fields/fvPatchFields/derived/waveSurfacePressure/waveSurfacePressureFvPatchScalarField.C
+++ b/src/finiteVolume/fields/fvPatchFields/derived/waveSurfacePressure/waveSurfacePressureFvPatchScalarField.C
@@ -212,10 +212,7 @@ void Foam::waveSurfacePressureFvPatchScalarField::updateCoeffs()
     const uniformDimensionedVectorField& g =
         db().lookupObject<uniformDimensionedVectorField>("g");
 
-    const uniformDimensionedScalarField& pRef =
-        this->db().template lookupObject<uniformDimensionedScalarField>("pRef");
-
-    operator==(pRef.value() - rhop*(g.value() & zetap));
+    operator==(- rhop * (g.value() & zetap));
 
     fixedValueFvPatchScalarField::updateCoeffs();
 }
diff --git a/src/finiteVolume/fields/fvPatchFields/derived/waveSurfacePressure/waveSurfacePressureFvPatchScalarField.H b/src/finiteVolume/fields/fvPatchFields/derived/waveSurfacePressure/waveSurfacePressureFvPatchScalarField.H
index 1e9e30dbb1..65e9c005a4 100644
--- a/src/finiteVolume/fields/fvPatchFields/derived/waveSurfacePressure/waveSurfacePressureFvPatchScalarField.H
+++ b/src/finiteVolume/fields/fvPatchFields/derived/waveSurfacePressure/waveSurfacePressureFvPatchScalarField.H
@@ -29,7 +29,7 @@ Description
     the hydrostatic pressure based on a given displacement:
 
         \f[
-            p_rgh = pref - \rho*g*\zeta
+            p_rgh = - \rho*g*\zeta
         \f]
 
     \vartable
@@ -64,6 +64,11 @@ Usage
     The density field is only required if the flux is mass-based as opposed to
     volumetric-based.
 
+    It is possible to set the ambient pressure by specifying a pRef object in
+    the constant folder. The patch field with this boundary condition must be
+    oriented perpendicular to gravity and should be in the same plane as the
+    origin of the coordinate system.
+    
 See also
     Foam::fixedValueFvPatchField
 
waveSurfacePressure.diff (2,135 bytes)   

henry

2025-04-12 20:39

manager   ~0013555

Resolved by commit 53941b20e3a4f56237b48787acfc5cbc8ce7d0a7

Issue History

Date Modified Username Field Change
2025-04-12 10:50 michael_h New Issue
2025-04-12 10:50 michael_h File Added: waveSurfacePressure.diff
2025-04-12 20:39 henry Assigned To => henry
2025-04-12 20:39 henry Status new => resolved
2025-04-12 20:39 henry Resolution open => fixed
2025-04-12 20:39 henry Fixed in Version => dev
2025-04-12 20:39 henry Note Added: 0013555