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

How to calculate cell Temperature gradient using Ansys Fluent UDF ?

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 23, 2024, 03:59
Default How to calculate cell Temperature gradient using Ansys Fluent UDF ?
  #1
New Member
 
Rakibul Islam Kanak
Join Date: Feb 2024
Posts: 5
Rep Power: 2
kanak_BUET_ME19 is on a distinguished road
Hello, I am working on Selective Laser Melting CFD simulation using ansys fluent. And to apply the Marangoni effect (equation photo added below) , I need to calculate Cell temperature gradient.

According to fluent UDF manual , I can access Cell Temperature Gradient using C_T_G(c,t)[0] (for x axis gradient)

But whenever I mention the term C_T_G(c,t) inside udf, after running the simulation Fluent crashes instantly saying "bad termination" ( I will add the error log as a doc link)

My UDF code for the Marangoni part is like this :



DEFINE_SOURCE(x_mom, c, t, dS, eqn)
{
Thread *g, *w ;
g = THREAD_SUB_THREAD(t, 0);
w = THREAD_SUB_THREAD(t, 1);
real source = 0 ;
real recoil_pressure = 0;
real marangoni_flow = 0 ;
real D;
real T = C_T(c,t);
real temp_g_x = C_T_G(c,t)[0] ;
real temp_g_y = C_T_G(c,t)[1] ;
real temp_g_z = C_T_G(c,t)[2] ;

D = (2 * C_R(c,t) / (C_R(c,g) + C_R(c,w))) ;
if (C_VMAG(c,t) != 0)
{
if (T > boiling_temp)
{
recoil_pressure = 0.54 * 101000.0 * exp((latent_vap * molar_mass * (T - boiling_temp)) / (8.314 * T * boiling_temp)) * C_VOF_NX(c, t);
}
if (C_LIQUID_FRAC(c, t) > 0)
{
marangoni_flow = temp_surface_tension * (temp_g_x - (C_VOF_NX(c, t) * ND_DOT(C_VOF_NX(c, t), C_VOF_NY(c, t), C_VOF_NZ(c, t), temp_g_x, temp_g_y, temp_g_z)));
}

}
source = (recoil_pressure + marangoni_flow) * C_VMAG(c, t) * D;
dS[eqn] = 0 ;
return source;
}


Any suggestion what could possibly went wrong ? Thanks!

Attached Images
File Type: jpg error log.jpg (52.8 KB, 11 views)
File Type: jpg marangoni_code.jpg (37.4 KB, 8 views)
kanak_BUET_ME19 is offline   Reply With Quote

Old   December 9, 2024, 22:32
Default
  #2
New Member
 
Join Date: Dec 2024
Posts: 1
Rep Power: 0
San_tu_1 is on a distinguished road
hope it's not too late to answer

Hey friend, I'm glad we're doing the same thing.
I mean they are all doing LPBF numerical simulations with Fluent.
I have encountered your console error code in my previous work.
I did not encounter this error after reducing the number of CPU cores (i.e. CPU count<maximum CPU) in the startup interface of Fluent.

You can try adding the following command to the console interface regarding your issue with C_T-G (c, t)

/solve/set/expert
Save cell residuals for post-processing? [no]
Keep temporary solver memory from being freed? [no] yes
Allow selection of all applicable discretization schemes? [no]

Friendly reminder:
If your surface tension varies with temperature, there is no need to add additional Marangoni force, as the solver will include additional shear stress (Marangoni convection) caused by changes in the surface tension coefficient

I'm sorry, my English learning is very poor. Most of the content above is machine translated. If there are any expression problems, I hope you can understand
San_tu_1 is offline   Reply With Quote

Reply


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


Similar Threads
Thread Thread Starter Forum Replies Last Post
[ANSYS Meshing] negative cell volume detected while running ANSYS Fluent UDF khushbu.bhavsar92 ANSYS Meshing & Geometry 6 April 14, 2016 16:50
specified shear at wall - temperature gradient - UDF - access violation error senD Fluent UDF and Scheme Programming 9 September 18, 2014 08:29
FLUENT to ANSYS Temperature Mapping Procedure schreiberc1 FLUENT 0 June 29, 2006 14:50
[Commercial meshers] Trimmed cell and embedded refinement mesh conversion issues michele OpenFOAM Meshing & Mesh Conversion 2 July 15, 2005 05:15
Warning 097- AB Siemens 6 November 15, 2004 05:41


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