TrioCFD 1.9.8
TrioCFD documentation
Loading...
Searching...
No Matches
Eval_Darcy_VDF_Face.h
1/****************************************************************************
2* Copyright (c) 2024, 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_VDF_Face_included
17#define Eval_Darcy_VDF_Face_included
18
19#include <Modele_Permeabilite_base.h>
20#include <Evaluateur_Source_Face.h>
21#include <Champ_Uniforme.h>
22#include <Domaine_VDF.h>
23
24
25#include <TRUST_Ref.h>
26
27class Champ_Don_base;
28
30{
31public:
34 inline double& getPorosite() { return porosite_; }
35 template <typename Type_Double> void calculer_terme_source(const int , Type_Double& ) const;
36 template <typename Type_Double> void calculer_terme_source_bord(int num_face, Type_Double& source) const { calculer_terme_source(num_face,source); }
37 inline void mettre_a_jour() override;
38 inline void associer(const Champ_Don_base&);
39 inline void associer(const Champ_Inc_base& vit) { vitesse_ = vit; }
40
42
43protected:
45 OBS_PTR(Champ_Don_base) diffusivite_;
46 DoubleTab db_diffusivite_;
47 double porosite_;
48};
49
50/*! @brief associe le champ de diffusivite
51 *
52 */
54{
55 const int nb_faces_tot = ref_cast(Domaine_VDF,le_dom.valeur()).nb_faces_tot();
56 db_diffusivite_.resize(nb_faces_tot,RESIZE_OPTIONS::NOCOPY_NOINIT);
57 diffusivite_ = diffu;
59}
60
62{
63 const int nb_faces_tot = ref_cast(Domaine_VDF,le_dom.valeur()).nb_faces_tot();
64 if (sub_type(Champ_Uniforme,diffusivite_.valeur()))
65 db_diffusivite_ = diffusivite_->valeurs()(0,0);
66 else
67 {
68 const DoubleTab& val_diff = diffusivite_->valeurs();
69 const IntTab& face_vois = le_dom->face_voisins();
70 const ArrOfDouble& volumes = ref_cast(Domaine_VDF,le_dom.valeur()).volumes();
71 db_diffusivite_ = 0.;
72 // Compute nu(fac)=(nu(elem1).vol(elem1)+nu(elem2).vol(elem2))/(vol(elem1)+vol(elem2))
73 // Viscosity at face is the volume weighted average of viscosity on elements
74 for (int fac = 0; fac < nb_faces_tot; fac++)
75 {
76 const int elem1 = face_vois(fac,0), elem2 = face_vois(fac,1);
77 double vol = 0;
78 if (elem1!=-1)
79 {
80 db_diffusivite_(fac) += val_diff(elem1)*volumes[elem1];
81 vol += volumes[elem1];
82 }
83 if (elem2!=-1)
84 {
85 db_diffusivite_(fac) += val_diff(elem2)*volumes[elem2];
86 vol += volumes[elem2];
87 }
88 db_diffusivite_(fac) /= vol;
89 }
90 }
91}
92
93template <typename Type_Double>
94void Eval_Darcy_VDF_Face::calculer_terme_source(const int num_face, Type_Double& source) const
95{
96 const int size = source.size_array();
97 for (int i = 0; i < size; i++) source[i] = -db_diffusivite_(num_face)/modK_->getK(porosite_)*volumes_entrelaces(num_face)*porosite_surf(num_face)*(vitesse_->valeurs())(num_face,i); // -mu.vol.psi.U/K
98}
99
100#endif /* Eval_Darcy_VDF_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_VDF
Definition Domaine_VDF.h:64
void mettre_a_jour() override
void calculer_terme_source_bord(int num_face, Type_Double &source) const
OBS_PTR(Champ_Inc_base) vitesse_
Eval_Darcy_VDF_Face(const Eval_Darcy_VDF_Face &eval)
void associer(const Champ_Inc_base &vit)
void associer(const Champ_Don_base &)
associe le champ de diffusivite
OWN_PTR(Modele_Permeabilite_base) modK_
OBS_PTR(Champ_Don_base) diffusivite_
void calculer_terme_source(const int, Type_Double &) const
classe Modele_Permeabilite_base Cette classe de base represente un modele de permeabilite