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

not working DEFINE_DPM_SOURCE

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 6, 2020, 06:53
Default not working DEFINE_DPM_SOURCE
  #1
New Member
 
Monza e Brianza
Join Date: Nov 2020
Posts: 8
Rep Power: 5
loren is on a distinguished road
Hi! I need your help, please
I want to model CO2 gas bubble dissolution in water. The VOF model is on to study the water-air inface; bubbles are modeled with dpm inert type particle; water is a mixture of water and dissolved CO2. To compute gas dissolution from the bubble and to add the dissolved gas to the mixture, I'm using DEEFINE_DPM_SOURCE macro. The source term so defined: S->species [co2_index] +=mp_dot;
I can compile and load the UDF but when I run calculations the following message appears:

DPM Iteration ....

================================================== ============================

Node 1: Process 3188: Received signal SIGSEGV.

================================================== ============================
The fl process could not be started.

Here is my UDF:

#include "dpm.h"
#include "dpm_types.h"
#include "dpm_laws.h"
#include "udf.h"

DEFINE_DPM_SOURCE(dissolution, c, t, S, strenght, tp)
{

real temp, P, Dco2, Sc, d, ki, kh, Ci, Cinf, massrate,mp_dot, Re, rel_vel;
int co2_index = 0;
temp = 288;
d = TP_DIAM(tp);
P = C_P(c, t);
rel_vel = sqrt(pow((TP_VEL(tp)[0] - C_U(c,t)),2.0) + pow((TP_VEL(tp)[1] - C_V(c,t)), 2.0) + pow((TP_VEL(tp)[2] - C_W(c,t)), 2.0));
Re = TP_RHO(tp) * rel_vel * d/0.001003;
Dco2 = (1.38*pow(10.0,-23.0)*temp)/(6.0*M_PI*0.001003*pow(10.0,-10.0));
Sc=0.001003/(TP_RHO(tp)*Dco2);
if (d<0.0035)
{
ki=(2+0.6*pow(Re,1./2.)*pow(Sc,1./3.))*Dco2/d;
}
if(d<=0.0045 && d>0.0035)
{
ki=0.2838*d-0.0009121;
}
if (d>=0.0035){
ki=2/pow(M_PI, 1./2.)*pow(Re*Sc,1./2.)*Dco2/d;
}
kh=44*1000/101325*pow(2.7183,2119.05/temp-17.4141);
Ci=P*kh;
Cinf=C_YI(c, t, co2_index);
massrate=M_PI*d*d*ki*(Ci-Cinf);
mp_dot=massrate*TP_DT(tp)*strenght;
S->species[co2_index] += mp_dot;
}
loren is offline   Reply With Quote

Old   November 8, 2020, 04:17
Default
  #2
New Member
 
Monza e Brianza
Join Date: Nov 2020
Posts: 8
Rep Power: 5
loren is on a distinguished road
Help me please, it's for my thesis and I'm stuck on this UDF...
loren is offline   Reply With Quote

Old   November 8, 2020, 07:57
Default
  #3
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26
pakk will become famous soon enough
Simplify your UDF in small steps until the error disappears. Find which part is the problem.

1.38*pow(10.0,-23.0) = 1.38e-23
0.001003*pow(10.0,-10.0) = 0.001003e-10
pow(2.7183,2119.05/temp-17.4141) = exp(2119.05/temp-17.4141)

1000/101325 will become zero, be careful!
pakk is offline   Reply With Quote

Old   November 8, 2020, 09:02
Default
  #4
New Member
 
Monza e Brianza
Join Date: Nov 2020
Posts: 8
Rep Power: 5
loren is on a distinguished road
Thankyou Pakk, I will try
loren is offline   Reply With Quote

Old   November 9, 2020, 09:23
Default
  #5
New Member
 
Monza e Brianza
Join Date: Nov 2020
Posts: 8
Rep Power: 5
loren is on a distinguished road
Ok I think that I found the problem. If I don't use "Cinf=C_YI(c, t, co2_index);" and I use "Cinf=0;" Fluent doesn't crash, and gives some reasonable results.

Anyway the reason why I'm using TP_DT(tp) is because the mass rate is in kg/s and at each time step I'm computing the mass added to the continuous phase. I assume that the UDF is solved at each time step, so the mass rate computed in the time step is multiplied by the time step extension, is it correct?

Despite I get some results I see a particle diameter and mass reduction lower than expected and I don't understand why.

Here is the code:



#include "dpm.h"

#include "dpm_types.h"

#include "dpm_laws.h"

#include "udf.h"



DEFINE_DPM_SOURCE(dissolution, c, t, S, strenght, tp)

{



real temp, P, Dco2, Sc, d, ki, kh, Csol, Cinf, massrate,mp_dot, Re, rel_vel;

temp = 288;

d = TP_DIAM(tp);

P = C_P(c, t);

rel_vel = sqrt(pow((TP_VEL(tp)[0] - C_U(c,t)),2.0) + pow((TP_VEL(tp)[1] - C_V(c,t)), 2.0) + pow((TP_VEL(tp)[2] - C_W(c,t)), 2.0));

Re = (TP_RHO(tp) * rel_vel * d)/0.001003;

Dco2 = (1.38e-23*temp)/(1.8868e-12);

Sc=0.001003/(TP_RHO(tp)*Dco2);

if (d<0.0035)

{

ki=(2+0.6*pow(Re,1./2.)*pow(Sc,1./3.))*Dco2/d;

}

if(d<=0.0045 && d>0.0035)

{

ki=0.2838*d-0.0009121;

}

if (d>=0.0035){

ki=2/pow(3.14, 1./2.)*pow(Re*Sc,1./2.)*Dco2/d;

}

kh=(0.4342)*exp(2119.05/temp-17.4141);

Csol=P*kh;

Cinf=0;

massrate=3.14*d*d*ki*(Csol-Cinf);

TP_MASS(tp) = TP_MASS(tp) - massrate * TP_DT(tp);

mp_dot=massrate*TP_DT(tp)*strenght;

S->species[0] += mp_dot;

}
loren is offline   Reply With Quote

Reply

Tags
define_dpm_source, dpm, gas dissolution, multiphase, 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
Porous media coefficients and working fluid Dronzer FLUENT 1 June 30, 2020 22:23
findCell() in parallel: not working if location is outside the domain TobiWol OpenFOAM 0 January 10, 2018 14:33
Processor 0 not working vishwesh OpenFOAM Running, Solving & CFD 0 November 17, 2017 03:35
DPM parallel is not working but serial is working johnwinter FLUENT 1 March 27, 2012 02:01
Error: Unable to retrieve mon from working directo Atit Koonsrisuk CFX 6 February 20, 2004 05:07


All times are GMT -4. The time now is 04:40.