TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
Domaine_Cl_PolyMAC_family.cpp
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#include <Dirichlet_entree_fluide_leaves.h>
17#include <Champ_front_softanalytique.h>
18#include <Dirichlet_paroi_defilante.h>
19#include <Champ_Face_PolyMAC_HFV.h>
20#include <Dirichlet_paroi_fixe.h>
21#include <Discretisation_base.h>
22#include <Domaine_Cl_PolyMAC_family.h>
23#include <Champ_Face_PolyMAC_CDO.h>
24#include <Dirichlet_homogene.h>
25#include <Champ_Inc_P0_base.h>
26#include <Domaine_PolyMAC_CDO.h>
27#include <Equation_base.h>
28#include <Probleme_base.h>
29#include <Matrice_Morse.h>
30#include <Periodique.h>
31#include <Symetrie.h>
32#include <Debog.h>
33
34Implemente_instanciable(Domaine_Cl_PolyMAC_family, "Domaine_Cl_PolyMAC_family|Domaine_Cl_PolyMAC", Domaine_Cl_dis_base);
35
36Sortie& Domaine_Cl_PolyMAC_family::printOn(Sortie& os) const { return os; }
37
39
44
46{
47
48 DoubleTab& ch_tab = ch.valeurs(temps);
49 int n, N = ch_tab.line_size();
50
51 if (sub_type(Champ_Inc_P0_base, ch)) { /* Do nothing */ }
52 else if (ch.nature_du_champ() == scalaire) { /* Do nothing */ }
53 else if (sub_type(Champ_Face_PolyMAC_HFV, ch) || sub_type(Champ_Face_PolyMAC_CDO, ch))
54 {
55 Champ_Face_base& ch_face = ref_cast(Champ_Face_base, ch);
56 const Domaine_VF& mon_dom_VF = ch_face.domaine_vf();
57 int ndeb, nfin, num_face;
58
59 for (int i = 0; i < nb_cond_lim(); i++)
60 {
61 const Cond_lim_base& la_cl = les_conditions_limites(i).valeur();
62 if (sub_type(Periodique, la_cl))
63 {
64 if (N > 1) Process::exit("Periodique CLS not yet supported for multiphase pbs.");
65
66 if (modif_perio_fait_ == 0)
67 {
68 // Ensure that the field has the same value
69 // on two periodic faces that face each other
70 const Periodique& la_cl_perio = ref_cast(Periodique, la_cl);
71 const Front_VF& le_bord = ref_cast(Front_VF, la_cl.frontiere_dis());
72 ndeb = le_bord.num_premiere_face();
73 nfin = ndeb + le_bord.nb_faces();
74 int voisine;
75 double moy;
76 for (num_face = ndeb; num_face < nfin; num_face++)
77 {
78 voisine = la_cl_perio.face_associee(num_face - ndeb) + ndeb;
79 if (ch_tab[num_face] != ch_tab[voisine])
80 {
81 moy = 0.5 * (ch_tab[num_face] + ch_tab[voisine]);
82 ch_tab[num_face] = moy;
83 ch_tab[voisine] = moy;
84 }
85 }
86 // Must not be done on the first boundary condition but once all BCs have been processed once, for multi-periodic cases with non-periodic IC
87 // init = 1;
88 }
89 }
90 else if (sub_type(Symetrie, la_cl))
91 {
92 const Front_VF& le_bord = ref_cast(Front_VF, la_cl.frontiere_dis());
93 ndeb = le_bord.num_premiere_face();
94 nfin = ndeb + le_bord.nb_faces();
95 for (num_face = ndeb; num_face < nfin; num_face++)
96 for (n = 0; n < N; n++)
97 ch_tab(num_face, n) = 0;
98 }
99 else if (sub_type(Dirichlet_entree_fluide, la_cl))
100 {
101 const Dirichlet_entree_fluide& la_cl_diri = ref_cast(Dirichlet_entree_fluide, la_cl);
102 const Front_VF& le_bord = ref_cast(Front_VF, la_cl.frontiere_dis());
103 ndeb = le_bord.num_premiere_face();
104 nfin = ndeb + le_bord.nb_faces();
105
106 for (num_face = ndeb; num_face < nfin; num_face++)
107 for (n = 0; n < N; n++)
108 {
109 // WEC: optimizable (searches for the right time for each face!)
110 // vn
111 double vn = 0;
112 for (int d = 0; d < dimension; d++)
113 vn += mon_dom_VF.face_normales(num_face, d) * la_cl_diri.val_imp_au_temps(temps,num_face-ndeb, N * d + n);
114 vn /= mon_dom_VF.face_surfaces(num_face);
115 ch_tab(num_face, n) = vn;
116 }
117 }
118 else if (sub_type(Dirichlet_paroi_fixe, la_cl))
119 {
120 const Front_VF& le_bord = ref_cast(Front_VF, la_cl.frontiere_dis());
121 ndeb = le_bord.num_premiere_face();
122 nfin = ndeb + le_bord.nb_faces();
123 for (num_face = ndeb; num_face < nfin; num_face++)
124 for (n = 0; n < N; n++)
125 ch_tab(num_face, n) = 0;
126 }
127 else if (sub_type(Dirichlet_paroi_defilante, la_cl))
128 {
129 const Front_VF& le_bord = ref_cast(Front_VF, la_cl.frontiere_dis());
130 ndeb = le_bord.num_premiere_face();
131 nfin = ndeb + le_bord.nb_faces();
132 for (num_face = ndeb; num_face < nfin; num_face++)
133 for (n = 0; n < N; n++)
134 ch_tab(num_face, n) = 0;
135 }
136 }
138 }
139 else
140 {
141 Cerr << "The type of OWN_PTR(Champ_Inc_base) " << ch.que_suis_je() << " is not supported in the PolyMAC_CDO family " << finl;
143 }
144 ch_tab.echange_espace_virtuel();
145 Debog::verifier("Domaine_Cl_PolyMAC_family::imposer_cond_lim ch_tab", ch_tab);
146}
147
149{
151 return -1000000;
152}
153
155{
156 int compteur = 0;
157 for (int cl = 0; cl < les_conditions_limites_.size(); cl++)
158 {
159 if (sub_type(Periodique, les_conditions_limites_[cl].valeur()))
160 compteur++;
161 }
162 return compteur;
163}
164
166{
168
169 if (nb_bord_periodicite() > 0)
170 {
171 Cerr << " Periodicity is not implemented !!!" << finl;
173 }
174 return 1;
175}
176
181
183{
184 return ref_cast(Domaine_VF, domaine_dis());
185}
: class Champ_Face_PolyMAC_HFV
: class Champ_Inc_P0_base
Class Champ_Inc_base.
DoubleTab & valeurs() override
Returns the array of field values at the current time.
const Domaine_VF & domaine_vf() const
class Cond_lim_base Base class for the hierarchy of classes that represent the different boundary con...
virtual Frontiere_dis_base & frontiere_dis()
Returns the discretized boundary to which the boundary conditions apply.
static void verifier(const char *const msg, double)
Definition Debog.cpp:21
Dirichlet_entree_fluide This class represents a boundary condition imposing a quantity.
Dirichlet_paroi_defilante Imposes the wall velocity in an equation of type Navier_Stokes.
Dirichlet_paroi_fixe Represents a fixed wall in a Navier-Stokes type equation.
virtual double val_imp_au_temps(double temps, int i) const
Returns the imposed value on the i-th component of the field at the boundary at the specified time.
Definition Dirichlet.cpp:54
int initialiser(double temps) override
Initializes the BCs. Unlike the update methods, the.
void imposer_cond_lim(Champ_Inc_base &, double) override
class Domaine_Cl_dis_base Domaine_Cl_dis_base objects represent discretized boundary conditions
virtual int initialiser(double temps)
Initializes the BCs. Unlike the update methods, the.
int nb_cond_lim() const
Returns the number of boundary conditions.
void completer()
Calls Cond_lim_base::completer() on each boundary condition.
Conds_lim & les_conditions_limites()
Returns the array of boundary conditions.
Domaine_dis_base & domaine_dis()
Returns a reference to the discretized domain associated with the boundary conditions.
class Domaine_VF
Definition Domaine_VF.h:44
virtual const DoubleVect & face_surfaces() const
Definition Domaine_VF.h:51
virtual double face_normales(int face, int comp) const
Definition Domaine_VF.h:47
class Domaine_dis_base This class is the base of the hierarchy of discretized domains.
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
virtual Nature_du_champ nature_du_champ() const
Definition Field_base.h:77
class Front_VF
Definition Front_VF.h:36
int nb_faces() const
Definition Front_VF.h:53
int num_premiere_face() const
Definition Front_VF.h:63
static int dimension
Definition Objet_U.h:94
const Nom & que_suis_je() const
Returns the string identifying the class.
Definition Objet_U.cpp:104
virtual Entree & readOn(Entree &)
Reads an Objet_U from an input stream. Virtual method to override.
Definition Objet_U.cpp:289
virtual Sortie & printOn(Sortie &) const
Writes the object to an output stream. Virtual method to override.
Definition Objet_U.cpp:278
class Periodique This class represents a periodic boundary condition.
Definition Periodique.h:31
int face_associee(int i) const
Definition Periodique.h:35
static void exit(int exit_code=-1)
Exit routine for TRUST within a Kokkos region.
Definition Process.cpp:466
Base class for output streams.
Definition Sortie.h:52
Symetrie On symmetry faces, the following properties hold:
Definition Symetrie.h:37
int line_size() const
Definition TRUSTVect.tpp:67
virtual void echange_espace_virtuel(IsExchangeBlocking exchange_type=IsExchangeBlocking::DefaultBlocking, const std::string kernel_name="noname")