TrioCFD 1.9.8
TrioCFD documentation
Loading...
Searching...
No Matches
Op_Diff_K_Eps_Bas_Re_VDF_leaves.cpp
1/****************************************************************************
2* Copyright (c) 2019, 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_Diff_K_Eps_Bas_Re_VDF_leaves.h>
17
18Implemente_instanciable_sans_constructeur(Op_Diff_K_Eps_Bas_Re_VDF_Elem_Axi,"Op_Diff_K_Eps_Bas_Re_VDF_const_P0_VDF_Axi",Op_Diff_K_Eps_Bas_Re_VDF_base);
22
23Implemente_instanciable_sans_constructeur(Op_Diff_K_Eps_Bas_Re_VDF_Elem,"Op_Diff_K_Eps_Bas_Re_VDF_const_P0_VDF",Op_Diff_K_Eps_Bas_Re_VDF_base);
27
28///////////////////////////////////
29// VAR
30
31Implemente_instanciable_sans_constructeur(Op_Diff_K_Eps_Bas_Re_VDF_var_Elem,"Op_Diff_K_Eps_Bas_Re_VDF_var_P0_VDF",Op_Diff_K_Eps_Bas_Re_VDF_base);
34
36{
37 double dt_stab, coef;
38 const Domaine_VDF& domaine_VDF = iter->domaine();
39 const IntTab& elem_faces = domaine_VDF.elem_faces();
40 const DoubleVect& alpha = diffusivite().valeurs(), &alpha_t = diffusivite_turbulente().valeurs();
41
42 // Calcul du pas de temps de stabilite :
43 // - La diffusivite est non constante donc: dt_stab = Min (1/(2*(diff_lam(i)+diff_turb(i))*coeff(elem))
44 // avec :
45 // coeff = 1/(dx*dx) + 1/(dy*dy) + 1/(dz*dz)
46 // i decrivant l'ensemble des elements du maillage
47
48 coef= -1.e10;
49 double alpha_local,h_x,h_y,h_z;
50
51 if (dimension == 2)
52 {
53 int numfa[4];
54 for (int elem=0; elem<domaine_VDF.nb_elem(); elem++)
55 {
56 for (int i=0; i<4; i++) numfa[i] = elem_faces(elem,i);
57
58 h_x = domaine_VDF.dist_face(numfa[0],numfa[2],0);
59 h_y = domaine_VDF.dist_face(numfa[1],numfa[3],1);
60 alpha_local = (alpha(elem)+alpha_t(elem))*(1/(h_x*h_x) + 1/(h_y*h_y));
61 coef = std::max(coef,alpha_local);
62 }
63 }
64 else if (dimension == 3)
65 {
66 int numfa[6];
67 for (int elem=0; elem<domaine_VDF.nb_elem(); elem++)
68 {
69 for (int i=0; i<6; i++) numfa[i] = elem_faces(elem,i);
70
71 h_x = domaine_VDF.dist_face(numfa[0],numfa[3],0);
72 h_y = domaine_VDF.dist_face(numfa[1],numfa[4],1);
73 h_z = domaine_VDF.dist_face(numfa[2],numfa[5],2);
74 alpha_local = (alpha(elem)+alpha_t(elem))*(1/(h_x*h_x) + 1/(h_y*h_y) + 1/(h_z*h_z));
75 coef = std::max(coef,alpha_local);
76 }
77 }
78
79 coef = Process::mp_max(coef);
80 dt_stab = 1/(2*(coef+DMINFLOAT));
81
82 return dt_stab;
83}
84
DoubleTab & valeurs() override
Surcharge Champ_base::valeurs() Renvoie le tableau des valeurs.
virtual DoubleTab & valeurs()=0
class Domaine_VDF
Definition Domaine_VDF.h:64
double dist_face(int, int, int k) const
int elem_faces(int i, int j) const
renvoie le numero de le ieme face de la maille num_elem la facon dont ces faces sont numerotees est
Definition Domaine_VF.h:543
const Domaine & domaine() const
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
static int dimension
Definition Objet_U.h:99
const Nom & que_suis_je() const
renvoie la chaine identifiant la classe.
Definition Objet_U.cpp:104
virtual Entree & readOn(Entree &)
Lecture d'un Objet_U sur un flot d'entree Methode a surcharger.
Definition Objet_U.cpp:293
virtual Sortie & printOn(Sortie &) const
Ecriture de l'objet sur un flot de sortie Methode a surcharger.
Definition Objet_U.cpp:282
Op_Diff_K_Eps_Bas_Re_VDF_base(const Iterateur_VDF_base &iter_base)
const Champ_base & diffusivite() const override
double calculer_dt_stab() const override
Calcul dt_stab.
const Champ_Fonc_base & diffusivite_turbulente() const
static double mp_max(double)
Definition Process.cpp:376
Classe de base des flux de sortie.
Definition Sortie.h:52