-
-
August 25, 2021 at 5:57 pm
Dubey92
SubscriberI am modeling laser melting in FLUENT using solidification/melting and VOF. There are a number of particles over a solid substrate and there is an inert gas atmosphere above them. Now, the laser energy is a surface heat source. I need to convert it into volumetric heat source and then apply it into the interfacial cells between the metal particles and the gas. I need 2 things for this:
- Gradient of volume fraction of a phase in a cell(C_VOF_G) to convert the surface source to volumetric source. I understand that FLUENT does not have a macro for gradient of volume fraction. How to get the gradient of volume fraction?
- When the laser will melt the particle, volume fraction in the cells will change and hence the interface. How to track this interface using a UDF so that laser is applied on the interfacial cells?
Till now I have been using the following code and it compiles without any error, When I give an inlet velocity for the gas domain and an outlet, the simulation runs although the results are not correct. When I make the gas domain stationary , the simulation completes without anything happening. Any help is much appreciated.
Thank you
DEFINE_ADJUST(adjust_gradient_heat, 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));    // magnitude of gradient of volume fraction                                Â
C_UDMI(c,t,4) = C_UDMI(c,t,0)/C_UDMI(c,t,3);Â Â Â Â Â Â Â Â // nx -> x gradient of volume fraction divided by magnitude of gradient of volume fraction
C_UDMI(c,t,5) = C_UDMI(c,t,1)/C_UDMI(c,t,3);Â Â Â Â Â Â Â Â // ny -> y gradient of volume fraction divided by magnitude of gradient of volume fractionÂ
C_UDMI(c,t,6) = C_UDMI(c,t,2)/C_UDMI(c,t,3);       // nz -> z gradient of volume fraction divided by magnitude of gradient of volume fraction                                            Â
}
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)Â Â Â Â Â Â // The name of the UDF is heat_source
{
Thread *pri_th;
Thread *sec_th;
real source;
real x[ND_ND], time;Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â // Define face centroid vector, time
time = RP_Get_Real("flow-time");Â Â Â Â Â Â Â Â Â Â Â Â Â // Acquire time from Fluent solver
C_CENTROID(x, c, t);Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â // Acquire the cell centroid location
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);Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â // cell volume fraction
real gamma;
if (T>293.0 && T<1658.0)
{
gamma = 0;
}
else if (T>=1658.0 && T<=1723.0)
{
gamma = (T-Ts)/(Tl-Ts);
}
else if (T>1723.0)
{
gamma = 1;
}
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 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 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);
real r = sqrt(pow(x[0]-x0-v*time,2.0) + pow(x[1]-y0,2.0));
if(C_VOF(c,sec_th)>0.05 && C_VOF(c,sec_th)<1)
{
if(C_T(c,t) < 3090)
{
source = (((2*A*P)/(Pi*R*R))*exp((-2*(r*r))/(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,t) >= 3090)
{
source = (((2*A*P)/(Pi*R*R))*exp((-2*(r*r))/(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;
}
August 26, 2021 at 8:25 amAmine Ben Hadj Ali
Ansys EmployeeFluent calculates the gradients and once they are not required anymore they are reset and so on. You can keep memory from being freed : that is the official way to access gradients.
Laser Energy Source should be applied at the interface so in partial filled cells (Simple IF Condition).
August 26, 2021 at 11:39 amDubey92
SubscriberThanks for your suggestion. Till now, I have been using the following condition for applying the laser source in the interfacial cells:
Thread *pri_th;
Thread *sec_th;
pri_th = THREAD_SUB_THREAD(t, 0);
sec_th = THREAD_SUB_THREAD(t, 1);
if(C_VOF(c,sec_th)>0.05 && C_VOF(c,sec_th)<1)
But I am not sure if it is right. Then I read in a paper that the way to track the interfacial cells is to compare the coordinates of centroid of cells. If a cell has all the secondary phase and the above cell has volume fraction in between then I can use that z coordinate to apply laser source. Can you please tell which approach is correct? And should I use the above condition inside DEFINE_SOURCE or DEFINE_ADJUST?
August 26, 2021 at 11:46 amDubey92
SubscriberAs for the volume fraction gradients, which macro can I use to access gradient of volume fraction in my UDF as I understand that FLUENT does not have any macro C_VOF_G for accessing volume fraction gradient directly?
Viewing 3 reply threads- The topic ‘Interface tracking between 2 phases in VOF’ is closed to new replies.
Ansys Innovation SpaceTrending discussions- air flow in and out of computer case
- Varying Bond model parameters to mimic soil particle cohesion/stiction
- Eroded Mass due to Erosion of Soil Particles by Fluids
- I am doing a corona simulation. But particles are not spreading.
- Guidance needed for Conjugate Heat Transfer Analysis for a 3s3p Li-ion Battery
- Centrifugal Fan Analysis for Determination of Characteristic Curve
- Issue to compile a UDF in ANSYS Fluent
- JACOBI Convergence Issue in ANSYS AQWA
- affinity not set
- Resuming SAG Mill Simulation with New Particle Batch in Rocky
Top Contributors-
3932
-
1414
-
1272
-
1119
-
1015
Top Rated Tags© 2025 Copyright ANSYS, Inc. All rights reserved.
Ansys does not support the usage of unauthorized Ansys software. Please visit www.ansys.com to obtain an official distribution.
-

Ansys Assistant

Welcome to Ansys Assistant!
An AI-based virtual assistant for active Ansys Academic Customers. Please login using your university issued email address.

Hey there, you are quite inquisitive! You have hit your hourly question limit. Please retry after '10' minutes. For questions, please reach out to ansyslearn@ansys.com.
RETRY