|
[Sponsors] |
Pressure Function Object Crashes When Set To Output Static Pressure |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
April 3, 2021, 18:10 |
Pressure Function Object Crashes When Set To Output Static Pressure
|
#1 |
Senior Member
Claudio Boezio
Join Date: May 2020
Location: Europe
Posts: 137
Rep Power: 7 |
I'm attempting to obtain a pressure result field with the hydrostatic pressure for a two-phase case. I'm using OpenFOAM v8. According to the documentation, for that both calcTotal and calcCoeff have to be set to no. When I start interFoam, it crashes right after the time loop starts and I get the following error message:
Code:
--> FOAM FATAL ERROR: Attempt to acquire non-const reference to const object from a tmp<N4Foam14GeometricFieldIdNS_12fvPatchFieldENS_7volMeshEEE> From function T& Foam::tmp<T>::ref() const [with T = Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>] in file /home/ubuntu/OpenFOAM/OpenFOAM-8/src/OpenFOAM/lnInclude/tmpI.H at line 187. FOAM aborting #0 Foam::error::printStack(Foam::Ostream&) at ??:? #1 Foam::error::abort() at ??:? #2 Foam::tmp<Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> >::ref() const in "/opt/openfoam8/platforms/linux64GccDPInt32Opt/bin/interFoam" #3 bool Foam::functionObjects::regionFunctionObject::store<Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> >(Foam::word const&, Foam::tmp<Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> > const&, bool) at ??:? #4 Foam::functionObjects::pressure::calc() at ??:? #5 Foam::functionObjects::fieldExpression::execute() at ??:? #6 Foam::functionObjects::timeControl::execute() at ??:? #7 Foam::functionObjectList::start() at ??:? #8 Foam::Time::run() const at ??:? #9 Foam::pimpleControl::run(Foam::Time&) at ??:? #10 ? in "/opt/openfoam8/platforms/linux64GccDPInt32Opt/bin/interFoam" #11 __libc_start_main in "/lib/x86_64-linux-gnu/libc.so.6" #12 ? in "/opt/openfoam8/platforms/linux64GccDPInt32Opt/bin/interFoam" Aborted Code:
HydrostaticPressure { // Mandatory entries (unmodifiable) type pressure; libs ("libfieldFunctionObjects.so"); // Mandatory entries (runtime modifiable) calcTotal no; calcCoeff no; log on; pInf 0; pRef 0; UInf (-4.992 0 0); rhoInf 1025; // Water phase writeControl outputTime; // Optional entries (runtime modifiable) field p; U U; rho rho; g (0 0 -9.81); hRef 0; result p_hs; } See combinations with these settings: Code:
Mode calcTotal calcCoeff Crashing Static pressure no no yes Total pressure yes no no Pressure coefficient no yes no Total pressure coefficient yes yes no Cheers, Claudio |
|
June 24, 2021, 12:49 |
|
#2 |
New Member
Juan Pablo Carbajal
Join Date: Jun 2021
Posts: 23
Rep Power: 5 |
I am having the same issue with v8 and a case solved with interFoam.
When I try to postprocess the static pressure I get: Code:
$ postProcess -func "hydrostaticPressure(p)" /*---------------------------------------------------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org \\ / A nd | Version: 8 \\/ M anipulation | \*---------------------------------------------------------------------------*/ Build : 8-1c9b5879390b Exec : postProcess -func hydrostaticPressure(p) Date : Jun 24 2021 Time : 17:47:20 Host : "katara" PID : 24752 I/O : uncollated Case : XXX nProcs : 1 sigFpe : Enabling floating point exception trapping (FOAM_SIGFPE). fileModificationChecking : Monitoring run-time modified files using timeStampMaster (fileModificationSkew 10) allowSystemOperations : Allowing user-supplied system call operations // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // Create time Create mesh for time = 0 Time = 0 Reading fields: Executing functionObjects --> FOAM Warning : functionObjects::pressure hydrostaticPressure(p) cannot find required object p of type volScalarField --> FOAM Warning : functionObjects::pressure hydrostaticPressure(p) failed to execute. Time = 0.5 Reading fields: volScalarFields: p Executing functionObjects --> FOAM FATAL ERROR: Attempt to acquire non-const reference to const object from a tmp<N4Foam14GeometricFieldIdNS_12fvPatchFieldENS_7volMeshEEE> From function T& Foam::tmp<T>::ref() const [with T = Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>] in file /home/ubuntu/OpenFOAM/OpenFOAM-8/src/OpenFOAM/lnInclude/tmpI.H at line 187. FOAM aborting #0 Foam::error::printStack(Foam::Ostream&) at ??:? #1 Foam::error::abort() at ??:? #2 Foam::tmp<Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> >::ref() const at ??:? #3 bool Foam::functionObjects::regionFunctionObject::store<Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> >(Foam::word const&, Foam::tmp<Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> > const&, bool) at ??:? #4 Foam::functionObjects::pressure::calc() at ??:? #5 Foam::functionObjects::fieldExpression::execute() at ??:? #6 Foam::functionObjectList::execute() at ??:? #7 ? in "/opt/openfoam8/platforms/linux64GccDPInt32Opt/bin/postProcess" #8 ? in "/opt/openfoam8/platforms/linux64GccDPInt32Opt/bin/postProcess" #9 __libc_start_main in "/lib/x86_64-linux-gnu/libc.so.6" #10 ? in "/opt/openfoam8/platforms/linux64GccDPInt32Opt/bin/postProcess" Aborted (core dumped) Code:
postProcess -time 0.5: -func "hydrostaticPressure(p) The contents of the function file system/hydrostaticPressure is Code:
$ cat system/hydrostaticPressure /*--------------------------------*- C++ -*----------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org \\ / A nd | Version: 8 \\/ M anipulation | ------------------------------------------------------------------------------- Description Writes out values of the hydrostatic pressure field. \*---------------------------------------------------------------------------*/ type pressure; libs ("libfieldFunctionObjects.so"); calcTotal no; calcCoeff no; Any help is highly appreciated Regards, |
|
June 24, 2021, 13:21 |
|
#3 |
Senior Member
Herpes Free Engineer
Join Date: Sep 2019
Location: The Home Under The Ground with the Lost Boys
Posts: 931
Rep Power: 13 |
Hi,
Any chance for you to reproduce the matter by a standard tutorial, so that we can try to reproduce the issue?
__________________
The OpenFOAM community is the biggest contributor to OpenFOAM: User guide/Wiki-1/Wiki-2/Code guide/Code Wiki/Journal Nilsson/Guerrero/Holzinger/Holzmann/Nagy/Santos/Nozaki/Jasak/Primer Governance Bugs/Features: OpenFOAM (ESI-OpenCFD-Trademark) Bugs/Features: FOAM-Extend (Wikki-FSB) Bugs: OpenFOAM.org How to create a MWE New: Forkable OpenFOAM mirror |
|
June 24, 2021, 15:22 |
|
#4 |
New Member
Juan Pablo Carbajal
Join Date: Jun 2021
Posts: 23
Rep Power: 5 |
The error is reproduced using the damBreak tutorial
Code:
$ cd ~/OpenFOAM/juanpi-8/run $ cp -r ${FOAM_TUTORIALS}/multiphase/interFoam/laminar/damBreak . $ cd damBreak $ ./Allrun $ cd damBreak $ postProcess -func "staticPressure(p)" /*---------------------------------------------------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org \\ / A nd | Version: 8 \\/ M anipulation | \*---------------------------------------------------------------------------*/ Build : 8-1c9b5879390b Exec : postProcess -func staticPressure(p) Date : Jun 24 2021 Time : 19:20:16 Host : "katara" PID : 28589 I/O : uncollated Case : /home/juanpi/OpenFOAM/juanpi-8/run/damBreak/damBreak nProcs : 1 sigFpe : Enabling floating point exception trapping (FOAM_SIGFPE). fileModificationChecking : Monitoring run-time modified files using timeStampMaster (fileModificationSkew 10) allowSystemOperations : Allowing user-supplied system call operations // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // Create time Create mesh for time = 0 Time = 0 Reading fields: Executing functionObjects --> FOAM Warning : functionObjects::pressure staticPressure(p) cannot find required object p of type volScalarField --> FOAM Warning : functionObjects::pressure staticPressure(p) failed to execute. Time = 0.05 Reading fields: volScalarFields: p Executing functionObjects --> FOAM FATAL ERROR: Attempt to acquire non-const reference to const object from a tmp<N4Foam14GeometricFieldIdNS_12fvPatchFieldENS_7volMeshEEE> From function T& Foam::tmp<T>::ref() const [with T = Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>] in file /home/ubuntu/OpenFOAM/OpenFOAM-8/src/OpenFOAM/lnInclude/tmpI.H at line 187. FOAM aborting #0 Foam::error::printStack(Foam::Ostream&) at ??:? #1 Foam::error::abort() at ??:? #2 Foam::tmp<Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> >::ref() const at ??:? #3 bool Foam::functionObjects::regionFunctionObject::store<Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> >(Foam::word const&, Foam::tmp<Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> > const&, bool) at ??:? #4 Foam::functionObjects::pressure::calc() at ??:? #5 Foam::functionObjects::fieldExpression::execute() at ??:? #6 Foam::functionObjects::timeControl::execute() at ??:? #7 Foam::functionObjectList::execute() at ??:? #8 ? in "/opt/openfoam8/platforms/linux64GccDPInt32Opt/bin/postProcess" #9 ? in "/opt/openfoam8/platforms/linux64GccDPInt32Opt/bin/postProcess" #10 __libc_start_main in "/lib/x86_64-linux-gnu/libc.so.6" #11 ? in "/opt/openfoam8/platforms/linux64GccDPInt32Opt/bin/postProcess" Aborted (core dumped) |
|
June 24, 2021, 18:42 |
|
#5 |
Senior Member
Join Date: Apr 2020
Location: UK
Posts: 748
Rep Power: 14 |
Sometimes you need to run postProcess from within the solver, eg if the data you are dealing with is created within the solver and is not just one of the standard fields. Maybe try running:
Code:
interFoam -postProcess -time 0.5 -func "hydrostaticPressure(p)" |
|
June 25, 2021, 08:19 |
|
#6 |
New Member
Juan Pablo Carbajal
Join Date: Jun 2021
Posts: 23
Rep Power: 5 |
Hi,
My answers are not being posted. It says a moderator needs to look at them. I have posted the reproduction of the error in the damBreak tutorial @Tobermory: it makes no difference, I get the same error |
|
June 25, 2021, 08:23 |
|
#7 |
New Member
Juan Pablo Carbajal
Join Date: Jun 2021
Posts: 23
Rep Power: 5 |
Code:
$ interFoam -postProcess -time 0.5 -func "staticPressure(p)" /*---------------------------------------------------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org \\ / A nd | Version: 8 \\/ M anipulation | \*---------------------------------------------------------------------------*/ Build : 8-1c9b5879390b Exec : interFoam -postProcess -time 0.5 -func staticPressure(p) Date : Jun 25 2021 Time : 13:22:57 Host : "katara" PID : 28654 I/O : uncollated Case : /home/juanpi/OpenFOAM/juanpi-8/run/damBreak/damBreak nProcs : 1 sigFpe : Enabling floating point exception trapping (FOAM_SIGFPE). fileModificationChecking : Monitoring run-time modified files using timeStampMaster (fileModificationSkew 10) allowSystemOperations : Allowing user-supplied system call operations // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // Create time Create mesh for time = 0.5 PIMPLE: No convergence criteria found PIMPLE: Operating solver in transient mode with 1 outer corrector PIMPLE: Operating solver in PISO mode Time = 0.5 Reading field p_rgh Reading field U Reading/calculating face flux field phi Reading transportProperties Selecting incompressible transport model Newtonian Selecting incompressible transport model Newtonian Selecting turbulence model type laminar Selecting laminar stress model Stokes Reading g Reading hRef Calculating field g.h No MRF models present No finite volume options present --> FOAM FATAL ERROR: Attempt to acquire non-const reference to const object from a tmp<N4Foam14GeometricFieldIdNS_12fvPatchFieldENS_7volMeshEEE> From function T& Foam::tmp<T>::ref() const [with T = Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>] in file /home/ubuntu/OpenFOAM/OpenFOAM-8/src/OpenFOAM/lnInclude/tmpI.H at line 187. FOAM aborting #0 Foam::error::printStack(Foam::Ostream&) at ??:? #1 Foam::error::abort() at ??:? #2 Foam::tmp<Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> >::ref() const in "/opt/openfoam8/platforms/linux64GccDPInt32Opt/bin/interFoam" #3 bool Foam::functionObjects::regionFunctionObject::store<Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> >(Foam::word const&, Foam::tmp<Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> > const&, bool) at ??:? #4 Foam::functionObjects::pressure::calc() at ??:? #5 Foam::functionObjects::fieldExpression::execute() at ??:? #6 Foam::functionObjects::timeControl::execute() at ??:? #7 Foam::functionObjectList::execute() at ??:? #8 ? in "/opt/openfoam8/platforms/linux64GccDPInt32Opt/bin/interFoam" #9 __libc_start_main in "/lib/x86_64-linux-gnu/libc.so.6" #10 ? in "/opt/openfoam8/platforms/linux64GccDPInt32Opt/bin/interFoam" Aborted (core dumped) |
|
June 25, 2021, 10:49 |
|
#8 |
Senior Member
Join Date: Apr 2020
Location: UK
Posts: 748
Rep Power: 14 |
Help me out here - you want the static pressure from your interFoam run, right? What's wrong with the static pressure in the time folder, ie p? Why do you want to calculate it? What am I missing?
|
|
June 25, 2021, 15:32 |
|
#9 |
New Member
Juan Pablo Carbajal
Join Date: Jun 2021
Posts: 23
Rep Power: 5 |
As far as I had understood p in the time folders is total pressure. Isn't it the case?
Anyways why is this postprocessing failing. It shouldn't. |
|
June 25, 2021, 18:00 |
|
#10 |
Senior Member
Join Date: Apr 2020
Location: UK
Posts: 748
Rep Power: 14 |
Aah, okay. No, p is the static pressure (although sometimes it is kinematic, i.e. p/rho). If you want convincing, take a look at the pEqn.H in any of the solvers and you'll see that that must be the case.
What's the point of the function? Well, the incompressible solvers solve for the kinematic pressure, and so this is a way I guess of converting that to a true static pressure. Otherwise, I agree it's probably not very useful. |
|
June 28, 2021, 11:18 |
|
#11 |
Senior Member
Claudio Boezio
Join Date: May 2020
Location: Europe
Posts: 137
Rep Power: 7 |
Hello all,
@Tobermory, I disagree with your statement about p in interFoam. @kakila is right, in interFoam, p is the total pressure according to the source code in applications/solvers/multiphase/interFoam/pEqn.H, line 72: Code:
p == p_rgh + rho*gh; // rho*gh is the hydrostatic component applications/solvers/multiphase/interFoam/createFields.H, lines 86-97: Code:
volScalarField p ( IOobject ( "p", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::AUTO_WRITE ), p_rgh + rho*gh ); I've attached a modified controlDict below for the DTC Hull Tutorial (tutorials/multiphase/interFoam/RAS/DTCHull). I've added two Function Objects, one for hydrostatic pressure and one for pressure coefficient. The latter works fine, the former doesn't. Comment out as required to test. Just replace the controlDict with this one, generate the grid and then let it run. P.S.: I'm not familiar with the damBreak case and wouldn't know what the pressure coefficients would have to look like there… Last edited by Ship Designer; June 28, 2021 at 11:21. Reason: Typos |
|
June 28, 2021, 11:44 |
|
#12 |
Senior Member
Join Date: Apr 2020
Location: UK
Posts: 748
Rep Power: 14 |
Dear Claudio ... I don't want to be confrontational, but I am afraid that you are mistaken.
The coding in pEqn.H, that I pointed kakila to, is the pressure-correction coding that is widely used across "incompressible" type solvers, and the "p" in that coding is static pressure. It would make absolutely no sense to use total pressure. As for the line that you are referring to: Code:
p == p_rgh + rho*gh; // rho*gh is the hydrostatic component 1. Quantity p_rgh is defined as the static pressure (p) minus rho*gh (take a look at line 118 in createFields.H for interFoam or check out https://www.openfoam.com/documentati...orm-p-rgh.html) 2. Therefore: p_rgh + rho*gh = (p - rho*gh) + rho*gh = p! In other words, the code you are quoting is not calculating a "total pressure", but is just recovering the static pressure! Finally, when you refer to "total pressure", I think you probably mean piezometric pressure since total pressure includes the dynamic pressure as well as the static and gravitational head. For constant density flows p_rgh is piezometric pressure, but just be careful since this is not the case for varying density flows since piezometric pressure is usually defined with a constant density. |
|
June 28, 2021, 21:04 |
|
#13 | |
Senior Member
Claudio Boezio
Join Date: May 2020
Location: Europe
Posts: 137
Rep Power: 7 |
Hi Tobermory, the code portion you are referring to in createFields.H on line 118 is a correction applied to p_rgh — after it was solved — if a pressure reference is necessary in the case (pRefCell and pRefValue in fvSolution PIMPLE dictionary), e.g. if all p_rgh boundary conditions would be set to zeroGradient. The very same code is present in pEqn.H as well on lines 74-83, almost at the end of the PIMPLE corrector.
I seriously doubt that p is the static pressure, at least with interFoam. If it were, your statement Quote:
I have attached screenshots from a case I'm currently working on. It's a profile view from a ship hull with the field p and it's contours. I left the same contours in place for reference in the other pictures. In the one with p_rgh it is clear that p is highly distorted where p_rgh is large, which should not have this effect if p were static pressure. The last picture shows the two phases and the wave profile more clearly. To get back to the question at hand, regardless of what p is, why would a Function Object crash a solver despite valid input in accordance with the documentation? Cheers, Claudio |
||
June 29, 2021, 05:35 |
|
#14 |
Senior Member
Join Date: Apr 2020
Location: UK
Posts: 748
Rep Power: 14 |
Dear Claudio
Can I ask - did you look at this link: https://www.openfoam.com/documentati...rm-p-rgh.html? The quantity p_rgh is used across a wide variety of solvers in OpenFOAM ... it's not just an interFoam thing. The definition is: Code:
p_rgh = p - rho*gh I wonder whether your confusion is over terminology? Let's explore this, looking at your pictures that you included, and ignoring the distortion around the hull for the moment - just look at the far field - you can clearly see a strong vertical variation in p. This is as expected in the static pressure, since this static pressure gradient is required to counter the weight of the water. In static conditions, the only terms that remain in the momentum equation are the vertical pressure gradient and the gravity term, viz where p here is the "static pressure" and g=-9.81. So far, so good hopefully. This variation in height of p is a nuisance, however, when trying to fix a vertical boundary condition, or when trying to review pressure results. So the quantity p_rgh is defined as the static pressure minus rho*gh, ie p_rgh = p - rho*g*z. In a constant density field, like the example above, you can see that this strips out the vertical variation in pressure - take the derivative and you get: here where rho is assumed constant here. And indeed p_rgh is also zero in this case, which is an easy BC to apply! And that's what we see in your second plot. In fact, p_rgh uses a datum (hRef), and so the farfield value of p_rgh may not be zero, but could be some other constant value depending on your choice of hRef. The idea is the same though. In your earlier post, you referred to p_rgh as a "dynamic pressure". I think most Fluid Mechanics practitioners would be confused by this label, since that term is almost universally used for the measure of the kinetic energy in the flow, 1/2 rho U^2 (eg https://en.wikipedia.org/wiki/Dynami...nation%20point). In an earlier post, I used the term piezometric pressure - that's something that is used by some of the Commercial CFD solvers, eg starccm+, and is defined as p_piez = p + rho_0 * g * z - i.e. similar to p_rgh but with a constant, reference density rather than the local, variable density. In a case like your water flow, p_rgh and piezometric pressure are the same thing. Finally - why does the functionObject crash when it is run? Well, I suspect that it's because it is being used incorrectly. The documentation says that when it is called for static pressure, it should convert a kinematic static pressure to ordinary static pressure, i.e. multiplies by density. In your case, your pressure variable p is not kinematic (check the units in the p or p_rgh boundary file), and so it makes no sense to run the functionObject on the pressure field. You could try raise a bug report, since it would be better if the code came back with a message "no - I can't do that" rather than just crashing, but I think the simpler answer is just don't run it! It's not necessary. You already have the static pressure, p (or p_rgh if you want to remove the hydrostatic variation) so you do not need to convert from a kinematic pressure. I hope that the above is helpful. I think that we have probably exhausted the subject! All the best. |
|
June 29, 2021, 10:26 |
|
#15 |
Senior Member
Claudio Boezio
Join Date: May 2020
Location: Europe
Posts: 137
Rep Power: 7 |
Hello all,
Tonight I looked at the source code again and I agree that this function object is not suitable for what we are trying to do. More on this later. @kakila, you can try this and see if this is what you need: 1. Add this Function Object to output the fields rho and gh, which are created internally by interFoam: Code:
rgh { type writeObjects; libs ("libutilityFunctionObjects.so"); objects (rho gh); writeOption anyWrite; writeControl outputTime; } Code:
rho*gh I'll post some more on this later, got to be productive now. Cheers |
|
June 29, 2021, 17:20 |
|
#16 |
New Member
Juan Pablo Carbajal
Join Date: Jun 2021
Posts: 23
Rep Power: 5 |
Hi people,
Thank you for the time to answer and all the insights. I made a small test: a Venturi meter. The image venturi_meter_p_gauge shows the values of the two pressures under discussion (p and p_rgh) along the black line shown in the image, starting on the left. The values are gauge (reference pressure 101325 Pa), and in mbar (to ease comparison with the ruler in the image) I do not see any difference between the two pressures, besides the lower quality of the p data. The pressure difference from one side to the other coincides with the vertical difference in water level (about 0.3 cm, i.e. ~0.3 mbar). It seems as both p and p_rgh are the static pressure = Pref + rho * g * h After the discussion I was expecting p_rgh to be lower than p. Why it isn't the case? I was expecting: p = pref + rho * g * h [what's oberseved] p_rgh = p - rho * g * h =(?) pref [not waht's observed] Also, as mentioned, p is not kinematic |
|
June 29, 2021, 17:51 |
|
#17 |
Senior Member
Join Date: Apr 2020
Location: UK
Posts: 748
Rep Power: 14 |
Hey - I like the test case - what a great idea!
Where is the origin in your model? If the origin (z=0) is on the black line, then it makes total sense that p and p_rgh are identical along the line, since the reference height hRef defaults to zero and (h - hRef) is therefore zero. If you want to force a difference between p and p_rgh then set the value for hRef by dropping the following dictionary (file) into the constant folder: Code:
/*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: v2012 | | \\ / A nd | Website: www.openfoam.com | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class uniformDimensionedScalarField; location "constant"; object hRef; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // dimensions [0 1 0 0 0 0 0]; value -10.0; // ************************************************************************* // |
|
June 29, 2021, 18:30 |
|
#18 |
New Member
Juan Pablo Carbajal
Join Date: Jun 2021
Posts: 23
Rep Power: 5 |
Thanks for the clarification. So the actual formulas are then
p = pref + rho * g * (water_elevation - z) where the parenthesis is the difference between the current z coordinate and the water elevation. While p_rgh = p - rho * g * (water_elevation + hRef) = pref - rho * g * (z + hRef) I believe the source of all confusion is the difficulty to find a careful mathematical definition of the two fields in the documentation (it might be hidden somewhere! By careful I mean not with inconsistent notation as in the links to the docs given). As you correctly guessed, in my model the black line is on z = 0, so the formulas coincide. I moved the line 0.2 cm up and, as you explained, the difference became obvious (p is lower by ~ 0.2 mbar). Image attached. I also tested the with the file hRef in the constant and also works (I used hRef value -1.0, not -10.0). However the quality of the solution was horribly affected! I do not understand why, as the value of h does not participate in the constant density equations (https://www.openfoam.com/documentati...orm-p-rgh.html) (I will leave that Pandora's box closed for now ...) Thanks for the clarification! I will file a bug regarding the misleading crash of staticPressure, asap. PS: I am using v8 (from .org) Last edited by kakila; June 29, 2021 at 19:01. Reason: improve equations |
|
June 29, 2021, 18:48 |
|
#19 | |
New Member
Juan Pablo Carbajal
Join Date: Jun 2021
Posts: 23
Rep Power: 5 |
Quote:
Wait... that can't be right, because I should see a constant p_rgh. That's not what I get. So it should be either p_rgh = p - rho * g * hRef = pref + rho * g * (water_elevation - z - hRef) or p_rgh = p - rho * g * (z + hRef) = pref + rho * g * (water_elevation - hRef) The observation that p has less quality than p_rgh supports the second equation. That's because p has two source of coarseness in water_level and z, while p_rhg only has the coarseness of water_elevation. Also, it the one that makes more sense to have. |
||
June 29, 2021, 18:50 |
|
#20 | |
New Member
Juan Pablo Carbajal
Join Date: Jun 2021
Posts: 23
Rep Power: 5 |
Quote:
But I can't.. I guess the term where h multiplies the gradient of rho is not always zero for two phases. The gradient has a huge contribution on the free surface, so I guess it is expected that for large hRef that term might introduce issues. |
||
Tags |
crash, function object, interfoam, static pressure |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Pressure fields in FOAM, p field, total pressure, etc. | Tobi | OpenFOAM Post-Processing | 9 | March 25, 2022 02:33 |
[OpenFOAM] Annoying issue of automatic "Rescale to Data Range " with paraFoam/paraview 3.12 | keepfit | ParaView | 60 | September 18, 2013 04:23 |
[blockMesh] BlockMesh FOAM warning | gaottino | OpenFOAM Meshing & Mesh Conversion | 7 | July 19, 2010 15:11 |
How to show the transient case? | H.P.LIU | Phoenics | 7 | July 13, 2010 05:31 |
latest OpenFOAM-1.6.x from git failed to compile | phsieh2005 | OpenFOAM Bugs | 25 | February 9, 2010 05:37 |