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

Fluent udf on mass transfer

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 21, 2019, 01:19
Exclamation Fluent udf on mass transfer
  #1
New Member
 
AKHIL KUMAR
Join Date: Jan 2019
Posts: 13
Rep Power: 7
AKHIL123 is on a distinguished road
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.
AKHIL123 is offline   Reply With Quote

Old   June 24, 2019, 05:45
Default
  #2
New Member
 
AKHIL KUMAR
Join Date: Jan 2019
Posts: 13
Rep Power: 7
AKHIL123 is on a distinguished road
yes ,i want to simulate mass transfer from gas to liquid
AKHIL123 is offline   Reply With Quote

Old   February 14, 2021, 11:54
Default Have you found Solution
  #3
New Member
 
Muhammad Ahmed
Join Date: Nov 2020
Posts: 1
Rep Power: 0
Smai is on a distinguished road
Can you put comments in this udf, so its easy for newbies to understand this udf . Thanks Hope for soon reply
Smai is offline   Reply With Quote

Old   May 4, 2022, 13:34
Default
  #4
New Member
 
Narasimha Reddy
Join Date: Jun 2019
Posts: 3
Rep Power: 7
snr1 is on a distinguished road
Hello akhil, did you able to solve the issue?
snr1 is offline   Reply With Quote

Reply

Tags
ansys, fluent, fluent 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
Accessing phase interaction mass transfer rate in UDF ahmadimo Fluent UDF and Scheme Programming 1 October 7, 2021 00:08
UDF for mass and heat source with heat transfer rajendra1 Fluent UDF and Scheme Programming 35 October 13, 2017 05:04
Mass Transfer UDF using Fluent VOF Anirudh_Deodhar Fluent UDF and Scheme Programming 3 November 18, 2015 10:29
The fluent stopped and errors with "Emergency: received SIGHUP signal" yuyuxuan FLUENT 0 December 3, 2013 23:56
Help,I have some questions about UDF of mass diffusivity in fluent apolloking Fluent UDF and Scheme Programming 0 March 20, 2011 12:40


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