1 #include "rrk_numerical_entropy_conservation_check.h" 2 #include "flow_solver/flow_solver_factory.h" 3 #include "flow_solver/flow_solver_cases/periodic_1D_unsteady.h" 4 #include "flow_solver/flow_solver_cases/periodic_turbulence.h" 5 #include "physics/exact_solutions/exact_solution.h" 11 template <
int dim,
int nstate>
14 const dealii::ParameterHandler ¶meter_handler_input)
16 parameter_handler(parameter_handler_input)
19 template <
int dim,
int nstate>
34 template <
int dim,
int nstate>
37 const double initial_numerical_entropy,
38 const double final_time_actual,
39 bool expect_conservation
53 const double numerical_entropy_change = abs(initial_numerical_entropy-final_numerical_entropy);
54 pcout <<
"At end time t = " << final_time_actual <<
", numerical entropy change at end was " << std::fixed << std::setprecision(16) << numerical_entropy_change <<std::endl;
55 if (expect_conservation && (numerical_entropy_change< 1E-13)){
56 pcout <<
"Numerical entropy was conserved, as expected." << std::endl;
58 }
else if (!expect_conservation && (numerical_entropy_change > 1E-13)){
59 pcout <<
"Numerical entropy was NOT conserved, as expected." << std::endl;
61 }
else if (expect_conservation && (numerical_entropy_change > 1E-13)){
62 pcout <<
"Numerical entropy was NOT conserved, but was expected to be conserved." << std::endl;
63 pcout <<
" Unexpected result! Test failing." << std::endl;
66 pcout <<
"Numerical entropy was conserved, but was expected NOT to be conserved." << std::endl;
67 pcout <<
" Unexpected result! Test failing." << std::endl;
72 template <
int dim,
int nstate>
75 const double numerical_entropy_initial,
76 bool expect_conservation
80 static_cast<void>(flow_solver->run());
81 const double final_time_actual = flow_solver->ode_solver->current_time;
83 return failed_this_calculation;
86 template <
int dim,
int nstate>
92 double time_step_reduction_factor = 1E-2;
94 int n_steps = round(final_time/time_step_large);
95 if (n_steps * time_step_large!= final_time){
96 pcout <<
"WARNING: final_time is not evenly divisible by initial_time_step!" << std::endl
97 <<
"Remainder is " << fmod(final_time, time_step_large)
98 <<
". Consider modifying parameters." << std::endl;
102 int failed_this_calculation = 0;
104 pcout <<
"\n\n-------------------------------------------------------------" << std::endl;
105 pcout <<
" Calculating initial numerical entropy..." << std::endl;
106 pcout <<
"-------------------------------------------------------------" << std::endl;
119 pcout <<
" Initial numerical_entropy : " << numerical_entropy_initial << std::endl;
122 pcout <<
"\n\n-------------------------------------------------------------" << std::endl;
123 pcout <<
" Using large timestep and RRK" << std::endl;
124 pcout <<
"-------------------------------------------------------------" << std::endl;
128 numerical_entropy_initial,
130 if (failed_this_calculation) testfail = 1;
132 pcout <<
"\n\n-------------------------------------------------------------" << std::endl;
133 pcout <<
" Using large timestep without RRK" << std::endl;
134 pcout <<
"-------------------------------------------------------------" << std::endl;
138 numerical_entropy_initial,
140 if (failed_this_calculation) testfail = 1;
142 pcout <<
"\n\n-------------------------------------------------------------" << std::endl;
143 pcout <<
" Using small timestep, reducing by " << time_step_reduction_factor <<
" and RRK" << std::endl;
144 pcout <<
"-------------------------------------------------------------" << std::endl;
148 numerical_entropy_initial,
150 if (failed_this_calculation) testfail = 1;
152 pcout <<
"\n\n-------------------------------------------------------------" << std::endl;
153 pcout <<
" Using small timestep, reducing by " << time_step_reduction_factor <<
" without RRK" << std::endl;
154 pcout <<
"-------------------------------------------------------------" << std::endl;
158 numerical_entropy_initial,
160 if (failed_this_calculation) testfail = 1;
166 #elif PHILIP_DIM == 3 double final_time
Final solution time.
double courant_friedrichs_lewy_number
Courant-Friedrich-Lewy (CFL) number for constant time step.
FlowSolverParam flow_solver_param
Contains the parameters for simulation cases (flow solver test)
Selects which flow case to simulate.
Files for the baseline physics.
int run_test() const override
Run test.
double get_numerical_entropy(const std::shared_ptr< DGBase< dim, double >>) const
Retrieves cumulative_numerical_entropy_change_FRcorrected.
ODESolverEnum
Types of ODE solver.
const dealii::ParameterHandler & parameter_handler
Parameter handler for storing the .prm file being ran.
Main parameter class that contains the various other sub-parameter classes.
int compare_numerical_entropy_to_initial(const std::unique_ptr< FlowSolver::FlowSolver< dim, nstate >> &flow_solver, const double initial_numerical_entropy, const double final_time_actual, bool expect_conservation) const
Compare the numerical_entropy after flow simulation to initial, and return test fail int...
ODESolverParam ode_solver_param
Contains parameters for ODE solver.
double initial_time_step
Time step used in ODE solver.
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.
int get_numerical_entropy_and_compare_to_initial(const Parameters::AllParameters params, const double numerical_entropy_initial, bool expect_conservation) const
runs flow solver. Returns 0 (pass) or 1 (fail) based on numerical_entropy conservation of calculation...
RRKNumericalEntropyConservationCheck(const Parameters::AllParameters *const parameters_input, const dealii::ParameterHandler ¶meter_handler_input)
Constructor.
Parameters::AllParameters reinit_params(bool use_rrk, double time_step_size) const
Reinitialize parameters. Necessary because all_parameters is constant.
ODESolverEnum ode_solver_type
ODE solver type.
dealii::ConditionalOStream pcout
ConditionalOStream.
Verify numerical_entropy conservation for inviscid Burgers using split form and RRK.
Base class of all the tests.