MoDeNa  1.0
Software framework facilitating sequential multi-scale modelling
gasConductivity.py
Go to the documentation of this file.
1 
31 
32 
44 
45 import os
46 from modena import *
47 from fireworks.utilities.fw_utilities import explicit_serialize
48 
49 
50 species = IndexSet(
51  name= 'gas_thermal_conductivity_species',
52  names= [ 'CO2', 'CyP', 'O2', 'N2' ]
53 )
54 
55 
58 f_gas_thermal_conductivity = CFunction(
59  Ccode='''
60 #include "modena.h"
61 #include "math.h"
62 
63 void gas_thermal_conductivity
64 (
65  const modena_model_t* model,
66  const double* inputs,
67  double *outputs
68 )
69 {
70  {% block variables %}{% endblock %}
71 
72  const double a = parameters[0];
73  const double b = parameters[1];
74 
75  outputs[0] = (a*T)+b;
76 }
77 ''',
78  # These are global bounds for the function
79  inputs={
80  'T': {'min': 273, 'max': 550},
81  },
82  outputs={
83  'gas_thermal_conductivity[A]': {'min': 0, 'max': +9e99, 'argPos': 0},
84  },
85  parameters={
86  'param0[A]': {'min': -9e99, 'max': +9e99, 'argPos': 0},
87  'param1[A]': {'min': -9e99, 'max': +9e99, 'argPos': 1},
88  },
89  indices={
90  'A': species,
91  },
92 )
93 
94 
97 m_CO2_thermal_conductivity = ForwardMappingModel(
98  _id='gas_thermal_conductivity[A=CO2]',
99  surrogateFunction=f_gas_thermal_conductivity,
100  substituteModels=[],
101  parameters=[0.0807e-3, -6.96e-3],
102 )
103 
104 
107 m_Air_thermal_conductivity = ForwardMappingModel(
108  _id='gas_thermal_conductivity[A=Air]',
109  surrogateFunction=f_gas_thermal_conductivity,
110  substituteModels=[],
111  parameters=[0.0720e-3, 4.23e-3],
112 )
113 
114 
117 m_CyP_thermal_conductivity = ForwardMappingModel(
118  _id='gas_thermal_conductivity[A=CyP]',
119  surrogateFunction=f_gas_thermal_conductivity,
120  substituteModels=[],
121  parameters=[0.0956e-3, -14.89e-3],
122 )
123 
124 
127 m_O2_thermal_conductivity = ForwardMappingModel(
128  _id='gas_thermal_conductivity[A=O2]',
129  surrogateFunction=f_gas_thermal_conductivity,
130  substituteModels=[],
131  parameters=[7.79027851e-05, 3.08485612e-03],
132 )
133 
134 
137 m_N2_thermal_conductivity = ForwardMappingModel(
138  _id='gas_thermal_conductivity[A=N2]',
139  surrogateFunction=f_gas_thermal_conductivity,
140  substituteModels=[],
141  parameters=[6.93333072e-05, 4.87189502e-03],
142 )