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

How to define a wall heat flux changing with flow time in udf? Such as: t<0.3, heat f

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 12, 2020, 01:06
Default How to define a wall heat flux changing with flow time in udf? Such as: t<0.3, heat f
  #1
Senior Member
 
Join Date: Dec 2017
Posts: 388
Rep Power: 10
hitzhwan is on a distinguished road
How to define a wall heat flux changing with flow time in udf? Such as:
t<0.3, heat flux =10w/m^2;
t>=0.3,heat flux =1000w/m^2;

Other than udf, could we use an expression to solve this problem in fluent?
hitzhwan is offline   Reply With Quote

Old   July 13, 2020, 02:18
Default
  #2
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
you can use profile or expression.
look for profile on this forum
__________________
best regards


******************************
press LIKE if this message was helpful
AlexanderZ is offline   Reply With Quote

Old   July 13, 2020, 12:05
Default Would you please share me the codes for me? Thank you so much.
  #3
Senior Member
 
Join Date: Dec 2017
Posts: 388
Rep Power: 10
hitzhwan is on a distinguished road
Quote:
Originally Posted by AlexanderZ View Post
you can use profile or expression.
look for profile on this forum
Would you please share me the codes for me? Thank you so much.
hitzhwan is offline   Reply With Quote

Old   July 13, 2020, 20:11
Default
  #4
New Member
 
Siddharth
Join Date: Nov 2016
Posts: 11
Rep Power: 10
siddhu23 is on a distinguished road
Quote:
Originally Posted by hitzhwan View Post
How to define a wall heat flux changing with flow time in udf? Such as:
t<0.3, heat flux =10w/m^2;
t>=0.3,heat flux =1000w/m^2;

Other than udf, could we use an expression to solve this problem in fluent?
FYR:
Code:
#include "udf.h"

DEFINE_PROFILE(hf_change,thread,position) 
{
  face_t f;
  real time,heat_flux1,heat_flux2;
  heat_flux1 = 10;
  heat_flux2 = 100;
  time=CURRENT_TIME;
  begin_f_loop(f,thread)
  {
   
	if (time<0.3)
	{
	F_PROFILE(f,thread,position)=heat_flux1;
	}
        
	else if (time>=0.3)
	{
	F_PROFILE(f,thread,position)=heat_flux2;
	}
      	
   }
  end_f_loop(f,thread)
}
siddhu23 is offline   Reply With Quote

Old   July 14, 2020, 19:39
Default Is this code right? If yes, what is the difference?
  #5
Senior Member
 
Join Date: Dec 2017
Posts: 388
Rep Power: 10
hitzhwan is on a distinguished road
Is this code right? If yes, what is the difference?

#include "udf.h"
DEFINE_PROFILE(wall_heatflux, thread, position)
{
real t,q;
face_t f;
begin_f_loop(f, thread)
{
t=RP_Get_Real("flow-time");
{
if (t>0 && t<=0.50)
{
q=0;
}

else if (t>=0.5)
{
q=47300;
}

}
F_PROFILE(f,thread,position)=q;
}
end_f_loop(f,thread)
}
hitzhwan is offline   Reply With Quote

Old   July 14, 2020, 20:25
Default
  #6
New Member
 
Siddharth
Join Date: Nov 2016
Posts: 11
Rep Power: 10
siddhu23 is on a distinguished road
Quote:
Originally Posted by hitzhwan View Post
Is this code right? If yes, what is the difference?

#include "udf.h"
DEFINE_PROFILE(wall_heatflux, thread, position)
{
real t,q;
face_t f;
begin_f_loop(f, thread)
{
t=RP_Get_Real("flow-time");
{
if (t>0 && t<=0.50)
{
q=0;
}

else if (t>=0.5)
{
q=47300;
}

}
F_PROFILE(f,thread,position)=q;
}
end_f_loop(f,thread)
}
Code:
#include "udf.h"
DEFINE_PROFILE(wall_heatflux,thread,position)
{
	real t,q;
	face_t f;
	t=RP_Get_Real("flow-time"); /* CURRENT_TIME & RP_Get_Real("flow-time") both return same value*/

	if ((t>0) && (t<=0.50))	/* both condition must closed with parentheses ((condition1) && (condition1) && ..... && (conditionN)) */
		{
		q=0;
		}
	else if (t>=0.5)
		{
		q=47300;
		}
	begin_f_loop(f,thread)
	{
        F_PROFILE(f,thread,position) = q;
	}
	end_f_loop(f,thread)
}
siddhu23 is offline   Reply With Quote

Old   July 15, 2020, 02:42
Default
  #7
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
codes are almost same
but in your last code
Code:
t=RP_Get_Real("flow-time");
is inside face loop which is inefficient (code gets time on each face, even though, you can get it just once)
usually, you want to get time value from outside of the loop.
__________________
best regards


