|
[Sponsors] |
June 21, 2019, 00:19 |
Fluent udf on mass transfer
|
#1 |
New Member
AKHIL KUMAR
Join Date: Jan 2019
Posts: 13
Rep Power: 7 |
hi,i am currently working on a project based on mass diffusion from o2 to water based on ficks law via solving transport equations.my udf is shown below,its compiling well,but during running its showing segmentation fault.
/* UDF to define Mass transfer */ #include "udf.h" #include "para.h" #include "math.h" #include "stdio.h" #include "prf.h" #include "mem.h" /********************************************/ /*USER INPUTS*/ double C_sat=8e-3,D=62.24e-8,maxmesh=3.2e-4; /******************************************/ /*GLOBAL VARIABLES THROUGH UDF*/ /*calculation of discretization length based on void fraction and normal*/ extern double GetVolumenSchwerpunkt(double Volumen,double Normale[3]); /************************************************** *********/ /*Determination of dispersed phase area*/ DEFINE_ADJUST(store_gradient, domain) { Thread *t; Thread **pt; cell_t c; int phase_domain_index = 0.; Domain *pDomain = DOMAIN_SUB_DOMAIN(domain,phase_domain_index); { Alloc_Storage_Vars(pDomain,SV_VOF_RG,SV_VOF_G,SV_N ULL); 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)=NV_MAG(C_VOF_G(c,ppt)); C_UDMI(c,t,1)=C_VOF_G(c,ppt)[0]; C_UDMI(c,t,2)=C_VOF_G(c,ppt)[1]; } end_c_loop (c,t) } Free_Storage_Vars(pDomain,SV_VOF_RG,SV_VOF_G,SV_NU LL); } /************************************************** *******************/ \ /*Calculation of dispersed concentration in continuous phase*/ DEFINE_ADJUST(max_C_liq,domain) { Thread *t; Thread **pt; cell_t c; real C_liq,C_liq_pt; real m_f,m_f_c,m_f_t,m_f_t_C; int phase_domain_index=1.;/*1 mixture*/ Domain *pDomain=DOMAIN_SUB_DOMAIN(domain,phase_domain_ind ex); mp_thread_loop_c(t,domain,pt) if (FLUID_THREAD_P(t)) { Thread *ppt=pt[phase_domain_index]; begin_c_loop(c,t) { /*m_f=species mass fraction of dispersed phase at actual time*/ m_f=C_YI(c,ppt,0); C_UDMI(c,t,3)=m_f; if (C_VOF(c,ppt) !=0) m_f=C_YI(c,ppt,0); else m_f=0; C_UDMI(c,t,4)=m_f*1205/18; /*concentration kg/m3*/ m_f_c=m_f*1205/18; /*concentration kg/m3*/ C_UDMI(c,t,5)=m_f_c; /*concentration kg/m3*/ if (m_f_c>=C_sat) m_f_c=C_sat; else m_f_c=m_f_c; C_UDMI(c,t,6)=m_f_c;/*concentration kg/m3*/ if (C_VOF(c,ppt) !=0) C_liq=m_f_c;/*C_liq is the concentration of o2 in the liquid phase at actual time*/ else C_liq=0; C_UDMI(c,t,7)=C_liq; /*C_liq kg/m3 the value of c in liquid at t*/ C_UDMI(c,t,8)=C_liq/18;/*C_liq kmol/m3 the value of c in liquid at t*/ } end_c_loop (c,t) } } /************************************************** *********/ /*Mass transfer from dispersed phase to continuous phase*/ DEFINE_MASS_TRANSFER(mstr_d_erg,cell,thread,from_i ndex,from_species_index,to_index,to_species_index) { cell_t c; Thread *t; Thread *gas=THREAD_SUB_THREAD(t,from_index); Thread *liq=THREAD_SUB_THREAD(t,to_index); double m_lq=0.0; double volume_liquid=0.; double Nx; double Ny; double Erg=0.0; double Erg1=0.0; double Normale[3]; double Volumen; volume_liquid=C_VOLUME(c,t)*C_VOF(cell,liq); C_UDMI(c,t,9)=volume_liquid; Nx=C_UDMI(c,t,1); Ny=C_UDMI(c,t,2); Normale[0]=Nx; Normale[1]=Ny; Volumen=C_VOF(cell,liq); C_UDMI(c,t,10)=Volumen; if (C_VOF(c,liq) !=0) { Erg=fabs(maxmesh*((1-C_UDMI(c,t,10)/2))); } else Erg=0.0; C_UDMI(c,t,11)=Erg; if (C_VOF(c,liq)>0.05&&Erg>(maxmesh*1e-3)&&C_sat>C_UDMI(c,t,8)) m_lq=C_UDMI(c,t,0)*(D/Erg)*(C_sat-C_UDMI(c,t,8)); else m_lq=0; C_UDMI(c,t,12)=m_lq; return m_lq; } could anyone help me to find the error. |
|
June 24, 2019, 04:45 |
|
#2 |
New Member
AKHIL KUMAR
Join Date: Jan 2019
Posts: 13
Rep Power: 7 |
yes ,i want to simulate mass transfer from gas to liquid
|
|
February 14, 2021, 10:54 |
Have you found Solution
|
#3 |
New Member
Muhammad Ahmed
Join Date: Nov 2020
Posts: 1
Rep Power: 0 |
Can you put comments in this udf, so its easy for newbies to understand this udf . Thanks Hope for soon reply
|
|
May 4, 2022, 12:34 |
|
#4 |
New Member
Narasimha Reddy
Join Date: Jun 2019
Posts: 3
Rep Power: 7 |
Hello akhil, did you able to solve the issue?
|
|
Tags |
ansys, fluent, fluent udf, udf |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Accessing phase interaction mass transfer rate in UDF | ahmadimo | Fluent UDF and Scheme Programming | 1 | October 6, 2021 23:08 |
UDF for mass and heat source with heat transfer | rajendra1 | Fluent UDF and Scheme Programming | 35 | October 13, 2017 04:04 |
Mass Transfer UDF using Fluent VOF | Anirudh_Deodhar | Fluent UDF and Scheme Programming | 3 | November 18, 2015 09:29 |
The fluent stopped and errors with "Emergency: received SIGHUP signal" | yuyuxuan | FLUENT | 0 | December 3, 2013 22:56 |
Help,I have some questions about UDF of mass diffusivity in fluent | apolloking | Fluent UDF and Scheme Programming | 0 | March 20, 2011 11:40 |