TRUST 1.9.8
HPC thermohydraulic platform
Loading...
Searching...
No Matches
Eval_Darcy_VEF_Face.h
1/****************************************************************************
2* Copyright (c) 2025, 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#ifndef Eval_Darcy_VEF_Face_included
17#define Eval_Darcy_VEF_Face_included
18
19#include <Evaluateur_Source_VEF_Face.h>
20#include <Modele_Permeabilite_base.h>
21#include <Champ_Uniforme.h>
22#include <Domaine_VEF.h>
23
24#include <TRUST_Ref.h>
25
26
27class Champ_Don_base;
28
30{
31public:
32 Eval_Darcy_VEF_Face() : porosite_(1.) { }
34
35 inline void mettre_a_jour( ) override;
36
37 template <typename Type_Double>
38 inline void calculer_terme_source_standard(const int num_face, Type_Double& source) const { calculer_terme_source(num_face, source, volumes_entrelaces); }
39
40 template <typename Type_Double>
41 inline void calculer_terme_source_non_standard(const int num_face, Type_Double& source) const { calculer_terme_source(num_face, source, volumes_entrelaces_Cl); }
42
43 inline void associer(const Champ_Don_base&);
44 inline void associer(const Champ_Inc_base& v) { vitesse_ = v; }
45 inline double& getPorosite() { return porosite_; }
46
48
49private:
50 template <typename Type_Double>
51 inline void calculer_terme_source(int , Type_Double& , const DoubleVect&) const;
52
53 OBS_PTR(Champ_Inc_base) vitesse_;
54 OBS_PTR(Champ_Don_base) diffusivite_;
55 DoubleTab db_diffusivite_;
56 double porosite_;
57};
58
60{
61 int nb_faces_tot = ref_cast(Domaine_VEF,le_dom.valeur()).nb_faces_tot();
62 db_diffusivite_.resize(nb_faces_tot, RESIZE_OPTIONS::NOCOPY_NOINIT);
63 diffusivite_ = diffu;
65}
66
68{
69 int nb_faces_tot = ref_cast(Domaine_VEF,le_dom.valeur()).nb_faces_tot();
70 if (sub_type(Champ_Uniforme, diffusivite_.valeur()))
71 db_diffusivite_ = diffusivite_->valeurs()(0, 0);
72 else
73 {
74 const DoubleTab& val_diff = diffusivite_->valeurs();
75 const IntTab& face_vois = le_dom->face_voisins();
76 const DoubleVect& volumes = ref_cast(Domaine_VEF,le_dom.valeur()).volumes();
77 db_diffusivite_ = 0.;
78 // Compute nu(fac)=(nu(elem1).vol(elem1)+nu(elem2).vol(elem2))/(vol(elem1)+vol(elem2))
79 // Viscosity at face is the volume weighted average of viscosity on elements
80 for (int fac = 0; fac < nb_faces_tot; fac++)
81 {
82 int elem1 = face_vois(fac, 0);
83 int elem2 = face_vois(fac, 1);
84 double vol = 0;
85 if (elem1 != -1)
86 {
87 db_diffusivite_(fac) += val_diff(elem1) * volumes(elem1);
88 vol += volumes(elem1);
89 }
90 if (elem2 != -1)
91 {
92 db_diffusivite_(fac) += val_diff(elem2) * volumes(elem2);
93 vol += volumes(elem2);
94 }
95 db_diffusivite_(fac) /= vol;
96 }
97 }
98}
99
100// Compute -mu.psi.U/K.dvol
101template <typename Type_Double>
102inline void Eval_Darcy_VEF_Face::calculer_terme_source(int num_face, Type_Double& source, const DoubleVect& volumes) const
103{
104 int size = source.size_array();
105 for (int i = 0; i < size; i++)
106 source[i] = -db_diffusivite_(num_face) / modK_->getK(porosite_) * volumes[num_face] * porosite_surf[num_face] * (vitesse_->valeurs()(num_face, i));
107}
108
110{
111public:
112 void set(const Eval_Darcy_VEF_Face& eval) const
113 {
114 };
115 KOKKOS_INLINE_FUNCTION
116 void calculer_terme_source_standard_view(int num_face, DoubleArrView source) const
117 {
118 Process::Kokkos_exit("Not coded!");
119 };
120 KOKKOS_INLINE_FUNCTION
121 void calculer_terme_source_non_standard_view(int num_face, DoubleArrView source) const
122 {
123 Process::Kokkos_exit("Not coded!");
124 };
125private:
126 // Views
127};
128#endif /* Eval_Darcy_VEF_Face_included */
classe Champ_Don_base classe de base des Champs donnes (non calcules)
Classe Champ_Inc_base.
classe Champ_Uniforme Represente un champ constant dans l'espace et dans le temps.
class Domaine_VEF
Definition Domaine_VEF.h:54
KOKKOS_INLINE_FUNCTION void calculer_terme_source_non_standard_view(int num_face, DoubleArrView source) const
void set(const Eval_Darcy_VEF_Face &eval) const
KOKKOS_INLINE_FUNCTION void calculer_terme_source_standard_view(int num_face, DoubleArrView source) const
void mettre_a_jour() override
void associer(const Champ_Don_base &)
void calculer_terme_source_non_standard(const int num_face, Type_Double &source) const
void calculer_terme_source_standard(const int num_face, Type_Double &source) const
OWN_PTR(Modele_Permeabilite_base) modK_
void associer(const Champ_Inc_base &v)
Eval_Darcy_VEF_Face(const Eval_Darcy_VEF_Face &eval)
classe Modele_Permeabilite_base Cette classe de base represente un modele de permeabilite
static KOKKOS_INLINE_FUNCTION void Kokkos_exit(const char *)
Routine de sortie de TRUST dans une region Kokkos.
Definition Process.h:173