MoDeNa  1.0
Software framework facilitating sequential multi-scale modelling
Solubility.Solubility Namespace Reference

Data Structures

class  SolubilityExactSim
 This FireTask controls the execution of the detailed model of the Solubility model. More...
 

Variables

 term = Terminal()
 
 species
 
 system
 
string Ccode2
 Surrogate Function. More...
 
string Ccode3
 
dictionary outputs
 
dictionary parameters
 
dictionary parameters4
 
dictionary indices
 
dictionary inputs2
 
dictionary inputs3
 
 f2
 
 f3
 
 outOfBoundsStrategy
 
 parameterFittingStrategy
 
 m_solubilityCO2PU
 
 m_solubilityAirPU
 
 m_solubilityCyclopentanePU
 
 m_solubilityO2PU
 
 m_solubilityN2PU
 
 m_solubilityCO2
 
 m_solubilityAir
 
 m_solubilityCyclopentane
 
dictionary inputsExp
 
string CcodeR11Baser
 
 fR11Baser
 
list parR11Baser = [1e-7, 4.2934, 203.3556, 40.016]
 R11, Baser
 
 m_solubilityR11Baser
 
string CcodeCO2Baser
 
dictionary parameters1
 
 fCO2Baser
 
list parCO2Baser = [1.1e-4]
 CO2, Baser
 
 m_solubilityCO2Baser
 
string CcodePentGupta
 
dictionary parameters5
 
 fPentGupta
 
list parPentGupta = [-3.3e-4, 2.09e4, 67.5, 8.69e4, 1.01]
 n-pentane, Gupta
 
 m_solubilityPentGupta
 
string CcodePentWinkler
 
 fPentWinkler
 
list parPentWinkler = [0.0064,0.0551,298.0,17.8]
 n-pentane, Winkler
 
 m_solubilityPentWinkler
 

Detailed Description

This is the Solubility python module. Basically, it contains the following:

The FireTask which controls the call of the detailed model. This detailed model is called at the very beginning of the simulation in order to generate initial data points which can be used to fit the parameters of the surrogate model and during a running simulation as soon as the Solubility model is called with input parameters which lie outside the range the parameters of the surrogate model was so far fitted for. This FireTask is stored in the class "SolubilityExactSim" and a more detailed description of the detailed model can be found in the description of this class.

Furthermore, this module contains the code of the surrogate model function as well as the definitions of its input and output values and its fittable parameters. Care should be taken to set reasonable bounds for these variables.

Also, this module contains the backward mapping model. This model consits of the surrogate model function, an initialisation strategy, the out of bounds strategy and the parameter fitting strategy. The initialisation strategy defines the initial data points where the detailed model will be evaluated at simulation start for an initial fit of the surrogate model parameters. The out of bounds strategy determines, how many new points and where to place these new points, once the Solubility model is called for input values outside of the fitted range. The parameter fitting strategy defines tolerances and maximal iterations which are passed to the numerical solver which performs the actual fitting of the surrogate model parameters.

Author
Jonas Mairhofer, Pavel Ferkl

Variable Documentation

◆ Ccode2

Solubility.Solubility.Ccode2
Initial value:
1 = '''
2 #include "modena.h"
3 #include "math.h"
4 
5 void surroSolubility2
6 (
7 const modena_model_t* model,
8 const double* inputs,
9 double *outputs
10 )
11 {
12 {% block variables %}{% endblock %}
13 
14 const double P0 = parameters[0];
15 const double P1 = parameters[1];
16 const double P2 = parameters[2];
17 
18 const double term1 = P1*(1/T - 1/P2);
19 const double term2 = exp(term1);
20 
21 outputs[0] = P0*term2;
22 
23 outputs[0] = P0 + T*P1 + P2*T*T;
24 }
25 '''

Surrogate Function.

$$f(T) := \theta_0 + \theta_1 \cdot T + \theta_2 T^2$$

Definition at line 172 of file Solubility.py.

◆ Ccode3

string Solubility.Solubility.Ccode3
Initial value:
1 = '''
2 #include "modena.h"
3 #include "math.h"
4 
5 void surroSolubility3
6 (
7 const modena_model_t* model,
8 const double* inputs,
9 double *outputs
10 )
11 {
12 {% block variables %}{% endblock %}
13 
14 const double P0 = parameters[0];
15 const double P1 = parameters[1];
16 const double P2 = parameters[2];
17 const double P3 = parameters[3];
18 
19 const double term1 = P1*(1/T - 1/P2);
20 const double term2 = exp(term1);
21 
22 outputs[0] = P0*term2;
23 
24 outputs[0] = P0 + T*P1 + P2*T*T;
25 
26 outputs[0] = P0+P1*exp(-pow((T-P2),2)/P3);
27 }
28 '''

