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

Population Balance Modeling (PBM) - Ansys Fluent

Register Blogs Community New Posts Updated Threads Search

Like Tree33Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 4, 2018, 12:21
Default
  #141
New Member
 
nilesh
Join Date: Jan 2017
Posts: 22
Rep Power: 9
nhendre is on a distinguished road
Quote:
Originally Posted by masoud.ravan View Post
as shaham said, I think the problem is here:
f_1 = C_PB_DISCI(cell, thread, 1);
f_2 = C_PB_DISCI(cell, thread_2, 2);
...
first, you have to find d_1 (or d_2) belongs to which bin fraction, then use it for the third argument of C_PB_DISCI.

Let us know the results
I got to know one thing regarding aggregation kernel. We have to pass aggregation kernel to fluent. The collision frequency is calculated as
w = pi/4*(d_1+d_2)^2*n_i*n_j*u_ij
In fluent, the coalescence rate is given as, product of aggregation kernal and product of number densities of two colliding bubbles. So, we just need to pass on collision frequency mentioned above as
w = pi/4*(d_1+d_2)^2*u_ij
i.e. by eliminating n_i*n_j
Please check if I am correct.
Tran Van Bay likes this.
nhendre is offline   Reply With Quote

Old   May 12, 2019, 02:14
Default
  #142
New Member
 
Dhiraj Lote
Join Date: Jul 2015
Location: Mumbai, India
Posts: 20
Rep Power: 11
dhiraj.lote@gmail.com is on a distinguished road
Hello,
Can you please help me, how to reconstruct bubble size distribution from QMOM. I read in litereture, but I dont find any clue how to predict bubble size distribution from QMOM or SMOM.


Thanks
dhiraj.lote@gmail.com is offline   Reply With Quote

Old   May 12, 2019, 02:16
Default Population balance modelling with QMOM
  #143
New Member
 
Dhiraj Lote
Join Date: Jul 2015
Location: Mumbai, India
Posts: 20
Rep Power: 11
dhiraj.lote@gmail.com is on a distinguished road
Quote:
Originally Posted by chittipo View Post
Dear Members,

If you have any specific questions on PBM implementation please post here. I will try to answer them, as I gained some experience in it.

on
- Existing module (or)
- Implementation through UDF



Hello,
Can you please help me, how to reconstruct bubble size distribution from QMOM. I read in litereture, but I dont find any clue how to predict bubble size distribution from QMOM or SMOM.


Thanks
dhiraj.lote@gmail.com is offline   Reply With Quote

Old   May 13, 2019, 00:47
Default
  #144
New Member
 
Dhiraj Lote
Join Date: Jul 2015
Location: Mumbai, India
Posts: 20
Rep Power: 11
dhiraj.lote@gmail.com is on a distinguished road
Quote:
Originally Posted by chittipo View Post
Dear Members,

If you have any specific questions on PBM implementation please post here. I will try to answer them, as I gained some experience in it.

on
- Existing module (or)
- Implementation through UDF
Hello,
Do you know how to reconstruct bubble size distribution from QMOM
dhiraj.lote@gmail.com is offline   Reply With Quote

Old   July 9, 2019, 09:56
Default
  #145
New Member
 
Dhiraj Lote
Join Date: Jul 2015
Location: Mumbai, India
Posts: 20
Rep Power: 11
dhiraj.lote@gmail.com is on a distinguished road
Quote:
Originally Posted by furqanrk View Post
Thank you very much sir..





Did you solved the problem
dhiraj.lote@gmail.com is offline   Reply With Quote

Old   July 9, 2019, 09:58
Default Divergence detected in AMG solver
  #146
New Member
 
