TrioCFD 1.9.8
TrioCFD documentation
Loading...
Searching...
No Matches
Operateur_IJK_data_channel.h
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#ifndef Operateur_IJK_data_channel_included
17#define Operateur_IJK_data_channel_included
18#include <IJK_Field.h>
19#include <Domaine_IJK.h>
20
21// Data used by IJK operators in the case of a
22// biperiodic channel uniform mesh in i and j,
23// wall in k direction.
25{
26public:
27 void initialize(const Domaine_IJK& splitting);
28
29 int nb_elem_k_tot() const
30 {
31 return nb_elem_k_tot_;
32 }
33
34 // First layer of non zero fluxes (eg, not in or at the walls)
35 // (specific for wall boundary conditions at zmin and zmax)
36 int first_global_k_layer_flux(int icompo, int idir) const
37 {
38 if (idir != 2 && icompo != 2) // not a trivial thing to determine...
39 return 0;
40 else
41 return 1;
42 }
43 int last_global_k_layer_flux(int icompo, int idir) const
44 {
45 if (idir == 2 && icompo == 2) // not a trivial thing to determine...
46 return nb_elem_k_tot_;
47 else
48 return nb_elem_k_tot_ - 1;
49 }
51 {
53 }
54 // Returns the surface between the two control volumes for the requested flux
55 // (flux in direction dir for velocity component compo, flux layer k_layer)
56 double get_surface(int k_layer, int compo, int dir)
57 {
58 // specific coding for uniform mesh in i and j, variable mesh in k:
59 switch(compo)
60 {
61 case 0:
62 case 1:
63 switch(dir)
64 {
65 case 0:
66 return delta_y_ * delta_z_[k_layer];
67 case 1:
68 return delta_x_ * delta_z_[k_layer];
69 case 2:
70 default:
71 return delta_x_ * delta_y_;
72 }
73 case 2:
74 default:
75 switch(dir)
76 {
77 case 0:
78 return delta_y_ * (delta_z_[k_layer - 1] + delta_z_[k_layer]) * 0.5;
79 case 1:
80 return delta_x_ * (delta_z_[k_layer - 1] + delta_z_[k_layer]) * 0.5;
81 case 2:
82 default:
83 return delta_x_ * delta_y_;
84 }
85 }
86 }
87 // Returns the surfaces of the two ajacent faces to the edge for the requested flux,
88 // (faces oriented in direction "dir", adjacent in direction "compo")
89 void get_surface_leftright(int k_layer, int compo, int dir, double& left, double& right)
90 {
91 // specific coding for uniform mesh in i and j, variable mesh in k:
92 switch(compo)
93 {
94 case 0:
95 case 1:
96 switch(dir)
97 {
98 case 0:
99 left = right = delta_y_ * delta_z_[k_layer];
100 break;
101 case 1:
102 left = right = delta_x_ * delta_z_[k_layer];
103 break;
104 case 2:
105 default:
106 left = right = delta_x_ * delta_y_;
107 }
108 break;
109 case 2:
110 default:
111 switch(dir)
112 {
113 case 0:
114 left = delta_y_ * delta_z_[k_layer - 1];
115 right = delta_y_ * delta_z_[k_layer];
116 break;
117 case 1:
118 left = delta_x_ * delta_z_[k_layer - 1];
119 right = delta_x_ * delta_z_[k_layer];
120 break;
121 case 2:
122 default:
123 left = right = delta_x_ * delta_y_;
124 }
125 break;
126 }
127 }
128 // Returns the inverse of the distance between velocity dof (component "compo",
129 // for gradient in direction "dir")
130 double inv_distance_for_gradient(int k_layer, int compo, int dir)
131 {
132 switch(dir)
133 {
134 case 0:
135 return inv_delta_x_;
136 case 1:
137 return inv_delta_y_;
138 default:
139 if (compo == 2)
140 // flux layer k is, by convention, between face k-1 and face k, which is within element k-1:
141 return inv_elem_size_z_[k_layer-1];
142 else
143 return inv_dist_z_elemcenter_[k_layer];
144 }
145 }
146 const ArrOfDouble_with_ghost& get_delta_z() const
147 {
148 return delta_z_;
149 }
150 double get_delta_x() const
151 {
152 return delta_x_;
153 }
154 double get_delta_y() const
155 {
156 return delta_y_;
157 }
158 double get_delta(int dir, int k_layer=-1) const
159 {
160 switch (dir)
161 {
162 case 0:
163 return delta_x_;
164 case 1:
165 return delta_y_;
166 case 2:
167 {
168 if(k_layer==-1)
169 {
170 Cerr << "Operateur_IJK_data_channel:get_delta:: invalid k_layer" << finl;
172 }
173 return delta_z_[k_layer];
174 }
175 default:
176 {
177 Cerr << "Operateur_IJK_data_channel:get_delta:: invalid direction" << finl;
179 return 0.;
180 }
181 }
182 }
183
184 double get_delta_xyz(int k_layer, int dir)
185 {
186 switch (dir)
187 {
188 case 0:
189 return delta_x_;
190 case 1:
191 return delta_y_;
192 case 2:
193 return delta_z_[k_layer];
194 default:
195 return delta_x_;
196 }
197 }
198
200 {
201 return uniform_k_ && perio_k_;
202 }
203
205 {
206 return perio_k_;
207 }
208
209protected:
210 // Total number of mesh cells in the k direction (in global mesh)
212 // adding this offset to a local k_layer we known where we are in the global mesh
214 // Mesh sizes for surface and distance computations:
215 double delta_x_; // uniform in i and j directions
216 double delta_y_;
217 ArrOfDouble_with_ghost delta_z_; // Size of mesh cells in z direction
218
219 double inv_delta_x_; // shortcut for inverse of cell size...
221 // inverse of size of elements (distance between k-oriented faces in k direction)
222 ArrOfDouble_with_ghost inv_elem_size_z_;
223 // inverse of distance between element centers (and distance to wall at boundaries)
224 // at index k we have the distance between elements k-1 and k
225 ArrOfDouble_with_ghost inv_dist_z_elemcenter_;
226
229};
230#endif
This class encapsulates all the information related to the eulerian mesh for TrioIJK.
Definition Domaine_IJK.h:47
int last_global_k_layer_flux(int icompo, int idir) const
double get_delta_xyz(int k_layer, int dir)
void initialize(const Domaine_IJK &splitting)
double get_delta(int dir, int k_layer=-1) const
void get_surface_leftright(int k_layer, int compo, int dir, double &left, double &right)
int first_global_k_layer_flux(int icompo, int idir) const
double inv_distance_for_gradient(int k_layer, int compo, int dir)
ArrOfDouble_with_ghost inv_dist_z_elemcenter_
double get_surface(int k_layer, int compo, int dir)
const ArrOfDouble_with_ghost & get_delta_z() const
static void exit(int exit_code=-1)
Routine de sortie de TRUST dans une region Kokkos.
Definition Process.cpp:455