|
[Sponsors] |
How to get density-field for compressible flow? |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
April 15, 2010, 06:59 |
How to get density-field for compressible flow?
|
#1 |
New Member
Benedikt Goeppner
Join Date: Jan 2010
Posts: 15
Rep Power: 16 |
Hi there,
I was wondering how to get the density-field if using some compressible solver? Beside rhoCentralFoam I think all other solvers define rho as a NOWRITE-object (like basicThermo does with psi, too). As density and compressiblity are a fundamental thing of compressible flow - if not it would be incompressible, right? - there should be a way to visualize those fields in postprocessing, shouldn't it? Or do I have to calculate the Mach-Number, out of that the compressiblity, and according to this finally the density? Sounds complicated to me.. Is it advisable as an easy solution to create a new solver as a copy of the existing one, say sonicFoam, with rho defined as AUTOWRITE-object? Ben |
|
April 15, 2010, 09:32 |
|
#2 | |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
Quote:
|
||
April 15, 2010, 11:59 |
|
#3 |
New Member
Benedikt Goeppner
Join Date: Jan 2010
Posts: 15
Rep Power: 16 |
Hi Bernhard,
thanks for your quick reply. That sounds exactly what I'm looking for. Unfortunately I'm not very used to functionObjects in OpenFOAM right now and the official documention does not offer a lot of instructions about that, too... There's just a general reference to the tutorials-folder... ;-) I will also check out your tools from the link you posted and have a look at the README-file, as well as I'm currently trying to understand the source-code. Anyway, if you have any suggestions on where to get more information regarding this topic or if you could give some examples how to use those objects, that would be great! Edit: I had a look at the source guide and some other resources... Am I right that the following steps would solve my problem? 1) Add some functions to the controlDict: Code:
functions ( rho { type writeRegisteredObject; functionObjectLibs ("libfunctionObjects.so"); objectNames ( rho ); } ) or if having added the functions-section to control-dict before running the case, everything should be fine anyway I will try that as soon as I'm back at my simulation-computer... Last edited by bgoeppner; April 15, 2010 at 13:23. |
|
April 15, 2010, 13:48 |
|
#4 | |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
Quote:
|
||
April 16, 2010, 07:54 |
Problem solved
|
#5 |
New Member
Benedikt Goeppner
Join Date: Jan 2010
Posts: 15
Rep Power: 16 |
Just in case someone's having the same problem and is using the search-function, here's the solution:
Add the following to your controlDict: Code:
functions { rhofunc { type writeRegisteredObject; functionObjectLibs ("libIOFunctionObjects.so"); /* outputControl outputTime;*/ outputControl timeStep; outputInterval 1; objectNames ( "rho" "psi" ); } } Code:
outputControl outputTime Code:
outputControl timeStep Code:
execFlowFunctionObjects Have fun! |
|
September 9, 2013, 08:37 |
|
#6 |
Senior Member
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 27 |
Hi
for notice: rhoCentralFoam now (in 2.2.0 version) writes "rho" field itself but doesn't write "phi" field.
__________________
Injustice Anywhere is a Threat for Justice Everywhere.Martin Luther King. To Be or Not To Be,Thats the Question! The Only Stupid Question Is the One that Goes Unasked. |
|
September 29, 2016, 12:04 |
OpenFOAM 4.0: postProcess "rho" field after sonicFoam simulation
|
#7 |
New Member
Join Date: Sep 2012
Posts: 13
Rep Power: 15 |
Hi everyone,
I am using OpenFOAM 4.0 and it seems, that the above solution doesn't work like that anymore. When I follow the work flow above and try to execute Code:
execFlowFunctionObjects execFlowFunctionObjects has been superceded by the '-postProcess' solver command-line option" I can't figure out a way to calculate the "rho" field after having run the sonicFoam solver. I tried using the postProcess utility but only seem to get more error messages... I would be very glad about any help! Thank you very much |
|
January 18, 2017, 11:14 |
|
#8 |
New Member
Join Date: Sep 2012
Posts: 13
Rep Power: 15 |
Meanwhile I figured out, that the writeRegisteredObject type was superseded by the writeObjects type. Reading one error message after another, I edited the function given above to the following:
Code:
functions { rhofunc { type writeObjects; libs ("libutilityFunctionObjects.so"); writeControl timeStep; writeInterval 1; objects ("rho"); } } Code:
sonicFoam -postProcess However, the rho field is much to small, on the 10⁻11 level and doesn't show physical behavior... Does anyone know, whether the function I implemented is still wrong and leads to the faulty results? |
|
March 28, 2017, 12:03 |
|
#9 |
New Member
Eric Emdee
Join Date: Mar 2017
Posts: 6
Rep Power: 9 |
Hey Endel, I'm trying to do pretty much the exact same thing (getting density fields from sonicFoam) did you ever figure out how to get the solver to get the correct results?
|
|
March 29, 2017, 11:33 |
|
#10 |
Super Moderator
Tobias Holzmann
Join Date: Oct 2010
Location: Bad Wörishofen
Posts: 2,711
Blog Entries: 6
Rep Power: 52 |
Hi all,
I have no idea about the postProcess tool but if you want to have the density field you can do the following (not the optimal way):
Code:
volScalarField rho ( IOobject ( "rho", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::AUTO_WRITE ), thermo.rho() );
Doing that, the solver will write the density file. I checked it with the shockTube tutorial and the density seems to be okay (0.125 - 0.998). But I have no idea in which range the density can go in shock waves.
__________________
Keep foaming, Tobias Holzmann |
|
March 29, 2017, 15:09 |
|
#11 |
New Member
Eric Emdee
Join Date: Mar 2017
Posts: 6
Rep Power: 9 |
This worked for me, though I have yet to confirm whether it is physical or not. One question though, why do you say that this isn't the optimal way?
Thanks a lot for your help! |
|
March 29, 2017, 15:13 |
|
#12 |
Super Moderator
Tobias Holzmann
Join Date: Oct 2010
Location: Bad Wörishofen
Posts: 2,711
Blog Entries: 6
Rep Power: 52 |
Hi,
I said this might be not the optimal way because if you could do it in a post-processing way I would prefer this instead of recompiling. Maybe there are smarter way that I do not know. If the way of Endel would work, it would be smarter, right? And in fact, I am not an expert. Well, if it works for you, I am happy. Good luck and the density field you write is actually the one FOAM uses.
__________________
Keep foaming, Tobias Holzmann |
|
April 26, 2017, 08:51 |
Adding different density values
|
#13 |
New Member
Sarath Raj
Join Date: Nov 2016
Posts: 3
Rep Power: 10 |
Hlo friends...
I am using interFoam solver is it possible to add different density values in the same case file by using setFields utility.???????? |
|
April 26, 2017, 20:23 |
|
#14 |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
No. In the classic interFoam the rhos of the two phases are constant values and the overall rho is calculated according to the alpha-field
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request |
|
June 10, 2019, 19:19 |
Using inline -postProcess tool
|
#15 | |
New Member
pooyan
Join Date: Mar 2013
Location: Boston, US
Posts: 6
Rep Power: 13 |
Quote:
I think you can simply write the following line after the simulation is done and it should write the rho field for all the simulated times: Code:
sonicFoam -postProcess -func 'writeObjects(rho)' |
||
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Flow meter Design | CD adapco Group Marketing | Siemens | 3 | June 21, 2011 09:33 |
rerun with same flow field, different fluid props | Tim | Phoenics | 0 | March 3, 2004 15:51 |
Injection of partical into flow field | M.Mahendran | FLUENT | 2 | November 24, 2002 01:54 |
Inviscid Drag at subsonic, subcritical Mach # | Axel Rohde | Main CFD Forum | 1 | November 19, 2001 13:19 |
Flow field measurement in turbomachinery! | Wanlai Lin | Main CFD Forum | 3 | September 3, 1999 13:06 |