Dhiraj Lote
Join Date: Jul 2015
Location: Mumbai, India
Posts: 20
Rep Power: 11
dhiraj.lote@gmail.com is on a distinguished road
Hello, I have written UDF for Wang aggregation Kernel in fluent. Udf is as follows
/************************************************** **********************
UDF that computes the particle aggregation rate
************************************************** ***********************/
#include "udf.h"
#include "sg_pb.h"
#include "sg_mphase.h"
DEFINE_PB_COALESCENCE_RATE(aggregation_kernel_Wang ,cell,thread,d_1,thread_2,d_2)
{
real agg_kernel, epsi, w_ag, p_ag, A, B, C, void_s, void_max = 0.6;
real rho_c = 998.2, sig = 0.072, C1=1.1107, mu_c = 0.001003, u_crit = 0.08;
/*calculating void fraction of secondary phase*/
void_s = C_VOF(cell, thread);
/*Thread *tm = THREAD_SUPER_THREAD(thread);*/
/*passed thread is phase*/
/*epsi = C_D(cell, tm);*/
/*calculation of aggregation freaquency of collision*/
A = exp(-pow((pow(void_max, 1/3)/pow(void_s, 1/3))-1,2));
B = 1-(exp(pow(void_max,1/3.)*pow(void_s, 1/3)*3/(pow(void_max, 1/3)-pow(void_s, 1/3))));
w_ag = C1*A*B*pow(epsi, 1/3)*(d_1+d_2)*(d_1+d_2)*pow(pow(d_1, (2/3))+pow(d_2, (2/3)), 0.5);
/*probability of aggregation*/
C = 1.4142*pow(epsi, 1/3)*pow(pow(d_1, (2/3))+pow(d_2, (2/3)), 0.5);
p_ag = MIN((u_crit/C),1);
/*compute agregation kernel*/
agg_kernel = (w_ag)*(p_ag);
return agg_kernel;
}
When i interpret it in fluent it shows no error and it get interpret well. But when I start the simulation it shows following messase and run could not start. the message is as follows.
# Divergence detected in AMG solver: bin-0-fraction -> Increasing relaxation sweeps!
# You may try the enhanced divergence recovery with (rpsetvar 'amg/protective-enhanced? #t)
Divergence detected in AMG solver: bin-0-fraction
Divergence detected in AMG solver: bin-1-fraction
Divergence detected in AMG solver: bin-2-fraction
Divergence detected in AMG solver: bin-3-fraction
Divergence detected in AMG solver: bin-4-fraction
Divergence detected in AMG solver: bin-5-fraction
Divergence detected in AMG solver: bin-6-fraction
Divergence detected in AMG solver: bin-7-fraction
Divergence detected in AMG solver: bin-8-fraction
Divergence detected in AMG solver: bin-9-fraction
Divergence detected in AMG solver: bin-10-fraction
Divergence detected in AMG solver: bin-11-fraction
Divergence detected in AMG solver: bin-12-fraction
Error at host: floating point exception
Error at Node 0: floating point exception
Error at Node 1: floating point exception
Error at Node 2: floating point exception
Error at Node 3: floating point exception
Error at Node 4: floating point exception
Error at Node 5: floating point exception
Error: floating point exception
Error Object: #f
any suggestion or comment is highly appreciated.
dhiraj.lote@gmail.com is offline   Reply With Quote

Old   April 11, 2020, 14:31
Default
  #147
New Member
 
John E
Join Date: Jan 2016
Posts: 25
Rep Power: 10
JohnE is on a distinguished road
Hi,
Do you have any tutorial about crystallization process?
Thank you~
JohnE is offline   Reply With Quote

Old   April 11, 2020, 16:03
Default
  #148
Member
 
George Corner
Join Date: Dec 2016
Posts: 30
Rep Power: 9
sam_cfdd is on a distinguished road
Quote:
Originally Posted by JohnE View Post
Hi,
Do you have any tutorial about crystallization process?
Thank you~
Hi,

Can you please check the Ansys portal. But in ansys population balance theory guide, at the end of theory guide, there is one UDF showing how to write UDF related to crystallization. Maybe you find example in Ansys customer portal.
sam_cfdd is offline   Reply With Quote

Old   April 11, 2020, 20:26
Default
  #149
New Member
 
John E
Join Date: Jan 2016
Posts: 25
Rep Power: 10
JohnE is on a distinguished road
Quote:
Originally Posted by sam_cfdd View Post
Hi,

Can you please check the Ansys portal. But in ansys population balance theory guide, at the end of theory guide, there is one UDF showing how to write UDF related to crystallization. Maybe you find example in Ansys customer portal.
thanks for reply.
Of course, I'm following the PBM guide now. But I have confused that how to set up the species transport condition?
JohnE is offline   Reply With Quote

