CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > General Forums > Main CFD Forum

Error on kla calculation using UDF

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 4, 2024, 16:19
Question Error on kla calculation using UDF
  #1
New Member
 
Join Date: Jul 2024
Posts: 2
Rep Power: 0
Yingshi is on a distinguished road
Hello,

I want to calculate gas mass transfer coefficient kla by using the following UDF:

#include "udf.h"

/* Define constants */
#define D 2.5e-9 /* mass diffusivity (m^2/s) */
#define rho_l 1000.0 /* density of liquid (kg/m^3) */
#define mu_l 0.001 /* viscosity of liquid (Pa.s) */
#define alpha_air_phase 3
#define water_phase 2

/* Define UDF to calculate oxygen mass transfer coefficient kla */
DEFINE_ON_DEMAND(calc_kla)
{
Domain *domain = Get_Domain(1);
Thread *cthread;
cell_t c;

/* Loop over all cells in the domain */
thread_loop_c(cthread, domain)
{
if (FLUID_THREAD_P(cthread)) /* Check if the thread is a fluid thread */
{

Thread **pt = THREAD_SUB_THREADS(cthread);
Thread *primary_phase_thread = pt[water_phase - 1]; /* Water */
Thread *secondary_phase_thread = pt[alpha_air_phase - 1]; /* Air */

/* Loop over all cells in the fluid thread */
begin_c_loop_all(c, cthread)
{
real alpha_air = C_VOF(c, secondary_phase_thread); /* Volume fraction of air */
real epsilon = C_D(c, cthread); /* Turbulence dissipation rate */
real d_b = C_PHASE_DIAMETER(c, secondary_phase_thread); /* Bubble diameter */

/* Calculate k_L using the Lamont and Scott model */
real kl = 0.4 * pow(D, 0.25) * pow(epsilon, 0.25) * pow(rho_l / mu_l, 0.25);

/* Calculate 'a' */
real a = 6.0 * alpha_air / d_b;

/* Calculate kla */
real kla = kl * a;

/* Store kla in a user-defined memory location */
C_UDMI(c, cthread, 0) = kla;
}
end_c_loop_all(c, cthread)
}
}
}


The UDF was successfully compiled and loaded. However, after I finished the calculation and went to contours > contours of user defined memory > user memory 0, the max and min boxes were grayed out.

Also, when I tried to execute on demand, I received: Node 0: Process 19108 has received the signal SIGSEGV. The fluent (f1) process encountered an error: the connection was reset.

How can I resolve this issue? Thanks in advance!
Yingshi is offline   Reply With Quote

Old   July 4, 2024, 16:26
Default
  #2
New Member
 
Join Date: Jul 2024
Posts: 2
Rep Power: 0
Yingshi is on a distinguished road
This is the log file:

My ansys fluent shut down every time when I want to excecute a UDF on deman. This is the log file: Node 0 Fatal signal raised sig = Segmentation fault
6457e430 CX_Primitive_Error
ae33b9d0 log2f
645f2fe0 logical_right_shift
a83be530 _C_specific_handler
b1054f20 _chkstk
b0fcddd0 RtlFindCharInUnicodeString
b1054010 KiUserExceptionDispatcher
8c690000 Ordinal0
61e8c170 fluent_fprintf
645dcf80 eval
61f44870 PRF_Command_Start
61f46fa0 PRF_Node_repl
61f52db0 Delay_Error
645f2fe0 logical_right_shift
b0872560 BaseThreadInitThunk
b100af00 RtlUserThreadStart

Error [node 0] [time 7/4/24 21:15:2] Abnormal Exit!
Yingshi is offline   Reply With Quote

Reply

Tags
mass transfer coefficient, multiphase flows, udf


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
A UDF to stop an unsteady run calculation based on the pressure in the fluent smh7 CFD Freelancers 3 January 2, 2024 06:14
UDF program for pressure calculation in a pipe Vighnesh sny Main CFD Forum 0 July 24, 2019 07:13
extract calculation result from udf anubhavd Fluent UDF and Scheme Programming 4 March 30, 2016 08:08
WILLING TO PAY/ FREELANCER REQUIRED / small UDF coding force loads over body / 6DOF acasas CFD Freelancers 1 January 23, 2015 08:26
UDF for VR Rate calculation ADI FLUENT 3 June 23, 2014 18:31


All times are GMT -4. The time now is 12:22.