TrioCFD 1.9.8
TrioCFD documentation
Loading...
Searching...
No Matches
Op_Conv_ALE_VEF.cpp
1/****************************************************************************
2* Copyright (c) 2022, 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 <Domaine_ALE.h>
17#include <TRUSTTrav.h>
18#include <Probleme_base.h>
19#include <Schema_Temps_base.h>
20#include <Porosites_champ.h>
21#include <Convection_tools.h>
22#include <Debog.h>
23#include <Champ_P1NC.h>
24#include <CL_Types_include.h>
25#include <Op_Conv_ALE_VEF.h>
26
27Implemente_instanciable(Op_Conv_ALE_VEF, "Op_Conv_ALE_VEF", Op_Conv_VEF_Face);
28// XD convection_ale convection_deriv ALE NO_BRACE Keyword for ALE-specific convection in VEF/VDF discretizations. At
29// XD_CONT runtime, TRUST's Discretisation_base maps `ALE` to the Op_Conv_ALE_<discr> operator (e.g. Op_Conv_ALE_VEF
30// XD_CONT here); the inner readOn delegates to Op_Conv_VEF_Face::readOn, which accepts the same scheme parameters as
31// XD_CONT `convection_generic`. NL2 Examples: NL2 convection { ALE amont }NL2 convection { ALE muscl vanleer 2 }
32// XD attr type chaine(into=["amont","muscl","centre"]) type REQ type of scheme
33// XD attr limiteur chaine(into=["minmod","vanleer","vanalbada","chakravarthy","superbee"]) limiteur OPT type of
34// XD_CONT limiter, for muscl
35// XD attr ordre entier(into=[1,2,3]) ordre OPT order of accuracy, for muscl
36// XD attr alpha floattant alpha OPT alpha
37
39
40
42
44{
46 const int Nt = equation().inconnue().nb_valeurs_temporelles(),
49 equation().discretisation().creer_champ(la_vitesse_relative_faces_, equation().domaine_dis(), equation().inconnue().que_suis_je(), "vitesse_relative_ALE", "m/s", Nc, Nl, Nt, equation().schema_temps().temps_courant());
50 la_vitesse_relative_faces_->associer_eqn(equation());
51}
52
53void Op_Conv_ALE_VEF::update_relative_velocity() const
54{
55 const Domaine_ALE& dom_ale = ref_cast(Domaine_ALE, equation().inconnue().domaine());
56 la_vitesse_relative_faces_->valeurs() = vitesse().valeurs();
57 const DoubleTab& w = dom_ale.vitesse_faces();
58 if (w.nb_dim() == 1) return;
59 la_vitesse_relative_faces_->valeurs() -= w;
60}
61
62DoubleTab& Op_Conv_ALE_VEF::ajouter(const DoubleTab& transporte, DoubleTab& resu) const
63{
64 update_relative_velocity();
65 return ajouter_gen(transporte, la_vitesse_relative_faces_.valeur(), resu);
66}
67
68void Op_Conv_ALE_VEF::ajouter_contribution(const DoubleTab& transporte, Matrice_Morse& matrice) const
69{
70 update_relative_velocity();
71 ajouter_contribution_gen(transporte, la_vitesse_relative_faces_.valeur(), matrice);
72}
73
75{
76// Taken from Op_Conv_EF_VEF_P1NC_Stab::remplir_fluent(DoubleVect& fluent_)
77//
78 const Domaine_VEF& domaine_VEF = le_dom_vef.valeur();
79//old const Champ_Inc_base& la_vitesse=vitesse_.valeur();
80//old const DoubleTab& tab_vitesse=la_vitesse.valeurs();
81//new DoubleTab velocity= equation().inconnue().valeurs();
82 const DoubleTab& tab_vitesse= vitesse().valeurs();
83 const DoubleTab& tab_vitesse_faces_ALE = ref_cast(Domaine_ALE, equation().inconnue().domaine()).vitesse_faces();
84
85 const DoubleTab& face_normales=domaine_VEF.face_normales();
86 const int nb_faces = domaine_VEF.nb_faces();
87 // calcul de la CFL.
88 double psc;
89 // On remet a zero le tableau qui sert pour
90 // le calcul du pas de temps de stabilite
91
92
93 //Initialization step before projection:
94 if(tab_vitesse_faces_ALE.nb_dim()==1 && tab_vitesse_faces_ALE.mp_norme_vect()<=1.e-12)
95 {
96 for(int num_face=0; num_face<nb_faces; num_face++)
97 {
98 psc=0.;
99 for (int i=0; i<dimension; i++)
100 psc+=tab_vitesse(num_face,i)*face_normales(num_face,i);
101 fluent_(num_face)=std::fabs(psc);
102 }
103 }
104
105 //Projection step and solving problem:
106 else
107 {
108 for(int num_face=0; num_face<nb_faces; num_face++)
109 {
110 psc=0.;
111 for (int i=0; i<dimension; i++)
112 psc+=(tab_vitesse(num_face,i)-tab_vitesse_faces_ALE(num_face,i))*face_normales(num_face,i);
113 fluent_(num_face)=std::fabs(psc);
114 }
115 }
116
117}
virtual int nb_valeurs_temporelles() const
Renvoie le nombre de valeurs temporelles actuellement conservees.
DoubleTab & valeurs() override
Renvoie le tableau des valeurs du champ au temps courant.
static void creer_champ(OWN_PTR(Champ_Inc_base)&ch, const Domaine_dis_base &z, const Nom &type, const Nom &nom, const Nom &unite, int nb_comp, int nb_ddl, int nb_pas_dt, double temps, const Nom &directive=NOM_VIDE, const Nom &nom_discretisation=NOM_VIDE)
Methode statique qui cree un OWN_PTR(Champ_Inc_base) du type specifie.
DoubleTab & vitesse_faces()
class Domaine_VEF
Definition Domaine_VEF.h:54
int nb_faces() const
renvoie le nombre global de faces.
Definition Domaine_VF.h:471
virtual double face_normales(int face, int comp) const
Definition Domaine_VF.h:47
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
const Discretisation_base & discretisation() const
Renvoie la discretisation associee a l'equation.
virtual const Champ_Inc_base & inconnue() const =0
Classe Matrice_Morse Represente une matrice M (creuse), non necessairement carree.
const Equation_base & equation() const
Renvoie la reference sur l'equation pointe par MorEqn::mon_equation.
Definition MorEqn.h:62
static int dimension
Definition Objet_U.h:99
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
void remplir_fluent() const override
DoubleTab & ajouter(const DoubleTab &, DoubleTab &) const override
void ajouter_contribution(const DoubleTab &, Matrice_Morse &) const override
void completer() override
Associe l'operateur au domaine_dis, le domaine_Cl_dis, et a l'inconnue de son equation.
class Op_Conv_VEF_Face
void ajouter_contribution_gen(const DoubleTab &transporte, const Champ_Inc_base &la_vitesse, Matrice_Morse &matrice) const
DoubleTab & ajouter_gen(const DoubleTab &transporte, const Champ_Inc_base &la_vitesse, DoubleTab &resu) const
void completer() override
Associe l'operateur au domaine_dis, le domaine_Cl_dis, et a l'inconnue de son equation.
const Champ_Inc_base & vitesse() const
Classe de base des flux de sortie.
Definition Sortie.h:52
int nb_dim() const
Definition TRUSTTab.h:199
_SIZE_ dimension(int d) const
Definition TRUSTTab.tpp:133
int line_size() const
Definition TRUSTVect.tpp:67
_TYPE_ mp_norme_vect() const
Definition TRUSTVect.h:162
_SIZE_ size_reelle_ok() const
Definition TRUSTVect.tpp:38