CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (https://www.cfd-online.com/Forums/fluent-udf/)
-   -   Averaging over iterations for steady-state simulation (https://www.cfd-online.com/Forums/fluent-udf/235722-averaging-over-iterations-steady-state-simulation.html)

CFD student April 26, 2021 13:15

Averaging over iterations for steady-state simulation
 
Hi all,

I'm currently doing a steady-state simulation in a parallel fluent environment. The results (inlet mass flow, outlet mass flow, total temperature at a specific created surface...) all vary in a certain band, the iterations don't lead to a 'constant' value.

Is there any possibility to let Fluent automatically write the average value of the last 1000 iterations of e.g. the total temperature to an output file?

If not, is it possible to do this with an UDF? I'm completely new to UDF's so a bit of help/a starting point is much appreciated!


Thanks in advance!

AlexanderZ April 26, 2021 23:41

why don't you want to write variable into file and get average value later, for instance in excel?
it's the easiest way if you have a few monitors.

CFD student April 27, 2021 03:03

Im doing batch simulations, so I have about 6 monitors and 100 simulations. Copying results to excel would take loads of time.

Thank you for your suggestion!

pakk April 27, 2021 04:25

If you really want to do it in Fluent:
*Make a global array with 1000 values.
*make a global index.
*after every time step:
- set the monitor value in the array, at the location of the index.
- increase the index by one (modulo 1000)
- calculate the average value of your array, and save it /print it.

There are many other ways to do it, but this is the easiest way I could think of.

AlexanderZ April 27, 2021 05:51

make a script ,for example in python or any other language, to get 1000 last values from file and to calculate average value.
this will be much easier comparing to UDF. And more flexible.

in case you want to proceed with UDF, Ansys Fluent Customization manual, look for DEFINE_ON_DEMAND macro, there is good example on how to get average temperature

for your case you will use DEFINE_EXECUTE_AT_END to calculate and write variables after each iteration

my recommendation: make it works for single core computation and later move to parallel

jean@cfd April 28, 2021 10:10

Iterations for simulation with schiaparelli capsule?
 
temperature limited to 1.000000e+01 in 1 cells on zone 4
43 6.2712e-02 1.5462e-02 2.2252e+00 4.0021e+00 1.1799e-01 1.1802e+01 3.5830e-01 3.8173e+00 6.1537e-02 5.9306e+04 2.3388e+04 6.0264e+04 3656:11:52 99964

reversed flow in 941 faces on pressure-outlet 9.

time step reduced in 25 cells due to excessive temperature change

absolute pressure limited to 1.000000e+00 in 1 cells on zone 4

temperature limited to 1.000000e+01 in 1 cells on zone 4
44 6.2213e-02 1.4892e-02 2.1214e+00 3.8880e+00 1.1235e-01 1.1824e+01 3.5848e-01 3.8248e+00 6.1033e-02 5.9061e+04 2.3360e+04 6.0090e+04 3430:17:51 99963

reversed flow in 940 faces on pressure-outlet 9.

time step reduced in 26 cells due to excessive temperature change

absolute pressure limited to 1.000000e+00 in 1 cells on zone 4

temperature limited to 1.000000e+01 in 1 cells on zone 4
45 6.1251e-02 1.3971e-02 2.0221e+00 3.7188e+00 1.0513e-01 1.3652e+01 4.1026e-01 4.4168e+00 6.0076e-02 5.8774e+04 2.3335e+04 5.9885e+04 3355:05:22 99962

FOR MY RESEARCH ON RE ENTRY VEHICLES MY ITERATIONS ARE COMING LIKE THIS WITH CONVERGENCE?

pakk April 28, 2021 12:37

Yes for your research on re entry vehicles your iterations are coming like this with convergence.

Or possibly for your research your iterations are going like that with convergence.

I'm sorry, did you ask a question?


All times are GMT -4. The time now is 10:28.