Old   April 12, 2020, 03:35
Default
  #150
Member
 
George Corner
Join Date: Dec 2016
Posts: 30
Rep Power: 9
sam_cfdd is on a distinguished road
Quote:
Originally Posted by JohnE View Post
thanks for reply.
Of course, I'm following the PBM guide now. But I have confused that how to set up the species transport condition?
I download from Ansys customer portal the example with solution for crystallization. I couldn't be attached hereby. Maybe you email me on e.zhaleh@gmail.com, then I share with you the files. If you have a access to Ansys customer portal, you can find yourself. just type crystallization in the keyword.
sam_cfdd is offline   Reply With Quote

Old   April 12, 2020, 09:31
Default
  #151
New Member
 
John E
Join Date: Jan 2016
Posts: 25
Rep Power: 10
JohnE is on a distinguished road
Quote:
Originally Posted by sam_cfdd View Post
I download from Ansys customer portal the example with solution for crystallization. I couldn't be attached hereby. Maybe you email me on e.zhaleh@gmail.com, then I share with you the files. If you have a access to Ansys customer portal, you can find yourself. just type crystallization in the keyword.
I couldn't log in ansys customer portal now due to COVID-19 quarantine policy in my area. I have emailed you and thank you for sharing the crystallization files. Appreciate that!
JohnE is offline   Reply With Quote

Old   October 22, 2020, 08:37
Default
  #152
New Member
 
Lamp
Join Date: Sep 2020
Posts: 11
Rep Power: 5
lampfall90@icloud.com is on a distinguished road
Quote:
Originally Posted by obscureed View Post
Hi All,

I think Shaham has pointed out something important: the UDF is intended to return the value of the kernel (which is effectively a rate constant), not the aggregation rate. (This is fairly clear in the documentation, and you have to ignore the fact that the UDF type's name ends in "_RATE".)

So, you do not need the factor of "*n1*n2". You do not need to look up which intervals d_1 and d_2 fall into. In fact, your UDF should not need to know anything about the size intervals -- it is defining the size behaviour of the aggregation phenomenon. You definitely should not need to hard-code the bin sizes into your UDF (either by a fixed array "double dbin[11]={..." or nested inside lots of "if" statements) -- this would be difficult to maintain.

OK, this structure makes some assumptions about the nature of the aggregation phenomenon -- for example, it assumes that there are no effects that are second-order in concentration, etc. Within those assumptions, this is a much cleaner way to define the UDF interface.

By the way, for the sake of my sanity, please do not use two different approximations to pi -- you should find that M_PI will work (without the need for any extra #include statements).

I have to admit that I once tried to reconstruct the fine detail of how Fluent's discrete-PB model treats size distributions: exactly what mean size is used inside each interval? does it assume constant length-based number density, or constant volume-based number density, or some other approximation of the distribution inside each interval? These are very small details, but I wanted to get them right. I did not finish this in the time available. If you make any solid conclusions about what Fluent is doing under the hood, please post them here.

Good luck!
Ed
Hello my Dears,
I am new in PBM coupling method , I would like to use this model to simulate my axial flow pump operating in two phase gas-liquid:

1) How can I know the bin that my inlet bubble diameter falls and is there any UDF which can predict the bin of my bubbles size ?

2) I have alpha1,2,3,4,5 and 6 volume fraction how can I implement the volume fraction in my inlet boundary conditions?
3)because the fraction of water, should the sum of all the bin fraction should be equal to 1?
4) should my outlet have same bin as the inlet with same volume fraction?
5) how can I calculate the totale bubbles ?
lampfall90@icloud.com is offline   Reply With Quote

Old   October 22, 2020, 09:14
Default
  #153
New Member
 
Lamp
Join Date: Sep 2020
Posts: 11
Rep Power: 5
lampfall90@icloud.com is on a distinguished road
Quote:
Originally Posted by furqanrk View Post
Respected experts,

When applying Discrete*Population Balance Model in ANSYS Fluent we have to put predefine boundary conditions values. For Example,

