CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Programming & Development (
-   -   Reading forces from previous time step within solver (

SD@TUB March 14, 2010 07:58

Reading forces from previous time step within solver
Hello FOAMers,

what would be the best way of reading forces from previous time step within solver code? I'm calculating some cases with OF 1.6 via simpleFoam.
I noticed the function objects where pressure and viscous forces/moments are integrated over given walls (using ""). In forces.C the
data of interest accessed by:

fm.first().first() (pressure forces) or fm.first().second() (viscous forces)
fm.second().first() (moment of pressure forces) or fm.second().second() (moment of viscous forces)
return fm;

Now i tried to catch the values within solver code. I added my own header in simpleFoam.C where i calculate some additional stuff. Within this header i want to initialize variables with the summarized forces (under consideration of the listed headers in forces.C), but it doesn't work. I did something like:

scalar Fp = fm.first().first();
scalar Fv = fm.first().second();

According to the OF programmers guide, field data from previous time step are associated with geometricField<type>. In my understanding this isn't applicable for calculated forces, because they applied to pressure and shear stress on walls.
I'm not familiar with the code conventions of OF and new to object oriented programming in C++! Any advice is much appreciated...


All times are GMT -4. The time now is 23:53.