25 template<
typename StateView>
28 const StateView &S,
const LTETables <eTables)
const
33 template<
typename StateView>
36 const StateView &S,
const LTETables <eTables)
const
41 template<
typename StateView>
44 const StateView &S)
const
49 template<
typename StateView>
52 const StateView &S)
const
54 const int dim = L.
dim;
56 for (
int d = 0; d < dim; ++d)
58 const mfem::real_t m = S.momentum(L,d);
64 template<
typename StateView>
67 const StateView &S,
const LTETables <eTables)
const
70 const mfem::real_t rho =
density(phys, L, S, lteTables);
72 return 0.5 * m2 / rho;
75 template<
typename StateView>
78 const StateView &S,
const LTETables <eTables)
const
84 template<
typename StateView>
87 const StateView &S, mfem::real_t pressure_target,
94 for(
int idim = 0; idim < L.
dim; idim++)
101 mfem::real_t tol = 1e-12;
102 mfem::real_t denom = 0.0;
103 mfem::real_t ie_old = pressure_target * 3;
104 mfem::real_t ie_new = ie_old*1.01 + tol;
108 mfem::real_t f_old, f_new, ie_update;
110 for(
int iter = 0; iter < 100; iter++)
118 denom = f_new - f_old;
125 ie_update = ie_new - f_new * (ie_new - ie_old) / denom;
130 MFEM_ABORT(
"Secant method did not converge in internal_energy_from_pressure");
136 template<
typename StateView>
139 const StateView &S,
const LTETables <eTables)
const
142 const mfem::real_t rho =
density(phys, L, S, lteTables);
149 template<
typename StateView>
152 const StateView &S,
const LTETables <eTables)
const
157 template<
typename StateView>
160 const StateView &S,
const LTETables <eTables)
const
165 template<
typename StateView>
168 const StateView &S,
const LTETables <eTables)
const
173 template<
typename StateView>
176 const StateView &S,
const mfem::real_t *grad_rho,
177 const mfem::real_t *grad_p, mfem::real_t *grad_t,
180 for(
int i = 0; i < L.
dim; i++){
181 grad_t[i] = grad_p[i];
185 template<
typename StateView>
188 const StateView &S,
const LTETables <eTables)
const
193 template<
typename StateView>
196 const StateView &S,
const LTETables <eTables)
const
201 template<
typename StateView>
204 const StateView &S,
const LTETables <eTables)
const
209 template<
typename StateView>
212 const StateView &S,
const LTETables <eTables)
const
214 MFEM_ABORT(
"CL ALERT : Dont have it in plato tables and also not needed");
218 template<
typename InStateView,
typename OutStateView>
221 const InStateView &S, OutStateView &E,
224 const mfem::real_t T =
temperature(phys, L, S, lteTables);
225 const mfem::real_t beta = 1/T;
226 const mfem::real_t ent_1 = 0.0;
228 E.set_mass(L, ent_1);
230 for(
int idim = 0;idim < dim;idim++){
231 E.set_momentum(L, idim, beta * S.velocity(L, idim));
233 E.set_energy(L, -beta);
236 template<
typename InStateView,
typename OutStateView>
239 const InStateView &S,
const InStateView &dE,
240 OutStateView &dPrim,
const LTETables <eTables)
const
243 const mfem::real_t T =
temperature(phys, L, S, lteTables);
245 dPrim.set_mass(L, 0.0);
247 for(
int i=0; i < dim; i++)
249 dPrim.set_momentum(L, i, dE.momentum(L, i)*T + T*S.velocity(L, i)*dE.energy(L));
251 dPrim.set_energy(L, T*T*dE.energy(L));
254 template<
typename InStateView,
typename OutStateView>
257 const InStateView &Se, OutStateView &Sc,
260 std::cerr<<
" CL ALERT : Not functional in LTE yet "<<std::endl;
263 template<
typename InStateView,
typename OutStateView>
265 const InStateView &prim, OutStateView &cons,
268 const mfem::real_t rho = prim.mass(L);
269 const int dim = L.
dim;
270 mfem::real_t v2 = 0.0;
272 cons.set_mass(L, rho);
273 for(
int d = 0; d < dim; d++)
275 cons.set_momentum(L, d, rho*prim.velocity(L, d));
276 v2 += prim.velocity(L,d)*prim.velocity(L,d);
279 cons.set_energy(L, rhoe + 0.5 * rho * v2);
284 template<
typename StateView>
287 const StateView &S, mfem::real_t u[3],
const LTETables <eTables)
const
289 const int dim = L.
dim;
290 for (
int d = 0; d < dim; ++d)
292 u[d] = S.velocity(L, d);
294 for (
int d = dim; d < 3; ++d)
296 u[d] = mfem::real_t(0);
300 template<
typename StateView>
310 template<
typename StateView>
313 const StateView &S,
const LTETables <eTables)
const
315 mfem::real_t rho =
density(phys, L, S, lteTables);
319 mfem::real_t tol = 1e-12;
320 mfem::real_t res = 1;
329 res = (e - e_guess)/
cv;
338 printf(
"Newton method did not converge in temp_from_internal_energy");
341 MFEM_ABORT(
"Newton method did not converge in temp_from_internal_energy");
349 template<
typename StateView>
352 const StateView &S,
const LTETables <eTables)
const
363 mfem::real_t rho =
density(phys, L, S, lteTables);
369 int u_x = l_x + 1 , u_y = l_y + 1;
371 if(l_x < 0 || u_x >= lteTables.
L.
nx || l_y < 0 || u_y >= lteTables.
L.
ny)
374 printf(
" CL ALERT : Out of bounds in LTE table lookup! \n");
375 printf(
"l_x : %d l_y : %d \n", l_x, l_y);
378 printf(
"e : %e < %e < %e \n", lteTables.
tables.
e_grid[0],
382 std::cout <<
" CL ALERT : Out of bounds in LTE table lookup! "<<std::endl;
383 std::cout <<
"l_x : " << l_x <<
"l_y : " << l_y << std::endl;
384 std::cout <<
"rho : " << lteTables.
tables.
rho_grid[0] <<
" < " << rho
386 std::cout <<
"e : " << lteTables.
tables.
e_grid[0] <<
" < "
387 << e <<
" < " << lteTables.
tables.
e_grid[lteTables.
L.
ny-1] << std::endl;
403 mfem::real_t wx = (rho - rho_l) / (rho_u - rho_l);
404 mfem::real_t wy = (e - e_l) / (e_u - e_l);
412 return Q00 * ((1 - wx) * (1 - wy)) + Q01 * ((1 - wx) * wy) +
413 Q10 * (wx * (1 - wy)) + Q11 * (wx * wy);
416 template<
typename StateView>
420 const mfem::real_t T,
431 mfem::real_t rho =
density(phys, L, S, lteTables);
436 int u_x = l_x + 1 , u_y = l_y + 1;
448 mfem::real_t wx = (rho - rho_l) / (rho_u - rho_l);
449 mfem::real_t wy = (T - T_l) / (T_u - T_l);
456 return Q00 * ((1 - wx) * (1 - wy)) + Q01 * ((1 - wx) * wy) +
457 Q10 * (wx * (1 - wy)) + Q11 * (wx * wy);
MFEM_HOST_DEVICE mfem::real_t rmin(mfem::real_t a, mfem::real_t b)
Definition theseus_kernels.hpp:18
MFEM_HOST_DEVICE mfem::real_t rmax(mfem::real_t a, mfem::real_t b)
Definition theseus_kernels.hpp:17
MFEM_HOST_DEVICE mfem::real_t rabs(mfem::real_t x)
Definition theseus_kernels.hpp:22
Definition LTETable.hpp:19
MFEM_HOST_DEVICE int hunt(const mfem::real_t *arr, int n, mfem::real_t x, int ind_lo)
Definition LTETable.hpp:272
Definition AxisymmetricGeometry.hpp:15
constexpr const int MAXEQ
Definition theseus_kernels.hpp:13
MFEM_HOST_DEVICE mfem::real_t property_lookup(int property_idx, const PhysicsConstants &phys, const StateLayout &L, const StateView &S, const LTETables <eTables) const
Definition LTEEOS.hpp:302
MFEM_HOST_DEVICE mfem::real_t momentum_sq(const PhysicsConstants &phys, const StateLayout &L, const StateView &S) const
Definition LTEEOS.hpp:51
MFEM_HOST_DEVICE mfem::real_t cp(const PhysicsConstants &phys, const StateLayout &L, const StateView &S, const LTETables <eTables) const
Definition LTEEOS.hpp:203
MFEM_HOST_DEVICE mfem::real_t density(const PhysicsConstants &phys, const StateLayout &L, const StateView &S, const LTETables <eTables) const
Definition LTEEOS.hpp:35
MFEM_HOST_DEVICE mfem::real_t pressure(const PhysicsConstants &phys, const StateLayout &L, const StateView &S, const LTETables <eTables) const
Definition LTEEOS.hpp:151
MFEM_HOST_DEVICE mfem::real_t cv(const PhysicsConstants &phys, const StateLayout &L, const StateView &S, const LTETables <eTables) const
Definition LTEEOS.hpp:195
MFEM_HOST_DEVICE mfem::real_t gamma(const PhysicsConstants &phys, const StateLayout &L, const StateView &S, const LTETables <eTables) const
Definition LTEEOS.hpp:159
void primitive_to_conserved(const PhysicsConstants &phys, const StateLayout &L, const InStateView &prim, OutStateView &cons, const LTETables <eTables) const
Definition LTEEOS.hpp:264
MFEM_HOST_DEVICE void entropy_state(const PhysicsConstants &phys, const StateLayout &L, const InStateView &S, OutStateView &E, const LTETables <eTables) const
Definition LTEEOS.hpp:220
MFEM_HOST_DEVICE void velocity(const PhysicsConstants &phys, const StateLayout &L, const StateView &S, mfem::real_t u[3], const LTETables <eTables) const
Definition LTEEOS.hpp:286
MFEM_HOST_DEVICE mfem::real_t entropy(const PhysicsConstants &phys, const StateLayout &L, const StateView &S, const LTETables <eTables) const
Definition LTEEOS.hpp:211
MFEM_HOST_DEVICE mfem::real_t kinetic_energy_density(const PhysicsConstants &phys, const StateLayout &L, const StateView &S, const LTETables <eTables) const
Definition LTEEOS.hpp:66
MFEM_HOST_DEVICE mfem::real_t internal_energy_from_pressure(const PhysicsConstants &phys, const StateLayout &L, const StateView &S, mfem::real_t pressure_target, const LTETables <eTables) const
Definition LTEEOS.hpp:86
MFEM_HOST_DEVICE mfem::real_t R_gas(const PhysicsConstants &phys, const StateLayout &L, const StateView &S, const LTETables <eTables) const
Definition LTEEOS.hpp:27
MFEM_HOST_DEVICE void grad_entropy_to_grad_prim(const PhysicsConstants &phys, const StateLayout &L, const InStateView &S, const InStateView &dE, OutStateView &dPrim, const LTETables <eTables) const
Definition LTEEOS.hpp:238
MFEM_HOST_DEVICE mfem::real_t sound_speed(const PhysicsConstants &phys, const StateLayout &L, const StateView &S, const LTETables <eTables) const
Definition LTEEOS.hpp:187
MFEM_HOST_DEVICE mfem::real_t temperature(const PhysicsConstants &phys, const StateLayout &L, const StateView &S, const LTETables <eTables) const
Definition LTEEOS.hpp:167
MFEM_HOST_DEVICE void grad_temperature(const PhysicsConstants &phys, const StateLayout &L, const StateView &S, const mfem::real_t *grad_rho, const mfem::real_t *grad_p, mfem::real_t *grad_t, const LTETables <eTables) const
Definition LTEEOS.hpp:175
MFEM_HOST_DEVICE mfem::real_t rhoE(const PhysicsConstants &phys, const StateLayout &L, const StateView &S) const
Definition LTEEOS.hpp:43
MFEM_HOST_DEVICE mfem::real_t specific_internal_energy(const PhysicsConstants &phys, const StateLayout &L, const StateView &S, const LTETables <eTables) const
Definition LTEEOS.hpp:138
MFEM_HOST_DEVICE void entropy_to_conserved(const PhysicsConstants &phys, const StateLayout &L, const InStateView &Se, OutStateView &Sc, const LTETables <eTables) const
Definition LTEEOS.hpp:256
MFEM_HOST_DEVICE mfem::real_t internal_energy_density(const PhysicsConstants &phys, const StateLayout &L, const StateView &S, const LTETables <eTables) const
Definition LTEEOS.hpp:77
MFEM_HOST_DEVICE mfem::real_t temp_from_internal_energy(const PhysicsConstants &phys, const StateLayout &L, const StateView &S, const LTETables <eTables) const
Definition LTEEOS.hpp:312
MFEM_HOST_DEVICE mfem::real_t biinterp_lte_table(int property_idx, const PhysicsConstants &phys, const StateLayout &L, const StateView &S, const mfem::real_t T, const LTETables <eTables) const
Definition LTEEOS.hpp:418
MFEM_HOST_DEVICE mfem::real_t biinterp_inverse_table(const PhysicsConstants &phys, const StateLayout &L, const StateView &S, const LTETables <eTables) const
Definition LTEEOS.hpp:351
Definition LTETable.hpp:75
LTETable::View tables
Definition LTETable.hpp:82
LTETable::Layout L
Definition LTETable.hpp:81
int cv_idx
Definition LTETable.hpp:30
int ny
Definition LTETable.hpp:24
int R_eq_idx
Definition LTETable.hpp:32
int cp_idx
Definition LTETable.hpp:31
int e_idx
Definition LTETable.hpp:29
int nx
Definition LTETable.hpp:24
MFEM_HOST_DEVICE int property_index(int property, int ind_x, int ind_y) const
Definition LTETable.hpp:45
int P_idx
Definition LTETable.hpp:28
int c_idx
Definition LTETable.hpp:34
int gamma_eq_idx
Definition LTETable.hpp:33
const mfem::real_t * T_grid
Definition LTETable.hpp:70
const mfem::real_t * inv_table
Definition LTETable.hpp:68
const mfem::real_t * rho_grid
Definition LTETable.hpp:69
const mfem::real_t * e_grid
Definition LTETable.hpp:71
const mfem::real_t * lte_table
Definition LTETable.hpp:67
Definition Physics.hpp:14
Definition GasState.hpp:218
MFEM_HOST_DEVICE void set_mass(const StateLayout &L, mfem::real_t val)
Definition GasState.hpp:239
MFEM_HOST_DEVICE void set_momentum(const StateLayout &L, int d, mfem::real_t val)
Definition GasState.hpp:252
MFEM_HOST_DEVICE void set_energy(const StateLayout &L, mfem::real_t val)
Definition GasState.hpp:301
Definition GasState.hpp:37
int dim
Definition GasState.hpp:38