CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Programming & Development (
-   -   Convergence criterion with runtime PostProcessing (

shaerdi October 29, 2012 09:25

Convergence criterion with runtime PostProcessing
Hello all

I am simulating a a non-newtonian fluid in a parallel plate rheometer. For this I am using a modified Version of the nonNewtonianIcoFoam-solver (OF Version 2.1.1). It works, but I cannot tell when the (steady-state) simulation is converged. The residuals from velocity and pressure rapidly drop at the beginning and then remain almost constant while the shear-rate depending viscosity still changes.

Now I want to program my own convergence criterion that checks for the resulting torque in the rheometer and stops the simulation if the (relative) change from the previous time step drops below a given value.

The problem is to calculate the torque at each time step. Until now I used the utility 'stressComponents' in combination with sampling the corresponding entry in the sigma matrix over a line and post-process (integral over a function of the samples) it with python after the simulation.

Now I want to implement these steps (Calculation of sigma, sampling, integral) into a function object, to store the torque (or write it to the terminal) in each time step and set the stopAt attribute according to the convergence criterion.
What is the best way to do so?

I managed to calculate and write sigma and I can sample fields using function objects, but I don't want to write these files at each time step as this really slows the computation down. Plus, I don't know how to access the sampled data to do the calculation that I did with python until now.

Any help is really appreciated!

Kind Regards,

All times are GMT -4. The time now is 14:01.