[P]arallel [Hi]gh-order [Li]brary for [P]DEs  Latest
Parallel High-Order Library for PDEs through hp-adaptive Discontinuous Galerkin methods
large_eddy_simulation.cpp
1 #include <cmath>
2 #include <vector>
3 #include <complex> // for the jacobian
4 
5 #include "ADTypes.hpp"
6 
7 #include "model.h"
8 #include "large_eddy_simulation.h"
9 
10 namespace PHiLiP {
11 namespace Physics {
12 
13 //================================================================
14 // Large Eddy Simulation (LES) Base Class
15 //================================================================
16 template <int dim, int nstate, typename real>
18  const Parameters::AllParameters *const parameters_input,
19  const double ref_length,
20  const double gamma_gas,
21  const double mach_inf,
22  const double angle_of_attack,
23  const double side_slip_angle,
24  const double prandtl_number,
25  const double reynolds_number_inf,
26  const bool use_constant_viscosity,
27  const double constant_viscosity,
28  const double temperature_inf,
29  const double turbulent_prandtl_number,
30  const double ratio_of_filter_width_to_cell_size,
31  const double isothermal_wall_temperature,
32  const thermal_boundary_condition_enum thermal_boundary_condition_type,
33  std::shared_ptr< ManufacturedSolutionFunction<dim,real> > manufactured_solution_function,
34  const two_point_num_flux_enum two_point_num_flux_type)
35  : ModelBase<dim,nstate,real>(manufactured_solution_function)
36  , turbulent_prandtl_number(turbulent_prandtl_number)
37  , ratio_of_filter_width_to_cell_size(ratio_of_filter_width_to_cell_size)
38  , navier_stokes_physics(std::make_unique < NavierStokes<dim,nstate,real> > (
39  parameters_input,
40  ref_length,
41  gamma_gas,
42  mach_inf,
43  angle_of_attack,
44  side_slip_angle,
45  prandtl_number,
46  reynolds_number_inf,
47  use_constant_viscosity,
48  constant_viscosity,
49  temperature_inf,
50  isothermal_wall_temperature,
51  thermal_boundary_condition_type,
52  manufactured_solution_function,
53  two_point_num_flux_type))
54 {
55  static_assert(nstate==dim+2, "ModelBase::LargeEddySimulationBase() should be created with nstate=dim+2");
56 }
57 //----------------------------------------------------------------
58 template <int dim, int nstate, typename real>
59 template<typename real2>
62  const dealii::Tensor<2,dim,real2> &tensor) const
63 {
64  real2 tensor_magnitude_sqr; // complex initializes it as 0+0i
65  if(std::is_same<real2,real>::value){
66  tensor_magnitude_sqr = 0.0;
67  }
68  for (int i=0; i<dim; ++i) {
69  for (int j=0; j<dim; ++j) {
70  tensor_magnitude_sqr += tensor[i][j]*tensor[i][j];
71  }
72  }
73  return tensor_magnitude_sqr;
74 }
75 //----------------------------------------------------------------
76 template <int dim, int nstate, typename real>
77 std::array<dealii::Tensor<1,dim,real>,nstate> LargeEddySimulationBase<dim,nstate,real>
79  const std::array<real,nstate> &/*conservative_soln*/) const
80 {
81  std::array<dealii::Tensor<1,dim,real>,nstate> conv_flux;
82  for (int i=0; i<nstate; i++) {
83  conv_flux[i] = 0; // No additional convective terms for Large Eddy Simulation
84  }
85  return conv_flux;
86 }
87 //----------------------------------------------------------------
88 template <int dim, int nstate, typename real>
89 std::array<dealii::Tensor<1,dim,real>,nstate> LargeEddySimulationBase<dim,nstate,real>
91  const std::array<real,nstate> &conservative_soln,
92  const std::array<dealii::Tensor<1,dim,real>,nstate> &solution_gradient,
93  const dealii::types::global_dof_index cell_index) const
94 {
95  return dissipative_flux_templated<real>(conservative_soln,solution_gradient,cell_index);
96 }
97 //----------------------------------------------------------------
98 template <int dim, int nstate, typename real>
99 template <typename real2>
100 std::array<dealii::Tensor<1,dim,real2>,nstate> LargeEddySimulationBase<dim,nstate,real>
102  const std::array<real2,nstate> &conservative_soln,
103  const std::array<dealii::Tensor<1,dim,real2>,nstate> &solution_gradient,
104  const dealii::types::global_dof_index cell_index) const
105 {
106  // Step 1,2: Primitive solution and Gradient of primitive solution
107  const std::array<dealii::Tensor<1,dim,real2>,nstate> primitive_soln_gradient = this->navier_stokes_physics->convert_conservative_gradient_to_primitive_gradient(conservative_soln, solution_gradient);
108  const std::array<real2,nstate> primitive_soln = this->navier_stokes_physics->convert_conservative_to_primitive(conservative_soln); // from Euler
109 
110  // Step 3: Viscous stress tensor, Velocities, Heat flux
111  const dealii::Tensor<1,dim,real2> vel = this->navier_stokes_physics->extract_velocities_from_primitive(primitive_soln); // from Euler
112  // Templated virtual member functions
113  dealii::Tensor<2,dim,real2> viscous_stress_tensor;
114  dealii::Tensor<1,dim,real2> heat_flux;
115  if constexpr(std::is_same<real2,real>::value){
116  viscous_stress_tensor = compute_SGS_stress_tensor(primitive_soln, primitive_soln_gradient,cell_index);
117  heat_flux = compute_SGS_heat_flux(primitive_soln, primitive_soln_gradient,cell_index);
118  }
119  else if constexpr(std::is_same<real2,FadType>::value){
120  viscous_stress_tensor = compute_SGS_stress_tensor_fad(primitive_soln, primitive_soln_gradient,cell_index);
121  heat_flux = compute_SGS_heat_flux_fad(primitive_soln, primitive_soln_gradient,cell_index);
122  }
123  else{
124  std::cout << "ERROR in physics/large_eddy_simulation.cpp --> dissipative_flux_templated(): real2!=real || real2!=FadType)" << std::endl;
125  std::abort();
126  }
127 
128  // Step 4: Construct viscous flux; Note: sign corresponds to LHS
129  std::array<dealii::Tensor<1,dim,real2>,nstate> viscous_flux
130  = this->navier_stokes_physics->dissipative_flux_given_velocities_viscous_stress_tensor_and_heat_flux(vel,viscous_stress_tensor,heat_flux);
131 
132  return viscous_flux;
133 }
134 //----------------------------------------------------------------
135 template <int dim, int nstate, typename real>
136 std::array<real,nstate> LargeEddySimulationBase<dim,nstate,real>
138  const std::array<real,nstate> &/*conservative_soln*/,
139  const dealii::Tensor<1,dim,real> &/*normal*/) const
140 {
141  std::array<real,nstate> eig;
142  eig.fill(0.0);
143  return eig;
144 }
145 //----------------------------------------------------------------
146 template <int dim, int nstate, typename real>
148 ::max_convective_eigenvalue (const std::array<real,nstate> &/*conservative_soln*/) const
149 {
150  const real max_eig = 0.0;
151  return max_eig;
152 }
153 //----------------------------------------------------------------
154 template <int dim, int nstate, typename real>
157  const std::array<real,nstate> &/*conservative_soln*/,
158  const dealii::Tensor<1,dim,real> &/*normal*/) const
159 {
160  const real max_eig = 0.0;
161  return max_eig;
162 }
163 //----------------------------------------------------------------
164 template <int dim, int nstate, typename real>
165 std::array<real,nstate> LargeEddySimulationBase<dim,nstate,real>
167  const dealii::Point<dim,real> &pos,
168  const std::array<real,nstate> &/*solution*/,
169  const real /*current_time*/,
170  const dealii::types::global_dof_index cell_index) const
171 {
172  /* TO DO Note: Since this is only used for the manufactured solution source term,
173  the grid spacing is fixed --> No AD wrt grid --> Can use same computation as NavierStokes
174  Acceptable if we can ensure that filter_width is the same everywhere in the domain
175  for the manufacture solution cases chosen
176  */
177  std::array<real,nstate> source_term = dissipative_source_term(pos,cell_index);
178  return source_term;
179 }
180 //----------------------------------------------------------------
181 template <int dim, int nstate, typename real>
183 ::get_filter_width (const dealii::types::global_dof_index cell_index) const
184 {
185  // Compute the LES filter width
190  const int cell_poly_degree = this->cellwise_poly_degree[cell_index];
191  const double cell_volume = this->cellwise_volume[cell_index];
192  double filter_width = pow(cell_volume, (1.0/3.0))/(cell_poly_degree+1);
193  // Resize given the ratio of filter width to cell size
194  filter_width *= ratio_of_filter_width_to_cell_size;
195 
196  return filter_width;
197 }
198 //----------------------------------------------------------------
199 // Returns the value from a CoDiPack or Sacado variable.
200 template<typename real>
201 double getValue(const real &x) {
202  if constexpr(std::is_same<real,double>::value) {
203  return x;
204  }
205  else if constexpr(std::is_same<real,FadType>::value) {
206  return x.val(); // sacado
207  }
208  else if constexpr(std::is_same<real,FadFadType>::value) {
209  return x.val().val(); // sacado
210  }
211  else if constexpr(std::is_same<real,RadType>::value) {
212  return x.value(); // CoDiPack
213  }
214  else if(std::is_same<real,RadFadType>::value) {
215  return x.value().value(); // CoDiPack
216  }
217 }
218 //----------------------------------------------------------------
219 template <int dim, int nstate, typename real>
220 dealii::Tensor<2,nstate,real> LargeEddySimulationBase<dim,nstate,real>
222  const std::array<real,nstate> &conservative_soln,
223  const std::array<dealii::Tensor<1,dim,real>,nstate> &solution_gradient,
224  const dealii::Tensor<1,dim,real> &normal,
225  const dealii::types::global_dof_index cell_index) const
226 {
227  using adtype = FadType;
228 
229  // Initialize AD objects
230  std::array<adtype,nstate> AD_conservative_soln;
231  std::array<dealii::Tensor<1,dim,adtype>,nstate> AD_solution_gradient;
232  for (int s=0; s<nstate; s++) {
233  adtype ADvar(nstate, s, getValue<real>(conservative_soln[s])); // create AD variable
234  AD_conservative_soln[s] = ADvar;
235  for (int d=0;d<dim;d++) {
236  AD_solution_gradient[s][d] = getValue<real>(solution_gradient[s][d]);
237  }
238  }
239 
240  // Compute AD dissipative flux
241  std::array<dealii::Tensor<1,dim,adtype>,nstate> AD_dissipative_flux = dissipative_flux_templated<adtype>(AD_conservative_soln, AD_solution_gradient, cell_index);
242 
243  // Assemble the directional Jacobian
244  dealii::Tensor<2,nstate,real> jacobian;
245  for (int sp=0; sp<nstate; sp++) {
246  // for each perturbed state (sp) variable
247  for (int s=0; s<nstate; s++) {
248  jacobian[s][sp] = 0.0;
249  for (int d=0;d<dim;d++) {
250  // Compute directional jacobian
251  jacobian[s][sp] += AD_dissipative_flux[s][d].dx(sp)*normal[d];
252  }
253  }
254  }
255  return jacobian;
256 }
257 //----------------------------------------------------------------
258 template <int dim, int nstate, typename real>
259 dealii::Tensor<2,nstate,real> LargeEddySimulationBase<dim,nstate,real>
261  const std::array<real,nstate> &conservative_soln,
262  const std::array<dealii::Tensor<1,dim,real>,nstate> &solution_gradient,
263  const dealii::Tensor<1,dim,real> &normal,
264  const int d_gradient,
265  const dealii::types::global_dof_index cell_index) const
266 {
267  using adtype = FadType;
268 
269  // Initialize AD objects
270  std::array<adtype,nstate> AD_conservative_soln;
271  std::array<dealii::Tensor<1,dim,adtype>,nstate> AD_solution_gradient;
272  for (int s=0; s<nstate; s++) {
273  AD_conservative_soln[s] = getValue<real>(conservative_soln[s]);
274  for (int d=0;d<dim;d++) {
275  if(d == d_gradient){
276  adtype ADvar(nstate, s, getValue<real>(solution_gradient[s][d])); // create AD variable
277  AD_solution_gradient[s][d] = ADvar;
278  }
279  else {
280  AD_solution_gradient[s][d] = getValue<real>(solution_gradient[s][d]);
281  }
282  }
283  }
284 
285  // Compute AD dissipative flux
286  std::array<dealii::Tensor<1,dim,adtype>,nstate> AD_dissipative_flux = dissipative_flux_templated<adtype>(AD_conservative_soln, AD_solution_gradient, cell_index);
287 
288  // Assemble the directional Jacobian
289  dealii::Tensor<2,nstate,real> jacobian;
290  for (int sp=0; sp<nstate; sp++) {
291  // for each perturbed state (sp) variable
292  for (int s=0; s<nstate; s++) {
293  jacobian[s][sp] = 0.0;
294  for (int d=0;d<dim;d++) {
295  // Compute directional jacobian
296  jacobian[s][sp] += AD_dissipative_flux[s][d].dx(sp)*normal[d];
297  }
298  }
299  }
300  return jacobian;
301 }
302 //----------------------------------------------------------------
303 template <int dim, int nstate, typename real>
304 std::array<real,nstate> LargeEddySimulationBase<dim,nstate,real>
306  const dealii::Point<dim,real> &pos) const
307 {
308  std::array<real,nstate> manufactured_solution;
309  for (int s=0; s<nstate; s++) {
310  manufactured_solution[s] = this->manufactured_solution_function->value (pos, s);
311  if (s==0) {
312  assert(manufactured_solution[s] > 0);
313  }
314  }
315  return manufactured_solution;
316 }
317 //----------------------------------------------------------------
318 template <int dim, int nstate, typename real>
319 std::array<dealii::Tensor<1,dim,real>,nstate> LargeEddySimulationBase<dim,nstate,real>
321  const dealii::Point<dim,real> &pos) const
322 {
323  std::vector<dealii::Tensor<1,dim,real>> manufactured_solution_gradient_dealii(nstate);
324  this->manufactured_solution_function->vector_gradient(pos,manufactured_solution_gradient_dealii);
325  std::array<dealii::Tensor<1,dim,real>,nstate> manufactured_solution_gradient;
326  for (int d=0;d<dim;d++) {
327  for (int s=0; s<nstate; s++) {
328  manufactured_solution_gradient[s][d] = manufactured_solution_gradient_dealii[s][d];
329  }
330  }
331  return manufactured_solution_gradient;
332 }
333 //----------------------------------------------------------------
334 template <int dim, int nstate, typename real>
335 std::array<real,nstate> LargeEddySimulationBase<dim,nstate,real>
337  const dealii::Point<dim,real> &pos,
338  const dealii::types::global_dof_index cell_index) const
339 {
344  // Get Manufactured Solution values
345  const std::array<real,nstate> manufactured_solution = get_manufactured_solution_value(pos); // from Euler
346 
347  // Get Manufactured Solution gradient
348  const std::array<dealii::Tensor<1,dim,real>,nstate> manufactured_solution_gradient = get_manufactured_solution_gradient(pos); // from Euler
349 
350  // Get Manufactured Solution hessian
351  std::array<dealii::SymmetricTensor<2,dim,real>,nstate> manufactured_solution_hessian;
352  for (int s=0; s<nstate; s++) {
353  dealii::SymmetricTensor<2,dim,real> hessian = this->manufactured_solution_function->hessian(pos,s);
354  for (int dr=0;dr<dim;dr++) {
355  for (int dc=0;dc<dim;dc++) {
356  manufactured_solution_hessian[s][dr][dc] = hessian[dr][dc];
357  }
358  }
359  }
360 
361  // First term -- wrt to the conservative variables
362  // This is similar, should simply provide this function a flux_directional_jacobian() -- could restructure later
363  dealii::Tensor<1,nstate,real> dissipative_flux_divergence;
364  for (int d=0;d<dim;d++) {
365  dealii::Tensor<1,dim,real> normal;
366  normal[d] = 1.0;
367  const dealii::Tensor<2,nstate,real> jacobian = dissipative_flux_directional_jacobian(manufactured_solution, manufactured_solution_gradient, normal, cell_index);
368 
369  // get the directional jacobian wrt gradient
370  std::array<dealii::Tensor<2,nstate,real>,dim> jacobian_wrt_gradient;
371  for (int d_gradient=0;d_gradient<dim;d_gradient++) {
372 
373  // get the directional jacobian wrt gradient component (x,y,z)
374  const dealii::Tensor<2,nstate,real> jacobian_wrt_gradient_component = dissipative_flux_directional_jacobian_wrt_gradient_component(manufactured_solution, manufactured_solution_gradient, normal, d_gradient, cell_index);
375 
376  // store each component in jacobian_wrt_gradient -- could do this in the function used above
377  for (int sr = 0; sr < nstate; ++sr) {
378  for (int sc = 0; sc < nstate; ++sc) {
379  jacobian_wrt_gradient[d_gradient][sr][sc] = jacobian_wrt_gradient_component[sr][sc];
380  }
381  }
382  }
383 
384  //dissipative_flux_divergence += jacobian*manufactured_solution_gradient[d]; <-- needs second term! (jac wrt gradient)
385  for (int sr = 0; sr < nstate; ++sr) {
386  real jac_grad_row = 0.0;
387  for (int sc = 0; sc < nstate; ++sc) {
388  jac_grad_row += jacobian[sr][sc]*manufactured_solution_gradient[sc][d]; // Euler is the same as this
389  // Second term -- wrt to the gradient of conservative variables
390  // -- add the contribution of each gradient component (e.g. x,y,z for dim==3)
391  for (int d_gradient=0;d_gradient<dim;d_gradient++) {
392  jac_grad_row += jacobian_wrt_gradient[d_gradient][sr][sc]*manufactured_solution_hessian[sc][d_gradient][d]; // symmetric so d indexing works both ways
393  }
394  }
395  dissipative_flux_divergence[sr] += jac_grad_row;
396  }
397  }
398  std::array<real,nstate> dissipative_source_term;
399  for (int s=0; s<nstate; s++) {
400  dissipative_source_term[s] = dissipative_flux_divergence[s];
401  }
402 
404 }
405 //----------------------------------------------------------------
406 //================================================================
407 // Smagorinsky eddy viscosity model
408 //================================================================
409 template <int dim, int nstate, typename real>
411  const Parameters::AllParameters *const parameters_input,
412  const double ref_length,
413  const double gamma_gas,
414  const double mach_inf,
415  const double angle_of_attack,
416  const double side_slip_angle,
417  const double prandtl_number,
418  const double reynolds_number_inf,
419  const bool use_constant_viscosity,
420  const double constant_viscosity,
421  const double temperature_inf,
422  const double turbulent_prandtl_number,
424  const double model_constant,
425  const double isothermal_wall_temperature,
426  const thermal_boundary_condition_enum thermal_boundary_condition_type,
428  const two_point_num_flux_enum two_point_num_flux_type)
429  : LargeEddySimulationBase<dim,nstate,real>(parameters_input,
430  ref_length,
431  gamma_gas,
432  mach_inf,
433  angle_of_attack,
434  side_slip_angle,
435  prandtl_number,
436  reynolds_number_inf,
437  use_constant_viscosity,
438  constant_viscosity,
439  temperature_inf,
440  turbulent_prandtl_number,
441  ratio_of_filter_width_to_cell_size,
442  isothermal_wall_temperature,
443  thermal_boundary_condition_type,
445  two_point_num_flux_type)
446  , model_constant(model_constant)
447 { }
448 //----------------------------------------------------------------
449 template <int dim, int nstate, typename real>
452  const dealii::types::global_dof_index cell_index) const
453 {
454  // Compute the filter width for the cell
455  const double filter_width = this->get_filter_width(cell_index);
456  // Product of the model constant (Cs) and the filter width (delta)
457  const double model_constant_times_filter_width = model_constant*filter_width;
458  return model_constant_times_filter_width;
459 }
460 //----------------------------------------------------------------
461 template <int dim, int nstate, typename real>
464  const std::array<real,nstate> &primitive_soln,
465  const std::array<dealii::Tensor<1,dim,real>,nstate> &primitive_soln_gradient,
466  const dealii::types::global_dof_index cell_index) const
467 {
468  return compute_eddy_viscosity_templated<real>(primitive_soln,primitive_soln_gradient,cell_index);
469 }
470 //----------------------------------------------------------------
471 template <int dim, int nstate, typename real>
474  const std::array<FadType,nstate> &primitive_soln,
475  const std::array<dealii::Tensor<1,dim,FadType>,nstate> &primitive_soln_gradient,
476  const dealii::types::global_dof_index cell_index) const
477 {
478  return compute_eddy_viscosity_templated<FadType>(primitive_soln,primitive_soln_gradient,cell_index);
479 }
480 //----------------------------------------------------------------
481 template <int dim, int nstate, typename real>
482 template<typename real2>
485  const std::array<real2,nstate> &/*primitive_soln*/,
486  const std::array<dealii::Tensor<1,dim,real2>,nstate> &primitive_soln_gradient,
487  const dealii::types::global_dof_index cell_index) const
488 {
489  // Get velocity gradient
490  const dealii::Tensor<2,dim,real2> vel_gradient
491  = this->navier_stokes_physics->extract_velocities_gradient_from_primitive_solution_gradient(primitive_soln_gradient);
492  // Get strain rate tensor
493  const dealii::Tensor<2,dim,real2> strain_rate_tensor
494  = this->navier_stokes_physics->compute_strain_rate_tensor(vel_gradient);
495 
496  // Product of the model constant (Cs) and the filter width (delta)
497  const real2 model_constant_times_filter_width = get_model_constant_times_filter_width(cell_index);
498  // Get magnitude of strain_rate_tensor
499  const real2 strain_rate_tensor_magnitude_sqr = this->template get_tensor_magnitude_sqr<real2>(strain_rate_tensor);
500  // Compute the eddy viscosity
501  const real2 eddy_viscosity = model_constant_times_filter_width*model_constant_times_filter_width*sqrt(2.0*strain_rate_tensor_magnitude_sqr);
502 
503  return eddy_viscosity;
504 }
505 //----------------------------------------------------------------
506 template <int dim, int nstate, typename real>
507 template<typename real2>
510  const std::array<real2,nstate> &primitive_soln,
511  const real2 eddy_viscosity) const
512 {
513  // Scaled non-dimensional eddy viscosity; See Plata 2019, Computers and Fluids, Eq.(12)
514  const real2 scaled_eddy_viscosity = primitive_soln[0]*eddy_viscosity;
515 
516  return scaled_eddy_viscosity;
517 }
518 //----------------------------------------------------------------
519 template <int dim, int nstate, typename real>
520 dealii::Tensor<1,dim,real> LargeEddySimulation_Smagorinsky<dim,nstate,real>
522  const std::array<real,nstate> &primitive_soln,
523  const std::array<dealii::Tensor<1,dim,real>,nstate> &primitive_soln_gradient,
524  const dealii::types::global_dof_index cell_index) const
525 {
526  return compute_SGS_heat_flux_templated<real>(primitive_soln,primitive_soln_gradient,cell_index);
527 }
528 //----------------------------------------------------------------
529 template <int dim, int nstate, typename real>
530 dealii::Tensor<1,dim,FadType> LargeEddySimulation_Smagorinsky<dim,nstate,real>
532  const std::array<FadType,nstate> &primitive_soln,
533  const std::array<dealii::Tensor<1,dim,FadType>,nstate> &primitive_soln_gradient,
534  const dealii::types::global_dof_index cell_index) const
535 {
536  return compute_SGS_heat_flux_templated<FadType>(primitive_soln,primitive_soln_gradient,cell_index);
537 }
538 //----------------------------------------------------------------
539 template <int dim, int nstate, typename real>
540 template<typename real2>
541 dealii::Tensor<1,dim,real2> LargeEddySimulation_Smagorinsky<dim,nstate,real>
543  const std::array<real2,nstate> &primitive_soln,
544  const std::array<dealii::Tensor<1,dim,real2>,nstate> &primitive_soln_gradient,
545  const dealii::types::global_dof_index cell_index) const
546 {
547  // Compute non-dimensional eddy viscosity; See Plata 2019, Computers and Fluids, Eq.(12)
548  real2 eddy_viscosity;
549  if constexpr(std::is_same<real2,real>::value){
550  eddy_viscosity = compute_eddy_viscosity(primitive_soln,primitive_soln_gradient,cell_index);
551  }
552  else if constexpr(std::is_same<real2,FadType>::value){
553  eddy_viscosity = compute_eddy_viscosity_fad(primitive_soln,primitive_soln_gradient,cell_index);
554  }
555  else{
556  std::cout << "ERROR in physics/large_eddy_simulation.cpp --> compute_SGS_heat_flux_templated(): real2 != real or FadType" << std::endl;
557  std::abort();
558  }
559 
560  // Scaled non-dimensional eddy viscosity; See Plata 2019, Computers and Fluids, Eq.(12)
561  const real2 scaled_eddy_viscosity = scale_eddy_viscosity_templated<real2>(primitive_soln,eddy_viscosity);
562 
563  // Compute scaled heat conductivity
564  const real2 scaled_heat_conductivity = this->navier_stokes_physics->compute_scaled_heat_conductivity_given_scaled_viscosity_coefficient_and_prandtl_number(scaled_eddy_viscosity,this->turbulent_prandtl_number);
565 
566  // Get temperature gradient
567  const dealii::Tensor<1,dim,real2> temperature_gradient = this->navier_stokes_physics->compute_temperature_gradient(primitive_soln, primitive_soln_gradient);
568 
569  // Compute the SGS stress tensor via the eddy_viscosity and the strain rate tensor
570  dealii::Tensor<1,dim,real2> heat_flux_SGS = this->navier_stokes_physics->compute_heat_flux_given_scaled_heat_conductivity_and_temperature_gradient(scaled_heat_conductivity,temperature_gradient);
571 
572  return heat_flux_SGS;
573 }
574 //----------------------------------------------------------------
575 template <int dim, int nstate, typename real>
576 dealii::Tensor<2,dim,real> LargeEddySimulation_Smagorinsky<dim,nstate,real>
578  const std::array<real,nstate> &primitive_soln,
579  const std::array<dealii::Tensor<1,dim,real>,nstate> &primitive_soln_gradient,
580  const dealii::types::global_dof_index cell_index) const
581 {
582  return compute_SGS_stress_tensor_templated<real>(primitive_soln,primitive_soln_gradient,cell_index);
583 }
584 //----------------------------------------------------------------
585 template <int dim, int nstate, typename real>
586 dealii::Tensor<2,dim,FadType> LargeEddySimulation_Smagorinsky<dim,nstate,real>
588  const std::array<FadType,nstate> &primitive_soln,
589  const std::array<dealii::Tensor<1,dim,FadType>,nstate> &primitive_soln_gradient,
590  const dealii::types::global_dof_index cell_index) const
591 {
592  return compute_SGS_stress_tensor_templated<FadType>(primitive_soln,primitive_soln_gradient,cell_index);
593 }
594 //----------------------------------------------------------------
595 template <int dim, int nstate, typename real>
596 template<typename real2>
597 dealii::Tensor<2,dim,real2> LargeEddySimulation_Smagorinsky<dim,nstate,real>
599  const std::array<real2,nstate> &primitive_soln,
600  const std::array<dealii::Tensor<1,dim,real2>,nstate> &primitive_soln_gradient,
601  const dealii::types::global_dof_index cell_index) const
602 {
603  // Compute non-dimensional eddy viscosity; See Plata 2019, Computers and Fluids, Eq.(12)
604  real2 eddy_viscosity;
605  if constexpr(std::is_same<real2,real>::value){
606  eddy_viscosity = compute_eddy_viscosity(primitive_soln,primitive_soln_gradient,cell_index);
607  }
608  else if constexpr(std::is_same<real2,FadType>::value){
609  eddy_viscosity = compute_eddy_viscosity_fad(primitive_soln,primitive_soln_gradient,cell_index);
610  }
611  else{
612  std::cout << "ERROR in physics/large_eddy_simulation.cpp --> compute_SGS_stress_tensor_templated(): real2 != real or FadType" << std::endl;
613  std::abort();
614  }
615 
616  // Scaled non-dimensional eddy viscosity; See Plata 2019, Computers and Fluids, Eq.(12)
617  const real2 scaled_eddy_viscosity = scale_eddy_viscosity_templated<real2>(primitive_soln,eddy_viscosity);
618 
619  // Get velocity gradients
620  const dealii::Tensor<2,dim,real2> vel_gradient
621  = this->navier_stokes_physics->extract_velocities_gradient_from_primitive_solution_gradient(primitive_soln_gradient);
622 
623  // Get strain rate tensor
624  const dealii::Tensor<2,dim,real2> strain_rate_tensor
625  = this->navier_stokes_physics->compute_strain_rate_tensor(vel_gradient);
626 
627  // Compute the SGS stress tensor via the eddy_viscosity and the strain rate tensor
628  dealii::Tensor<2,dim,real2> SGS_stress_tensor;
629  SGS_stress_tensor = this->navier_stokes_physics->compute_viscous_stress_tensor_via_scaled_viscosity_and_strain_rate_tensor(scaled_eddy_viscosity,strain_rate_tensor);
630 
631  return SGS_stress_tensor;
632 }
633 //----------------------------------------------------------------
634 //================================================================
635 // WALE (Wall-Adapting Local Eddy-viscosity) eddy viscosity model
636 //================================================================
637 template <int dim, int nstate, typename real>
639  const Parameters::AllParameters *const parameters_input,
640  const double ref_length,
641  const double gamma_gas,
642  const double mach_inf,
643  const double angle_of_attack,
644  const double side_slip_angle,
645  const double prandtl_number,
646  const double reynolds_number_inf,
647  const bool use_constant_viscosity,
648  const double constant_viscosity,
649  const double temperature_inf,
650  const double turbulent_prandtl_number,
652  const double model_constant,
653  const double isothermal_wall_temperature,
654  const thermal_boundary_condition_enum thermal_boundary_condition_type,
656  const two_point_num_flux_enum two_point_num_flux_type)
657  : LargeEddySimulation_Smagorinsky<dim,nstate,real>(parameters_input,
658  ref_length,
659  gamma_gas,
660  mach_inf,
661  angle_of_attack,
662  side_slip_angle,
663  prandtl_number,
664  reynolds_number_inf,
665  use_constant_viscosity,
666  constant_viscosity,
667  temperature_inf,
668  turbulent_prandtl_number,
669  ratio_of_filter_width_to_cell_size,
670  model_constant,
671  isothermal_wall_temperature,
672  thermal_boundary_condition_type,
674  two_point_num_flux_type)
675 { }
676 //----------------------------------------------------------------
677 template <int dim, int nstate, typename real>
680  const std::array<real,nstate> &primitive_soln,
681  const std::array<dealii::Tensor<1,dim,real>,nstate> &primitive_soln_gradient,
682  const dealii::types::global_dof_index cell_index) const
683 {
684  return compute_eddy_viscosity_templated<real>(primitive_soln,primitive_soln_gradient,cell_index);
685 }
686 //----------------------------------------------------------------
687 template <int dim, int nstate, typename real>
690  const std::array<FadType,nstate> &primitive_soln,
691  const std::array<dealii::Tensor<1,dim,FadType>,nstate> &primitive_soln_gradient,
692  const dealii::types::global_dof_index cell_index) const
693 {
694  return compute_eddy_viscosity_templated<FadType>(primitive_soln,primitive_soln_gradient,cell_index);
695 }
696 //----------------------------------------------------------------
697 template <int dim, int nstate, typename real>
698 template<typename real2>
701  const std::array<real2,nstate> &/*primitive_soln*/,
702  const std::array<dealii::Tensor<1,dim,real2>,nstate> &primitive_soln_gradient,
703  const dealii::types::global_dof_index cell_index) const
704 {
705  const dealii::Tensor<2,dim,real2> vel_gradient
706  = this->navier_stokes_physics->extract_velocities_gradient_from_primitive_solution_gradient(primitive_soln_gradient);
707  const dealii::Tensor<2,dim,real2> strain_rate_tensor
708  = this->navier_stokes_physics->compute_strain_rate_tensor(vel_gradient);
709 
710  // Product of the model constant (Cs) and the filter width (delta)
711  const real2 model_constant_times_filter_width = this->get_model_constant_times_filter_width(cell_index);
712 
716  // -- Compute $\bm{g}^{2}$
717  dealii::Tensor<2,dim,real2> g_sqr; // $g_{ij}^{2}$
718  for (int i=0; i<dim; ++i) {
719  for (int j=0; j<dim; ++j) {
720 
721  real2 val;if(std::is_same<real2,real>::value){val = 0.0;}
722 
723  for (int k=0; k<dim; ++k) {
724  val += vel_gradient[i][k]*vel_gradient[k][j];
725  }
726  g_sqr[i][j] = val;
727  }
728  }
729  real2 trace_g_sqr;if(std::is_same<real2,real>::value){trace_g_sqr = 0.0;}
730  for (int k=0; k<dim; ++k) {
731  trace_g_sqr += g_sqr[k][k];
732  }
733  dealii::Tensor<2,dim,real2> traceless_symmetric_square_of_velocity_gradient_tensor;
734  for (int i=0; i<dim; ++i) {
735  for (int j=0; j<dim; ++j) {
736  traceless_symmetric_square_of_velocity_gradient_tensor[i][j] = 0.5*(g_sqr[i][j]+g_sqr[j][i]);
737  }
738  }
739  for (int k=0; k<dim; ++k) {
740  traceless_symmetric_square_of_velocity_gradient_tensor[k][k] += -(1.0/3.0)*trace_g_sqr;
741  }
742 
743  // Get magnitude of strain_rate_tensor and ducros_strain_rate_tensor
744  const real2 strain_rate_tensor_magnitude_sqr = this->template get_tensor_magnitude_sqr<real2>(strain_rate_tensor);
745  const real2 traceless_symmetric_square_of_velocity_gradient_tensor_magnitude_sqr = this->template get_tensor_magnitude_sqr<real2>(traceless_symmetric_square_of_velocity_gradient_tensor);
746  // Compute the eddy viscosity
747  // -- Initialize as zero
748  real2 eddy_viscosity;if(std::is_same<real2,real>::value){eddy_viscosity = 0.0;}
749  if((strain_rate_tensor_magnitude_sqr != 0.0) &&
750  (traceless_symmetric_square_of_velocity_gradient_tensor_magnitude_sqr != 0.0)) {
757  eddy_viscosity = model_constant_times_filter_width*model_constant_times_filter_width*pow(traceless_symmetric_square_of_velocity_gradient_tensor_magnitude_sqr,1.5)/(pow(strain_rate_tensor_magnitude_sqr,2.5) + pow(traceless_symmetric_square_of_velocity_gradient_tensor_magnitude_sqr,1.25));
758  }
759 
760  return eddy_viscosity;
761 }
762 //----------------------------------------------------------------
763 //================================================================
764 // Vreman eddy viscosity model
765 //================================================================
766 template <int dim, int nstate, typename real>
768  const Parameters::AllParameters *const parameters_input,
769  const double ref_length,
770  const double gamma_gas,
771  const double mach_inf,
772  const double angle_of_attack,
773  const double side_slip_angle,
774  const double prandtl_number,
775  const double reynolds_number_inf,
776  const bool use_constant_viscosity,
777  const double constant_viscosity,
778  const double temperature_inf,
779  const double turbulent_prandtl_number,
781  const double model_constant,
782  const double isothermal_wall_temperature,
783  const thermal_boundary_condition_enum thermal_boundary_condition_type,
785  const two_point_num_flux_enum two_point_num_flux_type)
786  : LargeEddySimulation_Smagorinsky<dim,nstate,real>(parameters_input,
787  ref_length,
788  gamma_gas,
789  mach_inf,
790  angle_of_attack,
791  side_slip_angle,
792  prandtl_number,
793  reynolds_number_inf,
794  use_constant_viscosity,
795  constant_viscosity,
796  temperature_inf,
797  turbulent_prandtl_number,
798  ratio_of_filter_width_to_cell_size,
799  model_constant,
800  isothermal_wall_temperature,
801  thermal_boundary_condition_type,
803  two_point_num_flux_type)
804 { }
805 //----------------------------------------------------------------
806 template <int dim, int nstate, typename real>
809  const std::array<real,nstate> &primitive_soln,
810  const std::array<dealii::Tensor<1,dim,real>,nstate> &primitive_soln_gradient,
811  const dealii::types::global_dof_index cell_index) const
812 {
813  return compute_eddy_viscosity_templated<real>(primitive_soln,primitive_soln_gradient,cell_index);
814 }
815 //----------------------------------------------------------------
816 template <int dim, int nstate, typename real>
819  const std::array<FadType,nstate> &primitive_soln,
820  const std::array<dealii::Tensor<1,dim,FadType>,nstate> &primitive_soln_gradient,
821  const dealii::types::global_dof_index cell_index) const
822 {
823  return compute_eddy_viscosity_templated<FadType>(primitive_soln,primitive_soln_gradient,cell_index);
824 }
825 //----------------------------------------------------------------
826 template <int dim, int nstate, typename real>
827 template<typename real2>
830  const std::array<real2,nstate> &/*primitive_soln*/,
831  const std::array<dealii::Tensor<1,dim,real2>,nstate> &primitive_soln_gradient,
832  const dealii::types::global_dof_index cell_index) const
833 {
834  const dealii::Tensor<2,dim,real2> vel_gradient
835  = this->navier_stokes_physics->extract_velocities_gradient_from_primitive_solution_gradient(primitive_soln_gradient);
836 
837  // Compute the filter width for the cell
838  const double filter_width = this->get_filter_width(cell_index);
839 
842  // -- Compute $\bm{beta}$
843  dealii::Tensor<2,dim,real2> beta_tensor;
844  for (int i=0; i<dim; ++i) {
845  for (int j=0; j<dim; ++j) {
846 
847  real2 val;if(std::is_same<real2,real>::value){val = 0.0;}
848 
849  for (int k=0; k<dim; ++k) {
850  val += vel_gradient[i][k]*vel_gradient[j][k];
851  }
852  beta_tensor[i][j] = filter_width*filter_width*val; // for isotropic filter width
853  }
854  }
855  // Reference: Vreman (2004) - Equation (8) - $B_{\beta}$ (determinant of beta tensor -- symmetrical)
856  real2 beta_tensor_determinant;if(std::is_same<real2,real>::value){beta_tensor_determinant = 0.0;}
857  if constexpr(dim>1){
858  beta_tensor_determinant = beta_tensor[0][0]*beta_tensor[1][1] - beta_tensor[0][1]*beta_tensor[0][1];
859  }
860  if constexpr(dim==3){
861  for (int i=0; i<2; ++i) {
862  beta_tensor_determinant += beta_tensor[i][i]*beta_tensor[2][2] - beta_tensor[i][2]*beta_tensor[i][2];
863  }
864  }
865 
866  // Get magnitude of velocity gradient tensor squared
867  const real2 velocity_gradient_tensor_magnitude_sqr = this->template get_tensor_magnitude_sqr<real2>(vel_gradient);
868  // Compute the eddy viscosity
869  // -- Initialize as zero
870  real2 eddy_viscosity;if(std::is_same<real2,real>::value){eddy_viscosity = 0.0;}
871  if((velocity_gradient_tensor_magnitude_sqr !=0.0) && (beta_tensor_determinant >= 0.0)) {
879  // Reference: Vreman (2004) - Equation (5)
880  eddy_viscosity = this->model_constant*sqrt(beta_tensor_determinant/velocity_gradient_tensor_magnitude_sqr);
881  }
882 
883  return eddy_viscosity;
884 }
885 //----------------------------------------------------------------
886 //----------------------------------------------------------------
887 //----------------------------------------------------------------
888 // Instantiate explicitly
889 // -- LargeEddySimulationBase
895 // -- LargeEddySimulation_Smagorinsky
901 // -- LargeEddySimulation_WALE
907 // -- LargeEddySimulation_Vreman
913 //-------------------------------------------------------------------------------------
914 // Templated members used by derived classes, defined in respective parent classes
915 //-------------------------------------------------------------------------------------
916 // -- get_tensor_magnitude_sqr()
917 template double LargeEddySimulationBase < PHILIP_DIM, PHILIP_DIM+2, double >::get_tensor_magnitude_sqr< double >(const dealii::Tensor<2,PHILIP_DIM,double > &tensor) const;
918 template FadType LargeEddySimulationBase < PHILIP_DIM, PHILIP_DIM+2, FadType >::get_tensor_magnitude_sqr< FadType >(const dealii::Tensor<2,PHILIP_DIM,FadType > &tensor) const;
919 template RadType LargeEddySimulationBase < PHILIP_DIM, PHILIP_DIM+2, RadType >::get_tensor_magnitude_sqr< RadType >(const dealii::Tensor<2,PHILIP_DIM,RadType > &tensor) const;
920 template FadFadType LargeEddySimulationBase < PHILIP_DIM, PHILIP_DIM+2, FadFadType >::get_tensor_magnitude_sqr< FadFadType >(const dealii::Tensor<2,PHILIP_DIM,FadFadType> &tensor) const;
921 template RadFadType LargeEddySimulationBase < PHILIP_DIM, PHILIP_DIM+2, RadFadType >::get_tensor_magnitude_sqr< RadFadType >(const dealii::Tensor<2,PHILIP_DIM,RadFadType> &tensor) const;
922 // -- -- instantiate all the real types with real2 = FadType for automatic differentiation
923 template FadType LargeEddySimulationBase < PHILIP_DIM, PHILIP_DIM+2, double >::get_tensor_magnitude_sqr< FadType >(const dealii::Tensor<2,PHILIP_DIM,FadType > &tensor) const;
924 template FadType LargeEddySimulationBase < PHILIP_DIM, PHILIP_DIM+2, RadType >::get_tensor_magnitude_sqr< FadType >(const dealii::Tensor<2,PHILIP_DIM,FadType > &tensor) const;
925 template FadType LargeEddySimulationBase < PHILIP_DIM, PHILIP_DIM+2, FadFadType >::get_tensor_magnitude_sqr< FadType >(const dealii::Tensor<2,PHILIP_DIM,FadType > &tensor) const;
926 template FadType LargeEddySimulationBase < PHILIP_DIM, PHILIP_DIM+2, RadFadType >::get_tensor_magnitude_sqr< FadType >(const dealii::Tensor<2,PHILIP_DIM,FadType > &tensor) const;
927 
928 
929 } // Physics namespace
930 } // PHiLiP namespace
virtual dealii::Tensor< 2, dim, real > compute_SGS_stress_tensor(const std::array< real, nstate > &primitive_soln, const std::array< dealii::Tensor< 1, dim, real >, nstate > &primitive_soln_gradient, const dealii::types::global_dof_index cell_index) const =0
Nondimensionalized sub-grid scale (SGS) stress tensor, (tau^sgs)*.
virtual FadType compute_eddy_viscosity_fad(const std::array< FadType, nstate > &primitive_soln, const std::array< dealii::Tensor< 1, dim, FadType >, nstate > &primitive_soln_gradient, const dealii::types::global_dof_index cell_index) const
Nondimensionalized eddy viscosity for the Smagorinsky model (Automatic Differentiation Type: FadType)...
std::shared_ptr< ManufacturedSolutionFunction< dim, real > > manufactured_solution_function
Manufactured solution function.
Definition: model.h:29
real2 get_tensor_magnitude_sqr(const dealii::Tensor< 2, dim, real2 > &tensor) const
Returns the square of the magnitude of the tensor (i.e. the double dot product of a tensor with itsel...
const double turbulent_prandtl_number
Turbulent Prandtl number.
virtual dealii::Tensor< 2, dim, FadType > compute_SGS_stress_tensor_fad(const std::array< FadType, nstate > &primitive_soln, const std::array< dealii::Tensor< 1, dim, FadType >, nstate > &primitive_soln_gradient, const dealii::types::global_dof_index cell_index) const =0
Nondimensionalized sub-grid scale (SGS) stress tensor, (tau^sgs)* (Automatic Differentiation Type: Fa...
virtual dealii::Tensor< 1, dim, real > compute_SGS_heat_flux(const std::array< real, nstate > &primitive_soln, const std::array< dealii::Tensor< 1, dim, real >, nstate > &primitive_soln_gradient, const dealii::types::global_dof_index cell_index) const =0
Nondimensionalized sub-grid scale (SGS) heat flux, (q^sgs)*.
Sacado::Fad::DFad< FadType > FadFadType
Sacado AD type that allows 2nd derivatives.
Definition: ADTypes.hpp:12
Smagorinsky eddy viscosity model. Derived from Large Eddy Simulation.
dealii::Tensor< 2, nstate, real > dissipative_flux_directional_jacobian_wrt_gradient_component(const std::array< real, nstate > &conservative_soln, const std::array< dealii::Tensor< 1, dim, real >, nstate > &solution_gradient, const dealii::Tensor< 1, dim, real > &normal, const int d_gradient, const dealii::types::global_dof_index cell_index) const
virtual real compute_eddy_viscosity(const std::array< real, nstate > &primitive_soln, const std::array< dealii::Tensor< 1, dim, real >, nstate > &primitive_soln_gradient, const dealii::types::global_dof_index cell_index) const
Nondimensionalized eddy viscosity for the Smagorinsky model.
Sacado::Fad::DFad< double > FadType
Sacado AD type for first derivatives.
Definition: ADTypes.hpp:11
std::array< real, nstate > get_manufactured_solution_value(const dealii::Point< dim, real > &pos) const
Get manufactured solution value (repeated from Euler)
Manufactured solution used for grid studies to check convergence orders.
WALE (Wall-Adapting Local Eddy-viscosity) eddy viscosity model. Derived from LargeEddySimulation_Smag...
real max_convective_eigenvalue(const std::array< real, nstate > &soln) const
Maximum convective eigenvalue of the additional models&#39; PDEs.
codi_JacobianComputationType RadType
CoDiPaco reverse-AD type for first derivatives.
Definition: ADTypes.hpp:27
dealii::Tensor< 2, nstate, real > dissipative_flux_directional_jacobian(const std::array< real, nstate > &conservative_soln, const std::array< dealii::Tensor< 1, dim, real >, nstate > &solution_gradient, const dealii::Tensor< 1, dim, real > &normal, const dealii::types::global_dof_index cell_index) const
std::array< real, nstate > convective_eigenvalues(const std::array< real, nstate > &, const dealii::Tensor< 1, dim, real > &) const override
Convective eigenvalues of the additional models&#39; PDEs.
std::array< real, nstate > source_term(const dealii::Point< dim, real > &pos, const std::array< real, nstate > &solution, const real current_time, const dealii::types::global_dof_index cell_index) const
Source term for manufactured solution functions.
Files for the baseline physics.
Definition: ADTypes.hpp:10
LargeEddySimulation_WALE(const Parameters::AllParameters *const parameters_input, const double ref_length, const double gamma_gas, const double mach_inf, const double angle_of_attack, const double side_slip_angle, const double prandtl_number, const double reynolds_number_inf, const bool use_constant_viscosity, const double constant_viscosity, const double temperature_inf, const double turbulent_prandtl_number, const double ratio_of_filter_width_to_cell_size, const double model_constant, const double isothermal_wall_temperature=1.0, const thermal_boundary_condition_enum thermal_boundary_condition_type=thermal_boundary_condition_enum::adiabatic, std::shared_ptr< ManufacturedSolutionFunction< dim, real > > manufactured_solution_function=nullptr, const two_point_num_flux_enum two_point_num_flux_type=two_point_num_flux_enum::KG)
real2 compute_eddy_viscosity_templated(const std::array< real2, nstate > &primitive_soln, const std::array< dealii::Tensor< 1, dim, real2 >, nstate > &primitive_soln_gradient, const dealii::types::global_dof_index cell_index) const
Physics model additional terms and equations to the baseline physics.
Definition: model.h:18
dealii::Tensor< 1, dim, real > compute_SGS_heat_flux(const std::array< real, nstate > &primitive_soln, const std::array< dealii::Tensor< 1, dim, real >, nstate > &primitive_soln_gradient, const dealii::types::global_dof_index cell_index) const
Nondimensionalized sub-grid scale (SGS) heat flux, (q^sgs)*.
dealii::Tensor< 2, dim, FadType > compute_SGS_stress_tensor_fad(const std::array< FadType, nstate > &primitive_soln, const std::array< dealii::Tensor< 1, dim, FadType >, nstate > &primitive_soln_gradient, const dealii::types::global_dof_index cell_index) const
Nondimensionalized sub-grid scale (SGS) stress tensor, (tau^sgs)* (Automatic Differentiation Type: Fa...
dealii::Tensor< 1, dim, real2 > compute_SGS_heat_flux_templated(const std::array< real2, nstate > &primitive_soln, const std::array< dealii::Tensor< 1, dim, real2 >, nstate > &primitive_soln_gradient, const dealii::types::global_dof_index cell_index) const
Templated nondimensionalized sub-grid scale (SGS) heat flux, (q^sgs)*.
FadType compute_eddy_viscosity_fad(const std::array< FadType, nstate > &primitive_soln, const std::array< dealii::Tensor< 1, dim, FadType >, nstate > &primitive_soln_gradient, const dealii::types::global_dof_index cell_index) const override
Main parameter class that contains the various other sub-parameter classes.
std::array< real, nstate > dissipative_source_term(const dealii::Point< dim, real > &pos, const dealii::types::global_dof_index cell_index) const
Dissipative flux contribution to the source term (repeated from NavierStokes)
std::unique_ptr< NavierStokes< dim, nstate, real > > navier_stokes_physics
Pointer to Navier-Stokes physics object.
TwoPointNumericalFlux
Two point numerical flux type for split form.
LargeEddySimulationBase(const Parameters::AllParameters *const parameters_input, const double ref_length, const double gamma_gas, const double mach_inf, const double angle_of_attack, const double side_slip_angle, const double prandtl_number, const double reynolds_number_inf, const bool use_constant_viscosity, const double constant_viscosity, const double temperature_inf, const double turbulent_prandtl_number, const double ratio_of_filter_width_to_cell_size, const double isothermal_wall_temperature=1.0, const thermal_boundary_condition_enum thermal_boundary_condition_type=thermal_boundary_condition_enum::adiabatic, std::shared_ptr< ManufacturedSolutionFunction< dim, real > > manufactured_solution_function=nullptr, const two_point_num_flux_enum two_point_num_flux_type=two_point_num_flux_enum::KG)
Constructor.
real max_convective_normal_eigenvalue(const std::array< real, nstate > &soln, const dealii::Tensor< 1, dim, real > &normal) const
Maximum convective normal eigenvalue (used in Lax-Friedrichs) of the additional models&#39; PDEs...
real compute_eddy_viscosity(const std::array< real, nstate > &primitive_soln, const std::array< dealii::Tensor< 1, dim, real >, nstate > &primitive_soln_gradient, const dealii::types::global_dof_index cell_index) const override
Large Eddy Simulation equations. Derived from Navier-Stokes for modifying the stress tensor and heat ...
real compute_eddy_viscosity(const std::array< real, nstate > &primitive_soln, const std::array< dealii::Tensor< 1, dim, real >, nstate > &primitive_soln_gradient, const dealii::types::global_dof_index cell_index) const override
real2 compute_eddy_viscosity_templated(const std::array< real2, nstate > &primitive_soln, const std::array< dealii::Tensor< 1, dim, real2 >, nstate > &primitive_soln_gradient, const dealii::types::global_dof_index cell_index) const
Templated nondimensionalized eddy viscosity for the Smagorinsky model.
std::array< dealii::Tensor< 1, dim, real >, nstate > convective_flux(const std::array< real, nstate > &conservative_soln) const
Convective flux: .
Vreman eddy viscosity model. Derived from LargeEddySimulation_Smagorinsky for only modifying compute_...
dealii::LinearAlgebra::distributed::Vector< int > cellwise_poly_degree
Cellwise polynomial degree.
Definition: model.h:107
LargeEddySimulation_Smagorinsky(const Parameters::AllParameters *const parameters_input, const double ref_length, const double gamma_gas, const double mach_inf, const double angle_of_attack, const double side_slip_angle, const double prandtl_number, const double reynolds_number_inf, const bool use_constant_viscosity, const double constant_viscosity, const double temperature_inf, const double turbulent_prandtl_number, const double ratio_of_filter_width_to_cell_size, const double model_constant, const double isothermal_wall_temperature=1.0, const thermal_boundary_condition_enum thermal_boundary_condition_type=thermal_boundary_condition_enum::adiabatic, std::shared_ptr< ManufacturedSolutionFunction< dim, real > > manufactured_solution_function=nullptr, const two_point_num_flux_enum two_point_num_flux_type=two_point_num_flux_enum::KG)
virtual dealii::Tensor< 1, dim, FadType > compute_SGS_heat_flux_fad(const std::array< FadType, nstate > &primitive_soln, const std::array< dealii::Tensor< 1, dim, FadType >, nstate > &primitive_soln_gradient, const dealii::types::global_dof_index cell_index) const =0
Nondimensionalized sub-grid scale (SGS) heat flux, (q^sgs)* (Automatic Differentiation Type: FadType)...
LargeEddySimulation_Vreman(const Parameters::AllParameters *const parameters_input, const double ref_length, const double gamma_gas, const double mach_inf, const double angle_of_attack, const double side_slip_angle, const double prandtl_number, const double reynolds_number_inf, const bool use_constant_viscosity, const double constant_viscosity, const double temperature_inf, const double turbulent_prandtl_number, const double ratio_of_filter_width_to_cell_size, const double model_constant, const double isothermal_wall_temperature=1.0, const thermal_boundary_condition_enum thermal_boundary_condition_type=thermal_boundary_condition_enum::adiabatic, std::shared_ptr< ManufacturedSolutionFunction< dim, real > > manufactured_solution_function=nullptr, const two_point_num_flux_enum two_point_num_flux_type=two_point_num_flux_enum::KG)
dealii::Tensor< 2, dim, real > compute_SGS_stress_tensor(const std::array< real, nstate > &primitive_soln, const std::array< dealii::Tensor< 1, dim, real >, nstate > &primitive_soln_gradient, const dealii::types::global_dof_index cell_index) const
Nondimensionalized sub-grid scale (SGS) stress tensor, (tau^sgs)*.
double get_model_constant_times_filter_width(const dealii::types::global_dof_index cell_index) const
Returns the product of the eddy viscosity model constant and the filter width.
std::array< dealii::Tensor< 1, dim, real >, nstate > dissipative_flux(const std::array< real, nstate > &conservative_soln, const std::array< dealii::Tensor< 1, dim, real >, nstate > &solution_gradient, const dealii::types::global_dof_index cell_index) const
Dissipative (i.e. viscous) flux: .
dealii::Tensor< 2, dim, real2 > compute_SGS_stress_tensor_templated(const std::array< real2, nstate > &primitive_soln, const std::array< dealii::Tensor< 1, dim, real2 >, nstate > &primitive_soln_gradient, const dealii::types::global_dof_index cell_index) const
Templated nondimensionalized sub-grid scale (SGS) stress tensor, (tau^sgs)*.
real2 compute_eddy_viscosity_templated(const std::array< real2, nstate > &primitive_soln, const std::array< dealii::Tensor< 1, dim, real2 >, nstate > &primitive_soln_gradient, const dealii::types::global_dof_index cell_index) const
ThermalBoundaryCondition
Types of thermal boundary conditions available.
dealii::Tensor< 1, dim, FadType > compute_SGS_heat_flux_fad(const std::array< FadType, nstate > &primitive_soln, const std::array< dealii::Tensor< 1, dim, FadType >, nstate > &primitive_soln_gradient, const dealii::types::global_dof_index cell_index) const
Nondimensionalized sub-grid scale (SGS) heat flux, (q^sgs)* (Automatic Differentiation Type: FadType)...
FadType compute_eddy_viscosity_fad(const std::array< FadType, nstate > &primitive_soln, const std::array< dealii::Tensor< 1, dim, FadType >, nstate > &primitive_soln_gradient, const dealii::types::global_dof_index cell_index) const override
codi_HessianComputationType RadFadType
Nested reverse-forward mode type for Jacobian and Hessian computation using TapeHelper.
Definition: ADTypes.hpp:28
double get_filter_width(const dealii::types::global_dof_index cell_index) const
Compute the nondimensionalized filter width used by the SGS model given a cell index.
std::array< dealii::Tensor< 1, dim, real >, nstate > get_manufactured_solution_gradient(const dealii::Point< dim, real > &pos) const
Get manufactured solution value (repeated from Euler)
Navier-Stokes equations. Derived from Euler for the convective terms, which is derived from PhysicsBa...
Definition: navier_stokes.h:12
const double ratio_of_filter_width_to_cell_size
Ratio of filter width to cell size.
real2 scale_eddy_viscosity_templated(const std::array< real2, nstate > &primitive_soln, const real2 eddy_viscosity) const
Templated scale nondimensionalized eddy viscosity for Smagorinsky model.
std::array< dealii::Tensor< 1, dim, real2 >, nstate > dissipative_flux_templated(const std::array< real2, nstate > &conservative_soln, const std::array< dealii::Tensor< 1, dim, real2 >, nstate > &solution_gradient, const dealii::types::global_dof_index cell_index) const
Templated dissipative (i.e. viscous) flux: .