phase.. Air.. Bins...7 Ratio Exponent...1.7 Minimum Dia...0.05cm then in boundary conditions... Velocity Inlet...Boundary Values*for setting*are..

Bin-0-fraction________ * Constant

Bin-1-fraction_________ Constant

Bin-2-fraction_________Constant

Bin-3-fraction_________Constant

Bin-4-fraction_________Constant

Bin-5-fraction_________Constant

Bin-6-fraction_________Constant

How to set these values to get appropriate gas distribution ?

How to set boundary condition values in Fluent Population Balance model ? - ResearchGate. Available from: https://www.researchgate.net/post/Ho..._Balance_model [accessed Mar 15, 2016].

Hello my Dears,
I am new in PBM coupling method , I would like to use this model to simulate my axial flow pump operating in two phase gas-liquid:

1) How can I know the bin that my inlet bubble diameter falls and is there any UDF which can predict the bin of my bubbles size ?

2) I have alpha1,2,3,4,5 and 6 volume fraction how can I implement the volume fraction in my inlet boundary conditions?
3)because the fraction of water, should the sum of all the bin fraction should be equal to 1?
4) should my outlet have same bin as the inlet with same volume fraction?
5) how can I calculate the totale bubbles ?
lampfall90@icloud.com is offline   Reply With Quote

Old   November 15, 2020, 08:09
Default
  #154
New Member
 
Simar Sethi
Join Date: Jun 2020
Posts: 5
Rep Power: 6
alpha2rock is on a distinguished road
Quote:
Originally Posted by ashar_md2001 View Post
Hi,
The main purpose of this simulation is to study the Particle Size Distribution (PSD) of BaSO4 precipitate using Population balance modelling coupled with CFD, where we have two reactants (BaCl2 and Na2SO4) fed into the reactor which has two inlets forming the product BaSO4 crystals in the reactor after both the reactants mix. The reaction is as follows
BaCl2 (liq phase) + Na2SO4 (Liq phase)-----> BaSO4 (precipitate)
Here I defined both the reactants (BaCl2 and Na2SO4) as primary phases and BaSO4 as secondary phase.
Both the reactants were defined with water liquid properties except their mol.wt (BaCl2=208.23 and Na2SO4=142) from the literature. Then the BaSO4 was defined with density of solid crystals and its mol.wt.
Initially I obtained flow field without species transport model. Then I activated the multiphase Eulerian model the activated the Population balance model, here for now I am using the QMOM method.
In the inlet Boundary conditions for both reactants which are fed in separate inlets the mass fraction is defined. For secondary phase the inlets volume fraction is defined as zero as they are not the reactants. Then I define the outlet boundary conditions for secondary phase as one. In the Phase interaction Reactions panel I defined two rectatnts and 1 product and the reaction rate function as population balance variable.
Until now i have done these steps.
Is these steps right? because I am not able to solve or obtain any solution for secondary phase as the residuals show zero for the secondary phase and the moments are all zero. should I define any value for Moments? as I defined zero. And also I am getting divergence if I try to do these steps
here I am using the calculated values for nucleation and growth without using UDF, do you recommend UDF to define the nucleation and growth values.

Your help, feedback and guidance will be highly appreciated. thanks in advance

Sorry I know that my questions is very long
Quote:
Originally Posted by moomsan View Post
Hy mohamad ashar what did you do for simulation, i simulate the crystalization in fluent i do this steps like you but the residual always is zero i don what I do.
Quote:
Originally Posted by botiszilagyi View Post
Hi,

I am working on a similar problem, the difference is that I am modeling the calcium phosphate precipitation obtained from the reaction of calcium nitrate and diammonium phosphate and I have a similar problem. I would like to ask if you have succeeded to resolve this issue?

Thanks,
Botond
@Asar @moomsan @Botond. It's been a long time but could any of you solve the issue back then? I am facing the exact same problem for multiphase BaSO4 precipitation reaction using QMOM.
Please help
alpha2rock is offline   Reply With Quote

Old   June 14, 2021, 07:18
Smile vof-PBM
  #155
New Member
 
zahra asgari
Join Date: Jun 2021
Posts: 1
Rep Power: 0
zahra asgari is on a distinguished road
Quote:
Originally Posted by chittipo View Post
Dear Members,

