DEFINE_ADJUST for limiting values of UDS
Hi everybody,
I am simulating a system that includes a user defined scalar that is bounded (it cannot be higher than 1). Therefore, I have written the following DEFINE_ADJUST code, compiled (built and loaded) and hooked. No error is given. However, it does not work (the result is the same as with no DEFINE_ADJUST source code). I am using Fluent 13.0. I would appreciate your help. #include "udf.h" DEFINE_ADJUST(limit_UDS,d) { Thread *t; cell_t c; { begin_c_loop_c(t,d) if(C_UDSI(c,t,0)>1.) C_UDSI(c,t,0)=1. end_c_loop(c,t) } } |
Quote:
Therefore, forcing a UDS value in adjust function only should be used to rule temporary value which is unreasonable, like upper temperature limit 5000K in Fluent. You can't alway force the UDS to your value during the whole iteration. I mean you should force UDS value only when the value is out of reasonable range. |
How to limit the value of a UDS (like temperature)
So, is there any way to limit the value of a UDS like temperature in the "limits" option in the "run calculation" dialog box?
|
Quote:
#include "udf.h" DEFINE_ADJUST(limit_UDS,d) { Thread *t; cell_t c; thread_loop_c(t, d) /*loops over all cell threads in domain*/ { begin_c_loop(c, t) /* loops over cells in a cell thread */ { if(C_UDSI(c,t,0)>1.) { C_UDSI(c,t,0)=1. } } end_c_loop(c, t) } } |
I am sorry but I forgot to write the
thread_loop_c(t, d) line in my first message. So, my define_adjust is equal to yours but simply does not work. In any case, thank you for your replies. |
Quote:
|
Have the same problem.
Did you find some solution? Do not why hooking define_adjust doesn't work. I appreciate whatever clue to solve this... best regards |
No, I did not find the solution.
|
Maybe it is not too straightforward, but consider the following:
1) If the scheme for transport equation is monotonous, the solution should be within limits set by boundary conditions, if we disregard the source term. 2) Accordingly, it is much better to formulate the source term in such a manner that it will preserve the solution within the necessary limits (or decrease the iteration parameter/time step). 3) If you adjust the solution, it will go out of limits upon the next iteration in a most unpleasant manner anyway due to (2). Just take a look at http://www.cfd-online.com/Forums/flu...ds-values.html |
All times are GMT -4. The time now is 12:35. |