Definition at line 197 of file Solubility.py.

◆ CcodeCO2Baser

string Solubility.Solubility.CcodeCO2Baser
Initial value:
1 = '''
2 #include "modena.h"
3 #include "math.h"
4 
5 void surroSolubilityCO2Baser
6 (
7 const modena_model_t* model,
8 const double* inputs,
9 double *outputs
10 )
11 {
12 {% block variables %}{% endblock %}
13 
14 const double P0 = parameters[0];
15 
16 outputs[0] = P0;
17 }
18 '''

Definition at line 449 of file Solubility.py.

◆ CcodePentGupta

string Solubility.Solubility.CcodePentGupta
Initial value:
1 = '''
2 #include "modena.h"
3 #include "math.h"
4 
5 void surroSolubilityPentGupta
6 (
7 const modena_model_t* model,
8 const double* inputs,
9 double *outputs
10 )
11 {
12 {% block variables %}{% endblock %}
13 
14 const double P0 = parameters[0];
15 const double P1 = parameters[1];
16 const double P2 = parameters[2];
17 const double P3 = parameters[3];
18 const double P4 = parameters[4];
19 
20 outputs[0] = P0/(exp((P1-P2*T)/(P3-T))-P4)*1100.0/72.15e-3/101e3;
21 }
22 '''

Definition at line 487 of file Solubility.py.

◆ CcodePentWinkler

string Solubility.Solubility.CcodePentWinkler
Initial value:
1 = '''
2 #include "modena.h"
3 #include "math.h"
4 
5 void surroSolubilityPentWinkler
6 (
7 const modena_model_t* model,
8 const double* inputs,
9 double *outputs
10 )
11 {
12 {% block variables %}{% endblock %}
13 
14 const double P0 = parameters[0];
15 const double P1 = parameters[1];
16 const double P2 = parameters[2];
17 const double P3 = parameters[3];
18 
19 outputs[0] = (P0 + P1*exp(-pow(T-P2,2)/(2*P3*P3)))*1100.0/72.15e-3/101e3;
20 }
21 '''

Definition at line 533 of file Solubility.py.

◆ CcodeR11Baser

string Solubility.Solubility.CcodeR11Baser
Initial value:
1 = '''
2 #include "modena.h"
3 #include "math.h"
4 
5 void surroSolubilityR11Baser
6 (
7 const modena_model_t* model,
8 const double* inputs,
9 double *outputs
10 )
11 {
12 {% block variables %}{% endblock %}
13 
14 const double P0 = parameters[0];
15 const double P1 = parameters[1];
16 const double P2 = parameters[2];
17 const double P3 = parameters[3];
18 
19 outputs[0] = (P0 + P1*exp(-pow(T-P2,2)/(2*P3*P3)))*1100.0/137.37e-3/101e3;
20 }
21 '''

Definition at line 407 of file Solubility.py.

◆ f2

Solubility.Solubility.f2
Initial value:
1 = CFunction(Ccode=Ccode2,
2  inputs=inputs2,
3  outputs=outputs,
4  parameters=parameters,
5  indices=indices
6 )

Definition at line 254 of file Solubility.py.

◆ f3

Solubility.Solubility.f3
Initial value:
1 = CFunction(Ccode=Ccode3,
2  inputs=inputs3,
3  outputs=outputs,
4  parameters=parameters4,
5  indices=indices
6 )

Definition at line 260 of file Solubility.py.

◆ fCO2Baser

Solubility.Solubility.fCO2Baser
Initial value:
1 = CFunction(Ccode=CcodeCO2Baser,
2  inputs=inputsExp,
3  outputs=outputs,
4  parameters=parameters1
5 )

Definition at line 472 of file Solubility.py.

◆ fPentGupta

Solubility.Solubility.fPentGupta
Initial value:
1 = CFunction(Ccode=CcodePentGupta,
2  inputs=inputsExp,
3  outputs=outputs,
4  parameters=parameters5
5 )

Definition at line 518 of file Solubility.py.

◆ fPentWinkler

Solubility.Solubility.fPentWinkler
Initial value:
1 = CFunction(Ccode=CcodePentWinkler,
2  inputs=inputsExp,
3  outputs=outputs,
4  parameters=parameters5
5 )

