|
[Sponsors] |
DEFINE_PROFILE ---- SIGSEGV error - Multiphase |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
October 19, 2020, 13:14 |
DEFINE_PROFILE ---- SIGSEGV error - Multiphase
|
#1 | ||
Member
ssa
Join Date: Sep 2018
Posts: 93
Rep Power: 8 |
Hi all,
I am new to UDF programming and I am doing a UDF for heat transfer coefficient in multiphase simulation. The code compiles good, but produces a SIGSEGV error on execution. Code:
#include "udf.h" DEFINE_PROFILE(heat_gas_wall,t,i) { Message0("TEst 00000000000"); /*face thread*/ Thread *ti = THREAD_SUB_THREAD(t,0); Thread *tj = THREAD_SUB_THREAD(t,1); /*cell thread*/ Thread *tci = THREAD_T0(ti); Thread *tcj = THREAD_T0(tj); cell_t c; face_t f; Message0("TEst 0"); real v_x=0., v_y=0., v_z=0.; real vel; v_x = C_U(c,tcj) - C_U(c,tci); v_y = C_V(c,tcj) - C_V(c,tci); v_z = C_W(c,tcj) - C_W(c,tci); vel = sqrt(v_x*v_x + v_y*v_y + v_z*v_z); /*NV_DD(v,=,C_U(c,tcj),C_V(c,tcj),C_W(c,tcj),-,C_U(c,tci),C_V(c,tci),C_W(c,tci)); vel = NV_MAG(v);*/ real beta = 90; real D=1; /*dia of kiln*/ Message0("TEst 0.5"); real De = 0.5*D*(2*M_PI-beta+sin(beta*M_PI/180))/(M_PI-beta/2-sin((beta*M_PI/180)/2)); Message0("TEst 0.6"); real Re = RE_NUMBER(C_R(c,tci),vel,De,C_MU_L(c,tci)); Message0("TEst 0.7"); real kg = 1; /*C_K_L(c,tci);*/ real omega=0.1; Message0("TEst 1"); /*real xc = 0.01*0.1;*/ /*particle dia * experiment constant*/ /*real kb=C_K_L(c,tcj);*/ /*thermal conductivity of bed*/ Message0("TEst 2"); real pb=1; /*C_R(c,tcj);*/ /*density of bed*/ Message0("TEst 3"); /*real cp=C_CP(c,tcj);*/ /*heat capacity of bed*/ real Rew = pow(De,2)*omega*pb/C_MU_L(c,tci); Message0("TEst 4"); FILE *fp, *val; fp = fopen("htc_gas_wall.txt","a+"); val = fopen("htc_val.txt","a+"); begin_f_loop(f,t) { fprintf(val, "%f,%f,%f,%f\n", Re, Rew,kg,De); fprintf(fp, "%f\n", 1.54*pow(Re,0.575)*pow(Rew,-0.292)*kg/De); /*F_PROFILE(f,ti,i) = 1.54*pow(Re,0.575)*pow(Rew,-0.292)*kg/De; */ /*F_PROFILE(f,tj,i) = pow(xc/kg+pow(2*sqrt(kb*pb*cp/(M_PI*tc)),-1),-1); */ } end_f_loop(f,t) Message0("TEst 5"); fclose(val); fclose(fp); } htc_gas_wall.txt Quote:
Quote:
How to solve this error.? Thanks, Senthil. |
|||
October 19, 2020, 16:19 |
|
#2 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
You tell Fluent that c is a Cell, but you don't say which cell. And then you ask fluent to use the velocity on that unspecified cell. That gives problems.
It looks like you want to use the flow in the cell closest to the wall to calculate the Reynolds number, as input for the heat transfer. I forgot the physical equations, but is this what you need? I would find one of two things more logical : take the overall Reynolds number (with average velocity) or take the velocity at the wall (if you have wall slip). So I can see in which lines your code breaks, but I don't know how to fix it because I don't know which equations you are trying to implement. |
|
October 20, 2020, 04:31 |
|
#3 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
in addition to Pakk,
you should put the "computation" part of your code inside the loop of face and define adjusted cell of each face, using F_C0 macro (and you are using thread_t0, which is thread of adjusted to face cell) if you run in parallel, be careful with writing to file part. You should write to file from host read ansys fluent customization manual for details
__________________
best regards ****************************** press LIKE if this message was helpful |
|
October 20, 2020, 10:25 |
|
#4 |
Member
ssa
Join Date: Sep 2018
Posts: 93
Rep Power: 8 |
Thanks for your comments.
My problem is I am modelling a heat transfer coefficients for multiphase h(gas-wall) and h(solid-wall). So I choose DEFINE_PROFILE and wanted to add both coefficients in the same UDF. Because, I am able to select only one UDF in the boundary conditions. Simplified equations for heat transfer coefficients are h(gas-wall) = 1.54*Re*k/D and h(solid-wall) = D/k + [2 * sqrt(k * rho * cp / pi)]^(-1) So I got the sub threads from the mixture thread. Get the values from the adjacent cell and calculate the heat transfer coefficient. Because the velocity at the wall is zero. After your comments., I simplified the code and executed. When I execute with just mixture level threads, the UDF is working and when I use the sub_threads for the phase, It produces SIGSEGV error. Simplified UDF: Code:
#include "udf.h" DEFINE_PROFILE(heat_test,t,i) { face_t f; Thread *ti = THREAD_SUB_THREAD(t,0); Thread *tj = THREAD_SUB_THREAD(t,1); Thread *tci = THREAD_T0(ti); Thread *tcj = THREAD_T0(tj); cell_t c = F_C0(f,t); real D = 1; real beta = 90; real v_x=0., v_y=0., v_z=0.; real vel; v_x = F_U(f,t); v_y = F_V(f,t); v_z = F_W(f,t); vel = sqrt(v_x*v_x + v_y*v_y + v_z*v_z); real De = 0.5*D*(2*M_PI-beta+sin(beta*M_PI/180))/(M_PI-beta/2-sin((beta*M_PI/180)/2)); real Re = vel; begin_f_loop(f,t) { F_PROFILE(f,t,i) = 1.54*Re/De; } end_f_loop(f,t) } Thanks, Senthil. |
|
October 20, 2020, 10:50 |
|
#5 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
In this code, you use f before you tell fluent which face it is.
Put your begin_f_loop earlier in your code, before you use f for the first time. |
|
October 20, 2020, 12:05 |
|
#6 |
Member
ssa
Join Date: Sep 2018
Posts: 93
Rep Power: 8 |
Code:
#include "udf.h" DEFINE_PROFILE(heat_test,t,i) { face_t f; Thread *ti = THREAD_SUB_THREAD(t,0); real D = 1; real beta = 90; real v_x=0., v_y=0., v_z=0.; real vel; real De = 0.5*D*(2*M_PI-beta+sin(beta*M_PI/180))/(M_PI-beta/2-sin((beta*M_PI/180)/2)); begin_f_loop(f,t) { v_x = F_U(f,ti); v_y = F_V(f,ti); v_z = F_W(f,ti); vel = sqrt(v_x*v_x + v_y*v_y + v_z*v_z); real Re = vel; F_PROFILE(f,t,i) = 1.54*Re/De; } end_f_loop(f,t) } But the same SIGSEGV error on execution with F_U(f,ti) and works fine with F_U(f,t). Thanks, Senthil. |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Node 0: Process 15088: Received signal SIGSEGV. | hasib61 | FLUENT | 7 | September 4, 2022 02:25 |
SIGSEGV Memory Access Exeption when Exporting Files using 'Update' | JamesPermain | STAR-CCM+ | 0 | April 22, 2020 11:50 |
Process 10300: Received signal SIGSEGV | metaliat93 | FLUENT | 2 | January 28, 2020 01:53 |
error: Received signal SIGSEGV | ianziti92 | Fluent UDF and Scheme Programming | 2 | December 5, 2018 17:25 |
define_wall_functions density and dynamic viscosity | Ionut G | Fluent UDF and Scheme Programming | 3 | March 15, 2017 11:10 |