CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > FLUENT > Fluent UDF and Scheme Programming

Calculating flow variables only once in begin_f_loop()

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 25, 2020, 04:14
Default
  #61
Member
 
Homayoon sohrabi
Join Date: May 2020
Posts: 56
Rep Power: 6
homay95 is on a distinguished road
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??
homay95 is offline   Reply With Quote

Old   June 25, 2020, 04:19
Default Code
  #62
Senior Member
 
vinerm's Avatar
 
Vinerm
Join Date: Jun 2009
Location: Nederland
Posts: 2,946
Blog Entries: 1
Rep Power: 36
vinerm will become famous soon enough
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.
vinerm is offline   Reply With Quote

Old   June 25, 2020, 04:37
Default
  #63
Member
 
Homayoon sohrabi
Join Date: May 2020
Posts: 56
Rep Power: 6
homay95 is on a distinguished road
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?
homay95 is offline   Reply With Quote

Old   June 25, 2020, 04:43
Default Code
  #64
Senior Member
 
vinerm's Avatar
 
Vinerm
Join Date: Jun 2009
Location: Nederland
Posts: 2,946
Blog Entries: 1
Rep Power: 36
vinerm will become famous soon enough
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.
vinerm is offline   Reply With Quote

Old   June 25, 2020, 04:56
Default
  #65
Member
 
Homayoon sohrabi
Join Date: May 2020
Posts: 56
Rep Power: 6
homay95 is on a distinguished road
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) ??
homay95 is offline   Reply With Quote

Old   June 25, 2020, 06:57
Default Temperature Jump
  #66
Senior Member
 
vinerm's Avatar
 
Vinerm
Join Date: Jun 2009
Location: Nederland
Posts: 2,946
Blog Entries: 1
Rep Power: 36
vinerm will become famous soon enough
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.
vinerm is offline   Reply With Quote

Old   June 25, 2020, 09:23
Default
  #67
Member
 
Homayoon sohrabi
Join Date: May 2020
Posts: 56
Rep Power: 6
homay95 is on a distinguished road
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?
homay95 is offline   Reply With Quote

Old   June 25, 2020, 10:06
Default Correct
  #68
Senior Member
 
vinerm's Avatar
 
Vinerm
Join Date: Jun 2009
Location: Nederland
Posts: 2,946
Blog Entries: 1
Rep Power: 36
vinerm will become famous soon enough
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.
vinerm is offline   Reply With Quote

Old   June 25, 2020, 10:22
Default
  #69
Member
 
Homayoon sohrabi
Join Date: May 2020
Posts: 56
Rep Power: 6
homay95 is on a distinguished road
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?
homay95 is offline   Reply With Quote

Old   June 25, 2020, 11:00
Default Define_adjust
  #70
Senior Member
 
vinerm's Avatar
 
Vinerm
Join Date: Jun 2009
Location: Nederland
Posts: 2,946
Blog Entries: 1
Rep Power: 36
vinerm will become famous soon enough
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.
vinerm is offline   Reply With Quote

Old   June 25, 2020, 11:27
Default
  #71
Member
 
Homayoon sohrabi
Join Date: May 2020
Posts: 56
Rep Power: 6
homay95 is on a distinguished road
okay. now I understand. thank you very much for your help
homay95 is offline   Reply With Quote

Old   June 25, 2020, 12:22
Default
  #72
Member
 
Homayoon sohrabi
Join Date: May 2020
Posts: 56
Rep Power: 6
homay95 is on a distinguished road
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?
homay95 is offline   Reply With Quote

Old   June 27, 2020, 10:31
Default
  #73
Member
 
Homayoon sohrabi
Join Date: May 2020
Posts: 56
Rep Power: 6
homay95 is on a distinguished road
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?
homay95 is offline   Reply With Quote

Old   June 30, 2020, 11:55
Default
  #74
Member
 
Homayoon sohrabi
Join Date: May 2020
Posts: 56
Rep Power: 6
homay95 is on a distinguished road
Hi again
I have written a code by DEFINE_ADJUST for temperature jump as follows :

DEFINE_ADJUST(temperaturejump3, domain)
{
Domain *d;
int zone_ID = 16;
Thread *f_thread = Lookup_Thread(domain, zone_ID);
Thread *c_thread;
cell_t cell;
face_t face;
double dTdy, temp, walltemp;
double b = 0.000001;
thread_loop_f (f_thread,domain)
{
begin_f_loop(face,f_thread)
{
cell = F_C0(face,f_thread);
c_thread = THREAD_T0(f_thread);
walltemp = F_T(face,f_thread);
dTdy = C_T_G(cell,c_thread)[1];
F_PROFILE(face, f_thread, zone_ID) = (b*dTdy) + walltemp;
}
end_f_loop(face,f_thread)
}
}

is it correct or does it need any modifying??

Thanks in advance
homay95 is offline   Reply With Quote

Reply

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


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
UDF program for calculating the mass flow outlet with a pulsed output flow Benito89 Fluent UDF and Scheme Programming 9 August 22, 2019 00:57
Match Pressure Inlet/Outlet Boundary Condition Mass Flow Rate MSchneid Fluent UDF and Scheme Programming 3 February 23, 2019 07:00
mass flow in is not equal to mass flow out saii CFX 12 March 19, 2018 06:21
Calculating mass flow rate at multiphase flows Kuslo187 OpenFOAM Post-Processing 1 August 21, 2015 19:11
How to update polyPatchbs localPoints liu OpenFOAM Running, Solving & CFD 6 December 30, 2005 18:27


All times are GMT -4. The time now is 01:56.