TAGGED: #fluent-#ansys, multiphase, SLM, udf, vof
-
-
July 28, 2024 at 2:38 pmKanak BUET19Bbp_participant
I am simulating the Selective Laser Melting (SLM) process in Ansys Fluent. I have designed the powder bed domain (along with the gas domain) with dimensions of 0.8 mm (x) x 0.2 mm (z) x 0.28 mm (y). During initialization, I patched the region with a height of 0.2 mm along the Y-axis as solid, and the rest as the gas domain, as shown in the image.
I need to apply a laser heat source at the interface of the solid-gas contact surface and also apply recoil pressure and Marangoni effect equations. I understand that a UDF is required for this. I found a UDF code from one of the posts in this forum (which does not include the Marangoni effect) which I have added at last part of the post.Â
Â
Here are my questions:Â1. Material Properties Usage: If density and specific heat data are specified within the UDF, what is the use of the material properties defined in the "Materials" section inside Fluent? How does Fluent determine which properties to use during the simulation?Â2. UDF Implementation Issue: I successfully compiled the code within ANSYS, hooked it under the Adjust section, and added the heat source term under the Cell Zone Boundary Condition. However, I don't see any changes in the results (i.e the phase shape does not change from the initial state) . I even defined 12 User-Defined Memory (UDM) locations. Can you help me identify what might have gone wrong?ÂUDF Code :ÂÂÂÂ#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"Â#define A 0.4 // Absorption coefficient#define P 200 // Laser power#define R 80e-6 // Spot radius#define v 0.1 // Scan speed of laser#define h 25 // Heat transfer coefficient#define Ta 300 // Ambient air temperature#define s 5.67e-8 // Stefan Boltzmann constant#define e 0.5 // Emissivity#define Pi 3.1415926535#define Ts 1658 // Solidus temperature#define Tl 1723 // Liquidus temperature#define x0 0.0// Initial x position of the laser#define y0 0.1e-3 // Initial y position of the laser#define Lv 7.45e6 // Latent heat of Vaporisation#define Tv 3090 // Evaporation Temperature#define Rg 8.314 // Universal Gas constant#define M 0.005593 // Molar mass#define Pa 101325 // Atmospheric pressure#define domain_ID 3 // Domain ID of metal substrateÂDEFINE_ADJUST(adjust_gradient, domain){  Thread *t;  Thread **pt;  cell_t c;  int phase_domain_index = 1.0;  Domain *pDomain = DOMAIN_SUB_DOMAIN(domain,phase_domain_index);  {    Alloc_Storage_Vars(pDomain,SV_VOF_RG,SV_VOF_G,SV_NULL);    Scalar_Reconstruction(pDomain, SV_VOF,-1,SV_VOF_RG,NULL);    Scalar_Derivatives(pDomain,SV_VOF,-1,SV_VOF_G,SV_VOF_RG, Vof_Deriv_Accumulate);  }  mp_thread_loop_c(t,domain,pt)  if (FLUID_THREAD_P(t))  {    Thread *ppt = pt[phase_domain_index];    begin_c_loop (c,t)    {      C_UDMI(c,t,0) = C_VOF_G(c,ppt)[0];      C_UDMI(c,t,1) = C_VOF_G(c,ppt)[1];      C_UDMI(c,t,2) = C_VOF_G(c,ppt)[2];      C_UDMI(c,t,3) = sqrt(C_UDMI(c,t,0)*C_UDMI(c,t,0) + C_UDMI(c,t,1)*C_UDMI(c,t,1) + C_UDMI(c,t,2)*C_UDMI(c,t,2));    }    end_c_loop (c,t)  }  Free_Storage_Vars(pDomain,SV_VOF_RG,SV_VOF_G,SV_NULL);}ÂÂÂDEFINE_SOURCE(heat_source, c, t, dS, eqn){  Thread *pri_th;  Thread *sec_th;  real source;  real x[ND_ND], time;  time = CURRENT_TIME;  C_CENTROID(x, c, t);  real T = C_T(c,t);  Â  pri_th = THREAD_SUB_THREAD(t, 0);  sec_th = THREAD_SUB_THREAD(t, 1);  Â  real alpha = C_VOF(c,sec_th); // Use sub-thread for cell volume fraction  real gamma = C_LIQF(c,sec_th); // Use sub-thread for cell liquid fraction  Â  real Pv = 0.54*Pa*exp((Lv*M*(T-Tv))/(Rg*T*Tv));  real mv = (0.82*M*Pv)/(sqrt(2*Pi*M*Rg*T));  real rhog = 1.6228; // Density of argon  real rhos = 7900; // Density of solid SS316  real rhol = 7433 + 0.0393*T - 0.00018*pow(T,2); // Density of liquid SS316  real rhom = rhol*gamma + rhos*(1-gamma); // Density of SS316  real rho = alpha*rhom + rhog*(1-alpha); // Density of cell containing metal and gas  real Cpg = 520.64; // Specific heat of argon  real Cps = 462 + 0.134*T; // Specific heat of solid SS316  real Cpl = 775; // Specific heat of liquid SS316  real Cpm = Cpl*gamma + Cps*(1-gamma); // Specific heat of SS316  real Cp = alpha*Cpm + Cpg*(1-alpha); // Specific heat of cell containing metal and gas  real factor = (2*rho*Cp)/(rhom*Cpm + rhog*Cpg);  if(C_VOF(c,sec_th) > 0.05 && C_VOF(c,sec_th) < 1)  {    if(C_T(c,sec_th) < 3090)    {      source = (((2*A*P)/(Pi*R*R))*exp((-2*(pow(x[0]-x0-v*time,2.) + pow(x[1]-y0,2.)))/(R*R)) - h*(T-Ta) - s*e*(pow(T,4.) - pow(Ta,4.)))*C_UDMI(c,t,3)*factor;      dS[eqn] = 0.0;    }    else if(C_T(c,sec_th) >= 3090)    {      source = (((2*A*P)/(Pi*R*R))*exp((-2*(pow(x[0]-x0-v*time,2.) + pow(x[1]-y0,2.)))/(R*R)) - h*(T-Ta) - s*e*(pow(T,4.) - pow(Ta,4.)) - Lv*mv)*C_UDMI(c,t,3)*factor;      dS[eqn] = 0.0;    }  }  else  {    source = 0.0;    dS[eqn] = 0.0;  }  return source;}Â
ÂÂ
Â
-
July 29, 2024 at 1:07 pmRobForum Moderator
If you set material properties in the UDF as fixed values the code may use those if you tell it to. Or you can use the cell values which may make more sense.Â
Looking at the code, it is a source term UDF. So, assuming you've hooked up the source term into the fluid volume, have you met the criteria for a heat source or is source=0 ?
-
July 30, 2024 at 2:30 pmKanak BUET19Bbp_participant
- "Or you can use the cell values which may make more sense. "Â ------------ Can you tell me how exactly can I define in fluent to use the values within the code (and NOT the material data under the materials section? )Â
- I am sorry I did not comprehend the question "have you met the criteria for a heat source or is source=0?" properly. I added this source term in the x-momentum source in cell zone boundary condtion. But I am not sure if this is correct , hear source ( whether they are surface or volumetric) should be inside ENERGY source right?Â
I will really appreciate your suggestions on this problems sir . Thank youÂ
-
July 30, 2024 at 2:37 pmRobForum Moderator
If you check the various examples you'll see Fluent has macros to call cell data, eg https://ansyshelp.ansys.com/account/Secured?returnurl=/Views/Secured/corp/v242/en/flu_udf/flu_udf_DataAccessMacros.html Â
You may have added the momentum source, but have the criterion of C_VOF and C_T been met to give a non zero value of source (heat_source)?Â
-
- You must be logged in to reply to this topic.
-
416
-
187
-
167
-
156
-
140
© 2024 Copyright ANSYS, Inc. All rights reserved.