|
[Sponsors] |
Monitor Total Pressure in a running simulation using functionobjects |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
October 22, 2013, 05:00 |
Monitor Total Pressure in a running simulation using functionobjects
|
#1 |
New Member
Join Date: Oct 2012
Posts: 19
Rep Power: 14 |
Hi,
I'm new to Open Foam, so probably the solution of my problem will be really simple for other user but I couldn't find anything about this in the forum. I'm running a simulation of something similar to a pipe in simpleFoam ( OpenFoam 2.2.0). I'd like to monitor the areaAverage of the total pressure on the outlet boundary as a parameter to judge when the simulation reaches a good convergence. I'm doing the same for the massflowrate with a functionobject and it works fine but when I try to do it using the new pressureTools I got this warning: Code:
--> FOAM Warning : From function probes::read() in file patch/patchFieldFunctionObject/patchFieldFunctionObject.C at line 100 Unknown field total(p) when reading dictionary ".TotalPressureAveOutlet" Can only probe registered volScalar, volVector, volSphericalTensor, volSymmTensor and volTensor fields this is my control dictionary function: Code:
functions ( myFunctionObject // user-defined name of function object entry { type pressureTools; functionObjectLibs ("libutilityFunctionObjects.so"); rhoRef 997; pRef 101300; //region defaultRegion; enabled yes; //timeStart 0; //timeEnd 10; outputControl timeStep;//outputTime;// outputInterval 1; // 5000; calcTotal yes; calcCoeff no; } reloadTotalP { type readFields; functionObjectLibs ("libfieldFunctionObjects.so"); //region defaultRegion; enabled yes; //timeStart 0; //timeEnd 10; outputControl timeStep;//outputTime;// outputInterval 1; // 5000; fields ( "total(p)" ); } TotalPressureAveOutlet { type patchAverage; functionObjectLibs ("libsimpleFunctionObjects.so"); verbose true; patches (outlet); factor 1; fields ( total(p) ); outputControl timeStep; outputInterval 1; outputControlMode timestep; } Ale |
|
October 24, 2013, 13:15 |
|
#2 |
New Member
Join Date: Oct 2012
Posts: 19
Rep Power: 14 |
anybody can help me?
Did I do something wrong? |
|
October 26, 2013, 08:39 |
|
#3 |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128 |
Greetings CFD-Cat,
Mmm... this looks sort-of familiar... OK, 2 details:
Beyond this, I need an example case to test this for myself. Best regards, Bruno
__________________
|
|
October 28, 2013, 06:21 |
|
#4 |
New Member
Join Date: Oct 2012
Posts: 19
Rep Power: 14 |
I added the quote but it gives the same error. :-(
|
|
November 2, 2013, 13:20 |
|
#5 |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128 |
Hi CFD-Cat,
I finally managed to have a look into the case you sent me and it was fortunately rather simple! A bit of a introduction - the idea behind "()" and "{}" is this:
Code:
functions ( [...] ); Code:
functions { [...] }; Bruno
__________________
|
|
November 9, 2013, 15:43 |
|
#6 |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128 |
Hi CFD-Cat,
To answer the question you've asked via private message, the full "functions" entry should look something like this: Code:
functions { myFunctionObject // user-defined name of function object entry { type pressureTools; functionObjectLibs ("libutilityFunctionObjects.so"); rhoRef 997; pRef 101300; //region defaultRegion; enabled yes; //timeStart 0; //timeEnd 10; outputControl timeStep;//outputTime;// outputInterval 1; // 5000; calcTotal yes; calcCoeff no; } reloadTotalP { type readFields; functionObjectLibs ("libfieldFunctionObjects.so"); //region defaultRegion; enabled yes; //timeStart 0; //timeEnd 10; outputControl timeStep;//outputTime;// outputInterval 1; // 5000; fields ( "total(p)" ); } TotalPressureAveOutlet { type patchAverage; functionObjectLibs ("libsimpleFunctionObjects.so"); verbose true; patches (outlet); factor 1; fields ( "total(p)" ); outputControl timeStep; outputInterval 1; outputControlMode timestep; } massflow { type patchMassFlow; functionObjectLibs ("libsimpleFunctionObjects.so"); verbose true; patches (outlet); factor 997; outputControl timeStep; outputInterval 1; outputControlMode timestep; } } Best regards, Bruno
__________________
|
|
March 14, 2014, 14:23 |
|
#7 |
New Member
Join Date: Oct 2012
Posts: 19
Rep Power: 14 |
Hi,
I'm sorry to restart this old discussion but since when I installed OF2.2.2 instead of OF2.2.0 I'm facing a new problem with pressureTools function object. I can't understand the reason why when i try to calculate the total(p) the output reports only the BC like if no internal field has been calculated. It I try to calculate the static(p) I got the same problem, while for the total(p)_coeff I got a field distribution(maybe wrong) even setting the pInf =0. Code:
/*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: 2.2.2 | | \\ / A nd | Web: www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class volScalarField; location "160"; object total(p); } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // dimensions [1 -1 -2 0 0 0 0]; internalField uniform 0; boundaryField { wall_sx { type calculated; value uniform 0; } floor { type calculated; value uniform 0; } wall_rear { type calculated; value uniform 0; } wall2 { type symmetryPlane; } inlet { type calculated; value uniform 0; } wall1 { type calculated; value uniform 0; } wall_dx { type calculated; value uniform 0; } outlet { type calculated; value uniform 0; } } // ************************************************************************* // Except for this sentence that sincerely I don't understand completely: "Where the function generates a field, e.g. wallShearStress, pressureTools, yPlusRAS, etc., the field is now stored on the mesh database so that it is available for further post-processing. " from http://www.openfoam.org/version2.2.2/ |
|
March 15, 2014, 03:51 |
|
#8 |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128 |
Hi CFD-Cat,
I need more information in order to be able to help you, namely:
Bruno
__________________
|
|
March 15, 2014, 07:48 |
|
#9 |
New Member
Join Date: Oct 2012
Posts: 19
Rep Power: 14 |
I'm out of office. On monday I'll try the tutorial and I'll send you the file.thank you for your help
|
|
March 17, 2014, 05:46 |
|
#10 |
New Member
Join Date: Oct 2012
Posts: 19
Rep Power: 14 |
Hi wyldckat,
I reproduced it with the tutorial Tjunction. This is my controlDict Code:
/*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: 2.2.2 | | \\ / A nd | Web: www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class dictionary; location "system"; object controlDict; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // libs ( "libOpenFOAM.so" "libincompressibleTurbulenceModel.so" "libincompressibleRASModels.so" ); application pimpleFoam; startFrom startTime; startTime 0; stopAt endTime; endTime 1.5; deltaT 0.001; writeControl adjustableRunTime; writeInterval 0.1; purgeWrite 0; writeFormat ascii; writePrecision 6; writeCompression uncompressed; timeFormat general; timePrecision 6; runTimeModifiable true; adjustTimeStep yes; maxCo 5; functions { probes { // Where to load it from functionObjectLibs ( "libsampling.so" ); type probes; // Name of the directory for probe data name probes; // Write at same frequency as fields outputControl outputTime; outputInterval 1; // Fields to be probed fields ( p U ); probeLocations ( ( 1e-06 0 0.01 ) // at inlet ( 0.21 -0.20999 0.01 ) // at outlet1 ( 0.21 0.20999 0.01 ) // at outlet2 ( 0.21 0 0.01 ) // at central block ); } } // ************************************************************************* // functions { pressure // user-defined name of function object entry { type pressureTools; functionObjectLibs ("libutilityFunctionObjects.so"); rhoRef 997; pRef 0; //region defaultRegion; enabled yes; timeStart 0; //timeEnd 10; outputControl outputTime; //outputControl timeStep;//outputTime; //outputInterval 1; // 5000; calcTotal yes; calcCoeff no; } pressurecoeff // user-defined name of function object entry { type pressureTools; functionObjectLibs ("libutilityFunctionObjects.so"); rhoRef 997; pRef 0; //region defaultRegion; enabled yes; timeStart 0; //timeEnd 10; outputControl outputTime; //outputControl timeStep;//outputTime; //outputInterval 1; // 5000; calcTotal yes; calcCoeff yes; pInf 0; UInf (1 1 1); rhoInf 997; } reloadtotalP { type readFields; functionObjectLibs ("libfieldFunctionObjects.so"); //region defaultRegion; enabled yes; //timeStart 0; //timeEnd 10; outputControl outputTime; //outputControl timeStep;//outputTime;// //outputInterval 1; // 5000; outputControlMode timeStep; fields ( "total(p)" ); } outlet-total-pressure { type faceSource; functionObjectLibs ("libfieldFunctionObjects.so"); enabled true; outputControl outputTime; //outputControl timeStep; //outputInterval 1; outputControlMode timeStep; log true; valueOutput false; source patch; sourceName outlet2; operation areaAverage; //weightField phi; fields ( "total(p)" ); } }; Code:
/*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: 2.2.2 | | \\ / A nd | Web: www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class volScalarField; location "0.2"; object total(p); } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // dimensions [1 -1 -2 0 0 0 0]; internalField uniform 0; boundaryField { inlet { type calculated; value uniform 0; } outlet1 { type calculated; value uniform 0; } outlet2 { type calculated; value uniform 0; } defaultFaces { type calculated; value uniform 0; } } // ************************************************************************* // Code:
/*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: 2.2.2 | | \\ / A nd | Web: www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class volScalarField; location "0.2"; object total(p)_coeff; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // dimensions [0 0 0 0 0 0 0]; internalField nonuniform List<scalar> 3875 ( 10.639 10.4919 10.4483 10.3811 10.313 10.2384 10.1689 10.0984 ....... ) ; boundaryField { inlet { type calculated; value nonuniform List<scalar> 25 ( 10.6671 10.667 10.667 10.667 10.667 10.667 .... ... Best regards, Ale |
|
March 23, 2014, 16:21 |
|
#11 | |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128 |
Hi Ale,
I finally managed to look into this. This should work: Code:
pressure // user-defined name of function object entry { type pressureTools; functionObjectLibs ("libutilityFunctionObjects.so"); rhoName rhoInf; rhoInf 997; pRef 0; //region defaultRegion; enabled yes; timeStart 0; //timeEnd 10; outputControl outputTime; //outputControl timeStep;//outputTime; //outputInterval 1; // 5000; calcTotal yes; calcCoeff no; } Code:
rhoName rhoInf; rhoInf 997; Although a bit cryptic, this can be spotted if we look at the source code: https://github.com/OpenFOAM/OpenFOAM...reTools.C#L263 Quote:
Bruno
__________________
|
||
March 24, 2014, 09:10 |
|
#12 |
New Member
Join Date: Oct 2012
Posts: 19
Rep Power: 14 |
Thank you very much Bruno. Now it works! I really appreciate your help.
I didn't check it because in OF2.2.0 it works fine without Code:
rhoName rhoInf; |
|
February 23, 2019, 18:12 |
Monitor Total Pressure in a running simulation using functionobjects
|
#13 |
New Member
Aqeel Ahmed
Join Date: Feb 2017
Posts: 5
Rep Power: 9 |
For people looking for the same functionality in OpenFOAM version 6
Code:
functions { totalPressureCalc { type pressure; functionObjectlib ("libfieldFunctionObjects.so"); rhoName rhoInf; rhoInf 1000; pRef 0; enabled yes; executeControl timeStep; executeInterval 1; writeControl writeTime; writeInterval 1; calcTotal yes; calcCoeff no; } reloadTotalP { type readFields; functionObjectlib ("libfieldFunctionObjects.so"); enabled yes; executeControl timeStep; executeInterval 1; writeControl writeTime; writeInterval 1; fields ( "total(p)" ); } totalPressureAvgInlet { enabled yes; type surfaceFieldValue; surfaceFormat false; libs ("libfieldFunctionObjects.so"); writeControl timeStep; writeInterval 1; log true; writeFields false; regionType patch; name inlet; operation areaAverage; //- options: sum, areaIntegrate mode magnitude; fields ( "total(p)" ); } } |
|
March 10, 2020, 05:06 |
|
#14 |
Senior Member
BastiL
Join Date: Mar 2009
Posts: 530
Rep Power: 20 |
Does anybody know how to do that in OpenFOAM-1906 and 1912? Does not seem to accept "pressure" as a function type. "unknown function type pressure"
Solved: needed to add "libfieldFunctionObjects.so" in the libs-section on top of "controlDict" to make it work. Last edited by bastil; March 10, 2020 at 10:18. |
|
Tags |
functionobjects, openfoam 2.2.0, pressuretools, totalpressure |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Pressure BC for combustion chamber | Giuki | FLUENT | 1 | July 19, 2011 12:35 |
the role of operating pressure in flow simulation | sunflower | FLUENT | 1 | December 20, 2010 22:24 |
high pressure simulation | mahi | FLUENT | 0 | November 7, 2008 02:30 |
stagnation pressure in transient flow simulation | K.S.Ravichandran | Main CFD Forum | 2 | September 5, 2000 01:34 |
Hydrostatic pressure in 2-phase flow modeling (long) | DS & HB | Main CFD Forum | 0 | January 8, 2000 16:00 |