CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   FLUENT (http://www.cfd-online.com/Forums/fluent/)
-   -   GRID_MOTION updating problems (http://www.cfd-online.com/Forums/fluent/49053-grid_motion-updating-problems.html)

Ted August 20, 2008 11:47

GRID_MOTION updating problems
 
I am using the DEFINE_GRID_MOTION udf to move nodes at a small incremental rate inside of a while loop. I am comparing the volume after the node movement to a volume in which I would like to achieve, the target volume. If the updated volume is close to the target volume, then I break the loop. However, if the updated volume is still far from the target volume, then I continue to loop it and move the nodes again until the two converge.

The problem that is occuring is that the nodes are moving like I would like but the while loop is never breaking because I am unable to calculate the new/changed volume correctly during the while loop. The only time the volume is calculated correctly is after the GRID_MOTION udf has completed running and I use a DEFINE_EXECUTE_AT_END udf. The same function is used to calculate the volume in both UDF's. It is as if the nodes move, but the mesh is staying with the old nodal positions and the volume remains the same throughout the duration of the while loop even though nodes are moving. Is there a way to ensure that the correct volume is measured or computed after each nodal position change?

My function for calculating the volume that I am using is:

double get_volume() {

Domain *d = Get_Domain(1);

Thread *t;

cell_t c;

real TotVol=0.0;

int i;

thread_loop_c(t, d)

{

i = t->id;

if (FLUID_THREAD_P(t))

{

begin_c_loop(c, t)

{

TotVol += C_VOLUME(c, t);

}

end_c_loop(c, t)

}

}

return (TotVol*1.0e6); }

Thanks for any help, Ted


All times are GMT -4. The time now is 12:29.