Fluent6: Want to access values calculated by a custom field function inside a UDF


Sometimes, for some reason, the user wants to use values that are available in post-processing (through e.g. "Display---Contours" and all the other post-processing functions) inside a UDF. This requests includes even custom field function calculated values.
This is possible by the following background information:
After the user has pressed "Compute" or "Display" in e.g. the "Display---Contours" panel, FLUENT calculates values for the chosen quantity (under "Contours of...") and stores them in "C_TMP(c,t)".
Therefore, the following routine can be used to copy these values into a User Defined Memory (UDM):
This will only copy cell values -- face values can be handled similarly.
Note that UDM postprocessing ignores face values, so that the comparison should be done using display of cell values. Nevertheless, all values can be copied to the UDM and can then be used later on. The sequence of choosing a post-processing quantity (e.g. a custom field function), pressing "Compute" in the "Display---Contours" (or Velocity Vectors) panel, and running the on-demand UDF can be automatised through entries in the panel accessed through "Solve---Execute-Commands".
As a limitation the fact remains that only results after a completed iteration can be made available for use during subsequent iterations.
-----------------------------------
#include "udf.h"
DEFINE_ON_DEMAND(ondmd_poprobufftoudm)
{
Domain *my_dom = Get_Domain(1);
Thread *my_thr = NULL;
cell_t my_cel = -1;

thread_loop_c(my_thr, my_dom)
{
if (NNULLP(THREAD_STORAGE(my_thr, SV_RTMP_0)))
{
begin_c_loop(my_cel, my_thr)
{
C_UDMI(my_cel, my_thr, 0) = C_TMP(my_cel, my_thr);
}
end_c_loop(my_cel, my_thr)
}
}
}





Show Form
No comments yet. Be the first to add a comment!