1 #ifndef PHILIP_DG_BASE_HPP 2 #define PHILIP_DG_BASE_HPP 4 #include <deal.II/base/conditional_ostream.h> 5 #include <deal.II/base/parameter_handler.h> 7 #include <deal.II/base/qprojector.h> 9 #include <deal.II/grid/tria.h> 11 #include <deal.II/fe/fe_dgq.h> 12 #include <deal.II/fe/fe_dgp.h> 13 #include <deal.II/fe/fe_system.h> 14 #include <deal.II/fe/mapping_fe_field.h> 17 #include <deal.II/dofs/dof_handler.h> 19 #include <deal.II/hp/q_collection.h> 20 #include <deal.II/hp/mapping_collection.h> 21 #include <deal.II/hp/fe_values.h> 23 #include <deal.II/lac/vector.h> 24 #include <deal.II/lac/sparsity_pattern.h> 25 #include <deal.II/lac/trilinos_sparse_matrix.h> 26 #include <deal.II/lac/trilinos_vector.h> 28 #include <Epetra_RowMatrixTransposer.h> 31 #include "ADTypes.hpp" 33 #include <CoDiPack/include/codi.hpp> 35 #include "mesh/high_order_grid.h" 36 #include "physics/physics.h" 37 #include "physics/model.h" 38 #include "numerical_flux/numerical_flux_factory.hpp" 39 #include "numerical_flux/convective_numerical_flux.hpp" 40 #include "numerical_flux/viscous_numerical_flux.hpp" 41 #include "parameters/all_parameters.h" 42 #include "operators/operators.h" 43 #include "artificial_dissipation_factory.h" 46 #include <deal.II/base/timer.h> 53 template<
int dim,
typename real>
55 const std::vector< real > &function_coeff,
56 const dealii::FESystem<dim,dim> &fe_input,
57 const dealii::FESystem<dim,dim> &fe_output,
58 const dealii::QGauss<dim> &projection_quadrature);
77 #if PHILIP_DIM==1 // dealii::parallel::distributed::Triangulation<dim> does not work for 1D 78 template <
int dim,
typename real,
typename MeshType = dealii::Triangulation<dim>>
80 template <
int dim,
typename real,
typename MeshType = dealii::parallel::distributed::Triangulation<dim>>
121 DGBase(
const int nstate_input,
123 const unsigned int degree,
124 const unsigned int max_degree_input,
125 const unsigned int grid_degree_input,
126 const std::shared_ptr<Triangulation> triangulation_input);
138 dealii::hp::FECollection<dim>,
139 dealii::hp::QCollection<dim>,
140 dealii::hp::QCollection<dim-1>,
141 dealii::hp::FECollection<dim>,
142 dealii::hp::FECollection<1>,
143 dealii::hp::FECollection<1>,
144 dealii::hp::FECollection<1>,
145 dealii::hp::QCollection<1> >;
152 DGBase(
const int nstate_input,
154 const unsigned int degree,
155 const unsigned int max_degree_input,
156 const unsigned int grid_degree_input,
157 const std::shared_ptr<Triangulation> triangulation_input,
185 const bool compute_dRdX =
true,
186 const bool compute_d2R =
true);
212 void time_scale_solution_update ( dealii::LinearAlgebra::distributed::Vector<double> &solution_update,
const real CFL )
const;
220 const unsigned int poly_degree_int,
221 const unsigned int poly_degree_ext,
222 const unsigned int grid_degree,
234 const bool Cartesian_element,
235 const unsigned int poly_degree,
236 const unsigned int grid_degree,
249 const bool Cartesian_element,
250 const bool do_inverse_mass_matrix,
251 const unsigned int poly_degree,
252 const unsigned int curr_grid_degree,
253 const unsigned int n_quad_pts,
254 const unsigned int n_dofs_cell,
255 const std::vector<dealii::types::global_dof_index> dofs_indices,
268 const dealii::LinearAlgebra::distributed::Vector<double> &input_vector,
269 dealii::LinearAlgebra::distributed::Vector<double> &output_vector,
282 const dealii::LinearAlgebra::distributed::Vector<double> &input_vector,
283 dealii::LinearAlgebra::distributed::Vector<double> &output_vector,
285 const bool use_unmodified_mass_matrix =
false);
308 unsigned int n_dofs()
const;
356 dealii::TrilinosWrappers::SparseMatrix
dRdXv;
360 dealii::TrilinosWrappers::SparseMatrix
d2RdWdW;
364 dealii::TrilinosWrappers::SparseMatrix
d2RdXdX;
368 dealii::TrilinosWrappers::SparseMatrix
d2RdWdX;
409 dealii::LinearAlgebra::distributed::Vector<double>
solution;
442 dealii::LinearAlgebra::distributed::Vector<double>
dual_d2R;
459 dealii::Vector<double> reduced_mesh_weights;
467 template <
typename real2>
470 const dealii::Quadrature<dim> &volume_quadrature,
471 const std::vector< real2 > &soln_coeff_high,
472 const dealii::FiniteElement<dim,dim> &fe_high,
473 const std::vector<real2> &jac_det);
479 dealii::LinearAlgebra::distributed::Vector<real>
dual;
482 void set_dual(
const dealii::LinearAlgebra::distributed::Vector<real> &dual_input);
533 bool update_artificial_diss;
566 void assemble_residual (
const bool compute_dRdW=
false,
const bool compute_dRdX=
false,
const bool compute_d2R=
false,
const double CFL_mass = 0.0);
573 template<
typename DoFCellAccessorType1,
typename DoFCellAccessorType2>
575 const DoFCellAccessorType1 ¤t_cell,
576 const DoFCellAccessorType2 ¤t_metric_cell,
577 const bool compute_dRdW,
const bool compute_dRdX,
const bool compute_d2R,
578 dealii::hp::FEValues<dim,dim> &fe_values_collection_volume,
579 dealii::hp::FEFaceValues<dim,dim> &fe_values_collection_face_int,
580 dealii::hp::FEFaceValues<dim,dim> &fe_values_collection_face_ext,
581 dealii::hp::FESubfaceValues<dim,dim> &fe_values_collection_subface,
582 dealii::hp::FEValues<dim,dim> &fe_values_collection_volume_lagrange,
591 const bool compute_auxiliary_right_hand_side,
592 dealii::LinearAlgebra::distributed::Vector<double> &rhs,
593 std::array<dealii::LinearAlgebra::distributed::Vector<double>,dim> &rhs_aux);
677 typename dealii::DoFHandler<dim>::active_cell_iterator cell,
678 const dealii::types::global_dof_index current_cell_index,
679 const std::vector<dealii::types::global_dof_index> &cell_dofs_indices,
680 const std::vector<dealii::types::global_dof_index> &metric_dof_indices,
681 const unsigned int poly_degree,
682 const unsigned int grid_degree,
690 std::array<std::vector<real>,dim> &mapping_support_points,
691 dealii::hp::FEValues<dim,dim> &fe_values_collection_volume,
692 dealii::hp::FEValues<dim,dim> &fe_values_collection_volume_lagrange,
693 const dealii::FESystem<dim,dim> ¤t_fe_ref,
694 dealii::Vector<real> &local_rhs_int_cell,
695 std::vector<dealii::Tensor<1,dim,real>> &local_auxiliary_RHS,
696 const bool compute_auxiliary_right_hand_side,
697 const bool compute_dRdW,
const bool compute_dRdX,
const bool compute_d2R) = 0;
701 typename dealii::DoFHandler<dim>::active_cell_iterator cell,
702 const dealii::types::global_dof_index current_cell_index,
703 const unsigned int iface,
704 const unsigned int boundary_id,
706 const std::vector<dealii::types::global_dof_index> &cell_dofs_indices,
707 const std::vector<dealii::types::global_dof_index> &metric_dof_indices,
708 const unsigned int poly_degree,
709 const unsigned int grid_degree,
717 std::array<std::vector<real>,dim> &mapping_support_points,
718 dealii::hp::FEFaceValues<dim,dim> &fe_values_collection_face_int,
719 const dealii::FESystem<dim,dim> ¤t_fe_ref,
720 dealii::Vector<real> &local_rhs_int_cell,
721 std::vector<dealii::Tensor<1,dim,real>> &local_auxiliary_RHS,
722 const bool compute_auxiliary_right_hand_side,
723 const bool compute_dRdW,
const bool compute_dRdX,
const bool compute_d2R) = 0;
727 typename dealii::DoFHandler<dim>::active_cell_iterator cell,
728 typename dealii::DoFHandler<dim>::active_cell_iterator neighbor_cell,
729 const dealii::types::global_dof_index current_cell_index,
730 const dealii::types::global_dof_index neighbor_cell_index,
731 const unsigned int iface,
732 const unsigned int neighbor_iface,
734 const std::vector<dealii::types::global_dof_index> ¤t_dofs_indices,
735 const std::vector<dealii::types::global_dof_index> &neighbor_dofs_indices,
736 const std::vector<dealii::types::global_dof_index> ¤t_metric_dofs_indices,
737 const std::vector<dealii::types::global_dof_index> &neighbor_metric_dofs_indices,
738 const unsigned int poly_degree_int,
739 const unsigned int poly_degree_ext,
740 const unsigned int grid_degree_int,
741 const unsigned int grid_degree_ext,
752 std::array<std::vector<real>,dim> &mapping_support_points,
753 dealii::hp::FEFaceValues<dim,dim> &fe_values_collection_face_int,
754 dealii::hp::FEFaceValues<dim,dim> &fe_values_collection_face_ext,
755 dealii::Vector<real> ¤t_cell_rhs,
756 dealii::Vector<real> &neighbor_cell_rhs,
757 std::vector<dealii::Tensor<1,dim,real>> ¤t_cell_rhs_aux,
758 dealii::LinearAlgebra::distributed::Vector<double> &rhs,
759 std::array<dealii::LinearAlgebra::distributed::Vector<double>,dim> &rhs_aux,
760 const bool compute_auxiliary_right_hand_side,
761 const bool compute_dRdW,
const bool compute_dRdX,
const bool compute_d2R) = 0;
765 typename dealii::DoFHandler<dim>::active_cell_iterator cell,
766 typename dealii::DoFHandler<dim>::active_cell_iterator neighbor_cell,
767 const dealii::types::global_dof_index current_cell_index,
768 const dealii::types::global_dof_index neighbor_cell_index,
769 const unsigned int iface,
770 const unsigned int neighbor_iface,
771 const unsigned int neighbor_i_subface,
773 const std::vector<dealii::types::global_dof_index> ¤t_dofs_indices,
774 const std::vector<dealii::types::global_dof_index> &neighbor_dofs_indices,
775 const std::vector<dealii::types::global_dof_index> ¤t_metric_dofs_indices,
776 const std::vector<dealii::types::global_dof_index> &neighbor_metric_dofs_indices,
777 const unsigned int poly_degree_int,
778 const unsigned int poly_degree_ext,
779 const unsigned int grid_degree_int,
780 const unsigned int grid_degree_ext,
791 std::array<std::vector<real>,dim> &mapping_support_points,
792 dealii::hp::FEFaceValues<dim,dim> &fe_values_collection_face_int,
793 dealii::hp::FESubfaceValues<dim,dim> &fe_values_collection_subface,
794 dealii::Vector<real> ¤t_cell_rhs,
795 dealii::Vector<real> &neighbor_cell_rhs,
796 std::vector<dealii::Tensor<1,dim,real>> ¤t_cell_rhs_aux,
797 dealii::LinearAlgebra::distributed::Vector<double> &rhs,
798 std::array<dealii::LinearAlgebra::distributed::Vector<double>,dim> &rhs_aux,
799 const bool compute_auxiliary_right_hand_side,
800 const bool compute_dRdW,
const bool compute_dRdX,
const bool compute_d2R) = 0;
806 typename dealii::DoFHandler<dim>::active_cell_iterator cell,
807 const dealii::types::global_dof_index current_cell_index,
808 const dealii::FEValues<dim,dim> &,
809 const dealii::FESystem<dim,dim> &fe,
810 const dealii::Quadrature<dim> &quadrature,
811 const std::vector<dealii::types::global_dof_index> &metric_dof_indices,
812 const std::vector<dealii::types::global_dof_index> &soln_dof_indices,
813 dealii::Vector<real> &local_rhs_cell,
814 const dealii::FEValues<dim,dim> &,
815 const bool compute_dRdW,
const bool compute_dRdX,
const bool compute_d2R) = 0;
819 typename dealii::DoFHandler<dim>::active_cell_iterator cell,
820 const dealii::types::global_dof_index current_cell_index,
821 const unsigned int face_number,
822 const unsigned int boundary_id,
823 const dealii::FEFaceValuesBase<dim,dim> &fe_values_boundary,
825 const dealii::FESystem<dim,dim> &fe,
826 const dealii::Quadrature<dim-1> &quadrature,
827 const std::vector<dealii::types::global_dof_index> &metric_dof_indices,
828 const std::vector<dealii::types::global_dof_index> &soln_dof_indices,
829 dealii::Vector<real> &local_rhs_cell,
830 const bool compute_dRdW,
const bool compute_dRdX,
const bool compute_d2R) = 0;
836 typename dealii::DoFHandler<dim>::active_cell_iterator cell,
837 const dealii::types::global_dof_index current_cell_index,
838 const dealii::types::global_dof_index neighbor_cell_index,
839 const std::pair<unsigned int, int> face_subface_int,
840 const std::pair<unsigned int, int> face_subface_ext,
841 const typename dealii::QProjector<dim>::DataSetDescriptor face_data_set_int,
842 const typename dealii::QProjector<dim>::DataSetDescriptor face_data_set_ext,
843 const dealii::FEFaceValuesBase<dim,dim> &,
844 const dealii::FEFaceValuesBase<dim,dim> &,
846 const dealii::FESystem<dim,dim> &fe_int,
847 const dealii::FESystem<dim,dim> &fe_ext,
848 const dealii::Quadrature<dim-1> &face_quadrature,
849 const std::vector<dealii::types::global_dof_index> &metric_dof_indices_int,
850 const std::vector<dealii::types::global_dof_index> &metric_dof_indices_ext,
851 const std::vector<dealii::types::global_dof_index> &soln_dof_indices_int,
852 const std::vector<dealii::types::global_dof_index> &soln_dof_indices_ext,
853 dealii::Vector<real> &local_rhs_int_cell,
854 dealii::Vector<real> &local_rhs_ext_cell,
855 const bool compute_dRdW,
const bool compute_dRdX,
const bool compute_d2R) = 0;
859 typename dealii::DoFHandler<dim>::active_cell_iterator cell,
860 const dealii::types::global_dof_index current_cell_index,
861 const dealii::FEValues<dim,dim> &fe_values_volume,
862 const std::vector<dealii::types::global_dof_index> ¤t_dofs_indices,
863 const std::vector<dealii::types::global_dof_index> &metric_dof_indices,
864 const unsigned int poly_degree,
865 const unsigned int grid_degree,
866 dealii::Vector<real> ¤t_cell_rhs,
867 const dealii::FEValues<dim,dim> &fe_values_lagrange) = 0;
870 const dealii::UpdateFlags
volume_update_flags = dealii::update_values | dealii::update_gradients | dealii::update_quadrature_points | dealii::update_JxW_values
871 | dealii::update_inverse_jacobians;
873 const dealii::UpdateFlags
face_update_flags = dealii::update_values | dealii::update_gradients | dealii::update_quadrature_points | dealii::update_JxW_values | dealii::update_normal_vectors
874 | dealii::update_jacobians;
877 const dealii::UpdateFlags
neighbor_face_update_flags = dealii::update_values | dealii::update_gradients | dealii::update_quadrature_points | dealii::update_JxW_values;
902 template<
typename DoFCellAccessorType>
904 const DoFCellAccessorType &cell,
906 const dealii::hp::FECollection<dim> fe_collection)
const;
916 template<
typename DoFCellAccessorType1,
typename DoFCellAccessorType2>
virtual ~DGBase()=default
Destructor.
void output_face_results_vtk(const unsigned int cycle, const double current_time=0.0)
Output Euler face solution.
real2 discontinuity_sensor(const dealii::Quadrature< dim > &volume_quadrature, const std::vector< real2 > &soln_coeff_high, const dealii::FiniteElement< dim, dim > &fe_high, const std::vector< real2 > &jac_det)
dealii::SparsityPattern get_d2RdWdX_sparsity_pattern()
Evaluate SparsityPattern of the residual Hessian dual.d2RdXdW.
virtual void assemble_boundary_term_derivatives(typename dealii::DoFHandler< dim >::active_cell_iterator cell, const dealii::types::global_dof_index current_cell_index, const unsigned int face_number, const unsigned int boundary_id, const dealii::FEFaceValuesBase< dim, dim > &fe_values_boundary, const real penalty, const dealii::FESystem< dim, dim > &fe, const dealii::Quadrature< dim-1 > &quadrature, const std::vector< dealii::types::global_dof_index > &metric_dof_indices, const std::vector< dealii::types::global_dof_index > &soln_dof_indices, dealii::Vector< real > &local_rhs_cell, const bool compute_dRdW, const bool compute_dRdX, const bool compute_d2R)=0
Evaluate the integral over the cell edges that are on domain boundaries and the specified derivatives...
double CFL_mass_dRdW
CFL used to add mass matrix in the optimization FlowConstraints class.
dealii::Vector< double > artificial_dissipation_coeffs
Artificial dissipation in each cell.
virtual void assemble_face_term_derivatives(typename dealii::DoFHandler< dim >::active_cell_iterator cell, const dealii::types::global_dof_index current_cell_index, const dealii::types::global_dof_index neighbor_cell_index, const std::pair< unsigned int, int > face_subface_int, const std::pair< unsigned int, int > face_subface_ext, const typename dealii::QProjector< dim >::DataSetDescriptor face_data_set_int, const typename dealii::QProjector< dim >::DataSetDescriptor face_data_set_ext, const dealii::FEFaceValuesBase< dim, dim > &, const dealii::FEFaceValuesBase< dim, dim > &, const real penalty, const dealii::FESystem< dim, dim > &fe_int, const dealii::FESystem< dim, dim > &fe_ext, const dealii::Quadrature< dim-1 > &face_quadrature, const std::vector< dealii::types::global_dof_index > &metric_dof_indices_int, const std::vector< dealii::types::global_dof_index > &metric_dof_indices_ext, const std::vector< dealii::types::global_dof_index > &soln_dof_indices_int, const std::vector< dealii::types::global_dof_index > &soln_dof_indices_ext, dealii::Vector< real > &local_rhs_int_cell, dealii::Vector< real > &local_rhs_ext_cell, const bool compute_dRdW, const bool compute_dRdX, const bool compute_d2R)=0
Evaluate the integral over the internal cell edges and its specified derivatives. ...
bool use_auxiliary_eq
Flag for using the auxiliary equation.
const dealii::UpdateFlags neighbor_face_update_flags
Update flags needed at neighbor' face points.
void time_scaled_mass_matrices(const real scale)
dealii::LinearAlgebra::distributed::Vector< double > artificial_dissipation_c0
Artificial dissipation coefficients.
virtual void allocate_second_derivatives()
Allocates the second derivatives.
const dealii::hp::FECollection< 1 > oneD_fe_collection
1D Finite Element Collection for p-finite-element to represent the solution
const unsigned int initial_degree
Initial polynomial degree assigned during constructor.
dealii::LinearAlgebra::distributed::Vector< double > solution_d2R
dealii::TrilinosWrappers::SparseMatrix dRdXv
const Parameters::AllParameters *const all_parameters
Pointer to all parameters.
void add_time_scaled_mass_matrices()
Add time scaled mass matrices to the system.
double assemble_residual_time
Computational time for assembling residual.
dealii::TrilinosWrappers::SparseMatrix get_dRdX_finite_differences(dealii::SparsityPattern dRdX_sparsity_pattern)
Evaluate dRdX using finite-differences.
dealii::LinearAlgebra::distributed::Vector< real > dual
Current optimization dual variables corresponding to the residual constraints also known as the adjoi...
dealii::LinearAlgebra::distributed::Vector< double > volume_nodes_dRdX
std::array< dealii::LinearAlgebra::distributed::Vector< double >, dim > auxiliary_right_hand_side
The auxiliary equations' right hand sides.
void add_mass_matrices(const real scale)
Add mass matrices to the system scaled by a factor (likely time-step)
dealii::TrilinosWrappers::SparseMatrix global_mass_matrix_auxiliary
Global auxiliary mass matrix.
std::shared_ptr< Triangulation > triangulation
Mesh.
void output_results_vtk(const unsigned int cycle, const double current_time=0.0)
Output solution.
dealii::QGauss< 0 > oneD_face_quadrature
1D surface quadrature is always one single point for all poly degrees.
void update_artificial_dissipation_discontinuity_sensor()
Update discontinuity sensor.
dealii::Point< dim > coordinates_of_highest_refined_cell(bool check_for_p_refined_cell=false)
Returns the coordinates of the most refined cell.
dealii::IndexSet locally_owned_dofs_grid
Locally own degrees of freedom for the grid.
Files for the baseline physics.
void allocate_auxiliary_equation()
Allocates the auxiliary equations' variables and right hand side (primarily for Strong form diffusive...
const dealii::hp::FECollection< 1 > oneD_fe_collection_flux
1D collocated flux basis used in strong form
dealii::SparsityPattern get_d2RdXdX_sparsity_pattern()
Evaluate SparsityPattern of the residual Hessian dual.d2RdXdX.
double get_residual_linfnorm() const
Returns the Linf-norm of the right_hand_side vector.
dealii::TrilinosWrappers::SparseMatrix system_matrix_transpose
DGBase(const int nstate_input, 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)
Principal constructor that will call delegated constructor.
virtual void allocate_model_variables()=0
Allocate the necessary variables declared in src/physics/model.h.
std::unique_ptr< Epetra_RowMatrixTransposer > epetra_rowmatrixtransposer_dRdW
Epetra_RowMatrixTransposer used to transpose the system_matrix.
dealii::TrilinosWrappers::SparseMatrix d2RdWdW
double get_residual_l2norm() const
Returns the L2-norm of the right_hand_side vector.
-th order modal derivative of basis fuctions, ie/
virtual void assemble_boundary_term_and_build_operators(typename dealii::DoFHandler< dim >::active_cell_iterator cell, const dealii::types::global_dof_index current_cell_index, const unsigned int iface, const unsigned int boundary_id, const real penalty, const std::vector< dealii::types::global_dof_index > &cell_dofs_indices, const std::vector< dealii::types::global_dof_index > &metric_dof_indices, const unsigned int poly_degree, const unsigned int grid_degree, OPERATOR::basis_functions< dim, 2 *dim, real > &soln_basis, OPERATOR::basis_functions< dim, 2 *dim, real > &flux_basis, OPERATOR::local_basis_stiffness< dim, 2 *dim, real > &flux_basis_stiffness, OPERATOR::vol_projection_operator< dim, 2 *dim, real > &soln_basis_projection_oper_int, OPERATOR::vol_projection_operator< dim, 2 *dim, real > &soln_basis_projection_oper_ext, OPERATOR::metric_operators< real, dim, 2 *dim > &metric_oper, OPERATOR::mapping_shape_functions< dim, 2 *dim, real > &mapping_basis, std::array< std::vector< real >, dim > &mapping_support_points, dealii::hp::FEFaceValues< dim, dim > &fe_values_collection_face_int, const dealii::FESystem< dim, dim > ¤t_fe_ref, dealii::Vector< real > &local_rhs_int_cell, std::vector< dealii::Tensor< 1, dim, real >> &local_auxiliary_RHS, const bool compute_auxiliary_right_hand_side, const bool compute_dRdW, const bool compute_dRdX, const bool compute_d2R)=0
Builds the necessary operators/fe values and assembles boundary residual.
dealii::TrilinosWrappers::SparseMatrix global_mass_matrix
Global mass matrix.
void reinit_operators_for_cell_residual_loop(const unsigned int poly_degree_int, const unsigned int poly_degree_ext, const unsigned int grid_degree, OPERATOR::basis_functions< dim, 2 *dim, real > &soln_basis_int, OPERATOR::basis_functions< dim, 2 *dim, real > &soln_basis_ext, OPERATOR::basis_functions< dim, 2 *dim, real > &flux_basis_int, OPERATOR::basis_functions< dim, 2 *dim, real > &flux_basis_ext, OPERATOR::local_basis_stiffness< dim, 2 *dim, real > &flux_basis_stiffness, OPERATOR::vol_projection_operator< dim, 2 *dim, real > &soln_basis_projection_oper_int, OPERATOR::vol_projection_operator< dim, 2 *dim, real > &soln_basis_projection_oper_ext, OPERATOR::mapping_shape_functions< dim, 2 *dim, real > &mapping_basis)
Builds needed operators for cell residual loop.
MPI_Comm mpi_communicator
MPI communicator.
dealii::Vector< double > max_dt_cell
Time it takes for the maximum wavespeed to cross the cell domain.
Main parameter class that contains the various other sub-parameter classes.
const dealii::hp::FECollection< 1 > oneD_fe_collection_1state
1D Finite Element Collection for p-finite-element to represent the solution for a single state...
virtual void assemble_volume_term_explicit(typename dealii::DoFHandler< dim >::active_cell_iterator cell, const dealii::types::global_dof_index current_cell_index, const dealii::FEValues< dim, dim > &fe_values_volume, const std::vector< dealii::types::global_dof_index > ¤t_dofs_indices, const std::vector< dealii::types::global_dof_index > &metric_dof_indices, const unsigned int poly_degree, const unsigned int grid_degree, dealii::Vector< real > ¤t_cell_rhs, const dealii::FEValues< dim, dim > &fe_values_lagrange)=0
Evaluate the integral over the cell volume.
void reinit_operators_for_mass_matrix(const bool Cartesian_element, const unsigned int poly_degree, const unsigned int grid_degree, OPERATOR::mapping_shape_functions< dim, 2 *dim, real > &mapping_basis, OPERATOR::basis_functions< dim, 2 *dim, real > &basis, OPERATOR::local_mass< dim, 2 *dim, real > &reference_mass_matrix, OPERATOR::local_Flux_Reconstruction_operator< dim, 2 *dim, real > &reference_FR, OPERATOR::local_Flux_Reconstruction_operator_aux< dim, 2 *dim, real > &reference_FR_aux, OPERATOR::derivative_p< dim, 2 *dim, real > &deriv_p)
Builds needed operators to compute mass matrices/inverses efficiently.
dealii::LinearAlgebra::distributed::Vector< double > solution
Current modal coefficients of the solution.
ESFR correction matrix without jac dependence.
Local mass matrix without jacobian dependence.
virtual void assemble_volume_term_derivatives(typename dealii::DoFHandler< dim >::active_cell_iterator cell, const dealii::types::global_dof_index current_cell_index, const dealii::FEValues< dim, dim > &, const dealii::FESystem< dim, dim > &fe, const dealii::Quadrature< dim > &quadrature, const std::vector< dealii::types::global_dof_index > &metric_dof_indices, const std::vector< dealii::types::global_dof_index > &soln_dof_indices, dealii::Vector< real > &local_rhs_cell, const dealii::FEValues< dim, dim > &, const bool compute_dRdW, const bool compute_dRdX, const bool compute_d2R)=0
Evaluate the integral over the cell volume and the specified derivatives.
virtual void update_model_variables()=0
Update the necessary variables declared in src/physics/model.h.
const int nstate
Number of state variables.
dealii::DoFHandler< dim > dof_handler_artificial_dissipation
Degrees of freedom handler for C0 artificial dissipation.
dealii::IndexSet locally_owned_dofs
Locally own degrees of freedom.
dealii::LinearAlgebra::distributed::Vector< double > solution_dRdW
dealii::LinearAlgebra::distributed::Vector< double > volume_nodes_dRdW
dealii::SparsityPattern mass_sparsity_pattern
Sparsity pattern used on the system_matrix.
dealii::TrilinosWrappers::SparseMatrix global_inverse_mass_matrix_auxiliary
Global inverse of the auxiliary mass matrix.
void reinit()
Reinitializes the DG object after a change of triangulation.
dealii::IndexSet locally_relevant_dofs_grid
dealii::TrilinosWrappers::SparseMatrix time_scaled_global_mass_matrix
Global mass matrix divided by the time scales.
dealii::hp::QCollection< dim-1 > face_quadrature_collection
Quadrature used to evaluate face integrals.
real evaluate_penalty_scaling(const DoFCellAccessorType &cell, const int iface, const dealii::hp::FECollection< dim > fe_collection) const
const unsigned int max_degree
Maximum degree used for p-refi1nement.
Base metric operators class that stores functions used in both the volume and on surface.
void set_anisotropic_flags()
Set anisotropic flags based on jump indicator.
real current_time
The current time set in set_current_time()
ESFR correction matrix for AUX EQUATION without jac dependence.
dealii::SparsityPattern get_d2RdWdXs_sparsity_pattern()
Evaluate SparsityPattern of the residual Hessian dual.d2RdXsdW.
dealii::ConditionalOStream pcout
Parallel std::cout that only outputs on mpi_rank==0.
unsigned int get_max_fe_degree()
Gets the maximum value of currently active FE degree.
dealii::IndexSet ghost_dofs
Locally relevant ghost degrees of freedom.
The mapping shape functions evaluated at the desired nodes (facet set included in volume grid nodes f...
virtual void allocate_system(const bool compute_dRdW=true, const bool compute_dRdX=true, const bool compute_d2R=true)
Allocates the system.
virtual void allocate_dRdX()
Allocates the residual derivatives w.r.t the volume nodes.
const dealii::UpdateFlags face_update_flags
Update flags needed at face points.
std::shared_ptr< HighOrderGrid< dim, real, MeshType > > high_order_grid
High order grid that will provide the MappingFEField.
std::vector< real > project_function(const std::vector< real > &function_coeff, const dealii::FESystem< dim, dim > &fe_input, const dealii::FESystem< dim, dim > &fe_output, const dealii::QGauss< dim > &projection_quadrature)
Get the coefficients of a function projected onto a set of basis (to be replaced with operators->proj...
dealii::LinearAlgebra::distributed::Vector< double > solution_dRdX
dealii::TrilinosWrappers::SparseMatrix d2RdWdX
const unsigned int max_grid_degree
Maximum grid degree used for hp-refi1nement.
virtual void assemble_face_term_and_build_operators(typename dealii::DoFHandler< dim >::active_cell_iterator cell, typename dealii::DoFHandler< dim >::active_cell_iterator neighbor_cell, const dealii::types::global_dof_index current_cell_index, const dealii::types::global_dof_index neighbor_cell_index, const unsigned int iface, const unsigned int neighbor_iface, const real penalty, const std::vector< dealii::types::global_dof_index > ¤t_dofs_indices, const std::vector< dealii::types::global_dof_index > &neighbor_dofs_indices, const std::vector< dealii::types::global_dof_index > ¤t_metric_dofs_indices, const std::vector< dealii::types::global_dof_index > &neighbor_metric_dofs_indices, const unsigned int poly_degree_int, const unsigned int poly_degree_ext, const unsigned int grid_degree_int, const unsigned int grid_degree_ext, OPERATOR::basis_functions< dim, 2 *dim, real > &soln_basis_int, OPERATOR::basis_functions< dim, 2 *dim, real > &soln_basis_ext, OPERATOR::basis_functions< dim, 2 *dim, real > &flux_basis_int, OPERATOR::basis_functions< dim, 2 *dim, real > &flux_basis_ext, OPERATOR::local_basis_stiffness< dim, 2 *dim, real > &flux_basis_stiffness, OPERATOR::vol_projection_operator< dim, 2 *dim, real > &soln_basis_projection_oper_int, OPERATOR::vol_projection_operator< dim, 2 *dim, real > &soln_basis_projection_oper_ext, OPERATOR::metric_operators< real, dim, 2 *dim > &metric_oper_int, OPERATOR::metric_operators< real, dim, 2 *dim > &metric_oper_ext, OPERATOR::mapping_shape_functions< dim, 2 *dim, real > &mapping_basis, std::array< std::vector< real >, dim > &mapping_support_points, dealii::hp::FEFaceValues< dim, dim > &fe_values_collection_face_int, dealii::hp::FEFaceValues< dim, dim > &fe_values_collection_face_ext, dealii::Vector< real > ¤t_cell_rhs, dealii::Vector< real > &neighbor_cell_rhs, std::vector< dealii::Tensor< 1, dim, real >> ¤t_cell_rhs_aux, dealii::LinearAlgebra::distributed::Vector< double > &rhs, std::array< dealii::LinearAlgebra::distributed::Vector< double >, dim > &rhs_aux, const bool compute_auxiliary_right_hand_side, const bool compute_dRdW, const bool compute_dRdX, const bool compute_d2R)=0
Builds the necessary operators/fe values and assembles face residual.
dealii::LinearAlgebra::distributed::Vector< double > dual_d2R
const dealii::UpdateFlags volume_update_flags
Update flags needed at volume points.
dealii::IndexSet locally_relevant_dofs
Union of locally owned degrees of freedom and relevant ghost degrees of freedom.
virtual void assemble_subface_term_and_build_operators(typename dealii::DoFHandler< dim >::active_cell_iterator cell, typename dealii::DoFHandler< dim >::active_cell_iterator neighbor_cell, const dealii::types::global_dof_index current_cell_index, const dealii::types::global_dof_index neighbor_cell_index, const unsigned int iface, const unsigned int neighbor_iface, const unsigned int neighbor_i_subface, const real penalty, const std::vector< dealii::types::global_dof_index > ¤t_dofs_indices, const std::vector< dealii::types::global_dof_index > &neighbor_dofs_indices, const std::vector< dealii::types::global_dof_index > ¤t_metric_dofs_indices, const std::vector< dealii::types::global_dof_index > &neighbor_metric_dofs_indices, const unsigned int poly_degree_int, const unsigned int poly_degree_ext, const unsigned int grid_degree_int, const unsigned int grid_degree_ext, OPERATOR::basis_functions< dim, 2 *dim, real > &soln_basis_int, OPERATOR::basis_functions< dim, 2 *dim, real > &soln_basis_ext, OPERATOR::basis_functions< dim, 2 *dim, real > &flux_basis_int, OPERATOR::basis_functions< dim, 2 *dim, real > &flux_basis_ext, OPERATOR::local_basis_stiffness< dim, 2 *dim, real > &flux_basis_stiffness, OPERATOR::vol_projection_operator< dim, 2 *dim, real > &soln_basis_projection_oper_int, OPERATOR::vol_projection_operator< dim, 2 *dim, real > &soln_basis_projection_oper_ext, OPERATOR::metric_operators< real, dim, 2 *dim > &metric_oper_int, OPERATOR::metric_operators< real, dim, 2 *dim > &metric_oper_ext, OPERATOR::mapping_shape_functions< dim, 2 *dim, real > &mapping_basis, std::array< std::vector< real >, dim > &mapping_support_points, dealii::hp::FEFaceValues< dim, dim > &fe_values_collection_face_int, dealii::hp::FESubfaceValues< dim, dim > &fe_values_collection_subface, dealii::Vector< real > ¤t_cell_rhs, dealii::Vector< real > &neighbor_cell_rhs, std::vector< dealii::Tensor< 1, dim, real >> ¤t_cell_rhs_aux, dealii::LinearAlgebra::distributed::Vector< double > &rhs, std::array< dealii::LinearAlgebra::distributed::Vector< double >, dim > &rhs_aux, const bool compute_auxiliary_right_hand_side, const bool compute_dRdW, const bool compute_dRdX, const bool compute_d2R)=0
Builds the necessary operators/fe values and assembles subface residual.
dealii::SparsityPattern get_dRdX_sparsity_pattern()
Evaluate SparsityPattern of dRdX.
void evaluate_local_metric_dependent_mass_matrix_and_set_in_global_mass_matrix(const bool Cartesian_element, const bool do_inverse_mass_matrix, const unsigned int poly_degree, const unsigned int curr_grid_degree, const unsigned int n_quad_pts, const unsigned int n_dofs_cell, const std::vector< dealii::types::global_dof_index > dofs_indices, OPERATOR::metric_operators< real, dim, 2 *dim > &metric_oper, OPERATOR::basis_functions< dim, 2 *dim, real > &basis, OPERATOR::local_mass< dim, 2 *dim, real > &reference_mass_matrix, OPERATOR::local_Flux_Reconstruction_operator< dim, 2 *dim, real > &reference_FR, OPERATOR::local_Flux_Reconstruction_operator_aux< dim, 2 *dim, real > &reference_FR_aux, OPERATOR::derivative_p< dim, 2 *dim, real > &deriv_p)
Evaluates the metric dependent local mass matrices and inverses, then sets them in the global matrice...
dealii::LinearAlgebra::distributed::Vector< double > volume_nodes_d2R
virtual void allocate_dual_vector()=0
Allocate the dual vector for optimization.
dealii::Vector< double > artificial_dissipation_se
Artificial dissipation error ratio sensor in each cell.
unsigned int get_min_fe_degree()
Gets the minimum value of currently active FE degree.
void set_high_order_grid(std::shared_ptr< HighOrderGrid< dim, real, MeshType >> new_high_order_grid)
Sets the associated high order grid with the provided one.
MassiveCollectionTuple create_collection_tuple(const unsigned int max_degree, const int nstate, const Parameters::AllParameters *const parameters_input) const
Used in the delegated constructor.
virtual void assemble_volume_term_and_build_operators(typename dealii::DoFHandler< dim >::active_cell_iterator cell, const dealii::types::global_dof_index current_cell_index, const std::vector< dealii::types::global_dof_index > &cell_dofs_indices, const std::vector< dealii::types::global_dof_index > &metric_dof_indices, const unsigned int poly_degree, const unsigned int grid_degree, OPERATOR::basis_functions< dim, 2 *dim, real > &soln_basis, OPERATOR::basis_functions< dim, 2 *dim, real > &flux_basis, OPERATOR::local_basis_stiffness< dim, 2 *dim, real > &flux_basis_stiffness, OPERATOR::vol_projection_operator< dim, 2 *dim, real > &soln_basis_projection_oper_int, OPERATOR::vol_projection_operator< dim, 2 *dim, real > &soln_basis_projection_oper_ext, OPERATOR::metric_operators< real, dim, 2 *dim > &metric_oper, OPERATOR::mapping_shape_functions< dim, 2 *dim, real > &mapping_basis, std::array< std::vector< real >, dim > &mapping_support_points, dealii::hp::FEValues< dim, dim > &fe_values_collection_volume, dealii::hp::FEValues< dim, dim > &fe_values_collection_volume_lagrange, const dealii::FESystem< dim, dim > ¤t_fe_ref, dealii::Vector< real > &local_rhs_int_cell, std::vector< dealii::Tensor< 1, dim, real >> &local_auxiliary_RHS, const bool compute_auxiliary_right_hand_side, const bool compute_dRdW, const bool compute_dRdX, const bool compute_d2R)=0
Builds the necessary operators/fe values and assembles volume residual.
virtual void set_use_auxiliary_eq()=0
Set use_auxiliary_eq flag.
std::vector< real > evaluate_time_steps(const bool exact_time_stepping)
Evaluates the maximum stable time step.
dealii::DoFHandler< dim > dof_handler
Finite Element Collection to represent the high-order grid.
dealii::SparsityPattern sparsity_pattern
Sparsity pattern used on the system_matrix.
void apply_global_mass_matrix(const dealii::LinearAlgebra::distributed::Vector< double > &input_vector, dealii::LinearAlgebra::distributed::Vector< double > &output_vector, const bool use_auxiliary_eq=false, const bool use_unmodified_mass_matrix=false)
Applies the local metric dependent mass matrices when the global is not stored.
dealii::SparsityPattern get_d2RdWdW_sparsity_pattern()
Evaluate SparsityPattern of the residual Hessian dual.d2RdWdW.
void time_scale_solution_update(dealii::LinearAlgebra::distributed::Vector< double > &solution_update, const real CFL) const
Scales a solution update with the appropriate maximum time step.
dealii::SparsityPattern get_dRdXs_sparsity_pattern()
Evaluate SparsityPattern of dRdXs.
dealii::TrilinosWrappers::SparseMatrix system_matrix
void evaluate_mass_matrices(bool do_inverse_mass_matrix=false)
Allocates and evaluates the mass matrices for the entire grid.
const dealii::hp::FECollection< dim > fe_collection_lagrange
Lagrange basis used in strong form.
dealii::Vector< double > cell_volume
Time it takes for the maximum wavespeed to cross the cell domain.
bool current_cell_should_do_the_work(const DoFCellAccessorType1 ¤t_cell, const DoFCellAccessorType2 &neighbor_cell) const
In the case that two cells have the same coarseness, this function decides if the current cell should...
virtual void assemble_auxiliary_residual()=0
Asembles the auxiliary equations' residuals and solves.
dealii::IndexSet ghost_dofs_grid
Locally relevant ghost degrees of freedom for the grid.
void set_current_time(const real current_time_input)
Sets the current time within DG to be used for unsteady source terms.
dealii::hp::QCollection< 1 > oneD_quadrature_collection
1D quadrature to generate Lagrange polynomials for the sake of flux interpolation.
std::array< dealii::LinearAlgebra::distributed::Vector< double >, dim > auxiliary_solution
The auxiliary equations' solution.
bool freeze_artificial_dissipation
Flag to freeze artificial dissipation.
dealii::TrilinosWrappers::SparseMatrix d2RdXdX
DGBase is independent of the number of state variables.
void allocate_artificial_dissipation()
Allocates variables of artificial dissipation.
void assemble_cell_residual(const DoFCellAccessorType1 ¤t_cell, const DoFCellAccessorType2 ¤t_metric_cell, const bool compute_dRdW, const bool compute_dRdX, const bool compute_d2R, dealii::hp::FEValues< dim, dim > &fe_values_collection_volume, dealii::hp::FEFaceValues< dim, dim > &fe_values_collection_face_int, dealii::hp::FEFaceValues< dim, dim > &fe_values_collection_face_ext, dealii::hp::FESubfaceValues< dim, dim > &fe_values_collection_subface, dealii::hp::FEValues< dim, dim > &fe_values_collection_volume_lagrange, OPERATOR::basis_functions< dim, 2 *dim, real > &soln_basis_int, OPERATOR::basis_functions< dim, 2 *dim, real > &soln_basis_ext, OPERATOR::basis_functions< dim, 2 *dim, real > &flux_basis_int, OPERATOR::basis_functions< dim, 2 *dim, real > &flux_basis_ext, OPERATOR::local_basis_stiffness< dim, 2 *dim, real > &flux_basis_stiffness, OPERATOR::vol_projection_operator< dim, 2 *dim, real > &soln_basis_projection_oper_int, OPERATOR::vol_projection_operator< dim, 2 *dim, real > &soln_basis_projection_oper_ext, OPERATOR::mapping_shape_functions< dim, 2 *dim, real > &mapping_basis, const bool compute_auxiliary_right_hand_side, dealii::LinearAlgebra::distributed::Vector< double > &rhs, std::array< dealii::LinearAlgebra::distributed::Vector< double >, dim > &rhs_aux)
Used in assemble_residual().
dealii::hp::QCollection< dim > volume_quadrature_collection
Finite Element Collection to represent the high-order grid.
void set_all_cells_fe_degree(const unsigned int degree)
Refers to a collection Mappings, which represents the high-order grid.
unsigned int n_dofs() const
Number of degrees of freedom.
dealii::SparsityPattern get_d2RdXsdXs_sparsity_pattern()
Evaluate SparsityPattern of the residual Hessian dual.d2RdXsdXs.
const dealii::hp::FECollection< dim > fe_collection
Finite Element Collection for p-finite-element to represent the solution.
std::tuple< dealii::hp::FECollection< dim >, dealii::hp::QCollection< dim >, dealii::hp::QCollection< dim-1 >, dealii::hp::FECollection< dim >, dealii::hp::FECollection< 1 >, dealii::hp::FECollection< 1 >, dealii::hp::FECollection< 1 >, dealii::hp::QCollection< 1 > > MassiveCollectionTuple
Makes for cleaner doxygen documentation.
double max_artificial_dissipation_coeff
Stores maximum artificial dissipation while assembling the residual.
Projection operator corresponding to basis functions onto M-norm (L2).
dealii::LinearAlgebra::distributed::Vector< double > right_hand_side
Residual of the current solution.
void assemble_residual(const bool compute_dRdW=false, const bool compute_dRdX=false, const bool compute_d2R=false, const double CFL_mass=0.0)
Main loop of the DG class.
Local stiffness matrix without jacobian dependence.
dealii::TrilinosWrappers::SparseMatrix global_inverse_mass_matrix
Global inverser mass matrix.
void initialize_manufactured_solution()
Virtual function defined in DG.
void set_dual(const dealii::LinearAlgebra::distributed::Vector< real > &dual_input)
Sets the stored dual variables used to compute the dual dotted with the residual Hessians.
dealii::SparsityPattern get_dRdW_sparsity_pattern()
Evaluate SparsityPattern of dRdW.
const dealii::FE_Q< dim > fe_q_artificial_dissipation
Continuous distribution of artificial dissipation.
void apply_inverse_global_mass_matrix(const dealii::LinearAlgebra::distributed::Vector< double > &input_vector, dealii::LinearAlgebra::distributed::Vector< double > &output_vector, const bool use_auxiliary_eq=false)
Applies the inverse of the local metric dependent mass matrices when the global is not stored...