4 #include <boost/preprocessor/seq/for_each.hpp> 9 #include "large_eddy_simulation.h" 17 template <
int dim,
int nspecies,
int nstate,
typename real>
20 const double ref_length,
21 const double gamma_gas,
22 const double mach_inf,
23 const double angle_of_attack,
24 const double side_slip_angle,
25 const double prandtl_number,
26 const double reynolds_number_inf,
27 const bool use_constant_viscosity,
28 const double constant_viscosity,
29 const double temperature_inf,
30 const double turbulent_prandtl_number,
31 const double ratio_of_filter_width_to_cell_size,
32 const double isothermal_wall_temperature,
36 :
ModelBase<dim,nspecies,nstate,real>(manufactured_solution_function)
37 , turbulent_prandtl_number(turbulent_prandtl_number)
38 , ratio_of_filter_width_to_cell_size(ratio_of_filter_width_to_cell_size)
39 , navier_stokes_physics(
std::make_unique <
NavierStokes<dim,nspecies,nstate,real> > (
48 use_constant_viscosity,
51 isothermal_wall_temperature,
52 thermal_boundary_condition_type,
53 manufactured_solution_function,
54 two_point_num_flux_type))
56 static_assert(nstate==dim+2,
"ModelBase::LargeEddySimulationBase() should be created with nstate=dim+2");
59 template <
int dim,
int nspecies,
int nstate,
typename real>
60 template<
typename real2>
63 const dealii::Tensor<2,dim,real2> &tensor)
const 65 real2 tensor_magnitude_sqr = 0.0;
66 if(std::is_same<real2,real>::value){
67 tensor_magnitude_sqr = 0.0;
69 for (
int i=0; i<dim; ++i) {
70 for (
int j=0; j<dim; ++j) {
71 tensor_magnitude_sqr += tensor[i][j]*tensor[i][j];
74 return tensor_magnitude_sqr;
77 template <
int dim,
int nspecies,
int nstate,
typename real>
78 template<
typename real2>
81 const dealii::Tensor<2,dim,real2> &tensor)
const 83 const real2 tensor_magnitude_sqr = this->
template get_tensor_magnitude_sqr<real2>(tensor);
84 return sqrt(2.0*tensor_magnitude_sqr);
87 template <
int dim,
int nspecies,
int nstate,
typename real>
90 const std::array<real,nstate> &)
const 92 std::array<dealii::Tensor<1,dim,real>,nstate> conv_flux;
93 for (
int i=0; i<nstate; i++) {
99 template <
int dim,
int nspecies,
int nstate,
typename real>
102 const std::array<real,nstate> &conservative_soln,
103 const std::array<dealii::Tensor<1,dim,real>,nstate> &solution_gradient,
104 const dealii::types::global_dof_index cell_index)
const 106 return dissipative_flux_templated<real>(conservative_soln,solution_gradient,cell_index);
109 template <
int dim,
int nspecies,
int nstate,
typename real>
110 template <
typename real2>
113 const std::array<real2,nstate> &conservative_soln,
114 const std::array<dealii::Tensor<1,dim,real2>,nstate> &solution_gradient,
115 const dealii::types::global_dof_index cell_index)
const 118 const std::array<dealii::Tensor<1,dim,real2>,nstate> primitive_soln_gradient = this->
navier_stokes_physics->convert_conservative_gradient_to_primitive_gradient_templated(conservative_soln, solution_gradient);
119 const std::array<real2,nstate> primitive_soln = this->
navier_stokes_physics->convert_conservative_to_primitive_templated(conservative_soln);
122 const dealii::Tensor<1,dim,real2> vel = this->
navier_stokes_physics->extract_velocities_from_primitive(primitive_soln);
124 dealii::Tensor<2,dim,real2> viscous_stress_tensor;
125 dealii::Tensor<1,dim,real2> heat_flux;
126 if constexpr(std::is_same<real2,real>::value){
130 else if constexpr(std::is_same<real2,FadType>::value){
135 std::cout <<
"ERROR in physics/large_eddy_simulation.cpp --> dissipative_flux_templated(): real2!=real || real2!=FadType)" << std::endl;
140 std::array<dealii::Tensor<1,dim,real2>,nstate> viscous_flux
141 = this->
navier_stokes_physics->dissipative_flux_given_velocities_viscous_stress_tensor_and_heat_flux(vel,viscous_stress_tensor,heat_flux);
146 template <
int dim,
int nspecies,
int nstate,
typename real>
149 const std::array<real,nstate> &solution,
150 const std::array<dealii::Tensor<1,dim,real>,nstate> &solution_gradient,
151 const std::array<real,nstate> &,
152 const std::array<dealii::Tensor<1,dim,real>,nstate> &,
153 const bool on_boundary,
154 const dealii::types::global_dof_index cell_index,
155 const dealii::Tensor<1,dim,real> &normal,
156 const int boundary_type)
const 160 dissipative_flux_dot_normal.fill(0.0);
162 if((on_boundary && (
navier_stokes_physics->thermal_boundary_condition_type == thermal_boundary_condition_enum::adiabatic))
163 && (boundary_type == 1001)) {
176 const std::array<dealii::Tensor<1,dim,real>,nstate> primitive_soln_gradient = this->
navier_stokes_physics->convert_conservative_gradient_to_primitive_gradient_templated(solution, solution_gradient);
177 const std::array<real,nstate> primitive_soln = this->
navier_stokes_physics->convert_conservative_to_primitive_templated(solution);
180 const dealii::Tensor<1,dim,real> vel = this->
navier_stokes_physics->extract_velocities_from_primitive(primitive_soln);
181 dealii::Tensor<2,dim,real> viscous_stress_tensor =
compute_SGS_stress_tensor(primitive_soln, primitive_soln_gradient,cell_index);
182 dealii::Tensor<1,dim,real> heat_flux;
183 for (
int flux_dim=0; flux_dim<dim; ++flux_dim) {
185 heat_flux[flux_dim] = 0.0;
188 dissipative_flux = this->
navier_stokes_physics->dissipative_flux_given_velocities_viscous_stress_tensor_and_heat_flux(vel,viscous_stress_tensor,heat_flux);
192 dissipative_flux = dissipative_flux_templated<real>(solution,solution_gradient,cell_index);
196 for (
int s=0; s<nstate; s++) {
197 for (
int d=0; d<dim; ++d) {
198 dissipative_flux_dot_normal[s] += dissipative_flux[s][d] * normal[d];
205 template <
int dim,
int nspecies,
int nstate,
typename real>
208 const std::array<real,nstate> &,
209 const dealii::Tensor<1,dim,real> &)
const 211 std::array<real,nstate> eig;
216 template <
int dim,
int nspecies,
int nstate,
typename real>
220 const real max_eig = 0.0;
224 template <
int dim,
int nspecies,
int nstate,
typename real>
227 const std::array<real,nstate> &,
228 const dealii::Tensor<1,dim,real> &)
const 230 const real max_eig = 0.0;
234 template <
int dim,
int nspecies,
int nstate,
typename real>
237 const dealii::Point<dim,real> &pos,
238 const std::array<real,nstate> &,
240 const dealii::types::global_dof_index cell_index)
const 251 template <
int dim,
int nspecies,
int nstate,
typename real>
254 const dealii::Point<dim,real> &,
255 const std::array<real,nstate> &conservative_soln,
256 const std::array<dealii::Tensor<1,dim,real>,nstate> &,
257 const dealii::types::global_dof_index )
const 259 std::array<real,nstate> physical_source;
262 return physical_source;
265 template <
int dim,
int nspecies,
int nstate,
typename real>
268 const std::array<real,nstate> &conservative_soln)
const 271 std::fill(source_term.begin(), source_term.end(), 0.0);
275 const std::array<real,nstate> primitive_soln = this->
navier_stokes_physics->convert_conservative_to_primitive_templated(conservative_soln);
284 const real x_velocity = primitive_soln[1];
285 source_term[nstate-1] = x_velocity*source_term[1];
290 template <
int dim,
int nspecies,
int nstate,
typename real>
303 template <
int dim,
int nspecies,
int nstate,
typename real>
306 const dealii::types::global_dof_index cell_index,
307 const int cell_poly_degree)
const 314 const double cell_volume = this->cellwise_volume[cell_index];
315 double filter_width = pow(cell_volume, (1.0/3.0))/(cell_poly_degree+1);
323 template<
typename real>
324 double getValue(
const real &x) {
325 if constexpr(std::is_same<real,double>::value) {
328 else if constexpr(std::is_same<real,FadType>::value) {
331 else if constexpr(std::is_same<real,FadFadType>::value) {
332 return x.val().val();
334 else if constexpr(std::is_same<real,RadType>::value) {
337 else if(std::is_same<real,RadFadType>::value) {
338 return x.value().value();
342 template <
int dim,
int nspecies,
int nstate,
typename real>
345 const std::array<real,nstate> &conservative_soln,
346 const std::array<dealii::Tensor<1,dim,real>,nstate> &solution_gradient,
347 const dealii::Tensor<1,dim,real> &normal,
348 const dealii::types::global_dof_index cell_index)
const 353 std::array<adtype,nstate> AD_conservative_soln;
354 std::array<dealii::Tensor<1,dim,adtype>,nstate> AD_solution_gradient;
355 for (
int s=0; s<nstate; s++) {
356 adtype ADvar(nstate, s, getValue<real>(conservative_soln[s]));
357 AD_conservative_soln[s] = ADvar;
358 for (
int d=0;d<dim;d++) {
359 AD_solution_gradient[s][d] = getValue<real>(solution_gradient[s][d]);
364 std::array<dealii::Tensor<1,dim,adtype>,nstate> AD_dissipative_flux = dissipative_flux_templated<adtype>(AD_conservative_soln, AD_solution_gradient, cell_index);
367 dealii::Tensor<2,nstate,real> jacobian;
368 for (
int sp=0; sp<nstate; sp++) {
370 for (
int s=0; s<nstate; s++) {
371 jacobian[s][sp] = 0.0;
372 for (
int d=0;d<dim;d++) {
374 jacobian[s][sp] += AD_dissipative_flux[s][d].dx(sp)*normal[d];
381 template <
int dim,
int nspecies,
int nstate,
typename real>
384 const std::array<real,nstate> &conservative_soln,
385 const std::array<dealii::Tensor<1,dim,real>,nstate> &solution_gradient,
386 const dealii::Tensor<1,dim,real> &normal,
387 const int d_gradient,
388 const dealii::types::global_dof_index cell_index)
const 393 std::array<adtype,nstate> AD_conservative_soln;
394 std::array<dealii::Tensor<1,dim,adtype>,nstate> AD_solution_gradient;
395 for (
int s=0; s<nstate; s++) {
396 AD_conservative_soln[s] = getValue<real>(conservative_soln[s]);
397 for (
int d=0;d<dim;d++) {
399 adtype ADvar(nstate, s, getValue<real>(solution_gradient[s][d]));
400 AD_solution_gradient[s][d] = ADvar;
403 AD_solution_gradient[s][d] = getValue<real>(solution_gradient[s][d]);
409 std::array<dealii::Tensor<1,dim,adtype>,nstate> AD_dissipative_flux = dissipative_flux_templated<adtype>(AD_conservative_soln, AD_solution_gradient, cell_index);
412 dealii::Tensor<2,nstate,real> jacobian;
413 for (
int sp=0; sp<nstate; sp++) {
415 for (
int s=0; s<nstate; s++) {
416 jacobian[s][sp] = 0.0;
417 for (
int d=0;d<dim;d++) {
419 jacobian[s][sp] += AD_dissipative_flux[s][d].dx(sp)*normal[d];
426 template <
int dim,
int nspecies,
int nstate,
typename real>
429 const dealii::Point<dim,real> &pos)
const 431 std::array<real,nstate> manufactured_solution;
432 for (
int s=0; s<nstate; s++) {
435 assert(manufactured_solution[s] > 0);
438 return manufactured_solution;
441 template <
int dim,
int nspecies,
int nstate,
typename real>
444 const dealii::Point<dim,real> &pos)
const 446 std::vector<dealii::Tensor<1,dim,real>> manufactured_solution_gradient_dealii(nstate);
448 std::array<dealii::Tensor<1,dim,real>,nstate> manufactured_solution_gradient;
449 for (
int d=0;d<dim;d++) {
450 for (
int s=0; s<nstate; s++) {
451 manufactured_solution_gradient[s][d] = manufactured_solution_gradient_dealii[s][d];
454 return manufactured_solution_gradient;
457 template <
int dim,
int nspecies,
int nstate,
typename real>
460 const dealii::Point<dim,real> &pos,
461 const dealii::types::global_dof_index cell_index)
const 474 std::array<dealii::SymmetricTensor<2,dim,real>,nstate> manufactured_solution_hessian;
475 for (
int s=0; s<nstate; s++) {
477 for (
int dr=0;dr<dim;dr++) {
478 for (
int dc=0;dc<dim;dc++) {
479 manufactured_solution_hessian[s][dr][dc] = hessian[dr][dc];
486 dealii::Tensor<1,nstate,real> dissipative_flux_divergence;
487 for (
int d=0;d<dim;d++) {
488 dealii::Tensor<1,dim,real> normal;
493 std::array<dealii::Tensor<2,nstate,real>,dim> jacobian_wrt_gradient;
494 for (
int d_gradient=0;d_gradient<dim;d_gradient++) {
500 for (
int sr = 0; sr < nstate; ++sr) {
501 for (
int sc = 0; sc < nstate; ++sc) {
502 jacobian_wrt_gradient[d_gradient][sr][sc] = jacobian_wrt_gradient_component[sr][sc];
508 for (
int sr = 0; sr < nstate; ++sr) {
509 real jac_grad_row = 0.0;
510 for (
int sc = 0; sc < nstate; ++sc) {
511 jac_grad_row += jacobian[sr][sc]*manufactured_solution_gradient[sc][d];
514 for (
int d_gradient=0;d_gradient<dim;d_gradient++) {
515 jac_grad_row += jacobian_wrt_gradient[d_gradient][sr][sc]*manufactured_solution_hessian[sc][d_gradient][d];
518 dissipative_flux_divergence[sr] += jac_grad_row;
522 for (
int s=0; s<nstate; s++) {
523 dissipative_source_term[s] = dissipative_flux_divergence[s];
532 template <
int dim,
int nspecies,
int nstate,
typename real>
535 const double ref_length,
536 const double gamma_gas,
537 const double mach_inf,
538 const double angle_of_attack,
539 const double side_slip_angle,
540 const double prandtl_number,
541 const double reynolds_number_inf,
542 const bool use_constant_viscosity,
543 const double constant_viscosity,
544 const double temperature_inf,
547 const double model_constant,
548 const double isothermal_wall_temperature,
552 const bool apply_low_reynolds_number_eddy_viscosity_correction)
561 use_constant_viscosity,
564 turbulent_prandtl_number,
565 ratio_of_filter_width_to_cell_size,
566 isothermal_wall_temperature,
567 thermal_boundary_condition_type,
569 two_point_num_flux_type)
570 , model_constant(model_constant)
571 , apply_low_reynolds_number_eddy_viscosity_correction(apply_low_reynolds_number_eddy_viscosity_correction)
574 template <
int dim,
int nspecies,
int nstate,
typename real>
577 const dealii::types::global_dof_index cell_index)
const 582 const double model_constant_times_filter_width =
model_constant*filter_width;
583 return model_constant_times_filter_width;
586 template <
int dim,
int nspecies,
int nstate,
typename real>
589 const dealii::types::global_dof_index cell_index)
const 593 return model_constant_times_filter_width*model_constant_times_filter_width;
596 template <
int dim,
int nspecies,
int nstate,
typename real>
600 for(
int s=0; s<nstate; ++s){
607 template <
int dim,
int nspecies,
int nstate,
typename real>
610 const real uncorrected_eddy_viscosity)
const 612 return get_corrected_eddy_viscosity_low_reynolds_number_templated<real>(uncorrected_eddy_viscosity);
615 template <
int dim,
int nspecies,
int nstate,
typename real>
618 const FadType uncorrected_eddy_viscosity)
const 620 return get_corrected_eddy_viscosity_low_reynolds_number_templated<FadType>(uncorrected_eddy_viscosity);
623 template <
int dim,
int nspecies,
int nstate,
typename real>
627 const std::array<real,nstate> primitive_soln
630 const real fluid_viscosity
631 = this->
navier_stokes_physics->compute_scaled_viscosity_coefficient(primitive_soln)/primitive_soln[0];
632 return fluid_viscosity;
635 template <
int dim,
int nspecies,
int nstate,
typename real>
636 template<
typename real2>
639 const real2 uncorrected_eddy_viscosity)
const 644 const real2 corrected_eddy_viscosity = sqrt(uncorrected_eddy_viscosity*uncorrected_eddy_viscosity + fluid_viscosity*fluid_viscosity) - fluid_viscosity;
645 return corrected_eddy_viscosity;
648 template <
int dim,
int nspecies,
int nstate,
typename real>
651 const std::array<real,nstate> &primitive_soln,
652 const std::array<dealii::Tensor<1,dim,real>,nstate> &primitive_soln_gradient,
653 const dealii::types::global_dof_index cell_index)
const 655 return compute_eddy_viscosity_templated<real>(primitive_soln,primitive_soln_gradient,cell_index);
658 template <
int dim,
int nspecies,
int nstate,
typename real>
661 const std::array<FadType,nstate> &primitive_soln,
662 const std::array<dealii::Tensor<1,dim,FadType>,nstate> &primitive_soln_gradient,
663 const dealii::types::global_dof_index cell_index)
const 665 return compute_eddy_viscosity_templated<FadType>(primitive_soln,primitive_soln_gradient,cell_index);
668 template <
int dim,
int nspecies,
int nstate,
typename real>
669 template<
typename real2>
672 const std::array<real2,nstate> &,
673 const std::array<dealii::Tensor<1,dim,real2>,nstate> &primitive_soln_gradient,
674 const dealii::types::global_dof_index cell_index)
const 677 const dealii::Tensor<2,dim,real2> vel_gradient
678 = this->
navier_stokes_physics->extract_velocities_gradient_from_primitive_solution_gradient(primitive_soln_gradient);
680 const dealii::Tensor<2,dim,real2> strain_rate_tensor
686 const real2 strain_rate_tensor_magnitude = this->
template get_tensor_magnitude<real2>(strain_rate_tensor);
688 const real2 eddy_viscosity = model_constant_times_filter_width_squared*strain_rate_tensor_magnitude;
690 return eddy_viscosity;
693 template <
int dim,
int nspecies,
int nstate,
typename real>
694 template<
typename real2>
697 const std::array<real2,nstate> &primitive_soln,
698 const real2 eddy_viscosity)
const 702 const real2 scaled_eddy_viscosity = primitive_soln[0]*eddy_viscosity;
704 return scaled_eddy_viscosity;
707 template <
int dim,
int nspecies,
int nstate,
typename real>
710 const std::array<real,nstate> &primitive_soln,
711 const std::array<dealii::Tensor<1,dim,real>,nstate> &primitive_soln_gradient,
712 const dealii::types::global_dof_index cell_index)
const 714 return compute_SGS_heat_flux_templated<real>(primitive_soln,primitive_soln_gradient,cell_index);
717 template <
int dim,
int nspecies,
int nstate,
typename real>
720 const std::array<FadType,nstate> &primitive_soln,
721 const std::array<dealii::Tensor<1,dim,FadType>,nstate> &primitive_soln_gradient,
722 const dealii::types::global_dof_index cell_index)
const 724 return compute_SGS_heat_flux_templated<FadType>(primitive_soln,primitive_soln_gradient,cell_index);
727 template <
int dim,
int nspecies,
int nstate,
typename real>
728 template<
typename real2>
731 const std::array<real2,nstate> &primitive_soln,
732 const std::array<dealii::Tensor<1,dim,real2>,nstate> &primitive_soln_gradient,
733 const dealii::types::global_dof_index cell_index)
const 736 real2 eddy_viscosity;
737 if constexpr(std::is_same<real2,real>::value){
743 else if constexpr(std::is_same<real2,FadType>::value){
750 std::cout <<
"ERROR in physics/large_eddy_simulation.cpp --> compute_SGS_heat_flux_templated(): real2 != real or FadType" << std::endl;
755 const real2 scaled_eddy_viscosity = scale_eddy_viscosity_templated<real2>(primitive_soln,eddy_viscosity);
761 const dealii::Tensor<1,dim,real2> temperature_gradient = this->
navier_stokes_physics->compute_temperature_gradient(primitive_soln, primitive_soln_gradient);
764 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);
766 return heat_flux_SGS;
769 template <
int dim,
int nspecies,
int nstate,
typename real>
772 const std::array<real,nstate> &primitive_soln,
773 const std::array<dealii::Tensor<1,dim,real>,nstate> &primitive_soln_gradient,
774 const dealii::types::global_dof_index cell_index)
const 776 return compute_SGS_stress_tensor_templated<real>(primitive_soln,primitive_soln_gradient,cell_index);
779 template <
int dim,
int nspecies,
int nstate,
typename real>
782 const std::array<FadType,nstate> &primitive_soln,
783 const std::array<dealii::Tensor<1,dim,FadType>,nstate> &primitive_soln_gradient,
784 const dealii::types::global_dof_index cell_index)
const 786 return compute_SGS_stress_tensor_templated<FadType>(primitive_soln,primitive_soln_gradient,cell_index);
789 template <
int dim,
int nspecies,
int nstate,
typename real>
790 template<
typename real2>
793 const std::array<real2,nstate> &primitive_soln,
794 const std::array<dealii::Tensor<1,dim,real2>,nstate> &primitive_soln_gradient,
795 const dealii::types::global_dof_index cell_index)
const 798 real2 eddy_viscosity;
799 if constexpr(std::is_same<real2,real>::value){
805 else if constexpr(std::is_same<real2,FadType>::value){
812 std::cout <<
"ERROR in physics/large_eddy_simulation.cpp --> compute_SGS_stress_tensor_templated(): real2 != real or FadType" << std::endl;
817 const real2 scaled_eddy_viscosity = scale_eddy_viscosity_templated<real2>(primitive_soln,eddy_viscosity);
820 const dealii::Tensor<2,dim,real2> vel_gradient
821 = this->
navier_stokes_physics->extract_velocities_gradient_from_primitive_solution_gradient(primitive_soln_gradient);
824 const dealii::Tensor<2,dim,real2> strain_rate_tensor
828 dealii::Tensor<2,dim,real2> SGS_stress_tensor;
829 SGS_stress_tensor = this->
navier_stokes_physics->compute_viscous_stress_tensor_via_scaled_viscosity_and_strain_rate_tensor(scaled_eddy_viscosity,strain_rate_tensor);
831 return SGS_stress_tensor;
837 template <
int dim,
int nspecies,
int nstate,
typename real>
840 const double ref_length,
841 const double gamma_gas,
842 const double mach_inf,
843 const double angle_of_attack,
844 const double side_slip_angle,
845 const double prandtl_number,
846 const double reynolds_number_inf,
847 const bool use_constant_viscosity,
848 const double constant_viscosity,
849 const double temperature_inf,
853 const double isothermal_wall_temperature,
866 use_constant_viscosity,
869 turbulent_prandtl_number,
870 ratio_of_filter_width_to_cell_size,
872 isothermal_wall_temperature,
873 thermal_boundary_condition_type,
875 two_point_num_flux_type,
876 apply_low_reynolds_number_eddy_viscosity_correction)
879 template <
int dim,
int nspecies,
int nstate,
typename real>
882 const std::array<real,nstate> &primitive_soln,
883 const std::array<dealii::Tensor<1,dim,real>,nstate> &primitive_soln_gradient,
884 const dealii::types::global_dof_index cell_index)
const 886 return compute_eddy_viscosity_templated<real>(primitive_soln,primitive_soln_gradient,cell_index);
889 template <
int dim,
int nspecies,
int nstate,
typename real>
892 const std::array<FadType,nstate> &primitive_soln,
893 const std::array<dealii::Tensor<1,dim,FadType>,nstate> &primitive_soln_gradient,
894 const dealii::types::global_dof_index cell_index)
const 896 return compute_eddy_viscosity_templated<FadType>(primitive_soln,primitive_soln_gradient,cell_index);
899 template <
int dim,
int nspecies,
int nstate,
typename real>
900 template<
typename real2>
903 const std::array<real2,nstate> &,
904 const std::array<dealii::Tensor<1,dim,real2>,nstate> &primitive_soln_gradient,
905 const dealii::types::global_dof_index cell_index)
const 907 const dealii::Tensor<2,dim,real2> vel_gradient
908 = this->
navier_stokes_physics->extract_velocities_gradient_from_primitive_solution_gradient(primitive_soln_gradient);
909 const dealii::Tensor<2,dim,real2> strain_rate_tensor
919 dealii::Tensor<2,dim,real2> g_sqr;
920 for (
int i=0; i<dim; ++i) {
921 for (
int j=0; j<dim; ++j) {
923 real2 val;
if(std::is_same<real2,real>::value){val = 0.0;}
925 for (
int k=0; k<dim; ++k) {
926 val += vel_gradient[i][k]*vel_gradient[k][j];
931 real2 trace_g_sqr;
if(std::is_same<real2,real>::value){trace_g_sqr = 0.0;}
932 for (
int k=0; k<dim; ++k) {
933 trace_g_sqr += g_sqr[k][k];
935 dealii::Tensor<2,dim,real2> traceless_symmetric_square_of_velocity_gradient_tensor;
936 for (
int i=0; i<dim; ++i) {
937 for (
int j=0; j<dim; ++j) {
938 traceless_symmetric_square_of_velocity_gradient_tensor[i][j] = 0.5*(g_sqr[i][j]+g_sqr[j][i]);
941 for (
int k=0; k<dim; ++k) {
942 traceless_symmetric_square_of_velocity_gradient_tensor[k][k] += -(1.0/3.0)*trace_g_sqr;
946 const real2 strain_rate_tensor_magnitude_sqr = this->
template get_tensor_magnitude_sqr<real2>(strain_rate_tensor);
947 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);
950 real2 eddy_viscosity;
if(std::is_same<real2,real>::value){eddy_viscosity = 0.0;}
951 if((strain_rate_tensor_magnitude_sqr != 0.0) &&
952 (traceless_symmetric_square_of_velocity_gradient_tensor_magnitude_sqr != 0.0)) {
959 eddy_viscosity = model_constant_times_filter_width_squared*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));
962 return eddy_viscosity;
968 template <
int dim,
int nspecies,
int nstate,
typename real>
971 const double ref_length,
972 const double gamma_gas,
973 const double mach_inf,
974 const double angle_of_attack,
975 const double side_slip_angle,
976 const double prandtl_number,
977 const double reynolds_number_inf,
978 const bool use_constant_viscosity,
979 const double constant_viscosity,
980 const double temperature_inf,
984 const double isothermal_wall_temperature,
997 use_constant_viscosity,
1000 turbulent_prandtl_number,
1001 ratio_of_filter_width_to_cell_size,
1003 isothermal_wall_temperature,
1004 thermal_boundary_condition_type,
1006 two_point_num_flux_type,
1007 apply_low_reynolds_number_eddy_viscosity_correction)
1010 template <
int dim,
int nspecies,
int nstate,
typename real>
1013 const std::array<real,nstate> &primitive_soln,
1014 const std::array<dealii::Tensor<1,dim,real>,nstate> &primitive_soln_gradient,
1015 const dealii::types::global_dof_index cell_index)
const 1017 return compute_eddy_viscosity_templated<real>(primitive_soln,primitive_soln_gradient,cell_index);
1020 template <
int dim,
int nspecies,
int nstate,
typename real>
1023 const std::array<FadType,nstate> &primitive_soln,
1024 const std::array<dealii::Tensor<1,dim,FadType>,nstate> &primitive_soln_gradient,
1025 const dealii::types::global_dof_index cell_index)
const 1027 return compute_eddy_viscosity_templated<FadType>(primitive_soln,primitive_soln_gradient,cell_index);
1030 template <
int dim,
int nspecies,
int nstate,
typename real>
1031 template<
typename real2>
1034 const std::array<real2,nstate> &,
1035 const std::array<dealii::Tensor<1,dim,real2>,nstate> &primitive_soln_gradient,
1036 const dealii::types::global_dof_index cell_index)
const 1038 const dealii::Tensor<2,dim,real2> vel_gradient
1039 = this->
navier_stokes_physics->extract_velocities_gradient_from_primitive_solution_gradient(primitive_soln_gradient);
1047 dealii::Tensor<2,dim,real2> beta_tensor;
1048 for (
int i=0; i<dim; ++i) {
1049 for (
int j=0; j<dim; ++j) {
1051 real2 val;
if(std::is_same<real2,real>::value){val = 0.0;}
1053 for (
int k=0; k<dim; ++k) {
1054 val += vel_gradient[i][k]*vel_gradient[j][k];
1056 beta_tensor[i][j] = filter_width*filter_width*val;
1060 real2 beta_tensor_determinant;
if(std::is_same<real2,real>::value){beta_tensor_determinant = 0.0;}
1061 if constexpr(dim>1){
1062 beta_tensor_determinant = beta_tensor[0][0]*beta_tensor[1][1] - beta_tensor[0][1]*beta_tensor[0][1];
1064 if constexpr(dim==3){
1065 for (
int i=0; i<2; ++i) {
1066 beta_tensor_determinant += beta_tensor[i][i]*beta_tensor[2][2] - beta_tensor[i][2]*beta_tensor[i][2];
1071 const real2 velocity_gradient_tensor_magnitude_sqr = this->
template get_tensor_magnitude_sqr<real2>(vel_gradient);
1074 real2 eddy_viscosity;
if(std::is_same<real2,real>::value){eddy_viscosity = 0.0;}
1075 if((velocity_gradient_tensor_magnitude_sqr !=0.0) && (beta_tensor_determinant >= 0.0)) {
1084 eddy_viscosity = this->
model_constant*sqrt(beta_tensor_determinant/velocity_gradient_tensor_magnitude_sqr);
1087 return eddy_viscosity;
1093 template <
int dim,
int nspecies,
int nstate,
typename real>
1096 const double ref_length,
1097 const double gamma_gas,
1098 const double mach_inf,
1099 const double angle_of_attack,
1100 const double side_slip_angle,
1101 const double prandtl_number,
1102 const double reynolds_number_inf,
1103 const bool use_constant_viscosity,
1104 const double constant_viscosity,
1105 const double temperature_inf,
1109 const double isothermal_wall_temperature,
1121 reynolds_number_inf,
1122 use_constant_viscosity,
1125 turbulent_prandtl_number,
1126 ratio_of_filter_width_to_cell_size,
1128 isothermal_wall_temperature,
1129 thermal_boundary_condition_type,
1131 two_point_num_flux_type,
1132 apply_low_reynolds_number_eddy_viscosity_correction)
1135 template <
int dim,
int nspecies,
int nstate,
typename real>
1138 const std::array<real,nstate> &primitive_soln,
1139 const std::array<dealii::Tensor<1,dim,real>,nstate> &primitive_soln_gradient,
1140 const dealii::types::global_dof_index cell_index)
const 1142 return compute_eddy_viscosity_templated<real>(primitive_soln,primitive_soln_gradient,cell_index);
1145 template <
int dim,
int nspecies,
int nstate,
typename real>
1148 const std::array<FadType,nstate> &primitive_soln,
1149 const std::array<dealii::Tensor<1,dim,FadType>,nstate> &primitive_soln_gradient,
1150 const dealii::types::global_dof_index cell_index)
const 1152 return compute_eddy_viscosity_templated<FadType>(primitive_soln,primitive_soln_gradient,cell_index);
1155 template <
int dim,
int nspecies,
int nstate,
typename real>
1156 template<
typename real2>
1159 const std::array<real2,nstate> &,
1160 const std::array<dealii::Tensor<1,dim,real2>,nstate> &primitive_soln_gradient,
1161 const dealii::types::global_dof_index cell_index)
const 1170 const dealii::Tensor<2,dim,real2> vel_gradient
1171 = this->
navier_stokes_physics->extract_velocities_gradient_from_primitive_solution_gradient(primitive_soln_gradient);
1173 const dealii::Tensor<2,dim,real2> strain_rate_tensor
1179 const real2 strain_rate_tensor_magnitude = this->
template get_tensor_magnitude<real2>(strain_rate_tensor);
1181 const real2 eddy_viscosity = model_constant_times_filter_width_squared*(
1184 return eddy_viscosity;
1190 template <
int dim,
int nspecies,
int nstate,
typename real>
1193 const double ref_length,
1194 const double gamma_gas,
1195 const double mach_inf,
1196 const double angle_of_attack,
1197 const double side_slip_angle,
1198 const double prandtl_number,
1199 const double reynolds_number_inf,
1200 const bool use_constant_viscosity,
1201 const double constant_viscosity,
1202 const double temperature_inf,
1206 const unsigned int poly_degree,
1207 const unsigned int poly_degree_large_scales,
1208 const double mesh_size,
1209 const double curve_fit_constant,
1210 const double isothermal_wall_temperature,
1222 reynolds_number_inf,
1223 use_constant_viscosity,
1226 turbulent_prandtl_number,
1227 ratio_of_filter_width_to_cell_size,
1229 isothermal_wall_temperature,
1230 thermal_boundary_condition_type,
1232 two_point_num_flux_type,
1233 apply_low_reynolds_number_eddy_viscosity_correction)
1234 , poly_degree((double)poly_degree)
1235 , poly_degree_large_scales((double)poly_degree_large_scales)
1236 , mesh_size(mesh_size)
1237 , curve_fit_constant(curve_fit_constant)
1240 template <
int dim,
int nspecies,
int nstate,
typename real>
1243 const dealii::types::global_dof_index )
const 1250 model_constant_times_filter_width = pow(model_constant_times_filter_width, -3.0/4.0);
1251 model_constant_times_filter_width *= discontinuous_galerkin_smagorinsky_model_constant;
1253 return model_constant_times_filter_width;
1259 template <
int dim,
int nspecies,
int nstate,
typename real>
1262 const double ref_length,
1263 const double gamma_gas,
1264 const double mach_inf,
1265 const double angle_of_attack,
1266 const double side_slip_angle,
1267 const double prandtl_number,
1268 const double reynolds_number_inf,
1269 const bool use_constant_viscosity,
1270 const double constant_viscosity,
1271 const double temperature_inf,
1278 const double isothermal_wall_temperature,
1290 reynolds_number_inf,
1291 use_constant_viscosity,
1294 turbulent_prandtl_number,
1295 ratio_of_filter_width_to_cell_size,
1298 poly_degree_large_scales,
1301 isothermal_wall_temperature,
1302 thermal_boundary_condition_type,
1304 two_point_num_flux_type,
1305 apply_low_reynolds_number_eddy_viscosity_correction)
1311 template <
int dim,
int nspecies,
int nstate,
typename real>
1314 const double ref_length,
1315 const double gamma_gas,
1316 const double mach_inf,
1317 const double angle_of_attack,
1318 const double side_slip_angle,
1319 const double prandtl_number,
1320 const double reynolds_number_inf,
1321 const bool use_constant_viscosity,
1322 const double constant_viscosity,
1323 const double temperature_inf,
1330 const double isothermal_wall_temperature,
1342 reynolds_number_inf,
1343 use_constant_viscosity,
1346 turbulent_prandtl_number,
1347 ratio_of_filter_width_to_cell_size,
1350 poly_degree_large_scales,
1353 isothermal_wall_temperature,
1354 thermal_boundary_condition_type,
1356 two_point_num_flux_type,
1357 apply_low_reynolds_number_eddy_viscosity_correction)
1363 template <
int dim,
int nspecies,
int nstate,
typename real>
1366 const double ref_length,
1367 const double gamma_gas,
1368 const double mach_inf,
1369 const double angle_of_attack,
1370 const double side_slip_angle,
1371 const double prandtl_number,
1372 const double reynolds_number_inf,
1373 const bool use_constant_viscosity,
1374 const double constant_viscosity,
1375 const double temperature_inf,
1379 const double isothermal_wall_temperature,
1391 reynolds_number_inf,
1392 use_constant_viscosity,
1395 turbulent_prandtl_number,
1396 ratio_of_filter_width_to_cell_size,
1398 isothermal_wall_temperature,
1399 thermal_boundary_condition_type,
1401 two_point_num_flux_type,
1402 apply_low_reynolds_number_eddy_viscosity_correction)
1405 template <
int dim,
int nspecies,
int nstate,
typename real>
1408 const dealii::types::global_dof_index cell_index)
const 1413 #if PHILIP_SPECIES==1 1420 #define POSSIBLE_TYPES (double)(FadType)(RadType)(FadFadType)(RadFadType) 1423 #define INSTANTIATE_TYPES(r, data, type) \ 1424 template class LargeEddySimulationBase < PHILIP_DIM, PHILIP_SPECIES, PHILIP_DIM+2, type >; \ 1425 template class LargeEddySimulation_Smagorinsky < PHILIP_DIM, PHILIP_SPECIES, PHILIP_DIM+2, type >; \ 1426 template class LargeEddySimulation_WALE < PHILIP_DIM, PHILIP_SPECIES, PHILIP_DIM+2, type >; \ 1427 template class LargeEddySimulation_Vreman < PHILIP_DIM, PHILIP_SPECIES, PHILIP_DIM+2, type >; \ 1428 template class LargeEddySimulation_ShearImprovedSmagorinsky < PHILIP_DIM, PHILIP_SPECIES, PHILIP_DIM+2, type >; \ 1429 template class LargeEddySimulation_VMS < PHILIP_DIM, PHILIP_SPECIES, PHILIP_DIM+2, type >; \ 1430 template class LargeEddySimulation_SmallSmallVMS < PHILIP_DIM, PHILIP_SPECIES, PHILIP_DIM+2, type >; \ 1431 template class LargeEddySimulation_AllAllVMS < PHILIP_DIM, PHILIP_SPECIES, PHILIP_DIM+2, type >; \ 1432 template class LargeEddySimulation_DynamicSmagorinsky < PHILIP_DIM, PHILIP_SPECIES, PHILIP_DIM+2, type >; \ 1433 template type LargeEddySimulationBase < PHILIP_DIM, PHILIP_SPECIES, PHILIP_DIM+2, type >::get_tensor_magnitude_sqr< type >(const dealii::Tensor<2,PHILIP_DIM, type> &tensor) const; \ 1434 template type LargeEddySimulationBase < PHILIP_DIM, PHILIP_SPECIES, PHILIP_DIM+2, type >::get_tensor_magnitude< type >(const dealii::Tensor<2,PHILIP_DIM, type> &tensor) const; 1435 BOOST_PP_SEQ_FOR_EACH(INSTANTIATE_TYPES, _, POSSIBLE_TYPES)
1437 #undef POSSIBLE_TYPES 1439 #define POSSIBLE_TYPES (double)(RadType)(FadFadType)(RadFadType) 1442 #define INSTANTIATE_FADTYPES(r, data, type) \ 1443 template FadType LargeEddySimulationBase < PHILIP_DIM, PHILIP_SPECIES, PHILIP_DIM+2, type >::get_tensor_magnitude< FadType >(const dealii::Tensor<2,PHILIP_DIM,FadType > &tensor) const; \ 1444 template FadType LargeEddySimulationBase < PHILIP_DIM, PHILIP_SPECIES, PHILIP_DIM+2, type >::get_tensor_magnitude_sqr< FadType >(const dealii::Tensor<2,PHILIP_DIM, FadType > &tensor) const; 1445 BOOST_PP_SEQ_FOR_EACH(INSTANTIATE_FADTYPES, _, POSSIBLE_TYPES)
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.
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
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, nspecies, real > > manufactured_solution_function=nullptr, const two_point_num_flux_enum two_point_num_flux_type=two_point_num_flux_enum::KG, const bool apply_low_reynolds_number_eddy_viscosity_correction=false)
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.
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)*.
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)*.
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)*.
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
Sacado::Fad::DFad< double > FadType
Sacado AD type for first derivatives.
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...
double get_model_constant_times_filter_width_squared(const dealii::types::global_dof_index cell_index) const override
real get_corrected_eddy_viscosity_low_reynolds_number(const real uncorrected_eddy_viscosity) const
Corrected eddy viscosity for low Reynolds number flows.
Manufactured solution used for grid studies to check convergence orders.
const double ratio_of_filter_width_to_cell_size
Ratio of filter width to cell size.
real2 get_corrected_eddy_viscosity_low_reynolds_number_templated(const real2 uncorrected_eddy_viscosity) const
const double model_constant
SGS model constant.
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)*.
virtual 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.
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)
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, nspecies, real > > manufactured_solution_function=nullptr, const two_point_num_flux_enum two_point_num_flux_type=two_point_num_flux_enum::KG, const bool apply_low_reynolds_number_eddy_viscosity_correction=false)
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, nspecies, real > > manufactured_solution_function=nullptr, const two_point_num_flux_enum two_point_num_flux_type=two_point_num_flux_enum::KG, const bool apply_low_reynolds_number_eddy_viscosity_correction=false)
real get_scaled_fluid_kinematic_viscosity_from_unfiltered_solution() const
Scaled fluid kinematic viscosity from unfiltered solution.
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)...
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
const double curve_fit_constant
Curve fit constant for computing the model constant times filter width expresion. ...
Physics model additional terms and equations to the baseline physics.
double bulk_velocity
Bulk velocity, needed for channel flow case.
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.
LargeEddySimulation_DynamicSmagorinsky(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, nspecies, real > > manufactured_solution_function=nullptr, const two_point_num_flux_enum two_point_num_flux_type=two_point_num_flux_enum::KG, const bool apply_low_reynolds_number_eddy_viscosity_correction=false)
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.
LargeEddySimulation_AllAllVMS(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 unsigned int poly_degree, const unsigned int poly_degree_large_scales, const double mesh_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, const bool apply_low_reynolds_number_eddy_viscosity_correction=false)
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: .
std::unique_ptr< NavierStokes< dim, nspecies, nstate, real > > navier_stokes_physics
Pointer to Navier-Stokes physics object.
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 ...
virtual double get_model_constant_times_filter_width_squared(const dealii::types::global_dof_index cell_index) const
Returns the product of the eddy viscosity model constant and the filter width squared.
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
void set_unfiltered_conservative_solution(const std::array< real, nstate > &unfiltered_conservative_solution_) override
Setter for the unfiltered conservative solution (also sets the scaled_fluid_kinematic_viscosity_from_...
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.
LargeEddySimulation_SmallSmallVMS(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 unsigned int poly_degree, const unsigned int poly_degree_large_scales, const double mesh_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, const bool apply_low_reynolds_number_eddy_viscosity_correction=false)
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.
double time_step
Current time step.
const double mesh_size
Mesh size.
double get_model_constant_times_filter_width(const dealii::types::global_dof_index cell_index) const override
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.
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)
dealii::LinearAlgebra::distributed::Vector< double > cellwise_mean_strain_rate_tensor_magnitude
const double turbulent_prandtl_number
Turbulent Prandtl number.
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
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...
dealii::LinearAlgebra::distributed::Vector< double > dynamic_smagorinsky_model_constant_times_filter_width_sqr
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)...
LargeEddySimulation_ShearImprovedSmagorinsky(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, nspecies, real > > manufactured_solution_function=nullptr, const two_point_num_flux_enum two_point_num_flux_type=two_point_num_flux_enum::KG, const bool apply_low_reynolds_number_eddy_viscosity_correction=false)
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
std::array< real, nstate > get_manufactured_solution_value(const dealii::Point< dim, real > &pos) const
Get manufactured solution value (repeated from Euler)
FadType get_corrected_eddy_viscosity_low_reynolds_number_fad(const FadType uncorrected_eddy_viscosity) const
Corrected eddy viscosity for low Reynolds number flows (Automatic Differentiation Type: FadType) ...
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)*.
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...
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
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(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 unsigned int poly_degree, const unsigned int poly_degree_large_scales, const double mesh_size, const double curve_fit_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, nspecies, real > > manufactured_solution_function=nullptr, const two_point_num_flux_enum two_point_num_flux_type=two_point_num_flux_enum::KG, const bool apply_low_reynolds_number_eddy_viscosity_correction=false)
dealii::LinearAlgebra::distributed::Vector< int > cellwise_poly_degree
Cellwise polynomial degree.
const double poly_degree
Polynomial degree of solution.
ThermalBoundaryCondition
Types of thermal boundary conditions available.
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
std::array< dealii::Tensor< 1, dim, real >, nstate > convective_flux(const std::array< real, nstate > &conservative_soln) const
Convective flux: .
std::array< real, nstate > channel_flow_source_term(const std::array< real, nstate > &conservative_soln) const
Channel flow source term.
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
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...
Navier-Stokes equations. Derived from Euler for the convective terms, which is derived from PhysicsBa...
double bulk_density
Bulk density, needed for channel flow case.
std::array< real, nstate > unfiltered_conservative_solution
The unfiltered conservative solution.
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