CFD Online Discussion Forums

CFD Online Discussion Forums (
-   FLUENT (
-   -   UDF - define_init & restart problem (

argeus December 3, 2012 17:27

UDF - define_init & restart problem
Dear friends,
There is one thing I cant figure out. I interpreted my UDF which was made as follows:
Define_init function. Is to examine the geometry parameters, to simplify it, it returns the total volume (c_tot variable) of the cells.
Define_source (whatever define macro), uses this value, such as x/c_tot. Everything works fine, until I end the calculation, write a .dat file and restart the calculation without initialization. Seems to be (and Im pretty sure), that Fluent does not store the c_tot value, in general any value, obtained from define_init once the calculation is over and then restarted. I really dont want to use a define_adjust (it will uselessly slow down my calculation), or define_on_demand (want to keep it to be performed automatically). Is there any way to store that value for the next usage?
Thank you in advance.

argeus December 4, 2012 12:19

Hi again,
so it seems to be that I moved on a bit.
I found out that use of C_UDMI could be suitable for this kind of problem, anyway there is still an issue I cant pass through.
To explain it more closely:


DEFINE_INIT (init, domain)
  real ...
  thread_loop_c(t, domain);
      begin_c_loop(c, tc)
        if (sth)
        C_UDMI(c, tc, 0)+=C_VOLUME(c, tc);
      end_c_loop(c, tc)

and then

DEFINE_SOURCE(energy, c, thread, dS, eqn)
  real ...
  var1=var2/C_UDMI(c, tc, 0)
  return source;

Please have a look on that. Problem is, that C_UDMI is returning zero value (as an output from ini function), and I dont have a clue why.
Maybe I just dont understand how C_UDMI is working.
The second question is - Will be the C_UDMI value stored after I re-interpret my UDF, or restart the calculation from a .dat file? (Will be this value written into a .dat file?).
For now, Im using on demand macro, but it is not so pretty as I would like to.. :)
Thank you in advance.

All times are GMT -4. The time now is 22:25.