Definition at line 556 of file Solubility.py.

◆ fR11Baser

Solubility.Solubility.fR11Baser
Initial value:
1 = CFunction(Ccode=CcodeR11Baser,
2  inputs=inputsExp,
3  outputs=outputs,
4  parameters=parameters4
5 )

Definition at line 434 of file Solubility.py.

◆ indices

dictionary Solubility.Solubility.indices
Initial value:
1 = {
2  'A': species,
3  'B': system
4 }

Definition at line 239 of file Solubility.py.

◆ inputs2

dictionary Solubility.Solubility.inputs2
Initial value:
1 = {
2  'T': { 'min': 200.0, 'max': 550.0}, #check if boundaries reasonable, from this range, the random values for the DOE are chosen!
3  'xl1': { 'min': 0.0, 'max': 1.0 },
4  'xl2': { 'min': 0.0, 'max': 1.0 },
5 }

Definition at line 243 of file Solubility.py.

◆ inputs3

dictionary Solubility.Solubility.inputs3
Initial value:
1 = {
2  'T': { 'min': 200.0, 'max': 550.0}, #check if boundaries reasonable, from this range, the random values for the DOE are chosen!
3  'xl1': { 'min': 0.0, 'max': 1.0 },
4  'xl2': { 'min': 0.0, 'max': 1.0 },
5  'xl3': { 'min': 0.0, 'max': 1.0 },
6 }

Definition at line 248 of file Solubility.py.

◆ inputsExp

dictionary Solubility.Solubility.inputsExp
Initial value:
1 = {
2  'T': { 'min': 200.0, 'max': 550.0}
3 }

Definition at line 404 of file Solubility.py.

◆ m_solubilityAir

Solubility.Solubility.m_solubilityAir
Initial value:
1 = BackwardMappingModel(
2  _id='Solubility[A=Air,B=3]',
3  surrogateFunction=f3,
4  exactTask=SolubilityExactSim(),
5  substituteModels=[],
6  initialisationStrategy=Strategy.InitialPoints(
7  initialPoints={
8  'T': [290, 350, 450, 550],
9  'xl1': [0.9e-4, 1.1e-4, 1e-4, 1e-4],
10  'xl2': [0.51, 0.49, 0.5, 0.5],
11  'xl3': [0.49, 0.51, 0.5, 0.5],
12  },
13  ),
14  outOfBoundsStrategy=outOfBoundsStrategy,
15  parameterFittingStrategy=parameterFittingStrategy
16 )

Definition at line 370 of file Solubility.py.

◆ m_solubilityAirPU

Solubility.Solubility.m_solubilityAirPU
Initial value:
1 = BackwardMappingModel(
2  _id='Solubility[A=Air,B=2]',
3  surrogateFunction=f2,
4  exactTask=SolubilityExactSim(),
5  substituteModels=[],
6  initialisationStrategy=Strategy.InitialPoints(
7  initialPoints={
8  'T': [290, 320, 350, 380],
9  'xl1': [1.1e-3, 1.0e-3, 1.0e-3, 1.0e-4],
10  'xl2': [0.9989, 0.999, 0.999, 0.9999],
11  },
12  ),
13  outOfBoundsStrategy=outOfBoundsStrategy,
14  parameterFittingStrategy=parameterFittingStrategy
15 )

Definition at line 293 of file Solubility.py.

◆ m_solubilityCO2

Solubility.Solubility.m_solubilityCO2
Initial value:
1 = BackwardMappingModel(
2  _id='Solubility[A=CO2,B=3]',
3  surrogateFunction=f3,
4  exactTask=SolubilityExactSim(),
5  substituteModels=[],
6  initialisationStrategy=Strategy.InitialPoints(
7  initialPoints={
8  'T': [290, 350, 450, 550],
9  'xl1': [0.9e-4, 1.1e-4, 1e-4, 1e-4],
10  'xl2': [0.51, 0.49, 0.5, 0.5],
11  'xl3': [0.49, 0.51, 0.5, 0.5],
12  },
13  ),
14  outOfBoundsStrategy=outOfBoundsStrategy,
15  parameterFittingStrategy=parameterFittingStrategy
16 )

Definition at line 354 of file Solubility.py.

◆ m_solubilityCO2Baser

Solubility.Solubility.m_solubilityCO2Baser
Initial value:
1 = ForwardMappingModel(
2  _id='SolubilityCO2Baser',
3  surrogateFunction=fCO2Baser,
4  substituteModels=[],
5  parameters=parCO2Baser,
6  inputs=inputsExp,
7  outputs=outputs,
8 )

