How to get density-field for compressible flow?
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.. :confused: 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 |
Quote:
|
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 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... |
Quote:
|
Problem solved
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 Code:
outputControl outputTime Code:
outputControl timeStep Code:
execFlowFunctionObjects Have fun! |
Hi
for notice: rhoCentralFoam now (in 2.2.0 version) writes "rho" field itself but doesn't write "phi" field. |
OpenFOAM 4.0: postProcess "rho" field after sonicFoam simulation
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 |
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 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? |
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?
|
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
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. |
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! |
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. |
Adding different density values
Hlo friends...
I am using interFoam solver is it possible to add different density values in the same case file by using setFields utility.???????? |
Quote:
|
Using inline -postProcess tool
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)' |
All times are GMT -4. The time now is 08:52. |