8 #include "reynolds_averaged_navier_stokes.h" 16 template <
int dim,
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 turbulent_prandtl_number,
29 const double temperature_inf,
30 const double isothermal_wall_temperature,
34 :
ModelBase<dim,nstate,real>(manufactured_solution_function)
35 , turbulent_prandtl_number(turbulent_prandtl_number)
36 , navier_stokes_physics(
std::make_unique <
NavierStokes<dim,nstate_navier_stokes,real> > (
45 use_constant_viscosity,
48 isothermal_wall_temperature,
49 thermal_boundary_condition_type,
50 manufactured_solution_function,
51 two_point_num_flux_type))
53 static_assert(nstate>=dim+3,
"ModelBase::ReynoldsAveragedNavierStokesBase() should be created with nstate>=dim+3");
56 template <
int dim,
int nstate,
typename real>
57 template<
typename real2>
60 const dealii::Tensor<1,3,real2> &vector)
const 62 real2 vector_magnitude_sqr;
63 if(std::is_same<real2,real>::value){
64 vector_magnitude_sqr = 0.0;
66 for (
int i=0; i<3; ++i) {
67 vector_magnitude_sqr += vector[i]*vector[i];
69 return vector_magnitude_sqr;
72 template <
int dim,
int nstate,
typename real>
73 template<
typename real2>
76 const dealii::Tensor<2,dim,real2> &tensor)
const 78 real2 tensor_magnitude_sqr;
79 if(std::is_same<real2,real>::value){
80 tensor_magnitude_sqr = 0.0;
82 for (
int i=0; i<dim; ++i) {
83 for (
int j=0; j<dim; ++j) {
84 tensor_magnitude_sqr += tensor[i][j]*tensor[i][j];
87 return tensor_magnitude_sqr;
90 template <
int dim,
int nstate,
typename real>
93 const std::array<real,nstate> &conservative_soln)
const 95 return convective_flux_templated<real>(conservative_soln);
98 template <
int dim,
int nstate,
typename real>
99 template <
typename real2>
102 const std::array<real2,nstate> &conservative_soln)
const 105 const dealii::Tensor<1,dim,real2> vel = this->
navier_stokes_physics->template compute_velocities<real2>(conservative_soln_rans);
106 std::array<dealii::Tensor<1,dim,real2>,nstate> conv_flux;
109 conv_flux[flux_dim] = 0.0;
112 for (
int flux_dim=nstate_navier_stokes; flux_dim<nstate; ++flux_dim) {
113 for (
int velocity_dim=0; velocity_dim<dim; ++velocity_dim) {
114 conv_flux[flux_dim][velocity_dim] = conservative_soln[flux_dim]*vel[velocity_dim];
120 template <
int dim,
int nstate,
typename real>
123 const std::array<real,nstate> &conservative_soln,
124 const std::array<dealii::Tensor<1,dim,real>,nstate> &solution_gradient,
125 const dealii::types::global_dof_index cell_index)
const 127 return dissipative_flux_templated<real>(conservative_soln,solution_gradient,cell_index);
130 template <
int dim,
int nstate,
typename real>
131 template <
typename real2>
134 const std::array<real2,nstate> &conservative_soln,
135 const std::array<dealii::Tensor<1,dim,real2>,nstate> &solution_gradient,
136 const dealii::types::global_dof_index )
const 143 const std::array<real2,nstate_navier_stokes> primitive_soln_rans = this->
navier_stokes_physics->convert_conservative_to_primitive(conservative_soln_rans);
144 const std::array<dealii::Tensor<1,dim,real2>,
nstate_navier_stokes> primitive_soln_gradient_rans = this->
navier_stokes_physics->convert_conservative_gradient_to_primitive_gradient(conservative_soln_rans, solution_gradient_rans);
149 const dealii::Tensor<1,dim,real2> vel = this->
navier_stokes_physics->extract_velocities_from_primitive(primitive_soln_rans);
151 dealii::Tensor<2,dim,real2> viscous_stress_tensor;
152 dealii::Tensor<1,dim,real2> heat_flux;
153 if constexpr(std::is_same<real2,real>::value){
157 else if constexpr(std::is_same<real2,FadType>::value){
162 std::cout <<
"ERROR in physics/reynolds_averaged_navier_stokes.cpp --> dissipative_flux_templated(): real2!=real || real2!=FadType)" << std::endl;
168 = this->
navier_stokes_physics->dissipative_flux_given_velocities_viscous_stress_tensor_and_heat_flux(vel,viscous_stress_tensor,heat_flux);
173 std::array<dealii::Tensor<1,dim,real2>,nstate> viscous_flux;
176 viscous_flux[flux_dim] = viscous_flux_rans[flux_dim];
178 for(
int flux_dim=nstate_navier_stokes; flux_dim<nstate; ++flux_dim)
186 template <
int dim,
int nstate,
typename real>
187 template <
typename real2>
190 const std::array<real2,nstate> &conservative_soln)
const 192 std::array<real2,nstate_navier_stokes> conservative_soln_rans;
194 conservative_soln_rans[i] = conservative_soln[i];
197 return conservative_soln_rans;
200 template <
int dim,
int nstate,
typename real>
201 template <
typename real2>
204 const std::array<dealii::Tensor<1,dim,real2>,nstate> &solution_gradient)
const 208 solution_gradient_rans[i] = solution_gradient[i];
211 return solution_gradient_rans;
214 template <
int dim,
int nstate,
typename real>
215 template <
typename real2>
218 const std::array<real2,nstate_navier_stokes> &primitive_soln_rans,
219 const std::array<real2,nstate_turbulence_model> &primitive_soln_turbulence_model,
220 const std::array<dealii::Tensor<1,dim,real2>,
nstate_turbulence_model> &primitive_solution_gradient_turbulence_model)
const 222 std::array<real2,nstate_turbulence_model> effective_viscosity_turbulence_model;
224 if constexpr(std::is_same<real2,real>::value){
227 else if constexpr(std::is_same<real2,FadType>::value){
231 std::cout <<
"ERROR in physics/reynolds_averaged_navier_stokes.cpp --> dissipative_flux_turbulence_model(): real2!=real || real2!=FadType)" << std::endl;
238 for(
int j=0; j<dim; ++j){
239 viscous_flux_turbulence_model[i][j] = -effective_viscosity_turbulence_model[i]*primitive_solution_gradient_turbulence_model[i][j];
243 return viscous_flux_turbulence_model;
246 template <
int dim,
int nstate,
typename real>
247 template <
typename real2>
250 const std::array<real2,nstate> &conservative_soln)
const 252 std::array<real2,nstate_turbulence_model> primitive_soln_turbulence_model;
254 primitive_soln_turbulence_model[i] = conservative_soln[
nstate_navier_stokes+i]/conservative_soln[0];
257 return primitive_soln_turbulence_model;
260 template <
int dim,
int nstate,
typename real>
261 template <
typename real2>
264 const std::array<real2,nstate> &conservative_soln,
265 const std::array<dealii::Tensor<1,dim,real2>,nstate> &solution_gradient)
const 271 for(
int j=0; j<dim; ++j){
272 primitive_soln_gradient_turbulence_model[i][j] = (solution_gradient[
nstate_navier_stokes+i][j]-primitive_soln_turbulence_model[i]*solution_gradient[0][j])/conservative_soln[0];
276 return primitive_soln_gradient_turbulence_model;
279 template <
int dim,
int nstate,
typename real>
282 const std::array<real,nstate> &conservative_soln2)
const 284 std::array<real,nstate_turbulence_model> mean_turbulence_property;
290 mean_turbulence_property[i] = (primitive_soln1_turbulence_model[i]+primitive_soln2_turbulence_model[i])/2.0;
293 return mean_turbulence_property;
296 template <
int dim,
int nstate,
typename real>
299 const std::array<real,nstate> &conservative_soln,
300 const dealii::Tensor<1,dim,real> &normal)
const 303 std::array<real,nstate> eig;
304 const real vel_dot_n = this->
navier_stokes_physics->convective_eigenvalues(conservative_soln_rans,normal)[0];
308 for (
int i=nstate_navier_stokes; i<nstate; ++i) {
314 template <
int dim,
int nstate,
typename real>
320 const dealii::Tensor<1,dim,real> vel = this->
navier_stokes_physics->template compute_velocities<real>(conservative_soln_rans);
324 const real max_eig = sqrt(vel2);
329 template <
int dim,
int nstate,
typename real>
332 const std::array<real,nstate> &conservative_soln,
333 const dealii::Tensor<1,dim,real> &normal)
const 337 const dealii::Tensor<1,dim,real> vel = this->
navier_stokes_physics->template compute_velocities<real>(conservative_soln_rans);
339 real vel_dot_n = 0.0;
340 for (
int d=0;d<dim;++d) { vel_dot_n += vel[d]*normal[d]; };
341 const real max_normal_eig = sqrt(vel_dot_n*vel_dot_n);
343 return max_normal_eig;
346 template <
int dim,
int nstate,
typename real>
349 const dealii::Point<dim,real> &pos,
350 const std::array<real,nstate> &conservative_soln,
351 const std::array<dealii::Tensor<1,dim,real>,nstate> &solution_gradient,
352 const dealii::types::global_dof_index )
const 354 std::array<real,nstate> physical_source;
357 return physical_source;
360 template <
int dim,
int nstate,
typename real>
363 const dealii::Point<dim,real> &pos,
364 const std::array<real,nstate> &,
366 const dealii::types::global_dof_index cell_index)
const 372 for (
int s=0; s<nstate; ++s)
374 source_term[s] = conv_source_term[s] + diss_source_term[s] - phys_source_source_term[s];
380 template <
int dim,
int nstate,
typename real>
383 const dealii::Point<dim,real> &pos,
384 const std::array<real,nstate> &,
385 const dealii::types::global_dof_index cell_index)
const 390 for (
int s=0; s<nstate; ++s)
392 convective_dissipative_source_term[s] = conv_source_term[s] + diss_source_term[s];
398 template<
typename real>
399 double getValue(
const real &x) {
400 if constexpr(std::is_same<real,double>::value) {
403 else if constexpr(std::is_same<real,FadType>::value) {
406 else if constexpr(std::is_same<real,FadFadType>::value) {
407 return x.val().val();
409 else if constexpr(std::is_same<real,RadType>::value) {
412 else if(std::is_same<real,RadFadType>::value) {
413 return x.value().value();
417 template <
int dim,
int nstate,
typename real>
420 const std::array<real,nstate> &conservative_soln,
421 const dealii::Tensor<1,dim,real> &normal)
const 426 std::array<adtype,nstate> AD_conservative_soln;
427 for (
int s=0; s<nstate; ++s) {
428 adtype ADvar(nstate, s, getValue<real>(conservative_soln[s]));
429 AD_conservative_soln[s] = ADvar;
433 std::array<dealii::Tensor<1,dim,adtype>,nstate> AD_convective_flux = convective_flux_templated<adtype>(AD_conservative_soln);
436 dealii::Tensor<2,nstate,real> jacobian;
437 for (
int sp=0; sp<nstate; ++sp) {
439 for (
int s=0; s<nstate; ++s) {
440 jacobian[s][sp] = 0.0;
441 for (
int d=0;d<dim;++d) {
443 jacobian[s][sp] += AD_convective_flux[s][d].dx(sp)*normal[d];
450 template <
int dim,
int nstate,
typename real>
453 const std::array<real,nstate> &conservative_soln,
454 const std::array<dealii::Tensor<1,dim,real>,nstate> &solution_gradient,
455 const dealii::Tensor<1,dim,real> &normal,
456 const dealii::types::global_dof_index cell_index)
const 461 std::array<adtype,nstate> AD_conservative_soln;
462 std::array<dealii::Tensor<1,dim,adtype>,nstate> AD_solution_gradient;
463 for (
int s=0; s<nstate; ++s) {
464 adtype ADvar(nstate, s, getValue<real>(conservative_soln[s]));
465 AD_conservative_soln[s] = ADvar;
466 for (
int d=0;d<dim;++d) {
467 AD_solution_gradient[s][d] = getValue<real>(solution_gradient[s][d]);
472 std::array<dealii::Tensor<1,dim,adtype>,nstate> AD_dissipative_flux = dissipative_flux_templated<adtype>(AD_conservative_soln, AD_solution_gradient, cell_index);
475 dealii::Tensor<2,nstate,real> jacobian;
476 for (
int sp=0; sp<nstate; ++sp) {
478 for (
int s=0; s<nstate; ++s) {
479 jacobian[s][sp] = 0.0;
480 for (
int d=0;d<dim;++d) {
482 jacobian[s][sp] += AD_dissipative_flux[s][d].dx(sp)*normal[d];
489 template <
int dim,
int nstate,
typename real>
492 const std::array<real,nstate> &conservative_soln,
493 const std::array<dealii::Tensor<1,dim,real>,nstate> &solution_gradient,
494 const dealii::Tensor<1,dim,real> &normal,
495 const int d_gradient,
496 const dealii::types::global_dof_index cell_index)
const 501 std::array<adtype,nstate> AD_conservative_soln;
502 std::array<dealii::Tensor<1,dim,adtype>,nstate> AD_solution_gradient;
503 for (
int s=0; s<nstate; ++s) {
504 AD_conservative_soln[s] = getValue<real>(conservative_soln[s]);
505 for (
int d=0;d<dim;++d) {
507 adtype ADvar(nstate, s, getValue<real>(solution_gradient[s][d]));
508 AD_solution_gradient[s][d] = ADvar;
511 AD_solution_gradient[s][d] = getValue<real>(solution_gradient[s][d]);
517 std::array<dealii::Tensor<1,dim,adtype>,nstate> AD_dissipative_flux = dissipative_flux_templated<adtype>(AD_conservative_soln, AD_solution_gradient, cell_index);
520 dealii::Tensor<2,nstate,real> jacobian;
521 for (
int sp=0; sp<nstate; ++sp) {
523 for (
int s=0; s<nstate; ++s) {
524 jacobian[s][sp] = 0.0;
525 for (
int d=0;d<dim;++d) {
527 jacobian[s][sp] += AD_dissipative_flux[s][d].dx(sp)*normal[d];
534 template <
int dim,
int nstate,
typename real>
537 const dealii::Point<dim,real> &pos)
const 539 std::array<real,nstate> manufactured_solution;
540 for (
int s=0; s<nstate; ++s) {
543 assert(manufactured_solution[s] > 0);
546 return manufactured_solution;
549 template <
int dim,
int nstate,
typename real>
552 const dealii::Point<dim,real> &pos)
const 554 std::vector<dealii::Tensor<1,dim,real>> manufactured_solution_gradient_dealii(nstate);
556 std::array<dealii::Tensor<1,dim,real>,nstate> manufactured_solution_gradient;
557 for (
int d=0;d<dim;++d) {
558 for (
int s=0; s<nstate; ++s) {
559 manufactured_solution_gradient[s][d] = manufactured_solution_gradient_dealii[s][d];
562 return manufactured_solution_gradient;
565 template <
int dim,
int nstate,
typename real>
568 const dealii::Point<dim,real> &pos)
const 576 dealii::Tensor<1,nstate,real> convective_flux_divergence;
577 for (
int d=0;d<dim;++d) {
578 dealii::Tensor<1,dim,real> normal;
583 for (
int sr = 0; sr < nstate; ++sr) {
584 real jac_grad_row = 0.0;
585 for (
int sc = 0; sc < nstate; ++sc) {
586 jac_grad_row += jacobian[sr][sc]*manufactured_solution_gradient[sc][d];
588 convective_flux_divergence[sr] += jac_grad_row;
592 for (
int s=0; s<nstate; ++s) {
593 convective_source_term_computed_from_manufactured_solution[s] = convective_flux_divergence[s];
599 template <
int dim,
int nstate,
typename real>
602 const dealii::Point<dim,real> &pos,
603 const dealii::types::global_dof_index cell_index)
const 616 std::array<dealii::SymmetricTensor<2,dim,real>,nstate> manufactured_solution_hessian;
617 for (
int s=0; s<nstate; ++s) {
619 for (
int dr=0;dr<dim;++dr) {
620 for (
int dc=0;dc<dim;++dc) {
621 manufactured_solution_hessian[s][dr][dc] = hessian[dr][dc];
628 dealii::Tensor<1,nstate,real> dissipative_flux_divergence;
629 for (
int d=0;d<dim;++d) {
630 dealii::Tensor<1,dim,real> normal;
635 std::array<dealii::Tensor<2,nstate,real>,dim> jacobian_wrt_gradient;
636 for (
int d_gradient=0;d_gradient<dim;++d_gradient) {
642 for (
int sr = 0; sr < nstate; ++sr) {
643 for (
int sc = 0; sc < nstate; ++sc) {
644 jacobian_wrt_gradient[d_gradient][sr][sc] = jacobian_wrt_gradient_component[sr][sc];
650 for (
int sr = 0; sr < nstate; ++sr) {
651 real jac_grad_row = 0.0;
652 for (
int sc = 0; sc < nstate; ++sc) {
653 jac_grad_row += jacobian[sr][sc]*manufactured_solution_gradient[sc][d];
656 for (
int d_gradient=0;d_gradient<dim;++d_gradient) {
657 jac_grad_row += jacobian_wrt_gradient[d_gradient][sr][sc]*manufactured_solution_hessian[sc][d_gradient][d];
660 dissipative_flux_divergence[sr] += jac_grad_row;
664 for (
int s=0; s<nstate; ++s) {
665 dissipative_source_term_computed_from_manufactured_solution[s] = dissipative_flux_divergence[s];
671 template <
int dim,
int nstate,
typename real>
674 const dealii::Point<dim,real> &pos,
675 const dealii::types::global_dof_index cell_index)
const 683 std::array<real,nstate> physical_source_source_term_computed_from_manufactured_solution;
684 for (
int i=0;i<nstate;++i){
685 physical_source_source_term_computed_from_manufactured_solution =
physical_source_term(pos, manufactured_solution, manufactured_solution_gradient, cell_index);
688 return physical_source_source_term_computed_from_manufactured_solution;
691 template <
int dim,
int nstate,
typename real>
694 const dealii::Point<dim, real> &pos,
695 const dealii::Tensor<1,dim,real> &,
696 const std::array<real,nstate> &,
697 const std::array<dealii::Tensor<1,dim,real>,nstate> &,
698 std::array<real,nstate> &soln_bc,
699 std::array<dealii::Tensor<1,dim,real>,nstate> &soln_grad_bc)
const 702 std::array<real,nstate> boundary_values;
703 std::array<dealii::Tensor<1,dim,real>,nstate> boundary_gradients;
704 for (
int i=0; i<nstate; ++i) {
709 soln_bc[istate] = boundary_values[istate];
710 soln_grad_bc[istate] = boundary_gradients[istate];
787 template std::array<dealii::Tensor<1,PHILIP_DIM,double >,1>
ReynoldsAveragedNavierStokesBase < PHILIP_DIM, PHILIP_DIM+3, double >::convert_conservative_gradient_to_primitive_gradient_turbulence_model<
double >(
const std::array<double, PHILIP_DIM+3> &conservative_soln,
const std::array<dealii::Tensor<1,PHILIP_DIM,double >,PHILIP_DIM+3> &solution_gradient)
const;
788 template std::array<dealii::Tensor<1,PHILIP_DIM,FadType >,1>
ReynoldsAveragedNavierStokesBase < PHILIP_DIM, PHILIP_DIM+3, FadType >::convert_conservative_gradient_to_primitive_gradient_turbulence_model<
FadType >(
const std::array<FadType, PHILIP_DIM+3> &conservative_soln,
const std::array<dealii::Tensor<1,PHILIP_DIM,FadType >,PHILIP_DIM+3> &solution_gradient)
const;
789 template std::array<dealii::Tensor<1,PHILIP_DIM,RadType >,1>
ReynoldsAveragedNavierStokesBase < PHILIP_DIM, PHILIP_DIM+3, RadType >::convert_conservative_gradient_to_primitive_gradient_turbulence_model<
RadType >(
const std::array<RadType, PHILIP_DIM+3> &conservative_soln,
const std::array<dealii::Tensor<1,PHILIP_DIM,RadType >,PHILIP_DIM+3> &solution_gradient)
const;
790 template std::array<dealii::Tensor<1,PHILIP_DIM,FadFadType>,1>
ReynoldsAveragedNavierStokesBase < PHILIP_DIM, PHILIP_DIM+3, FadFadType >::convert_conservative_gradient_to_primitive_gradient_turbulence_model<
FadFadType >(
const std::array<FadFadType, PHILIP_DIM+3> &conservative_soln,
const std::array<dealii::Tensor<1,PHILIP_DIM,FadFadType>,PHILIP_DIM+3> &solution_gradient)
const;
791 template std::array<dealii::Tensor<1,PHILIP_DIM,RadFadType>,1>
ReynoldsAveragedNavierStokesBase < PHILIP_DIM, PHILIP_DIM+3, RadFadType >::convert_conservative_gradient_to_primitive_gradient_turbulence_model<
RadFadType >(
const std::array<RadFadType, PHILIP_DIM+3> &conservative_soln,
const std::array<dealii::Tensor<1,PHILIP_DIM,RadFadType>,PHILIP_DIM+3> &solution_gradient)
const;
793 template std::array<dealii::Tensor<1,PHILIP_DIM,FadType>,1>
ReynoldsAveragedNavierStokesBase < PHILIP_DIM, PHILIP_DIM+3, double >::convert_conservative_gradient_to_primitive_gradient_turbulence_model<
FadType >(
const std::array<FadType, PHILIP_DIM+3> &conservative_soln,
const std::array<dealii::Tensor<1,PHILIP_DIM,FadType>,PHILIP_DIM+3> &solution_gradient)
const;
794 template std::array<dealii::Tensor<1,PHILIP_DIM,FadType>,1>
ReynoldsAveragedNavierStokesBase < PHILIP_DIM, PHILIP_DIM+3, RadType >::convert_conservative_gradient_to_primitive_gradient_turbulence_model<
FadType >(
const std::array<FadType, PHILIP_DIM+3> &conservative_soln,
const std::array<dealii::Tensor<1,PHILIP_DIM,FadType>,PHILIP_DIM+3> &solution_gradient)
const;
795 template std::array<dealii::Tensor<1,PHILIP_DIM,FadType>,1>
ReynoldsAveragedNavierStokesBase < PHILIP_DIM, PHILIP_DIM+3, FadFadType >::convert_conservative_gradient_to_primitive_gradient_turbulence_model<
FadType >(
const std::array<FadType, PHILIP_DIM+3> &conservative_soln,
const std::array<dealii::Tensor<1,PHILIP_DIM,FadType>,PHILIP_DIM+3> &solution_gradient)
const;
796 template std::array<dealii::Tensor<1,PHILIP_DIM,FadType>,1>
ReynoldsAveragedNavierStokesBase < PHILIP_DIM, PHILIP_DIM+3, RadFadType >::convert_conservative_gradient_to_primitive_gradient_turbulence_model<
FadType >(
const std::array<FadType, PHILIP_DIM+3> &conservative_soln,
const std::array<dealii::Tensor<1,PHILIP_DIM,FadType>,PHILIP_DIM+3> &solution_gradient)
const;
virtual std::array< real, nstate > compute_production_dissipation_cross_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 =0
Physical source term (production, dissipation source terms and source term with cross derivatives) in...
std::shared_ptr< ManufacturedSolutionFunction< dim, real > > manufactured_solution_function
Manufactured solution function.
std::array< real, nstate > convective_dissipative_source_term(const dealii::Point< dim, real > &pos, const std::array< real, nstate > &conservative_solution, const dealii::types::global_dof_index cell_index) const
Convective and dissipative source term for manufactured solution functions.
void boundary_manufactured_solution(const dealii::Point< dim, real > &pos, const dealii::Tensor< 1, dim, real > &normal_int, const std::array< real, nstate > &soln_int, const std::array< dealii::Tensor< 1, dim, real >, nstate > &soln_grad_int, std::array< real, nstate > &soln_bc, std::array< dealii::Tensor< 1, dim, real >, nstate > &soln_grad_bc) const override
Evaluate the manufactured solution boundary conditions.
std::array< real, nstate > source_term(const dealii::Point< dim, real > &pos, const std::array< real, nstate > &conservative_solution, const real current_time, const dealii::types::global_dof_index cell_index) const
Source term for manufactured solution functions.
std::array< real2, nstate-(dim+2)> convert_conservative_to_primitive_turbulence_model(const std::array< real2, nstate > &conservative_soln) const
Sacado::Fad::DFad< FadType > FadFadType
Sacado AD type that allows 2nd derivatives.
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
virtual std::array< real, nstate_turbulence_model > compute_effective_viscosity_turbulence_model(const std::array< real, nstate_navier_stokes > &primitive_soln_rans, const std::array< real, nstate_turbulence_model > &primitive_soln_turbulence_model) const =0
Nondimensionalized effective (total) viscosities for the turbulence model.
Sacado::Fad::DFad< double > FadType
Sacado AD type for first derivatives.
Manufactured solution used for grid studies to check convergence orders.
codi_JacobianComputationType RadType
CoDiPaco reverse-AD type for first derivatives.
ReynoldsAveragedNavierStokesBase(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 turbulent_prandtl_number, 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, real > > manufactured_solution_function=nullptr, const two_point_num_flux_enum two_point_num_flux_type=two_point_num_flux_enum::KG)
Constructor.
std::array< dealii::Tensor< 1, dim, real2 >, nstate-(dim+2)> dissipative_flux_turbulence_model(const std::array< real2, nstate_navier_stokes > &primitive_soln_rans, const std::array< real2, nstate_turbulence_model > &primitive_soln_turbulence_model, const std::array< dealii::Tensor< 1, dim, real2 >, nstate_turbulence_model > &primitive_solution_gradient_turbulence_model) const
Templated Additional viscous flux of RANS + viscous flux of turbulence model.
std::array< real, nstate > dissipative_source_term_computed_from_manufactured_solution(const dealii::Point< dim, real > &pos, 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.
std::array< real, nstate > physical_source_term_computed_from_manufactured_solution(const dealii::Point< dim, real > &pos, const dealii::types::global_dof_index cell_index) const
Files for the baseline physics.
std::array< real, nstate-(dim+2)> compute_mean_turbulence_property(const std::array< real, nstate > &conservative_soln1, const std::array< real, nstate > &conservative_soln2) const
Mean turbulence properties given two sets of conservative solutions.
real max_convective_eigenvalue(const std::array< real, nstate > &soln) const
Maximum convective eigenvalue of the additional models' PDEs.
virtual std::array< FadType, nstate_turbulence_model > compute_effective_viscosity_turbulence_model_fad(const std::array< FadType, nstate_navier_stokes > &primitive_soln_rans, const std::array< FadType, nstate_turbulence_model > &primitive_soln_turbulence_model) const =0
Nondimensionalized effective (total) viscosities for the turbulence model (Automatic Differentiation ...
virtual dealii::Tensor< 2, dim, FadType > compute_Reynolds_stress_tensor_fad(const std::array< FadType, nstate_navier_stokes > &primitive_soln_rans, const std::array< dealii::Tensor< 1, dim, FadType >, nstate_navier_stokes > &primitive_soln_gradient_rans, const std::array< FadType, nstate_turbulence_model > &primitive_soln_turbulence_model) const =0
Nondimensionalized Reynolds stress tensor, (tau^reynolds)* (Automatic Differentiation Type: FadType) ...
Physics model additional terms and equations to the baseline physics.
Main parameter class that contains the various other sub-parameter classes.
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
std::array< dealii::Tensor< 1, dim, real2 >, dim+2 > extract_rans_solution_gradient(const std::array< dealii::Tensor< 1, dim, real2 >, nstate > &solution_gradient) const
Returns the conservative solutions gradient of Reynolds-averaged Navier-Stokes equations (without add...
std::array< dealii::Tensor< 1, dim, real >, nstate > convective_flux(const std::array< real, nstate > &conservative_soln) const
Additional convective flux of RANS + convective flux of turbulence model.
virtual dealii::Tensor< 1, dim, FadType > compute_Reynolds_heat_flux_fad(const std::array< FadType, nstate_navier_stokes > &primitive_soln_rans, const std::array< dealii::Tensor< 1, dim, FadType >, nstate_navier_stokes > &primitive_soln_gradient_rans, const std::array< FadType, nstate_turbulence_model > &primitive_soln_turbulence_model) const =0
Nondimensionalized Reynolds heat flux, (q^reynolds)* (Automatic Differentiation Type: FadType) ...
TwoPointNumericalFlux
Two point numerical flux type for split form.
std::array< dealii::Tensor< 1, dim, real2 >, nstate > convective_flux_templated(const std::array< real2, nstate > &conservative_soln) const
Templated additional convective flux.
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 additional dissipative (i.e. viscous) flux.
virtual dealii::Tensor< 2, dim, real > compute_Reynolds_stress_tensor(const std::array< real, nstate_navier_stokes > &primitive_soln_rans, const std::array< dealii::Tensor< 1, dim, real >, nstate_navier_stokes > &primitive_soln_gradient_rans, const std::array< real, nstate_turbulence_model > &primitive_soln_turbulence_model) const =0
Nondimensionalized Reynolds stress tensor, (tau^reynolds)*.
std::unique_ptr< NavierStokes< dim, nstate_navier_stokes, real > > navier_stokes_physics
Pointer to Navier-Stokes physics object.
static const int nstate_navier_stokes
Number of PDEs for RANS equations.
Reynolds-Averaged Navier-Stokes (RANS) equations. Derived from Navier-Stokes for modifying the stress...
std::array< real, nstate > convective_eigenvalues(const std::array< real, nstate > &, const dealii::Tensor< 1, dim, real > &) const
Convective eigenvalues of the additional models' PDEs.
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...
dealii::Tensor< 2, nstate, real > convective_flux_directional_jacobian(const std::array< real, nstate > &conservative_soln, const dealii::Tensor< 1, dim, real > &normal) const
real2 get_vector_magnitude_sqr(const dealii::Tensor< 1, 3, real2 > &vector) const
Returns the square of the magnitude of the vector.
virtual dealii::Tensor< 1, dim, real > compute_Reynolds_heat_flux(const std::array< real, nstate_navier_stokes > &primitive_soln_rans, const std::array< dealii::Tensor< 1, dim, real >, nstate_navier_stokes > &primitive_soln_gradient_rans, const std::array< real, nstate_turbulence_model > &primitive_soln_turbulence_model) const =0
Nondimensionalized Reynolds heat flux, (q^reynolds)*.
std::array< real, nstate > convective_source_term_computed_from_manufactured_solution(const dealii::Point< dim, real > &pos) const
static const int nstate_turbulence_model
Number of PDEs for RANS turbulence model.
ThermalBoundaryCondition
Types of thermal boundary conditions available.
std::array< dealii::Tensor< 1, dim, real2 >, nstate-(dim+2)> convert_conservative_gradient_to_primitive_gradient_turbulence_model(const std::array< real2, nstate > &conservative_soln, const std::array< dealii::Tensor< 1, dim, real2 >, nstate > &solution_gradient) 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...
std::array< real2, dim+2 > extract_rans_conservative_solution(const std::array< real2, nstate > &conservative_soln) const
Returns the conservative solutions of Reynolds-averaged Navier-Stokes equations (without additional R...
codi_HessianComputationType RadFadType
Nested reverse-forward mode type for Jacobian and Hessian computation using TapeHelper.
Navier-Stokes equations. Derived from Euler for the convective terms, which is derived from PhysicsBa...
std::array< dealii::Tensor< 1, dim, real >, nstate > get_manufactured_solution_gradient(const dealii::Point< dim, real > &pos) const
Get manufactured solution value.
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.
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
Additional viscous flux of RANS + viscous flux of turbulence model.