12 if (KineticsModel ==
"generic")
33 forAll(mesh.C(), celli)
35 temp_current = TS[celli];
36 temp_old = TS.oldTime()[celli];
38 if (liquidMixtureDensitySurrogate)
41 modena_inputs_set(inputs_den, T_pos, temp_current);
42 modena_inputs_set(inputs_den, XOH_pos, XOH[celli]);
47 density_reaction_mixturemodel,
53 modena_inputs_destroy (inputs_den);
54 modena_outputs_destroy (outputs_den);
58 rhoPolyS = modena_outputs_get(outputs_den, 0);
67 XW[celli] = ROOTVSMALL;
71 XW[celli] = ROOTVSMALL;
74 if (QW < 0.0 || CW_0 == 0.0)
79 if (XOH[celli] < XOH_Gel)
88 else if (XW[celli] > 1.0)
99 XOH[celli] = ROOTVSMALL;
101 if (XOH[celli] > 1.0)
103 XOH[celli] = ROOTVSMALL;
106 if (XOH[celli] < XOH_Gel)
108 XOH_valOld = XOH[celli];
109 Arhns_current =
arrhenius (AOH, EOH, temp_current);
110 Arhns_old =
arrhenius (AOH, EOH, temp_old);
114 (Arhns_old*COH_0*(1 - XOH_valOld)*
115 (CNCO_0/COH_0 - 2*XW_val*CW_0/COH_0 - XOH_valOld)*BA_dilution)
117 if (XOHSource_Old < 0.0)
119 ScNonXOH[celli] = ROOTVSMALL;
120 Coeff_1stOrd[celli] = ROOTVSMALL;
121 SuXOH[celli] = ROOTVSMALL;
122 SpXOH[celli] = ROOTVSMALL;
129 (Arhns_current*CNCO_0 - 2.0*Arhns_current*CW_0*XW_val)
131 Coeff_1stOrd[celli] =
134 (Arhns_current*COH_0 + Arhns_current*CNCO_0
135 - 2.0*Arhns_current*CW_0*XW_val)
140 -1.0*BA_dilution*Arhns_old*
141 COH_0*Foam::pow(XOH_valOld,2.0)
145 2.0*BA_dilution*Arhns_old*COH_0*XOH_valOld
151 if (KineticsModel ==
"RF-1")
153 forAll(mesh.C(), celli)
156 modena_inputs_set(inputs_kinetics,
Catalyst_1_Pos, (Catalyst_1[celli]));
157 modena_inputs_set(inputs_kinetics,
CE_A0_Pos, (CE_A0[celli]));
158 modena_inputs_set(inputs_kinetics,
CE_A1_Pos, (CE_A1[celli]));
159 modena_inputs_set(inputs_kinetics,
CE_B_Pos, (CE_B[celli]));
160 modena_inputs_set(inputs_kinetics,
CE_B2_Pos, (CE_B2[celli]));
161 modena_inputs_set(inputs_kinetics,
CE_I0_Pos, (CE_I0[celli]));
162 modena_inputs_set(inputs_kinetics,
CE_I1_Pos, (CE_I1[celli]));
163 modena_inputs_set(inputs_kinetics,
CE_I2_Pos, (CE_I2[celli]));
164 modena_inputs_set(inputs_kinetics,
CE_PBA_Pos, (CE_PBA[celli]));
165 modena_inputs_set(inputs_kinetics,
CE_Breac_Pos, (CE_Breac[celli]));
166 modena_inputs_set(inputs_kinetics,
CE_Areac0_Pos, (CE_Areac0[celli]));
167 modena_inputs_set(inputs_kinetics,
CE_Areac1_Pos, (CE_Areac1[celli]));
168 modena_inputs_set(inputs_kinetics,
CE_Ireac0_Pos, (CE_Ireac0[celli]));
169 modena_inputs_set(inputs_kinetics,
CE_Ireac1_Pos, (CE_Ireac1[celli]));
170 modena_inputs_set(inputs_kinetics,
CE_Ireac2_Pos, (CE_Ireac2[celli]));
171 modena_inputs_set(inputs_kinetics,
Bulk_Pos, Bulk[celli]);
172 modena_inputs_set(inputs_kinetics,
R_1_Pos, R_1[celli]);
173 modena_inputs_set(inputs_kinetics,
R_1_mass_Pos, R_1_mass[celli]);
175 modena_inputs_set(inputs_kinetics,
R_1_vol_RF1_Pos, R_1_vol_RF1[celli]);
180 if (ret_kinetics != 0)
182 modena_inputs_destroy (inputs_kinetics);
183 modena_outputs_destroy (outputs_kinetics);
188 source_Catalyst_1[celli] =
190 source_CE_A0[celli] =
192 source_CE_A1[celli] =
196 source_CE_B2[celli] =
198 source_CE_I0[celli] =
200 source_CE_I1[celli] =
202 source_CE_I2[celli] =
204 source_CE_PBA[celli] =
206 source_CE_Breac[celli] =
208 source_CE_Areac0[celli] =
210 source_CE_Areac1[celli] =
212 source_CE_Ireac0[celli] =
214 source_CE_Ireac1[celli] =
216 source_CE_Ireac2[celli] =
222 source_R_1_mass[celli] =
224 source_R_1_temp_RF1[celli] =
226 source_R_1_vol_RF1[celli] =
229 if (CW_0 > scalar(1e-8)) {
230 XWSource[celli] = scalar(-1.0)*
231 source_CE_B2[celli]/(CW_0/scalar(1000.0));
233 XWSource[celli] = scalar(0.0);
236 XOHSource[celli] = scalar(-1.0)*
237 (source_CE_A0[celli] + source_CE_A1[celli])/
238 ((COH_0))*scalar(1000.0);
240 source_Catalyst_1.correctBoundaryConditions();
241 source_CE_A0.correctBoundaryConditions();
242 source_CE_A1.correctBoundaryConditions();
243 source_CE_B.correctBoundaryConditions();
244 source_CE_B2.correctBoundaryConditions();
245 source_CE_I0.correctBoundaryConditions();
246 source_CE_I1.correctBoundaryConditions();
247 source_CE_I2.correctBoundaryConditions();
248 source_CE_PBA.correctBoundaryConditions();
249 source_CE_Breac.correctBoundaryConditions();
250 source_CE_Areac0.correctBoundaryConditions();
251 source_CE_Areac1.correctBoundaryConditions();
252 source_CE_Ireac0.correctBoundaryConditions();
253 source_CE_Ireac1.correctBoundaryConditions();
254 source_CE_Ireac2.correctBoundaryConditions();
255 source_Bulk.correctBoundaryConditions();
256 source_R_1.correctBoundaryConditions();
257 source_R_1_mass.correctBoundaryConditions();
258 source_R_1_temp_RF1.correctBoundaryConditions();
259 source_R_1_vol_RF1.correctBoundaryConditions();
size_t source_CE_Ireac2_Pos
memory allocation for outputs of kinetics surrogate model
size_t source_CE_PBA_Pos
memory allocation for outputs of kinetics surrogate model
size_t source_CE_A1_Pos
memory allocation for outputs of kinetics surrogate model
size_t CE_I2_Pos
memory allocation for inputs of kinetics surrogate model
size_t source_CE_Breac_Pos
memory allocation for outputs of kinetics surrogate model
size_t source_Bulk_Pos
memory allocation for outputs of kinetics surrogate model
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 source_CE_Areac0_Pos
memory allocation for outputs of kinetics surrogate model
size_t CE_Ireac0_Pos
memory allocation for inputs of kinetics surrogate model
size_t CE_PBA_Pos
memory allocation for inputs of kinetics surrogate model
size_t CE_Breac_Pos
memory allocation for inputs of kinetics surrogate model
size_t R_1_mass_Pos
memory allocation for inputs of kinetics surrogate model
size_t source_CE_I1_Pos
memory allocation for outputs of kinetics surrogate model
size_t Catalyst_1_Pos
memory allocation for inputs of kinetics surrogate model
size_t source_R_1_temp_RF1_Pos
memory allocation for outputs of kinetics surrogate model
size_t source_CE_B_Pos
memory allocation for outputs of kinetics surrogate model
size_t CE_Areac1_Pos
memory allocation for inputs of kinetics surrogate model
size_t CE_I1_Pos
memory allocation for inputs of kinetics surrogate model
size_t source_CE_Ireac1_Pos
memory allocation for outputs of kinetics surrogate model
size_t CE_Ireac2_Pos
memory allocation for inputs of kinetics surrogate model
size_t source_CE_A0_Pos
memory allocation for outputs of kinetics surrogate model
size_t CE_Areac0_Pos
memory allocation for inputs of kinetics surrogate model
size_t source_CE_I2_Pos
memory allocation for outputs of kinetics surrogate model
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.
size_t R_1_vol_RF1_Pos
memory allocation for inputs of kinetics surrogate model
size_t source_CE_I0_Pos
memory allocation for outputs of kinetics surrogate model
size_t CE_I0_Pos
memory allocation for inputs of kinetics surrogate model
size_t source_R_1_mass_Pos
memory allocation for outputs of kinetics surrogate model
size_t source_CE_Ireac0_Pos
memory allocation for outputs of kinetics surrogate model
double rhoPoly
density of the liquid polymer, kg/m3
size_t source_R_1_vol_RF1_Pos
memory allocation for outputs of kinetics surrogate model
size_t source_Catalyst_1_Pos
memory allocation for outputs of kinetics surrogate model
void modena_model_destroy(modena_model_t *self)
Function deallocating the memory allocated for the surrogate model.
double arrhenius(double &, double &, double &)
Arrhenius function.
double BAdilution(double &, double &, double &)
dilution term for the blowing agent (n-pentane)
double rhoBL
density of the blowing agent, kg/m3
size_t R_1_Pos
memory allocation for inputs of kinetics surrogate model
double QKinW(double &AW, double &EW, double &tempi, double &Lliq, double &rhoPoly, double &rhoBL)
arrhenius term times by dilution term
size_t Bulk_Pos
memory allocation for inputs of kinetics surrogate model
size_t source_CE_Areac1_Pos
memory allocation for outputs of kinetics surrogate model
size_t kineticTime_Pos
memory allocation for inputs of kinetics surrogate model
double L0
Initial weight fraction of blowing agent in the liquid, -.
size_t CE_A1_Pos
memory allocation for inputs of kinetics surrogate model
size_t CE_B_Pos
memory allocation for inputs of kinetics surrogate model
size_t source_CE_B2_Pos
memory allocation for outputs of kinetics surrogate model
size_t CE_B2_Pos
memory allocation for inputs of kinetics surrogate model
void modena_model_argPos_check(const modena_model_t *self)
Function checking that the user has queried all input positions.
size_t CE_Ireac1_Pos
memory allocation for inputs of kinetics surrogate model
size_t R_1_temp_RF1_Pos
memory allocation for inputs of kinetics surrogate model
size_t CE_A0_Pos
memory allocation for inputs of kinetics surrogate model
size_t source_R_1_Pos
memory allocation for outputs of kinetics surrogate model