Ansys Learning Forum Forums Discuss Simulation Fluids Laser Surface melting in fluent using udf Reply To: Laser Surface melting in fluent using udf

Avinash Kumar
Subscriber

I have written a udf for 2D gaussian heat source moving in x direction on the face to the centroid of the largest face of rectangle .

#include "udf.h"
DEFINE_PROFILE(gauss2D_heat_flux, thread, position)
{
  real x[ND_ND];
  face_t f;
  real current_time;
  real Q = 250;
  real PI = acos(-1);
  real vel = 1e-2;
  real r = 0.00125;
  real B = -3;
  real A;
  real d;
  real dt;
  real x_pos;
  current_time = CURRENT_TIME;
  dt = CURRENT_TIMESTEP;
  A = (2 * Q) / (PI * pow(r, 2.));
  begin_f_loop(f, thread)
  {
     F_CENTROID(x, f, thread);
     x_pos = vel * current_time;
     F_PROFILE(f, thread, position) = A * exp(B * (pow((x[0] - x_pos), 2.) + pow(x[1], 2.)) / pow(r, 2.));
  }
  end_f_loop(f, thread)
}
I think there is probelm in udf Can you check it.