106 mfem::real_t* lte_table, mfem::real_t &e_min, mfem::real_t &e_max)
110 mfem::real_t UKB = 1.380649e-23;
111 int nb_comp = plato_get_nb_comp();
112 int nb_spec = plato_get_nb_species();
113 int nb_temp = plato_get_nb_temp();
114 double X_tol = 1e-12;
116 mfem::Vector yc(nb_comp), Xc(nb_comp);
117 mfem::Vector Xi(nb_spec), Xitol(nb_spec), Xip(nb_spec), Xim(nb_spec), yi(nb_spec),
118 Ri(nb_spec), ei(nb_spec), hi(nb_spec), Ji(nb_spec),
119 Di(nb_spec),Dij(nb_spec*(nb_spec + 1)/2), di(nb_spec);
120 mfem::Vector temp(nb_temp), lambda_int(nb_temp);
122 mfem::real_t R, P, nb, e, betaT, alpha, cv, gam, cp, c,
123 mu, sigma, lambda_trh, lambda_tre, lambda_reactive;
125 plato_get_Ri(Ri.GetData());
128 for(
int i=0; i < L.
nx; i++)
130 const mfem::real_t rho = rho_grid[i];
131 for(
int j=0; j < L.
ny; j++)
136 const mfem::real_t T = T_grid[j];
140 plato_get_eq_composition_mass(&rho, &T, yc.GetData(), yi.GetData(), &flag);
141 plato_mass_to_mole_fractions(yi.GetData(), Xi.GetData());
149 plato_get_species_energy(temp.GetData(), ei.GetData());
150 for(
int sp=0; sp < nb_spec; sp++) hi[sp] = ei[sp] + Ri[sp]*T;
155 betaT = plato_get_eq_isoth_comp(&P, &T, Xi.GetData());
156 alpha = plato_get_eq_coeff_th_exp(&P, &T, Xi.GetData());
157 cv = plato_get_eq_cv(&rho, &T, yi.GetData());
158 gam = 1.0 + alpha*alpha*T/(rho*betaT*cv);
160 c = std::sqrt(gam*P/rho);
164 plato_get_transp_coeff_comp(&nb, Xi.GetData(), temp.GetData(), &mu, &sigma,
165 &lambda_trh, &lambda_tre, lambda_int.GetData(), Di.GetData());
168 double Tepsp1 = T*(1.0 + eps);
169 double Tepsm1 = T*(1.0 - eps);
172 plato_get_eq_composition_mole(&P, &Tepsp1, Xc.GetData(), Xip.GetData(), &flag);
173 plato_get_eq_composition_mole(&P, &Tepsm1, Xc.GetData(), Xim.GetData(), &flag);
174 plato_get_bin_diff_coeff(&nb, &T, &T, Xi.GetData(), Dij.GetData());
175 for(
int sp=0; sp < nb_spec; sp++) di[sp] = -0.5 * (Xip[sp] - Xim[sp])/(eps*T);
177 double sum_Xitol = 0.0, X;
178 for(
int sp=0; sp < nb_spec; sp++)
185 sum_Xitol = 1.0/sum_Xitol;
186 for(
int sp=0; sp < nb_spec; sp++) Xitol[sp] *= sum_Xitol;
188 plato_get_species_diff_flux(&T, &T, &nb, Xitol.GetData(), Dij.GetData(), di.GetData(), Ji.GetData());
208 e_min = std::min(e_min, e);
209 e_max = std::max(e_max, e);
217 const mfem::real_t* T_grid, mfem::real_t* inv_table)
220 int nb_comp = plato_get_nb_comp();
221 int nb_spec = plato_get_nb_species();
223 mfem::Vector yc(nb_comp);
224 mfem::Vector yi(nb_spec), ei(nb_spec);
225 mfem::Vector temp(1);
227 mfem::real_t rho, e0, e, res, cv;
228 mfem::real_t tol = 1e-8;
231 mfem::real_t T = T_grid[0];
232 for(
int i = 0; i < L.
nx; i++)
236 for(
int j = 0; j < L.
ny; j++)
246 plato_get_eq_composition_mass(&rho, &T, yc.GetData(), yi.GetData(), &flag);
247 plato_get_species_energy(temp.GetData(), ei.GetData());
249 cv = plato_get_eq_cv(&rho, &T, yi.GetData());
254 res = std::abs(res)/T;
258 MFEM_ABORT(
"Maximum number of iterations reached in fill_inv_table");
262 MFEM_ABORT(
"Negative temperature encountered in fill_inv_table");