If you have any specific questions on PBM implementation please post here. I will try to answer them, as I gained some experience in it.

on
- Existing module (or)
- Implementation through UDF
hi
can't we use VOF model and PBM model at the same time? if we can, could you explain how I can active PBM with VOF in fluent?
:)
thank you for your attention.
zahra asgari is offline   Reply With Quote

Old   June 14, 2021, 08:14
Default
  #156
New Member
 
Lamp
Join Date: Sep 2020
Posts: 11
Rep Power: 5
lampfall90@icloud.com is on a distinguished road
Quote:
Originally Posted by zahra asgari View Post
hi
can't we use VOF model and PBM model at the same time? if we can, could you explain how I can active PBM with VOF in fluent?

thank you for your attention.
Hi, yes for sure go to: the console and you type : define hit enter , model hit enter and add hit enter again , when you scroll down you will 5 which corresponds to pbm then you enter 5 and hit enter .( define >>model>>add>>5)
lampfall90@icloud.com is offline   Reply With Quote

Old   March 21, 2022, 16:51
Default Homogenous nucleation of n-butanol with helium carrier gas
  #157
New Member
 
Wee Piin Huah
Join Date: Mar 2022
Posts: 2
Rep Power: 0
edypw1 is on a distinguished road
I am simulating the nucleation of n-butanol using multiphase eulerian in laminar flow. As for the population balance model, I have activated the nucleation feature and input my UDF (kindly refer to my UDF below).

The experiment is a 2D counter-flow setup where there are two jet inlets, hot and cold. The hot inlet consists of hot saturated n-butanol+helium vapour whereas the cold inlet consists of cold helium vapour. The fluids from both inlets will collide at the stagnation plane (at the centre) and nucleation will occur (saturation ratio>1).

However, from my results in Fluent, I simulated that nucleation occurs at the walls of the hot inlet jet and not at the stagnation plane. This is not ideal, and I have no idea why this phenomenon happens. Please help.

An IMG of my setup in details and the contours of the nucleation in the form of number density in one of the "bin" size is attached below. *Kindly refer*


#include "udf.h"
#include "sg_pb.h"
#include "sg_mphase.h"

# define PI 3.14159265
# define K 1.38064852e-23 /* Boltzmann constant */
# define butane_mol_wt 0.07412 /* n-butanol molecular weight */
# define helium_mol_wt 0.004003 /* helium molecular weight */
# define ro_gas 0.179 /* helium gas density */

DEFINE_PB_NUCLEATION_RATE(nuc_rate, cell, thread)
{
real J; /* nucleation */
real T, butane_mol_frac, butane_mass_frac, helium_mass_frac, sigma, ro_liquid, vap_press, sat, d, v, m, r, ar, v_c, m_c, delta_G, scc, jbd;

Thread *tc = THREAD_SUPER_THREAD(thread); /* obtain mixture thread */
Thread **pt = THREAD_SUB_THREADS(tc); /* pointer to sub_threads */
Thread *tp = pt[S_PHASE]; /* secondary phase thread */

T = C_T(cell,tp); /* Temperature of second phase in Kelvin */

butane_mol_frac = C_VOF(cell,tp); /* mole fraction of n-butanol vapor in primary phase (helium) */

butane_mass_frac = (butane_mol_frac*butane_mol_wt)/((butane_mol_frac*butane_mol_wt)+((1-butane_mol_frac)/helium_mol_wt));
helium_mass_frac = 1.0 - butane_mass_frac;

sigma = (4.833e-2)-((8.181e-5)*T); /*surface tension */
ro_liquid = 990.9563548-(0.524148*T)-(0.00032*pow(T,2.0)); /* density of n-butanol liquid */
vap_press = exp(98.494-(9412.6064/T)-(10.54*(double)log((double)T))); /* equilibrium vapor pressure */
sat = (butane_mol_frac/vap_press)*101325.0; /* supersaturation */
d = (sigma*m)/(ro_liquid*K*T*((double)log((double)sat))); /* diameter of critical cluster */
v = (4.0/3.0)*PI*(pow(d/2,3.0)); /* volume of a single particle with size 1 nm */
m = (ro_liquid)*v; /* mass of one n-butanol molecule*/
r = d/2.0; /*radius of critical cluster */
ar = 4.0*PI*(pow(r,2.0)); /* surface area */
v_c = (4.0/3.0)*PI*(pow(r,3.0)); /* volume of critical cluster */
m_c = (ro_liquid)*(v_c); /* mass of critical cluster */
delta_G = ((4.0*PI)/3.0)*(pow(r,2.0))*sigma; /* free energy formation of critical cluster */
scc = (1.0/sat)*(exp((ar*sigma)/(K*T)));
jbd = ((pow((ro_gas*butane_mass_frac),2.0))/(ro_liquid*butane_mol_wt))*(pow(((2.0*sigma)/(PI*butane_mol_wt)),0.5))*(exp(-delta_G/(K*T)))*(pow((m_c/butane_mol_wt),(2.0/3.0)));

if (sat<=1.0)
{
J = 0.;
}
else
{
J = scc*jbd;
}
return J;
}