******************************
press LIKE if this message was helpful
AlexanderZ is offline   Reply With Quote

Old   July 16, 2020, 22:09
Default
  #8
New Member
 
Siddharth
Join Date: Nov 2016
Posts: 11
Rep Power: 10
siddhu23 is on a distinguished road
Quote:
Originally Posted by AlexanderZ View Post
codes are almost same
but in your last code
Code:
t=RP_Get_Real("flow-time");
is inside face loop which is inefficient (code gets time on each face, even though, you can get it just once)
usually, you want to get time value from outside of the loop.
Hi,

t=RP_Get_Real("flow-time"); each time the flow time will be updated even though the "t" outside of the loop.
siddhu23 is offline   Reply With Quote

Old   July 17, 2020, 00:37
Default In your giving code, you do not have the "begin loop"
  #9
Senior Member
 
Join Date: Dec 2017
Posts: 388
Rep Power: 10
hitzhwan is on a distinguished road
Quote:
Originally Posted by AlexanderZ View Post
codes are almost same
but in your last code
Code:
t=RP_Get_Real("flow-time");
is inside face loop which is inefficient (code gets time on each face, even though, you can get it just once)
usually, you want to get time value from outside of the loop.
In your giving code, why did you put the "begin_f_loop(f,thread)" after the if Statement?

#include "udf.h"
DEFINE_PROFILE(wall_heatflux,thread,position)
{
real t,q;
face_t f;
t=RP_Get_Real("flow-time"); /* CURRENT_TIME & RP_Get_Real("flow-time") both return same value*/

if ((t>0) && (t<=0.50)) /* both condition must closed with parentheses ((condition1) && (condition1) && ..... && (conditionN)) */
{
q=0;
}
else if (t>=0.5)
{
q=47300;
}
begin_f_loop(f,thread)
{
F_PROFILE(f,thread,position) = q;
}
end_f_loop(f,thread)
}
hitzhwan is offline   Reply With Quote

Old   July 17, 2020, 00:41
Default You mean the “time=CURRENT_TIME;” and “t=RP_Get_Real("flow-time")” have the same func
  #10
Senior Member
 
Join Date: Dec 2017
Posts: 388
Rep Power: 10
hitzhwan is on a distinguished road
Quote:
Originally Posted by AlexanderZ View Post
codes are almost same
but in your last code
Code:
t=RP_Get_Real("flow-time");
is inside face loop which is inefficient (code gets time on each face, even though, you can get it just once)
usually, you want to get time value from outside of the loop.
You mean the “time=CURRENT_TIME;” and “t=RP_Get_Real("flow-time")” have the same function?
hitzhwan is offline   Reply With Quote

Old   July 17, 2020, 01:33
Default
  #11
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
read Ansys Fluent Customization manual carefully,
it has good examples inside
all your questions as of now are covered there
__________________
best regards


******************************
press LIKE if this message was helpful
AlexanderZ is offline   Reply With Quote

Old   July 17, 2020, 10:23
Default
  #12
New Member
 
Siddharth
Join Date: Nov 2016
Posts: 11
Rep Power: 10
siddhu23 is on a distinguished road
Quote:
Originally Posted by hitzhwan View Post
You mean the “time=CURRENT_TIME;” and “t=RP_Get_Real("flow-time")” have the same function?
Yes.
Refer the link below. For more detail.

https://www.afs.enea.it/project/nept...df/node112.htm
siddhu23 is offline   Reply With Quote

Old   July 17, 2020, 14:28
Default Hi, because I am not familar with C language,it is hard for me to understand, do you
  #13
Senior Member
 
Join Date: Dec 2017
Posts: 388
Rep Power: 10
hitzhwan is on a distinguished road
Quote:
Originally Posted by AlexanderZ View Post
read Ansys Fluent Customization manual carefully,
it has good examples inside
all your questions as of now are covered there
Hi, because I am not familar with C language,it is hard for me to understand, do you have any better material (such as vedio)to learn it , thank you.
hitzhwan is offline   Reply With Quote

Reply


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
Changing Wall Heat Flux in CFX-Pre Doesn't Change Wall Heat Transfer Coef in CFD-Post Shomaz ul Haq CFX 26 October 16, 2019 18:59
Centrifugal fan-reverse flow in outlet lesds to a mass in flow field xiexing CFX 3 March 29, 2017 11:00
Error - Solar absorber - Solar Thermal Radiation MichaelK CFX 12 September 1, 2016 06:15
Basic Nozzle-Expander Design karmavatar CFX 20 March 20, 2016 09:44
Micro Scale Pore, icoFoam gooya_kabir OpenFOAM Running, Solving & CFD 2 November 2, 2013 14:58


All times are GMT -4. The time now is 13:03.