# Calculating flow variables only once in begin_f_loop()

 Register Blogs Members List Search Today's Posts Mark Forums Read

 June 25, 2020, 03:14 #61 Member   Homayoon sohrabi Join Date: May 2020 Posts: 56 Rep Power: 5 so I have written a code for " Tf = Ts + ks(dT/dn)" in which Tf is fluid temperature, Ts is the wall temperature and ks is temperature jump coefficient. DEFINE_PROFILE(temperaturejump, thread, position) { face_t f; cell_t c; Thread *tc; double b = 0.000001; double dTdy ,tem ,walltemp; begin_f_loop(f, thread) { c = F_C0(f,thread); tc = THREAD_T0(thread); dTdy = C_T_G(c,tc)[1]; walltemp = F_T(f, thread); tem = (b*dTdy) + walltemp; F_PROFILE(f, thread, position) = tem; } end_f_loop(f, thread) } is it correct or does it have any problem??

 June 25, 2020, 03:19 Code #62 Senior Member     Vinerm Join Date: Jun 2009 Location: Nederland Posts: 2,946 Blog Entries: 1 Rep Power: 35 The code is correct, but missing the commands that I shared earlier for storing temperature gradient. __________________ Regards, Vinerm PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority.

 June 25, 2020, 03:37 #63 Member   Homayoon sohrabi Join Date: May 2020 Posts: 56 Rep Power: 5 so should i add them within the loop? and another question is that does the expression "F_T(f, thread)" gives wall temperature? or do i have to use "C_T(c, thread)" instead?

 June 25, 2020, 03:43 Code #64 Senior Member     Vinerm Join Date: Jun 2009 Location: Nederland Posts: 2,946 Blog Entries: 1 Rep Power: 35 You need to add those three lines outside the loop. F_T is good. C_T gives cell temperature. __________________ Regards, Vinerm PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority.

 June 25, 2020, 03:56 #65 Member   Homayoon sohrabi Join Date: May 2020 Posts: 56 Rep Power: 5 okay. but im having a trouble with hooking the UDFs. where do i have to hook this temperature jump? for the face (adjacent to solid) or for the shadow(adjacent to fluid) ??

 June 25, 2020, 05:57 Temperature Jump #66 Senior Member     Vinerm Join Date: Jun 2009 Location: Nederland Posts: 2,946 Blog Entries: 1 Rep Power: 35 The profiles are same for a wall and its shadow. If you hook it to one, it automatically works for the other. And that's where you have trouble since the jump should exist only on the fluid side. So, DEFINE_PROFILE may not be a good idea. Use DEFINE_ADJUST, access the thread on the fluid size, and then change the temperature. Let the coupled condition be as it is so that thermal energy conservation could be maintained. __________________ Regards, Vinerm PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority.

 June 25, 2020, 08:23 #67 Member   Homayoon sohrabi Join Date: May 2020 Posts: 56 Rep Power: 5 aha I think I understand what you are saying, do you mean if I use DEFINE_ADJUST, it would implement the heat transfer(conduction) between the face and its shadow by itself too, right?

 June 25, 2020, 09:06 Correct #68 Senior Member     Vinerm Join Date: Jun 2009 Location: Nederland Posts: 2,946 Blog Entries: 1 Rep Power: 35 That's what a default coupled condition does. In reality, there is no conduction between a boundary and its shadow. They are same. When they are coupled, the heat flux entering one is equal to heat flux exiting other, i.e., thermal energy is conserved. __________________ Regards, Vinerm PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority.

 June 25, 2020, 09:22 #69 Member   Homayoon sohrabi Join Date: May 2020 Posts: 56 Rep Power: 5 but the problem Im having here is that I need to apply both conditions to the liquid-solid interface, I mean I need to apply temperature jump to shadow(adjacent to fluid) temperature and also I need to have a coupled condition between face and shadow. but in fluent I can only either apply temperature jump or just have coupled condition, not both of them at a time. what should I do?

 June 25, 2020, 10:00 Define_adjust #70 Senior Member     Vinerm Join Date: Jun 2009 Location: Nederland Posts: 2,946 Blog Entries: 1 Rep Power: 35 That's why you need to use DEFINE_ADJUST. You can apply jump using UDF and coupled condition will maintain the conservation across shadow pairs. __________________ Regards, Vinerm PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority.

 June 25, 2020, 10:27 #71 Member   Homayoon sohrabi Join Date: May 2020 Posts: 56 Rep Power: 5 okay. now I understand. thank you very much for your help

 June 25, 2020, 11:22 #72 Member   Homayoon sohrabi Join Date: May 2020 Posts: 56 Rep Power: 5 so I have read about DEFINE_ADJUST macro. but I dont know how does it work!? what are the differences between this and DEFINE_PROFILE? which arguments should I use ? and to which part of FLUENT should I apply that?

 June 27, 2020, 09:31 #73 Member   Homayoon sohrabi Join Date: May 2020 Posts: 56 Rep Power: 5 You mean first I have to write a DEFINE_ADJUST which includes temperature jump function in it and hook it to function hooks and then leave the thermal boundary conditions for faces and their shadows as coupled. right?

 Tags fluent - udf - parallel, slip b.c., slip flow, udf and programming