Attached IMG: https://ibb.co/F4ZTQvk
edypw1 is offline   Reply With Quote

Old   March 23, 2022, 10:24
Default
  #158
Senior Member
 
Join Date: Sep 2017
Posts: 246
Rep Power: 11
obscureed is on a distinguished road
Hi edypw1,

Running CFD calculations is a really time-consuming way to debug your function for nucleation rate, and it needs debugging. You need to be confident that each line gives a sensible answer for the entire range of input parameters. (For full resilience, you could make your functions give sensible answers even if called with input parameters way outside the sensible range. I have occasionally seen Fluent UDFs called with temperature = 0.0 kelvin, in a weird pre-initialisation state.)

You might find it easier to debug the functions in a spreadsheet, but after that it would also be good to run the exact code that you intend to run in your UDF -- for example, to eliminate errors copying from the spreadsheet to C. Or maybe not the exact code, but near enough -- to run the UDF code as standalone C, you need to change "real" to "double" etc. Currently, your function does not give sensible answers -- see the example standalone C code below.

Good luck!
Ed

Code:
#include <stdio.h>
#include <stdlib.h>
#include <math.h>

# define PI 3.14159265
# define K 1.38064852e-23 /* Boltzmann constant */
# define butane_mol_wt 0.07412 /* n-butanol molecular weight */
# define helium_mol_wt 0.004003 /* helium molecular weight */
# define ro_gas 0.179 /* helium gas density */

  double
nuc_rate(double butane_mol_frac, double T)
{
  double J; /* nucleation */
  double butane_mass_frac, helium_mass_frac, sigma, ro_liquid, vap_press, sat, d, v, m, r, ar, v_c, m_c, delta_G, scc, jbd;

  butane_mass_frac = (butane_mol_frac*butane_mol_wt)/((butane_mol_frac*butane_mol_wt)+((1-butane_mol_frac)/helium_mol_wt));
  helium_mass_frac = 1.0 - butane_mass_frac;

  sigma = (4.833e-2)-((8.181e-5)*T); /*surface tension */
  ro_liquid = 990.9563548-(0.524148*T)-(0.00032*pow(T,2.0)); /* density of n-butanol liquid */
  vap_press = exp(98.494-(9412.6064/T)-(10.54*(double)log((double)T))); /* equilibrium vapor pressure */
  sat = (butane_mol_frac/vap_press)*101325.0; /* supersaturation */
  d = (sigma*m)/(ro_liquid*K*T*((double)log((double)sat))); /* diameter of critical cluster */
  v = (4.0/3.0)*PI*(pow(d/2,3.0)); /* volume of a single particle with size 1 nm */
  m = (ro_liquid)*v; /* mass of one n-butanol molecule*/
  r = d/2.0; /*radius of critical cluster */
  ar = 4.0*PI*(pow(r,2.0)); /* surface area */
  v_c = (4.0/3.0)*PI*(pow(r,3.0)); /* volume of critical cluster */
  m_c = (ro_liquid)*(v_c); /* mass of critical cluster */
  delta_G = ((4.0*PI)/3.0)*(pow(r,2.0))*sigma; /* free energy formation of critical cluster */
  scc = (1.0/sat)*(exp((ar*sigma)/(K*T)));
  jbd = ((pow((ro_gas*butane_mass_frac),2.0))/(ro_liquid*butane_mol_wt))*(pow(((2.0*sigma)/(PI*butane_mol_wt)),0.5))*(exp(-delta_G/(K*T)))*(pow((m_c/butane_mol_wt),(2.0/3.0)));

  if (sat<=1.0)
  {
    J = 0.;
  }
  else
  {
    J = scc*jbd;
  }
  return J;
}

  int
