4 #include <boost/preprocessor/seq/for_each.hpp> 5 #include <deal.II/lac/identity_matrix.h> 11 #include "navier_stokes.h" 16 template <
int dim,
int nspecies,
int nstate,
typename real>
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 isothermal_wall_temperature,
33 const bool has_nonzero_physical_source)
34 :
Euler<dim,nspecies,nstate,real>(parameters_input,
40 manufactured_solution_function,
41 two_point_num_flux_type,
43 has_nonzero_physical_source)
44 , viscosity_coefficient_inf(1.0)
45 , use_constant_viscosity(use_constant_viscosity)
46 , constant_viscosity(constant_viscosity)
47 , prandtl_number(prandtl_number)
48 , reynolds_number_inf(reynolds_number_inf)
49 , isothermal_wall_temperature(isothermal_wall_temperature)
50 , thermal_boundary_condition_type(thermal_boundary_condition_type)
51 , sutherlands_temperature(110.4)
52 , freestream_temperature(temperature_inf)
53 , temperature_ratio(sutherlands_temperature/freestream_temperature)
55 static_assert(nstate==dim+2,
"Physics::NavierStokes() should be created with nstate=dim+2");
59 template <
int dim,
int nspecies,
int nstate,
typename real>
60 template<
typename real2>
63 const std::array<real2,nstate> &primitive_soln,
64 const std::array<dealii::Tensor<1,dim,real2>,nstate> &primitive_soln_gradient)
const 66 const real2 density = primitive_soln[0];
67 const real2 temperature = this->
template compute_temperature<real2>(primitive_soln);
69 dealii::Tensor<1,dim,real2> temperature_gradient;
70 for (
int d=0; d<dim; d++) {
71 temperature_gradient[d] = (this->gam*this->mach_inf_sqr*primitive_soln_gradient[nstate-1][d] - temperature*primitive_soln_gradient[0][d])/density;
73 return temperature_gradient;
76 template <
int dim,
int nspecies,
int nstate,
typename real>
77 template<
typename real2>
80 const std::array<real2,nstate> &conservative_soln,
81 const dealii::Tensor<1,dim,real2> &normal_vector)
const 84 const dealii::Tensor<1,dim,real2> velocities = this->
template compute_velocities<real2>(conservative_soln);
86 real2 normal_velocity = 0.0;
87 for(
int d=0;d<dim;++d){
88 normal_velocity += velocities[d]*normal_vector[d];
91 dealii::Tensor<1,dim,real2> velocities_parallel_to_wall;
92 for(
int d=0;d<dim;++d){
93 velocities_parallel_to_wall[d] = velocities[d] - normal_velocity*normal_vector[d];
95 return velocities_parallel_to_wall;
98 template <
int dim,
int nspecies,
int nstate,
typename real>
99 template<
typename real2>
102 const std::array<real2,nstate> &conservative_soln,
103 const dealii::Tensor<1,dim,real2> &normal_vector)
const 106 const dealii::Tensor<1,dim,real2> velocities_parallel_to_wall = compute_velocities_parallel_to_wall(conservative_soln,normal_vector);
108 const dealii::Tensor<1,dim,real2> tangent_vector = compute_wall_tangent_vector_from_velocities_parallel_to_wall(velocities_parallel_to_wall);
109 return tangent_vector;
112 template <
int dim,
int nspecies,
int nstate,
typename real>
113 template<
typename real2>
116 const dealii::Tensor<1,dim,real2> &velocities_parallel_to_wall)
const 119 real2 magnitude = 0.0;
120 for(
int d=0;d<dim;++d){
121 magnitude += velocities_parallel_to_wall[d]*velocities_parallel_to_wall[d];
123 magnitude = pow(magnitude,0.5);
125 dealii::Tensor<1,dim,real2> tangent_vector;
126 for(
int d=0;d<dim;++d){
127 tangent_vector[d] = velocities_parallel_to_wall[d]/magnitude;
129 return tangent_vector;
132 template <
int dim,
int nspecies,
int nstate,
typename real>
133 template<
typename real2>
136 const std::array<real2,nstate> &conservative_soln,
137 const std::array<dealii::Tensor<1,dim,real2>,nstate> &conservative_soln_gradient,
138 const dealii::Tensor<1,dim,real2> &normal_vector)
const 142 const std::array<real2,nstate> primitive_soln = this->
template convert_conservative_to_primitive_templated<real2>(conservative_soln);
143 const std::array<dealii::Tensor<1,dim,real2>,nstate> primitive_soln_gradient
144 = this->
template convert_conservative_gradient_to_primitive_gradient_templated<real2>(conservative_soln,conservative_soln_gradient);
190 const dealii::Tensor<2,dim,real2> viscous_stress_tensor = compute_viscous_stress_tensor<real2>(primitive_soln,primitive_soln_gradient);
211 dealii::Tensor<1,dim,real2> viscous_stress_tensor_times_normal_vector;
212 for(
int i=0;i<dim;++i){
213 viscous_stress_tensor_times_normal_vector[i] = 0.0;
214 for(
int j=0;j<dim;++j){
215 viscous_stress_tensor_times_normal_vector[i] += viscous_stress_tensor[i][j]*normal_vector[j];
227 real2 wall_shear_stress = 0.0;
228 for(
int i=0;i<dim;++i){
230 wall_shear_stress += viscous_stress_tensor_times_normal_vector[i]*viscous_stress_tensor_times_normal_vector[i];
232 wall_shear_stress = pow(wall_shear_stress,0.5);
235 return wall_shear_stress;
238 template <
int dim,
int nspecies,
int nstate,
typename real>
239 template<
typename real2>
244 real2 viscosity_coefficient;
245 if(use_constant_viscosity){
246 viscosity_coefficient = 1.0*constant_viscosity;
248 viscosity_coefficient = compute_viscosity_coefficient_sutherlands_law<real2>(primitive_soln);
251 return viscosity_coefficient;
254 template <
int dim,
int nspecies,
int nstate,
typename real>
255 template<
typename real2>
260 real2 viscosity_coefficient;
261 if(use_constant_viscosity){
262 viscosity_coefficient = 1.0*constant_viscosity;
264 viscosity_coefficient = compute_viscosity_coefficient_sutherlands_law_from_temperature<real2>(temperature);
267 return viscosity_coefficient;
270 template <
int dim,
int nspecies,
int nstate,
typename real>
271 template<
typename real2>
283 const real2 temperature = this->
template compute_temperature<real2>(primitive_soln);
285 const real2 viscosity_coefficient = compute_viscosity_coefficient_sutherlands_law_from_temperature<real2>(temperature);
287 return viscosity_coefficient;
290 template <
int dim,
int nspecies,
int nstate,
typename real>
291 template<
typename real2>
302 const real2 viscosity_coefficient = ((1.0 + temperature_ratio)/(temperature + temperature_ratio))*pow(temperature,1.5);
304 return viscosity_coefficient;
307 template <
int dim,
int nspecies,
int nstate,
typename real>
308 template<
typename real2>
315 const real2 scaled_viscosity_coefficient = viscosity_coefficient/reynolds_number_inf;
317 return scaled_viscosity_coefficient;
320 template <
int dim,
int nspecies,
int nstate,
typename real>
321 template<
typename real2>
328 const real2 viscosity_coefficient = compute_viscosity_coefficient<real2>(primitive_soln);
329 const real2 scaled_viscosity_coefficient = scale_viscosity_coefficient(viscosity_coefficient);
331 return scaled_viscosity_coefficient;
334 template <
int dim,
int nspecies,
int nstate,
typename real>
335 template<
typename real2>
342 const real2 scaled_heat_conductivity = scaled_viscosity_coefficient/(this->gamm1*this->mach_inf_sqr*prandtl_number_input);
344 return scaled_heat_conductivity;
347 template <
int dim,
int nspecies,
int nstate,
typename real>
348 template<
typename real2>
355 const real2 scaled_viscosity_coefficient = compute_scaled_viscosity_coefficient<real2>(primitive_soln);
357 const real2 scaled_heat_conductivity = compute_scaled_heat_conductivity_given_scaled_viscosity_coefficient_and_prandtl_number(scaled_viscosity_coefficient,prandtl_number);
359 return scaled_heat_conductivity;
362 template <
int dim,
int nspecies,
int nstate,
typename real>
363 template<
typename real2>
366 const std::array<real2,nstate> &primitive_soln,
367 const std::array<dealii::Tensor<1,dim,real2>,nstate> &primitive_soln_gradient)
const 372 const real2 scaled_heat_conductivity = compute_scaled_heat_conductivity<real2>(primitive_soln);
373 const dealii::Tensor<1,dim,real2> temperature_gradient = compute_temperature_gradient<real2>(primitive_soln, primitive_soln_gradient);
375 const dealii::Tensor<1,dim,real2> heat_flux = compute_heat_flux_given_scaled_heat_conductivity_and_temperature_gradient<real2>(scaled_heat_conductivity,temperature_gradient);
379 template <
int dim,
int nspecies,
int nstate,
typename real>
380 template<
typename real2>
383 const real2 scaled_heat_conductivity,
384 const dealii::Tensor<1,dim,real2> &temperature_gradient)
const 389 dealii::Tensor<1,dim,real2> heat_flux;
390 for (
int d=0; d<dim; d++) {
391 heat_flux[d] = -scaled_heat_conductivity*temperature_gradient[d];
396 template <
int dim,
int nspecies,
int nstate,
typename real>
397 template<
typename real2>
400 const std::array<real2,nstate> &conservative_soln,
401 const std::array<dealii::Tensor<1,dim,real2>,nstate> &conservative_soln_gradient)
const 404 dealii::Tensor<1,3,real2> vorticity;
405 for(
int d=0; d<3; ++d) {
408 if constexpr(dim>1) {
410 const std::array<dealii::Tensor<1,dim,real2>,nstate> primitive_soln_gradient = this->
template convert_conservative_gradient_to_primitive_gradient_templated<real2>(conservative_soln, conservative_soln_gradient);
411 const dealii::Tensor<2,dim,real2> velocities_gradient = extract_velocities_gradient_from_primitive_solution_gradient<real2>(primitive_soln_gradient);
412 if constexpr(dim==2) {
414 vorticity[2] = velocities_gradient[1][0] - velocities_gradient[0][1];
416 if constexpr(dim==3) {
417 vorticity[0] = velocities_gradient[2][1] - velocities_gradient[1][2];
418 vorticity[1] = velocities_gradient[0][2] - velocities_gradient[2][0];
419 vorticity[2] = velocities_gradient[1][0] - velocities_gradient[0][1];
425 template <
int dim,
int nspecies,
int nstate,
typename real>
428 const std::array<real,nstate> &conservative_soln,
429 const std::array<dealii::Tensor<1,dim,real>,nstate> &conservative_soln_gradient)
const 432 dealii::Tensor<1,3,real> vorticity = compute_vorticity(conservative_soln, conservative_soln_gradient);
434 real vorticity_magnitude_sqr = 0.0;
435 for(
int d=0; d<3; ++d) {
436 vorticity_magnitude_sqr += vorticity[d]*vorticity[d];
438 return vorticity_magnitude_sqr;
441 template <
int dim,
int nspecies,
int nstate,
typename real>
444 const std::array<real,nstate> &conservative_soln,
445 const std::array<dealii::Tensor<1,dim,real>,nstate> &conservative_soln_gradient)
const 447 real vorticity_magnitude_sqr = compute_vorticity_magnitude_sqr(conservative_soln, conservative_soln_gradient);
448 real vorticity_magnitude = sqrt(vorticity_magnitude_sqr);
449 return vorticity_magnitude;
452 template <
int dim,
int nspecies,
int nstate,
typename real>
455 const std::array<real,nstate> &conservative_soln,
456 const std::array<dealii::Tensor<1,dim,real>,nstate> &conservative_soln_gradient)
const 461 real second_invariant = 0.0;
462 if constexpr(dim>1) {
464 const std::array<dealii::Tensor<1,dim,real>,nstate> primitive_soln_gradient = this->
template convert_conservative_gradient_to_primitive_gradient_templated<real>(conservative_soln, conservative_soln_gradient);
465 const dealii::Tensor<2,dim,real> velocities_gradient = extract_velocities_gradient_from_primitive_solution_gradient<real>(primitive_soln_gradient);
467 const dealii::Tensor<2,dim,real> strain_rate_tensor_symmetric = compute_strain_rate_tensor<real>(velocities_gradient);
469 dealii::Tensor<2,dim,real> strain_rate_tensor_antisymmetric;
470 for (
int d1=0; d1<dim; d1++) {
471 for (
int d2=0; d2<dim; d2++) {
472 strain_rate_tensor_antisymmetric[d1][d2] = 0.5*(velocities_gradient[d1][d2] - velocities_gradient[d2][d1]);
475 second_invariant = 0.5*(get_tensor_magnitude_sqr(strain_rate_tensor_antisymmetric) - get_tensor_magnitude_sqr(strain_rate_tensor_symmetric));
477 return second_invariant;
480 template <
int dim,
int nspecies,
int nstate,
typename real>
483 const std::array<real,nstate> &conservative_soln,
484 const std::array<dealii::Tensor<1,dim,real>,nstate> &conservative_soln_gradient)
const 487 const real density = conservative_soln[0];
488 real enstrophy = 0.5*density*compute_vorticity_magnitude_sqr(conservative_soln, conservative_soln_gradient);
492 template <
int dim,
int nspecies,
int nstate,
typename real>
495 const std::array<real,nstate> &conservative_soln,
496 const std::array<dealii::Tensor<1,dim,real>,nstate> &conservative_soln_gradient)
const 499 real enstrophy = 0.5*compute_vorticity_magnitude_sqr(conservative_soln, conservative_soln_gradient);
503 template <
int dim,
int nspecies,
int nstate,
typename real>
506 const std::array<real,nstate> &,
507 const std::array<dealii::Tensor<1,dim,real>,3> &vorticity_gradient)
const 510 real vorticity_gradient_magnitude_sqr = 0.0;
511 for(
int istate=0; istate<3; ++istate) {
512 for(
int d=0; d<dim; ++d) {
513 vorticity_gradient_magnitude_sqr += vorticity_gradient[istate][d]*vorticity_gradient[istate][d];
517 const real palinstrophy = 0.5*vorticity_gradient_magnitude_sqr;
521 template <
int dim,
int nspecies,
int nstate,
typename real>
524 const real integrated_enstrophy)
const 526 real dissipation_rate = 2.0*integrated_enstrophy/(this->reynolds_number_inf);
527 return dissipation_rate;
530 template <
int dim,
int nspecies,
int nstate,
typename real>
533 const std::array<real,nstate> &conservative_soln,
534 const std::array<dealii::Tensor<1,dim,real>,nstate> &conservative_soln_gradient)
const 537 const real pressure = this->
template compute_pressure_templated<real>(conservative_soln);
540 real pressure_dilatation = compute_dilatation(conservative_soln,conservative_soln_gradient);
541 pressure_dilatation *= pressure;
543 return pressure_dilatation;
546 template <
int dim,
int nspecies,
int nstate,
typename real>
549 const std::array<real,nstate> &conservative_soln,
550 const std::array<dealii::Tensor<1,dim,real>,nstate> &conservative_soln_gradient)
const 553 const std::array<dealii::Tensor<1,dim,real>,nstate> primitive_soln_gradient = this->
template convert_conservative_gradient_to_primitive_gradient_templated<real>(conservative_soln, conservative_soln_gradient);
554 const dealii::Tensor<2,dim,real> velocities_gradient = extract_velocities_gradient_from_primitive_solution_gradient<real>(primitive_soln_gradient);
557 real dilatation = 0.0;
558 for(
int d=0; d<dim; ++d) {
559 dilatation += velocities_gradient[d][d];
565 template <
int dim,
int nspecies,
int nstate,
typename real>
568 const std::array<real,nstate> &,
569 const std::array<dealii::Tensor<1,dim,real>,nstate> &conservative_soln_gradient)
const 572 dealii::Tensor<1,dim,real> density_gradient;
573 for (
int d=0; d<dim; d++) {
574 density_gradient[d] = conservative_soln_gradient[0][d];
577 real density_gradient_magnitude = 0.0;
578 for (
int d=0; d<dim; d++) {
579 density_gradient_magnitude += density_gradient[d]*density_gradient[d];
581 density_gradient_magnitude = sqrt(density_gradient_magnitude);
582 return density_gradient_magnitude;
585 template <
int dim,
int nspecies,
int nstate,
typename real>
588 const std::array<real,nstate> &conservative_soln,
589 const std::array<dealii::Tensor<1,dim,real>,nstate> &conservative_soln_gradient)
const 591 return compute_strain_rate_tensor_from_conservative_templated<real>(conservative_soln,conservative_soln_gradient);
594 template <
int dim,
int nspecies,
int nstate,
typename real>
595 template<
typename real2>
598 const std::array<real2,nstate> &conservative_soln,
599 const std::array<dealii::Tensor<1,dim,real2>,nstate> &conservative_soln_gradient)
const 602 const std::array<dealii::Tensor<1,dim,real2>,nstate> primitive_soln_gradient = this->
template convert_conservative_gradient_to_primitive_gradient_templated<real2>(conservative_soln, conservative_soln_gradient);
603 const dealii::Tensor<2,dim,real2> velocities_gradient = extract_velocities_gradient_from_primitive_solution_gradient<real2>(primitive_soln_gradient);
606 const dealii::Tensor<2,dim,real2> strain_rate_tensor = compute_strain_rate_tensor<real2>(velocities_gradient);
607 return strain_rate_tensor;
610 template <
int dim,
int nspecies,
int nstate,
typename real>
613 const std::array<real,nstate> &conservative_soln,
614 const std::array<dealii::Tensor<1,dim,real>,nstate> &conservative_soln_gradient)
const 617 const std::array<dealii::Tensor<1,dim,real>,nstate> primitive_soln_gradient = this->
template convert_conservative_gradient_to_primitive_gradient_templated<real>(conservative_soln, conservative_soln_gradient);
618 const dealii::Tensor<2,dim,real> velocities_gradient = extract_velocities_gradient_from_primitive_solution_gradient<real>(primitive_soln_gradient);
621 const dealii::Tensor<2,dim,real> strain_rate_tensor = compute_strain_rate_tensor<real>(velocities_gradient);
624 real vel_divergence = 0.0;
625 for(
int d1=0; d1<dim; ++d1) {
626 vel_divergence += velocities_gradient[d1][d1];
630 dealii::Tensor<2,dim,real> deviatoric_strain_rate_tensor;
631 for(
int d1=0; d1<dim; ++d1) {
632 for(
int d2=0; d2<dim; ++d2) {
633 deviatoric_strain_rate_tensor[d1][d2] = strain_rate_tensor[d1][d2];
635 deviatoric_strain_rate_tensor[d1][d1] -= (1.0/3.0)*vel_divergence;
637 return deviatoric_strain_rate_tensor;
640 template <
int dim,
int nspecies,
int nstate,
typename real>
643 const dealii::Tensor<2,dim,real> &tensor)
const 645 real tensor_magnitude_sqr = 0.0;
646 for (
int i=0; i<dim; ++i) {
647 for (
int j=0; j<dim; ++j) {
648 tensor_magnitude_sqr += tensor[i][j]*tensor[i][j];
651 return tensor_magnitude_sqr;
654 template <
int dim,
int nspecies,
int nstate,
typename real>
657 const dealii::Tensor<2,dim,real> &tensor)
const 659 return sqrt(get_tensor_magnitude_sqr(tensor));
662 template <
int dim,
int nspecies,
int nstate,
typename real>
665 const std::array<real,nstate> &conservative_soln,
666 const std::array<dealii::Tensor<1,dim,real>,nstate> &conservative_soln_gradient)
const 669 const dealii::Tensor<2,dim,real> deviatoric_strain_rate_tensor = compute_deviatoric_strain_rate_tensor(conservative_soln,conservative_soln_gradient);
671 real deviatoric_strain_rate_tensor_magnitude_sqr = get_tensor_magnitude_sqr(deviatoric_strain_rate_tensor);
674 const std::array<real,nstate> primitive_soln = this->
template convert_conservative_to_primitive_templated<real>(conservative_soln);
675 const real viscosity_coefficient = compute_viscosity_coefficient (primitive_soln);
677 return (viscosity_coefficient*deviatoric_strain_rate_tensor_magnitude_sqr);
680 template <
int dim,
int nspecies,
int nstate,
typename real>
683 const real integrated_viscosity_times_deviatoric_strain_rate_tensor_magnitude_sqr)
const 685 real dissipation_rate = 2.0*integrated_viscosity_times_deviatoric_strain_rate_tensor_magnitude_sqr/(this->reynolds_number_inf);
686 return dissipation_rate;
689 template <
int dim,
int nspecies,
int nstate,
typename real>
690 template<
typename real2>
693 const std::array<dealii::Tensor<1,dim,real2>,nstate> &primitive_soln_gradient)
const 695 dealii::Tensor<2,dim,real2> velocities_gradient;
696 for (
int d1=0; d1<dim; d1++) {
697 for (
int d2=0; d2<dim; d2++) {
698 velocities_gradient[d1][d2] = primitive_soln_gradient[1+d1][d2];
701 return velocities_gradient;
704 template <
int dim,
int nspecies,
int nstate,
typename real>
705 template<
typename real2>
708 const dealii::Tensor<2,dim,real2> &vel_gradient)
const 711 dealii::Tensor<2,dim,real2> strain_rate_tensor;
712 for (
int d1=0; d1<dim; d1++) {
713 for (
int d2=0; d2<dim; d2++) {
715 strain_rate_tensor[d1][d2] = 0.5*(vel_gradient[d1][d2] + vel_gradient[d2][d1]);
718 return strain_rate_tensor;
721 template <
int dim,
int nspecies,
int nstate,
typename real>
724 const std::array<real,nstate> &conservative_soln,
725 const std::array<dealii::Tensor<1,dim,real>,nstate> &conservative_soln_gradient)
const 728 const std::array<dealii::Tensor<1,dim,real>,nstate> primitive_soln_gradient = this->
template convert_conservative_gradient_to_primitive_gradient_templated<real>(conservative_soln, conservative_soln_gradient);
729 const dealii::Tensor<2,dim,real> velocities_gradient = extract_velocities_gradient_from_primitive_solution_gradient<real>(primitive_soln_gradient);
732 const dealii::Tensor<2,dim,real> strain_rate_tensor = compute_strain_rate_tensor(velocities_gradient);
734 real strain_rate_tensor_magnitude_sqr = get_tensor_magnitude_sqr(strain_rate_tensor);
737 const std::array<real,nstate> primitive_soln = this->
template convert_conservative_to_primitive_templated<real>(conservative_soln);
738 const real viscosity_coefficient = compute_viscosity_coefficient (primitive_soln);
740 return (viscosity_coefficient*strain_rate_tensor_magnitude_sqr);
743 template <
int dim,
int nspecies,
int nstate,
typename real>
746 const real integrated_viscosity_times_strain_rate_tensor_magnitude_sqr)
const 748 real dissipation_rate = 2.0*integrated_viscosity_times_strain_rate_tensor_magnitude_sqr/(this->reynolds_number_inf);
749 return dissipation_rate;
752 template <
int dim,
int nspecies,
int nstate,
typename real>
753 template<
typename real2>
756 const real2 scaled_viscosity_coefficient,
757 const dealii::Tensor<2,dim,real2> &strain_rate_tensor)
const 765 real2 vel_divergence;
766 if(std::is_same<real2,real>::value){
767 vel_divergence = 0.0;
770 for (
int d=0; d<dim; d++) {
771 vel_divergence += strain_rate_tensor[d][d];
775 dealii::Tensor<2,dim,real2> viscous_stress_tensor;
776 const real2 scaled_2nd_viscosity_coefficient = (-2.0/3.0)*scaled_viscosity_coefficient;
777 for (
int d1=0; d1<dim; d1++) {
778 for (
int d2=0; d2<dim; d2++) {
779 viscous_stress_tensor[d1][d2] = 2.0*scaled_viscosity_coefficient*strain_rate_tensor[d1][d2];
781 viscous_stress_tensor[d1][d1] += scaled_2nd_viscosity_coefficient*vel_divergence;
783 return viscous_stress_tensor;
786 template <
int dim,
int nspecies,
int nstate,
typename real>
789 const std::array<real,nstate> &conservative_soln,
790 const std::array<dealii::Tensor<1,dim,real>,nstate> &conservative_soln_gradient)
const 792 return compute_viscous_stress_tensor_from_conservative_templated<real>(conservative_soln,conservative_soln_gradient);
795 template <
int dim,
int nspecies,
int nstate,
typename real>
796 template<
typename real2>
799 const std::array<real2,nstate> &conservative_soln,
800 const std::array<dealii::Tensor<1,dim,real2>,nstate> &conservative_soln_gradient)
const 803 const std::array<real2,nstate> primitive_soln = this->
template convert_conservative_to_primitive_templated<real2>(conservative_soln);
806 const std::array<dealii::Tensor<1,dim,real2>,nstate> primitive_soln_gradient = this->
template convert_conservative_gradient_to_primitive_gradient_templated<real2>(conservative_soln, conservative_soln_gradient);
809 const dealii::Tensor<2,dim,real2> viscous_stress_tensor = compute_viscous_stress_tensor<real2>(primitive_soln,primitive_soln_gradient);
811 return viscous_stress_tensor;
814 template <
int dim,
int nspecies,
int nstate,
typename real>
815 template<
typename real2>
818 const std::array<real2,nstate> &primitive_soln,
819 const std::array<dealii::Tensor<1,dim,real2>,nstate> &primitive_soln_gradient)
const 824 const dealii::Tensor<2,dim,real2> vel_gradient = extract_velocities_gradient_from_primitive_solution_gradient<real2>(primitive_soln_gradient);
825 const dealii::Tensor<2,dim,real2> strain_rate_tensor = compute_strain_rate_tensor<real2>(vel_gradient);
826 const real2 scaled_viscosity_coefficient = compute_scaled_viscosity_coefficient<real2>(primitive_soln);
829 const dealii::Tensor<2,dim,real2> viscous_stress_tensor
830 = compute_viscous_stress_tensor_via_scaled_viscosity_and_strain_rate_tensor<real2>(scaled_viscosity_coefficient,strain_rate_tensor);
832 return viscous_stress_tensor;
835 template <
int dim,
int nspecies,
int nstate,
typename real>
838 const std::array<real,nstate> &conservative_soln)
const 840 const dealii::Tensor<1,dim,real> vel = this->
template compute_velocities<real>(conservative_soln);
841 dealii::Tensor<2,dim,real> matrix_L;
842 for (
int i=0; i<dim; i++) {
843 for (
int j=0; j<dim; j++) {
844 matrix_L[i][j] = vel[i]*vel[j];
850 template <
int dim,
int nspecies,
int nstate,
typename real>
853 const std::array<real,nstate> &conservative_soln,
854 const std::array<dealii::Tensor<1,dim,real>,nstate> &conservative_soln_gradient)
const 856 dealii::Tensor<2,dim,real> matrix_M;
859 const dealii::Tensor<2,dim,real> strain_rate_tensor = compute_strain_rate_tensor_from_conservative(conservative_soln, conservative_soln_gradient);
861 const real strain_rate_tensor_magnitude = sqrt(2.0*get_tensor_magnitude_sqr(strain_rate_tensor));
864 real strain_rate_tensor_trace = 0.0;
865 for(
int i=0; i<dim; ++i) {
866 strain_rate_tensor_trace += strain_rate_tensor[i][i];
870 dealii::Tensor<2,dim,real> deviatoric_strain_rate_tensor;
871 for(
int i=0; i<dim; ++i) {
872 for(
int j=0; j<dim; ++j) {
873 matrix_M[i][j] = strain_rate_tensor_magnitude*strain_rate_tensor[i][j];
875 matrix_M[i][i] -= strain_rate_tensor_magnitude*(1.0/3.0)*strain_rate_tensor_trace;
881 template <
int dim,
int nspecies,
int nstate,
typename real>
884 const dealii::Tensor<2,dim,real> &tensor1,
885 const dealii::Tensor<2,dim,real> &tensor2)
const 887 real tensor_product_magnitude_sqr = 0.0;
888 for (
int i=0; i<dim; ++i) {
889 for (
int j=0; j<dim; ++j) {
890 tensor_product_magnitude_sqr += tensor1[i][j]*tensor2[i][j];
893 return tensor_product_magnitude_sqr;
896 template <
int dim,
int nspecies,
int nstate,
typename real>
899 const std::array<real,nstate> &conservative_soln,
900 const std::array<dealii::Tensor<1,dim,real>,nstate> &solution_gradient)
const 905 std::array<dealii::Tensor<1,dim,real>,nstate> viscous_flux = dissipative_flux_templated<real>(conservative_soln, solution_gradient);
909 template <
int dim,
int nspecies,
int nstate,
typename real>
912 const std::array<real,nstate> &primitive_soln,
913 const dealii::Tensor<1,dim,real> &temperature_gradient)
const 918 const real temperature = this->compute_temperature(primitive_soln);
919 const real scaled_viscosity_coefficient = compute_scaled_viscosity_coefficient(primitive_soln);
922 real dmudT = 0.5*(scaled_viscosity_coefficient/(temperature + temperature_ratio))*(1.0 + 3.0*temperature_ratio/temperature);
925 dealii::Tensor<1,dim,real> scaled_viscosity_coefficient_gradient;
926 for (
int d=0; d<dim; d++) {
927 scaled_viscosity_coefficient_gradient[d] = dmudT*temperature_gradient[d];
930 return scaled_viscosity_coefficient_gradient;
934 template<
typename real>
935 double getValue(
const real &x) {
936 if constexpr(std::is_same<real,double>::value) {
939 else if constexpr(std::is_same<real,FadType>::value) {
942 else if constexpr(std::is_same<real,FadFadType>::value) {
943 return x.val().val();
945 else if constexpr(std::is_same<real,RadType>::value) {
948 else if(std::is_same<real,RadFadType>::value) {
949 return x.value().value();
953 template <
int dim,
int nspecies,
int nstate,
typename real>
956 const std::array<real,nstate> &conservative_soln,
957 const std::array<dealii::Tensor<1,dim,real>,nstate> &solution_gradient,
958 const dealii::Tensor<1,dim,real> &normal)
const 963 std::array<adtype,nstate> AD_conservative_soln;
964 std::array<dealii::Tensor<1,dim,adtype>,nstate> AD_solution_gradient;
965 for (
int s=0; s<nstate; s++) {
966 adtype ADvar(nstate, s, getValue<real>(conservative_soln[s]));
967 AD_conservative_soln[s] = ADvar;
968 for (
int d=0;d<dim;d++) {
969 AD_solution_gradient[s][d] = getValue<real>(solution_gradient[s][d]);
974 std::array<dealii::Tensor<1,dim,adtype>,nstate> AD_dissipative_flux = dissipative_flux_templated<adtype>(AD_conservative_soln, AD_solution_gradient);
977 dealii::Tensor<2,nstate,real> jacobian;
978 for (
int sp=0; sp<nstate; sp++) {
980 for (
int s=0; s<nstate; s++) {
981 jacobian[s][sp] = 0.0;
982 for (
int d=0;d<dim;d++) {
984 jacobian[s][sp] += AD_dissipative_flux[s][d].dx(sp)*normal[d];
991 template <
int dim,
int nspecies,
int nstate,
typename real>
994 const std::array<real,nstate> &conservative_soln,
995 const std::array<dealii::Tensor<1,dim,real>,nstate> &solution_gradient,
996 const dealii::Tensor<1,dim,real> &normal,
997 const int d_gradient)
const 1002 std::array<adtype,nstate> AD_conservative_soln;
1003 std::array<dealii::Tensor<1,dim,adtype>,nstate> AD_solution_gradient;
1004 for (
int s=0; s<nstate; s++) {
1005 AD_conservative_soln[s] = getValue<real>(conservative_soln[s]);
1006 for (
int d=0;d<dim;d++) {
1007 if(d == d_gradient){
1008 adtype ADvar(nstate, s, getValue<real>(solution_gradient[s][d]));
1009 AD_solution_gradient[s][d] = ADvar;
1012 AD_solution_gradient[s][d] = getValue<real>(solution_gradient[s][d]);
1018 std::array<dealii::Tensor<1,dim,adtype>,nstate> AD_dissipative_flux = dissipative_flux_templated<adtype>(AD_conservative_soln, AD_solution_gradient);
1021 dealii::Tensor<2,nstate,real> jacobian;
1022 for (
int sp=0; sp<nstate; sp++) {
1024 for (
int s=0; s<nstate; s++) {
1025 jacobian[s][sp] = 0.0;
1026 for (
int d=0;d<dim;d++) {
1028 jacobian[s][sp] += AD_dissipative_flux[s][d].dx(sp)*normal[d];
1035 template <
int dim,
int nspecies,
int nstate,
typename real>
1038 const dealii::Point<dim,real> &pos)
const 1041 const std::array<real,nstate> manufactured_solution = this->get_manufactured_solution_value(pos);
1044 const std::array<dealii::Tensor<1,dim,real>,nstate> manufactured_solution_gradient = this->get_manufactured_solution_gradient(pos);
1047 std::array<dealii::SymmetricTensor<2,dim,real>,nstate> manufactured_solution_hessian;
1048 for (
int s=0; s<nstate; s++) {
1049 dealii::SymmetricTensor<2,dim,real> hessian = this->manufactured_solution_function->hessian(pos,s);
1050 for (
int dr=0;dr<dim;dr++) {
1051 for (
int dc=0;dc<dim;dc++) {
1052 manufactured_solution_hessian[s][dr][dc] = hessian[dr][dc];
1059 dealii::Tensor<1,nstate,real> dissipative_flux_divergence;
1060 for (
int d=0;d<dim;d++) {
1061 dealii::Tensor<1,dim,real> normal;
1063 const dealii::Tensor<2,nstate,real> jacobian = dissipative_flux_directional_jacobian(manufactured_solution, manufactured_solution_gradient, normal);
1066 std::array<dealii::Tensor<2,nstate,real>,dim> jacobian_wrt_gradient;
1067 for (
int d_gradient=0;d_gradient<dim;d_gradient++) {
1070 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);
1073 for (
int sr = 0; sr < nstate; ++sr) {
1074 for (
int sc = 0; sc < nstate; ++sc) {
1075 jacobian_wrt_gradient[d_gradient][sr][sc] = jacobian_wrt_gradient_component[sr][sc];
1079 for (
int sr = 0; sr < nstate; ++sr) {
1080 real jac_grad_row = 0.0;
1081 for (
int sc = 0; sc < nstate; ++sc) {
1082 jac_grad_row += jacobian[sr][sc]*manufactured_solution_gradient[sc][d];
1085 for (
int d_gradient=0;d_gradient<dim;d_gradient++) {
1086 jac_grad_row += jacobian_wrt_gradient[d_gradient][sr][sc]*manufactured_solution_hessian[sc][d_gradient][d];
1089 dissipative_flux_divergence[sr] += jac_grad_row;
1092 std::array<real,nstate> dissipative_source_term;
1093 for (
int s=0; s<nstate; s++) {
1094 dissipative_source_term[s] = dissipative_flux_divergence[s];
1097 return dissipative_source_term;
1100 template <
int dim,
int nspecies,
int nstate,
typename real>
1103 const dealii::Point<dim,real> &pos,
1104 const std::array<real,nstate> &,
1108 const std::array<real,nstate> conv_source_term = this->convective_source_term(pos);
1109 const std::array<real,nstate> diss_source_term = dissipative_source_term(pos);
1110 std::array<real,nstate> source_term;
1111 for (
int s=0; s<nstate; s++)
1113 source_term[s] = conv_source_term[s] + diss_source_term[s];
1118 template <
int dim,
int nspecies,
int nstate,
typename real>
1121 std::array<real,nstate> &conservative_soln,
1122 const dealii::Tensor<1,dim,real> &normal)
const 1127 std::array<adtype,nstate> AD_conservative_soln;
1128 for (
int s=0; s<nstate; s++) {
1129 adtype ADvar(nstate, s, getValue<real>(conservative_soln[s]));
1130 AD_conservative_soln[s] = ADvar;
1135 std::array<dealii::Tensor<1,dim,adtype>,nstate> AD_conv_flux;
1136 const adtype density = AD_conservative_soln[0];
1137 const adtype pressure = this->
template compute_pressure_templated<adtype>(AD_conservative_soln);
1138 const dealii::Tensor<1,dim,adtype> vel = this->
template compute_velocities<adtype>(AD_conservative_soln);
1139 const adtype specific_total_energy = AD_conservative_soln[nstate-1]/AD_conservative_soln[0];
1140 const adtype specific_total_enthalpy = specific_total_energy + pressure/density;
1141 for (
int flux_dim=0; flux_dim<dim; ++flux_dim) {
1143 AD_conv_flux[0][flux_dim] = AD_conservative_soln[1+flux_dim];
1145 for (
int velocity_dim=0; velocity_dim<dim; ++velocity_dim){
1146 AD_conv_flux[1+velocity_dim][flux_dim] = density*vel[flux_dim]*vel[velocity_dim];
1148 AD_conv_flux[1+flux_dim][flux_dim] += pressure;
1150 AD_conv_flux[nstate-1][flux_dim] = density*vel[flux_dim]*specific_total_enthalpy;
1155 dealii::Tensor<2,nstate,real> jacobian;
1156 for (
int sp=0; sp<nstate; sp++) {
1158 for (
int s=0; s<nstate; s++) {
1159 jacobian[s][sp] = 0.0;
1160 for (
int d=0;d<dim;d++) {
1162 jacobian[s][sp] += AD_conv_flux[s][d].dx(sp)*normal[d];
1169 template <
int dim,
int nspecies,
int nstate,
typename real>
1172 std::array<real,nstate> &conservative_soln)
const 1177 const std::array<real,nstate> primitive_soln = this->
template convert_conservative_to_primitive_templated<real>(conservative_soln);
1180 real temperature = this->
template compute_temperature<real>(primitive_soln);
1183 adtype AD_temperature(1, 0, getValue<real>(temperature));
1186 adtype viscosity_coefficient = ((1.0 + temperature_ratio)/(AD_temperature + temperature_ratio))*pow(AD_temperature,1.5);
1187 adtype scaled_viscosity_coefficient = viscosity_coefficient/reynolds_number_inf;
1190 real dmudT = scaled_viscosity_coefficient.dx(0);
1195 template <
int dim,
int nspecies,
int nstate,
typename real>
1196 template<
typename real2>
1199 const std::array<real2,nstate> &conservative_soln,
1200 const std::array<dealii::Tensor<1,dim,real2>,nstate> &solution_gradient)
const 1207 const std::array<real2,nstate> primitive_soln = this->
template convert_conservative_to_primitive_templated<real2>(conservative_soln);
1210 const std::array<dealii::Tensor<1,dim,real2>,nstate> primitive_soln_gradient = this->
template convert_conservative_gradient_to_primitive_gradient_templated<real2>(conservative_soln, solution_gradient);
1213 const dealii::Tensor<2,dim,real2> viscous_stress_tensor = compute_viscous_stress_tensor<real2>(primitive_soln, primitive_soln_gradient);
1214 const dealii::Tensor<1,dim,real2> vel = this->
template extract_velocities_from_primitive<real2>(primitive_soln);
1215 const dealii::Tensor<1,dim,real2> heat_flux = compute_heat_flux<real2>(primitive_soln, primitive_soln_gradient);
1218 const std::array<dealii::Tensor<1,dim,real2>,nstate> viscous_flux = dissipative_flux_given_velocities_viscous_stress_tensor_and_heat_flux<real2>(vel,viscous_stress_tensor,heat_flux);
1219 return viscous_flux;
1222 template <
int dim,
int nspecies,
int nstate,
typename real>
1225 const std::array<real,nstate> &solution,
1226 const std::array<dealii::Tensor<1,dim,real>,nstate> &solution_gradient,
1227 const std::array<real,nstate> &filtered_solution,
1228 const std::array<dealii::Tensor<1,dim,real>,nstate> &filtered_solution_gradient,
1229 const bool on_boundary,
1230 const dealii::types::global_dof_index cell_index,
1231 const dealii::Tensor<1,dim,real> &normal,
1232 const int boundary_type)
1234 std::array<real,nstate> dissipative_flux_dot_normal;
1236 if((on_boundary && (thermal_boundary_condition_type == thermal_boundary_condition_enum::adiabatic))
1237 && (boundary_type == 1001)) {
1242 dissipative_flux_dot_normal = this->dissipative_flux_dot_normal_on_adiabatic_boundary (
1246 filtered_solution_gradient,
1252 std::array<dealii::Tensor<1,dim,real>,nstate> dissipative_flux;
1253 dissipative_flux = dissipative_flux_templated<real>(solution,solution_gradient);
1255 dissipative_flux_dot_normal.fill(0.0);
1256 for (
int s=0; s<nstate; s++) {
1257 for (
int d=0; d<dim; ++d) {
1258 dissipative_flux_dot_normal[s] += dissipative_flux[s][d] * normal[d];
1263 return dissipative_flux_dot_normal;
1266 template <
int dim,
int nspecies,
int nstate,
typename real>
1269 const std::array<real,nstate> &solution,
1270 const std::array<dealii::Tensor<1,dim,real>,nstate> &solution_gradient,
1271 const std::array<real,nstate> &,
1272 const std::array<dealii::Tensor<1,dim,real>,nstate> &,
1273 const dealii::types::global_dof_index ,
1274 const dealii::Tensor<1,dim,real> &normal)
1276 std::array<real,nstate> dissipative_flux_dot_normal;
1289 const std::array<real,nstate> primitive_soln = this->
template convert_conservative_to_primitive_templated<real>(solution);
1292 const std::array<dealii::Tensor<1,dim,real>,nstate> primitive_soln_gradient = this->
template convert_conservative_gradient_to_primitive_gradient_templated<real>(solution, solution_gradient);
1295 const dealii::Tensor<2,dim,real> viscous_stress_tensor = compute_viscous_stress_tensor<real>(primitive_soln, primitive_soln_gradient);
1296 const dealii::Tensor<1,dim,real> vel = this->
template extract_velocities_from_primitive<real>(primitive_soln);
1298 dealii::Tensor<1,dim,real> heat_flux;
1299 for (
int flux_dim=0; flux_dim<dim; ++flux_dim) {
1301 heat_flux[flux_dim] = 0.0;
1305 std::array<dealii::Tensor<1,dim,real>,nstate> dissipative_flux;
1306 dissipative_flux = dissipative_flux_given_velocities_viscous_stress_tensor_and_heat_flux<real>(vel,viscous_stress_tensor,heat_flux);
1309 dissipative_flux_dot_normal.fill(0.0);
1310 for (
int s=0; s<nstate; s++) {
1311 for (
int d=0; d<dim; ++d) {
1312 dissipative_flux_dot_normal[s] += dissipative_flux[s][d] * normal[d];
1316 return dissipative_flux_dot_normal;
1319 template <
int dim,
int nspecies,
int nstate,
typename real>
1320 template<
typename real2>
1323 const dealii::Tensor<1,dim,real2> &vel,
1324 const dealii::Tensor<2,dim,real2> &viscous_stress_tensor,
1325 const dealii::Tensor<1,dim,real2> &heat_flux)
const 1334 std::array<dealii::Tensor<1,dim,real2>,nstate> viscous_flux;
1335 for (
int flux_dim=0; flux_dim<dim; ++flux_dim) {
1337 viscous_flux[0][flux_dim] = 0.0;
1339 for (
int stress_dim=0; stress_dim<dim; ++stress_dim){
1340 viscous_flux[1+stress_dim][flux_dim] = -viscous_stress_tensor[stress_dim][flux_dim];
1343 viscous_flux[nstate-1][flux_dim] = 0.0;
1344 for (
int stress_dim=0; stress_dim<dim; ++stress_dim){
1345 viscous_flux[nstate-1][flux_dim] -= vel[stress_dim]*viscous_stress_tensor[flux_dim][stress_dim];
1347 viscous_flux[nstate-1][flux_dim] += heat_flux[flux_dim];
1349 return viscous_flux;
1352 template <
int dim,
int nspecies,
int nstate,
typename real>
1355 const int boundary_type,
1356 const dealii::Point<dim, real> &pos,
1357 const dealii::Tensor<1,dim,real> &normal_int,
1358 const std::array<real,nstate> &soln_int,
1359 const std::array<dealii::Tensor<1,dim,real>,nstate> &soln_grad_int,
1360 const std::array<real,nstate> &,
1361 const std::array<dealii::Tensor<1,dim,real>,nstate> &,
1362 std::array<real,nstate> &soln_bc,
1363 std::array<dealii::Tensor<1,dim,real>,nstate> &soln_grad_bc)
const 1365 if (boundary_type == 1000) {
1367 boundary_manufactured_solution (pos, normal_int, soln_int, soln_grad_int, soln_bc, soln_grad_bc);
1369 else if (boundary_type == 1001) {
1371 boundary_wall_viscous_flux (normal_int, soln_int, soln_grad_int, soln_bc, soln_grad_bc);
1373 else if (boundary_type == 1004) {
1375 this->boundary_riemann (normal_int, soln_int, soln_bc);
1377 else if (boundary_type == 1005) {
1379 this->boundary_farfield(soln_bc);
1381 else if (boundary_type == 1006)
1391 for (
int istate=0; istate<nstate; ++istate) {
1392 soln_bc[istate] = soln_int[istate];
1393 soln_grad_bc[istate] = soln_grad_int[istate];
1397 this->pcout <<
"Invalid boundary_type: " << boundary_type <<
" not implemented for viscous flows."<<std::endl;
1402 template <
int dim,
int nspecies,
int nstate,
typename real>
1405 const dealii::Tensor<1,dim,real> &,
1406 const std::array<real,nstate> &soln_int,
1407 const std::array<dealii::Tensor<1,dim,real>,nstate> &soln_grad_int,
1408 std::array<real,nstate> &soln_bc,
1409 std::array<dealii::Tensor<1,dim,real>,nstate> &soln_grad_bc)
const 1418 soln_bc[0] = soln_int[0];
1419 soln_bc[nstate-1] = soln_int[nstate-1];
1420 for (
int d=0; d<dim; ++d) {
1421 soln_bc[1+d] = -soln_int[1+d];
1424 for (
int istate=0; istate<nstate; ++istate) {
1425 soln_grad_bc[istate] = soln_grad_int[istate];
1428 if(thermal_boundary_condition_type == thermal_boundary_condition_enum::adiabatic){
1429 soln_grad_bc[nstate-1] = 0.0;
1432 if(thermal_boundary_condition_type == thermal_boundary_condition_enum::isothermal){
1434 const std::array<real,nstate> primitive_soln_int = this->
template convert_conservative_to_primitive_templated<real>(soln_int);
1435 std::array<real,nstate> primitive_soln_ext = this->
template convert_conservative_to_primitive_templated<real>(soln_bc);
1436 const real temperature_int = this->
template compute_temperature<real>(primitive_soln_int);
1437 const real temperature_ext = 2.0*this->isothermal_wall_temperature - temperature_int;
1439 primitive_soln_ext[nstate-1] = this->compute_pressure_from_density_temperature(primitive_soln_ext[0],temperature_ext);
1441 soln_bc[nstate-1] = this->compute_total_energy(primitive_soln_ext);
1445 template <
int dim,
int nspecies,
int nstate,
typename real>
1448 const dealii::Point<dim, real> &pos,
1449 const dealii::Tensor<1,dim,real> &,
1450 const std::array<real,nstate> &,
1451 const std::array<dealii::Tensor<1,dim,real>,nstate> &,
1452 std::array<real,nstate> &soln_bc,
1453 std::array<dealii::Tensor<1,dim,real>,nstate> &soln_grad_bc)
const 1457 std::array<real,nstate> boundary_values;
1458 std::array<dealii::Tensor<1,dim,real>,nstate> boundary_gradients;
1459 for (
int i=0; i<nstate; i++) {
1460 boundary_values[i] = this->manufactured_solution_function->value (pos, i);
1461 boundary_gradients[i] = this->manufactured_solution_function->gradient (pos, i);
1463 for (
int istate=0; istate<nstate; istate++) {
1464 soln_bc[istate] = boundary_values[istate];
1466 soln_grad_bc[istate] = boundary_gradients[istate];
1470 template <
int dim,
int nspecies,
int nstate,
typename real>
1472 const dealii::Vector<double> &uh,
1473 const std::vector<dealii::Tensor<1,dim> > &duh,
1474 const std::vector<dealii::Tensor<2,dim> > &dduh,
1475 const dealii::Tensor<1,dim> &normals,
1476 const dealii::Point<dim> &evaluation_points)
const 1478 std::vector<std::string> names = post_get_names ();
1480 unsigned int current_data_index = computed_quantities.size() - 1;
1481 computed_quantities.grow_or_shrink(names.size());
1482 if constexpr (std::is_same<real,double>::value) {
1484 std::array<double, nstate> conservative_soln;
1485 for (
unsigned int s=0; s<nstate; ++s) {
1486 conservative_soln[s] = uh(s);
1488 const std::array<double, nstate> primitive_soln = this->
template convert_conservative_to_primitive_templated<real>(conservative_soln);
1490 std::array<dealii::Tensor<1,dim,double>,nstate> conservative_soln_gradient;
1491 for (
unsigned int s=0; s<nstate; ++s) {
1492 for (
unsigned int d=0; d<dim; ++d) {
1493 conservative_soln_gradient[s][d] = duh[s][d];
1498 computed_quantities(++current_data_index) = primitive_soln[0];
1500 for (
unsigned int d=0; d<dim; ++d) {
1501 computed_quantities(++current_data_index) = primitive_soln[1+d];
1504 for (
unsigned int d=0; d<dim; ++d) {
1505 computed_quantities(++current_data_index) = conservative_soln[1+d];
1508 computed_quantities(++current_data_index) = conservative_soln[nstate-1];
1510 computed_quantities(++current_data_index) = primitive_soln[nstate-1];
1512 computed_quantities(++current_data_index) = (primitive_soln[nstate-1] - this->pressure_inf) / this->dynamic_pressure_inf;
1514 computed_quantities(++current_data_index) = this->
template compute_temperature<real>(primitive_soln);
1516 computed_quantities(++current_data_index) = this->compute_entropy_measure(conservative_soln) - this->entropy_inf;
1518 computed_quantities(++current_data_index) = this->compute_mach_number(conservative_soln);
1519 if constexpr(dim==3) {
1521 dealii::Tensor<1,3,double> vorticity = compute_vorticity<double>(conservative_soln,conservative_soln_gradient);
1522 for (
unsigned int d=0; d<3; ++d) {
1523 computed_quantities(++current_data_index) = vorticity[d];
1527 computed_quantities(++current_data_index) = compute_vorticity_magnitude(conservative_soln,conservative_soln_gradient);
1529 computed_quantities(++current_data_index) = compute_enstrophy(conservative_soln,conservative_soln_gradient);
1531 computed_quantities(++current_data_index) = compute_second_invariant(conservative_soln,conservative_soln_gradient);
1533 computed_quantities(++current_data_index) = compute_dilatation(conservative_soln,conservative_soln_gradient);
1535 computed_quantities(++current_data_index) = compute_density_gradient_magnitude(conservative_soln,conservative_soln_gradient);
1537 if constexpr(dim==2) {
1539 dealii::Tensor<2,2,double> viscous_stress_tensor = compute_viscous_stress_tensor_from_conservative_templated<double>(conservative_soln,conservative_soln_gradient);
1541 for (
unsigned int d=0; d<2; ++d) {
1542 computed_quantities(++current_data_index) = viscous_stress_tensor[0][d];
1545 for (
unsigned int d=0; d<2; ++d) {
1546 computed_quantities(++current_data_index) = viscous_stress_tensor[1][d];
1549 else if constexpr(dim==3) {
1551 const std::array<dealii::Tensor<1,dim,real>,nstate> primitive_soln_gradient = this->
template convert_conservative_gradient_to_primitive_gradient_templated<real>(conservative_soln, conservative_soln_gradient);
1553 dealii::Tensor<2,3,double> viscous_stress_tensor = compute_viscous_stress_tensor<real>(primitive_soln,primitive_soln_gradient);
1555 for (
unsigned int d=0; d<3; ++d) {
1556 computed_quantities(++current_data_index) = viscous_stress_tensor[0][d];
1559 for (
unsigned int d=0; d<3; ++d) {
1560 computed_quantities(++current_data_index) = viscous_stress_tensor[1][d];
1563 for (
unsigned int d=0; d<3; ++d) {
1564 computed_quantities(++current_data_index) = viscous_stress_tensor[2][d];
1568 computed_quantities(++current_data_index) = compute_viscosity_coefficient<real>(primitive_soln);
1571 if (computed_quantities.size()-1 != current_data_index) {
1572 this->pcout <<
" Did not assign a value to all the data. Missing " << computed_quantities.size() - current_data_index <<
" variables." 1573 <<
" If you added a new output variable, make sure the names and DataComponentInterpretation match the above. " 1577 return computed_quantities;
1580 template <
int dim,
int nspecies,
int nstate,
typename real>
1584 namespace DCI = dealii::DataComponentInterpretation;
1586 interpretation.push_back (DCI::component_is_scalar);
1587 for (
unsigned int d=0; d<dim; ++d) {
1588 interpretation.push_back (DCI::component_is_part_of_vector);
1590 for (
unsigned int d=0; d<dim; ++d) {
1591 interpretation.push_back (DCI::component_is_part_of_vector);
1593 interpretation.push_back (DCI::component_is_scalar);
1594 interpretation.push_back (DCI::component_is_scalar);
1595 interpretation.push_back (DCI::component_is_scalar);
1596 interpretation.push_back (DCI::component_is_scalar);
1597 interpretation.push_back (DCI::component_is_scalar);
1598 interpretation.push_back (DCI::component_is_scalar);
1599 if constexpr(dim==3) {
1600 for (
unsigned int d=0; d<3; ++d) {
1601 interpretation.push_back (DCI::component_is_part_of_vector);
1604 interpretation.push_back (DCI::component_is_scalar);
1605 interpretation.push_back (DCI::component_is_scalar);
1606 interpretation.push_back (DCI::component_is_scalar);
1607 interpretation.push_back (DCI::component_is_scalar);
1608 interpretation.push_back (DCI::component_is_scalar);
1609 if constexpr(dim==2) {
1610 for (
unsigned int d=0; d<dim; ++d) {
1611 interpretation.push_back (DCI::component_is_part_of_vector);
1613 for (
unsigned int d=0; d<dim; ++d) {
1614 interpretation.push_back (DCI::component_is_part_of_vector);
1617 else if constexpr(dim==3) {
1618 for (
unsigned int d=0; d<dim; ++d) {
1619 interpretation.push_back (DCI::component_is_part_of_vector);
1621 for (
unsigned int d=0; d<dim; ++d) {
1622 interpretation.push_back (DCI::component_is_part_of_vector);
1624 for (
unsigned int d=0; d<dim; ++d) {
1625 interpretation.push_back (DCI::component_is_part_of_vector);
1628 interpretation.push_back (DCI::component_is_scalar);
1630 std::vector<std::string> names = post_get_names();
1631 if (names.size() != interpretation.size()) {
1632 this->pcout <<
"Number of DataComponentInterpretation is not the same as number of names for output file" << std::endl;
1634 return interpretation;
1638 template <
int dim,
int nspecies,
int nstate,
typename real>
1643 names.push_back (
"density");
1644 for (
unsigned int d=0; d<dim; ++d) {
1645 names.push_back (
"velocity");
1647 for (
unsigned int d=0; d<dim; ++d) {
1648 names.push_back (
"momentum");
1650 names.push_back (
"total_energy");
1651 names.push_back (
"pressure");
1652 names.push_back (
"pressure_coefficient");
1653 names.push_back (
"temperature");
1655 names.push_back (
"entropy_generation");
1656 names.push_back (
"mach_number");
1657 if constexpr(dim==3) {
1658 for (
unsigned int d=0; d<3; ++d) {
1659 names.push_back (
"vorticity");
1662 names.push_back (
"vorticity_magnitude");
1663 names.push_back (
"enstrophy");
1664 names.push_back (
"second_invariant_Q");
1665 names.push_back (
"dilatation");
1666 names.push_back (
"density_gradient_magnitude");
1667 if constexpr(dim==2) {
1669 for (
unsigned int d=0; d<dim; ++d) {
1670 names.push_back (
"du_viscous_stress_tensor");
1673 for (
unsigned int d=0; d<dim; ++d) {
1674 names.push_back (
"dv_viscous_stress_tensor");
1677 else if constexpr(dim==3) {
1679 for (
unsigned int d=0; d<dim; ++d) {
1680 names.push_back (
"du_viscous_stress_tensor");
1683 for (
unsigned int d=0; d<dim; ++d) {
1684 names.push_back (
"dv_viscous_stress_tensor");
1687 for (
unsigned int d=0; d<dim; ++d) {
1688 names.push_back (
"dz_viscous_stress_tensor");
1691 names.push_back (
"viscosity_coefficient");
1695 template <
int dim,
int nspecies,
int nstate,
typename real>
1700 return dealii::update_values
1701 | dealii::update_quadrature_points
1702 | dealii::update_gradients
1706 template <
int dim,
int nspecies,
int nstate,
typename real>
1709 const double ref_length,
1710 const double gamma_gas,
1711 const double mach_inf,
1712 const double angle_of_attack,
1713 const double side_slip_angle,
1714 const double prandtl_number,
1715 const double reynolds_number_inf,
1716 const bool use_constant_viscosity,
1717 const double constant_viscosity,
1718 const double reynolds_number_based_on_friction_velocity,
1719 const double half_channel_height,
1720 const double temperature_inf,
1721 const double isothermal_wall_temperature,
1733 reynolds_number_inf,
1734 use_constant_viscosity,
1737 isothermal_wall_temperature,
1738 thermal_boundary_condition_type,
1739 manufactured_solution_function,
1740 two_point_num_flux_type,
1742 , x_momentum_constant_source_term(pow((1.0/half_channel_height),3.0)*pow((reynolds_number_based_on_friction_velocity/this->reynolds_number_inf),2.0))
1744 static_assert(nstate==dim+2,
"Physics::NavierStokes_ChannelFlowConstantSourceTerm() should be created with nstate=dim+2");
1748 template <
int dim,
int nspecies,
int nstate,
typename real>
1751 const dealii::Point<dim,real> &,
1752 const std::array<real,nstate> &solution,
1753 const std::array<dealii::Tensor<1,dim,real>,nstate> &,
1754 const dealii::types::global_dof_index )
const 1756 std::array<real,nstate> physical_source;
1757 for (
int i=0; i<nstate; i++) {
1758 physical_source[i] = 0;
1761 const dealii::Tensor<1,dim,real> vel = this->
template compute_velocities<real>(solution);
1762 physical_source[nstate-1] = vel[0]*physical_source[1];
1764 return physical_source;
1767 template <
int dim,
int nspecies,
int nstate,
typename real>
1771 const double gamma_gas,
1779 const double reynolds_number_based_on_friction_velocity,
1780 const double half_channel_height,
1781 const double distance_from_wall_for_wall_model_input_velocity,
1795 reynolds_number_inf,
1796 use_constant_viscosity,
1798 reynolds_number_based_on_friction_velocity,
1799 half_channel_height,
1801 isothermal_wall_temperature,
1802 thermal_boundary_condition_type,
1804 two_point_num_flux_type)
1805 , distance_from_wall_for_wall_model_input_velocity(distance_from_wall_for_wall_model_input_velocity)
1808 static_assert(nstate==dim+2,
"Physics::NavierStokes_ChannelFlowConstantSourceTerm_WallModel() should be created with nstate=dim+2");
1812 template <
int dim,
int nspecies,
int nstate,
typename real>
1815 const std::array<real,nstate> &conservative_soln,
1816 const dealii::Tensor<1,dim,real> &normal_vector)
const 1819 const dealii::Tensor<1,dim,real> velocities_parallel_to_wall = this->
template compute_velocities_parallel_to_wall<real>(conservative_soln,normal_vector);
1822 const dealii::Tensor<1,dim,real> wall_tangent_vector = this->
template compute_wall_tangent_vector_from_velocities_parallel_to_wall<real>(velocities_parallel_to_wall);
1825 real velocity_parallel_to_wall = 0.0;
1826 for (
int d=0; d<dim; ++d) {
1827 velocity_parallel_to_wall += velocities_parallel_to_wall[d]*wall_tangent_vector[d];
1829 return velocity_parallel_to_wall;
1832 template <
int dim,
int nspecies,
int nstate,
typename real>
1835 const std::array<real,nstate> &solution,
1836 const std::array<dealii::Tensor<1,dim,real>,nstate> &,
1837 const std::array<real,nstate> &,
1838 const std::array<dealii::Tensor<1,dim,real>,nstate> &,
1839 const dealii::types::global_dof_index ,
1840 const dealii::Tensor<1,dim,real> &normal)
1848 const dealii::Tensor<1,dim,real> velocities_parallel_to_wall = this->
template compute_velocities_parallel_to_wall<real>(solution,normal);
1851 const dealii::Tensor<1,dim,real> wall_tangent_vector = this->
template compute_wall_tangent_vector_from_velocities_parallel_to_wall<real>(velocities_parallel_to_wall);
1854 real velocity_parallel_to_wall = 0.0;
1855 for (
int d=0; d<dim; ++d) {
1856 velocity_parallel_to_wall += velocities_parallel_to_wall[d]*wall_tangent_vector[d];
1860 const std::array<real, nstate> primitive_soln = this->
template convert_conservative_to_primitive_templated<real>(solution);
1861 const real viscosity_coefficient = this->
template compute_viscosity_coefficient<real>(primitive_soln);
1862 const real density = solution[0];
1863 const real wall_shear_stress_magnitude =
1865 velocity_parallel_to_wall,
1867 viscosity_coefficient,
1873 dissipative_flux_dot_normal.fill(0.0);
1874 for (
int d=0; d<dim; ++d) {
1875 dissipative_flux_dot_normal[1+d] += wall_shear_stress_magnitude * wall_tangent_vector[d];
1880 template <
typename real>
1886 template <
typename real>
1889 const real wall_parallel_velocity,
1890 const real distance,
1891 const real viscosity_coefficient,
1895 const real u_parallel_plus_y_plus = reynolds_number_inf*density*distance*wall_parallel_velocity/viscosity_coefficient;
1896 const real y_plus = this->interpolate(u_parallel_plus_y_plus,
true);
1897 const real wall_friction_velocity = y_plus*viscosity_coefficient/(density*distance*
reynolds_number_inf);
1898 const real wall_shear_stress = density*wall_friction_velocity*wall_friction_velocity;
1899 return wall_shear_stress;
1902 template <
typename real>
1907 if ( x >= xData[NUMBER_OF_SAMPLE_POINTS - 2] )
1909 i = NUMBER_OF_SAMPLE_POINTS - 2;
1913 while ( x > xData[i+1] ) i++;
1915 real xL = xData[i], yL = yData[i], xR = xData[i+1], yR = yData[i+1];
1918 if ( x < xL ) yR = yL;
1919 if ( x > xR ) yL = yR;
1922 real dydx = ( yR - yL ) / ( xR - xL );
1924 return yL + dydx * ( x - xL );
1927 #if PHILIP_SPECIES==1 1929 #define POSSIBLE_TYPES (double)(FadType)(RadType)(FadFadType)(RadFadType) 1931 #define INSTANTIATE_TYPES(r, data, type) \ 1932 template class NavierStokes < PHILIP_DIM, PHILIP_SPECIES, PHILIP_DIM+2, type >; \ 1933 template class NavierStokes_ChannelFlowConstantSourceTerm < PHILIP_DIM, PHILIP_SPECIES, PHILIP_DIM+2, type >; \ 1934 template class NavierStokes_ChannelFlowConstantSourceTerm_WallModel < PHILIP_DIM, PHILIP_SPECIES, PHILIP_DIM+2, type >; \ 1935 template class WallModelLookUpTable<type>; \ 1936 template type NavierStokes < PHILIP_DIM, PHILIP_SPECIES, PHILIP_DIM+2, type >::compute_scaled_viscosity_coefficient< type >(const std::array<type,PHILIP_DIM+2> &primitive_soln) const; \ 1937 template dealii::Tensor<2,PHILIP_DIM, type > NavierStokes<PHILIP_DIM, PHILIP_SPECIES,PHILIP_DIM+2,type >::extract_velocities_gradient_from_primitive_solution_gradient< type > (const std::array<dealii::Tensor<1,PHILIP_DIM, type >,PHILIP_DIM+2> &primitive_soln_gradient) const; \ 1938 template std::array<dealii::Tensor<1,PHILIP_DIM, type >,PHILIP_DIM+2> NavierStokes<PHILIP_DIM, PHILIP_SPECIES,PHILIP_DIM+2,type >::dissipative_flux_given_velocities_viscous_stress_tensor_and_heat_flux<type>(const dealii::Tensor<1,PHILIP_DIM, type> &vel, const dealii::Tensor<2,PHILIP_DIM,type> &viscous_stress_tensor, const dealii::Tensor<1,PHILIP_DIM, type> &heat_flux) const; \ 1939 template dealii::Tensor<2,PHILIP_DIM, type > NavierStokes<PHILIP_DIM, PHILIP_SPECIES,PHILIP_DIM+2,type >::compute_strain_rate_tensor< type > (const dealii::Tensor<2,PHILIP_DIM,type > &vel_gradient) const; \ 1940 template dealii::Tensor<2,PHILIP_DIM, type > NavierStokes<PHILIP_DIM, PHILIP_SPECIES,PHILIP_DIM+2,type>::compute_strain_rate_tensor_from_conservative_templated<type>(const std::array<type,PHILIP_DIM+2> &conservative_soln, const std::array<dealii::Tensor<1,PHILIP_DIM,type>,PHILIP_DIM+2> &conservative_soln_gradient) const; \ 1941 template dealii::Tensor<2,PHILIP_DIM, type > NavierStokes<PHILIP_DIM, PHILIP_SPECIES,PHILIP_DIM+2,type >::compute_viscous_stress_tensor_via_scaled_viscosity_and_strain_rate_tensor< type > (const type scaled_viscosity_coefficient, const dealii::Tensor<2,PHILIP_DIM,type> &strain_rate_tensor) const; \ 1942 template dealii::Tensor<2,PHILIP_DIM, type > NavierStokes<PHILIP_DIM, PHILIP_SPECIES,PHILIP_DIM+2,type >::compute_viscous_stress_tensor_from_conservative_templated<type>(const std::array<type,PHILIP_DIM+2> &conservative_soln, const std::array<dealii::Tensor<1,PHILIP_DIM,type>,PHILIP_DIM+2> &conservative_soln_gradient) const; \ 1943 template dealii::Tensor<1,PHILIP_DIM, type > NavierStokes<PHILIP_DIM, PHILIP_SPECIES,PHILIP_DIM+2,type >::compute_heat_flux_given_scaled_heat_conductivity_and_temperature_gradient< type > (const type scaled_heat_conductivity, const dealii::Tensor<1,PHILIP_DIM, type> &temperature_gradient) const; \ 1944 template type NavierStokes<PHILIP_DIM, PHILIP_SPECIES,PHILIP_DIM+2,type >::compute_scaled_heat_conductivity_given_scaled_viscosity_coefficient_and_prandtl_number< type > (const type scaled_viscosity_coefficient, const double prandtl_number_input) const; \ 1945 template dealii::Tensor<1,PHILIP_DIM, type > NavierStokes<PHILIP_DIM, PHILIP_SPECIES,PHILIP_DIM+2,type >::compute_temperature_gradient< type >(const std::array< type ,PHILIP_DIM+2> &primitive_soln, const std::array<dealii::Tensor<1,PHILIP_DIM, type >,PHILIP_DIM+2> &primitive_soln_gradient) const; \ 1946 template type NavierStokes < PHILIP_DIM, PHILIP_SPECIES, PHILIP_DIM+2, type >::compute_viscosity_coefficient< type >(const std::array< type ,PHILIP_DIM+2> &primitive_soln) const; \ 1947 template type NavierStokes < PHILIP_DIM, PHILIP_SPECIES, PHILIP_DIM+2, type>::compute_viscosity_coefficient_from_temperature< type >(const type temperature) const; \ 1948 template dealii::Tensor<1,3,type > NavierStokes < PHILIP_DIM, PHILIP_SPECIES, PHILIP_DIM+2, type >::compute_vorticity< type >(const std::array<type ,PHILIP_DIM+2> &conservative_soln, const std::array<dealii::Tensor<1,PHILIP_DIM, type >,PHILIP_DIM+2> &conservative_soln_gradient) const; \ 1949 template type NavierStokes<PHILIP_DIM,PHILIP_SPECIES,PHILIP_DIM+2,type>::compute_wall_shear_stress<type>(const std::array<type,PHILIP_DIM+2> &conservative_soln, const std::array<dealii::Tensor<1,PHILIP_DIM,type>,PHILIP_DIM+2> &conservative_soln_gradient, const dealii::Tensor<1,PHILIP_DIM,type> &normal_vector) const; \ 1950 template type NavierStokes<PHILIP_DIM,PHILIP_SPECIES,PHILIP_DIM+2,type>::scale_viscosity_coefficient<type> (const type viscosity_coefficient) const; 1951 BOOST_PP_SEQ_FOR_EACH(INSTANTIATE_TYPES, _, POSSIBLE_TYPES)
1954 #undef POSSIBLE_TYPES 1955 #define POSSIBLE_TYPES (double)(RadType)(FadFadType)(RadFadType) 1957 #define INSTANTIATE_FADTYPES(r, data, type) \ 1958 template dealii::Tensor<2,PHILIP_DIM, FadType> NavierStokes<PHILIP_DIM, PHILIP_SPECIES,PHILIP_DIM+2,type >::extract_velocities_gradient_from_primitive_solution_gradient<FadType> (const std::array<dealii::Tensor<1,PHILIP_DIM, FadType>,PHILIP_DIM+2> &primitive_soln_gradient) const; \ 1959 template std::array<dealii::Tensor<1,PHILIP_DIM, FadType>,PHILIP_DIM+2> NavierStokes<PHILIP_DIM, PHILIP_SPECIES,PHILIP_DIM+2,type>::dissipative_flux_given_velocities_viscous_stress_tensor_and_heat_flux<FadType>(const dealii::Tensor<1,PHILIP_DIM, FadType> &vel, const dealii::Tensor<2,PHILIP_DIM, FadType> &viscous_stress_tensor, const dealii::Tensor<1,PHILIP_DIM, FadType> &heat_flux) const; \ 1960 template dealii::Tensor<2,PHILIP_DIM, FadType> NavierStokes<PHILIP_DIM, PHILIP_SPECIES,PHILIP_DIM+2,type >::compute_strain_rate_tensor<FadType> (const dealii::Tensor<2,PHILIP_DIM, FadType> &vel_gradient) const; \ 1961 template dealii::Tensor<2,PHILIP_DIM, FadType> NavierStokes<PHILIP_DIM, PHILIP_SPECIES,PHILIP_DIM+2, type>::compute_strain_rate_tensor_from_conservative_templated<FadType>(const std::array<FadType,PHILIP_DIM+2> &conservative_soln, const std::array<dealii::Tensor<1,PHILIP_DIM,FadType>,PHILIP_DIM+2> &conservative_soln_gradient) const; \ 1962 template dealii::Tensor<2,PHILIP_DIM, FadType> NavierStokes<PHILIP_DIM, PHILIP_SPECIES,PHILIP_DIM+2,type >::compute_viscous_stress_tensor_via_scaled_viscosity_and_strain_rate_tensor<FadType> (const FadType scaled_viscosity_coefficient, const dealii::Tensor<2,PHILIP_DIM, FadType> &strain_rate_tensor) const; \ 1963 template dealii::Tensor<2,PHILIP_DIM, FadType > NavierStokes<PHILIP_DIM, PHILIP_SPECIES,PHILIP_DIM+2,type >::compute_viscous_stress_tensor_from_conservative_templated<FadType>(const std::array<FadType,PHILIP_DIM+2> &conservative_soln, const std::array<dealii::Tensor<1,PHILIP_DIM,FadType>,PHILIP_DIM+2> &conservative_soln_gradient) const; \ 1964 template dealii::Tensor<1,PHILIP_DIM, FadType> NavierStokes<PHILIP_DIM, PHILIP_SPECIES,PHILIP_DIM+2,type >::compute_heat_flux_given_scaled_heat_conductivity_and_temperature_gradient<FadType> (const FadType scaled_heat_conductivity, const dealii::Tensor<1,PHILIP_DIM, FadType> &temperature_gradient) const; \ 1965 template FadType NavierStokes<PHILIP_DIM, PHILIP_SPECIES,PHILIP_DIM+2,type >::compute_scaled_heat_conductivity_given_scaled_viscosity_coefficient_and_prandtl_number<FadType> (const FadType scaled_viscosity_coefficient, const double prandtl_number_input) const; \ 1966 template dealii::Tensor<1,PHILIP_DIM, FadType> NavierStokes<PHILIP_DIM, PHILIP_SPECIES,PHILIP_DIM+2,type >::compute_temperature_gradient<FadType>(const std::array<FadType,PHILIP_DIM+2> &primitive_soln, const std::array<dealii::Tensor<1,PHILIP_DIM, FadType>,PHILIP_DIM+2> &primitive_soln_gradient) const; \ 1967 template FadType NavierStokes<PHILIP_DIM, PHILIP_SPECIES, PHILIP_DIM+2, type >::compute_viscosity_coefficient< FadType >(const std::array<FadType,PHILIP_DIM+2> &primitive_soln) const; \ 1968 template FadType NavierStokes < PHILIP_DIM, PHILIP_SPECIES, PHILIP_DIM+2, type >::compute_viscosity_coefficient_from_temperature< FadType >(const FadType temperature) const; \ 1969 template dealii::Tensor<1,3,FadType> NavierStokes < PHILIP_DIM, PHILIP_SPECIES, PHILIP_DIM+2, type >::compute_vorticity< FadType >(const std::array<FadType,PHILIP_DIM+2> &conservative_soln, const std::array<dealii::Tensor<1,PHILIP_DIM, FadType>,PHILIP_DIM+2> &conservative_soln_gradient) const; \ 1970 template FadType NavierStokes < PHILIP_DIM, PHILIP_SPECIES, PHILIP_DIM+2, type >::compute_scaled_viscosity_coefficient< FadType >(const std::array<FadType ,PHILIP_DIM+2> &primitive_soln) const; 1971 BOOST_PP_SEQ_FOR_EACH(INSTANTIATE_FADTYPES, _, POSSIBLE_TYPES)
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) override
const thermal_boundary_condition_enum thermal_boundary_condition_type
Thermal boundary condition type (adiabatic or isothermal)
const double angle_of_attack
Angle of attack.
const double constant_viscosity
Nondimensionalized constant viscosity.
Sacado::Fad::DFad< double > FadType
Sacado AD type for first derivatives.
const double mach_inf
Farfield Mach number.
Base class from which Advection, Diffusion, ConvectionDiffusion, and Euler is derived.
std::array< real, nstate > physical_source_term(const dealii::Point< dim, real > &pos, const std::array< real, nstate > &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 for turbulent channel flow case.
const two_point_num_flux_enum two_point_num_flux_type
Two point numerical flux type (for split form)
Manufactured solution used for grid studies to check convergence orders.
Files for the baseline physics.
Wall Model Look up table.
real get_velocity_component_parallel_to_wall_from_solution_and_normal_vector(const std::array< real, nstate > &conservative_soln, const dealii::Tensor< 1, dim, real > &normal_vector) const
Returns the velocoty component parallel to the wall from the solution and normal vector.
std::array< real, nstate > dissipative_flux_dot_normal_on_adiabatic_boundary(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 dealii::types::global_dof_index cell_index, const dealii::Tensor< 1, dim, real > &normal) override
std::shared_ptr< ManufacturedSolutionFunction< dim, nspecies, real > > manufactured_solution_function
Manufactured solution function.
NavierStokes_ChannelFlowConstantSourceTerm_WallModel(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 reynolds_number_based_on_friction_velocity, const double half_channel_height, const double distance_from_wall_for_wall_model_input_velocity, const double temperature_inf=273.15, 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.
Main parameter class that contains the various other sub-parameter classes.
const double distance_from_wall_for_wall_model_input_velocity
Distance from wall for wall model input velocity.
NavierStokes(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=273.15, 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 has_nonzero_physical_source=false)
Constructor.
TwoPointNumericalFlux
Two point numerical flux type for split form.
const double isothermal_wall_temperature
Nondimensionalized isothermal wall temperature.
const double side_slip_angle
Sideslip angle.
Euler equations. Derived from PhysicsBase.
const double x_momentum_constant_source_term
Nondimensional constant source term for x-momentum.
double temperature_inf
Non-dimensionalized temperature* at infinity. Should equal 1/density*(inf)
const double reynolds_number_inf
Farfield (free stream) Reynolds number.
WallModelLookUpTable()
Constructor.
const bool use_constant_viscosity
Flag to use constant viscosity instead of Sutherland's law of viscosity.
const double ref_length
Reference length.
const double prandtl_number
Prandtl number.
real interpolate(const real x, const bool extrapolate) const
Destructor.
ThermalBoundaryCondition
Types of thermal boundary conditions available.
std::unique_ptr< WallModelLookUpTable< real > > wall_model_look_up_table
Pointer to wall model look-up table object.
Navier-Stokes equations. Derived from Euler for the convective terms, which is derived from PhysicsBa...
real get_wall_shear_stress_magnitude(const real wall_parallel_velocity, const real distance, const real viscosity_coefficient, const real density, const double reynolds_number_inf) const
Returns the wall shear stress magnitude calculated from the wall model.
Navier-Stokes equations with constant physical source term for the turbulent channel flow case...