Definition at line 479 of file Solubility.py.

◆ m_solubilityCO2PU

Solubility.Solubility.m_solubilityCO2PU
Initial value:
1 = BackwardMappingModel(
2  _id='Solubility[A=CO2,B=2]',
3  surrogateFunction=f2,
4  exactTask=SolubilityExactSim(),
5  substituteModels=[],
6  initialisationStrategy=Strategy.InitialPoints(
7  initialPoints={
8  'T': [290, 320, 350, 380],
9  'xl1': [1.1e-3, 1.0e-3, 1.0e-3, 1.0e-4],
10  'xl2': [0.9989, 0.999, 0.999, 0.9999],
11  },
12  ),
13  outOfBoundsStrategy=outOfBoundsStrategy,
14  parameterFittingStrategy=parameterFittingStrategy
15 )

Definition at line 278 of file Solubility.py.

◆ m_solubilityCyclopentane

Solubility.Solubility.m_solubilityCyclopentane
Initial value:
1 = BackwardMappingModel(
2  _id='Solubility[A=CyP,B=3]',
3  surrogateFunction=f3,
4  exactTask=SolubilityExactSim(),
5  substituteModels=[],
6  initialisationStrategy=Strategy.InitialPoints(
7  initialPoints={
8  'T': [290, 350, 450, 550],
9  'xl1': [0.9e-4, 1.1e-4, 1e-4, 1e-4],
10  'xl2': [0.51, 0.49, 0.5, 0.5],
11  'xl3': [0.49, 0.51, 0.5, 0.5],
12  },
13  ),
14  outOfBoundsStrategy=outOfBoundsStrategy,
15  parameterFittingStrategy=parameterFittingStrategy
16 )

Definition at line 386 of file Solubility.py.

◆ m_solubilityCyclopentanePU

Solubility.Solubility.m_solubilityCyclopentanePU
Initial value:
1 = BackwardMappingModel(
2  _id='Solubility[A=CyP,B=2]',
3  surrogateFunction=f2,
4  exactTask=SolubilityExactSim(),
5  substituteModels=[],
6  initialisationStrategy=Strategy.InitialPoints(
7  initialPoints={
8  'T': [290, 320, 350, 380],
9  'xl1': [1.1e-3, 1.0e-3, 1.0e-3, 1.0e-4],
10  'xl2': [0.9989, 0.999, 0.999, 0.9999],
11  },
12  ),
13  outOfBoundsStrategy=outOfBoundsStrategy,
14  parameterFittingStrategy=parameterFittingStrategy
15 )

Definition at line 308 of file Solubility.py.

◆ m_solubilityN2PU

Solubility.Solubility.m_solubilityN2PU
Initial value:
1 = BackwardMappingModel(
2  _id='Solubility[A=N2,B=2]',
3  surrogateFunction=f2,
4  exactTask=SolubilityExactSim(),
5  substituteModels=[],
6  initialisationStrategy=Strategy.InitialPoints(
7  initialPoints={
8  'T': [290, 320, 350, 380],
9  'xl1': [1.1e-3, 1.0e-3, 1.0e-3, 1.0e-4],
10  'xl2': [0.9989, 0.999, 0.999, 0.9999],
11  },
12  ),
13  outOfBoundsStrategy=outOfBoundsStrategy,
14  parameterFittingStrategy=parameterFittingStrategy
15 )

Definition at line 338 of file Solubility.py.

◆ m_solubilityO2PU

Solubility.Solubility.m_solubilityO2PU
Initial value:
1 = BackwardMappingModel(
2  _id='Solubility[A=O2,B=2]',
3  surrogateFunction=f2,
4  exactTask=SolubilityExactSim(),
5  substituteModels=[],
6  initialisationStrategy=Strategy.InitialPoints(
7  initialPoints={
8  'T': [290, 320, 350, 380],
9  'xl1': [1.1e-3, 1.0e-3, 1.0e-3, 1.0e-4],
10  'xl2': [0.9989, 0.999, 0.999, 0.9999],
11  },
12  ),
13  outOfBoundsStrategy=outOfBoundsStrategy,
14  parameterFittingStrategy=parameterFittingStrategy
15 )

Definition at line 323 of file Solubility.py.

◆ m_solubilityPentGupta

