TrioCFD 1.9.8
TrioCFD documentation
Loading...
Searching...
No Matches
Domaine_DG.h
1
2/****************************************************************************
3* Copyright (c) 2023, CEA
4* All rights reserved.
5*
6* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
7* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
8* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
9* 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
10*
11* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
12* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
13* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
14*
15*****************************************************************************/
16
17#ifndef Domaine_DG_included
18#define Domaine_DG_included
19
20#include <Domaine_Poly_base.h>
21#include <Option_DG.h>
22#include <Matrix_tools.h>
23#include <memory>
24#include <map>
25#include <tuple>
26
27class Quadrature_base;
28class BasisFunction;
29
31{
32 Declare_instanciable(Domaine_DG);
33
34public :
35
36 void discretiser() override;
37 void init_equiv() const override;
38
39 inline const DoubleTab& get_dia() const { return dia_; }
40 inline const DoubleTab& get_invdia() const { return invdia_; }
41 inline const DoubleTab& get_per() const { return per_; }
42 inline const DoubleTab& get_rho() const { return rho_; }
43 inline const DoubleTab& get_sig() const { return sig_; }
44 inline const IntTab& get_nfaces_elem() const { return nfaces_elem_; }
45 inline const TRUST_Deriv<Elem_poly_base> get_type_elem() const { return type_elem_; }
46
47 inline const Quadrature_base& get_quadrature(int order) const;
48 inline const Quadrature_base& get_quadrature() const;
49
50 inline const Stencil& get_stencil_sorted() const { return stencil_sorted_;}
51
52 const BasisFunction& get_basisFunction(int order) const;
53
54 void set_default_order(int order);
55 void get_position(DoubleTab& positions) const override;
56 double compute_L1_norm(const DoubleVect& val_source, const bool basis_function, const int order) const override;
57 double compute_L2_norm(const DoubleVect& val_source, const bool basis_function, const int order) const override;
58 void compute_average(const DoubleVect& val_source, double& sum, double& average, const bool basis_function, const int order) const override;
59 void compute_average_porosity(const DoubleVect& val_source, const DoubleVect& porosity, double& sum, double& average, const bool basis_function, const int order) const override;
60 void get_nb_integ_points(IntTab& nb_integ_points) const override;
61 void get_ind_integ_points(IntTab& ind_integ_points) const override;
62 int get_max_nb_integ_points() const override;
63
64 void calculer_h_carre() override;
65
66 inline const bool& gram_schmidt() const { return gram_schmidt_;}
67
68protected:
69
70 std::shared_ptr<Quadrature_base> quad1_; // Key: quadrature order, value: DoubleTab representing the quadrature barycenters for that order
71 std::shared_ptr<Quadrature_base> quad3_; // Key: quadrature order, value: DoubleTab representing the quadrature barycenters for that order
72 std::shared_ptr<Quadrature_base> quad5_; // Key: quadrature order, value: DoubleTab representing the quadrature barycenters for that order
73
74 DoubleTab dia_;
75 DoubleTab invdia_;
76 DoubleTab per_;
77 DoubleTab rho_;
78 DoubleTab sig_;
80 int order_quad_=-1; // 3*(Option_DG::DEFAULT_ORDER==1)+5*(Option_DG::DEFAULT_ORDER==2)
81 bool gram_schmidt_ = true; // init from Option_DG::GRAM_SCHMIDT which is 1 by default
82
83 Stencil stencil_sorted_; //table of stencil sorted for each elements
84
85 void compute_mesh_param(); // Compute the stabilization parameters
86 bool build_nfaces_elem_();
87
89 {
90 int order;
91 bool operator<(const BasisFunction_Key& other) const
92 {
93 return order < other.order;
94 }
95 };
96
97 mutable std::map<BasisFunction_Key, std::shared_ptr<BasisFunction>> bfunc_maps_;
98};
99
101{
102 switch(order)
103 {
104 case 1:
105 return *quad1_;
106 case 3:
107 return *quad3_;
108 case 5:
109 return *quad5_;
110 default:
111 Process::exit("Quadrature order not implemented yet");
112 }
113
114 return *quad1_;
115}
116
117const Quadrature_base& Domaine_DG::get_quadrature() const // overloaded to give the defaut order, depending of the order of the method
118{
120}
121
122#endif /* Domaine_DG_included */
Manages the local polynomial basis functions for Discontinuous Galerkin elements.
DoubleTab invdia_
Definition Domaine_DG.h:75
std::shared_ptr< Quadrature_base > quad3_
Definition Domaine_DG.h:71
IntTab nfaces_elem_
Definition Domaine_DG.h:79
DoubleTab rho_
Definition Domaine_DG.h:77
std::shared_ptr< Quadrature_base > quad1_
Definition Domaine_DG.h:70
DoubleTab per_
Definition Domaine_DG.h:76
void init_equiv() const override
New feature in Trust, not yet available in DG, ask Elie.
bool build_nfaces_elem_()
Create an array that store the number of faces per element.
void get_ind_integ_points(IntTab &ind_integ_points) const override
Create the indirection that give for each cell, the index number of the first integration point.
int get_max_nb_integ_points() const override
DoubleTab sig_
Definition Domaine_DG.h:78
void discretiser() override
Compute mesh parameters, allocate quadratures and link them to the domain.
const DoubleTab & get_rho() const
Definition Domaine_DG.h:42
double compute_L1_norm(const DoubleVect &val_source, const bool basis_function, const int order) const override
Compute L_1 norm.
const DoubleTab & get_dia() const
Definition Domaine_DG.h:39
std::map< BasisFunction_Key, std::shared_ptr< BasisFunction > > bfunc_maps_
Definition Domaine_DG.h:97
const DoubleTab & get_per() const
Definition Domaine_DG.h:41
bool gram_schmidt_
Definition Domaine_DG.h:81
void set_default_order(int order)
Set the global default order.
void get_nb_integ_points(IntTab &nb_integ_points) const override
Give an IntTab that contains the number of integration points for each cell.
void calculer_h_carre() override
Should disappear, as well as h_carre, as we have dia_, this come with a refactoring of Domaine_Poly_b...
const Stencil & get_stencil_sorted() const
Definition Domaine_DG.h:50
void compute_mesh_param()
Compute geometric quantities used for the computation TODO :: Put this in the Domain_Poly_base and de...
std::shared_ptr< Quadrature_base > quad5_
Definition Domaine_DG.h:72
double compute_L2_norm(const DoubleVect &val_source, const bool basis_function, const int order) const override
Compute L_2 norm.
Stencil stencil_sorted_
Definition Domaine_DG.h:83
int order_quad_
Definition Domaine_DG.h:80
void compute_average(const DoubleVect &val_source, double &sum, double &average, const bool basis_function, const int order) const override
Compute average.
const Quadrature_base & get_quadrature() const
Definition Domaine_DG.h:117
const TRUST_Deriv< Elem_poly_base > get_type_elem() const
Definition Domaine_DG.h:45
const DoubleTab & get_sig() const
Definition Domaine_DG.h:43
const bool & gram_schmidt() const
Definition Domaine_DG.h:66
const DoubleTab & get_invdia() const
Definition Domaine_DG.h:40
void get_position(DoubleTab &positions) const override
Compute positions of the quadrature points.
void compute_average_porosity(const DoubleVect &val_source, const DoubleVect &porosity, double &sum, double &average, const bool basis_function, const int order) const override
Compute average with porosity.
const IntTab & get_nfaces_elem() const
Definition Domaine_DG.h:44
const BasisFunction & get_basisFunction(int order) const
DoubleTab dia_
Definition Domaine_DG.h:74
class Domaine_Poly_base
static void exit(int exit_code=-1)
Routine de sortie de TRUST dans une region Kokkos.
Definition Process.cpp:455
bool operator<(const BasisFunction_Key &other) const
Definition Domaine_DG.h:91