1 #ifndef PHILIP_DG_BASE_HPP 2 #define PHILIP_DG_BASE_HPP 4 #include <deal.II/base/conditional_ostream.h> 5 #include <deal.II/base/parameter_handler.h> 7 #include <deal.II/base/qprojector.h> 9 #include <deal.II/grid/tria.h> 11 #include <deal.II/fe/fe_dgq.h> 12 #include <deal.II/fe/fe_dgp.h> 13 #include <deal.II/fe/fe_system.h> 14 #include <deal.II/fe/mapping_fe_field.h> 17 #include <deal.II/dofs/dof_handler.h> 19 #include <deal.II/hp/q_collection.h> 20 #include <deal.II/hp/mapping_collection.h> 21 #include <deal.II/hp/fe_values.h> 23 #include <deal.II/lac/vector.h> 24 #include <deal.II/lac/sparsity_pattern.h> 25 #include <deal.II/lac/trilinos_sparse_matrix.h> 26 #include <deal.II/lac/trilinos_vector.h> 28 #include <Epetra_RowMatrixTransposer.h> 31 #include "ADTypes.hpp" 33 #include <CoDiPack/include/codi.hpp> 35 #include "mesh/high_order_grid.h" 36 #include "physics/physics.h" 37 #include "physics/model.h" 38 #include "numerical_flux/numerical_flux_factory.hpp" 39 #include "numerical_flux/convective_numerical_flux.hpp" 40 #include "numerical_flux/viscous_numerical_flux.hpp" 41 #include "parameters/all_parameters.h" 42 #include "operators/operators.h" 43 #include "artificial_dissipation_factory.h" 46 #include <deal.II/base/timer.h> 53 template<
int dim,
int nspecies,
typename real>
55 const std::vector< real > &function_coeff,
56 const dealii::FESystem<dim,dim> &fe_input,
57 const dealii::FESystem<dim,dim> &fe_output,
58 const dealii::QGauss<dim> &projection_quadrature);
77 #if PHILIP_DIM==1 // dealii::parallel::distributed::Triangulation<dim> does not work for 1D 78 template <
int dim,
int nspecies,
typename real,
typename MeshType = dealii::Triangulation<dim>>
80 template <
int dim,
int nspecies,
typename real,
typename MeshType = dealii::parallel::distributed::Triangulation<dim>>
121 DGBase(
const int nstate_input,
123 const unsigned int degree,
124 const unsigned int max_degree_input,
125 const unsigned int grid_degree_input,
126 const std::shared_ptr<Triangulation> triangulation_input);
138 dealii::hp::FECollection<dim>,
139 dealii::hp::QCollection<dim>,
140 dealii::hp::QCollection<dim-1>,
141 dealii::hp::FECollection<dim>,
142 dealii::hp::FECollection<1>,
143 dealii::hp::FECollection<1>,
144 dealii::hp::FECollection<1>,
145 dealii::hp::QCollection<1> >;
152 DGBase(
const int nstate_input,
154 const unsigned int degree,
155 const unsigned int max_degree_input,
156 const unsigned int grid_degree_input,
157 const std::shared_ptr<Triangulation> triangulation_input,
185 const bool compute_dRdX =
true,
186 const bool compute_d2R =
true);
212 void time_scale_solution_update ( dealii::LinearAlgebra::distributed::Vector<double> &solution_update,
const real CFL )
const;
220 const unsigned int poly_degree_int,
221 const unsigned int poly_degree_ext,
222 const unsigned int grid_degree,
234 const bool Cartesian_element,
235 const unsigned int poly_degree,
236 const unsigned int grid_degree,
249 const bool Cartesian_element,
250 const bool do_inverse_mass_matrix,
251 const unsigned int poly_degree,
252 const unsigned int curr_grid_degree,
253 const unsigned int n_quad_pts,
254 const unsigned int n_dofs_cell,
255 const std::vector<dealii::types::global_dof_index> dofs_indices,
268 const dealii::LinearAlgebra::distributed::Vector<double> &input_vector,
269 dealii::LinearAlgebra::distributed::Vector<double> &output_vector,
282 const dealii::LinearAlgebra::distributed::Vector<double> &input_vector,
283 dealii::LinearAlgebra::distributed::Vector<double> &output_vector,
285 const bool use_unmodified_mass_matrix =
false);
308 unsigned int n_dofs()
const;
356 dealii::TrilinosWrappers::SparseMatrix
dRdXv;
360 dealii::TrilinosWrappers::SparseMatrix
d2RdWdW;
364 dealii::TrilinosWrappers::SparseMatrix
d2RdXdX;
368 dealii::TrilinosWrappers::SparseMatrix
d2RdWdX;
409 dealii::LinearAlgebra::distributed::Vector<double>
solution;
411 dealii::LinearAlgebra::distributed::Vector<double> time_averaged_solution;
413 dealii::LinearAlgebra::distributed::Vector<double> fluctuating_quantities;
446 dealii::LinearAlgebra::distributed::Vector<double>
dual_d2R;
463 dealii::Vector<double> reduced_mesh_weights;
471 template <
typename real2>
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);
483 dealii::LinearAlgebra::distributed::Vector<real>
dual;
486 void set_dual(
const dealii::LinearAlgebra::distributed::Vector<real> &dual_input);
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);
538 bool update_artificial_diss;
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);
578 template<
typename adtype>
580 const dealii::TriaActiveIterator<dealii::DoFCellAccessor<dim, dim, false>> ¤t_cell,
581 const dealii::TriaActiveIterator<dealii::DoFCellAccessor<dim, dim, false>> ¤t_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,
596 const bool compute_auxiliary_right_hand_side,
597 dealii::LinearAlgebra::distributed::Vector<double> &rhs,
598 std::array<dealii::LinearAlgebra::distributed::Vector<double>,dim> &rhs_aux);
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,
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);
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,
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);
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,
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,
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);
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,
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,
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);
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,
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,
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>> ¤t_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);
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,
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,
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>> ¤t_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);
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,
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;
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,
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,
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,
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,
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,
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,
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;
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,
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,
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,
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,
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,
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,
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,
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,
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;
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,
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,
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,
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;
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,
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,
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,
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;
1094 template <
typename real2>
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);
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);
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> ¤t_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> ¤t_cell_rhs,
1209 const dealii::FEValues<dim,dim> &fe_values_lagrange) = 0;
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;
1219 const dealii::UpdateFlags
neighbor_face_update_flags = dealii::update_values | dealii::update_gradients | dealii::update_quadrature_points | dealii::update_JxW_values;
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;
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;
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;
1267 template<
typename DoFCellAccessorType>
1269 const DoFCellAccessorType &cell,
1271 const dealii::hp::FECollection<dim> fe_collection)
const;
1281 template<
typename DoFCellAccessorType1,
typename DoFCellAccessorType2>
void time_scale_solution_update(dealii::LinearAlgebra::distributed::Vector< double > &solution_update, const real CFL) const
Scales a solution update with the appropriate maximum time step.
dealii::SparsityPattern get_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.
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 >> ¤t_cell_rhs_aux, dealii::LinearAlgebra::distributed::Vector< double > &rhs, std::array< dealii::LinearAlgebra::distributed::Vector< double >, dim > &rhs_aux, const bool compute_auxiliary_right_hand_side, const bool compute_dRdW, const bool compute_dRdX, const bool compute_d2R, const bool is_a_subface=false, const unsigned int neighbor_i_subface=0)
Computes face term of the cell and performs automatic differentiation.
codi::RealReverseIndexVec< dimReverseAD > codi_JacobianComputationType
Reverse mode type for Jacobian computation using TapeHelper.
void add_time_scaled_mass_matrices()
Add time scaled mass matrices to the system.
const dealii::hp::FECollection< dim > fe_collection_lagrange
Lagrange basis used in strong form.
dealii::SparsityPattern get_d2RdXdX_sparsity_pattern()
Evaluate SparsityPattern of the residual Hessian dual.d2RdXdX.
void allocate_artificial_dissipation()
Allocates variables of artificial dissipation.
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.
void add_mass_matrices(const real scale)
Add mass matrices to the system scaled by a factor (likely time-step)
double max_artificial_dissipation_coeff
Stores maximum artificial dissipation while assembling the residual.
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...
dealii::Point< dim > coordinates_of_highest_refined_cell(bool check_for_p_refined_cell=false)
Returns the coordinates of the most refined cell.
const dealii::hp::FECollection< 1 > oneD_fe_collection_1state
1D Finite Element Collection for p-finite-element to represent the solution for a single state...
virtual void assemble_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.
dealii::TrilinosWrappers::SparseMatrix dRdXv
const dealii::FE_Q< dim > fe_q_artificial_dissipation
Continuous distribution of artificial dissipation.
double assemble_residual_time
Computational time for assembling residual.
dealii::ConditionalOStream pcout
Parallel std::cout that only outputs on mpi_rank==0.
dealii::IndexSet ghost_dofs
Locally relevant ghost degrees of freedom.
bool freeze_artificial_dissipation
Flag to freeze artificial dissipation.
virtual void set_store_surf_flux_nodes()=0
Set store_surf_flux_nodes flag.
virtual void allocate_second_derivatives()
Allocates the second derivatives.
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' face points.
dealii::hp::QCollection< dim-1 > face_quadrature_collection
Quadrature used to evaluate face integrals.
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.
dealii::LinearAlgebra::distributed::Vector< double > volume_nodes_d2R
Files for the baseline physics.
dealii::DoFHandler< dim > dof_handler_artificial_dissipation
Degrees of freedom handler for C0 artificial dissipation.
dealii::TrilinosWrappers::SparseMatrix system_matrix_transpose
void allocate_auxiliary_equation()
Allocates the auxiliary equations' variables and right hand side (primarily for Strong form diffusive...
dealii::TrilinosWrappers::SparseMatrix global_mass_matrix
Global mass matrix.
double get_residual_linfnorm() const
Returns the Linf-norm of the right_hand_side vector.
dealii::QGauss< 0 > oneD_face_quadrature
1D surface quadrature is always one single point for all poly degrees.
void reinit()
Reinitializes the DG object after a change of triangulation.
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...
std::shared_ptr< HighOrderGrid< dim, real, MeshType > > high_order_grid
High order grid that will provide the MappingFEField.
double get_residual_l2norm() const
Returns the L2-norm of the right_hand_side vector.
const int nstate
Number of state variables.
virtual ~DGBase()=default
Destructor.
dealii::IndexSet ghost_dofs_grid
Locally relevant ghost degrees of freedom for the grid.
dealii::hp::QCollection< dim > volume_quadrature_collection
Finite Element Collection to represent the high-order grid.
-th order modal derivative of basis fuctions, ie/
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...
virtual void assemble_auxiliary_residual(const bool compute_dRdW, const bool compute_dRdX, const bool compute_d2R)=0
Asembles the auxiliary equations' residuals and solves. Note: This function cannot be automatically d...
dealii::TrilinosWrappers::SparseMatrix d2RdWdX
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.
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.
dealii::LinearAlgebra::distributed::Vector< double > solution_dRdX
dealii::Vector< double > artificial_dissipation_se
Artificial dissipation error ratio sensor in each cell.
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.
ESFR correction matrix without jac dependence.
Local mass matrix without jacobian dependence.
dealii::DoFHandler< dim > dof_handler
Finite Element Collection to represent the high-order grid.
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.
bool use_auxiliary_eq
Flag for using the auxiliary equation.
dealii::TrilinosWrappers::SparseMatrix system_matrix
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.
dealii::Vector< double > cell_volume
Time it takes for the maximum wavespeed to cross the cell domain.
const Parameters::AllParameters *const all_parameters
Pointer to all parameters.
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.
MPI_Comm mpi_communicator
MPI communicator.
dealii::LinearAlgebra::distributed::Vector< double > dual_d2R
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)
dealii::LinearAlgebra::distributed::Vector< double > volume_nodes_dRdW
dealii::IndexSet locally_owned_dofs
Locally own degrees of freedom.
Base metric operators class that stores functions used in both the volume and on surface.
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.
const unsigned int initial_degree
Initial polynomial degree assigned during constructor.
dealii::SparsityPattern sparsity_pattern
Sparsity pattern used on the system_matrix.
ESFR correction matrix for AUX EQUATION without jac dependence.
std::array< dealii::LinearAlgebra::distributed::Vector< double >, dim > auxiliary_solution
The auxiliary equations' solution.
void assemble_cell_residual_and_ad_derivatives(const dealii::TriaActiveIterator< dealii::DoFCellAccessor< dim, dim, false >> ¤t_cell, const dealii::TriaActiveIterator< dealii::DoFCellAccessor< dim, dim, false >> ¤t_metric_cell, const bool compute_dRdW, const bool compute_dRdX, const bool compute_d2R, dealii::hp::FEValues< dim, dim > &fe_values_collection_volume, dealii::hp::FEFaceValues< dim, dim > &fe_values_collection_face_int, dealii::hp::FEFaceValues< dim, dim > &fe_values_collection_face_ext, dealii::hp::FESubfaceValues< dim, dim > &fe_values_collection_subface, dealii::hp::FEValues< dim, dim > &fe_values_collection_volume_lagrange, OPERATOR::basis_functions< dim, 2 *dim > &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().
The mapping shape functions evaluated at the desired nodes (facet set included in volume grid nodes f...
double getValue(const real2 &x)
Returns the value from a CoDiPack variable.
dealii::Vector< double > max_dt_cell
Time it takes for the maximum wavespeed to cross the cell domain.
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.
dealii::SparsityPattern get_d2RdWdX_sparsity_pattern()
Evaluate SparsityPattern of the residual Hessian dual.d2RdXdW.
dealii::LinearAlgebra::distributed::Vector< double > solution_dRdW
virtual void assemble_volume_term_explicit(typename dealii::DoFHandler< dim >::active_cell_iterator cell, const dealii::types::global_dof_index current_cell_index, const dealii::FEValues< dim, dim > &fe_values_volume, const std::vector< dealii::types::global_dof_index > ¤t_dofs_indices, const std::vector< dealii::types::global_dof_index > &metric_dof_indices, const unsigned int poly_degree, const unsigned int grid_degree, dealii::Vector< real > ¤t_cell_rhs, const dealii::FEValues< dim, dim > &fe_values_lagrange)=0
Evaluate the integral over the cell volume.
void initialize_manufactured_solution()
Virtual function defined in DG.
dealii::IndexSet locally_relevant_dofs_grid
virtual void set_use_auxiliary_eq()=0
Set use_auxiliary_eq flag.
dealii::LinearAlgebra::distributed::Vector< double > volume_nodes_dRdX
dealii::LinearAlgebra::distributed::Vector< double > right_hand_side
Residual of the current solution.
dealii::hp::QCollection< 1 > oneD_quadrature_collection
1D quadrature to generate Lagrange polynomials for the sake of flux interpolation.
const dealii::UpdateFlags volume_update_flags
Update flags needed at volume points.
std::array< dealii::LinearAlgebra::distributed::Vector< double >, dim > auxiliary_right_hand_side
The auxiliary equations' right hand sides.
dealii::TrilinosWrappers::SparseMatrix d2RdXdX
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)
dealii::LinearAlgebra::distributed::Vector< double > solution
Current modal coefficients of the solution.
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...
bool store_surf_flux_nodes
Flag for storing surface flux nodes.
void update_artificial_dissipation_discontinuity_sensor()
Update discontinuity sensor.
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.
real evaluate_penalty_scaling(const DoFCellAccessorType &cell, const int iface, const dealii::hp::FECollection< dim > fe_collection) const
const dealii::hp::FECollection< 1 > oneD_fe_collection
1D Finite Element Collection for p-finite-element to represent the solution
dealii::SparsityPattern mass_sparsity_pattern
Sparsity pattern used on the system_matrix.
const unsigned int max_degree
Maximum degree used for p-refi1nement.
dealii::Vector< double > artificial_dissipation_coeffs
Artificial dissipation in each cell.
real current_time
The current time set in set_current_time()
dealii::IndexSet locally_relevant_dofs
Union of locally owned degrees of freedom and relevant ghost degrees of freedom.
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.
dealii::TrilinosWrappers::SparseMatrix global_inverse_mass_matrix
Global inverser mass matrix.
void set_current_time(const real current_time_input)
Sets the current time within DG to be used for unsteady source terms.
dealii::TrilinosWrappers::SparseMatrix time_scaled_global_mass_matrix
Global mass matrix divided by the time scales.
const dealii::UpdateFlags face_update_flags
Update flags needed at face points.
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.
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.
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...
std::shared_ptr< Triangulation > triangulation
Mesh.
bool current_cell_should_do_the_work(const DoFCellAccessorType1 ¤t_cell, const DoFCellAccessorType2 &neighbor_cell) const
In the case that two cells have the same coarseness, this function decides if the current cell should...
MassiveCollectionTuple create_collection_tuple(const unsigned int max_degree, const int nstate, const Parameters::AllParameters *const parameters_input) const
Used in the delegated constructor.
const dealii::hp::FECollection< dim > fe_collection
Finite Element Collection for p-finite-element to represent the solution.
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.
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.
DGBase is independent of the number of state variables.
const dealii::hp::FECollection< 1 > oneD_fe_collection_flux
1D collocated flux basis used in strong form
void time_scaled_mass_matrices(const real scale)
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.
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)
virtual void allocate_dRdX()
Allocates the residual derivatives w.r.t the volume nodes.
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.
virtual void allocate_system(const bool compute_dRdW=true, const bool compute_dRdX=true, const bool compute_d2R=true)
Allocates the system.
unsigned int get_max_fe_degree()
Gets the maximum value of currently active FE degree.
Projection operator corresponding to basis functions onto M-norm (L2).
dealii::SparsityPattern get_dRdX_sparsity_pattern()
Evaluate SparsityPattern of dRdX.
Local stiffness matrix without jacobian dependence.
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.
dealii::LinearAlgebra::distributed::Vector< double > solution_d2R
dealii::TrilinosWrappers::SparseMatrix d2RdWdW
dealii::TrilinosWrappers::SparseMatrix global_inverse_mass_matrix_auxiliary
Global inverse of the auxiliary mass matrix.
bool store_vol_flux_nodes
Flag for storing volume flux nodes.