main(int argc, char*argv[])
{
  double Tmin,Tmax,deltaT,T,J;
  double butane_mol_frac;

  Tmin = 275;
  Tmax = 450;
  deltaT = 25;

  butane_mol_frac = atof(argv[1]);
  printf("butane_mol_frac = %12.6f\n",butane_mol_frac);

  T = Tmin;
  while(T <= Tmax){
    J = nuc_rate(butane_mol_frac,T);
    printf("T = %12.6g  J = %12.6g\n",T,J);
    T = T + deltaT;
  }
  exit(EXIT_SUCCESS);
}
To run this standalone C code, save it as testJ_0001.c, compile it with

Code:
gcc testJ_0001.c -o testJ_0001.exe
and run it with
Code:
./testJ_0001.exe 0.01
(or some sensible input value of butane_mol_frac). (I'm assuming you have a Linux-style command window and gcc installed.)

Or, much much better, compile it with strict warning messages:

Code:
gcc testJ_0001.c -o testJ_0001.exe -Wall -Wextra -pedantic -std=c99
This will tell you that "'m' is used uninitialized". This is true: your formula for d involves m, and your formula for v involves d, and your formula for m involves v. Reordering the lines does not help. Something is wrong in your formulas, and you could run CFD for a long time without finding this.


One last point, that actually is UDF-related: It is interesting that you look up temperature from the secondary phase. This will work for some models (obviously, where temperature is different for the phases), but not others. As usual, it is worth checking that a simple line such as "T = C_T(cell,tp);" produces sensible results. Yet again, running the whole CFD simulation is a crude way to check.
obscureed is offline   Reply With Quote

Old   November 8, 2022, 11:24
Default Population Balance Model
  #159
New Member
 
Jann Unkhoff
Join Date: Nov 2022
Posts: 3
Rep Power: 3
Jann U is on a distinguished road
Hello everybody!


In the Users Guide it is stated that the DEFINE macros of the Population Balance model are executed at the beginning of every time step.


1. Does that mean that the Population Balance Model or at least the UDFs are not suitable for steady state?


2. I'd also love to know whether the PBE is calculated along the transport equations or at a different location in the algorithm?


Any help would be much appreciated!
Jann U is offline   Reply With Quote

Old   November 8, 2022, 11:36
Default Hooking UDF PBM
  #160
New Member
 
Jann Unkhoff
Join Date: Nov 2022
Posts: 3
Rep Power: 3
Jann U is on a distinguished road
Hi!


I started experimenting with UDFs for the PBM and immediately ran into problems:


I compiled the following UDF (no error was thrown)




DEFINE_PB_NUCLEATION_RATE(nucrate, cell, thread){

real J = 1.0e7;

return J;
}


However when I select the UDF for the nucleation rate in the PBM dialogue box and press Apply the UDF is deselected and simply the previous constant value is displayed.


Has anybody experienced anything similar?


Any help would be much appreciated?
Jann U is offline   Reply With Quote

Reply


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
Modeling porous media with FLUENT newcomer FLUENT 4 September 26, 2013 00:08
Loading of Temperature datas from ansys to fluent! need help!! tensun FLUENT 0 November 6, 2010 00:35
Import Soliworks geometry to Ansys Fluent 12.0 nunolopes FLUENT 0 October 7, 2010 11:24
FSI, Fluent Ansys coupling Greg Carnie FLUENT 5 January 7, 2010 19:15
Population Balance Theory student Main CFD Forum 2 August 10, 2008 04:12


All times are GMT -4. The time now is 15:41.