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

Invalid Cp and Floating point exception in FLUENT UDF

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 14, 2022, 11:22
Post Invalid Cp and Floating point exception in FLUENT UDF
  #1
Member
 
Join Date: Jul 2020
Location: India
Posts: 66
Rep Power: 6
Cooper24 is on a distinguished road
I am trying to move a Laser over a cylindrical pellet. The Laser is applied using a UDF and using DEFINE_PROFILE. When I remove the UDF and just apply a constant surface heat flux on the surface, the simulation runs. But when I am using the UDF, the simulation does not start and throws a floating point exception error along with Invalid Cp warning. I have attached the image of the domain. My UDF is as follows:

#include "udf.h"
#include "sg_mphase.h"
#include "mem.h"
#include "sg_mem.h"
#include "math.h"
#include "flow.h"
#include "unsteady.h"
#include "metric.h"
#include "sg.h"

#define eta 0.35 // Absorption coefficient
#define P 500 // Laser power
#define R 40e-6 // spot radius
#define v 0.04 // scan speed of laser
#define ha 25 // Heat transfer coefficient
#define Ta 298 // Ambient air temperature
#define s 5.67e-8 // Stefan Boltzmann constant
#define e 0.5 // Emmisivity
#define Pi 3.1415926535
#define x0 -200e-6 // Initial x position of the laser
#define y0 0.0 // Intiial y position of the laser
#define Ts 1357 // Solidus temperature
#define Tl 1357 // Liquidus temperature

DEFINE_PROFILE(Laser, t, i) // The name of the UDF is Laser
{
real x[ND_ND], time; // Define face centroid vector, time
time = RP_Get_Real("flow-time"); // Acquire time from Fluent solver
face_t f; // face thread


begin_f_loop(f,t)
{
F_CENTROID(x,f,t);
real r = sqrt(pow(x[0]-x0-v*time,2.0) + pow(x[1]-y0,2.0));
real T = F_T(f,t);

if(r<=R)
{
F_PROFILE(f,t,i) = (((2*eta*P)/(Pi*R*R))*exp((-2*(r*r))/(R*R))) - ha*(T-Ta) - (s*e*(pow(T,4) - pow(Ta,4)));
}
else
{
F_PROFILE(f,t,i) = - ha*(T-Ta) - (s*e*(pow(T,4) - pow(Ta,4)));
}
}
end_f_loop(f,t)
}

Someone please help!! Thanks in advance.
Cooper24 is offline   Reply With Quote

Reply

Tags
divergence detected, floating point exception, invalid cp, solidification/melting


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



All times are GMT -4. The time now is 15:08.