|
[Sponsors] |
February 7, 2014, 04:40 |
read result values with pyFoam
|
#1 |
Member
Davide Pasini
Join Date: Mar 2009
Posts: 34
Rep Power: 17 |
Hi Foamers!
I'm trying to read the average p values on a patch with python. What is the right way? Yes, I'm a newbie I have done some tests with pyFoam. I'm able to modify the boundary condictions and run the solver but nothing in order to read the result values and convert in a "python" format. I don't know if reading the csv output file is an easy way to read the openFoam outputs in python. This is the function I wrote in controlDict in order to do that. Code:
pressureAverage { type patchAverage; fields ( p ); patches ( velocity-inlet-6 ); expression "p"; outputFileMode csv; verbose true; } Regards |
|
February 11, 2014, 05:32 |
|
#2 |
Member
Davide Pasini
Join Date: Mar 2009
Posts: 34
Rep Power: 17 |
Hi again,
Any ideas to help me? Thank you |
|
February 13, 2014, 19:45 |
|
#3 | |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
Quote:
Usually I do such calculations in a functionObject. The way you're sketching it. If this is the patchAverage from swak4Foam? Then you already should have a csv file in the case (exact location depends on the version of swak you're using). Or is your problem READING that CSV-file?
__________________
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 |
||
February 14, 2014, 07:34 |
|
#4 |
Member
Davide Pasini
Join Date: Mar 2009
Posts: 34
Rep Power: 17 |
Thank you gschaider for your reply.
I'm trying to couple a 0D circuit with a 3D vessel. For the 0d simulation I use OpenModelica, OpenFoam for the 3d model and python is a good language for a "simulation manager" script. I was looking for an easy and efficient way to read result values. According to what you say read the csv file directly is the best way. There are some libraries for that. I'll try this way. Patch average: at the interface 0D / 3D I've to calculate the velocity and pressure and insert the values in the 0D system . I don't know if the functionObject I've written in the previous post is correct. I'll try. I appreciate any advice that you can give me. |
|
February 14, 2014, 12:22 |
|
#5 | |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
Quote:
Concerning the FO: "expression" is not needed for patchAverage (all things in the simpleFunctionObjects-sublibrary work without parsers. They MAY have subclasses that do that)
__________________
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 |
||
February 17, 2014, 10:25 |
|
#6 |
Member
Davide Pasini
Join Date: Mar 2009
Posts: 34
Rep Power: 17 |
Foreach timestep the python script reads the OF results and inserts the values to the 0D model.
After a timestep the 0D model returns the initial conditions of the 3D model. I think this flow is correct. |
|
February 20, 2014, 17:46 |
|
#7 |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
"For each timestep" and "initial condition" somehow don't work for me (or are you talking about boundary conditions? That would be a feedback of the model)
__________________
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 |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
how to calculate mass flow rate on patches and summation of that during the run? | immortality | OpenFOAM Post-Processing | 104 | February 16, 2021 09:46 |
DEFINE_ADJUST: How open and read file values (.prof or .txt) into one boundary | rayolau | Fluent UDF and Scheme Programming | 0 | April 25, 2013 08:01 |
read a file .txt with nurecial values of time and acceleration | sicfred | Fluent UDF and Scheme Programming | 0 | November 21, 2011 08:02 |
Problem in running ICEM grid in Openfoam | Tarak | OpenFOAM | 6 | September 9, 2011 18:51 |
Read values from previous timesteps | vmlxb6 | CFX | 9 | April 22, 2011 19:56 |