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

UDF-Calculation regression rate_DEFINE_ADJUST error

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 9, 2024, 23:50
Default UDF-Calculation regression rate_DEFINE_ADJUST error
  #1
New Member
 
EunChong Kim
Join Date: Jan 2024
Posts: 2
Rep Power: 0
SilverGun is on a distinguished road
Hello! I am currently trying to simulate the pyrolysis of solid fuel using UDF. The surface of the solid fuel is set as a wall, and the regression rate is calculated in the cell zone right above it. Afterward, the corresponding species is injected through the source term based on the regression rate.

When I initialize and press Calculate with the code below, the following error occurs.

Process 35236: received signal sigsegv

Could you suggest any solutions or provide your opinion on how to resolve this issue?




real calculate_regression_rate(cell_t c, Thread* t) {
real Ts = C_T(c, t); // Temperature of the cell
real Cp = C_CP(c, t); // Specific heat of the cell
real k = C_K_L(c, t); // Thermal conductivity of the cell
real grad_T = C_T_G(c, t)[1]; // Temperature gradient of the cell[y]
real Q_conv = -k * grad_T; // Convective heat flux

real Hv, Told_s, Tnew_s, error, rdot;
int iter;

Told_s = Ts;
iter = 0;
error = 1.0;

while (error > TOL && iter < MAX_ITER) { // Iterative loop
Hv = Delta_H_f - Delta_H_H + Cp * (Told_s - Tref); // Calculate Hv
rdot = Q_conv / (Hv + rho); // Calculate rdot
Tnew_s = Ea / (Ru * (log(A) - log(rdot))); // Calculate Tnew_s
error = fabs(Tnew_s - Told_s); // Calculate error
Told_s = Tnew_s; // Update Told_s
iter++; // Increase iteration count
}

Ts = Tnew_s + 0.1 * (Tnew_s - Ts); // Update Ts
rdot = Q_conv / (Hv + rho); // Final rdot calculation
return rdot; // Return rdot
}

// Calculate and store regression rate for all cells
DEFINE_ADJUST(store_regression_rate, domain) {
Thread* t;
cell_t c;
real rdot;
int cell_zone_id = 6; // Specific cell zone ID

t = Lookup_Thread(domain, cell_zone_id); // Find the specific cell zone

begin_c_loop(c, t) { // Loop through all cells in the cell zone
rdot = calculate_regression_rate(c, t); // Calculate regression rate
C_UDMI(c, t, 0) = rdot; // Store regression rate in UDM
}
end_c_loop(c, t);
}
SilverGun is offline   Reply With Quote

Reply

Tags
define_adjust, define_source udf, 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
Gmsh reports an OpenCascade exception when opening a .geo file algc Main CFD Forum 2 October 24, 2022 06:59
[OpenFOAM.org] compile error in dynamicMesh and thermophysicalModels libraries NickG OpenFOAM Installation 3 December 30, 2019 01:21
long error when using make-install SU2_AD. tomp1993 SU2 Installation 3 March 17, 2018 07:25
Mesquite - Adaptive mesh refinement / coarsening? philippose OpenFOAM Running, Solving & CFD 94 January 27, 2016 10:40
Installation OF1.5-dev ttdtud OpenFOAM Installation 46 May 5, 2009 03:32


All times are GMT -4. The time now is 21:52.