|
[Sponsors] |
October 13, 2010, 04:38 |
Switching from simpleFoam to rhoSimpleFoam
|
#1 |
Member
Sebastian Saegeler
Join Date: Nov 2009
Location: Munich
Posts: 70
Rep Power: 16 |
Hi!
I generated a solution with simpleFoam. Now I want to have a look at the compressible case by switching to rhoSimpleFoam. As in simpleFoam, pressure is normalized by density, I cannot use the solution of my incompressible case as a starting solution for rhoSimpleFoam straight forward. Therefore I should multiply pressure by density... Has anybody got an idea how to use a simpleFoam generated solution as starting solution for rhoSimpleFoam? Thanks in advance! Sebastian |
|
October 14, 2010, 13:30 |
|
#2 |
Senior Member
Marco A. Turcios
Join Date: Mar 2009
Location: Vancouver, BC, Canada
Posts: 740
Rep Power: 28 |
At first I thought foamCalc could do a multiplication, but it seems it can't.
You can modify the simpleFoam code to create a new field pComp: In createFields.H, add the following at the end: Code:
volScalarField pComp ( IOobject ( "pComp", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::AUTO_WRITE ), p*rho ); This should write out the new field at all timesteps. You'd then need to rename it "p" for when preparing the case for rhoSimpleFoam. |
|
October 15, 2010, 05:59 |
|
#3 |
Member
Sebastian Saegeler
Join Date: Nov 2009
Location: Munich
Posts: 70
Rep Power: 16 |
Hi Thanks a lot!
Yes, meanwhile I did that by myself. Just a bit more simple: Code:
volScalarField pRho ( IOobject ( "pRho", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::AUTO_WRITE ), p*1.225 //p * density [kg/m^3] ); pRho.write(); Unfortunatelly it messes up a bit my boundary conditions. It even writes out the pressure field on the walls and at my pressure inlets (total pressure inlets). So I have to manually correct it at my boundaries and reset the inital settings there. Has anybody an idea to avoid that? Best regards, Sebastian |
|
October 15, 2010, 16:53 |
|
#4 |
Senior Member
Marco A. Turcios
Join Date: Mar 2009
Location: Vancouver, BC, Canada
Posts: 740
Rep Power: 28 |
Try creating pRho as a copy of p, then just performing the rho*p calculation over all the interior cells:
Code:
forAll(pRho.mesh().cells(),celli) { pRho[celli]*=rho } |
|
October 16, 2010, 09:59 |
|
#5 | |
Senior Member
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,714
Rep Power: 40 |
Quote:
In the end I found that this was all a waste of time and it was much easier just to use rhoSimpleFoam directly. |
||
October 16, 2010, 14:47 |
Compute static pressure during the run time
|
#6 | |
Member
Frederic Collonval
Join Date: Apr 2009
Location: Technische Universitaet Munich - Lehrstuhl fuer Thermodynamik
Posts: 53
Rep Power: 17 |
Quote:
Add the following lines at the end of the controlDict. Then a new field called pStatic = rho*p will be computed during the resolution and output in the time folders. Code:
functions { computepStatic { type staticPressure; functionObjectLibs ( "libutilityFunctionObjects.so" ); enabled true; outputControl outputTime; p p; // Name of the kinematic pressure rho 1.225; // Value of the density } } |
||
October 19, 2010, 06:49 |
|
#7 |
Member
Frederic Collonval
Join Date: Apr 2009
Location: Technische Universitaet Munich - Lehrstuhl fuer Thermodynamik
Posts: 53
Rep Power: 17 |
I just found that you can execute just the "functions" by running:
execFlowFunctionObjects Frederic |
|
October 27, 2010, 05:54 |
|
#8 | |
New Member
s k
Join Date: Oct 2010
Posts: 1
Rep Power: 0 |
Quote:
first of all thanks for your code which works perfekt for this kind of problem. but I encountered two problems: 1. "execFlowFunctionObjects" didnt't work for me, it actually did something (read Fields etc.), but eventually there was no pStatic. It seems that nothing happened. I just received pStatic by calculating one more step of calculation (by starting simpleFoam) 2. the BCs were messed up in pStatic, so for walls e.g. zerogradient BC in p was changed to calculated with nonuniform list. Is there a fix to that? regards, gerda |
||
October 27, 2010, 07:58 |
execFlowFunctionObjects not so great - changeDictionary to change BC
|
#9 | ||
Member
Frederic Collonval
Join Date: Apr 2009
Location: Technische Universitaet Munich - Lehrstuhl fuer Thermodynamik
Posts: 53
Rep Power: 17 |
Hi Gerda,
Quote:
Quote:
If your plan is to switch from a incompressible solution to a compressible solution. You can correct the boundary conditions easily using changeDictionary "$FOAM_UTILITIES/preProcessing/changeDictionary". An example is explained at the begin of the code "changeDictionary.C" and an example of dictionary is provided there. But that make the trick only for the first time as define in controlDict (so startTime or latestTime). Kindly, Frederic Last edited by fcollonv; October 27, 2010 at 08:00. Reason: Grammar error+add a detail |
|||
July 30, 2014, 08:34 |
|
#10 |
New Member
Join Date: Mar 2014
Posts: 17
Rep Power: 12 |
Hi!
I've found this solution using the function staticpressure very confortable for the previous version of OpenFOAM. But it seems this function is not available anymore in OF 2.3.0 that I wish to use now. Does anybody knows how to implement the function pressureTools (or another one ?) in order tu compute static pressure ? Thanks in advance ! BenJ |
|
July 31, 2014, 04:08 |
|
#11 |
New Member
Join Date: Mar 2014
Posts: 17
Rep Power: 12 |
Hi!
After reading the descritption here: http://foam.sourceforge.net/docs/cpp/a01944.html, it seems the utility has to be used as follow: functions ( computepStatic { type pressureTools; functionObjectLibs ("libutilityFunctionObjects.so"); enabled yes; outputControl outputTime; p_k p; rho 1.225; calcTotal no; calcCoeff no; } ); If I want to compute the static pressure, I have to set the two parameters calcTotal and calcCoeff to "no". And indeed, when I run a case, this outputs a volScalarField "static(p)". But this one has a range between 0 and 1e-16, which does not look like a pressure in Pa. I tried to tell OpenFOAM the static pressure p_k is p and the density value, but it does not help. Has anybody an idea? Best regards BenJ |
|
January 7, 2015, 05:32 |
|
#12 |
New Member
Join Date: May 2013
Posts: 23
Rep Power: 13 |
Hello BenJ,
Did you make some progress with your question ? I am facing exactly the same problem ! I can not make the computepStatic works correctly either |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
transsonic nozzle with rhoSimpleFoam | Unseen | OpenFOAM Running, Solving & CFD | 8 | July 1, 2022 07:54 |
TRANSONIC FLOW in RHOSIMPLEFOAM | dinonettis | OpenFOAM Running, Solving & CFD | 10 | September 13, 2018 11:22 |
Laminar simpleFoam and inviscid simpleFoam | herenger | OpenFOAM Running, Solving & CFD | 7 | July 11, 2013 07:27 |
Dimesion error after switching from simpleFoam to rhoSimpleFoam | sebastian | OpenFOAM Bugs | 2 | June 17, 2010 09:03 |
Naca0012 k-e mpirun gives fpe whereas simpleFoam not | Pierpaolo | OpenFOAM | 1 | May 8, 2010 04:08 |