TrioCFD 1.9.8
TrioCFD documentation
Loading...
Searching...
No Matches
Domaine_PolyMAC_CDO.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_PolyMAC_CDO_included
18#define Domaine_PolyMAC_CDO_included
19
20#include <Echange_global_impose.h>
21#include <Neumann_sortie_libre.h>
22#include <Domaine_Poly_base.h>
23#include <Matrice_Morse_Sym.h>
24#include <Neumann_homogene.h>
25#include <SolveurSys.h>
26#include <Periodique.h>
27#include <Dirichlet.h>
28#include <Symetrie.h>
29
31{
32 Declare_instanciable(Domaine_PolyMAC_CDO);
33public :
34 void discretiser() override;
35 void swap(int, int, int) { }
36 void modifier_pour_Cl(const Conds_lim& ) override;
37 void init_equiv() const override;
38
39 inline const IntTab& arete_faces() const { return arete_faces_; }
40 void calculer_volumes_entrelaces() override;
41 void calculer_h_carre() override;
42
43 inline double dot (const double *a, const double *b, const double *ma = nullptr, const double *mb = nullptr) const { return dot(dimension, a, b, ma, mb); }
44 KOKKOS_INLINE_FUNCTION double dot (const int dim, const double *a, const double *b, const double *ma = nullptr, const double *mb = nullptr) const;
45
46 IntVect cyclic; // cyclic(i) = 1 i le poly i est cyclique
47
48 //quelles structures optionelles on a initialise
49 mutable std::map<std::string, int> is_init;
50 //interpolations d'ordre 1 du vecteur vitesse aux elements
51 void init_ve() const;
52 mutable IntTab vedeb, veji; //reconstruction de ve par (veji, veci)[vedeb(e), vedeb(e + 1)[ (faces)
53 mutable DoubleTab veci;
54
55 //rotationnel aux faces d'un champ tangent aux aretes
56 void init_rf() const;
57 mutable IntTab rfdeb, rfji; //reconstruction du rotationnel par (rfji, rfci)[rfdeb(f), rfdeb(f + 1)[ (champ aux aretes)
58 mutable DoubleTab rfci;
59
60 //stabilisation d'une matrice de masse mimetique en un element : dans PolyMAC_CDO -> m1 ou m2
61 inline void ajouter_stabilisation(DoubleTab& M, DoubleTab& N) const;
62 inline int W_stabiliser(DoubleTab& W, DoubleTab& R, DoubleTab& N, int *ctr, double *spectre) const;
63
64 //matrice mimetique d'un champ aux faces : (valeur normale aux faces) -> (integrale lineaire sur les lignes brisees)
65 void init_m2() const;
66 // ToDo passer ces tableaux en IntVect et DoubleVect:
67 mutable IntTab m2d, m2i, m2j, w2i, w2j; //stockage: lignes de M_2^e dans m2i([m2d(e), m2d(e + 1)[), indices/coeffs de ces lignes dans (m2j/m2c)[m2i(i), m2i(i+1)[
68 mutable DoubleTab m2c, w2c; // avec le coeff diagonal en premier (facilite Echange_contact_PolyMAC_CDO)
69 void init_m2solv() const; //pour resoudre m2.v = s
72
73 //interpolation aux elements d'ordre 1 d'un champ defini par ses composantes tangentes aux aretes (ex. : la vorticite)
74 inline void init_we() const;
75 void init_we_2d() const;
76 void init_we_3d() const;
77 mutable IntTab wedeb, weji; //reconstruction de we par (weji, weci)[wedeb(e), wedeb(e + 1)[ (sommets en 2D, aretes en 3D)
78 mutable DoubleTab weci;
79
80 //matrice mimetique d'un champ aux aretes : (valeur tangente aux aretes) -> (flux a travers l'union des facettes touchant l'arete)
81 void init_m1() const;
82 void init_m1_2d() const;
83 void init_m1_3d() const;
84 mutable IntTab m1deb, m1ji; //reconstruction de m1 par (m1ji(.,0), m1ci)[m1deb(a), m1deb(a + 1)[ (sommets en 2D, aretes en 3D); m1ji(.,1) contient le numero d'element
85 mutable DoubleTab m1ci;
86
87 //std::map permettant de retrouver le couple (proc, item local) associe a un item virtuel pour le mdv_elem_faces
88 void init_virt_ef_map() const;
89 mutable std::map<std::array<int, 2>, int> virt_ef_map;
90
91 //matrices locales par elements (operateurs de Hodge) permettant de faire des interpolations :
92 void M2(const DoubleTab *nu, int e, DoubleTab& m2) const; //normales aux faces -> tangentes aux faces duales : (nu x_ef.v) = m2 (|f|n_ef.v)
93 void W2(const DoubleTab *nu, int e, DoubleTab& w2) const; //tangentes aux faces duales -> normales aux faces : (nu |f|n_ef.v) = w2 (x_ef.v)
94
95private:
96 void init_m2_new() const;
97 void init_m2_osqp() const;
98
99 mutable IntTab arete_faces_; //connectivite face -> aretes
100};
101
102/* produit scalaire de deux vecteurs */
103KOKKOS_INLINE_FUNCTION double Domaine_PolyMAC_CDO::dot(const int dim, const double *a, const double *b, const double *ma, const double *mb) const
104{
105 double res = 0;
106 for (int i = 0; i < dim; i++) res += (a[i] - (ma ? ma[i] : 0)) * (b[i] - (mb ? mb[i] : 0));
107 return res;
108}
109
110#endif /* Domaine_PolyMAC_CDO_included */
classe Conds_lim Cette classe represente un vecteur de conditions aux limites.
Definition Conds_lim.h:32
void W2(const DoubleTab *nu, int e, DoubleTab &w2) const
int W_stabiliser(DoubleTab &W, DoubleTab &R, DoubleTab &N, int *ctr, double *spectre) const
double dot(const double *a, const double *b, const double *ma=nullptr, const double *mb=nullptr) const
void ajouter_stabilisation(DoubleTab &M, DoubleTab &N) const
void calculer_volumes_entrelaces() override
const IntTab & arete_faces() const
std::map< std::string, int > is_init
Matrice_Morse_Sym m2mat
void M2(const DoubleTab *nu, int e, DoubleTab &m2) const
void swap(int, int, int)
void init_equiv() const override
std::map< std::array< int, 2 >, int > virt_ef_map
void modifier_pour_Cl(const Conds_lim &) override
void calculer_h_carre() override
class Domaine_Poly_base
Classe Matrice_Morse_Sym Represente une matrice M (creuse) symetrique stockee au format Morse.
static int dimension
Definition Objet_U.h:99
class SolveurSys Un SolveurSys represente n'importe qu'elle classe
Definition SolveurSys.h:32