TRUST 1.9.8
HPC thermohydraulic platform
Loading...
Searching...
No Matches
Eval_Source_C_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_Source_C_VEF_Face_included
17#define Eval_Source_C_VEF_Face_included
18
19#include <Evaluateur_Source_VEF_Face.h>
20#include <Champ_Uniforme.h>
21#include <TRUST_Ref.h>
22
23#include <TRUSTTab.h>
24
26{
27public:
29 void completer() override;
31 void mettre_a_jour() override { }
32
33protected:
34 OBS_PTR(Champ_Don_base) la_source_constituant;
36 DoubleVect volumes;
37 mutable int nb_faces_elem = 0;
38};
39
41{
42public:
43 virtual bool has_view() const override { return true; }
44 void set(const Eval_Source_C_VEF_Face_View& eval) const
45 {
47 source_constituant_ = eval.source_constituant.view_ro();
48 volumes_ = eval.volumes.view_ro();
49 face_voisins_ = eval.face_voisins.view_ro();
50 volumes_entrelaces_ = eval.volumes_entrelaces.view_ro();
51 volumes_entrelaces_Cl_ = eval.volumes_entrelaces_Cl.view_ro();
52 porosite_surf_ = eval.porosite_surf.view_ro();
53 };
54 KOKKOS_INLINE_FUNCTION
55 void calculer_terme_source_standard_view(int num_face, DoubleArrView source) const
56 {
57 const int size = (int)source.size();
58
59 if (source_constituant_.extent(0)==1)
60 for (int i = 0; i < size; i++) source[i] = source_constituant_(0, i) * volumes_entrelaces_[num_face] * porosite_surf_[num_face];
61 else
62 {
63 int elem0 = face_voisins_(num_face, 0);
64 int elem1 = face_voisins_(num_face, 1);
65 for (int i = 0; i < size; i++)
66 {
67 source[i] = (source_constituant_(elem0, i) * volumes_(elem0) +
68 source_constituant_(elem1, i) * volumes_(elem1))
69 / nb_faces_elem * porosite_surf_[num_face];
70 }
71 }
72 };
73 KOKKOS_INLINE_FUNCTION
74 void calculer_terme_source_non_standard_view(int num_face, DoubleArrView source) const
75 {
76 const int size = (int)source.size();
77
78 if (source_constituant_.extent(0)==1)
79 for (int i = 0; i < size; i++) source[i] = source_constituant_(0, i) * volumes_entrelaces_Cl_[num_face] * porosite_surf_[num_face];
80 else
81 {
82 int elem0 = face_voisins_(num_face, 0);
83 int elem1 = face_voisins_(num_face, 1);
84 for (int i = 0; i < size; i++)
85 if (elem1 != -1)
86 source[i] = (source_constituant_(elem0, i) * volumes_(elem0) + source_constituant_(elem1, i) * volumes_(elem1))
87 / nb_faces_elem * porosite_surf_[num_face];
88 else
89 source[i] = source_constituant_(elem0, i) * volumes_(elem0) * porosite_surf_[num_face] / nb_faces_elem;
90 }
91 };
92private:
93 // Views
94 mutable CDoubleTabView source_constituant_;
95 mutable CDoubleArrView volumes_;
96 mutable CIntTabView face_voisins_;
97 mutable CDoubleArrView volumes_entrelaces_;
98 mutable CDoubleArrView volumes_entrelaces_Cl_;
99 mutable CDoubleArrView porosite_surf_;
100};
101#endif /* Eval_Source_C_VEF_Face_included */
classe Champ_Don_base classe de base des Champs donnes (non calcules)
virtual bool has_view() const override
void set(const Eval_Source_C_VEF_Face_View &eval) const
KOKKOS_INLINE_FUNCTION void calculer_terme_source_non_standard_view(int num_face, DoubleArrView source) const
KOKKOS_INLINE_FUNCTION void calculer_terme_source_standard_view(int num_face, DoubleArrView source) const
void associer_champs(const Champ_Don_base &)
OBS_PTR(Champ_Don_base) la_source_constituant
std::enable_if_t< is_default_exec_space< EXEC_SPACE >, ConstView< _TYPE_, _SHAPE_ > > view_ro() const
Definition TRUSTTab.h:261