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

udf for moving heat flux for the simulation of laser melting

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By AlexanderZ

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 23, 2018, 09:49
Default udf for moving heat flux for the simulation of laser melting
  #1
New Member
 
rishitosh's Avatar
 
Rishitosh Ranjan
Join Date: Dec 2012
Location: Trichirapalli, Tamilnadu, India
Posts: 22
Rep Power: 14
rishitosh is on a distinguished road
Helllo all!!!
I have created udf for moving heat flux for the simulation of laser melting.

DEFINE_PROFILE (gaussian_heat_flux,thread,position)
{

face_t f;
real x[3], dummy, se; //[10]
real current_time = RP_Get_Real("flow-time");
real dt = RP_Get_Real ("physical-time-step");
real vel = 1e-3; //velocity of welding in x direction m/sec
real p = 450; // laser power in watt
real a = 0.0015; // [15] deposition half width in m
real b = 0.0009; // melt pool depth in m
real cc = 0.0015; // longitudinal ellipsoid axis in m
begin_f_loop(f, thread)
{ // [20]
F_CENTROID (x, f, thread);
x[0]= vel * current_time;
dummy = 3 * pow(x[0], 2) / pow(a, 2) + 3 * pow(x[1], 2) / pow(b, 2) + 3 * pow(x[2],2) / pow(cc, 2);
se=(3*p/(M_PI*a*b*cc));
F_PROFILE(f, thread, position) = se*exp(-dummy);// [25]
}
end_f_loop(f, thread)
}


but after compilation i am getting waring and error..
c(23) : warning C4700: uninitialized local variable 'x' used
c(7) : error C2059: syntax error : '}'
c(8) : warning C4034: sizeof returns 0

can anybody help please..!!

with thanks and regards,
Rishi.
rishitosh is offline   Reply With Quote

Old   January 23, 2018, 21:17
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
Delete space in function header.
Code:
#include "udf.h"

DEFINE_PROFILE(gaussian_heat_flux2,thread,position) 
{ 

face_t f;
real x[3], dummy, se; //[10]
real current_time = RP_Get_Real("flow-time"); 
real dt = RP_Get_Real ("physical-time-step"); 
real vel = 1e-3; //velocity of welding in x direction m/sec
real p = 450; // laser power in watt
real a = 0.0015; // [15] deposition half width in m
real b = 0.0009; // melt pool depth in m
real cc = 0.0015; // longitudinal ellipsoid axis in m
begin_f_loop(f, thread) 
{ // [20] 
F_CENTROID (x, f, thread); 
x[0]= vel * current_time;
dummy = 3 * pow(x[0], 2) / pow(a, 2) + 3 * pow(x[1], 2) / pow(b, 2) + 3 * pow(x[2],2) / pow(cc, 2);
se=(3*p/(M_PI*a*b*cc));
F_PROFILE(f, thread, position) = se*exp(-dummy);// [25]
} 
end_f_loop(f, thread) 
}
Best regards
rishitosh likes this.
AlexanderZ is offline   Reply With Quote

Old   January 24, 2018, 02:01
Default
  #3
New Member
 
rishitosh's Avatar
 
Rishitosh Ranjan
Join Date: Dec 2012
Location: Trichirapalli, Tamilnadu, India
Posts: 22
Rep Power: 14
rishitosh is on a distinguished road
dear... thanks for the response!!
I have rectified it and complied it successfully...
#include "udf.h"
#include "metric.h"
#include "math.h"

#define P 2000 /*peak power of laser*/
DEFINE_PROFILE(ht_flx_tp_srf,t,i)
{
face_t f;
real x[2];
real Q, a, b, time, vel,dt;
a = b=0.001;
time = RP_Get_Real("flow-time");
dt = RP_Get_Real ("physical-time-step");
vel = 1e-3; //10
//x[0]=-0.005;
//x[1]=0;
begin_f_loop(f,t)
{
F_CENTROID(x,f,t);
Q = (3 * P / (M_PI*a*b))*exp(- (3 * pow(x[0]-vel*time, 2) / pow(a, 2)) - (3 * pow(x[1], 2) / pow(b, 2))); //15
F_PROFILE(f,t,i) = Q;
}
end_f_loop(f,t)
}
but I am not able to move heat flux "Q"...
can you help me in this ...

thank you.
rishitosh 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
UDF for time dependent stepwise heat flux profile bugrasss Fluent UDF and Scheme Programming 0 April 15, 2015 07:32
UDF for heat source in Soldification and melting model karthik82 FLUENT 1 June 23, 2014 06:39
Question about heat transfer coefficient setting for CFX Anna Tian CFX 1 June 16, 2013 07:28
Error finding variable "THERMX" sunilpatil CFX 8 April 26, 2013 08:00
Laser Heat Flux & UDF Dominick FLUENT 3 February 12, 2004 16:46


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