14 double dXOHdt,XOH_C,XOH_Old,dWdt,XW_C,XW_Old,dLdt,alphaFO,
16 rhoFO,
C_TOT, L_l_C, L_l_Old, T_C,T_O, wBA_g_val, xBL_val, rhoPolyMixture;
25 forAll(mesh.C(), celli)
27 alphaFO = alpha2[celli];
28 rhoFO = rho_foam[celli];
31 XOH_Old = XOH.oldTime()[celli];
32 dXOHdt = (mag(XOH_C-XOH_Old))/(max(runTime.deltaTValue(),ROOTVSMALL));
35 XW_Old = XW.oldTime()[celli];
36 dWdt = (mag(XW_C-XW_Old))/(max(runTime.deltaTValue(),ROOTVSMALL));
39 T_O = TS.oldTime()[celli];
41 wBA_g_val = wBA_g[celli];
46 L_l_Old = wBA_l.oldTime().oldTime()[celli];
47 dLdt = (L_l_C - L_l_Old)/(max(runTime.deltaTValue(),ROOTVSMALL));
58 /(max(runTime.deltaTValue(),ROOTVSMALL)))
67 if (liquidMixtureDensitySurrogate)
70 modena_inputs_set(inputs_den, Tm_pos, T_C);
71 modena_inputs_set(inputs_den, XOHv_pos, XOH_C);
76 density_reaction_mixturemodel,
82 modena_inputs_destroy (inputs_den);
83 modena_outputs_destroy (outputs_den);
87 rhoPolyMixture = modena_outputs_get(outputs_den, 0);
94 if (blowingAgent ==
"n-pentane")
97 if (alphaFO > 0.5 && XOH[celli] < XOH_Gel)
102 + (-
DH_W*CW_0*dWdt)/(rhoPolyMixture*C_TOT)
103 + (latenth*dLdt)/(C_TOT))
106 else if (alphaFO > 0.5 && XOH[celli] >= XOH_Gel)
108 TSSource[celli] = (latenth*dLdt)/(C_TOT);
112 TSSource[celli] = ROOTVSMALL;
116 if (blowingAgent ==
"R-11")
120 xBL_val =
xBL(T_C, dxdT);
125 (1.0/(Foam::pow((1.0 - xBL_val),2)))*(dxdT))*latenth
128 if (alphaFO > 0.5 && XOH[celli] < XOH_Gel)
132 ((-
DH_OH*COH_0*dXOHdt)/(rhoPolyMixture*C_TOT)
133 + (-
DH_W*CW_0*dWdt)/(rhoPolyMixture*C_TOT))
136 else if (alphaFO > 0.5 && XOH[celli] >= XOH_Gel)
141 (1.0/(Foam::pow((1.0 - xBL_val),2)))*(dxdT))*latenth)
146 TSSource[celli] = ROOTVSMALL;
152 if (alphaFO > 0.5 && XOH[celli] < XOH_Gel)
156 ((-
DH_OH*COH_0*dXOHdt)/(rhoPolyMixture*C_TOT)
157 + (-
DH_W*CW_0*dWdt)/(rhoPolyMixture*C_TOT))
162 TSSource[celli] = ROOTVSMALL;
166 if (blowingAgent ==
"no")
169 if (alphaFO > 0.5 && XOH[celli] < XOH_Gel)
173 ((-
DH_OH*COH_0*dXOHdt)/(rhoPolyMixture*C_TOT)
174 + (-
DH_W*CW_0*dWdt)/(rhoPolyMixture*C_TOT))
179 TSSource[celli] = ROOTVSMALL;
182 if (thermalConductivitySurrogateSwitch)
187 modena_inputs_set(inputs_thermalConductivity,
porosity_Pos, max(1.0 - rhoFO/rhoPolyMixture,0.0));
190 modena_inputs_set(inputs_thermalConductivity,
cell_size_Pos, (2.0*radiusBubble));
191 modena_inputs_set(inputs_thermalConductivity,
temp_Pos, TS[celli]);
192 scalar pp_CO2, pp_BA;
197 wBA_g[celli], p[celli], radiusBubble
203 p[celli], radiusBubble
205 modena_inputs_set(inputs_thermalConductivity,
X_CO2_Pos, (pp_CO2/(pp_BA+pp_CO2)));
206 modena_inputs_set(inputs_thermalConductivity,
X_O2_Pos, 0.0);
207 modena_inputs_set(inputs_thermalConductivity,
X_N2_Pos, 0.0);
208 modena_inputs_set(inputs_thermalConductivity,
X_Cyp_Pos, (pp_BA/(pp_BA+pp_CO2)));
210 modena_inputs_set(inputs_strutContent,
rho_foam_Pos, rhoFO);
211 int ret_strutContent =
modena_model_call (strutContentmodel, inputs_strutContent, outputs_strutContent);
213 st_c = modena_outputs_get(outputs_strutContent, 0);
214 modena_inputs_set(inputs_thermalConductivity,
strut_c_Pos, st_c);
216 if(modena_error_occurred())
218 exit(modena_error());
220 thermalConductivity[celli] = modena_outputs_get(outputs_thermalConductivity, 0);
221 thermalDiff_foam[celli] = (thermalConductivity[celli]/(rhoFO*C_Poly));
231 if (blowingAgent ==
"n-pentane")
237 thermalConductivity[celli] =
239 (scalar(8.7006e-8)*Foam::pow(rhoFO,2)
240 + scalar(8.4674e-5)*rhoFO + scalar(1.16e-2))
245 thermalConductivity[celli] =
247 (scalar(9.3738e-6)*Foam::pow(rhoFO,2)
248 - scalar(7.3511e-4)*rhoFO+scalar(2.956e-2))
251 thermalDiff_foam[celli] = (thermalConductivity[celli]/(rhoFO*C_Poly));
264 thermalConductivity[celli] = 0.03;
265 thermalDiff_foam[celli] =
266 (thermalConductivity[celli]/(rhoFO*C_Poly));
275 thermalDiffusivity[celli] =
276 alpha1[celli]*thermalDiff_gas[celli]
277 + alpha2[celli]*thermalDiff_foam[celli];
279 thermalDiffusivity.correctBoundaryConditions();
size_t modena_model_inputs_argPos(const modena_model_t *self, const char *name)
Function determining position of an argument in the input vector.
size_t X_CO2_Pos
memory allocation for the partial pressure of CO2 as the input of thermal conductivity surrogate mode...
size_t temp_Pos
memory allocation for the temperature as the input of thermal conductivity surrogate model ...
size_t porosity_Pos
memory allocation for the gas volume fraction as the input of thermal conductivity surrogate model ...
size_t X_N2_Pos
memory allocation for the partial pressure of N2 as the input of thermal conductivity surrogate model...
size_t cell_size_Pos
memory allocation for the bubble size as the input of thermal conductivity surrogate model ...
modena_model_t * thermalConductivitymodel
pointer to the surrogate model for thermal conductivity
size_t X_Cyp_Pos
memory allocation for the partial pressure of cyclo-pentane as the input of thermal conductivity surr...
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.
double M_NCO
Molecular weight of NCO, kg/kmol.
int modena_model_call(modena_model_t *self, modena_inputs_t *inputs, modena_outputs_t *outputs)
Function calling the surrogate model and checking for errors.
double DH_OH
Reaction heat for the gelling reaction, J/mol.
double ddT_LliqMax(double &)
derivative of LliqMax with respect to temperature
double C_TOT
Total specifc heat of the mixture.
double bubbleRadius(const double m0, const double m1)
radius of bubbles based on the moments
size_t rho_foam_Pos
memory allocation for the foam density as the input of thermal conductivity surrogate model ...
double LliqMax(double &)
maximum allowable amount of liquid blowing agent (n-pentane) in liquid
double rhoPoly
density of the liquid polymer, kg/m3
double thermalDiffusivityGas(double &T)
thermal diffusivity of gas as a function of temperature
void modena_model_destroy(modena_model_t *self)
Function deallocating the memory allocated for the surrogate model.
double M_B
Molecular mass of blowing agent, kg/kmol.
double xBL(double &T, double &dxdT)
mole fraction of blowing agent (R-11) in liquid polymer
double partialPressureBA(const state_type &y)
partial pressure of the physical blowing agent
double L0
Initial weight fraction of blowing agent in the liquid, -.
size_t strut_c_Pos
memory allocation for the strut content as the input of thermal conductivity surrogate model ...
size_t X_O2_Pos
memory allocation for the partial pressure of O2 as the input of thermal conductivity surrogate model...
void modena_model_argPos_check(const modena_model_t *self)
Function checking that the user has queried all input positions.
double DH_W
Reaction heat for the blowing reaction, J/mol.