1 #ifndef __LARGE_EDDY_SIMULATION__ 2 #define __LARGE_EDDY_SIMULATION__ 5 #include "navier_stokes.h" 12 template <
int dim,
int nspecies,
int nstate,
typename real>
21 const double ref_length,
22 const double gamma_gas,
23 const double mach_inf,
24 const double angle_of_attack,
25 const double side_slip_angle,
26 const double prandtl_number,
27 const double reynolds_number_inf,
28 const bool use_constant_viscosity,
29 const double constant_viscosity,
30 const double temperature_inf,
33 const double isothermal_wall_temperature = 1.0,
49 const std::array<real,nstate> &conservative_soln)
const;
53 const std::array<real,nstate> &conservative_soln,
54 const std::array<dealii::Tensor<1,dim,real>,nstate> &solution_gradient,
55 const dealii::types::global_dof_index cell_index)
const;
59 const std::array<real,nstate> &solution,
60 const std::array<dealii::Tensor<1,dim,real>,nstate> &solution_gradient,
61 const std::array<real,nstate> &filtered_solution,
62 const std::array<dealii::Tensor<1,dim,real>,nstate> &filtered_solution_gradient,
63 const bool on_boundary,
64 const dealii::types::global_dof_index cell_index,
65 const dealii::Tensor<1,dim,real> &normal,
66 const int boundary_type)
const;
71 const std::array<real,nstate> &,
72 const dealii::Tensor<1,dim,real> &)
const override;
81 const std::array<real,nstate> &soln,
82 const dealii::Tensor<1,dim,real> &normal)
const;
86 const dealii::Point<dim,real> &pos,
87 const std::array<real,nstate> &solution,
88 const real current_time,
89 const dealii::types::global_dof_index cell_index)
const;
93 const dealii::Point<dim,real> &pos,
94 const std::array<real,nstate> &conservative_solution,
95 const std::array<dealii::Tensor<1,dim,real>,nstate> &solution_gradient,
96 const dealii::types::global_dof_index cell_index)
const override;
99 double get_filter_width (
const dealii::types::global_dof_index cell_index)
const;
103 const dealii::types::global_dof_index cell_index,
104 const int cell_poly_degree)
const;
108 const std::array<real,nstate> &primitive_soln,
109 const std::array<dealii::Tensor<1,dim,real>,nstate> &primitive_soln_gradient,
110 const dealii::types::global_dof_index cell_index)
const = 0;
114 const std::array<real,nstate> &primitive_soln,
115 const std::array<dealii::Tensor<1,dim,real>,nstate> &primitive_soln_gradient,
116 const dealii::types::global_dof_index cell_index)
const = 0;
120 const std::array<FadType,nstate> &primitive_soln,
121 const std::array<dealii::Tensor<1,dim,FadType>,nstate> &primitive_soln_gradient,
122 const dealii::types::global_dof_index cell_index)
const = 0;
126 const std::array<FadType,nstate> &primitive_soln,
127 const std::array<dealii::Tensor<1,dim,FadType>,nstate> &primitive_soln_gradient,
128 const dealii::types::global_dof_index cell_index)
const = 0;
131 template<
typename real2>
136 template<
typename real2>
140 template<
typename real2>
142 const std::array<real2,nstate> &conservative_soln,
143 const std::array<dealii::Tensor<1,dim,real2>,nstate> &solution_gradient,
144 const dealii::types::global_dof_index cell_index)
const;
151 const std::array<real,nstate> &conservative_soln,
152 const std::array<dealii::Tensor<1,dim,real>,nstate> &solution_gradient,
153 const dealii::Tensor<1,dim,real> &normal,
154 const dealii::types::global_dof_index cell_index)
const;
161 const std::array<real,nstate> &conservative_soln,
162 const std::array<dealii::Tensor<1,dim,real>,nstate> &solution_gradient,
163 const dealii::Tensor<1,dim,real> &normal,
164 const int d_gradient,
165 const dealii::types::global_dof_index cell_index)
const;
169 const dealii::Point<dim,real> &pos)
const;
173 const dealii::Point<dim,real> &pos)
const;
177 const dealii::Point<dim,real> &pos,
178 const dealii::types::global_dof_index cell_index)
const;
185 const std::array<real,nstate> &conservative_soln)
const;
189 template <
int dim,
int nspecies,
int nstate,
typename real>
200 const double ref_length,
201 const double gamma_gas,
202 const double mach_inf,
203 const double angle_of_attack,
204 const double side_slip_angle,
205 const double prandtl_number,
206 const double reynolds_number_inf,
207 const bool use_constant_viscosity,
208 const double constant_viscosity,
209 const double temperature_inf,
212 const double model_constant,
213 const double isothermal_wall_temperature = 1.0,
217 const bool apply_low_reynolds_number_eddy_viscosity_correction =
false);
229 virtual double get_model_constant_times_filter_width (
const dealii::types::global_dof_index cell_index)
const;
232 virtual double get_model_constant_times_filter_width_squared (
const dealii::types::global_dof_index cell_index)
const;
235 real get_corrected_eddy_viscosity_low_reynolds_number(
236 const real uncorrected_eddy_viscosity)
const;
239 FadType get_corrected_eddy_viscosity_low_reynolds_number_fad(
240 const FadType uncorrected_eddy_viscosity)
const;
243 real get_scaled_fluid_kinematic_viscosity_from_unfiltered_solution()
const;
247 const std::array<real,nstate> &primitive_soln,
248 const std::array<dealii::Tensor<1,dim,real>,nstate> &primitive_soln_gradient,
249 const dealii::types::global_dof_index cell_index)
const;
253 const std::array<real,nstate> &primitive_soln,
254 const std::array<dealii::Tensor<1,dim,real>,nstate> &primitive_soln_gradient,
255 const dealii::types::global_dof_index cell_index)
const;
259 const std::array<FadType,nstate> &primitive_soln,
260 const std::array<dealii::Tensor<1,dim,FadType>,nstate> &primitive_soln_gradient,
261 const dealii::types::global_dof_index cell_index)
const;
265 const std::array<FadType,nstate> &primitive_soln,
266 const std::array<dealii::Tensor<1,dim,FadType>,nstate> &primitive_soln_gradient,
267 const dealii::types::global_dof_index cell_index)
const;
270 virtual real compute_eddy_viscosity(
271 const std::array<real,nstate> &primitive_soln,
272 const std::array<dealii::Tensor<1,dim,real>,nstate> &primitive_soln_gradient,
273 const dealii::types::global_dof_index cell_index)
const;
276 virtual FadType compute_eddy_viscosity_fad(
277 const std::array<FadType,nstate> &primitive_soln,
278 const std::array<dealii::Tensor<1,dim,FadType>,nstate> &primitive_soln_gradient,
279 const dealii::types::global_dof_index cell_index)
const;
283 template<
typename real2> dealii::Tensor<2,dim,real2> compute_SGS_stress_tensor_templated (
284 const std::array<real2,nstate> &primitive_soln,
285 const std::array<dealii::Tensor<1,dim,real2>,nstate> &primitive_soln_gradient,
286 const dealii::types::global_dof_index cell_index)
const;
289 template<
typename real2>
290 dealii::Tensor<1,dim,real2> compute_SGS_heat_flux_templated (
291 const std::array<real2,nstate> &primitive_soln,
292 const std::array<dealii::Tensor<1,dim,real2>,nstate> &primitive_soln_gradient,
293 const dealii::types::global_dof_index cell_index)
const;
296 template<
typename real2> real2 scale_eddy_viscosity_templated(
297 const std::array<real2,nstate> &primitive_soln,
298 const real2 eddy_viscosity)
const;
305 template<
typename real2> real2 compute_eddy_viscosity_templated(
306 const std::array<real2,nstate> &primitive_soln,
307 const std::array<dealii::Tensor<1,dim,real2>,nstate> &primitive_soln_gradient,
308 const dealii::types::global_dof_index cell_index)
const;
315 template<
typename real2> real2 get_corrected_eddy_viscosity_low_reynolds_number_templated(
316 const real2 uncorrected_eddy_viscosity)
const;
320 template <
int dim,
int nspecies,
int nstate,
typename real>
332 const double ref_length,
333 const double gamma_gas,
334 const double mach_inf,
335 const double angle_of_attack,
336 const double side_slip_angle,
337 const double prandtl_number,
338 const double reynolds_number_inf,
339 const bool use_constant_viscosity,
340 const double constant_viscosity,
341 const double temperature_inf,
344 const double model_constant,
345 const double isothermal_wall_temperature = 1.0,
349 const bool apply_low_reynolds_number_eddy_viscosity_correction =
false);
354 real compute_eddy_viscosity(
355 const std::array<real,nstate> &primitive_soln,
356 const std::array<dealii::Tensor<1,dim,real>,nstate> &primitive_soln_gradient,
357 const dealii::types::global_dof_index cell_index)
const override;
362 FadType compute_eddy_viscosity_fad(
363 const std::array<FadType,nstate> &primitive_soln,
364 const std::array<dealii::Tensor<1,dim,FadType>,nstate> &primitive_soln_gradient,
365 const dealii::types::global_dof_index cell_index)
const override;
371 template<
typename real2> real2 compute_eddy_viscosity_templated(
372 const std::array<real2,nstate> &primitive_soln,
373 const std::array<dealii::Tensor<1,dim,real2>,nstate> &primitive_soln_gradient,
374 const dealii::types::global_dof_index cell_index)
const;
378 template <
int dim,
int nspecies,
int nstate,
typename real>
389 const double ref_length,
390 const double gamma_gas,
391 const double mach_inf,
392 const double angle_of_attack,
393 const double side_slip_angle,
394 const double prandtl_number,
395 const double reynolds_number_inf,
396 const bool use_constant_viscosity,
397 const double constant_viscosity,
398 const double temperature_inf,
401 const double model_constant,
402 const double isothermal_wall_temperature = 1.0,
406 const bool apply_low_reynolds_number_eddy_viscosity_correction =
false);
411 real compute_eddy_viscosity(
412 const std::array<real,nstate> &primitive_soln,
413 const std::array<dealii::Tensor<1,dim,real>,nstate> &primitive_soln_gradient,
414 const dealii::types::global_dof_index cell_index)
const override;
419 FadType compute_eddy_viscosity_fad(
420 const std::array<FadType,nstate> &primitive_soln,
421 const std::array<dealii::Tensor<1,dim,FadType>,nstate> &primitive_soln_gradient,
422 const dealii::types::global_dof_index cell_index)
const override;
428 template<
typename real2> real2 compute_eddy_viscosity_templated(
429 const std::array<real2,nstate> &primitive_soln,
430 const std::array<dealii::Tensor<1,dim,real2>,nstate> &primitive_soln_gradient,
431 const dealii::types::global_dof_index cell_index)
const;
435 template <
int dim,
int nspecies,
int nstate,
typename real>
447 const double ref_length,
448 const double gamma_gas,
449 const double mach_inf,
450 const double angle_of_attack,
451 const double side_slip_angle,
452 const double prandtl_number,
453 const double reynolds_number_inf,
454 const bool use_constant_viscosity,
455 const double constant_viscosity,
456 const double temperature_inf,
459 const double model_constant,
460 const double isothermal_wall_temperature = 1.0,
464 const bool apply_low_reynolds_number_eddy_viscosity_correction =
false);
473 real compute_eddy_viscosity(
474 const std::array<real,nstate> &primitive_soln,
475 const std::array<dealii::Tensor<1,dim,real>,nstate> &primitive_soln_gradient,
476 const dealii::types::global_dof_index cell_index)
const override;
482 FadType compute_eddy_viscosity_fad(
483 const std::array<FadType,nstate> &primitive_soln,
484 const std::array<dealii::Tensor<1,dim,FadType>,nstate> &primitive_soln_gradient,
485 const dealii::types::global_dof_index cell_index)
const override;
493 template<
typename real2> real2 compute_eddy_viscosity_templated(
494 const std::array<real2,nstate> &primitive_soln,
495 const std::array<dealii::Tensor<1,dim,real2>,nstate> &primitive_soln_gradient,
496 const dealii::types::global_dof_index cell_index)
const;
500 template <
int dim,
int nspecies,
int nstate,
typename real>
511 const double ref_length,
512 const double gamma_gas,
513 const double mach_inf,
514 const double angle_of_attack,
515 const double side_slip_angle,
516 const double prandtl_number,
517 const double reynolds_number_inf,
518 const bool use_constant_viscosity,
519 const double constant_viscosity,
520 const double temperature_inf,
523 const double model_constant,
524 const unsigned int poly_degree,
525 const unsigned int poly_degree_large_scales,
526 const double mesh_size,
527 const double curve_fit_constant,
528 const double isothermal_wall_temperature = 1.0,
532 const bool apply_low_reynolds_number_eddy_viscosity_correction =
false);
537 const double poly_degree;
545 double get_model_constant_times_filter_width (
const dealii::types::global_dof_index cell_index)
const override;
549 template <
int dim,
int nspecies,
int nstate,
typename real>
560 const double ref_length,
561 const double gamma_gas,
562 const double mach_inf,
563 const double angle_of_attack,
564 const double side_slip_angle,
565 const double prandtl_number,
566 const double reynolds_number_inf,
567 const bool use_constant_viscosity,
568 const double constant_viscosity,
569 const double temperature_inf,
572 const double model_constant,
573 const unsigned int poly_degree,
574 const unsigned int poly_degree_large_scales,
575 const double mesh_size,
576 const double isothermal_wall_temperature = 1.0,
580 const bool apply_low_reynolds_number_eddy_viscosity_correction =
false);
587 template <
int dim,
int nspecies,
int nstate,
typename real>
598 const double ref_length,
599 const double gamma_gas,
600 const double mach_inf,
601 const double angle_of_attack,
602 const double side_slip_angle,
603 const double prandtl_number,
604 const double reynolds_number_inf,
605 const bool use_constant_viscosity,
606 const double constant_viscosity,
607 const double temperature_inf,
610 const double model_constant,
611 const unsigned int poly_degree,
612 const unsigned int poly_degree_large_scales,
613 const double mesh_size,
614 const double isothermal_wall_temperature = 1.0,
618 const bool apply_low_reynolds_number_eddy_viscosity_correction =
false);
625 template <
int dim,
int nspecies,
int nstate,
typename real>
636 const double ref_length,
637 const double gamma_gas,
638 const double mach_inf,
639 const double angle_of_attack,
640 const double side_slip_angle,
641 const double prandtl_number,
642 const double reynolds_number_inf,
643 const bool use_constant_viscosity,
644 const double constant_viscosity,
645 const double temperature_inf,
648 const double model_constant,
649 const double isothermal_wall_temperature = 1.0,
653 const bool apply_low_reynolds_number_eddy_viscosity_correction =
false);
661 double get_model_constant_times_filter_width_squared (
const dealii::types::global_dof_index cell_index)
const override;
double get_filter_width_from_poly_degree(const dealii::types::global_dof_index cell_index, const int cell_poly_degree) const
Compute the nondimensionalized filter width used by the SGS model given a cell index.
virtual void set_unfiltered_conservative_solution(const std::array< real, nstate > &unfiltered_conservative_solution_)
Setter for the unfiltered conservative solution.
Dynamic Smagorinsky Model (DSM) eddy viscosity model. Derived from LargeEddySimulation_Smagorinsky fo...
Variational multiscale (VMS) eddy viscosity model. Derived from LargeEddySimulation_Smagorinsky for o...
Smagorinsky eddy viscosity model. Derived from Large Eddy Simulation.
real max_convective_eigenvalue(const std::array< real, nstate > &soln) const
Maximum convective eigenvalue of the additional models' PDEs.
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< double > FadType
Sacado AD type for first derivatives.
Manufactured solution used for grid studies to check convergence orders.
WALE (Wall-Adapting Local Eddy-viscosity) eddy viscosity model. Derived from LargeEddySimulation_Smag...
const double ratio_of_filter_width_to_cell_size
Ratio of filter width to cell size.
const double model_constant
SGS model constant.
real2 get_tensor_magnitude(const dealii::Tensor< 2, dim, real2 > &tensor) const
Returns the magnitude of the tensor.
Files for the baseline physics.
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)
Shear-improved Smagorinsky eddy viscosity model. Derived from LargeEddySimulation_Smagorinsky for onl...
const double curve_fit_constant
Curve fit constant for computing the model constant times filter width expresion. ...
~LargeEddySimulation_SmallSmallVMS()
Destructor.
Physics model additional terms and equations to the baseline physics.
~LargeEddySimulation_Smagorinsky()
Destructor.
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
Main parameter class that contains the various other sub-parameter classes.
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' PDEs.
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, nspecies, real > > manufactured_solution_function=nullptr, const two_point_num_flux_enum two_point_num_flux_type=two_point_num_flux_enum::KG)
Constructor.
TwoPointNumericalFlux
Two point numerical flux type for split form.
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)...
std::array< real, nstate > dissipative_flux_dot_normal(const std::array< real, nstate > &solution, const std::array< dealii::Tensor< 1, dim, real >, nstate > &solution_gradient, const std::array< real, nstate > &filtered_solution, const std::array< dealii::Tensor< 1, dim, real >, nstate > &filtered_solution_gradient, const bool on_boundary, const dealii::types::global_dof_index cell_index, const dealii::Tensor< 1, dim, real > &normal, const int boundary_type) const
Dissipative (i.e. viscous) flux: dot normal vector.
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: .
All-All Variational multiscale (VMS) eddy viscosity model. Derived from LargeEddySimulation_VMS for o...
std::unique_ptr< NavierStokes< dim, nspecies, nstate, real > > navier_stokes_physics
Pointer to Navier-Stokes physics object.
~LargeEddySimulation_DynamicSmagorinsky()
Destructor.
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)*.
Large Eddy Simulation equations. Derived from Navier-Stokes for modifying the stress tensor and heat ...
std::array< real, nstate > physical_source_term(const dealii::Point< dim, real > &pos, const std::array< real, nstate > &conservative_solution, const std::array< dealii::Tensor< 1, dim, real >, nstate > &solution_gradient, const dealii::types::global_dof_index cell_index) const override
Physical source term.
~LargeEddySimulation_AllAllVMS()
Destructor.
const double mesh_size
Mesh size.
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.
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)
const double turbulent_prandtl_number
Turbulent Prandtl number.
Vreman eddy viscosity model. Derived from LargeEddySimulation_Smagorinsky for only modifying compute_...
const bool apply_low_reynolds_number_eddy_viscosity_correction
Flag for applying the low Reynolds number eddy viscosity correction.
double scaled_fluid_kinematic_viscosity_from_unfiltered_solution
Scaled fluid kinematic viscosity based on the unfiltered solution.
const double poly_degree_large_scales
Polynomial degree of large scale partition of solution.
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...
std::array< real, nstate > get_manufactured_solution_value(const dealii::Point< dim, real > &pos) const
Get manufactured solution value (repeated from Euler)
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' PDEs...
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: .
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.
~LargeEddySimulation_VMS()
Destructor.
ThermalBoundaryCondition
Types of thermal boundary conditions available.
std::array< dealii::Tensor< 1, dim, real >, nstate > convective_flux(const std::array< real, nstate > &conservative_soln) const
Convective flux: .
~LargeEddySimulation_ShearImprovedSmagorinsky()
Destructor.
Small-Small Variational multiscale (VMS) eddy viscosity model. Derived from LargeEddySimulation_VMS f...
std::array< real, nstate > channel_flow_source_term(const std::array< real, nstate > &conservative_soln) const
Channel flow source term.
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...
std::shared_ptr< ManufacturedSolutionFunction< dim, nspecies, real > > manufactured_solution_function
Manufactured solution function.
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