MoDeNa  1.0
Software framework facilitating sequential multi-scale modelling
partialPressure.h
Go to the documentation of this file.
1 
29 void ddtpartialPressure(const state_type &y , const double t , const double dt , double *dpdt , double *pOld, const double p_1, const double p_2, const double R);
30 bool isNaN(double var);
31 double bubbleRadius (const double m0, const double m1);
32 double nodeRadius(const double &v);
33 double partialPressureBA(const state_type &y);
34 double partialPressureCO2(const state_type &y);
35 
36 void ddtpartialPressure(const state_type &y , const double t , const double dt , double *dpdt , double *pOld, const double p_1, const double p_2, const double R)
37 {
38  // dp1dt:
39  dpdt[0] = (p_1 - pOld[0])/(dt);
40  pOld[0] = p_1;
41 
42  // dp2dt:
43  dpdt[1] = (p_2 - pOld[1])/(dt);
44  pOld[1] = p_2;
45 }
46 bool isNaN(double var)
47 {
48  volatile double d = var;
49  return d != d;
50 }
51 double bubbleRadius (const double m0, const double m1)
52 {
53  double R;
54  R = pow((3.0*m1/(4.0*M_PI*m0)), 1.0/3.0);
55  if (isNaN(R)) {
56  R=init_size;
57  }
58  return R;
59 }
60 
61 double nodeRadius(const double &v)
62 {
63  return (pow((6.0*v/M_PI),1.0/3)/2.0);
64 }
65 double partialPressureBA(const state_type &y)
66 {
67  double L_g = y[4];
68  double CO2_g = y[6];
69  double m0 = y[7];
70  double m1 = y[8];
71  // double PENTANE = y[15];
72  // double CO2 = y[14];
73 
74  double R = bubbleRadius(m0, m1);
75 
76  double p_1;
77  if (L_g == 0.0)
78  {
79  p_1 = 0.0;
80  }
81  else
82  {
83  p_1 = ((L_g/M_B)/(L_g/M_B + CO2_g/M_CO2 + air_g/M_air)) * (Pr + 2*surfaceTension/R);
84  }
85 
86  return p_1;
87 }
88 
89 double partialPressureCO2(const state_type &y)
90 {
91  double L_g = y[4];
92  double CO2_g = y[6];
93  double m0 = y[7];
94  double m1 = y[8];
95  // double PENTANE = y[15];
96  // double CO2 = y[14];
97 
98  double R = bubbleRadius(m0, m1);
99 
100  double p_2;
101 
102  if (CO2_g == 0.0)
103  {
104  p_2 = 0.0;
105  }
106  else
107  {
108  p_2 = ((CO2_g/M_CO2)/(L_g/M_B + CO2_g/M_CO2 + air_g/M_air)) * (Pr + 2*surfaceTension/R);
109  }
110 
111  return p_2;
112 }
double dt
time step, s
real(dp), dimension(:), allocatable y
state variables
Definition: globals.f90:106
double partialPressureCO2(const state_type &y)
partial pressure of CO2
double surfaceTension
required for the computation of partial pressure
double M_CO2
Molecular mass of carbon dioxide, kg/kmol.
bool isNaN(double var)
checks if the passed argument is not a number
Definition: bubbleRadius.h:23
double init_size
initial mean bubble diameter, m
double Pr
initial/final pressure of the mixture, Pa
double dpdt[2]
This is used to compute the partial pressures.
double bubbleRadius(const double m0, const double m1)
radius of bubbles based on the moments
Definition: bubbleRadius.h:28
double air_g
air weight fraction
real(dp), dimension(:), allocatable d
diffusion coefficients (for each dissolved gas)
Definition: globals.f90:106
double nodeRadius(const double &v)
radius of bubbles at each node
Definition: bubbleRadius.h:38
double M_B
Molecular mass of blowing agent, kg/kmol.
double partialPressureBA(const state_type &y)
partial pressure of the physical blowing agent
double M_air
Molecular weight of air, kg/kmol.
double pOld[2]
This is to hold the old pressure values during the partial pressure calculations. ...
void ddtpartialPressure(const state_type &y, const double t, const double dt, double *dpdt, double *pOld, const double p_1, const double p_2, const double R)
time derivative of partial pressure