TRUST 1.9.8
HPC thermohydraulic platform
Loading...
Searching...
No Matches
Champ_Fonc_Elem_PolyMAC_MPFA_rot.cpp
1/****************************************************************************
2* Copyright (c) 2023, 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 <Champ_Fonc_Elem_PolyMAC_MPFA_rot.h>
17#include <grad_Champ_Face_PolyMAC_MPFA.h>
18#include <Champ_Face_PolyMAC_MPFA.h>
19#include <Navier_Stokes_std.h>
20#include <Domaine_Cl_PolyMAC_family.h>
21
22Implemente_instanciable(Champ_Fonc_Elem_PolyMAC_MPFA_rot, "Champ_Fonc_Elem_PolyMAC_MPFA_rot", Champ_Fonc_Elem_PolyMAC_CDO);
23
24Sortie& Champ_Fonc_Elem_PolyMAC_MPFA_rot::printOn(Sortie& s) const { return s << que_suis_je() << " " << le_nom(); }
25
27
29{
30 if (temps() != tps)
31 {
32 if (dimension == 2)
34 if (dimension == 3)
36 }
38}
39
41{
44 int e, n;
45 int D = dimension, N = champ_a_deriver().valeurs().line_size();
46 int ne = domaine.nb_elem(), nf_tot = domaine.nb_faces_tot();
47
48 const Navier_Stokes_std& eq = ref_cast(Navier_Stokes_std, vit.equation());
49 DoubleTab& tab_rot = valeurs();
50 const grad_Champ_Face_PolyMAC_MPFA& grad = ref_cast(grad_Champ_Face_PolyMAC_MPFA, eq.get_champ("gradient_vitesse"));
51 const DoubleTab& tab_grad = grad.passe();
52
53 for (n = 0; n < N; n++)
54 for (e = 0; e < ne; e++)
55 {
56 tab_rot(e, n) = tab_grad(nf_tot + D * e + 0, 1 + n * D) - tab_grad(nf_tot + D * e + 1, 0 + n * D); // dUy/dx - dUx/dy
57 }
58
59 tab_rot.echange_espace_virtuel();
60}
61
63{
66 int e, n;
67 int D = dimension, N = champ_a_deriver().valeurs().line_size();
68 int ne = domaine.nb_elem(), nf_tot = domaine.nb_faces_tot();
69
70 const Navier_Stokes_std& eq = ref_cast(Navier_Stokes_std, vit.equation());
71 DoubleTab& tab_rot = valeurs();
72 const grad_Champ_Face_PolyMAC_MPFA& grad = ref_cast(grad_Champ_Face_PolyMAC_MPFA, eq.get_champ("gradient_vitesse"));
73 const DoubleTab& tab_grad = grad.passe();
74
75 for (n = 0; n < N; n++)
76 for (e = 0; e < ne; e++)
77 {
78 tab_rot(e, N*0 + n) = tab_grad(nf_tot + D * e + 1, 2 + n * D) - tab_grad(nf_tot + D * e + 2, 1 + n * D); // dUz/dy - dUy/dz
79 tab_rot(e, N*1 + n) = tab_grad(nf_tot + D * e + 2, 0 + n * D) - tab_grad(nf_tot + D * e + 0, 2 + n * D); // dUx/dz - dUz/dx
80 tab_rot(e, N*2 + n) = tab_grad(nf_tot + D * e + 0, 1 + n * D) - tab_grad(nf_tot + D * e + 1, 0 + n * D); // dUy/dx - dUx/dy
81 }
82
83 tab_rot.echange_espace_virtuel();
84}
DoubleTab & valeurs() override
Surcharge Champ_base::valeurs() Renvoie le tableau des valeurs.
: class Champ_Face_PolyMAC_MPFA
class Champ_Fonc_Elem_PolyMAC_MPFA_rot for the calculation of the vorticity This field is a Champ_Fon...
void mettre_a_jour(double tps) override
Mise a jour en temps du champ.
virtual Champ_Face_PolyMAC_MPFA & champ_a_deriver()
virtual const Domaine & domaine() const
void mettre_a_jour(double temps) override
Mise a jour en temps du champ.
DoubleTab & valeurs() override
Renvoie le tableau des valeurs du champ au temps courant.
const Domaine_VF & domaine_vf() const
virtual DoubleTab & passe(int i=1)
Definition Champ_Proto.h:50
double temps() const
Renvoie le temps du champ.
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
const Nom & le_nom() const override
Renvoie le nom du champ.
const Equation_base & equation() const
Renvoie la reference sur l'equation pointe par MorEqn::mon_equation.
Definition MorEqn.h:62
classe Navier_Stokes_std Cette classe porte les termes de l'equation de la dynamique
const Champ_base & get_champ(const Motcle &nom) const override
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
Classe de base des flux de sortie.
Definition Sortie.h:52
int line_size() const
Definition TRUSTVect.tpp:67
virtual void echange_espace_virtuel(IsExchangeBlocking exchange_type=IsExchangeBlocking::DefaultBlocking, const std::string kernel_name="noname")
class grad_Champ_Face_PolyMAC_MPFA for the calculation of the gradient This field is a Champ_Fonc_Fac...