[P]arallel [Hi]gh-order [Li]brary for [P]DEs  Latest
Parallel High-Order Library for PDEs through hp-adaptive Discontinuous Galerkin methods
turbulent_channel_flow_unsteady_quantity_check.cpp
1 #include "turbulent_channel_flow_unsteady_quantity_check.h"
2 #include "flow_solver/flow_solver_factory.h"
3 #include "flow_solver/flow_solver_cases/channel_flow.h"
4 
5 namespace PHiLiP {
6 namespace Tests {
7 
8 template <int dim, int nspecies, int nstate>
10  const PHiLiP::Parameters::AllParameters *const parameters_input,
11  const dealii::ParameterHandler &parameter_handler_input)
12  : TestsBase::TestsBase(parameters_input)
13  , parameter_handler(parameter_handler_input)
14  , average_wall_shear_stress_expected(parameters_input->flow_solver_param.expected_average_wall_shear_stress_at_final_time)
15  , skin_friction_coefficient_expected(parameters_input->flow_solver_param.expected_skin_friction_coefficient_at_final_time)
16  , using_wall_model(parameters_input->using_wall_model)
17 {}
18 
19 template <int dim, int nspecies, int nstate>
21 {
22  // Integrate to final time
23  std::unique_ptr<FlowSolver::FlowSolver<dim,nspecies,nstate>> flow_solver = FlowSolver::FlowSolverFactory<dim,nspecies,nstate>::select_flow_case(this->all_parameters, parameter_handler);
24  static_cast<void>(flow_solver->run());
25 
26  // Compute kinetic energy, enstrophy, and palinstrophy
27  std::unique_ptr<FlowSolver::ChannelFlow<dim, nspecies, nstate>> flow_solver_case = std::make_unique<FlowSolver::ChannelFlow<dim,nspecies,nstate>>(this->all_parameters);
28  flow_solver_case->compute_and_update_integrated_quantities(*(flow_solver->dg));
29 
30  double average_wall_shear_stress = 0.0;
31  if(using_wall_model) average_wall_shear_stress = flow_solver_case->get_average_wall_shear_stress_from_wall_model(*(flow_solver->dg));
32  else average_wall_shear_stress = flow_solver_case->get_average_wall_shear_stress(*(flow_solver->dg));
33  flow_solver_case->set_bulk_flow_quantities(*(flow_solver->dg));
34  const double skin_friction_coefficient = flow_solver_case->get_skin_friction_coefficient_from_average_wall_shear_stress(average_wall_shear_stress);
35 
36  const double relative_error_average_wall_shear_stress = abs(average_wall_shear_stress - average_wall_shear_stress_expected)/average_wall_shear_stress_expected;
37  const double relative_error_skin_friction_coefficient = abs(skin_friction_coefficient - skin_friction_coefficient_expected)/skin_friction_coefficient_expected;
38 
39  if (relative_error_average_wall_shear_stress > 1.0e-10) {
40  pcout << "Computed average wall shear stress is not within specified tolerance with respect to expected value." << std::endl;
41  return 1;
42  }
43  if (relative_error_skin_friction_coefficient > 1.0e-10) {
44  pcout << "Computed skin friction coefficient is not within specified tolerance with respect to expected value." << std::endl;
45  return 1;
46  }
47  pcout << " Test passed, computed average wall shear stress, and skin friction coefficient are within specified tolerance." << std::endl;
48  return 0;
49 }
50 
51 #if PHILIP_DIM==3
53 #endif
54 } // Tests namespace
55 } // PHiLiP namespace
const dealii::ParameterHandler & parameter_handler
Parameter handler for storing the .prm file being ran.
const double skin_friction_coefficient_expected
Expected skin friction coefficient at final time.
const double average_wall_shear_stress_expected
Expected average wall shear stress at final time.
Files for the baseline physics.
Definition: ADTypes.hpp:10
static std::unique_ptr< FlowSolver< dim, nspecies, nstate > > select_flow_case(const Parameters::AllParameters *const parameters_input, const dealii::ParameterHandler &parameter_handler_input)
Factory to return the correct flow solver given input file.
Main parameter class that contains the various other sub-parameter classes.
const Parameters::AllParameters *const all_parameters
Pointer to all parameters.
Definition: tests.h:20
TurbulentChannelFlowUnsteadyQuantityCheck(const Parameters::AllParameters *const parameters_input, const dealii::ParameterHandler &parameter_handler_input)
Constructor.
dealii::ConditionalOStream pcout
ConditionalOStream.
Definition: tests.h:45
Base class of all the tests.
Definition: tests.h:17