[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_SPECIES,PHILIP_DIM, PHILIP_SPECIES,dealii::LinearAlgebra::distributed::Vector<double>, dealii::DoFHandler<PHILIP_DIM> >;
50 namespace PHiLiP {
51 
53 template<int dim, int nspecies, 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, int nspecies, typename real, typename MeshType = dealii::Triangulation<dim>>
79 #else
80 template <int dim, int nspecies, 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,
223  OPERATOR::basis_functions<dim,2*dim> &soln_basis_int,
224  OPERATOR::basis_functions<dim,2*dim> &soln_basis_ext,
225  OPERATOR::basis_functions<dim,2*dim> &flux_basis_int,
226  OPERATOR::basis_functions<dim,2*dim> &flux_basis_ext,
227  OPERATOR::local_basis_stiffness<dim,2*dim> &flux_basis_stiffness,
228  OPERATOR::vol_projection_operator<dim,2*dim> &soln_basis_projection_oper_int,
229  OPERATOR::vol_projection_operator<dim,2*dim> &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> &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> &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 
411  dealii::LinearAlgebra::distributed::Vector<double> time_averaged_solution;
412 
413  dealii::LinearAlgebra::distributed::Vector<double> fluctuating_quantities;
414 
416  std::array<dealii::LinearAlgebra::distributed::Vector<double>,dim> auxiliary_right_hand_side;
417 
419  std::array<dealii::LinearAlgebra::distributed::Vector<double>,dim> auxiliary_solution;
420 private:
423  dealii::LinearAlgebra::distributed::Vector<double> solution_dRdW;
426  dealii::LinearAlgebra::distributed::Vector<double> volume_nodes_dRdW;
427 
430 
433  dealii::LinearAlgebra::distributed::Vector<double> solution_dRdX;
436  dealii::LinearAlgebra::distributed::Vector<double> volume_nodes_dRdX;
437 
440  dealii::LinearAlgebra::distributed::Vector<double> solution_d2R;
443  dealii::LinearAlgebra::distributed::Vector<double> volume_nodes_d2R;
446  dealii::LinearAlgebra::distributed::Vector<double> dual_d2R;
447 public:
448 
450 
454  dealii::Vector<double> cell_volume;
455 
457 
461  dealii::Vector<double> max_dt_cell;
462 
463  dealii::Vector<double> reduced_mesh_weights;
464 
466  dealii::Vector<double> artificial_dissipation_coeffs;
467 
469  dealii::Vector<double> artificial_dissipation_se;
470 
471  template <typename real2>
473  real2 discontinuity_sensor(
474  const dealii::Quadrature<dim> &volume_quadrature,
475  const std::vector< real2 > &soln_coeff_high,
476  const dealii::FiniteElement<dim,dim> &fe_high,
477  const std::vector<real2> &jac_det);
478 
480 
483  dealii::LinearAlgebra::distributed::Vector<real> dual;
484 
486  void set_dual(const dealii::LinearAlgebra::distributed::Vector<real> &dual_input);
487 
489  /* Where R represents the residual and X represents the grid degrees of freedom stored as high_order_grid.volume_nodes.
490  */
491  dealii::SparsityPattern get_dRdX_sparsity_pattern ();
492 
494  /* Where R represents the residual and W represents the solution degrees of freedom.
495  */
496  dealii::SparsityPattern get_dRdW_sparsity_pattern ();
497 
499  /* Where R represents the residual and W represents the solution degrees of freedom.
500  */
501  dealii::SparsityPattern get_d2RdWdW_sparsity_pattern ();
502 
504  /* Where R represents the residual and X represents the grid degrees of freedom stored as high_order_grid.volume_nodes.
505  */
506  dealii::SparsityPattern get_d2RdXdX_sparsity_pattern ();
507 
509  /* Where R represents the residual, W the solution DoF, and X represents the grid degrees of freedom stored as high_order_grid.volume_nodes.
510  */
511  dealii::SparsityPattern get_d2RdWdX_sparsity_pattern ();
512 
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_dRdXs_sparsity_pattern ();
518  /* Where R represents the residual and Xs represents the grid surface degrees of freedom stored as high_order_grid.volume_nodes.
519  */
520  dealii::SparsityPattern get_d2RdXsdXs_sparsity_pattern ();
521 
523  /* 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.
524  */
525  dealii::SparsityPattern get_d2RdWdXs_sparsity_pattern ();
526 
528  /* Where R represents the residual and X represents the grid degrees of freedom stored as high_order_grid.volume_nodes.
529  */
530  dealii::TrilinosWrappers::SparseMatrix get_dRdX_finite_differences (dealii::SparsityPattern dRdX_sparsity_pattern);
531 
533 
534  // Output VTK files. Do not modify default output_time_averaged_solution or output_fluctuating_quantities flags.
535  void output_results_vtk (const unsigned int cycle, const double current_time=0.0, const bool output_time_averaged_solution=false, const bool output_fluctuating_quantities=false);
536  void output_face_results_vtk (const unsigned int cycle, const double current_time=0.0, const bool output_time_averaged_solution=false, const bool output_fluctuating_quantities=false);
537 
538  bool update_artificial_diss;
540 
570  //void assemble_residual_dRdW ();
571  void assemble_residual (const bool compute_dRdW=false, const bool compute_dRdX=false, const bool compute_d2R=false, const double CFL_mass = 0.0);
572 
574 
578  template<typename adtype>
580  const dealii::TriaActiveIterator<dealii::DoFCellAccessor<dim, dim, false>> &current_cell,
581  const dealii::TriaActiveIterator<dealii::DoFCellAccessor<dim, dim, false>> &current_metric_cell,
582  const bool compute_dRdW, const bool compute_dRdX, const bool compute_d2R,
583  dealii::hp::FEValues<dim,dim> &fe_values_collection_volume,
584  dealii::hp::FEFaceValues<dim,dim> &fe_values_collection_face_int,
585  dealii::hp::FEFaceValues<dim,dim> &fe_values_collection_face_ext,
586  dealii::hp::FESubfaceValues<dim,dim> &fe_values_collection_subface,
587  dealii::hp::FEValues<dim,dim> &fe_values_collection_volume_lagrange,
588  OPERATOR::basis_functions<dim,2*dim> &soln_basis_int,
589  OPERATOR::basis_functions<dim,2*dim> &soln_basis_ext,
590  OPERATOR::basis_functions<dim,2*dim> &flux_basis_int,
591  OPERATOR::basis_functions<dim,2*dim> &flux_basis_ext,
592  OPERATOR::local_basis_stiffness<dim,2*dim> &flux_basis_stiffness,
593  OPERATOR::vol_projection_operator<dim,2*dim> &soln_basis_projection_oper_int,
594  OPERATOR::vol_projection_operator<dim,2*dim> &soln_basis_projection_oper_ext,
596  const bool compute_auxiliary_right_hand_side,//flag on whether computing the Auxiliary variable's equations' residuals
597  dealii::LinearAlgebra::distributed::Vector<double> &rhs,
598  std::array<dealii::LinearAlgebra::distributed::Vector<double>,dim> &rhs_aux);
599 
601  template <typename adtype>
602  typename std::enable_if<!std::is_same<adtype, double>::value,void>::type
604  typename dealii::DoFHandler<dim>::active_cell_iterator cell,
605  const dealii::types::global_dof_index current_cell_index,
606  const std::vector<dealii::types::global_dof_index> &soln_dofs_indices,
607  const std::vector<dealii::types::global_dof_index> &metric_dof_indices,
608  const unsigned int poly_degree,
609  const unsigned int grid_degree,
612  OPERATOR::local_basis_stiffness<dim,2*dim> &flux_basis_stiffness,
613  OPERATOR::vol_projection_operator<dim,2*dim> &soln_basis_projection_oper_int,
614  OPERATOR::vol_projection_operator<dim,2*dim> &soln_basis_projection_oper_ext,
617  std::array<std::vector<adtype>,dim> &mapping_support_points,
618  dealii::hp::FEValues<dim,dim> &fe_values_collection_volume,
619  dealii::hp::FEValues<dim,dim> &fe_values_collection_volume_lagrange,
620  const dealii::FESystem<dim,dim> &fe_soln,
621  std::vector<real> &local_rhs_cell,
622  dealii::Tensor<1,dim,std::vector<real>> &local_auxiliary_RHS,
623  const bool compute_auxiliary_right_hand_side,
624  const bool compute_dRdW, const bool compute_dRdX, const bool compute_d2R);
625 
628  typename dealii::DoFHandler<dim>::active_cell_iterator cell,
629  const dealii::types::global_dof_index current_cell_index,
630  const std::vector<dealii::types::global_dof_index> &soln_dofs_indices,
631  const std::vector<dealii::types::global_dof_index> &metric_dof_indices,
632  const unsigned int poly_degree,
633  const unsigned int grid_degree,
636  OPERATOR::local_basis_stiffness<dim,2*dim> &flux_basis_stiffness,
637  OPERATOR::vol_projection_operator<dim,2*dim> &soln_basis_projection_oper_int,
638  OPERATOR::vol_projection_operator<dim,2*dim> &soln_basis_projection_oper_ext,
641  std::array<std::vector<double>,dim> &mapping_support_points,
642  dealii::hp::FEValues<dim,dim> &fe_values_collection_volume,
643  dealii::hp::FEValues<dim,dim> &fe_values_collection_volume_lagrange,
644  const dealii::FESystem<dim,dim> &fe_soln,
645  std::vector<real> &local_rhs_cell,
646  dealii::Tensor<1,dim,std::vector<real>> &local_auxiliary_RHS,
647  const bool compute_auxiliary_right_hand_side,
648  const bool compute_dRdW, const bool compute_dRdX, const bool compute_d2R);
649 
651  template <typename adtype>
652  typename std::enable_if<!std::is_same<adtype, double>::value,void>::type
654  typename dealii::DoFHandler<dim>::active_cell_iterator cell,
655  const dealii::types::global_dof_index current_cell_index,
656  const unsigned int iface,
657  const unsigned int boundary_id,
658  const real penalty,
659  const std::vector<dealii::types::global_dof_index> &soln_dofs_indices,
660  const std::vector<dealii::types::global_dof_index> &metric_dof_indices,
661  const unsigned int poly_degree,
662  const unsigned int grid_degree,
665  OPERATOR::vol_projection_operator<dim,2*dim> &soln_basis_projection_oper_int,
668  std::array<std::vector<adtype>,dim> &mapping_support_points,
669  dealii::hp::FEFaceValues<dim,dim> &fe_values_collection_face_int,
670  const dealii::FESystem<dim,dim> &fe_soln,
671  std::vector<real> &local_rhs_cell,
672  dealii::Tensor<1,dim,std::vector<real>> &local_auxiliary_RHS,
673  const bool compute_auxiliary_right_hand_side,
674  const bool compute_dRdW, const bool compute_dRdX, const bool compute_d2R);
675 
678  typename dealii::DoFHandler<dim>::active_cell_iterator cell,
679  const dealii::types::global_dof_index current_cell_index,
680  const unsigned int iface,
681  const unsigned int boundary_id,
682  const real penalty,
683  const std::vector<dealii::types::global_dof_index> &soln_dofs_indices,
684  const std::vector<dealii::types::global_dof_index> &metric_dof_indices,
685  const unsigned int poly_degree,
686  const unsigned int grid_degree,
689  OPERATOR::vol_projection_operator<dim,2*dim> &soln_basis_projection_oper_int,
692  std::array<std::vector<double>,dim> &mapping_support_points,
693  dealii::hp::FEFaceValues<dim,dim> &fe_values_collection_face_int,
694  const dealii::FESystem<dim,dim> &fe_soln,
695  std::vector<real> &local_rhs_cell,
696  dealii::Tensor<1,dim,std::vector<real>> &local_auxiliary_RHS,
697  const bool compute_auxiliary_right_hand_side,
698  const bool compute_dRdW, const bool compute_dRdX, const bool compute_d2R);
699 
701  template <typename adtype>
702  typename std::enable_if<!std::is_same<adtype, double>::value,void>::type
704  typename dealii::DoFHandler<dim>::active_cell_iterator cell,
705  typename dealii::DoFHandler<dim>::active_cell_iterator neighbor_cell,
706  const dealii::types::global_dof_index current_cell_index,
707  const dealii::types::global_dof_index neighbor_cell_index,
708  const unsigned int iface,
709  const unsigned int neighbor_iface,
710  const real penalty,
711  dealii::hp::FEFaceValues<dim,dim> &fe_values_collection_face_int,
712  dealii::hp::FEFaceValues<dim,dim> &fe_values_collection_face_ext,
713  dealii::hp::FESubfaceValues<dim,dim> &fe_values_collection_subface,
714  const dealii::FESystem<dim,dim> &fe_int,
715  const dealii::FESystem<dim,dim> &fe_ext,
716  const std::vector<dealii::types::global_dof_index> &soln_dofs_indices_int,
717  const std::vector<dealii::types::global_dof_index> &soln_dofs_indices_ext,
718  const std::vector<dealii::types::global_dof_index> &metric_dofs_indices_int,
719  const std::vector<dealii::types::global_dof_index> &metric_dofs_indices_ext,
720  const unsigned int poly_degree_int,
721  const unsigned int poly_degree_ext,
722  const unsigned int grid_degree_int,
723  const unsigned int grid_degree_ext,
724  OPERATOR::basis_functions<dim,2*dim> &soln_basis_int,
725  OPERATOR::basis_functions<dim,2*dim> &soln_basis_ext,
726  OPERATOR::basis_functions<dim,2*dim> &flux_basis_int,
727  OPERATOR::basis_functions<dim,2*dim> &flux_basis_ext,
728  OPERATOR::local_basis_stiffness<dim,2*dim> &flux_basis_stiffness,
729  OPERATOR::vol_projection_operator<dim,2*dim> &soln_basis_projection_oper_int,
730  OPERATOR::vol_projection_operator<dim,2*dim> &soln_basis_projection_oper_ext,
734  std::array<std::vector<adtype>,dim> &mapping_support_points,
735  std::vector<real> &local_rhs_int_cell,
736  std::vector<real> &local_rhs_ext_cell,
737  dealii::Tensor<1,dim,std::vector<real>> &current_cell_rhs_aux,
738  dealii::LinearAlgebra::distributed::Vector<double> &rhs,
739  std::array<dealii::LinearAlgebra::distributed::Vector<double>,dim> &rhs_aux,
740  const bool compute_auxiliary_right_hand_side,
741  const bool compute_dRdW, const bool compute_dRdX, const bool compute_d2R,
742  const bool is_a_subface = false,
743  const unsigned int neighbor_i_subface = 0);
744 
747  typename dealii::DoFHandler<dim>::active_cell_iterator cell,
748  typename dealii::DoFHandler<dim>::active_cell_iterator neighbor_cell,
749  const dealii::types::global_dof_index current_cell_index,
750  const dealii::types::global_dof_index neighbor_cell_index,
751  const unsigned int iface,
752  const unsigned int neighbor_iface,
753  const real penalty,
754  dealii::hp::FEFaceValues<dim,dim> &fe_values_collection_face_int,
755  dealii::hp::FEFaceValues<dim,dim> &fe_values_collection_face_ext,
756  dealii::hp::FESubfaceValues<dim,dim> &fe_values_collection_subface,
757  const dealii::FESystem<dim,dim> &fe_int,
758  const dealii::FESystem<dim,dim> &fe_ext,
759  const std::vector<dealii::types::global_dof_index> &soln_dofs_indices_int,
760  const std::vector<dealii::types::global_dof_index> &soln_dofs_indices_ext,
761  const std::vector<dealii::types::global_dof_index> &metric_dofs_indices_int,
762  const std::vector<dealii::types::global_dof_index> &metric_dofs_indices_ext,
763  const unsigned int poly_degree_int,
764  const unsigned int poly_degree_ext,
765  const unsigned int grid_degree_int,
766  const unsigned int grid_degree_ext,
767  OPERATOR::basis_functions<dim,2*dim> &soln_basis_int,
768  OPERATOR::basis_functions<dim,2*dim> &soln_basis_ext,
769  OPERATOR::basis_functions<dim,2*dim> &flux_basis_int,
770  OPERATOR::basis_functions<dim,2*dim> &flux_basis_ext,
771  OPERATOR::local_basis_stiffness<dim,2*dim> &flux_basis_stiffness,
772  OPERATOR::vol_projection_operator<dim,2*dim> &soln_basis_projection_oper_int,
773  OPERATOR::vol_projection_operator<dim,2*dim> &soln_basis_projection_oper_ext,
777  std::array<std::vector<double>,dim> &mapping_support_points,
778  std::vector<real> &local_rhs_int_cell,
779  std::vector<real> &local_rhs_ext_cell,
780  dealii::Tensor<1,dim,std::vector<real>> &current_cell_rhs_aux,
781  dealii::LinearAlgebra::distributed::Vector<double> &rhs,
782  std::array<dealii::LinearAlgebra::distributed::Vector<double>,dim> &rhs_aux,
783  const bool compute_auxiliary_right_hand_side,
784  const bool compute_dRdW, const bool compute_dRdX, const bool compute_d2R,
785  const bool is_a_subface = false,
786  const unsigned int neighbor_i_subface = 0);
787 
790  typename dealii::DoFHandler<dim>::active_cell_iterator cell,
791  const dealii::types::global_dof_index current_cell_index,
792  const std::vector<double> &soln_coeffs,
793  const dealii::Tensor<1,dim,std::vector<double>> &aux_soln_coeffs,
794  const std::vector<double> &metric_coeffs,
795  const std::vector<real> &local_dual,
796  const std::vector<dealii::types::global_dof_index> &soln_dofs_indices,
797  const std::vector<dealii::types::global_dof_index> &metric_dofs_indices,
798  const unsigned int poly_degree,
799  const unsigned int grid_degree,
802  OPERATOR::local_basis_stiffness<dim,2*dim> &flux_basis_stiffness,
803  OPERATOR::vol_projection_operator<dim,2*dim> &soln_basis_projection_oper_int,
804  OPERATOR::vol_projection_operator<dim,2*dim> &soln_basis_projection_oper_ext,
807  std::array<std::vector<double>,dim> &mapping_support_points,
808  dealii::hp::FEValues<dim,dim> &fe_values_collection_volume,
809  dealii::hp::FEValues<dim,dim> &fe_values_collection_volume_lagrange,
810  const dealii::FESystem<dim,dim> &fe_soln,
811  std::vector<double> &rhs,
812  dealii::Tensor<1,dim,std::vector<double>> &local_auxiliary_RHS,
813  const bool compute_auxiliary_right_hand_side,
814  double &dual_dot_residual) =0;
815 
818  typename dealii::DoFHandler<dim>::active_cell_iterator cell,
819  const dealii::types::global_dof_index current_cell_index,
820  const std::vector<codi_JacobianComputationType> &soln_coeffs,
821  const dealii::Tensor<1,dim,std::vector<codi_JacobianComputationType>> &aux_soln_coeffs,
822  const std::vector<codi_JacobianComputationType> &metric_coeffs,
823  const std::vector<real> &local_dual,
824  const std::vector<dealii::types::global_dof_index> &soln_dofs_indices,
825  const std::vector<dealii::types::global_dof_index> &metric_dofs_indices,
826  const unsigned int poly_degree,
827  const unsigned int grid_degree,
830  OPERATOR::local_basis_stiffness<dim,2*dim> &flux_basis_stiffness,
831  OPERATOR::vol_projection_operator<dim,2*dim> &soln_basis_projection_oper_int,
832  OPERATOR::vol_projection_operator<dim,2*dim> &soln_basis_projection_oper_ext,
835  std::array<std::vector<codi_JacobianComputationType>,dim> &mapping_support_points,
836  dealii::hp::FEValues<dim,dim> &fe_values_collection_volume,
837  dealii::hp::FEValues<dim,dim> &fe_values_collection_volume_lagrange,
838  const dealii::FESystem<dim,dim> &fe_soln,
839  std::vector<codi_JacobianComputationType> &rhs,
840  dealii::Tensor<1,dim,std::vector<codi_JacobianComputationType>> &local_auxiliary_RHS,
841  const bool compute_auxiliary_right_hand_side,
842  codi_JacobianComputationType &dual_dot_residual) =0;
843 
846  typename dealii::DoFHandler<dim>::active_cell_iterator cell,
847  const dealii::types::global_dof_index current_cell_index,
848  const std::vector<codi_HessianComputationType> &soln_coeffs,
849  const dealii::Tensor<1,dim,std::vector<codi_HessianComputationType>> &aux_soln_coeffs,
850  const std::vector<codi_HessianComputationType> &metric_coeffs,
851  const std::vector<real> &local_dual,
852  const std::vector<dealii::types::global_dof_index> &soln_dofs_indices,
853  const std::vector<dealii::types::global_dof_index> &metric_dofs_indices,
854  const unsigned int poly_degree,
855  const unsigned int grid_degree,
858  OPERATOR::local_basis_stiffness<dim,2*dim> &flux_basis_stiffness,
859  OPERATOR::vol_projection_operator<dim,2*dim> &soln_basis_projection_oper_int,
860  OPERATOR::vol_projection_operator<dim,2*dim> &soln_basis_projection_oper_ext,
863  std::array<std::vector<codi_HessianComputationType>,dim> &mapping_support_points,
864  dealii::hp::FEValues<dim,dim> &fe_values_collection_volume,
865  dealii::hp::FEValues<dim,dim> &fe_values_collection_volume_lagrange,
866  const dealii::FESystem<dim,dim> &fe_soln,
867  std::vector<codi_HessianComputationType> &rhs,
868  dealii::Tensor<1,dim,std::vector<codi_HessianComputationType>> &local_auxiliary_RHS,
869  const bool compute_auxiliary_right_hand_side,
870  codi_HessianComputationType &dual_dot_residual) =0;
871 
874  typename dealii::DoFHandler<dim>::active_cell_iterator cell,
875  const dealii::types::global_dof_index current_cell_index,
876  const std::vector<double> &soln_coeffs,
877  const dealii::Tensor<1,dim,std::vector<double>> &aux_soln_coeffs,
878  const std::vector<double> &metric_coeffs,
879  const std::vector<real> &local_dual,
880  const unsigned int face_number,
881  const unsigned int boundary_id,
882  const unsigned int poly_degree,
883  const unsigned int grid_degree,
886  OPERATOR::vol_projection_operator<dim,2*dim> &soln_basis_projection_oper_int,
889  std::array<std::vector<double>,dim> &mapping_support_points,
890  dealii::hp::FEFaceValues<dim,dim> &fe_values_collection_face_int,
891  const dealii::FESystem<dim,dim> &fe_soln,
892  const real penalty,
893  std::vector<double> &rhs,
894  dealii::Tensor<1,dim,std::vector<double>> &local_auxiliary_RHS,
895  const bool compute_auxiliary_right_hand_side,
896  double &dual_dot_residual) =0;
897 
900  typename dealii::DoFHandler<dim>::active_cell_iterator cell,
901  const dealii::types::global_dof_index current_cell_index,
902  const std::vector<codi_JacobianComputationType> &soln_coeffs,
903  const dealii::Tensor<1,dim,std::vector<codi_JacobianComputationType>> &aux_soln_coeffs,
904  const std::vector<codi_JacobianComputationType> &metric_coeffs,
905  const std::vector<real> &local_dual,
906  const unsigned int face_number,
907  const unsigned int boundary_id,
908  const unsigned int poly_degree,
909  const unsigned int grid_degree,
912  OPERATOR::vol_projection_operator<dim,2*dim> &soln_basis_projection_oper_int,
915  std::array<std::vector<codi_JacobianComputationType>,dim> &mapping_support_points,
916  dealii::hp::FEFaceValues<dim,dim> &fe_values_collection_face_int,
917  const dealii::FESystem<dim,dim> &fe_soln,
918  const real penalty,
919  std::vector<codi_JacobianComputationType> &rhs,
920  dealii::Tensor<1,dim,std::vector<codi_JacobianComputationType>> &local_auxiliary_RHS,
921  const bool compute_auxiliary_right_hand_side,
922  codi_JacobianComputationType &dual_dot_residual) =0;
923 
926  typename dealii::DoFHandler<dim>::active_cell_iterator cell,
927  const dealii::types::global_dof_index current_cell_index,
928  const std::vector<codi_HessianComputationType> &soln_coeffs,
929  const dealii::Tensor<1,dim,std::vector<codi_HessianComputationType>> &aux_soln_coeffs,
930  const std::vector<codi_HessianComputationType> &metric_coeffs,
931  const std::vector<real> &local_dual,
932  const unsigned int face_number,
933  const unsigned int boundary_id,
934  const unsigned int poly_degree,
935  const unsigned int grid_degree,
938  OPERATOR::vol_projection_operator<dim,2*dim> &soln_basis_projection_oper_int,
941  std::array<std::vector<codi_HessianComputationType>,dim> &mapping_support_points,
942  dealii::hp::FEFaceValues<dim,dim> &fe_values_collection_face_int,
943  const dealii::FESystem<dim,dim> &fe_soln,
944  const real penalty,
945  std::vector<codi_HessianComputationType> &rhs,
946  dealii::Tensor<1,dim,std::vector<codi_HessianComputationType>> &local_auxiliary_RHS,
947  const bool compute_auxiliary_right_hand_side,
948  codi_HessianComputationType &dual_dot_residual) =0;
949 
952  typename dealii::DoFHandler<dim>::active_cell_iterator cell,
953  typename dealii::DoFHandler<dim>::active_cell_iterator neighbor_cell,
954  const dealii::types::global_dof_index current_cell_index,
955  const dealii::types::global_dof_index neighbor_cell_index,
956  const unsigned int iface,
957  const unsigned int neighbor_iface,
958  const std::vector<double> &soln_coeff_int,
959  const std::vector<double> &soln_coeff_ext,
960  const dealii::Tensor<1,dim,std::vector<double>> &aux_soln_coeff_int,
961  const dealii::Tensor<1,dim,std::vector<double>> &aux_soln_coeff_ext,
962  const std::vector<double> &metric_coefF_int,
963  const std::vector<double> &metric_coefF_ext,
964  const std::vector< double > &dual_int,
965  const std::vector< double > &dual_ext,
966  const unsigned int poly_degree_int,
967  const unsigned int poly_degree_ext,
968  const unsigned int grid_degree_int,
969  const unsigned int grid_degree_ext,
970  OPERATOR::basis_functions<dim,2*dim> &soln_basis_int,
971  OPERATOR::basis_functions<dim,2*dim> &soln_basis_ext,
972  OPERATOR::basis_functions<dim,2*dim> &flux_basis_int,
973  OPERATOR::basis_functions<dim,2*dim> &flux_basis_ext,
974  OPERATOR::local_basis_stiffness<dim,2*dim> &flux_basis_stiffness,
975  OPERATOR::vol_projection_operator<dim,2*dim> &soln_basis_projection_oper_int,
976  OPERATOR::vol_projection_operator<dim,2*dim> &soln_basis_projection_oper_ext,
980  std::array<std::vector<double>,dim> &mapping_support_points,
981  dealii::hp::FEFaceValues<dim,dim> &fe_values_collection_face_int,
982  dealii::hp::FEFaceValues<dim,dim> &fe_values_collection_face_ext,
983  dealii::hp::FESubfaceValues<dim,dim> &fe_values_collection_subface,
984  const dealii::FESystem<dim,dim> &fe_int,
985  const dealii::FESystem<dim,dim> &fe_ext,
986  const real penalty,
987  std::vector<double> &rhs_int,
988  std::vector<double> &rhs_ext,
989  dealii::Tensor<1,dim,std::vector<double>> &aux_rhs_int,
990  dealii::Tensor<1,dim,std::vector<double>> &aux_rhs_ext,
991  const bool compute_auxiliary_right_hand_side,
992  double &dual_dot_residual,
993  const bool compute_dRdW, const bool compute_dRdX, const bool compute_d2R,
994  const bool is_a_subface,
995  const unsigned int neighbor_i_subface) =0;
996 
999  typename dealii::DoFHandler<dim>::active_cell_iterator cell,
1000  typename dealii::DoFHandler<dim>::active_cell_iterator neighbor_cell,
1001  const dealii::types::global_dof_index current_cell_index,
1002  const dealii::types::global_dof_index neighbor_cell_index,
1003  const unsigned int iface,
1004  const unsigned int neighbor_iface,
1005  const std::vector<codi_JacobianComputationType> &soln_coeff_int,
1006  const std::vector<codi_JacobianComputationType> &soln_coeff_ext,
1007  const dealii::Tensor<1,dim,std::vector<codi_JacobianComputationType>> &aux_soln_coeff_int,
1008  const dealii::Tensor<1,dim,std::vector<codi_JacobianComputationType>> &aux_soln_coeff_ext,
1009  const std::vector<codi_JacobianComputationType> &metric_coefF_int,
1010  const std::vector<codi_JacobianComputationType> &metric_coefF_ext,
1011  const std::vector< double > &dual_int,
1012  const std::vector< double > &dual_ext,
1013  const unsigned int poly_degree_int,
1014  const unsigned int poly_degree_ext,
1015  const unsigned int grid_degree_int,
1016  const unsigned int grid_degree_ext,
1017  OPERATOR::basis_functions<dim,2*dim> &soln_basis_int,
1018  OPERATOR::basis_functions<dim,2*dim> &soln_basis_ext,
1019  OPERATOR::basis_functions<dim,2*dim> &flux_basis_int,
1020  OPERATOR::basis_functions<dim,2*dim> &flux_basis_ext,
1021  OPERATOR::local_basis_stiffness<dim,2*dim> &flux_basis_stiffness,
1022  OPERATOR::vol_projection_operator<dim,2*dim> &soln_basis_projection_oper_int,
1023  OPERATOR::vol_projection_operator<dim,2*dim> &soln_basis_projection_oper_ext,
1027  std::array<std::vector<codi_JacobianComputationType>,dim> &mapping_support_points,
1028  dealii::hp::FEFaceValues<dim,dim> &fe_values_collection_face_int,
1029  dealii::hp::FEFaceValues<dim,dim> &fe_values_collection_face_ext,
1030  dealii::hp::FESubfaceValues<dim,dim> &fe_values_collection_subface,
1031  const dealii::FESystem<dim,dim> &fe_int,
1032  const dealii::FESystem<dim,dim> &fe_ext,
1033  const real penalty,
1034  std::vector<codi_JacobianComputationType> &rhs_int,
1035  std::vector<codi_JacobianComputationType> &rhs_ext,
1036  dealii::Tensor<1,dim,std::vector<codi_JacobianComputationType>> &aux_rhs_int,
1037  dealii::Tensor<1,dim,std::vector<codi_JacobianComputationType>> &aux_rhs_ext,
1038  const bool compute_auxiliary_right_hand_side,
1039  codi_JacobianComputationType &dual_dot_residual,
1040  const bool compute_dRdW, const bool compute_dRdX, const bool compute_d2R,
1041  const bool is_a_subface,
1042  const unsigned int neighbor_i_subface) =0;
1043 
1046  typename dealii::DoFHandler<dim>::active_cell_iterator cell,
1047  typename dealii::DoFHandler<dim>::active_cell_iterator neighbor_cell,
1048  const dealii::types::global_dof_index current_cell_index,
1049  const dealii::types::global_dof_index neighbor_cell_index,
1050  const unsigned int iface,
1051  const unsigned int neighbor_iface,
1052  const std::vector<codi_HessianComputationType> &soln_coeff_int,
1053  const std::vector<codi_HessianComputationType> &soln_coeff_ext,
1054  const dealii::Tensor<1,dim,std::vector<codi_HessianComputationType>> &aux_soln_coeff_int,
1055  const dealii::Tensor<1,dim,std::vector<codi_HessianComputationType>> &aux_soln_coeff_ext,
1056  const std::vector<codi_HessianComputationType> &metric_coefF_int,
1057  const std::vector<codi_HessianComputationType> &metric_coefF_ext,
1058  const std::vector< double > &dual_int,
1059  const std::vector< double > &dual_ext,
1060  const unsigned int poly_degree_int,
1061  const unsigned int poly_degree_ext,
1062  const unsigned int grid_degree_int,
1063  const unsigned int grid_degree_ext,
1064  OPERATOR::basis_functions<dim,2*dim> &soln_basis_int,
1065  OPERATOR::basis_functions<dim,2*dim> &soln_basis_ext,
1066  OPERATOR::basis_functions<dim,2*dim> &flux_basis_int,
1067  OPERATOR::basis_functions<dim,2*dim> &flux_basis_ext,
1068  OPERATOR::local_basis_stiffness<dim,2*dim> &flux_basis_stiffness,
1069  OPERATOR::vol_projection_operator<dim,2*dim> &soln_basis_projection_oper_int,
1070  OPERATOR::vol_projection_operator<dim,2*dim> &soln_basis_projection_oper_ext,
1074  std::array<std::vector<codi_HessianComputationType>,dim> &mapping_support_points,
1075  dealii::hp::FEFaceValues<dim,dim> &fe_values_collection_face_int,
1076  dealii::hp::FEFaceValues<dim,dim> &fe_values_collection_face_ext,
1077  dealii::hp::FESubfaceValues<dim,dim> &fe_values_collection_subface,
1078  const dealii::FESystem<dim,dim> &fe_int,
1079  const dealii::FESystem<dim,dim> &fe_ext,
1080  const real penalty,
1081  std::vector<codi_HessianComputationType> &rhs_int,
1082  std::vector<codi_HessianComputationType> &rhs_ext,
1083  dealii::Tensor<1,dim,std::vector<codi_HessianComputationType>> &aux_rhs_int,
1084  dealii::Tensor<1,dim,std::vector<codi_HessianComputationType>> &aux_rhs_ext,
1085  const bool compute_auxiliary_right_hand_side,
1086  codi_HessianComputationType &dual_dot_residual,
1087  const bool compute_dRdW, const bool compute_dRdX, const bool compute_d2R,
1088  const bool is_a_subface,
1089  const unsigned int neighbor_i_subface) =0;
1090 
1092 
1094  template <typename real2>
1095  double getValue(const real2 &x);
1096 
1103  const bool compute_dRdW, const bool compute_dRdX, const bool compute_d2R,
1104  const unsigned int n_soln_dofs, const unsigned int n_metric_dofs,
1105  unsigned int &w_start, unsigned int &w_end,
1106  unsigned int &x_start, unsigned int &x_end);
1107 
1113  const bool compute_dRdW, const bool compute_dRdX, const bool compute_d2R,
1114  const unsigned int n_soln_dofs_int, const unsigned int n_soln_dofs_ext, const unsigned int n_metric_dofs,
1115  unsigned int &w_int_start, unsigned int &w_int_end, unsigned int &w_ext_start, unsigned int &w_ext_end,
1116  unsigned int &x_int_start, unsigned int &x_int_end, unsigned int &x_ext_start, unsigned int &x_ext_end);
1117 
1119 
1120  const dealii::hp::FECollection<dim> fe_collection;
1121 
1123 
1127  //const dealii::hp::FECollection<dim> fe_collection_grid;
1128  //const dealii::FESystem<dim> fe_grid;
1129 
1131  dealii::hp::QCollection<dim> volume_quadrature_collection;
1133  dealii::hp::QCollection<dim-1> face_quadrature_collection;
1134 
1136 
1137  const dealii::hp::FECollection<dim> fe_collection_lagrange;
1138 
1139 public:
1140 
1142 
1143  const dealii::hp::FECollection<1> oneD_fe_collection;
1144 
1146 
1150  const dealii::hp::FECollection<1> oneD_fe_collection_1state;
1152 
1153  const dealii::hp::FECollection<1> oneD_fe_collection_flux;
1155  dealii::hp::QCollection<1> oneD_quadrature_collection;
1157  dealii::QGauss<0> oneD_face_quadrature;
1158 
1160 
1164  //const dealii::hp::FECollection<dim> fe_collection_grid;
1165  //const dealii::FESystem<dim> fe_grid;
1166 
1168  /* Allows us to iterate over the finite elements' degrees of freedom.
1169  * Note that since we are not using FESystem, we need to multiply
1170  * the index by a factor of "nstate"
1171  *
1172  * Must be defined after fe_dg since it is a subscriptor of fe_dg.
1173  * Destructor are called in reverse order in which they appear in class definition.
1174  */
1175  dealii::DoFHandler<dim> dof_handler;
1176 
1178  std::shared_ptr<HighOrderGrid<dim,real,MeshType>> high_order_grid;
1179 
1181  void set_current_time(const real current_time_input);
1182 
1185 
1186 protected:
1190  const dealii::FE_Q<dim> fe_q_artificial_dissipation;
1191 
1193  dealii::DoFHandler<dim> dof_handler_artificial_dissipation;
1194 
1196  dealii::LinearAlgebra::distributed::Vector<double> artificial_dissipation_c0;
1197 
1198 protected:
1200  virtual void assemble_volume_term_explicit(
1201  typename dealii::DoFHandler<dim>::active_cell_iterator cell,
1202  const dealii::types::global_dof_index current_cell_index,
1203  const dealii::FEValues<dim,dim> &fe_values_volume,
1204  const std::vector<dealii::types::global_dof_index> &current_dofs_indices,
1205  const std::vector<dealii::types::global_dof_index> &metric_dof_indices,
1206  const unsigned int poly_degree,
1207  const unsigned int grid_degree,
1208  dealii::Vector<real> &current_cell_rhs,
1209  const dealii::FEValues<dim,dim> &fe_values_lagrange) = 0;
1210 
1212  const dealii::UpdateFlags volume_update_flags = dealii::update_values | dealii::update_gradients | dealii::update_quadrature_points | dealii::update_JxW_values
1213  | dealii::update_inverse_jacobians;
1215  const dealii::UpdateFlags face_update_flags = dealii::update_values | dealii::update_gradients | dealii::update_quadrature_points | dealii::update_JxW_values | dealii::update_normal_vectors
1216  | dealii::update_jacobians;
1218 
1219  const dealii::UpdateFlags neighbor_face_update_flags = dealii::update_values | dealii::update_gradients | dealii::update_quadrature_points | dealii::update_JxW_values;
1220 
1221 
1222 public:
1225 
1227  virtual void assemble_auxiliary_residual (const bool compute_dRdW, const bool compute_dRdX, const bool compute_d2R) = 0;
1228 
1230  virtual void allocate_dual_vector (const bool compute_d2R) = 0;
1231 
1233  virtual void build_volume_metric_operators(
1234  const unsigned int poly_degree,
1235  const unsigned int grid_degree,
1236  const std::vector<double> &metric_coeffs,
1239  std::array<std::vector<double>,dim> &mapping_support_points) =0;
1241  virtual void build_volume_metric_operators(
1242  const unsigned int poly_degree,
1243  const unsigned int grid_degree,
1244  const std::vector<codi_JacobianComputationType> &metric_coeffs,
1247  std::array<std::vector<codi_JacobianComputationType>,dim> &mapping_support_points) =0;
1249  virtual void build_volume_metric_operators(
1250  const unsigned int poly_degree,
1251  const unsigned int grid_degree,
1252  const std::vector<codi_HessianComputationType> &metric_coeffs,
1255  std::array<std::vector<codi_HessianComputationType>,dim> &mapping_support_points) =0;
1256 
1257 protected:
1258  MPI_Comm mpi_communicator;
1259  dealii::ConditionalOStream pcout;
1260 private:
1261 
1267  template<typename DoFCellAccessorType>
1269  const DoFCellAccessorType &cell,
1270  const int iface,
1271  const dealii::hp::FECollection<dim> fe_collection) const;
1272 
1274 
1281  template<typename DoFCellAccessorType1, typename DoFCellAccessorType2>
1282  bool current_cell_should_do_the_work (const DoFCellAccessorType1 &current_cell, const DoFCellAccessorType2 &neighbor_cell) const;
1283 
1285 
1289  MassiveCollectionTuple create_collection_tuple(const unsigned int max_degree, const int nstate, const Parameters::AllParameters *const parameters_input) const;
1290 
1291 public:
1299  virtual void allocate_model_variables() = 0;
1301  virtual void update_model_variables() = 0;
1303  virtual void set_unsteady_model_time_step(const double time_step) = 0;
1307  virtual void set_use_auxiliary_eq() = 0;
1311  virtual void set_store_vol_flux_nodes() = 0;
1315  virtual void set_store_surf_flux_nodes() = 0;
1316 }; // end of DGBase class
1317 
1318 } // PHiLiP namespace
1319 
1320 #endif
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:264
dealii::SparsityPattern get_d2RdWdXs_sparsity_pattern()
Evaluate SparsityPattern of the residual Hessian dual.d2RdXsdW.
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 > &soln_basis_int, OPERATOR::basis_functions< dim, 2 *dim > &soln_basis_ext, OPERATOR::basis_functions< dim, 2 *dim > &flux_basis_int, OPERATOR::basis_functions< dim, 2 *dim > &flux_basis_ext, OPERATOR::local_basis_stiffness< dim, 2 *dim > &flux_basis_stiffness, OPERATOR::vol_projection_operator< dim, 2 *dim > &soln_basis_projection_oper_int, OPERATOR::vol_projection_operator< dim, 2 *dim > &soln_basis_projection_oper_ext, OPERATOR::mapping_shape_functions< dim, 2 *dim > &mapping_basis)
Builds needed operators for cell residual loop.
Definition: dg_base.cpp:2553
std::enable_if<!std::is_same< adtype, double >::value, void >::type assemble_face_codi_taped_derivatives_ad(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, 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, const dealii::FESystem< dim, dim > &fe_int, const dealii::FESystem< dim, dim > &fe_ext, const std::vector< dealii::types::global_dof_index > &soln_dofs_indices_int, const std::vector< dealii::types::global_dof_index > &soln_dofs_indices_ext, const std::vector< dealii::types::global_dof_index > &metric_dofs_indices_int, const std::vector< dealii::types::global_dof_index > &metric_dofs_indices_ext, 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 > &soln_basis_int, OPERATOR::basis_functions< dim, 2 *dim > &soln_basis_ext, OPERATOR::basis_functions< dim, 2 *dim > &flux_basis_int, OPERATOR::basis_functions< dim, 2 *dim > &flux_basis_ext, OPERATOR::local_basis_stiffness< dim, 2 *dim > &flux_basis_stiffness, OPERATOR::vol_projection_operator< dim, 2 *dim > &soln_basis_projection_oper_int, OPERATOR::vol_projection_operator< dim, 2 *dim > &soln_basis_projection_oper_ext, OPERATOR::metric_operators< adtype, dim, 2 *dim > &metric_oper_int, OPERATOR::metric_operators< adtype, dim, 2 *dim > &metric_oper_ext, OPERATOR::mapping_shape_functions< dim, 2 *dim > &mapping_basis, std::array< std::vector< adtype >, dim > &mapping_support_points, std::vector< real > &local_rhs_int_cell, std::vector< real > &local_rhs_ext_cell, dealii::Tensor< 1, dim, std::vector< 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, const bool is_a_subface=false, const unsigned int neighbor_i_subface=0)
Computes face term of the cell and performs automatic differentiation.
Definition: dg_base.cpp:1607
codi::RealReverseIndexVec< dimReverseAD > codi_JacobianComputationType
Reverse mode type for Jacobian computation using TapeHelper.
Definition: ADTypes.hpp:20
void add_time_scaled_mass_matrices()
Add time scaled mass matrices to the system.
Definition: dg_base.cpp:4446
const dealii::hp::FECollection< dim > fe_collection_lagrange
Lagrange basis used in strong form.
Definition: dg_base.hpp:1137
dealii::SparsityPattern get_d2RdXdX_sparsity_pattern()
Evaluate SparsityPattern of the residual Hessian dual.d2RdXdX.
void allocate_artificial_dissipation()
Allocates variables of artificial dissipation.
Definition: dg_base.cpp:3606
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:2363
void add_mass_matrices(const real scale)
Add mass matrices to the system scaled by a factor (likely time-step)
Definition: dg_base.cpp:4441
double max_artificial_dissipation_coeff
Stores maximum artificial dissipation while assembling the residual.
Definition: dg_base.hpp:1295
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:4089
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:328
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:1150
virtual void assemble_boundary_term_and_build_operators_ad(typename dealii::DoFHandler< dim >::active_cell_iterator cell, const dealii::types::global_dof_index current_cell_index, const std::vector< double > &soln_coeffs, const dealii::Tensor< 1, dim, std::vector< double >> &aux_soln_coeffs, const std::vector< double > &metric_coeffs, const std::vector< real > &local_dual, const unsigned int face_number, const unsigned int boundary_id, const unsigned int poly_degree, const unsigned int grid_degree, OPERATOR::basis_functions< dim, 2 *dim > &soln_basis, OPERATOR::basis_functions< dim, 2 *dim > &flux_basis, OPERATOR::vol_projection_operator< dim, 2 *dim > &soln_basis_projection_oper_int, OPERATOR::metric_operators< double, dim, 2 *dim > &metric_oper, OPERATOR::mapping_shape_functions< dim, 2 *dim > &mapping_basis, std::array< std::vector< double >, dim > &mapping_support_points, dealii::hp::FEFaceValues< dim, dim > &fe_values_collection_face_int, const dealii::FESystem< dim, dim > &fe_soln, const real penalty, std::vector< double > &rhs, dealii::Tensor< 1, dim, std::vector< double >> &local_auxiliary_RHS, const bool compute_auxiliary_right_hand_side, double &dual_dot_residual)=0
Builds the necessary operators/fe values and assembles boundary residual. For double type...
dealii::LinearAlgebra::distributed::Vector< double > artificial_dissipation_c0
Artificial dissipation coefficients.
Definition: dg_base.hpp:1196
dealii::TrilinosWrappers::SparseMatrix dRdXv
Definition: dg_base.hpp:356
const dealii::FE_Q< dim > fe_q_artificial_dissipation
Continuous distribution of artificial dissipation.
Definition: dg_base.hpp:1190
double assemble_residual_time
Computational time for assembling residual.
Definition: dg_base.hpp:1184
dealii::ConditionalOStream pcout
Parallel std::cout that only outputs on mpi_rank==0.
Definition: dg_base.hpp:1259
dealii::IndexSet ghost_dofs
Locally relevant ghost degrees of freedom.
Definition: dg_base.hpp:399
bool freeze_artificial_dissipation
Flag to freeze artificial dissipation.
Definition: dg_base.hpp:1293
virtual void set_store_surf_flux_nodes()=0
Set store_surf_flux_nodes flag.
virtual void allocate_second_derivatives()
Allocates the second derivatives.
Definition: dg_base.cpp:3625
void output_face_results_vtk(const unsigned int cycle, const double current_time=0.0, const bool output_time_averaged_solution=false, const bool output_fluctuating_quantities=false)
Output Euler face solution.
const dealii::UpdateFlags neighbor_face_update_flags
Update flags needed at neighbor&#39; face points.
Definition: dg_base.hpp:1219
dealii::hp::QCollection< dim-1 > face_quadrature_collection
Quadrature used to evaluate face integrals.
Definition: dg_base.hpp:1133
virtual void update_model_variables()=0
Update the necessary variables declared in src/physics/model.h.
dealii::TrilinosWrappers::SparseMatrix global_mass_matrix_auxiliary
Global auxiliary mass matrix.
Definition: dg_base.hpp:336
dealii::LinearAlgebra::distributed::Vector< double > volume_nodes_d2R
Definition: dg_base.hpp:443
Files for the baseline physics.
Definition: ADTypes.hpp:10
dealii::DoFHandler< dim > dof_handler_artificial_dissipation
Degrees of freedom handler for C0 artificial dissipation.
Definition: dg_base.hpp:1193
dealii::TrilinosWrappers::SparseMatrix system_matrix_transpose
Definition: dg_base.hpp:347
void allocate_auxiliary_equation()
Allocates the auxiliary equations&#39; variables and right hand side (primarily for Strong form diffusive...
Definition: dg_base.cpp:3466
dealii::TrilinosWrappers::SparseMatrix global_mass_matrix
Global mass matrix.
Definition: dg_base.hpp:329
double get_residual_linfnorm() const
Returns the Linf-norm of the right_hand_side vector.
Definition: dg_base.cpp:2917
dealii::QGauss< 0 > oneD_face_quadrature
1D surface quadrature is always one single point for all poly degrees.
Definition: dg_base.hpp:1157
void reinit()
Reinitializes the DG object after a change of triangulation.
Definition: dg_base.cpp:112
std::enable_if<!std::is_same< adtype, double >::value, void >::type assemble_boundary_codi_taped_derivatives_ad(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 > &soln_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 > &soln_basis, OPERATOR::basis_functions< dim, 2 *dim > &flux_basis, OPERATOR::vol_projection_operator< dim, 2 *dim > &soln_basis_projection_oper_int, OPERATOR::metric_operators< adtype, dim, 2 *dim > &metric_oper, OPERATOR::mapping_shape_functions< dim, 2 *dim > &mapping_basis, std::array< std::vector< adtype >, dim > &mapping_support_points, dealii::hp::FEFaceValues< dim, dim > &fe_values_collection_face_int, const dealii::FESystem< dim, dim > &fe_soln, std::vector< real > &local_rhs_cell, dealii::Tensor< 1, dim, std::vector< real >> &local_auxiliary_RHS, const bool compute_auxiliary_right_hand_side, const bool compute_dRdW, const bool compute_dRdX, const bool compute_d2R)
Computes boundary term of the cell if the cell has a face at the boundary and performs automatic diff...
Definition: dg_base.cpp:1246
std::shared_ptr< HighOrderGrid< dim, real, MeshType > > high_order_grid
High order grid that will provide the MappingFEField.
Definition: dg_base.hpp:1178
double get_residual_l2norm() const
Returns the L2-norm of the right_hand_side vector.
Definition: dg_base.cpp:2965
const int nstate
Number of state variables.
Definition: dg_base.hpp:96
virtual ~DGBase()=default
Destructor.
dealii::IndexSet ghost_dofs_grid
Locally relevant ghost degrees of freedom for the grid.
Definition: dg_base.hpp:403
dealii::hp::QCollection< dim > volume_quadrature_collection
Finite Element Collection to represent the high-order grid.
Definition: dg_base.hpp:1131
-th order modal derivative of basis fuctions, ie/
Definition: operators.h:544
void set_anisotropic_flags()
Set anisotropic flags based on jump indicator.
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 > &basis, OPERATOR::local_mass< dim, 2 *dim > &reference_mass_matrix, OPERATOR::local_Flux_Reconstruction_operator< dim, 2 *dim > &reference_FR, OPERATOR::local_Flux_Reconstruction_operator_aux< dim, 2 *dim > &reference_FR_aux, OPERATOR::derivative_p< dim, 2 *dim > &deriv_p)
Evaluates the metric dependent local mass matrices and inverses, then sets them in the global matrice...
Definition: dg_base.cpp:3866
virtual void assemble_auxiliary_residual(const bool compute_dRdW, const bool compute_dRdX, const bool compute_d2R)=0
Asembles the auxiliary equations&#39; residuals and solves. Note: This function cannot be automatically d...
dealii::TrilinosWrappers::SparseMatrix d2RdWdX
Definition: dg_base.hpp:368
virtual void allocate_dual_vector(const bool compute_d2R)=0
Allocate the dual vector for optimization.
Main parameter class that contains the various other sub-parameter classes.
dealii::SparsityPattern get_d2RdXsdXs_sparsity_pattern()
Evaluate SparsityPattern of the residual Hessian dual.d2RdXsdXs.
std::unique_ptr< Epetra_RowMatrixTransposer > epetra_rowmatrixtransposer_dRdW
Epetra_RowMatrixTransposer used to transpose the system_matrix.
Definition: dg_base.hpp:350
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
dealii::LinearAlgebra::distributed::Vector< double > solution_dRdX
Definition: dg_base.hpp:433
dealii::Vector< double > artificial_dissipation_se
Artificial dissipation error ratio sensor in each cell.
Definition: dg_base.hpp:469
dealii::SparsityPattern get_dRdW_sparsity_pattern()
Evaluate SparsityPattern of dRdW.
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:292
ESFR correction matrix without jac dependence.
Definition: operators.h:564
Local mass matrix without jacobian dependence.
Definition: operators.h:461
dealii::DoFHandler< dim > dof_handler
Finite Element Collection to represent the high-order grid.
Definition: dg_base.hpp:1175
std::vector< real > evaluate_time_steps(const bool exact_time_stepping)
Evaluates the maximum stable time step.
unsigned int n_dofs() const
Number of degrees of freedom.
Definition: dg_base.cpp:3023
bool use_auxiliary_eq
Flag for using the auxiliary equation.
Definition: dg_base.hpp:1305
dealii::TrilinosWrappers::SparseMatrix system_matrix
Definition: dg_base.hpp:343
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 > &mapping_basis, OPERATOR::basis_functions< dim, 2 *dim > &basis, OPERATOR::local_mass< dim, 2 *dim > &reference_mass_matrix, OPERATOR::local_Flux_Reconstruction_operator< dim, 2 *dim > &reference_FR, OPERATOR::local_Flux_Reconstruction_operator_aux< dim, 2 *dim > &reference_FR_aux, OPERATOR::derivative_p< dim, 2 *dim > &deriv_p)
Builds needed operators to compute mass matrices/inverses efficiently.
Definition: dg_base.cpp:3661
dealii::Vector< double > cell_volume
Time it takes for the maximum wavespeed to cross the cell domain.
Definition: dg_base.hpp:454
const Parameters::AllParameters *const all_parameters
Pointer to all parameters.
Definition: dg_base.hpp:91
virtual void assemble_volume_term_and_build_operators_ad(typename dealii::DoFHandler< dim >::active_cell_iterator cell, const dealii::types::global_dof_index current_cell_index, const std::vector< double > &soln_coeffs, const dealii::Tensor< 1, dim, std::vector< double >> &aux_soln_coeffs, const std::vector< double > &metric_coeffs, const std::vector< real > &local_dual, const std::vector< dealii::types::global_dof_index > &soln_dofs_indices, const std::vector< dealii::types::global_dof_index > &metric_dofs_indices, const unsigned int poly_degree, const unsigned int grid_degree, OPERATOR::basis_functions< dim, 2 *dim > &soln_basis, OPERATOR::basis_functions< dim, 2 *dim > &flux_basis, OPERATOR::local_basis_stiffness< dim, 2 *dim > &flux_basis_stiffness, OPERATOR::vol_projection_operator< dim, 2 *dim > &soln_basis_projection_oper_int, OPERATOR::vol_projection_operator< dim, 2 *dim > &soln_basis_projection_oper_ext, OPERATOR::metric_operators< double, dim, 2 *dim > &metric_oper, OPERATOR::mapping_shape_functions< dim, 2 *dim > &mapping_basis, std::array< std::vector< double >, 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 > &fe_soln, std::vector< double > &rhs, dealii::Tensor< 1, dim, std::vector< double >> &local_auxiliary_RHS, const bool compute_auxiliary_right_hand_side, double &dual_dot_residual)=0
Builds the necessary operators/fe values and assembles volume residual. For double type...
dealii::IndexSet locally_owned_dofs_grid
Locally own degrees of freedom for the grid.
Definition: dg_base.hpp:402
MPI_Comm mpi_communicator
MPI communicator.
Definition: dg_base.hpp:1258
dealii::LinearAlgebra::distributed::Vector< double > dual_d2R
Definition: dg_base.hpp:446
void automatic_differentiation_indexing_1(const bool compute_dRdW, const bool compute_dRdX, const bool compute_d2R, const unsigned int n_soln_dofs, const unsigned int n_metric_dofs, unsigned int &w_start, unsigned int &w_end, unsigned int &x_start, unsigned int &x_end)
Definition: dg_base.cpp:2300
dealii::LinearAlgebra::distributed::Vector< double > volume_nodes_dRdW
Definition: dg_base.hpp:426
dealii::IndexSet locally_owned_dofs
Locally own degrees of freedom.
Definition: dg_base.hpp:398
Base metric operators class that stores functions used in both the volume and on surface.
Definition: operators.h:1131
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:2599
const unsigned int initial_degree
Initial polynomial degree assigned during constructor.
Definition: dg_base.hpp:99
dealii::SparsityPattern sparsity_pattern
Sparsity pattern used on the system_matrix.
Definition: dg_base.hpp:317
MeshType Triangulation
Definition: dg_base.hpp:89
ESFR correction matrix for AUX EQUATION without jac dependence.
Definition: operators.h:684
std::array< dealii::LinearAlgebra::distributed::Vector< double >, dim > auxiliary_solution
The auxiliary equations&#39; solution.
Definition: dg_base.hpp:419
void assemble_cell_residual_and_ad_derivatives(const dealii::TriaActiveIterator< dealii::DoFCellAccessor< dim, dim, false >> &current_cell, const dealii::TriaActiveIterator< dealii::DoFCellAccessor< dim, dim, false >> &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 > &soln_basis_int, OPERATOR::basis_functions< dim, 2 *dim > &soln_basis_ext, OPERATOR::basis_functions< dim, 2 *dim > &flux_basis_int, OPERATOR::basis_functions< dim, 2 *dim > &flux_basis_ext, OPERATOR::local_basis_stiffness< dim, 2 *dim > &flux_basis_stiffness, OPERATOR::vol_projection_operator< dim, 2 *dim > &soln_basis_projection_oper_int, OPERATOR::vol_projection_operator< dim, 2 *dim > &soln_basis_projection_oper_ext, OPERATOR::mapping_shape_functions< dim, 2 *dim > &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:453
The mapping shape functions evaluated at the desired nodes (facet set included in volume grid nodes f...
Definition: operators.h:1071
double getValue(const real2 &x)
Returns the value from a CoDiPack variable.
Definition: dg_base.cpp:2290
dealii::Vector< double > max_dt_cell
Time it takes for the maximum wavespeed to cross the cell domain.
Definition: dg_base.hpp:461
virtual void allocate_model_variables()=0
Allocate the necessary variables declared in src/physics/model.h.
unsigned int get_min_fe_degree()
Gets the minimum value of currently active FE degree.
Definition: dg_base.cpp:316
dealii::SparsityPattern get_d2RdWdX_sparsity_pattern()
Evaluate SparsityPattern of the residual Hessian dual.d2RdXdW.
dealii::LinearAlgebra::distributed::Vector< double > solution_dRdW
Definition: dg_base.hpp:423
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 initialize_manufactured_solution()
Virtual function defined in DG.
dealii::IndexSet locally_relevant_dofs_grid
Definition: dg_base.hpp:404
virtual void set_use_auxiliary_eq()=0
Set use_auxiliary_eq flag.
dealii::LinearAlgebra::distributed::Vector< double > volume_nodes_dRdX
Definition: dg_base.hpp:436
dealii::LinearAlgebra::distributed::Vector< double > right_hand_side
Residual of the current solution.
Definition: dg_base.hpp:396
dealii::hp::QCollection< 1 > oneD_quadrature_collection
1D quadrature to generate Lagrange polynomials for the sake of flux interpolation.
Definition: dg_base.hpp:1155
const dealii::UpdateFlags volume_update_flags
Update flags needed at volume points.
Definition: dg_base.hpp:1212
std::array< dealii::LinearAlgebra::distributed::Vector< double >, dim > auxiliary_right_hand_side
The auxiliary equations&#39; right hand sides.
Definition: dg_base.hpp:416
dealii::TrilinosWrappers::SparseMatrix d2RdXdX
Definition: dg_base.hpp:364
virtual void build_volume_metric_operators(const unsigned int poly_degree, const unsigned int grid_degree, const std::vector< double > &metric_coeffs, OPERATOR::metric_operators< double, dim, 2 *dim > &metric_oper, OPERATOR::mapping_shape_functions< dim, 2 *dim > &mapping_basis, std::array< std::vector< double >, dim > &mapping_support_points)=0
Builds volume metric operators (metric cofactor and determinant of metric Jacobian). For double type.
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:4571
dealii::LinearAlgebra::distributed::Vector< double > solution
Current modal coefficients of the solution.
Definition: dg_base.hpp:409
virtual void set_unsteady_model_time_step(const double time_step)=0
Set the unsteady time step variable declared in src/physics/model.h.
dealii::LinearAlgebra::distributed::Vector< real > dual
Current optimization dual variables corresponding to the residual constraints also known as the adjoi...
Definition: dg_base.hpp:483
bool store_surf_flux_nodes
Flag for storing surface flux nodes.
Definition: dg_base.hpp:1313
void update_artificial_dissipation_discontinuity_sensor()
Update discontinuity sensor.
Definition: dg_base.cpp:2369
codi::RealReversePrimalIndexGen< codi::RealForwardVec< dimForwardAD >, codi::Direction< codi::RealForwardVec< dimForwardAD >, dimReverseAD > > codi_HessianComputationType
Nested reverse-forward mode type for Jacobian and Hessian computation using TapeHelper.
Definition: ADTypes.hpp:23
real evaluate_penalty_scaling(const DoFCellAccessorType &cell, const int iface, const dealii::hp::FECollection< dim > fe_collection) const
Definition: dg_base.cpp:397
const dealii::hp::FECollection< 1 > oneD_fe_collection
1D Finite Element Collection for p-finite-element to represent the solution
Definition: dg_base.hpp:1143
dealii::SparsityPattern mass_sparsity_pattern
Sparsity pattern used on the system_matrix.
Definition: dg_base.hpp:321
const unsigned int max_degree
Maximum degree used for p-refi1nement.
Definition: dg_base.hpp:104
dealii::Vector< double > artificial_dissipation_coeffs
Artificial dissipation in each cell.
Definition: dg_base.hpp:466
real current_time
The current time set in set_current_time()
Definition: dg_base.hpp:1188
dealii::IndexSet locally_relevant_dofs
Union of locally owned degrees of freedom and relevant ghost degrees of freedom.
Definition: dg_base.hpp:400
dealii::SparsityPattern get_dRdXs_sparsity_pattern()
Evaluate SparsityPattern of dRdXs.
double CFL_mass_dRdW
CFL used to add mass matrix in the optimization FlowConstraints class.
Definition: dg_base.hpp:429
dealii::TrilinosWrappers::SparseMatrix global_inverse_mass_matrix
Global inverser mass matrix.
Definition: dg_base.hpp:332
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:4659
dealii::TrilinosWrappers::SparseMatrix time_scaled_global_mass_matrix
Global mass matrix divided by the time scales.
Definition: dg_base.hpp:325
const dealii::UpdateFlags face_update_flags
Update flags needed at face points.
Definition: dg_base.hpp:1215
dealii::TrilinosWrappers::SparseMatrix get_dRdX_finite_differences(dealii::SparsityPattern dRdX_sparsity_pattern)
Evaluate dRdX using finite-differences.
const unsigned int max_grid_degree
Maximum grid degree used for hp-refi1nement.
Definition: dg_base.hpp:109
dealii::SparsityPattern get_d2RdWdW_sparsity_pattern()
Evaluate SparsityPattern of the residual Hessian dual.d2RdWdW.
void evaluate_mass_matrices(bool do_inverse_mass_matrix=false)
Allocates and evaluates the mass matrices for the entire grid.
Definition: dg_base.cpp:3699
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:4492
std::shared_ptr< Triangulation > triangulation
Mesh.
Definition: dg_base.hpp:160
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:417
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
const dealii::hp::FECollection< dim > fe_collection
Finite Element Collection for p-finite-element to represent the solution.
Definition: dg_base.hpp:1120
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:4263
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
DGBase is independent of the number of state variables.
Definition: dg_base.hpp:82
const dealii::hp::FECollection< 1 > oneD_fe_collection_flux
1D collocated flux basis used in strong form
Definition: dg_base.hpp:1153
void time_scaled_mass_matrices(const real scale)
Definition: dg_base.cpp:4451
virtual void set_store_vol_flux_nodes()=0
Set store_vol_flux_nodes flag.
std::enable_if<!std::is_same< adtype, double >::value, void >::type assemble_volume_codi_taped_derivatives_ad(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 > &soln_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 > &soln_basis, OPERATOR::basis_functions< dim, 2 *dim > &flux_basis, OPERATOR::local_basis_stiffness< dim, 2 *dim > &flux_basis_stiffness, OPERATOR::vol_projection_operator< dim, 2 *dim > &soln_basis_projection_oper_int, OPERATOR::vol_projection_operator< dim, 2 *dim > &soln_basis_projection_oper_ext, OPERATOR::metric_operators< adtype, dim, 2 *dim > &metric_oper, OPERATOR::mapping_shape_functions< dim, 2 *dim > &mapping_basis, std::array< std::vector< adtype >, 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 > &fe_soln, std::vector< real > &local_rhs_cell, dealii::Tensor< 1, dim, std::vector< real >> &local_auxiliary_RHS, const bool compute_auxiliary_right_hand_side, const bool compute_dRdW, const bool compute_dRdX, const bool compute_d2R)
Computes the volume term of the cell and performs automatic differentiation.
Definition: dg_base.cpp:985
void automatic_differentiation_indexing_2(const bool compute_dRdW, const bool compute_dRdX, const bool compute_d2R, const unsigned int n_soln_dofs_int, const unsigned int n_soln_dofs_ext, const unsigned int n_metric_dofs, unsigned int &w_int_start, unsigned int &w_int_end, unsigned int &w_ext_start, unsigned int &w_ext_end, unsigned int &x_int_start, unsigned int &x_int_end, unsigned int &x_ext_start, unsigned int &x_ext_end)
Definition: dg_base.cpp:2327
virtual void allocate_dRdX()
Allocates the residual derivatives w.r.t the volume nodes.
Definition: dg_base.cpp:3651
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
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:3478
unsigned int get_max_fe_degree()
Gets the maximum value of currently active FE degree.
Definition: dg_base.cpp:304
Projection operator corresponding to basis functions onto M-norm (L2).
Definition: operators.h:723
dealii::SparsityPattern get_dRdX_sparsity_pattern()
Evaluate SparsityPattern of dRdX.
Local stiffness matrix without jacobian dependence.
Definition: operators.h:497
virtual void assemble_face_term_and_build_operators_ad(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 std::vector< double > &soln_coeff_int, const std::vector< double > &soln_coeff_ext, const dealii::Tensor< 1, dim, std::vector< double >> &aux_soln_coeff_int, const dealii::Tensor< 1, dim, std::vector< double >> &aux_soln_coeff_ext, const std::vector< double > &metric_coefF_int, const std::vector< double > &metric_coefF_ext, const std::vector< double > &dual_int, const std::vector< double > &dual_ext, 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 > &soln_basis_int, OPERATOR::basis_functions< dim, 2 *dim > &soln_basis_ext, OPERATOR::basis_functions< dim, 2 *dim > &flux_basis_int, OPERATOR::basis_functions< dim, 2 *dim > &flux_basis_ext, OPERATOR::local_basis_stiffness< dim, 2 *dim > &flux_basis_stiffness, OPERATOR::vol_projection_operator< dim, 2 *dim > &soln_basis_projection_oper_int, OPERATOR::vol_projection_operator< dim, 2 *dim > &soln_basis_projection_oper_ext, OPERATOR::metric_operators< double, dim, 2 *dim > &metric_oper_int, OPERATOR::metric_operators< double, dim, 2 *dim > &metric_oper_ext, OPERATOR::mapping_shape_functions< dim, 2 *dim > &mapping_basis, std::array< std::vector< double >, 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::hp::FESubfaceValues< dim, dim > &fe_values_collection_subface, const dealii::FESystem< dim, dim > &fe_int, const dealii::FESystem< dim, dim > &fe_ext, const real penalty, std::vector< double > &rhs_int, std::vector< double > &rhs_ext, dealii::Tensor< 1, dim, std::vector< double >> &aux_rhs_int, dealii::Tensor< 1, dim, std::vector< double >> &aux_rhs_ext, const bool compute_auxiliary_right_hand_side, double &dual_dot_residual, const bool compute_dRdW, const bool compute_dRdX, const bool compute_d2R, const bool is_a_subface, const unsigned int neighbor_i_subface)=0
Builds the necessary operators/fe values and assembles face residual. For double type.
void output_results_vtk(const unsigned int cycle, const double current_time=0.0, const bool output_time_averaged_solution=false, const bool output_fluctuating_quantities=false)
Output solution.
Definition: dg_base.cpp:3339
dealii::LinearAlgebra::distributed::Vector< double > solution_d2R
Definition: dg_base.hpp:440
dealii::TrilinosWrappers::SparseMatrix d2RdWdW
Definition: dg_base.hpp:360
dealii::TrilinosWrappers::SparseMatrix global_inverse_mass_matrix_auxiliary
Global inverse of the auxiliary mass matrix.
Definition: dg_base.hpp:339
bool store_vol_flux_nodes
Flag for storing volume flux nodes.
Definition: dg_base.hpp:1309