1 #include <boost/preprocessor/seq/for_each.hpp> 4 #include "dg_base_state.hpp" 5 #include "physics/model_factory.h" 6 #include "physics/physics_factory.h" 10 template <
int dim,
int nspecies,
int nstate,
typename real,
typename MeshType>
12 const unsigned int degree,
const unsigned int max_degree_input,
13 const unsigned int grid_degree_input,
14 const std::shared_ptr<Triangulation> triangulation_input)
15 :
DGBase<dim, nspecies, real, MeshType>::
DGBase(nstate, parameters_input, degree, max_degree_input, grid_degree_input,
40 template <
int dim,
int nspecies,
int nstate,
typename real,
typename MeshType>
74 template <
int dim,
int nspecies,
int nstate,
typename real,
typename MeshType>
90 template <
int dim,
int nspecies,
int nstate,
typename real,
typename MeshType>
110 template <
int dim,
int nspecies,
int nstate,
typename real,
typename MeshType>
117 dealii::hp::MappingCollection<dim> mapping_collection(mapping);
118 const dealii::UpdateFlags update_flags = dealii::update_values | dealii::update_JxW_values;
119 dealii::hp::FEValues<dim,dim> fe_values_collection_volume (mapping_collection,
125 for (
auto cell : this->
dof_handler.active_cell_iterators()) {
126 if (!(cell->is_locally_owned() || cell->is_ghost()))
continue;
129 const int i_fele = cell->active_fe_index();
130 const int i_quad = i_fele;
131 const int i_mapp = 0;
132 fe_values_collection_volume.reinit(cell, i_quad, i_mapp, i_fele);
133 const dealii::FEValues<dim,dim> &fe_values_volume = fe_values_collection_volume.get_present_fe_values();
136 const dealii::FESystem<dim,dim> &fe_high = this->
fe_collection[i_fele];
137 const unsigned int cell_poly_degree = fe_high.tensor_degree();
140 const dealii::Quadrature<dim> &quadrature = fe_values_volume.get_quadrature();
141 const unsigned int n_quad_pts = quadrature.size();
142 const std::vector<real> &JxW = fe_values_volume.get_JxW_values();
143 real cell_volume_estimate = 0.0;
144 for (
unsigned int iquad=0; iquad<n_quad_pts; ++iquad) {
145 cell_volume_estimate = cell_volume_estimate + JxW[iquad];
150 const dealii::types::global_dof_index cell_index = cell->active_cell_index();
158 pde_model_fad->cellwise_poly_degree[cell_index] = cell_poly_degree;
161 pde_model_rad->cellwise_poly_degree[cell_index] = cell_poly_degree;
182 template <
int dim,
int nspecies,
int nstate,
typename real,
typename MeshType>
184 const double time_step)
194 template <
int dim,
int nspecies,
int nstate,
typename real,
typename MeshType>
199 template <
int dim,
int nspecies,
int nstate,
typename real,
typename MeshType>
207 template <
int dim,
int nspecies,
int nstate,
typename real,
typename MeshType>
216 template <
int dim,
int nspecies,
int nstate,
typename real,
typename MeshType>
218 const real artificial_dissipation,
const real cell_diameter,
219 const unsigned int cell_degree) {
220 const unsigned int n_pts = soln_at_q.size();
221 std::vector<real> convective_eigenvalues(n_pts);
222 std::vector<real> viscosities(n_pts);
223 for (
unsigned int isol = 0; isol < n_pts; ++isol) {
224 convective_eigenvalues[isol] =
pde_physics_double->max_convective_eigenvalue(soln_at_q[isol]);
227 const real max_eig = *(std::max_element(convective_eigenvalues.begin(), convective_eigenvalues.end()));
228 const real max_diffusive = *(std::max_element(viscosities.begin(), viscosities.end()));
234 const unsigned int p = std::max((
unsigned int)1, cell_degree);
235 const real cfl_convective = (cell_diameter / max_eig) / (2 * p + 1);
236 const real cfl_diffusive = artificial_dissipation != 0.0
237 ? (0.5 * cell_diameter * cell_diameter / artificial_dissipation) / (p * p * p * p)
239 Parameters::ODESolverParam::ODESolverEnum::implicit_solver)
241 (0.5 * cell_diameter * cell_diameter / max_diffusive) / (2 * p + 1)
243 real min_cfl = std::min(cfl_convective, cfl_diffusive);
245 if (min_cfl >= 1e190) min_cfl = cell_diameter / 1;
250 #if PHILIP_SPECIES==1 252 #define POSSIBLE_NSTATE (1)(2)(3)(4)(5)(6) 255 #define INSTANTIATE_DISTRIBUTED(r, data, index) \ 256 template class DGBaseState <PHILIP_DIM, PHILIP_SPECIES, index, double, dealii::parallel::distributed::Triangulation<PHILIP_DIM>>; 259 BOOST_PP_SEQ_FOR_EACH(INSTANTIATE_DISTRIBUTED, _, POSSIBLE_NSTATE)
262 #define INSTANTIATE_TRIA(r, data, index) \ 263 template class DGBaseState <PHILIP_DIM, PHILIP_SPECIES, index, double, dealii::parallel::shared::Triangulation<PHILIP_DIM>>; \ 264 template class DGBaseState <PHILIP_DIM, PHILIP_SPECIES, index, double, dealii::Triangulation<PHILIP_DIM>>; 265 BOOST_PP_SEQ_FOR_EACH(INSTANTIATE_TRIA, _, POSSIBLE_NSTATE)
std::shared_ptr< Physics::ModelBase< dim, nspecies, nstate, FadFadType > > pde_model_fad_fad
Contains the model terms of the PDEType == PhysicsModel with FadFadType.
void set_use_auxiliary_eq()
Set use_auxiliary_eq flag.
PartialDifferentialEquation pde_type
Store the PDE type to be solved.
static std::shared_ptr< ArtificialDissipationBase< dim, nspecies, nstate > > create_artificial_dissipation(const Parameters::AllParameters *const parameters_input)
Creates artificial dissipation type depending on input parameters.
void set_store_vol_flux_nodes()
Set store_vol_flux_nodes flag.
bool all_boundaries_are_periodic
Flag to signal that all boundaries are periodic; if true surface flux nodes will not be stored for ef...
Base class from which Advection, Diffusion, ConvectionDiffusion, and Euler is derived.
std::shared_ptr< Physics::ModelBase< dim, nspecies, nstate, RadFadType > > pde_model_rad_fad
Contains the model terms of the PDEType == PhysicsModel with RadFadType.
DGBaseState(const Parameters::AllParameters *const parameters_input, const unsigned int degree, const unsigned int max_degree_input, const unsigned int grid_degree_input, const std::shared_ptr< Triangulation > triangulation_input)
< Input parameters.
std::shared_ptr< ArtificialDissipationBase< dim, nspecies, nstate > > artificial_dissip
Link to Artificial dissipation class (with three dissipation types, depending on the input)...
Files for the baseline physics.
bool use_weak_form
Flag to use weak or strong form of DG.
ManufacturedSolutionParam manufactured_solution_param
Associated manufactured solution parameters.
std::shared_ptr< Physics::ModelBase< dim, nspecies, nstate, real > > pde_model_double
Contains the model terms of the PDEType == PhysicsModel with real type.
std::shared_ptr< HighOrderGrid< dim, real, MeshType > > high_order_grid
High order grid that will provide the MappingFEField.
dealii::hp::QCollection< dim > volume_quadrature_collection
Finite Element Collection to represent the high-order grid.
std::unique_ptr< NumericalFlux::NumericalFluxConvective< dim, nspecies, nstate, RadFadType > > conv_num_flux_rad_fad
Convective numerical flux with RadFadDtype.
std::shared_ptr< Physics::ModelBase< dim, nspecies, nstate, FadType > > pde_model_fad
Contains the model terms of the PDEType == PhysicsModel with FadType.
std::unique_ptr< NumericalFlux::NumericalFluxDissipative< dim, nspecies, nstate, FadType > > diss_num_flux_fad
Dissipative numerical flux with FadType.
std::shared_ptr< Physics::PhysicsBase< dim, nspecies, nstate, FadType > > pde_physics_fad
Contains the physics of the PDE with FadType.
Main parameter class that contains the various other sub-parameter classes.
void set_physics(std::shared_ptr< Physics::PhysicsBase< dim, nspecies, nstate, real > > pde_physics_double_input, std::shared_ptr< Physics::PhysicsBase< dim, nspecies, nstate, FadType > > pde_physics_fad_input, std::shared_ptr< Physics::PhysicsBase< dim, nspecies, nstate, RadType > > pde_physics_rad_input, std::shared_ptr< Physics::PhysicsBase< dim, nspecies, nstate, FadFadType > > pde_physics_fad_fad_input, std::shared_ptr< Physics::PhysicsBase< dim, nspecies, nstate, RadFadType > > pde_physics_rad_fad_input)
std::unique_ptr< NumericalFlux::NumericalFluxConvective< dim, nspecies, nstate, FadType > > conv_num_flux_fad
Convective numerical flux with FadType.
static std::unique_ptr< NumericalFluxConvective< dim, nspecies, nstate, real > > create_convective_numerical_flux(const AllParam::ConvectiveNumericalFlux conv_num_flux_type, const AllParam::PartialDifferentialEquation pde_type, const AllParam::ModelType model_type, std::shared_ptr< Physics::PhysicsBase< dim, nspecies, nstate, real >> physics_input)
Creates convective numerical flux (baseline flux + upwind term) based on input.
dealii::DoFHandler< dim > dof_handler
Finite Element Collection to represent the high-order grid.
ManufacturedConvergenceStudyParam manufactured_convergence_study_param
Contains parameters for manufactured convergence study.
ODESolverParam ode_solver_param
Contains parameters for ODE solver.
bool use_auxiliary_eq
Flag for using the auxiliary equation.
dealii::Vector< double > cell_volume
Time it takes for the maximum wavespeed to cross the cell domain.
const Parameters::AllParameters *const all_parameters
Pointer to all parameters.
MPI_Comm mpi_communicator
MPI communicator.
std::unique_ptr< NumericalFlux::NumericalFluxDissipative< dim, nspecies, nstate, RadType > > diss_num_flux_rad
Dissipative numerical flux with RadType.
virtual void update_model_variables()
Update the necessary variables declared in src/physics/model.h.
bool use_manufactured_source_term
Uses non-zero source term based on the manufactured solution and the PDE.
std::shared_ptr< Physics::PhysicsBase< dim, nspecies, nstate, FadFadType > > pde_physics_fad_fad
Contains the physics of the PDE with FadFadType.
static std::unique_ptr< NumericalFluxDissipative< dim, nspecies, nstate, real > > create_dissipative_numerical_flux(const AllParam::DissipativeNumericalFlux diss_num_flux_type, std::shared_ptr< Physics::PhysicsBase< dim, nspecies, nstate, real >> physics_input, std::shared_ptr< ArtificialDissipationBase< dim, nspecies, nstate >> artificial_dissipation_input)
Creates dissipative numerical flux based on input.
std::shared_ptr< Physics::PhysicsBase< dim, nspecies, nstate, RadFadType > > pde_physics_rad_fad
Contains the physics of the PDE with RadFadDtype.
std::unique_ptr< NumericalFlux::NumericalFluxConvective< dim, nspecies, nstate, real > > conv_num_flux_double
Convective numerical flux with real type.
ConvectiveNumericalFlux conv_num_flux_type
Store convective flux type.
Abstract class templated on the number of state variables.
std::shared_ptr< Physics::PhysicsBase< dim, nspecies, nstate, RadType > > pde_physics_rad
Contains the physics of the PDE with RadType.
bool store_surf_flux_nodes
Flag for storing surface flux nodes.
std::unique_ptr< NumericalFlux::NumericalFluxDissipative< dim, nspecies, nstate, FadFadType > > diss_num_flux_fad_fad
Dissipative numerical flux with FadFadType.
ODESolverEnum ode_solver_type
ODE solver type.
std::unique_ptr< NumericalFlux::NumericalFluxDissipative< dim, nspecies, nstate, RadFadType > > diss_num_flux_rad_fad
Dissipative numerical flux with RadFadDtype.
static std::shared_ptr< PhysicsBase< dim, nspecies, nstate, real > > create_Physics(const Parameters::AllParameters *const parameters_input, std::shared_ptr< ModelBase< dim, nspecies, nstate, real > > model_input=nullptr)
Factory to return the correct physics given input file.
void reset_numerical_fluxes()
Reinitializes the numerical fluxes based on the current physics.
void set_store_surf_flux_nodes()
Set store_surf_flux_nodes flag.
DissipativeNumericalFlux diss_num_flux_type
Store diffusive flux type.
std::shared_ptr< Triangulation > triangulation
Mesh.
std::unique_ptr< NumericalFlux::NumericalFluxConvective< dim, nspecies, nstate, FadFadType > > conv_num_flux_fad_fad
Convective numerical flux with FadFadType.
const dealii::hp::FECollection< dim > fe_collection
Finite Element Collection for p-finite-element to represent the solution.
ModelType model_type
Store the model type.
DGBase is independent of the number of state variables.
std::unique_ptr< NumericalFlux::NumericalFluxDissipative< dim, nspecies, nstate, real > > diss_num_flux_double
Dissipative numerical flux with real type.
void set_unsteady_model_time_step(const double time_step)
Set the necessary unsteady variables declared in src/physics/model.h.
std::shared_ptr< Physics::ModelBase< dim, nspecies, nstate, RadType > > pde_model_rad
Contains the model terms of the PDEType == PhysicsModel with RadType.
static std::shared_ptr< ModelBase< dim, nspecies, nstate, real > > create_Model(const Parameters::AllParameters *const parameters_input)
Factory to return the correct model given input parameters.
std::unique_ptr< NumericalFlux::NumericalFluxConvective< dim, nspecies, nstate, RadType > > conv_num_flux_rad
Convective numerical flux with RadType.
virtual void allocate_model_variables()
Allocate the necessary variables declared in src/physics/model.h.
std::shared_ptr< Physics::PhysicsBase< dim, nspecies, nstate, real > > pde_physics_double
Contains the physics of the PDE with real type.
real evaluate_CFL(std::vector< std::array< real, nstate > > soln_at_q, const real artificial_dissipation, const real cell_diameter, const unsigned int cell_degree)
Evaluate the time it takes for the maximum wavespeed to cross the cell domain.
bool store_vol_flux_nodes
Flag for storing volume flux nodes.