1 #include "naca0012_unsteady_check_quick.h" 2 #include "flow_solver/flow_solver_factory.h" 3 #include "flow_solver/flow_solver_cases/naca0012.h" 8 template <
int dim,
int nstate>
11 const dealii::ParameterHandler ¶meter_handler_input)
13 , parameter_handler(parameter_handler_input)
16 template <
int dim,
int nstate>
23 parameters.
conv_num_flux_type = (use_two_point_flux_input) ? ConvFluxEnum::two_point_flux : ConvFluxEnum::roe;
29 template <
int dim,
int nstate>
33 double lift_calculated[n_runs] = {0};
34 double drag_calculated[n_runs] = {0};
36 const bool use_weak_form[3] = {
true,
false,
false};
37 const bool use_two_point_flux[3] = {
false,
false,
true};
38 for (
unsigned int irun = 0; irun < n_runs; ++irun) {
40 this->
pcout <<
"=====================================================" << std::endl;
44 if (use_weak_form[irun]){
45 this->
pcout <<
"Initialized parameters with weak form." << std::endl;
47 this->
pcout <<
"Initialized parameters with strong form." << std::endl;
50 if (use_two_point_flux[irun]){
51 this->
pcout <<
"Using two-point flux." << std::endl;
53 this->
pcout <<
"Using roe flux." << std::endl;
55 this->
pcout << std::endl;
60 static_cast<void>(flow_solver_loop->run());
61 std::unique_ptr<FlowSolver::NACA0012<dim, nstate>> flow_solver_case_loop = std::make_unique<FlowSolver::NACA0012<dim,nstate>>(this->
all_parameters);
62 lift_calculated[irun] = flow_solver_case_loop->compute_lift((flow_solver_loop->dg));
63 drag_calculated[irun] = flow_solver_case_loop->compute_drag((flow_solver_loop->dg));
64 this->
pcout <<
"Finished run." << std::endl;
65 this->
pcout <<
"Calculated lift value was : " << lift_calculated[irun] << std::endl
66 <<
"Calculated drag value was : " << drag_calculated[irun] << std::endl;
67 this->
pcout <<
"=====================================================" << std::endl;
70 const double acceptable_tolerance = 0.00001;
74 const bool allow_strong_split_to_be_different =
true;
76 this->
pcout << std::endl
77 <<
"Finished runs. Summary of results: " << std::endl
78 <<
"Scheme | Lift | Drag" << std::endl
79 <<
"------------------------------------" << std::endl
80 <<
"Weak, roe | " << lift_calculated[0] <<
" | " << drag_calculated[0] << std::endl
81 <<
"Strong, roe | " << lift_calculated[1] <<
" | " << drag_calculated[1] << std::endl
82 <<
"Strong, split | " << lift_calculated[2] <<
" | " << drag_calculated[2] << std::endl;
84 if (allow_strong_split_to_be_different) {
85 if ((abs(lift_calculated[0]-lift_calculated[1]) > acceptable_tolerance)
86 || (abs(drag_calculated[0]-drag_calculated[1]) > acceptable_tolerance)){
90 const double lift_max = *std::max_element(lift_calculated, lift_calculated+n_runs);
91 const double lift_min = *std::min_element(lift_calculated, lift_calculated+n_runs);
92 const double drag_max = *std::max_element(drag_calculated, drag_calculated+n_runs);
93 const double drag_min = *std::min_element(drag_calculated, drag_calculated+n_runs);
94 if ((abs(lift_max - lift_min) > acceptable_tolerance)
95 || (abs(drag_max - drag_min) > acceptable_tolerance)){
101 this->
pcout <<
"Test failing: difference is not within the allowable tolerance of " << acceptable_tolerance << std::endl;
102 this->
pcout <<
"If this test is failing, please check the *vtu output." << std::endl;
104 this->
pcout <<
"Test passing: lift and drag close to the expected value." << std::endl;
Parameters::AllParameters reinit_params(const bool use_weak_form_input, const bool use_two_point_flux_input) const
Reinit parameters based on specified weak/strong form and convective num flux.
int run_test() const override
Run test.
Files for the baseline physics.
bool use_weak_form
Flag to use weak or strong form of DG.
Main parameter class that contains the various other sub-parameter classes.
const dealii::ParameterHandler & parameter_handler
Parameter handler for storing the .prm file being ran.
static std::unique_ptr< FlowSolver< dim, nstate > > select_flow_case(const Parameters::AllParameters *const parameters_input, const dealii::ParameterHandler ¶meter_handler_input)
Factory to return the correct flow solver given input file.
const Parameters::AllParameters *const all_parameters
Pointer to all parameters.
NACA0012UnsteadyCheckQuick(const Parameters::AllParameters *const parameters_input, const dealii::ParameterHandler ¶meter_handler_input)
Constructor.
bool use_split_form
Flag to use split form.
NACA 0012 Unsteady Check.
ConvectiveNumericalFlux
Possible convective numerical flux types.
ConvectiveNumericalFlux conv_num_flux_type
Store convective flux type.
dealii::ConditionalOStream pcout
ConditionalOStream.
Base class of all the tests.