Solubility.Solubility.m_solubilityPentGupta
Initial value:
1 = ForwardMappingModel(
2  _id='SolubilityPentGupta',
3  surrogateFunction=fPentGupta,
4  substituteModels=[],
5  parameters=parPentGupta,
6  inputs=inputsExp,
7  outputs=outputs,
8 )

Definition at line 525 of file Solubility.py.

◆ m_solubilityPentWinkler

Solubility.Solubility.m_solubilityPentWinkler
Initial value:
1 = ForwardMappingModel(
2  _id='SolubilityPentWinkler',
3  surrogateFunction=fPentWinkler,
4  substituteModels=[],
5  parameters=parPentWinkler,
6  inputs=inputsExp,
7  outputs=outputs,
8 )

Definition at line 563 of file Solubility.py.

◆ m_solubilityR11Baser

Solubility.Solubility.m_solubilityR11Baser
Initial value:
1 = ForwardMappingModel(
2  _id='SolubilityR11Baser',
3  surrogateFunction=fR11Baser,
4  substituteModels=[],
5  parameters=parR11Baser,
6  inputs=inputsExp,
7  outputs=outputs,
8 )

Definition at line 441 of file Solubility.py.

◆ outOfBoundsStrategy

Solubility.Solubility.outOfBoundsStrategy
Initial value:
1 = Strategy.ExtendSpaceStochasticSampling(
2  nNewPoints=4
3 )

Definition at line 267 of file Solubility.py.

◆ outputs

dictionary Solubility.Solubility.outputs
Initial value:
1 = {
2  'H': { 'min': 9e99, 'max': -9e99, 'argPos': 0 }
3 }

Definition at line 225 of file Solubility.py.

◆ parameterFittingStrategy

Solubility.Solubility.parameterFittingStrategy
Initial value:
1 = Strategy.NonLinFitWithErrorContol(
2  testDataPercentage=0.2,
3  maxError=0.1,
4  improveErrorStrategy=Strategy.StochasticSampling(
5  nNewPoints=2
6  ),
7  maxIterations=5 # Currently not used
8 )

Definition at line 270 of file Solubility.py.

◆ parameters

dictionary Solubility.Solubility.parameters
Initial value:
1 = {
2  'param0': { 'min': 1e-12, 'max': 1E1, 'argPos': 0 }, #check if boundaries are reasonable!!!
3  'param1': { 'min': -1e-1, 'max': 1e-1, 'argPos': 1 },
4  'param2': { 'min': -1e-1, 'max': 1e-1, 'argPos': 2 },
5 }

Definition at line 228 of file Solubility.py.

◆ parameters1

dictionary Solubility.Solubility.parameters1
Initial value:
1 = {
2  'param0': { 'min': 1e-12, 'max': 1E1, 'argPos': 0 },
3 }

Definition at line 467 of file Solubility.py.

◆ parameters4

dictionary Solubility.Solubility.parameters4
Initial value:
1 = {
2  'param0': { 'min': -9e9, 'max': 9e9+2*1.42885440e-04, 'argPos': 0 }, #check if boundaries are reasonable!!!
3  'param1': { 'min': -9e9, 'max': 9e9+2*1.22132172e+00, 'argPos': 1 },
4  'param2': { 'min': -9e9, 'max': 9e9+2*-7.97789449e+02, 'argPos': 2 },
5  'param3': { 'min': -9e9, 'max': 9e9+2*1.33835999e+05, 'argPos': 3 },
6 }

Definition at line 233 of file Solubility.py.

◆ parameters5

dictionary Solubility.Solubility.parameters5
Initial value:
1 = {
2  'param0': { 'min': 1e-12, 'max': 1E1, 'argPos': 0 },
3  'param1': { 'min': -1e-1, 'max': 1e-1, 'argPos': 1 },
4  'param2': { 'min': -1e-1, 'max': 1e-1, 'argPos': 2 },
5  'param3': { 'min': -1e-1, 'max': 1e-1, 'argPos': 3 },
6  'param4': { 'min': -1e-1, 'max': 1e-1, 'argPos': 4 },
7 }

Definition at line 509 of file Solubility.py.

◆ species

Solubility.Solubility.species
Initial value:
1 = IndexSet(
2  name= 'solubility_pol_species',
3  names= [ 'Air', 'CO2', 'CyP', 'O2', 'N2' ]
4 )

Definition at line 80 of file Solubility.py.

◆ system

Solubility.Solubility.system
Initial value:
1 = IndexSet(
2  name= 'solubility_num_of_components',
3  names= [ '2', '3' ]
4 )

Definition at line 84 of file Solubility.py.