Ansys Assistant will be unavailable on the Learning Forum starting January 30. An upgraded version is coming soon. We apologize for any inconvenience and appreciate your patience. Stay tuned for updates.

Ansys Learning Forum Forums Discuss Simulation Fluids Laser Melting heat source UDF issue [FLUENT Crashing] Reply To: Laser Melting heat source UDF issue [FLUENT Crashing]

rakibul.buet19
Subscriber

Even if the gradient is negative , I am squaring and rooting the x,y,z gradients and adding them in UDMI 3 right? It aint supposed to be the issue. However when I tried writing the heat source using DEFINE_PROFILE and used begin_f_loop , it worked (although I couldnt add any multiplying factor and gradient UDMI) . I need to multiply the "factor" and "UDMI" in order to convert the surface heat source to volumetric heat source.

 

CODE : ( This heats up both my gasesous and solid phase , which I dont want)

 

#include "udf.h"

DEFINE_PROFILE(heat_source_profile, thread, position)
{
    real x[ND_ND];
    face_t f;
    real current_time;
    real Q = 120; // Define your heat source magnitude (Watts)
    real rx = 5.3e-5; // Define your desired values for rx, ry, rz (meters)
    real ry = 250e-6;
    real rz = 5.3e-5;
    real A;
    real vel = 0.1e-3; // velocity @ m/s
    real PI = 3.1416;
    real x_pos;
    real x_start = 0; // Set your desired starting position in x (m)
    real y_start = 0.2e-3; // Set your desired starting position in y (m)
    real z_start = 0.1e-3; // Set your desired starting position in z (m)

 
   
    real x_local, y_local, z_local; // Declare local coordinates


 

   
    current_time = CURRENT_TIME;
    A = (6 * sqrt(3) * Q) / (PI * sqrt(PI) * rx * ry * rz);

    x_local = 0.0; // Initialize x_local outside the loop
    y_local = 0.0; // Initialize y_local outside the loop
    z_local = 0.0; // Initialize z_local outside the loop
   
    begin_f_loop(f, thread)
    {
        F_CENTROID(x, f, thread);
       
        // Transform global coordinates to local coordinates
        x_local = x[0] - x_start;
        y_local = x[1] - y_start;
        z_local = x[2] - z_start;
       
        x_pos = vel * current_time;

     
       
       
        // Compute the heat source function value
       
         F_PROFILE(f, thread, position) = A * exp(-3 * (pow(x_local - x_pos, 2.) / pow(rx, 2.) + pow(y_local, 2.) / pow(ry, 2.) + pow(z_local, 2.) / pow(rz, 2.)));
         
         
    }
    end_f_loop(f, thread)
}
[bingo_chatbox]