DEFINE_ADJUST Application
Hi All,
I am confused on the DEFINE_ADJUST macro as there is not much in the UDF manual. Would it be possible to alter material properties (e.g. diffusivity) via DEFINE_ADJUST? In addition, can someone please explain how the DEFINE_ADJUST macro works? Thanks all! |
Quote:
|
Hi Bruno,
Thank you for the reply. Can elaborate when you say "add functions to your code and call for these inside the DEFINE_ADJUST"? Do you mean I could call on the DEFINE_ADJUST code from a DEFINE_DIFFUSIVITY code? I am asking because I am not exactly sure how DEFINE_ADJUST works as I am not sure how it can alter values in specific fields such as boundary conditions. Thank you for the help! Much appreciated. |
Quote:
You can have different functions in your code, eg real function1(c,t) { . . . } real function2(c,t) { . . . } real function3(c,t) { . . . } In your define adjust, you can call these functions and it will be computed each iteration DEFINE_ADJUST(whatever,d) { Thread *t; cell_t c; real variable; thread_loop_c (t,d) { begin_c_loop (c,t) C_UDMI(c,t,0) = function1(c,t) + function2(c,t) + function3(c,t); end_c_loop (c,t) } } In this piece of code, you have 3 distinct functions and in your define adjust, you are defining an UDM as the sum of the three. This is one example, but you can apply many other purposes at it. You can also call the functions you define in the DEFINE_DIFFUSIVITY. Again, thousands of examples on internet. |
Hi Bruno,
Thank you for the help. I believe I am understanding what you are saying. Can you elaborate on if the the following is possible via the DEFINE_ADJUST macro? I would like to alter kinetic theory results from diffusivity by a factor (e.g. 1/x^2). Would this be possible via DEFINE_ADJUST or would I have to store the values via UDMI and then somehow recall it via DEFINE_DIFFUSIVITY and something like C_PROFILE? |
There are a number of macros available within most hooks such as the x-velocity: C_U(c,t). However, if you alter the velocity, for example by setting it to uniform flow:
Code:
C_U(c,t) = 1.; |
Hi e,
thank you for the reply. Here is what I am trying to do. I am trying to implement something to this extent in the diffusivity field kinetic theory * some multiplicative factor (e.g. 0.5) I do not want to rewrite the kinetic theory equation in a UDF as it will take a long time so I was wondering if the DEFINE_ADJUST can accomplish this. The problem I am running into is that all DEFINE_ADJUST macro example I can find are storing the values via UDSI or UDMI which will then require a UDF (most likely DEFINE_DIFFUSIVITY macro) to use this value for diffusivity. Doing this will remove the kinetic theory field for diffusivity, thus this process seems like it is invalid. If this is not possible, please tell me, so I may go along another route. Thank you so much, GF |
Check if the laminar species (C_DIFF_L) or effective species (C_DIFF_EFF) diffusivity macros return the value you're after.
|
All times are GMT -4. The time now is 06:30. |