[P]arallel [Hi]gh-order [Li]brary for [P]DEs  Latest
Parallel High-Order Library for PDEs through hp-adaptive Discontinuous Galerkin methods
dg_base.hpp
1 #ifndef PHILIP_DG_BASE_HPP
2 #define PHILIP_DG_BASE_HPP
3 
4 #include <deal.II/base/conditional_ostream.h>
5 #include <deal.II/base/parameter_handler.h>
6 
7 #include <deal.II/base/qprojector.h>
8 
9 #include <deal.II/grid/tria.h>
10 
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>
15 
16 
17 #include <deal.II/dofs/dof_handler.h>
18 
19 #include <deal.II/hp/q_collection.h>
20 #include <deal.II/hp/mapping_collection.h>
21 #include <deal.II/hp/fe_values.h>
22 
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>
27 
28 #include <Epetra_RowMatrixTransposer.h>
29 #include <AztecOO.h>
30 
31 #include "ADTypes.hpp"
32 #include <Sacado.hpp>
33 #include <CoDiPack/include/codi.hpp>
34 
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"
44 
45 #include <time.h>
46 #include <deal.II/base/timer.h>
47 
48 // Template specialization of MappingFEField
49 //extern template class dealii::MappingFEField<PHILIP_DIM,PHILIP_DIM,dealii::LinearAlgebra::distributed::Vector<double>, dealii::DoFHandler<PHILIP_DIM> >;
50 namespace PHiLiP {
51 
53 template<int dim, typename real>
54 std::vector< real > project_function(
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);
59 
60 
62 
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>>
79 #else
80 template <int dim, typename real, typename MeshType = dealii::parallel::distributed::Triangulation<dim>>
81 #endif
82 class DGBase
83 {
84 public:
89  using Triangulation = MeshType;
90 
92 
94 
96  const int nstate;
97 
99  const unsigned int initial_degree;
100 
102 
104  const unsigned int max_degree;
105 
107 
109  const unsigned int max_grid_degree;
110 
112  virtual ~DGBase() = default;
113 
115 
121  DGBase(const int nstate_input,
122  const Parameters::AllParameters *const parameters_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);
127 
128 
130 
133  void reinit();
134 
136  using MassiveCollectionTuple = std::tuple<
137  //dealii::hp::MappingCollection<dim>, // Mapping
138  dealii::hp::FECollection<dim>, // Solution FE
139  dealii::hp::QCollection<dim>, // Volume quadrature
140  dealii::hp::QCollection<dim-1>, // Face quadrature
141  dealii::hp::FECollection<dim>, // Lagrange polynomials for strong form
142  dealii::hp::FECollection<1>, // Solution FE 1D
143  dealii::hp::FECollection<1>, // Solution FE 1D for a single state
144  dealii::hp::FECollection<1>, // Collocated flux basis 1D for strong form
145  dealii::hp::QCollection<1> >; // 1D quadrature for strong form
146 
148 
152  DGBase( const int nstate_input,
153  const Parameters::AllParameters *const parameters_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,
158  const MassiveCollectionTuple collection_tuple);
159 
160  std::shared_ptr<Triangulation> triangulation;
161 
162 
164  void set_high_order_grid(std::shared_ptr<HighOrderGrid<dim,real,MeshType>> new_high_order_grid);
165 
167 
170  //dealii::hp::MappingCollection<dim> mapping_collection;
171  void set_all_cells_fe_degree ( const unsigned int degree );
172 
174  unsigned int get_max_fe_degree();
175 
177  unsigned int get_min_fe_degree();
178 
180  dealii::Point<dim> coordinates_of_highest_refined_cell(bool check_for_p_refined_cell = false);
181 
183 
184  virtual void allocate_system (const bool compute_dRdW = true,
185  const bool compute_dRdX = true,
186  const bool compute_d2R = true);
187 
188 private:
190 
193  virtual void allocate_second_derivatives ();
194 
196 
199  virtual void allocate_dRdX ();
200 
202 
206 
207 public:
208 
210 
212  void time_scale_solution_update ( dealii::LinearAlgebra::distributed::Vector<double> &solution_update, const real CFL ) const;
213 
216  void time_scaled_mass_matrices(const real scale);
217 
220  const unsigned int poly_degree_int,
221  const unsigned int poly_degree_ext,
222  const unsigned int grid_degree,
228  OPERATOR::vol_projection_operator<dim,2*dim,real> &soln_basis_projection_oper_int,
229  OPERATOR::vol_projection_operator<dim,2*dim,real> &soln_basis_projection_oper_ext,
231 
234  const bool Cartesian_element,
235  const unsigned int poly_degree,
236  const unsigned int grid_degree,
239  OPERATOR::local_mass<dim,2*dim,real> &reference_mass_matrix,
243 
245  void evaluate_mass_matrices (bool do_inverse_mass_matrix = false);
246 
249  const bool Cartesian_element,//Flag if cell is Cartesian
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,
258  OPERATOR::local_mass<dim,2*dim,real> &reference_mass_matrix,
262 
264 
268  const dealii::LinearAlgebra::distributed::Vector<double> &input_vector,
269  dealii::LinearAlgebra::distributed::Vector<double> &output_vector,
270  const bool use_auxiliary_eq = false);
271 
273 
282  const dealii::LinearAlgebra::distributed::Vector<double> &input_vector,
283  dealii::LinearAlgebra::distributed::Vector<double> &output_vector,
284  const bool use_auxiliary_eq = false,
285  const bool use_unmodified_mass_matrix = false);
286 
288 
291  std::vector<real> evaluate_time_steps (const bool exact_time_stepping);
292 
294 
297  void add_mass_matrices (const real scale);
298 
300 
303 
304  double get_residual_l2norm () const;
305 
306  double get_residual_linfnorm () const;
307 
308  unsigned int n_dofs() const;
309 
311 
313  void set_anisotropic_flags();
314 
316 
317  dealii::SparsityPattern sparsity_pattern;
318 
320 
321  dealii::SparsityPattern mass_sparsity_pattern;
322 
324 
325  dealii::TrilinosWrappers::SparseMatrix time_scaled_global_mass_matrix;
326 
328 
329  dealii::TrilinosWrappers::SparseMatrix global_mass_matrix;
331 
332  dealii::TrilinosWrappers::SparseMatrix global_inverse_mass_matrix;
333 
335 
336  dealii::TrilinosWrappers::SparseMatrix global_mass_matrix_auxiliary;
337 
339  dealii::TrilinosWrappers::SparseMatrix global_inverse_mass_matrix_auxiliary;
340 
343  dealii::TrilinosWrappers::SparseMatrix system_matrix;
344 
347  dealii::TrilinosWrappers::SparseMatrix system_matrix_transpose;
348 
350  std::unique_ptr<Epetra_RowMatrixTransposer> epetra_rowmatrixtransposer_dRdW;
351 
352  //AztecOO dRdW_preconditioner_builder;
353 
356  dealii::TrilinosWrappers::SparseMatrix dRdXv;
357 
360  dealii::TrilinosWrappers::SparseMatrix d2RdWdW;
361 
364  dealii::TrilinosWrappers::SparseMatrix d2RdXdX;
365  //
368  dealii::TrilinosWrappers::SparseMatrix d2RdWdX;
369 
371 
396  dealii::LinearAlgebra::distributed::Vector<double> right_hand_side;
397 
398  dealii::IndexSet locally_owned_dofs;
399  dealii::IndexSet ghost_dofs;
400  dealii::IndexSet locally_relevant_dofs;
401 
402  dealii::IndexSet locally_owned_dofs_grid;
403  dealii::IndexSet ghost_dofs_grid;
404  dealii::IndexSet locally_relevant_dofs_grid;
405 
409  dealii::LinearAlgebra::distributed::Vector<double> solution;
410 
412  std::array<dealii::LinearAlgebra::distributed::Vector<double>,dim> auxiliary_right_hand_side;
413 
415  std::array<dealii::LinearAlgebra::distributed::Vector<double>,dim> auxiliary_solution;
416 private:
419  dealii::LinearAlgebra::distributed::Vector<double> solution_dRdW;
422  dealii::LinearAlgebra::distributed::Vector<double> volume_nodes_dRdW;
423 
426 
429  dealii::LinearAlgebra::distributed::Vector<double> solution_dRdX;
432  dealii::LinearAlgebra::distributed::Vector<double> volume_nodes_dRdX;
433 
436  dealii::LinearAlgebra::distributed::Vector<double> solution_d2R;
439  dealii::LinearAlgebra::distributed::Vector<double> volume_nodes_d2R;
442  dealii::LinearAlgebra::distributed::Vector<double> dual_d2R;
443 public:
444 
446 
450  dealii::Vector<double> cell_volume;
451 
453 
457  dealii::Vector<double> max_dt_cell;
458 
459  dealii::Vector<double> reduced_mesh_weights;
460 
462  dealii::Vector<double> artificial_dissipation_coeffs;
463 
465  dealii::Vector<double> artificial_dissipation_se;
466 
467  template <typename real2>
469  real2 discontinuity_sensor(
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);
474 
476 
479  dealii::LinearAlgebra::distributed::Vector<real> dual;
480 
482  void set_dual(const dealii::LinearAlgebra::distributed::Vector<real> &dual_input);
483 
485  /* Where R represents the residual and X represents the grid degrees of freedom stored as high_order_grid.volume_nodes.
486  */
487  dealii::SparsityPattern get_dRdX_sparsity_pattern ();
488 
490  /* Where R represents the residual and W represents the solution degrees of freedom.
491  */
492  dealii::SparsityPattern get_dRdW_sparsity_pattern ();
493 
495  /* Where R represents the residual and W represents the solution degrees of freedom.
496  */
497  dealii::SparsityPattern get_d2RdWdW_sparsity_pattern ();
498 
500  /* Where R represents the residual and X represents the grid degrees of freedom stored as high_order_grid.volume_nodes.
501  */
502  dealii::SparsityPattern get_d2RdXdX_sparsity_pattern ();
503 
505  /* Where R represents the residual, W the solution DoF, and X represents the grid degrees of freedom stored as high_order_grid.volume_nodes.
506  */
507  dealii::SparsityPattern get_d2RdWdX_sparsity_pattern ();
508 
510  /* Where R represents the residual and Xs represents the grid surface degrees of freedom stored as high_order_grid.volume_nodes.
511  */
512  dealii::SparsityPattern get_dRdXs_sparsity_pattern ();
514  /* Where R represents the residual and Xs represents the grid surface degrees of freedom stored as high_order_grid.volume_nodes.
515  */
516  dealii::SparsityPattern get_d2RdXsdXs_sparsity_pattern ();
517 
519  /* Where R represents the residual, W the solution DoF, and Xs represents the grid surface degrees of freedom stored as high_order_grid.volume_nodes.
520  */
521  dealii::SparsityPattern get_d2RdWdXs_sparsity_pattern ();
522 
524  /* Where R represents the residual and X represents the grid degrees of freedom stored as high_order_grid.volume_nodes.
525  */
526  dealii::TrilinosWrappers::SparseMatrix get_dRdX_finite_differences (dealii::SparsityPattern dRdX_sparsity_pattern);
527 
529 
530  void output_results_vtk (const unsigned int cycle, const double current_time=0.0);
531  void output_face_results_vtk (const unsigned int cycle, const double current_time=0.0);
532 
533  bool update_artificial_diss;
535 
565  //void assemble_residual_dRdW ();
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);
567 
569 
573  template<typename DoFCellAccessorType1, typename DoFCellAccessorType2>
575  const DoFCellAccessorType1 &current_cell,
576  const DoFCellAccessorType2 &current_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,
588  OPERATOR::vol_projection_operator<dim,2*dim,real> &soln_basis_projection_oper_int,
589  OPERATOR::vol_projection_operator<dim,2*dim,real> &soln_basis_projection_oper_ext,
591  const bool compute_auxiliary_right_hand_side,//flag on whether computing the Auxiliary variable's equations' residuals
592  dealii::LinearAlgebra::distributed::Vector<double> &rhs,
593  std::array<dealii::LinearAlgebra::distributed::Vector<double>,dim> &rhs_aux);
594 
596 
597  const dealii::hp::FECollection<dim> fe_collection;
598 
600 
604  //const dealii::hp::FECollection<dim> fe_collection_grid;
605  //const dealii::FESystem<dim> fe_grid;
606 
608  dealii::hp::QCollection<dim> volume_quadrature_collection;
610  dealii::hp::QCollection<dim-1> face_quadrature_collection;
611 
613 
614  const dealii::hp::FECollection<dim> fe_collection_lagrange;
615 
616 public:
617 
619 
620  const dealii::hp::FECollection<1> oneD_fe_collection;
621 
623 
627  const dealii::hp::FECollection<1> oneD_fe_collection_1state;
629 
630  const dealii::hp::FECollection<1> oneD_fe_collection_flux;
632  dealii::hp::QCollection<1> oneD_quadrature_collection;
634  dealii::QGauss<0> oneD_face_quadrature;
635 
637 
641  //const dealii::hp::FECollection<dim> fe_collection_grid;
642  //const dealii::FESystem<dim> fe_grid;
643 
645  /* Allows us to iterate over the finite elements' degrees of freedom.
646  * Note that since we are not using FESystem, we need to multiply
647  * the index by a factor of "nstate"
648  *
649  * Must be defined after fe_dg since it is a subscriptor of fe_dg.
650  * Destructor are called in reverse order in which they appear in class definition.
651  */
652  dealii::DoFHandler<dim> dof_handler;
653 
655  std::shared_ptr<HighOrderGrid<dim,real,MeshType>> high_order_grid;
656 
658  void set_current_time(const real current_time_input);
659 
662 
663 protected:
667  const dealii::FE_Q<dim> fe_q_artificial_dissipation;
668 
670  dealii::DoFHandler<dim> dof_handler_artificial_dissipation;
671 
673  dealii::LinearAlgebra::distributed::Vector<double> artificial_dissipation_c0;
674 
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,
686  OPERATOR::vol_projection_operator<dim,2*dim,real> &soln_basis_projection_oper_int,
687  OPERATOR::vol_projection_operator<dim,2*dim,real> &soln_basis_projection_oper_ext,
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> &current_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;
698 
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,
705  const real penalty,
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,
713  OPERATOR::vol_projection_operator<dim,2*dim,real> &soln_basis_projection_oper_int,
714  OPERATOR::vol_projection_operator<dim,2*dim,real> &soln_basis_projection_oper_ext,
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> &current_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;
724 
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,
733  const real penalty,
734  const std::vector<dealii::types::global_dof_index> &current_dofs_indices,
735  const std::vector<dealii::types::global_dof_index> &neighbor_dofs_indices,
736  const std::vector<dealii::types::global_dof_index> &current_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,
747  OPERATOR::vol_projection_operator<dim,2*dim,real> &soln_basis_projection_oper_int,
748  OPERATOR::vol_projection_operator<dim,2*dim,real> &soln_basis_projection_oper_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> &current_cell_rhs,
756  dealii::Vector<real> &neighbor_cell_rhs,
757  std::vector<dealii::Tensor<1,dim,real>> &current_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;
762 
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,
772  const real penalty,
773  const std::vector<dealii::types::global_dof_index> &current_dofs_indices,
774  const std::vector<dealii::types::global_dof_index> &neighbor_dofs_indices,
775  const std::vector<dealii::types::global_dof_index> &current_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,
786  OPERATOR::vol_projection_operator<dim,2*dim,real> &soln_basis_projection_oper_int,
787  OPERATOR::vol_projection_operator<dim,2*dim,real> &soln_basis_projection_oper_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> &current_cell_rhs,
795  dealii::Vector<real> &neighbor_cell_rhs,
796  std::vector<dealii::Tensor<1,dim,real>> &current_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;
801 
802 protected:
804 
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> &,//fe_values_vol,
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> &/*fe_values_lagrange*/,
815  const bool compute_dRdW, const bool compute_dRdX, const bool compute_d2R) = 0;
817 
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,
824  const real penalty,
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;
832 
835  virtual void assemble_face_term_derivatives(
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> &,//fe_values_int,
844  const dealii::FEFaceValuesBase<dim,dim> &,//fe_values_ext,
845  const real penalty,
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;
856 
858  virtual void assemble_volume_term_explicit(
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> &current_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> &current_cell_rhs,
867  const dealii::FEValues<dim,dim> &fe_values_lagrange) = 0;
868 
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;
876 
877  const dealii::UpdateFlags neighbor_face_update_flags = dealii::update_values | dealii::update_gradients | dealii::update_quadrature_points | dealii::update_JxW_values;
878 
879 
880 public:
883 
885  virtual void assemble_auxiliary_residual () = 0;
886 
888 
890  virtual void allocate_dual_vector () = 0;
891 
892 protected:
893  MPI_Comm mpi_communicator;
894  dealii::ConditionalOStream pcout;
895 private:
896 
902  template<typename DoFCellAccessorType>
904  const DoFCellAccessorType &cell,
905  const int iface,
906  const dealii::hp::FECollection<dim> fe_collection) const;
907 
909 
916  template<typename DoFCellAccessorType1, typename DoFCellAccessorType2>
917  bool current_cell_should_do_the_work (const DoFCellAccessorType1 &current_cell, const DoFCellAccessorType2 &neighbor_cell) const;
918 
920 
924  MassiveCollectionTuple create_collection_tuple(const unsigned int max_degree, const int nstate, const Parameters::AllParameters *const parameters_input) const;
925 
926 public:
934  virtual void allocate_model_variables() = 0;
936  virtual void update_model_variables() = 0;
940  virtual void set_use_auxiliary_eq() = 0;
941 
942 }; // end of DGBase class
943 
944 } // PHiLiP namespace
945 
946 #endif
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)
Definition: dg_base.cpp:2932
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.
Definition: dg_base.hpp:425
dealii::Vector< double > artificial_dissipation_coeffs
Artificial dissipation in each cell.
Definition: dg_base.hpp:462
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.
Definition: dg_base.hpp:938
const dealii::UpdateFlags neighbor_face_update_flags
Update flags needed at neighbor&#39; face points.
Definition: dg_base.hpp:877
void time_scaled_mass_matrices(const real scale)
Definition: dg_base.cpp:2812
dealii::LinearAlgebra::distributed::Vector< double > artificial_dissipation_c0
Artificial dissipation coefficients.
Definition: dg_base.hpp:673
virtual void allocate_second_derivatives()
Allocates the second derivatives.
Definition: dg_base.cpp:1990
const dealii::hp::FECollection< 1 > oneD_fe_collection
1D Finite Element Collection for p-finite-element to represent the solution
Definition: dg_base.hpp:620
const unsigned int initial_degree
Initial polynomial degree assigned during constructor.
Definition: dg_base.hpp:99
dealii::LinearAlgebra::distributed::Vector< double > solution_d2R
Definition: dg_base.hpp:436
dealii::TrilinosWrappers::SparseMatrix dRdXv
Definition: dg_base.hpp:356
const Parameters::AllParameters *const all_parameters
Pointer to all parameters.
Definition: dg_base.hpp:91
void add_time_scaled_mass_matrices()
Add time scaled mass matrices to the system.
Definition: dg_base.cpp:2807
double assemble_residual_time
Computational time for assembling residual.
Definition: dg_base.hpp:661
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...
Definition: dg_base.hpp:479
dealii::LinearAlgebra::distributed::Vector< double > volume_nodes_dRdX
Definition: dg_base.hpp:432
std::array< dealii::LinearAlgebra::distributed::Vector< double >, dim > auxiliary_right_hand_side
The auxiliary equations&#39; right hand sides.
Definition: dg_base.hpp:412
void add_mass_matrices(const real scale)
Add mass matrices to the system scaled by a factor (likely time-step)
Definition: dg_base.cpp:2802
dealii::TrilinosWrappers::SparseMatrix global_mass_matrix_auxiliary
Global auxiliary mass matrix.
Definition: dg_base.hpp:336
std::shared_ptr< Triangulation > triangulation
Mesh.
Definition: dg_base.hpp:160
void output_results_vtk(const unsigned int cycle, const double current_time=0.0)
Output solution.
Definition: dg_base.cpp:1749
dealii::QGauss< 0 > oneD_face_quadrature
1D surface quadrature is always one single point for all poly degrees.
Definition: dg_base.hpp:634
void update_artificial_dissipation_discontinuity_sensor()
Update discontinuity sensor.
Definition: dg_base.cpp:861
dealii::Point< dim > coordinates_of_highest_refined_cell(bool check_for_p_refined_cell=false)
Returns the coordinates of the most refined cell.
Definition: dg_base.cpp:329
dealii::IndexSet locally_owned_dofs_grid
Locally own degrees of freedom for the grid.
Definition: dg_base.hpp:402
Files for the baseline physics.
Definition: ADTypes.hpp:10
void allocate_auxiliary_equation()
Allocates the auxiliary equations&#39; variables and right hand side (primarily for Strong form diffusive...
Definition: dg_base.cpp:1854
const dealii::hp::FECollection< 1 > oneD_fe_collection_flux
1D collocated flux basis used in strong form
Definition: dg_base.hpp:630
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.
Definition: dg_base.cpp:1352
dealii::TrilinosWrappers::SparseMatrix system_matrix_transpose
Definition: dg_base.hpp:347
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.
Definition: dg_base.cpp:60
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.
Definition: dg_base.hpp:350
dealii::TrilinosWrappers::SparseMatrix d2RdWdW
Definition: dg_base.hpp:360
double get_residual_l2norm() const
Returns the L2-norm of the right_hand_side vector.
Definition: dg_base.cpp:1400
-th order modal derivative of basis fuctions, ie/
Definition: operators.h:519
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 > &current_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.
Definition: dg_base.hpp:329
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.
Definition: dg_base.cpp:1045
MPI_Comm mpi_communicator
MPI communicator.
Definition: dg_base.hpp:893
dealii::Vector< double > max_dt_cell
Time it takes for the maximum wavespeed to cross the cell domain.
Definition: dg_base.hpp:457
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...
Definition: dg_base.hpp:627
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 > &current_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 > &current_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.
Definition: dg_base.cpp:2026
dealii::LinearAlgebra::distributed::Vector< double > solution
Current modal coefficients of the solution.
Definition: dg_base.hpp:409
ESFR correction matrix without jac dependence.
Definition: operators.h:539
Local mass matrix without jacobian dependence.
Definition: operators.h:436
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.
Definition: dg_base.hpp:96
dealii::DoFHandler< dim > dof_handler_artificial_dissipation
Degrees of freedom handler for C0 artificial dissipation.
Definition: dg_base.hpp:670
dealii::IndexSet locally_owned_dofs
Locally own degrees of freedom.
Definition: dg_base.hpp:398
dealii::LinearAlgebra::distributed::Vector< double > solution_dRdW
Definition: dg_base.hpp:419
dealii::LinearAlgebra::distributed::Vector< double > volume_nodes_dRdW
Definition: dg_base.hpp:422
dealii::SparsityPattern mass_sparsity_pattern
Sparsity pattern used on the system_matrix.
Definition: dg_base.hpp:321
dealii::TrilinosWrappers::SparseMatrix global_inverse_mass_matrix_auxiliary
Global inverse of the auxiliary mass matrix.
Definition: dg_base.hpp:339
void reinit()
Reinitializes the DG object after a change of triangulation.
Definition: dg_base.cpp:112
dealii::IndexSet locally_relevant_dofs_grid
Definition: dg_base.hpp:404
dealii::TrilinosWrappers::SparseMatrix time_scaled_global_mass_matrix
Global mass matrix divided by the time scales.
Definition: dg_base.hpp:325
dealii::hp::QCollection< dim-1 > face_quadrature_collection
Quadrature used to evaluate face integrals.
Definition: dg_base.hpp:610
real evaluate_penalty_scaling(const DoFCellAccessorType &cell, const int iface, const dealii::hp::FECollection< dim > fe_collection) const
Definition: dg_base.cpp:398
const unsigned int max_degree
Maximum degree used for p-refi1nement.
Definition: dg_base.hpp:104
Base metric operators class that stores functions used in both the volume and on surface.
Definition: operators.h:1086
void set_anisotropic_flags()
Set anisotropic flags based on jump indicator.
real current_time
The current time set in set_current_time()
Definition: dg_base.hpp:665
ESFR correction matrix for AUX EQUATION without jac dependence.
Definition: operators.h:655
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.
Definition: dg_base.hpp:894
unsigned int get_max_fe_degree()
Gets the maximum value of currently active FE degree.
Definition: dg_base.cpp:305
dealii::IndexSet ghost_dofs
Locally relevant ghost degrees of freedom.
Definition: dg_base.hpp:399
The mapping shape functions evaluated at the desired nodes (facet set included in volume grid nodes f...
Definition: operators.h:1026
virtual void allocate_system(const bool compute_dRdW=true, const bool compute_dRdX=true, const bool compute_d2R=true)
Allocates the system.
Definition: dg_base.cpp:1866
virtual void allocate_dRdX()
Allocates the residual derivatives w.r.t the volume nodes.
Definition: dg_base.cpp:2016
const dealii::UpdateFlags face_update_flags
Update flags needed at face points.
Definition: dg_base.hpp:873
std::shared_ptr< HighOrderGrid< dim, real, MeshType > > high_order_grid
High order grid that will provide the MappingFEField.
Definition: dg_base.hpp:655
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...
Definition: dg_base.cpp:2853
dealii::LinearAlgebra::distributed::Vector< double > solution_dRdX
Definition: dg_base.hpp:429
dealii::TrilinosWrappers::SparseMatrix d2RdWdX
Definition: dg_base.hpp:368
const unsigned int max_grid_degree
Maximum grid degree used for hp-refi1nement.
Definition: dg_base.hpp:109
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 > &current_dofs_indices, const std::vector< dealii::types::global_dof_index > &neighbor_dofs_indices, const std::vector< dealii::types::global_dof_index > &current_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 > &current_cell_rhs, dealii::Vector< real > &neighbor_cell_rhs, std::vector< dealii::Tensor< 1, dim, real >> &current_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
Definition: dg_base.hpp:442
const dealii::UpdateFlags volume_update_flags
Update flags needed at volume points.
Definition: dg_base.hpp:870
dealii::IndexSet locally_relevant_dofs
Union of locally owned degrees of freedom and relevant ghost degrees of freedom.
Definition: dg_base.hpp:400
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 > &current_dofs_indices, const std::vector< dealii::types::global_dof_index > &neighbor_dofs_indices, const std::vector< dealii::types::global_dof_index > &current_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 > &current_cell_rhs, dealii::Vector< real > &neighbor_cell_rhs, std::vector< dealii::Tensor< 1, dim, real >> &current_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...
Definition: dg_base.cpp:2229
dealii::LinearAlgebra::distributed::Vector< double > volume_nodes_d2R
Definition: dg_base.hpp:439
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.
Definition: dg_base.hpp:465
unsigned int get_min_fe_degree()
Gets the minimum value of currently active FE degree.
Definition: dg_base.cpp:317
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.
Definition: dg_base.cpp:121
MassiveCollectionTuple create_collection_tuple(const unsigned int max_degree, const int nstate, const Parameters::AllParameters *const parameters_input) const
Used in the delegated constructor.
Definition: dg_base.cpp:142
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 > &current_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.
Definition: dg_base.hpp:652
dealii::SparsityPattern sparsity_pattern
Sparsity pattern used on the system_matrix.
Definition: dg_base.hpp:317
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.
Definition: dg_base.cpp:2625
dealii::SparsityPattern get_d2RdWdW_sparsity_pattern()
Evaluate SparsityPattern of the residual Hessian dual.d2RdWdW.
MeshType Triangulation
Definition: dg_base.hpp:89
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.
Definition: dg_base.cpp:265
dealii::SparsityPattern get_dRdXs_sparsity_pattern()
Evaluate SparsityPattern of dRdXs.
dealii::TrilinosWrappers::SparseMatrix system_matrix
Definition: dg_base.hpp:343
void evaluate_mass_matrices(bool do_inverse_mass_matrix=false)
Allocates and evaluates the mass matrices for the entire grid.
Definition: dg_base.cpp:2064
const dealii::hp::FECollection< dim > fe_collection_lagrange
Lagrange basis used in strong form.
Definition: dg_base.hpp:614
dealii::Vector< double > cell_volume
Time it takes for the maximum wavespeed to cross the cell domain.
Definition: dg_base.hpp:450
bool current_cell_should_do_the_work(const DoFCellAccessorType1 &current_cell, const DoFCellAccessorType2 &neighbor_cell) const
In the case that two cells have the same coarseness, this function decides if the current cell should...
Definition: dg_base.cpp:418
virtual void assemble_auxiliary_residual()=0
Asembles the auxiliary equations&#39; residuals and solves.
dealii::IndexSet ghost_dofs_grid
Locally relevant ghost degrees of freedom for the grid.
Definition: dg_base.hpp:403
void set_current_time(const real current_time_input)
Sets the current time within DG to be used for unsteady source terms.
Definition: dg_base.cpp:3020
dealii::hp::QCollection< 1 > oneD_quadrature_collection
1D quadrature to generate Lagrange polynomials for the sake of flux interpolation.
Definition: dg_base.hpp:632
std::array< dealii::LinearAlgebra::distributed::Vector< double >, dim > auxiliary_solution
The auxiliary equations&#39; solution.
Definition: dg_base.hpp:415
bool freeze_artificial_dissipation
Flag to freeze artificial dissipation.
Definition: dg_base.hpp:928
dealii::TrilinosWrappers::SparseMatrix d2RdXdX
Definition: dg_base.hpp:364
DGBase is independent of the number of state variables.
Definition: dg_base.hpp:82
void allocate_artificial_dissipation()
Allocates variables of artificial dissipation.
Definition: dg_base.cpp:1971
void assemble_cell_residual(const DoFCellAccessorType1 &current_cell, const DoFCellAccessorType2 &current_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().
Definition: dg_base.cpp:454
dealii::hp::QCollection< dim > volume_quadrature_collection
Finite Element Collection to represent the high-order grid.
Definition: dg_base.hpp:608
void set_all_cells_fe_degree(const unsigned int degree)
Refers to a collection Mappings, which represents the high-order grid.
Definition: dg_base.cpp:293
unsigned int n_dofs() const
Number of degrees of freedom.
Definition: dg_base.cpp:1458
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.
Definition: dg_base.hpp:597
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.
Definition: dg_base.hpp:145
double max_artificial_dissipation_coeff
Stores maximum artificial dissipation while assembling the residual.
Definition: dg_base.hpp:930
Projection operator corresponding to basis functions onto M-norm (L2).
Definition: operators.h:694
dealii::LinearAlgebra::distributed::Vector< double > right_hand_side
Residual of the current solution.
Definition: dg_base.hpp:396
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.
Definition: dg_base.cpp:1091
Local stiffness matrix without jacobian dependence.
Definition: operators.h:472
dealii::TrilinosWrappers::SparseMatrix global_inverse_mass_matrix
Global inverser mass matrix.
Definition: dg_base.hpp:332
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.
Definition: dg_base.cpp:855
dealii::SparsityPattern get_dRdW_sparsity_pattern()
Evaluate SparsityPattern of dRdW.
const dealii::FE_Q< dim > fe_q_artificial_dissipation
Continuous distribution of artificial dissipation.
Definition: dg_base.hpp:667
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...
Definition: dg_base.cpp:2452