K
Subscriber

There are no iterations being performed. The UDF is just executed to solve for something based on the mesh (e.g. suppose it is calculating the average x-component of all the cell centroids or something). I’m unable to share it, but I’ve provided an example code below:

DEFINE_ON_DEMAND(compute_variable) {
#if !RP_HOST

Domain *domain;
Thread *t;
cell_t c;
domain = Get_Domain(ROOT_DOMAIN_ID);
thread_loop_c(t,domain) {
begin_c_loop(c,t) {
/* Do something that might take 10s. */
Message("Analyzed cell %d\n",c);
}
end_c_loop(c,tc)
}

#endif
}

The code takes a few minutes to run, so the messages are there to provide an update for the user. However, it does not spit out the messages as it is running, but rather just dumps all the messages in one go at the end.