TrioCFD 1.9.8
TrioCFD documentation
Loading...
Searching...
No Matches
Cut_cell_diffusion_auxiliaire.cpp
1/****************************************************************************
2* Copyright (c) 2015 - 2016, 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 <Cut_cell_diffusion_auxiliaire.h>
17#include <Cut_cell_FT_Disc.h>
18#include <IJK_Thermal_base.h>
19#include <Probleme_FTD_IJK_cut_cell.h>
20#include <Process.h>
21
22#include <IJK_Navier_Stokes_tools.h>
23#include <IJK_Navier_Stokes_tools_cut_cell.h>
24#include <Param.h>
25
26Implemente_instanciable_sans_constructeur(Cut_cell_diffusion_auxiliaire, "Cut_cell_diffusion_auxiliaire", Cut_cell_schema_auxiliaire) ;
27
28Cut_cell_diffusion_auxiliaire::Cut_cell_diffusion_auxiliaire()
29{
30 methode_valeur_remplissage_ = METHODE_TEMPERATURE_REMPLISSAGE::COPIE_DIRECTE;
31
32 correction_petites_cellules_ = CORRECTION_PETITES_CELLULES::DIRECTION_PRIVILEGIEE_AVEC_LIMITATION_2;
33
34 no_static_update_ = false;
35}
36
38{
40 return os;
41}
42
44{
45 Param param(que_suis_je());
46 set_param(param);
47 param.lire_avec_accolades(is);
48 return is;
49}
50
52{
54
55 param.ajouter_flag("deactivate_correction_petites_cellules_diffusion", &deactivate_correction_petites_cellules_diffusion_);
56}
57
58double Cut_cell_diffusion_auxiliaire::dying_cells_flux(int num_face, int phase, int n, const Cut_field_vector3_double& cut_field_total_velocity, const Cut_field_double& cut_field_temperature)
59{
60 const Cut_cell_FT_Disc& cut_cell_disc = cut_field_temperature.get_cut_cell_disc();
61
62 Int3 ijk = cut_cell_disc.get_ijk(n);
63 int i = ijk[0];
64 int j = ijk[1];
65 int k = ijk[2];
66
67 int dir = num_face%3;
68 int decalage = num_face/3;
69 int sign = decalage*2 -1;
70
71 int di = decalage*(dir == 0);
72 int dj = decalage*(dir == 1);
73 int dk = decalage*(dir == 2);
74
75 const DoubleTabFT_cut_cell_scalar& flux_interface_efficace = select_flux_interface(phase);
76
77 double normal_x = cut_cell_disc.get_interfaces().get_normale_deplacement_interface()(n,0);
78 double normal_y = cut_cell_disc.get_interfaces().get_normale_deplacement_interface()(n,1);
79 double normal_z = cut_cell_disc.get_interfaces().get_normale_deplacement_interface()(n,2);
80 int sign_flux_interf = (flux_interface_efficace(n) == 0.) ? 0 : (1 - 2*phase)*(2*(flux_interface_efficace(n) > 0) - 1);
81
82 double normal_to_face = sign*select_dir(dir, normal_x, normal_y, normal_z);
83
84 int n_face = cut_cell_disc.get_n_face(num_face, n, i, j, k);
85 if (n_face >= 0)
86 {
87 double surface_efficace = (phase == 0) ? 1 - cut_cell_disc.get_interfaces().get_indicatrice_surfacique_efficace_face()(n_face, dir) : cut_cell_disc.get_interfaces().get_indicatrice_surfacique_efficace_face()(n_face, dir);
88 if (surface_efficace > 0)
89 {
90 return -sign*surface_efficace*normal_to_face*sign_flux_interf;
91 }
92 else
93 {
94 return 0.;
95 }
96 }
97 else
98 {
99 double surface_efficace = (phase == 0) ? 1 - cut_cell_disc.get_interfaces().I(i+di,j+dj,k+dk) : cut_cell_disc.get_interfaces().I(i+di,j+dj,k+dk);
100 assert((surface_efficace == 0) || (surface_efficace == 1));
101 if (surface_efficace > 0)
102 {
103 return -sign*surface_efficace*normal_to_face*sign_flux_interf;
104 }
105 else
106 {
107 return 0.;
108 }
109 }
110}
111
112double Cut_cell_diffusion_auxiliaire::small_nascent_cells_flux(int num_face, int phase, int n, const Cut_field_vector3_double& cut_field_total_velocity, const Cut_field_double& cut_field)
113{
114 const Cut_cell_FT_Disc& cut_cell_disc = cut_field.get_cut_cell_disc();
115
116 Int3 ijk = cut_cell_disc.get_ijk(n);
117 int i = ijk[0];
118 int j = ijk[1];
119 int k = ijk[2];
120
121 int dir = num_face%3;
122 int decalage = num_face/3;
123 int sign = decalage*2 -1;
124
125 int di = decalage*(dir == 0);
126 int dj = decalage*(dir == 1);
127 int dk = decalage*(dir == 2);
128
129 const DoubleTabFT_cut_cell_scalar& flux_interface_efficace = select_flux_interface(phase);
130
131 double normal_x = cut_cell_disc.get_interfaces().get_normale_deplacement_interface()(n,0);
132 double normal_y = cut_cell_disc.get_interfaces().get_normale_deplacement_interface()(n,1);
133 double normal_z = cut_cell_disc.get_interfaces().get_normale_deplacement_interface()(n,2);
134 int sign_flux_interf = (flux_interface_efficace(n) == 0.) ? 0 : (1 - 2*phase)*(2*(flux_interface_efficace(n) > 0) - 1);
135
136 double normal_to_face = sign*select_dir(dir, normal_x, normal_y, normal_z);
137
138 int n_face = cut_cell_disc.get_n_face(num_face, n, i, j, k);
139 if (n_face >= 0)
140 {
141 double surface_efficace = (phase == 0) ? 1 - cut_cell_disc.get_interfaces().get_indicatrice_surfacique_efficace_face()(n_face, dir) : cut_cell_disc.get_interfaces().get_indicatrice_surfacique_efficace_face()(n_face, dir);
142 if (surface_efficace > 0)
143 {
144 return -sign*surface_efficace*normal_to_face*sign_flux_interf;
145 }
146 else
147 {
148 return 0.;
149 }
150 }
151 else
152 {
153 double surface_efficace = (phase == 0) ? 1 - cut_cell_disc.get_interfaces().In(i+di,j+dj,k+dk) : cut_cell_disc.get_interfaces().In(i+di,j+dj,k+dk);
154 assert((surface_efficace == 0) || (surface_efficace == 1));
155 if (surface_efficace > 0)
156 {
157 return -sign*surface_efficace*normal_to_face*sign_flux_interf;
158 }
159 else
160 {
161 return 0.;
162 }
163 }
164}
165
166void Cut_cell_diffusion_auxiliaire::associer(DoubleTabFT_cut_cell_scalar& flux_interface_efficace)
167{
168 flux_interface_efficace_ptr_ = &flux_interface_efficace;
169}
170
171const DoubleTabFT_cut_cell_scalar& Cut_cell_diffusion_auxiliaire::select_flux_interface(int phase)
172{
173 if (flux_interface_efficace_ptr_ == nullptr)
174 {
175 Cerr << "Invalid pointer flux_interface_efficace_ in Cut_cell_diffusion_auxiliaire::select_flux_interface." << finl;
177 }
179}
const IJK_Interfaces & get_interfaces() const
Int3 get_ijk(int n) const
int get_n_face(int num_face, int n, int i, int j, int k) const
double dying_cells_flux(int num_face, int phase, int n, const Cut_field_vector3_double &cut_field_total_velocity, const Cut_field_double &cut_field) override
void set_param(Param &param) const override
double small_nascent_cells_flux(int num_face, int phase, int n, const Cut_field_vector3_double &cut_field_total_velocity, const Cut_field_double &cut_field) override
DoubleTabFT_cut_cell_scalar * flux_interface_efficace_ptr_
void associer(DoubleTabFT_cut_cell_scalar &flux_interface_efficace)
const DoubleTabFT_cut_cell_scalar & select_flux_interface(int phase)
CORRECTION_PETITES_CELLULES correction_petites_cellules_
void set_param(Param &param) const override
METHODE_TEMPERATURE_REMPLISSAGE methode_valeur_remplissage_
const Cut_cell_FT_Disc & get_cut_cell_disc() const
Definition Cut_field.h:78
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
const DoubleTabFT_cut_cell_vector3 & get_indicatrice_surfacique_efficace_face() const
const IJK_Field_double & I() const
const IJK_Field_double & In() const
const DoubleTabFT_cut_cell_vector3 & get_normale_deplacement_interface() const
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
Helper class to factorize the readOn method of Objet_U classes.
Definition Param.h:112
void ajouter_flag(const char *keyword, const bool *value)
Register a boolean flag whose mere presence switches it to true.
Definition Param.cpp:474
static void exit(int exit_code=-1)
Routine de sortie de TRUST dans une region Kokkos.
Definition Process.cpp:455
Classe de base des flux de sortie.
Definition Sortie.h:52