temperature gradient problem in udf
Hi all,I am using a udf to attach 2 body forces(source terms in momentum equation)one in x direction and another in y direction with 2 define_source macros written in same source file.
They both call a third function for some computational task(like a sin or cos function,entirely mathematical stuff). Now,the problem is I am using c_t_g macro to calculate temperature gradient in both the source functions.I read in the manual "In order to retain the gradient data (when you want to set up user-dened scalar transport equations, for example), you can prevent the solver from freeing up memory by issuing the text command solve/set/expert and then answering yes to the question Keep temporary solver memory from being freed?. Note that when you do this, all of the gradient data is retained, but the calculation requires more memory to run." I did that...But I am getting ACCESS VIOLATION during runtime... Please help.... the udf is as follows.... Code:
|
If you turn on "Keep temporary solver memory from being freed", Fluent will start to store gradient data. However, there will be no gradient data stored from the previous iteration, so in your first iteration these will be undefined, which might cause your problem. Either turn the option on and do one or several iterations/time steps before you start your "real" simulation, to ensure that the gradients are there, or rewrite your code to include something like:
if ( NULL != THREAD_STORAGE(t,SV_T_G) ) { temp_gradient_x = C_T_G(c,t)[0]; } else { /* first iteration OR option to store gradients not turned on */ temp_gradient_x = 0.0; } Hope this helps! /Henrik |
Thanks a lot Henriks ,Your code snippet worked like a charm...!!!!
|
temperature gradient fluent
Dear all
I entered the entropy generation equation in custom field function.but my result is wrong(not validated with paper). I examined my results and found that Fluent calculate the temperature gradient, but it can not properly calculate the square of the temperature gradient!!! please help with this problem thanks |
Quote:
|
There is no indication that Fluent can not "properly calculate the square of the temperature gradient".
It is much more likely that Ras0ul made a mistake in his code. But, because he never posted his code, we can not find out the truth. (I don't understand why so many people ask here for help with their code, but then don't post their code... I really don't know what they expect to happen.) |
i have a cfd problem setup in which i have to insert a udf for soil temperature distribution with respect to depth and real time as an initial condition. I have the equation for it right now i have insert a constant soil temperature patch., please help in how may i proceed?
|
All times are GMT -4. The time now is 11:41. |