TrioCFD 1.9.9_beta
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<<"Problem in Piso on the diagonal entry"<<i<<" comp "<< c<<" ref "<<ref<<" values "<<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
Returns the array of field values at the current time.
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
class Equation_base The role of an equation is the calculation of one or more fields....
virtual const Champ_Inc_base & inconnue() const =0
Domaine_dis_base & domaine_dis()
Returns the discretized domain associated with the equation.
Matrice_Morse class - Represents a (sparse) matrix M, not necessarily square,.
const auto & get_tab1() const
const auto & get_coeff() const
Matrice class - Generic class in the matrix hierarchy.
Definition Matrice.h:34
A character string (Nom) in uppercase.
Definition Motcle.h:26
Navier_Stokes_std This class carries the terms of the momentum equation.
SolveurSys & solveur_pression()
Returns the pressure solver (const version).
friend class Entree
Definition Objet_U.h:71
const Nom & que_suis_je() const
Returns the string identifying the class.
Definition Objet_U.cpp:104
virtual Entree & readOn(Entree &)
Reads an Objet_U from an input stream. Virtual method to override.
Definition Objet_U.cpp:289
virtual Sortie & printOn(Sortie &) const
Writes the object to an output stream. Virtual method to override.
Definition Objet_U.cpp:278
static void exit(int exit_code=-1)
Exit routine for TRUST within a Kokkos region.
Definition Process.cpp:466
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 A SolveurSys represents any class
Definition SolveurSys.h:32
class Solveur_non_lineaire
Base class for output streams.
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")