TrioCFD 1.9.8
TrioCFD documentation
Loading...
Searching...
No Matches
OpGradCentre2IJKScalar.cpp
1/****************************************************************************
2* Copyright (c) 2023, 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 <OpGradCentre2IJKScalar.h>
17
18Implemente_instanciable_sans_constructeur( OpGradCentre2IJKScalar_double, "OpGradCentre2IJKScalar_double", OpConvCentre2IJKScalar_double ) ;
19
21{
22 return os;
23}
24
26{
27 return is;
28}
29
30void OpGradCentre2IJKScalar_double::calculer_grad(const IJK_Field_double& field,
31 IJK_Field_vector3_double& result)
32{
33 input_field_ = &field;
34 compute_grad(result);
35 input_field_ = nullptr;
36 input_velocity_x_ = nullptr;
37 input_velocity_y_ = nullptr;
38 input_velocity_z_ = nullptr;
39}
40
41void OpGradCentre2IJKScalar_double::calculer_grad_x(const IJK_Field_double& field,
42 IJK_Field_double& result)
43{
44 input_field_ = &field;
45 compute_grad_x(result);
46 input_field_ = nullptr;
47 input_velocity_x_ = nullptr;
48 input_velocity_y_ = nullptr;
49 input_velocity_z_ = nullptr;
50}
51
52void OpGradCentre2IJKScalar_double::calculer_grad_y(const IJK_Field_double& field,
53 IJK_Field_double& result)
54{
55 input_field_ = &field;
56 compute_grad_y(result);
57 input_field_ = nullptr;
58 input_velocity_x_ = nullptr;
59 input_velocity_y_ = nullptr;
60 input_velocity_z_ = nullptr;
61}
62
63void OpGradCentre2IJKScalar_double::calculer_grad_z(const IJK_Field_double& field,
64 IJK_Field_double& result)
65{
66 input_field_ = &field;
67 compute_grad_z(result);
68 input_field_ = nullptr;
69 input_velocity_x_ = nullptr;
70 input_velocity_y_ = nullptr;
71 input_velocity_z_ = nullptr;
72}
73
74void OpGradCentre2IJKScalar_double::fill_grad_field_x_y_(IJK_Field_local_double& flux, IJK_Field_double& resu, int k, int dir)
75{
76 int ni = resu.ni();
77 int nj = resu.nj();
78 switch(dir)
79 {
80 case 0:
81 for (int i=0; i < ni; i++)
82 for (int j=0; j < nj; j++)
83 resu(i,j,k) = flux(i+1,j,0) - flux(i,j,0);
84 break;
85 case 1:
86 for (int i=0; i < ni; i++)
87 for (int j=0; j < nj; j++)
88 resu(i,j,k) = flux(i,j+1,0) - flux(i,j,0);
89 break;
90 }
91}
92
93void OpGradCentre2IJKScalar_double::fill_grad_field_z_(IJK_Field_local_double& flux_min,
94 IJK_Field_local_double& flux_max,
95 IJK_Field_double& resu, int k)
96{
97 int ni = resu.ni();
98 int nj = resu.nj();
99 for (int i=0; i < ni; i++)
100 for (int j=0; j < nj; j++)
101 {
102 // TODO: What happen if dz is not constant ? The FD operator is no longer define
103 double dz_inv = is_flux_ ? 1.: 1 / channel_data_.get_delta_z()[k];
104 resu(i,j,k) = (flux_max(i,j,0) - flux_min(i,j,0)) * dz_inv;
105 }
106}
107
108Implemente_instanciable_sans_constructeur( OpGradFluxCentre2IJKScalar_double, "OpGradFluxCentre2IJKScalar_double", OpGradCentre2IJKScalar_double ) ;
109
111{
112 return os;
113}
114
116{
117 return is;
118}
119
121 const IJK_Field_double& vx,
122 const IJK_Field_double& vy,
123 const IJK_Field_double& vz,
124 IJK_Field_vector3_double& result)
125{
126 input_velocity_x_ = &vx;
127 input_velocity_y_ = &vy;
128 input_velocity_z_ = &vz;
129 calculer_grad(field, result);
130 result.echange_espace_virtuel();
131}
132
133void OpGradFluxCentre2IJKScalar_double::fill_grad_field_x_y_(IJK_Field_local_double& flux, IJK_Field_double& resu, int k, int dir)
134{
135 int ni = resu.ni();
136 int nj = resu.nj();
137 for (int i=0; i < ni; i++)
138 for (int j=0; j < nj; j++)
139 resu(i,j,k) = flux(i,j,0);
140}
141
142void OpGradFluxCentre2IJKScalar_double::fill_grad_field_z_(IJK_Field_local_double& flux_min,
143 IJK_Field_local_double& flux_max,
144 IJK_Field_double& resu, int k)
145{
146 fill_grad_field_x_y_(flux_min, resu, k, 2);
147}
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
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
void calculer_grad_x(const IJK_Field_double &field, IJK_Field_double &result)
void calculer_grad_y(const IJK_Field_double &field, IJK_Field_double &result)
void fill_grad_field_x_y_(IJK_Field_local_double &flux, IJK_Field_double &resu, int k, int dir) override
void fill_grad_field_z_(IJK_Field_local_double &flux_min, IJK_Field_local_double &flux_max, IJK_Field_double &resu, int k) override
void calculer_grad(const IJK_Field_double &field, IJK_Field_vector3_double &result)
void calculer_grad_z(const IJK_Field_double &field, IJK_Field_double &result)
void fill_grad_field_x_y_(IJK_Field_local_double &flux, IJK_Field_double &resu, int k, int dir) override
void fill_grad_field_z_(IJK_Field_local_double &flux_min, IJK_Field_local_double &flux_max, IJK_Field_double &resu, int k) override
void calculer_grad_flux(const IJK_Field_double &field, const IJK_Field_double &vx, const IJK_Field_double &vy, const IJK_Field_double &vz, IJK_Field_vector3_double &result)
virtual void compute_grad(IJK_Field_vector3_double &dx)
virtual void compute_grad_x(IJK_Field_double &dx)
virtual void compute_grad_y(IJK_Field_double &dx)
virtual void compute_grad_z(IJK_Field_double &dx)
Classe de base des flux de sortie.
Definition Sortie.h:52