MoDeNa  1.0
Software framework facilitating sequential multi-scale modelling
readParameters.h
Go to the documentation of this file.
1 
6 #include <rapidjson/document.h>
7 #include <rapidjson/filereadstream.h>
8 #include "rapidjson/writer.h"
9 #include "rapidjson/stringbuffer.h"
10 void readParams();
11 void readParams() {
12  FILE * pFile = fopen ("../inputs/unifiedInput.json" , "r");
13  char buffer[65536];
14  rapidjson::FileReadStream is(pFile, buffer, sizeof(buffer));
15  rapidjson::Document document;
16  document.ParseStream<0, rapidjson::UTF8<>, rapidjson::FileReadStream>(is);
17 
18  Pr=document["physicalProperties"]["pressure"].GetDouble();
19  Temp0=document["initialConditions"]["temperature"].GetDouble();
20  if (document["kinetics"]["kineticModel"].GetString()==std::string("Baser")) {
21  kinMod=1;
22  } else if (document["kinetics"]["kineticModel"].GetString()==std::string("BaserRx")) {
23  kinMod=2;
24  } else if (document["kinetics"]["kineticModel"].GetString()==std::string("RF-1")) {
25  kinMod=3;
26  } else {
27  std::cout << "kinetic model unknown in QmomKinetics" << std::endl;
28  exit(0);
29  }
30  X_gel=document["kinetics"]["gelPoint"].GetDouble();
31  if (kinMod==1 || kinMod==2) {
32  A_OH=document["kinetics"]["gellingReaction"]["frequentialFactor"].GetDouble();
33  E_OH=document["kinetics"]["gellingReaction"]["activationEnergy"].GetDouble();
34  A_W=document["kinetics"]["blowingReaction"]["frequentialFactor"].GetDouble();
35  E_W=document["kinetics"]["blowingReaction"]["activationEnergy"].GetDouble();
36  OH_0=document["initialConditions"]["concentrations"]["polyol"].GetDouble();
37  NCO_0=document["initialConditions"]["concentrations"]["isocyanate"].GetDouble();
38  if (document["kinetics"]["useDilution"].GetBool()){
39  dilution=1;
40  } else {
41  dilution=0;
42  }
43  } else if (kinMod==3) {
44  catalyst=document["initialConditions"]["concentrations"]["catalyst"].GetDouble();
45  polyol1_ini=document["initialConditions"]["concentrations"]["polyol1"].GetDouble();
46  polyol2_ini=document["initialConditions"]["concentrations"]["polyol2"].GetDouble();
47  amine_ini=document["initialConditions"]["concentrations"]["amine"].GetDouble();
48  isocyanate1_ini=document["initialConditions"]["concentrations"]["isocyanate1"].GetDouble();
49  isocyanate2_ini=document["initialConditions"]["concentrations"]["isocyanate2"].GetDouble();
50  isocyanate3_ini=document["initialConditions"]["concentrations"]["isocyanate3"].GetDouble();
52  }
53  W_0=document["initialConditions"]["concentrations"]["water"].GetDouble();
54  rhoBL=document["physicalProperties"]["blowingAgents"]["PBL"]["density"].GetDouble();
55  DH_OH=document["kinetics"]["gellingReaction"]["reactionEnthalpy"].GetDouble();
56  DH_W=document["kinetics"]["blowingReaction"]["reactionEnthalpy"].GetDouble();
57  C_Poly=document["physicalProperties"]["polymer"]["heatCapacity"].GetDouble();
58  C_CO2=document["physicalProperties"]["blowingAgents"]["CO2"]["heatCapacityInLiquidPhase"].GetDouble();
59  C_BG=document["physicalProperties"]["blowingAgents"]["PBL"]["heatCapacityInGaseousPhase"].GetDouble();
60  C_BL=document["physicalProperties"]["blowingAgents"]["PBL"]["heatCapacityInLiquidPhase"].GetDouble();
61  lambda=document["physicalProperties"]["blowingAgents"]["PBL"]["evaporationHeat"].GetDouble();
62  if (document["physicalBlowingAgent"].GetString()==std::string("n-pentane")) {
63  phBL=1;
64  } else if (document["physicalBlowingAgent"].GetString()==std::string("R11")) {
65  phBL=2;
66  } else {
67  std::cout << "unknown blowing agent (solubility)" << std::endl;
68  exit(0);
69  }
70  if (document["physicalProperties"]["polymer"]["polymerDensityModel"].GetString()==std::string("nanotools")) {
71  denMod=1;
72  } else if (document["physicalProperties"]["polymer"]["polymerDensityModel"].GetString()==std::string("constant")) {
73  denMod=2;
74  rhoPoly=document["physicalProperties"]["polymer"]["density"].GetDouble();
75  } else if (document["physicalProperties"]["polymer"]["polymerDensityModel"].GetString()==std::string("pcsaft")) {
76  denMod=3;
77  }
78  M_CO2=document["physicalProperties"]["blowingAgents"]["CO2"]["molarMass"].GetDouble()*1e3;
79  M_B=document["physicalProperties"]["blowingAgents"]["PBL"]["molarMass"].GetDouble()*1e3;
80  M_NCO=document["physicalProperties"]["polymer"]["molarMassNCO"].GetDouble()*1e3;
81  M_air=document["physicalProperties"]["air"]["molarMass"].GetDouble()*1e3;
82  double cb=document["initialConditions"]["concentrations"]["blowingAgents"]["PBL"].GetDouble();
83  L0=cb*M_B/rhoPoly/1000.0;
84  double cc=document["initialConditions"]["concentrations"]["blowingAgents"]["CO2"].GetDouble();
85  CO2_0=cc*M_CO2/rhoPoly/1000.0;
86  surfaceTension=document["physicalProperties"]["surfaceTension"].GetDouble();
87  sig=document["initialConditions"]["bubbleRadiusDeviation"].GetDouble();
88  init_size=document["initialConditions"]["bubbleRadius"].GetDouble()*2;
89  NN=document["initialConditions"]["numberBubbleDensity"].GetDouble();
90  abs_err=document["QmomKinetics"]["absoluteTolerance"].GetDouble();
91  rel_err=document["QmomKinetics"]["relativeTolerance"].GetDouble();
92  dt=document["QmomKinetics"]["timeStep"].GetDouble();
93  tend=document["QmomKinetics"]["endTime"].GetDouble();
94  bubbleMode=document["QmomKinetics"]["bubbleMode"].GetString();
95  if (W_0<1e-8) {
96  W_0=-1.0;
97  }
98  apparentViscosity=document["physicalProperties"]["ModenaFoamViscosityModel"].GetBool();
99 }
double E_W
activation energy for the blowing reaction, J/mol
double C_BL
Specific heat of the physical blowing agent in liquid phase, J/kg K.
real(dp) polyol1_ini
initial concentration of polyol 1
Definition: globals.f90:49
double CO2_0
Initial weight fraction of CO2 in the liquid, -.
double NN
correlated to number of initial bubbles in m^3
double lambda
Latent heat of blowing agent, J/kg.
double rel_err
relative error
double dt
time step, s
double abs_err
absolute error
double OH_0
Initial concentration of polyol OH groups in the mixutre, mol/m3.
real(dp) amine_ini
initial concentration of amine
Definition: globals.f90:49
double sig
correlated to variance of initial distribution
real(dp) isocyanate2_ini
initial concentration of isocyanate 2
Definition: globals.f90:49
int denMod
density mode, 1 = modena, 2 = constant
double C_BG
Specific heat of the physical blowing agent in gas phase, J/kg K.
real(dp) isocyanate3_ini
initial concentration of isocyanate 3
Definition: globals.f90:49
double surfaceTension
required for the computation of partial pressure
double M_CO2
Molecular mass of carbon dioxide, kg/kmol.
double W_0
Initial concentration of water in the mixture, mol/m3.
double M_NCO
Molecular weight of NCO, kg/kmol.
double init_size
initial mean bubble diameter, m
double DH_OH
Reaction heat for the gelling reaction, J/mol.
double Pr
initial/final pressure of the mixture, Pa
double rhoPoly
density of the liquid polymer, kg/m3
bool dilution
use dilution effect
double rhoBL
density of the blowing agent, kg/m3
double C_CO2
CO2 specific heat, J/kg K.
real(dp) polyol2_ini
initial concentration of polyol 2
Definition: globals.f90:49
double NCO_0
Initial concentration of isocianate NCO groups in the mixutre, mol/m3.
double M_B
Molecular mass of blowing agent, kg/kmol.
double Temp0
initial temperature, K
double M_air
Molecular weight of air, kg/kmol.
double L0
Initial weight fraction of blowing agent in the liquid, -.
int kinMod
kinetics model, 1 = Baser, 2 = Baser with R(x)
real(dp) isocyanate1_ini
initial concentration of isocyanate 1
Definition: globals.f90:49
double A_OH
pre-exponential factor for the gelling reaction, 1/s
int phBL
type of physical blowing agent 1 = pentane, 2 = R-11
double tend
end time, s
double DH_W
Reaction heat for the blowing reaction, J/mol.
double A_W
pre-exponential factor for the blowing reaction, 1/s
real(dp) catalyst
concentration of catalyst
Definition: globals.f90:49
double E_OH
activation energy for the gelling reaction, J/mol