Temperature gradient macro
2 Attachment(s)
I wanted to calculate temperature gradient. It can be obtained by macro C_T_G(c,t). I wrote a simple udf to save the Gradient magnitude in UDM.
include "udf.h" DEFINE_EXECUTE_AT_END(temp_gradient) { Domain *d; Thread *t; cell_t c; d = Get_Domain(1); thread_loop_c(t,d) { begin_c_loop(c,t) { C_UDMI(c,t,0) = (C_T_G(c,t)[0]); C_UDMI(c,t,1) = (C_T(c,t)-C_T(c-1,t))/0.00025; } end_c_loop(c,t) } } But I do not know the gradient value is correct. The regions where temperature is constant should have zero gradient value but in result there is some finite value. Attached herewith the images. Can someone take a look at them and comment? Thanking you in anticipation. |
Hello Tushar_Telmasre
You use command define on DEFINE_ON_DEMAND First define Temperature gradient by real value Define definition Temperature_gradient=C_T_G(c,t) C_UDMI(c,t,1)=C_T_G(c,t) Sent from my Moto G (4) using CFD Online Forum mobile app |
|
If you have any idea rather than this please send me
Sent from my Moto G (4) using CFD Online Forum mobile app |
hi swapnil,
I use EXECUTE_AT_END macro so that solver automatically calculates the gradient value at the end of the time step. Further I formulated a similar problem in comsol and calculated the gradient. As expected the gradient value was zero where there was no change in temperature. now I am thinking about calculating the gradient value myself using C_T(c,t) macro but for gradient I would need the values OF TEMPERATURE at surrounding nodes and I don't know how to do that. have you any idea? |
All times are GMT -4. The time now is 14:20. |