TrioCFD 1.9.8
TrioCFD documentation
Loading...
Searching...
No Matches
Simpler_Base.cpp
1/****************************************************************************
2* Copyright (c) 2026, CEA
3* All rights reserved.
4*
5* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
6* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
7* 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.
8* 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.
9*
10* 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.
11* 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;
12* 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.
13*
14*****************************************************************************/
15
16#include <Navier_Stokes_std.h>
17#include <Assembleur_base.h>
18#include <Probleme_base.h>
19#include <Simpler_Base.h>
20#include <Domaine_VF.h>
21#include <TRUSTTrav.h>
22
23Implemente_base_sans_constructeur(Simpler_Base,"Simpler_Base",Solveur_non_lineaire);
24
26{
27 return os;
28}
29
31{
34 no_qdm_ = 0;
36}
37
39{
40 if (motlu == "no_qdm")
41 {
42 Cerr << motlu << finl;
43 no_qdm_ = 1;
44 }
45 else if (motlu == "facsec_diffusion_for_sets")
46 {
47 Cerr << motlu << finl;
49 }
50 else
51 {
52 Cerr << "Keyword : " << motlu << " is not undertood in " << que_suis_je() << finl;
54 }
55 return is;
56}
57
59{
60 Navier_Stokes_std& eqnNS = ref_cast(Navier_Stokes_std,eqn_NS);
61 const auto& tab1 = matrice.get_tab1();
62 const auto& coeff = matrice.get_coeff();
63 const DoubleTab& present = eqn_NS.inconnue().valeurs();
64 int nb_comp = 1;
65 int deux_entrees = 0;
66
67 if (present.nb_dim()==2)
68 {
69 deux_entrees = 1;
70 nb_comp = present.dimension(1);
71 }
72
73 const Domaine_VF& le_dom = ref_cast(Domaine_VF,eqnNS.domaine_dis());
74 if (deux_entrees==0)
75 {
76 DoubleVect vol2 = le_dom.volumes_entrelaces();
77 int ns = vol2.size();
78 for (int i=0; i<ns; i++)
79 {
80 auto idiag = tab1[i*nb_comp]-1;
81 double ref = coeff[idiag];
82 for (int c=1; c<nb_comp; c++)
83 if (!est_egal(ref,coeff[tab1[i*nb_comp+c]-1]))
84 {
85 Cerr<<"Pb dans Piso sur la diagonale case"<<i<<" comp "<< c<<" ref "<<ref<<" valeurs "<<coeff[tab1[i*nb_comp+c]-1]<<finl;
86 exit();
87 }
88 vol2[i] = coeff[idiag];
89 }
91 eqnNS.assembleur_pression()->assembler_mat(matrice_en_pression_2,vol2,1,1);
92 }
93 else
94 {
95 DoubleTab vol2(present);
96 int ns = vol2.dimension_tot(0);
97 for (int i=0; i<ns; i++)
98 for (int c=0; c<nb_comp; c++)
99 vol2(i,c) = matrice(i*nb_comp+c,i*nb_comp+c);
100
102 eqnNS.assembleur_pression()->assembler_mat(matrice_en_pression_2,vol2,1,1);
103 }
104
105 SolveurSys& solveur_pression_ = eqnNS.solveur_pression();
106 solveur_pression_->reinit();
107}
DoubleTab & valeurs() override
Renvoie le tableau des valeurs du champ au temps courant.
class Domaine_VF
Definition Domaine_VF.h:44
DoubleVect & volumes_entrelaces()
Definition Domaine_VF.h:99
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
classe Equation_base Le role d'une equation est le calcul d'un ou plusieurs champs....
virtual const Champ_Inc_base & inconnue() const =0
Domaine_dis_base & domaine_dis()
Renvoie le domaine discretise associe a l'equation.
Classe Matrice_Morse Represente une matrice M (creuse), non necessairement carree.
const auto & get_tab1() const
const auto & get_coeff() const
Classe Matrice Classe generique de la hierarchie des matrices.
Definition Matrice.h:34
Une chaine de caractere (Nom) en majuscules.
Definition Motcle.h:26
classe Navier_Stokes_std Cette classe porte les termes de l'equation de la dynamique
SolveurSys & solveur_pression()
Renvoie le solveur en pression (version const).
friend class Entree
Definition Objet_U.h:76
const Nom & que_suis_je() const
renvoie la chaine identifiant la classe.
Definition Objet_U.cpp:104
virtual Entree & readOn(Entree &)
Lecture d'un Objet_U sur un flot d'entree Methode a surcharger.
Definition Objet_U.cpp:293
virtual Sortie & printOn(Sortie &) const
Ecriture de l'objet sur un flot de sortie Methode a surcharger.
Definition Objet_U.cpp:282
static void exit(int exit_code=-1)
Routine de sortie de TRUST dans une region Kokkos.
Definition Process.cpp:455
Entree & lire(const Motcle &, Entree &) override
void assembler_matrice_pression_implicite(Equation_base &eqn_NS, const Matrice_Morse &matrice, Matrice &matrice_en_pression_2)
double facsec_diffusion_for_sets_
class SolveurSys Un SolveurSys represente n'importe qu'elle classe
Definition SolveurSys.h:32
class Solveur_non_lineaire
Classe de base des flux de sortie.
Definition Sortie.h:52
int nb_dim() const
Definition TRUSTTab.h:199
_SIZE_ dimension_tot(int) const override
Definition TRUSTTab.tpp:160
_SIZE_ dimension(int d) const
Definition TRUSTTab.tpp:133
_SIZE_ size() const
Definition TRUSTVect.tpp:45
virtual void echange_espace_virtuel(IsExchangeBlocking exchange_type=IsExchangeBlocking::DefaultBlocking, const std::string kernel_name="noname")