TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
Op_Conv_EF_base.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 <Op_Conv_EF_base.h>
17
18#include <Milieu_base.h>
19#include <Schema_Temps_base.h>
20#include <Probleme_base.h>
21#include <TRUSTTrav.h>
22#include <Discretisation_base.h>
23
24
25Implemente_base(Op_Conv_EF_base,"Op_Conv_EF_base",Operateur_Conv_base);
26
27
28//// printOn
29//
30
32{
33 return s << que_suis_je() ;
34}
35
36
37//// readOn
38//
39
41{
42 return s ;
43}
44
45
46
47/*! @brief Defines whether psi is convected with phi*u or with u.
48 *
49 */
51{
52 if (eq.inconnue().le_nom()=="vitesse")
53 return 0;
54 return 1;
55}
56
57
59{
60 vitesse_ = ref_cast(Champ_Inc_base,vit);
61}
62
64{
65 return vitesse_.valeur();
66}
67
69{
70 return vitesse_.valeur();
71}
72
74{
75 Cerr<<__FILE__<<(int)__LINE__<<" dt_stab mal code "<<finl;
76 double dt_stab=1e30;
77 /* const Domaine_Cl_EF& domaine_Cl_EF = la_zcl_EF.valeur();
78 const Domaine_EF& domaine_EF = le_dom_EF.valeur();
79 const DoubleVect& volumes_entrelaces = domaine_EF.volumes_entrelaces();
80 const DoubleVect& volumes_entrelaces_Cl = domaine_Cl_EF.volumes_entrelaces_Cl();
81 remplir_fluent();
82
83
84 double dt_face,dt_stab =1.e30;
85
86 // Process boundary conditions
87 // If a face carries a Dirichlet condition, it is not taken into account
88 // in the dt_stab computation
89 for (int n_bord=0; n_bord<domaine_EF.nb_front_Cl(); n_bord++)
90 {
91 const Cond_lim& la_cl = domaine_Cl_EF.les_conditions_limites(n_bord);
92 if ( (sub_type(Dirichlet,la_cl.valeur()))
93 ||
94 (sub_type(Dirichlet_homogene,la_cl.valeur()))
95 )
96 ;
97 else
98 {
99 const Front_VF& le_bord = ref_cast(Front_VF,la_cl->frontiere_dis());
100 int ndeb = le_bord.num_premiere_face();
101 int nfin = ndeb + le_bord.nb_faces();
102 for (int num_face=ndeb; num_face<nfin; num_face++) {
103 dt_face = volumes_entrelaces_Cl(num_face)/(fluent[num_face]+1.e-30);
104 dt_stab = (dt_face < dt_stab) ? dt_face : dt_stab;
105 }
106 }
107 }
108
109 // Process non-standard internal faces
110 int ndeb = domaine_EF.premiere_face_int();
111 int nfin = domaine_EF.premiere_face_std();
112
113 for (int num_face=ndeb; num_face<nfin; num_face++)
114 {
115 dt_face = volumes_entrelaces_Cl(num_face)/(fluent[num_face]+1.e-30);
116 dt_stab =(dt_face < dt_stab) ? dt_face : dt_stab;
117 }
118
119 // Process standard internal faces
120 ndeb = nfin;
121 nfin = domaine_EF.nb_faces();
122 for (int num_face=ndeb; num_face<nfin; num_face++)
123 {
124 dt_face = volumes_entrelaces(num_face)/(fluent[num_face]+1.e-30);
125 dt_stab =(dt_face < dt_stab) ? dt_face : dt_stab;
126 }
127 */
128 dt_stab = Process::mp_min(dt_stab);
129 // trick to work around the const type of the method
130 Op_Conv_EF_base& op = ref_cast_non_const(Op_Conv_EF_base,*this);
131 op.fixer_dt_stab_conv(dt_stab);
132 return dt_stab;
133}
134
135//compute values of the operator stability time step for post-processing
136//-discretise the storage space (at faces)
137// storage space named "localisation" to complete the Champ_Generique_base
138// storage space named "??" otherwise
139//-compute values
140//-verify in debug the compatibility with dt_stab used for the computation
141// cf Op_Conv_EF_base::calculer_dt_stab() for the choice of dt_stab computation
142
143void Op_Conv_EF_base::calculer_pour_post(Champ_base& espace_stockage,const Nom& option,int) const
144{
145 Cerr<<__FILE__<<(int)__LINE__<<" dt_stab mal code "<<finl;
146 exit();
147
148}
149
151{
152 const Domaine_Cl_EF& zclEF = ref_cast(Domaine_Cl_EF,domaine_cl_dis);
153 la_zcl_EF = zclEF;
154}
155
157 const Domaine_Cl_dis_base& domaine_cl_dis,
158 const Champ_Inc_base& )
159{
160 const Domaine_EF& zEF = ref_cast(Domaine_EF,domaine_dis);
161 const Domaine_Cl_EF& zclEF = ref_cast(Domaine_Cl_EF,domaine_cl_dis);
162
163 le_dom_EF = zEF;
164 la_zcl_EF = zclEF;
165 /*
166 fluent.resize(le_dom_EF->nb_faces());
167 // Create the virtual space for fluent
168 int nbjoints = zEF.nb_joints();
169 int i;
170 for(i=0;i<nbjoints;i++){
171 const Joint& joint=zEF.joint(i);
172 int PEvoisin = joint.PEvoisin();
173 const ArrOfInt& esp_dist_face=joint.esp_dist_faces();
174 fluent.ajoute_espace_distant(PEvoisin, esp_dist_face);
175 }
176 fluent.echange_espace_virtuel();
177 */
178}
179
180
182{
183 return Op_EF_base::impr(os, *this );
184}
185
186DoubleTab& Op_Conv_EF_base::calculer(const DoubleTab& transporte,
187 DoubleTab& resu) const
188{
189 resu = 0;
190 return ajouter(transporte,resu);
191}
193{
194 // Fill the fluent array by calling ajouter.
195 // This is expensive but at least it corrects (while waiting
196 // to optimize) the problem of a convection time step
197 // computed with past velocities.
198 DoubleTrav tmp(equation().inconnue().valeurs());
199 DoubleTab flux_bords_sauve(flux_bords_); // Save flux_bords to avoid it being zeroed out
200 ajouter(tmp,tmp);
201 flux_bords_=flux_bords_sauve;
202 // PL: This is really heavy, but how else? fluent depends
203 // on the scheme, so one could code something like fluent=velocity*surface*porosity
204 // in the present method
205}
Class Champ_Inc_base.
class Champ_base This class is the base of the fields hierarchy.
Definition Champ_base.h:43
class Domaine_Cl_dis_base Domaine_Cl_dis_base objects represent discretized boundary conditions
class Domaine_EF
Definition Domaine_EF.h:56
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
class Equation_base The role of an equation is the calculation of one or more fields....
virtual const Champ_Inc_base & inconnue() const =0
const Nom & le_nom() const override
Returns the name of the field.
const Equation_base & equation() const
Returns the reference to the equation pointed to by MorEqn::mon_equation.
Definition MorEqn.h:62
class Nom: a character string for naming TRUST objects.
Definition Nom.h:31
friend class Sortie
Definition Objet_U.h:70
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 Op_Conv_EF_base
int impr(Sortie &os) const override
DOES NOTHING - to override in derived classes.
void associer_vitesse(const Champ_base &) override
void completer() override
Associates the operator with the domaine_dis, the domaine_Cl_dis, and the unknown of its equation.
int phi_u_transportant(const Equation_base &eq) const
Defines whether psi is convected with phi*u or with u.
void calculer_pour_post(Champ_base &espace_stockage, const Nom &option, int) const override
double calculer_dt_stab() const override
Computes dt_stab.
DoubleTab & calculer(const DoubleTab &, DoubleTab &) const override
virtual void remplir_fluent() const
void associer_domaine_cl_dis(const Domaine_Cl_dis_base &) override
void associer(const Domaine_dis_base &, const Domaine_Cl_dis_base &, const Champ_Inc_base &) override
const Champ_Inc_base & vitesse() const
void marque_elem(const Equation_base &eqn)
int impr(Sortie &, const Operateur_base &) const
Prints the boundary fluxes of an EF operator at faces (i.e., diffusion, convection).
Operateur_Conv_base This class is the base of the hierarchy of operators representing.
void fixer_dt_stab_conv(double dt)
DoubleTab flux_bords_
virtual void completer()
Associates the operator with the domaine_dis, the domaine_Cl_dis, and the unknown of its equation.
virtual DoubleTab & ajouter(const DoubleTab &, DoubleTab &) const
static double mp_min(double)
Definition Process.cpp:391
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