[P]arallel [Hi]gh-order [Li]brary for [P]DEs  Latest
Parallel High-Order Library for PDEs through hp-adaptive Discontinuous Galerkin methods
convective_numerical_flux.cpp
1 #include <boost/preprocessor/seq/for_each.hpp>
2 
3 #include "ADTypes.hpp"
4 
5 #include "convective_numerical_flux.hpp"
6 
7 namespace PHiLiP {
8 namespace NumericalFlux {
9 
10 using AllParam = Parameters::AllParameters;
11 
12 // Protyping low level functions
13 template<int nstate, typename real_tensor>
14 std::array<real_tensor, nstate> array_average(
15  const std::array<real_tensor, nstate> &array1,
16  const std::array<real_tensor, nstate> &array2)
17 {
18  std::array<real_tensor,nstate> array_average;
19  for (int s=0; s<nstate; s++) {
20  array_average[s] = 0.5*(array1[s] + array2[s]);
21  }
22  return array_average;
23 }
24 
25 template <int dim, int nspecies, int nstate, typename real>
27  std::unique_ptr< BaselineNumericalFluxConvective<dim,nspecies,nstate,real> > baseline_input,
28  std::unique_ptr< RiemannSolverDissipation<dim,nspecies,nstate,real> > riemann_solver_dissipation_input)
29  : baseline(std::move(baseline_input))
30  , riemann_solver_dissipation(std::move(riemann_solver_dissipation_input))
31 { }
32 
33 template<int dim, int nspecies, int nstate, typename real>
36  const std::array<real, nstate> &soln_int,
37  const std::array<real, nstate> &soln_ext,
38  const dealii::Tensor<1,dim,real> &normal_int) const
39 {
40  // baseline flux (without upwind dissipation)
41  const std::array<real, nstate> baseline_flux_dot_n
42  = this->baseline->evaluate_flux(soln_int, soln_ext, normal_int);
43 
44  // Riemann solver dissipation
45  const std::array<real, nstate> riemann_solver_dissipation_dot_n
46  = this->riemann_solver_dissipation->evaluate_riemann_solver_dissipation(soln_int, soln_ext, normal_int);
47 
48  // convective numerical flux: sum of baseline and Riemann solver dissipation term
49  std::array<real, nstate> numerical_flux_dot_n;
50  for (int s=0; s<nstate; s++) {
51  numerical_flux_dot_n[s] = baseline_flux_dot_n[s] + riemann_solver_dissipation_dot_n[s];
52  }
53  return numerical_flux_dot_n;
54 }
55 
56 template <int dim, int nspecies, int nstate, typename real>
58  std::shared_ptr<Physics::PhysicsBase<dim, nspecies, nstate, real>> physics_input)
59  : NumericalFluxConvective<dim,nspecies,nstate,real>(
60  std::make_unique< CentralBaselineNumericalFluxConvective<dim, nspecies, nstate, real> > (physics_input),
61  std::make_unique< LaxFriedrichsRiemannSolverDissipation<dim, nspecies, nstate, real> > (physics_input))
62 {}
63 
64 template <int dim, int nspecies, int nstate, typename real>
66  std::shared_ptr<Physics::PhysicsBase<dim, nspecies, nstate, real>> physics_input)
67  : NumericalFluxConvective<dim,nspecies,nstate,real>(
68  std::make_unique< CentralBaselineNumericalFluxConvective<dim, nspecies, nstate, real> > (physics_input),
69  std::make_unique< RoePikeRiemannSolverDissipation<dim, nspecies, nstate, real> > (physics_input))
70 {}
71 
72 template <int dim, int nspecies, int nstate, typename real>
74  std::shared_ptr<Physics::PhysicsBase<dim, nspecies, nstate, real>> physics_input)
75  : NumericalFluxConvective<dim,nspecies,nstate,real>(
76  std::make_unique< CentralBaselineNumericalFluxConvective<dim, nspecies, nstate, real> > (physics_input),
77  std::make_unique< L2RoeRiemannSolverDissipation<dim, nspecies, nstate, real> > (physics_input))
78 {}
79 
80 template <int dim, int nspecies, int nstate, typename real>
82  std::shared_ptr<Physics::PhysicsBase<dim, nspecies, nstate, real>> physics_input)
83  : NumericalFluxConvective<dim,nspecies,nstate,real>(
84  std::make_unique< CentralBaselineNumericalFluxConvective<dim, nspecies, nstate, real> > (physics_input),
85  std::make_unique< ZeroRiemannSolverDissipation<dim, nspecies, nstate, real> > ())
86 {}
87 
88 template <int dim, int nspecies, int nstate, typename real>
90  std::shared_ptr<Physics::PhysicsBase<dim, nspecies, nstate, real>> physics_input)
91  : NumericalFluxConvective<dim,nspecies,nstate,real>(
92  std::make_unique< EntropyConservingBaselineNumericalFluxConvective<dim, nspecies, nstate, real> > (physics_input),
93  std::make_unique< ZeroRiemannSolverDissipation<dim, nspecies, nstate, real> > ())
94 {}
95 
96 template <int dim, int nspecies, int nstate, typename real>
98  std::shared_ptr<Physics::PhysicsBase<dim, nspecies, nstate, real>> physics_input)
99  : NumericalFluxConvective<dim,nspecies,nstate,real>(
100  std::make_unique< EntropyConservingBaselineNumericalFluxConvective<dim, nspecies, nstate, real> > (physics_input),
101  std::make_unique< LaxFriedrichsRiemannSolverDissipation<dim, nspecies, nstate, real> > (physics_input))
102 {}
103 
104 template <int dim, int nspecies, int nstate, typename real>
106  std::shared_ptr<Physics::PhysicsBase<dim, nspecies, nstate, real>> physics_input)
107  : NumericalFluxConvective<dim,nspecies,nstate,real>(
108  std::make_unique< EntropyConservingBaselineNumericalFluxConvective<dim, nspecies, nstate, real> > (physics_input),
109  std::make_unique< RoePikeRiemannSolverDissipation<dim, nspecies, nstate, real> > (physics_input))
110 {}
111 
112 template <int dim, int nspecies, int nstate, typename real>
114  std::shared_ptr<Physics::PhysicsBase<dim, nspecies, nstate, real>> physics_input)
115  : NumericalFluxConvective<dim,nspecies,nstate,real>(
116  std::make_unique< EntropyConservingBaselineNumericalFluxConvective<dim, nspecies, nstate, real> > (physics_input),
117  std::make_unique< L2RoeRiemannSolverDissipation<dim, nspecies, nstate, real> > (physics_input))
118 {}
119 
120 template <int dim, int nspecies, int nstate, typename real>
122  const std::array<real, nstate> &soln_int,
123  const std::array<real, nstate> &soln_ext,
124  const dealii::Tensor<1,dim,real> &normal_int) const
125 {
126  using RealArrayVector = std::array<dealii::Tensor<1,dim,real>,nstate>;
127  RealArrayVector conv_phys_flux_int;
128  RealArrayVector conv_phys_flux_ext;
129 
130  conv_phys_flux_int = pde_physics->convective_flux (soln_int);
131  conv_phys_flux_ext = pde_physics->convective_flux (soln_ext);
132 
133  RealArrayVector flux_avg;
134  for (int s=0; s<nstate; s++) {
135  flux_avg[s] = 0.0;
136  for (int d=0; d<dim; ++d) {
137  flux_avg[s][d] = 0.5*(conv_phys_flux_int[s][d] + conv_phys_flux_ext[s][d]);
138  }
139  }
140 
141  std::array<real, nstate> numerical_flux_dot_n;
142  for (int s=0; s<nstate; s++) {
143  real flux_dot_n = 0.0;
144  for (int d=0; d<dim; ++d) {
145  flux_dot_n += flux_avg[s][d]*normal_int[d];
146  }
147  numerical_flux_dot_n[s] = flux_dot_n;
148  }
149  return numerical_flux_dot_n;
150 }
151 
152 template <int dim, int nspecies, int nstate, typename real>
154  const std::array<real, nstate> &soln_int,
155  const std::array<real, nstate> &soln_ext,
156  const dealii::Tensor<1,dim,real> &normal_int) const
157 {
158  using RealArrayVector = std::array<dealii::Tensor<1,dim,real>,nstate>;
159  RealArrayVector conv_phys_split_flux;
160 
161  conv_phys_split_flux = pde_physics->convective_numerical_split_flux (soln_int,soln_ext);
162 
163  // Scalar dissipation
164  std::array<real, nstate> numerical_flux_dot_n;
165  for (int s=0; s<nstate; s++) {
166  real flux_dot_n = 0.0;
167  for (int d=0; d<dim; ++d) {
168  flux_dot_n += conv_phys_split_flux[s][d] * normal_int[d];
169  }
170  numerical_flux_dot_n[s] = flux_dot_n;
171  }
172  return numerical_flux_dot_n;
173 }
174 
175 template<int dim, int nspecies, int nstate, typename real>
178  const std::array<real, nstate> &/*soln_int*/,
179  const std::array<real, nstate> &/*soln_ext*/,
180  const dealii::Tensor<1,dim,real> &/*normal_int*/) const
181 {
182  // zero upwind dissipation
183  std::array<real, nstate> numerical_flux_dot_n;
184  numerical_flux_dot_n.fill(0.0);
185  return numerical_flux_dot_n;
186 }
187 
188 template<int dim, int nspecies, int nstate, typename real>
191  const std::array<real, nstate> &soln_int,
192  const std::array<real, nstate> &soln_ext,
193  const dealii::Tensor<1,dim,real> &normal_int) const
194 {
195  const real conv_max_eig_int = pde_physics->max_convective_normal_eigenvalue(soln_int,normal_int);
196  const real conv_max_eig_ext = pde_physics->max_convective_normal_eigenvalue(soln_ext,normal_int);
197  // Replaced the std::max with an if-statement for the AD to work properly.
198  //const real conv_max_eig = std::max(conv_max_eig_int, conv_max_eig_ext);
199  real conv_max_eig;
200  if (conv_max_eig_int > conv_max_eig_ext) {
201  conv_max_eig = conv_max_eig_int;
202  } else {
203  conv_max_eig = conv_max_eig_ext;
204  }
205  //conv_max_eig = std::max(conv_max_eig_int, conv_max_eig_ext);
206  // Scalar dissipation
207  std::array<real, nstate> numerical_flux_dot_n;
208  for (int s=0; s<nstate; s++) {
209  numerical_flux_dot_n[s] = - 0.5 * conv_max_eig * (soln_ext[s]-soln_int[s]);
210  }
211 
212  return numerical_flux_dot_n;
213 }
214 
215 template <int dim, int nspecies, int nstate, typename real>
218  const std::array<real, 3> &eig_L,
219  const std::array<real, 3> &eig_R,
220  std::array<real, 3> &eig_RoeAvg,
221  const real /*vel2_ravg*/,
222  const real /*sound_ravg*/) const
223 {
224  // Harten's entropy fix
225  // -- See Blazek 2015, p.103-105
226  for(int e=0;e<3;e++) {
227  const real eps = std::max(abs(eig_RoeAvg[e] - eig_L[e]), abs(eig_R[e] - eig_RoeAvg[e]));
228  if(eig_RoeAvg[e] < eps) {
229  eig_RoeAvg[e] = 0.5*(eig_RoeAvg[e] * eig_RoeAvg[e]/eps + eps);
230  }
231  }
232 }
233 
234 template <int dim, int nspecies, int nstate, typename real>
237  const std::array<real, nstate> &/*soln_int*/,
238  const std::array<real, nstate> &/*soln_ext*/,
239  const std::array<real, 3> &/*eig_L*/,
240  const std::array<real, 3> &/*eig_R*/,
241  real &/*dV_normal*/,
242  dealii::Tensor<1,dim,real> &/*dV_tangent*/
243  ) const
244 {
245  // No additional modifications for the Roe-Pike scheme
246 }
247 
248 template <int dim, int nspecies, int nstate, typename real>
251  const std::array<real, 3> &eig_L,
252  const std::array<real, 3> &eig_R,
253  int &ssw_LEFT,
254  int &ssw_RIGHT) const
255 {
256  // Shock indicator of Wada & Liou (1994 Flux) -- Eq.(39)
257  // -- See also p.74 of Osswald et al. (2016 L2Roe)
258 
259  ssw_LEFT=0; ssw_RIGHT=0; // initialize
260 
261  // ssw_L: i=L --> j=R
262  if((eig_L[0]>0.0 && eig_R[0]<0.0) || (eig_L[2]>0.0 && eig_R[2]<0.0)) {
263  ssw_LEFT = 1;
264  }
265 
266  // ssw_R: i=R --> j=L
267  if((eig_R[0]>0.0 && eig_L[0]<0.0) || (eig_R[2]>0.0 && eig_L[2]<0.0)) {
268  ssw_RIGHT = 1;
269  }
270 }
271 
272 template <int dim, int nspecies, int nstate, typename real>
275  const std::array<real, 3> &eig_L,
276  const std::array<real, 3> &eig_R,
277  std::array<real, 3> &eig_RoeAvg,
278  const real vel2_ravg,
279  const real sound_ravg) const
280 {
281  // Van Leer et al. (1989 Sonic) entropy fix for acoustic waves
282  // -- p.74 of Osswald et al. (2016 L2Roe)
283  for(int e=0;e<3;e++) {
284  if(e!=1) {
285  // const real deig = std::max((eig_R[e]-eig_L[e]), 0.0);
286  const real deig = std::max(static_cast<real>(eig_R[e] - eig_L[e]), static_cast<real>(0.0));
287  if(eig_RoeAvg[e] < 2.0*deig) {
288  eig_RoeAvg[e] = 0.25*(eig_RoeAvg[e] * eig_RoeAvg[e]/deig) + deig;
289  }
290  }
291  }
292 
293  // Entropy fix of Liou (2000 Mass)
294  // -- p.74 of Osswald et al. (2016 L2Roe)
295  int ssw_L, ssw_R;
296  evaluate_shock_indicator(eig_L,eig_R,ssw_L,ssw_R);
297  if(ssw_L!=0 || ssw_R!=0) {
298  eig_RoeAvg[1] = std::max(sound_ravg, static_cast<real>(sqrt(vel2_ravg)));
299  }
300 }
301 
302 template <int dim, int nspecies, int nstate, typename real>
305  const std::array<real, nstate> &soln_int,
306  const std::array<real, nstate> &soln_ext,
307  const std::array<real, 3> &eig_L,
308  const std::array<real, 3> &eig_R,
309  real &dV_normal,
310  dealii::Tensor<1,dim,real> &dV_tangent) const
311 {
312  const real mach_number_L = this->euler_physics->compute_mach_number(soln_int);
313  const real mach_number_R = this->euler_physics->compute_mach_number(soln_ext);
314 
315  // Osswald's two modifications to Roe-Pike scheme --> L2Roe
316  // - Blending factor (variable 'z' in reference)
317  const real blending_factor = std::min(static_cast<real>(1.0), std::max(mach_number_L,mach_number_R));
318  // - Scale jump in (1) normal and (2) tangential velocities
319  int ssw_L, ssw_R;
320  evaluate_shock_indicator(eig_L,eig_R,ssw_L,ssw_R);
321  if(ssw_L==0 && ssw_R==0)
322  {
323  dV_normal *= blending_factor;
324  for (int d=0;d<dim;d++)
325  {
326  dV_tangent[d] *= blending_factor;
327  }
328  }
329 }
330 
331 template <int dim, int nspecies, int nstate, typename real>
334  const std::array<real, nstate> &soln_int,
335  const std::array<real, nstate> &soln_ext,
336  const dealii::Tensor<1,dim,real> &normal_int) const
337 {
338  // See Blazek 2015, p.103-105
339  // -- Note: Modified calculation of alpha_{3,4} to use
340  // dVt (jump in tangential velocities);
341  // expressions are equivalent
342 
343  // Blazek 2015
344  // p. 103-105
345  // Note: This is in fact the Roe-Pike method of Roe & Pike (1984 - Efficient)
346  const std::array<real,nstate> prim_soln_int = euler_physics->convert_conservative_to_primitive(soln_int);
347  const std::array<real,nstate> prim_soln_ext = euler_physics->convert_conservative_to_primitive(soln_ext);
348  // Left cell
349  const real density_L = prim_soln_int[0];
350  const dealii::Tensor< 1,dim,real > velocities_L = euler_physics->extract_velocities_from_primitive(prim_soln_int);
351  const real pressure_L = prim_soln_int[nstate-1];
352 
353  //const real normal_vel_L = velocities_L*normal_int;
354  real normal_vel_L = 0.0;
355  for (int d=0; d<dim; ++d) {
356  normal_vel_L+= velocities_L[d]*normal_int[d];
357  }
358  const real specific_enthalpy_L = euler_physics->compute_specific_enthalpy(soln_int, pressure_L);
359 
360  // Right cell
361  const real density_R = prim_soln_ext[0];
362  const dealii::Tensor< 1,dim,real > velocities_R = euler_physics->extract_velocities_from_primitive(prim_soln_ext);
363  const real pressure_R = prim_soln_ext[nstate-1];
364 
365  //const real normal_vel_R = velocities_R*normal_int;
366  real normal_vel_R = 0.0;
367  for (int d=0; d<dim; ++d) {
368  normal_vel_R+= velocities_R[d]*normal_int[d];
369  }
370  const real specific_enthalpy_R = euler_physics->compute_specific_enthalpy(soln_ext, pressure_R);
371 
372  // Roe-averaged states
373  const real r = sqrt(density_R/density_L);
374  const real rp1 = r+1.0;
375 
376  const real density_ravg = r*density_L;
377  //const dealii::Tensor< 1,dim,real > velocities_ravg = (r*velocities_R + velocities_L) / rp1;
378  dealii::Tensor< 1,dim,real > velocities_ravg;
379  for (int d=0; d<dim; ++d) {
380  velocities_ravg[d] = (r*velocities_R[d] + velocities_L[d]) / rp1;
381  }
382  const real specific_total_enthalpy_ravg = (r*specific_enthalpy_R + specific_enthalpy_L) / rp1;
383 
384  const real vel2_ravg = euler_physics->compute_velocity_squared (velocities_ravg);
385  //const real normal_vel_ravg = velocities_ravg*normal_int;
386  real normal_vel_ravg = 0.0;
387  for (int d=0; d<dim; ++d) {
388  normal_vel_ravg += velocities_ravg[d]*normal_int[d];
389  }
390 
391  const real sound2_ravg = euler_physics->gamm1*(specific_total_enthalpy_ravg-0.5*vel2_ravg);
392  real sound_ravg = 1e10;
393  if (sound2_ravg > 0.0) {
394  sound_ravg = sqrt(sound2_ravg);
395  }
396 
397  // Compute eigenvalues
398  std::array<real, 3> eig_ravg;
399  eig_ravg[0] = abs(normal_vel_ravg-sound_ravg);
400  eig_ravg[1] = abs(normal_vel_ravg);
401  eig_ravg[2] = abs(normal_vel_ravg+sound_ravg);
402 
403  const real sound_L = euler_physics->compute_sound(density_L, pressure_L);
404  std::array<real, 3> eig_L;
405  eig_L[0] = abs(normal_vel_L-sound_L);
406  eig_L[1] = abs(normal_vel_L);
407  eig_L[2] = abs(normal_vel_L+sound_L);
408 
409  const real sound_R = euler_physics->compute_sound(density_R, pressure_R);
410  std::array<real, 3> eig_R;
411  eig_R[0] = abs(normal_vel_R-sound_R);
412  eig_R[1] = abs(normal_vel_R);
413  eig_R[2] = abs(normal_vel_R+sound_R);
414 
415  // Jumps in pressure and density
416  const real dp = pressure_R - pressure_L;
417  const real drho = density_R - density_L;
418 
419  // Jump in normal velocity
420  real dVn = normal_vel_R-normal_vel_L;
421 
422  // Jumps in tangential velocities
423  dealii::Tensor<1,dim,real> dVt;
424  for (int d=0;d<dim;d++) {
425  dVt[d] = (velocities_R[d] - velocities_L[d]) - dVn*normal_int[d];
426  }
427 
428  // Evaluate entropy fix on wave speeds
429  evaluate_entropy_fix (eig_L, eig_R, eig_ravg, vel2_ravg, sound_ravg);
430 
431  // Evaluate additional modifications to the Roe-Pike scheme (if applicable)
432  evaluate_additional_modifications (soln_int, soln_ext, eig_L, eig_R, dVn, dVt);
433 
434  // Product of eigenvalues and wave strengths
435  real coeff[4];
436  coeff[0] = eig_ravg[0]*(dp-density_ravg*sound_ravg*dVn)/(2.0*sound2_ravg);
437  coeff[1] = eig_ravg[1]*(drho - dp/sound2_ravg);
438  coeff[2] = eig_ravg[1]*density_ravg;
439  coeff[3] = eig_ravg[2]*(dp+density_ravg*sound_ravg*dVn)/(2.0*sound2_ravg);
440 
441  // Evaluate |A_Roe| * (W_R - W_L)
442  std::array<real,nstate> AdW;
443 
444  // Vn-c (i=1)
445  AdW[0] = coeff[0] * 1.0;
446  for (int d=0;d<dim;d++) {
447  AdW[1+d] = coeff[0] * (velocities_ravg[d] - sound_ravg * normal_int[d]);
448  }
449  AdW[nstate-1] = coeff[0] * (specific_total_enthalpy_ravg - sound_ravg*normal_vel_ravg);
450 
451  // Vn (i=2)
452  AdW[0] += coeff[1] * 1.0;
453  for (int d=0;d<dim;d++) {
454  AdW[1+d] += coeff[1] * velocities_ravg[d];
455  }
456  AdW[nstate-1] += coeff[1] * vel2_ravg * 0.5;
457 
458  // (i=3,4)
459  AdW[0] += coeff[2] * 0.0;
460  real dVt_dot_vel_ravg = 0.0;
461  for (int d=0;d<dim;d++) {
462  AdW[1+d] += coeff[2]*dVt[d];
463  dVt_dot_vel_ravg += velocities_ravg[d]*dVt[d];
464  }
465  AdW[nstate-1] += coeff[2]*dVt_dot_vel_ravg;
466 
467  // Vn+c (i=5)
468  AdW[0] += coeff[3] * 1.0;
469  for (int d=0;d<dim;d++) {
470  AdW[1+d] += coeff[3] * (velocities_ravg[d] + sound_ravg * normal_int[d]);
471  }
472  AdW[nstate-1] += coeff[3] * (specific_total_enthalpy_ravg + sound_ravg*normal_vel_ravg);
473 
474  std::array<real, nstate> numerical_flux_dot_n;
475  for (int s=0; s<nstate; s++) {
476  numerical_flux_dot_n[s] = - 0.5 * AdW[s];
477  }
478 
479  return numerical_flux_dot_n;
480 }
481 
482 #if PHILIP_SPECIES==1
483  // Define a sequence of indices representing the range [1, 6]
484  #define POSSIBLE_NSTATE (1)(2)(3)(4)(5)(6)
485 
486  // Define a macro to instantiate functions for a specific nstate
487  #define INSTANTIATE_UPTO_NSTATE6(r, data, nstate) \
488  template class NumericalFluxConvective<PHILIP_DIM, PHILIP_SPECIES, nstate, double>; \
489  template class NumericalFluxConvective<PHILIP_DIM, PHILIP_SPECIES, nstate, FadType>; \
490  template class NumericalFluxConvective<PHILIP_DIM, PHILIP_SPECIES, nstate, RadType>; \
491  template class NumericalFluxConvective<PHILIP_DIM, PHILIP_SPECIES, nstate, FadFadType>; \
492  template class NumericalFluxConvective<PHILIP_DIM, PHILIP_SPECIES, nstate, RadFadType>; \
493  \
494  template class LaxFriedrichs<PHILIP_DIM, PHILIP_SPECIES, nstate, double>; \
495  template class LaxFriedrichs<PHILIP_DIM, PHILIP_SPECIES, nstate, FadType>; \
496  template class LaxFriedrichs<PHILIP_DIM, PHILIP_SPECIES, nstate, RadType>; \
497  template class LaxFriedrichs<PHILIP_DIM, PHILIP_SPECIES, nstate, FadFadType>; \
498  template class LaxFriedrichs<PHILIP_DIM, PHILIP_SPECIES, nstate, RadFadType>; \
499  \
500  template class BaselineNumericalFluxConvective<PHILIP_DIM, PHILIP_SPECIES, nstate, double>; \
501  template class BaselineNumericalFluxConvective<PHILIP_DIM, PHILIP_SPECIES, nstate, FadType>; \
502  template class BaselineNumericalFluxConvective<PHILIP_DIM, PHILIP_SPECIES, nstate, RadType>; \
503  template class BaselineNumericalFluxConvective<PHILIP_DIM, PHILIP_SPECIES, nstate, FadFadType>; \
504  template class BaselineNumericalFluxConvective<PHILIP_DIM, PHILIP_SPECIES, nstate, RadFadType>; \
505  \
506  template class CentralBaselineNumericalFluxConvective<PHILIP_DIM, PHILIP_SPECIES, nstate, double>; \
507  template class CentralBaselineNumericalFluxConvective<PHILIP_DIM, PHILIP_SPECIES, nstate, FadType>; \
508  template class CentralBaselineNumericalFluxConvective<PHILIP_DIM, PHILIP_SPECIES, nstate, RadType>; \
509  template class CentralBaselineNumericalFluxConvective<PHILIP_DIM, PHILIP_SPECIES, nstate, FadFadType>; \
510  template class CentralBaselineNumericalFluxConvective<PHILIP_DIM, PHILIP_SPECIES, nstate, RadFadType>; \
511  \
512  template class RiemannSolverDissipation<PHILIP_DIM, PHILIP_SPECIES, nstate, double>; \
513  template class RiemannSolverDissipation<PHILIP_DIM, PHILIP_SPECIES, nstate, FadType>; \
514  template class RiemannSolverDissipation<PHILIP_DIM, PHILIP_SPECIES, nstate, RadType>; \
515  template class RiemannSolverDissipation<PHILIP_DIM, PHILIP_SPECIES, nstate, FadFadType>; \
516  template class RiemannSolverDissipation<PHILIP_DIM, PHILIP_SPECIES, nstate, RadFadType>; \
517  \
518  template class LaxFriedrichsRiemannSolverDissipation<PHILIP_DIM, PHILIP_SPECIES, nstate, double>; \
519  template class LaxFriedrichsRiemannSolverDissipation<PHILIP_DIM, PHILIP_SPECIES, nstate, FadType>; \
520  template class LaxFriedrichsRiemannSolverDissipation<PHILIP_DIM, PHILIP_SPECIES, nstate, RadType>; \
521  template class LaxFriedrichsRiemannSolverDissipation<PHILIP_DIM, PHILIP_SPECIES, nstate, FadFadType>; \
522  template class LaxFriedrichsRiemannSolverDissipation<PHILIP_DIM, PHILIP_SPECIES, nstate, RadFadType>;
523  BOOST_PP_SEQ_FOR_EACH(INSTANTIATE_UPTO_NSTATE6, _, POSSIBLE_NSTATE)
524 
525  // Removes nstate 6 from list, if you want to compile the function in INSTANTIATE_UPTO_NSTATE5 for nstate 6, then comment the two lines defining new nstate list
526  #undef POSSIBLE_NSTATE
527  #define POSSIBLE_NSTATE (1)(2)(3)(4)(5)
528 
529  #define INSTANTIATE_UPTO_NSTATE5(r, data, nstate) \
530  template class Central<PHILIP_DIM, PHILIP_SPECIES, nstate, double>; \
531  template class Central<PHILIP_DIM, PHILIP_SPECIES, nstate, FadType>; \
532  template class Central<PHILIP_DIM, PHILIP_SPECIES, nstate, RadType>; \
533  template class Central<PHILIP_DIM, PHILIP_SPECIES, nstate, FadFadType>; \
534  template class Central<PHILIP_DIM, PHILIP_SPECIES, nstate, RadFadType>; \
535  \
536  template class EntropyConserving<PHILIP_DIM, PHILIP_SPECIES, nstate, double>; \
537  template class EntropyConserving<PHILIP_DIM, PHILIP_SPECIES, nstate, FadType>; \
538  template class EntropyConserving<PHILIP_DIM, PHILIP_SPECIES, nstate, RadType>; \
539  template class EntropyConserving<PHILIP_DIM, PHILIP_SPECIES, nstate, FadFadType>; \
540  template class EntropyConserving<PHILIP_DIM, PHILIP_SPECIES, nstate, RadFadType>; \
541  \
542  template class EntropyConservingWithLaxFriedrichsDissipation<PHILIP_DIM, PHILIP_SPECIES, nstate, double>; \
543  template class EntropyConservingWithLaxFriedrichsDissipation<PHILIP_DIM, PHILIP_SPECIES, nstate, FadType>; \
544  template class EntropyConservingWithLaxFriedrichsDissipation<PHILIP_DIM, PHILIP_SPECIES, nstate, RadType>; \
545  template class EntropyConservingWithLaxFriedrichsDissipation<PHILIP_DIM, PHILIP_SPECIES, nstate, FadFadType>; \
546  template class EntropyConservingWithLaxFriedrichsDissipation<PHILIP_DIM, PHILIP_SPECIES, nstate, RadFadType>; \
547  \
548  template class EntropyConservingBaselineNumericalFluxConvective<PHILIP_DIM, PHILIP_SPECIES, nstate, double>; \
549  template class EntropyConservingBaselineNumericalFluxConvective<PHILIP_DIM, PHILIP_SPECIES, nstate, FadType>; \
550  template class EntropyConservingBaselineNumericalFluxConvective<PHILIP_DIM, PHILIP_SPECIES, nstate, RadType>; \
551  template class EntropyConservingBaselineNumericalFluxConvective<PHILIP_DIM, PHILIP_SPECIES, nstate, FadFadType>; \
552  template class EntropyConservingBaselineNumericalFluxConvective<PHILIP_DIM, PHILIP_SPECIES, nstate, RadFadType>; \
553  \
554  template class ZeroRiemannSolverDissipation<PHILIP_DIM, PHILIP_SPECIES, nstate, double>; \
555  template class ZeroRiemannSolverDissipation<PHILIP_DIM, PHILIP_SPECIES, nstate, FadType>; \
556  template class ZeroRiemannSolverDissipation<PHILIP_DIM, PHILIP_SPECIES, nstate, RadType>; \
557  template class ZeroRiemannSolverDissipation<PHILIP_DIM, PHILIP_SPECIES, nstate, FadFadType>; \
558  template class ZeroRiemannSolverDissipation<PHILIP_DIM, PHILIP_SPECIES, nstate, RadFadType>;
559  BOOST_PP_SEQ_FOR_EACH(INSTANTIATE_UPTO_NSTATE5, _, POSSIBLE_NSTATE)
560 
561  // Instantiation for NSTATE = DIM + 2 with different types
562  #define POSSIBLE_TYPE (double)(FadType)(RadType)(FadFadType)(RadFadType)
563 
564  #define INSTANTIATE_TYPES(r, data, type) \
565  template class RoePike<PHILIP_DIM, PHILIP_SPECIES, PHILIP_DIM+2, type>; \
566  template class L2Roe<PHILIP_DIM, PHILIP_SPECIES, PHILIP_DIM+2, type >; \
567  template class EntropyConservingWithRoeDissipation<PHILIP_DIM, PHILIP_SPECIES, PHILIP_DIM+2, type>; \
568  template class EntropyConservingWithL2RoeDissipation<PHILIP_DIM, PHILIP_SPECIES, PHILIP_DIM+2, type>; \
569  template class RoeBaseRiemannSolverDissipation<PHILIP_DIM, PHILIP_SPECIES, PHILIP_DIM+2, type>; \
570  template class RoePikeRiemannSolverDissipation<PHILIP_DIM, PHILIP_SPECIES, PHILIP_DIM+2, type>; \
571  template class L2RoeRiemannSolverDissipation<PHILIP_DIM, PHILIP_SPECIES, PHILIP_DIM+2, type>;
572  BOOST_PP_SEQ_FOR_EACH(INSTANTIATE_TYPES, _, POSSIBLE_TYPE)
573 #else
574  #define POSSIBLE_TYPE (double)(FadType)(RadType)(FadFadType)(RadFadType)
575  #define INSTANTIATE_TYPES(r, data, type) \
576  template class NumericalFluxConvective<PHILIP_DIM, PHILIP_SPECIES, PHILIP_DIM+PHILIP_SPECIES+1, type>; \
577  template class Central<PHILIP_DIM, PHILIP_SPECIES, PHILIP_DIM+PHILIP_SPECIES+1, type>; \
578  template class LaxFriedrichs<PHILIP_DIM, PHILIP_SPECIES, PHILIP_DIM+PHILIP_SPECIES+1, type>; \
579  template class BaselineNumericalFluxConvective<PHILIP_DIM, PHILIP_SPECIES, PHILIP_DIM+PHILIP_SPECIES+1, type>; \
580  template class CentralBaselineNumericalFluxConvective<PHILIP_DIM, PHILIP_SPECIES, PHILIP_DIM+PHILIP_SPECIES+1, type>; \
581  template class RiemannSolverDissipation<PHILIP_DIM, PHILIP_SPECIES, PHILIP_DIM+PHILIP_SPECIES+1, type>; \
582  template class LaxFriedrichsRiemannSolverDissipation<PHILIP_DIM, PHILIP_SPECIES, PHILIP_DIM+PHILIP_SPECIES+1, type>; \
583  template class EntropyConserving<PHILIP_DIM, PHILIP_SPECIES, PHILIP_DIM+PHILIP_SPECIES+1, type>; \
584  template class EntropyConservingWithLaxFriedrichsDissipation<PHILIP_DIM, PHILIP_SPECIES, PHILIP_DIM+PHILIP_SPECIES+1, type>;
585  BOOST_PP_SEQ_FOR_EACH(INSTANTIATE_TYPES, _, POSSIBLE_TYPE)
586 #endif
587 } // NumericalFlux namespace
588 } // PHiLiP namespace
void evaluate_entropy_fix(const std::array< real, 3 > &eig_L, const std::array< real, 3 > &eig_R, std::array< real, 3 > &eig_RoeAvg, const real vel2_ravg, const real sound_ravg) const
std::array< real, nstate > evaluate_flux(const std::array< real, nstate > &soln_int, const std::array< real, nstate > &soln_ext, const dealii::Tensor< 1, dim, real > &normal1) const
Returns the convective numerical flux at an interface.
Central(std::shared_ptr< Physics::PhysicsBase< dim, nspecies, nstate, real >> physics_input)
Constructor.
Central numerical flux. Derived from BaselineNumericalFluxConvective.
std::array< real, nstate > evaluate_flux(const std::array< real, nstate > &soln_int, const std::array< real, nstate > &soln_ext, const dealii::Tensor< 1, dim, real > &normal1) const
Returns the convective numerical flux at an interface.
Base class from which Advection, Diffusion, ConvectionDiffusion, and Euler is derived.
Definition: physics.h:34
void evaluate_additional_modifications(const std::array< real, nstate > &soln_int, const std::array< real, nstate > &soln_ext, const std::array< real, 3 > &eig_L, const std::array< real, 3 > &eig_R, real &dV_normal, dealii::Tensor< 1, dim, real > &dV_tangent) const
Empty function. No additional modifications for the Roe-Pike scheme.
LaxFriedrichs(std::shared_ptr< Physics::PhysicsBase< dim, nspecies, nstate, real >> physics_input)
Constructor.
Files for the baseline physics.
Definition: ADTypes.hpp:10
L2Roe(std::shared_ptr< Physics::PhysicsBase< dim, nspecies, nstate, real >> physics_input)
Constructor.
NumericalFluxConvective(std::unique_ptr< BaselineNumericalFluxConvective< dim, nspecies, nstate, real > > baseline_input, std::unique_ptr< RiemannSolverDissipation< dim, nspecies, nstate, real > > riemann_solver_dissipation_input)
Constructor.
std::unique_ptr< RiemannSolverDissipation< dim, nspecies, nstate, real > > riemann_solver_dissipation
Upwind convective numerical flux object.
EntropyConservingWithRoeDissipation(std::shared_ptr< Physics::PhysicsBase< dim, nspecies, nstate, real >> physics_input)
Constructor.
Base class of Riemann solver dissipation (i.e. upwind-term) for numerical flux associated with convec...
void evaluate_entropy_fix(const std::array< real, 3 > &eig_L, const std::array< real, 3 > &eig_R, std::array< real, 3 > &eig_RoeAvg, const real vel2_ravg, const real sound_ravg) const
Base class of baseline numerical flux (without upwind term) associated with convection.
EntropyConservingWithLaxFriedrichsDissipation(std::shared_ptr< Physics::PhysicsBase< dim, nspecies, nstate, real >> physics_input)
Constructor.
std::unique_ptr< BaselineNumericalFluxConvective< dim, nspecies, nstate, real > > baseline
Baseline convective numerical flux object.
Base class of numerical flux associated with convection.
Lax-Friedrichs Riemann solver dissipation. Derived from RiemannSolverDissipation. ...
std::array< real, nstate > evaluate_riemann_solver_dissipation(const std::array< real, nstate > &soln_int, const std::array< real, nstate > &soln_ext, const dealii::Tensor< 1, dim, real > &normal1) const
RoePike flux with entropy fix. Derived from RoeBase.
std::array< real, nstate > evaluate_riemann_solver_dissipation(const std::array< real, nstate > &soln_int, const std::array< real, nstate > &soln_ext, const dealii::Tensor< 1, dim, real > &normal1) const
Zero Riemann solver dissipation. Derived from RiemannSolverDissipation.
void evaluate_shock_indicator(const std::array< real, 3 > &eig_L, const std::array< real, 3 > &eig_R, int &ssw_LEFT, int &ssw_RIGHT) const
void evaluate_additional_modifications(const std::array< real, nstate > &soln_int, const std::array< real, nstate > &soln_ext, const std::array< real, 3 > &eig_L, const std::array< real, 3 > &eig_R, real &dV_normal, dealii::Tensor< 1, dim, real > &dV_tangent) const
RoePike(std::shared_ptr< Physics::PhysicsBase< dim, nspecies, nstate, real >> physics_input)
Constructor.
std::array< real, nstate > evaluate_riemann_solver_dissipation(const std::array< real, nstate > &soln_int, const std::array< real, nstate > &soln_ext, const dealii::Tensor< 1, dim, real > &normal1) const
Returns zeros.
std::array< real, nstate > evaluate_flux(const std::array< real, nstate > &soln_int, const std::array< real, nstate > &soln_ext, const dealii::Tensor< 1, dim, real > &normal1) const
Returns the convective numerical flux at an interface.
EntropyConservingWithL2RoeDissipation(std::shared_ptr< Physics::PhysicsBase< dim, nspecies, nstate, real >> physics_input)
Constructor.
EntropyConserving(std::shared_ptr< Physics::PhysicsBase< dim, nspecies, nstate, real >> physics_input)
Constructor.
Entropy Conserving Numerical Flux. Derived from BaselineNumericalFluxConvective.