read result values with pyFoam
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 :D 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 Regards |
Hi again,
Any ideas to help me? Thank you |
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? |
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. |
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) |
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. |
Quote:
|
All times are GMT -4. The time now is 17:51. |