16#ifndef OpConvDiscQuickIJKScalar_included
17#define OpConvDiscQuickIJKScalar_included
19#include <Operateur_IJK_elem_conv_base.h>
27 void calculer(
const IJK_Field_double& field,
28 const IJK_Field_double& vx,
const IJK_Field_double& vy,
const IJK_Field_double& vz,
29 IJK_Field_double& result)
override;
30 void ajouter(
const IJK_Field_double& field,
31 const IJK_Field_double& vx,
const IJK_Field_double& vy,
const IJK_Field_double& vz,
32 IJK_Field_double& result)
override;
35 inline void compute_flux_x(IJK_Field_local_double& resu,
const int k_layer)
override
37 compute_flux_<DIRECTION::X>(resu,k_layer);
39 inline void compute_flux_y(IJK_Field_local_double& resu,
const int k_layer)
override
41 compute_flux_<DIRECTION::Y>(resu,k_layer);
43 inline void compute_flux_z(IJK_Field_local_double& resu,
const int k_layer)
override
45 compute_flux_<DIRECTION::Z>(resu,k_layer);
52 template <DIRECTION _DIR_>
53 void compute_flux_(IJK_Field_local_double& resu,
const int k_layer);
58template <DIRECTION _DIR_>
59void OpConvDiscQuickIJKScalar_double::compute_flux_(IJK_Field_local_double& resu,
const int k_layer)
61 if(_DIR_==DIRECTION::Z)
73 ConstIJK_double_ptr input_field(*
input_field_, 0, 0, k_layer);
77 IJK_double_ptr resu_ptr(resu, 0, 0, 0);
83 if(_DIR_==DIRECTION::X)
88 if(_DIR_==DIRECTION::Y)
94 if(_DIR_==DIRECTION::Z)
100 const double dx_squared_over_8 = dx * dx * 0.125;
102 if(_DIR_==DIRECTION::Z)
105 const int global_k_layer = k_layer +
channel_data_.offset_to_global_k_layer();
108 const int first_global_k_layer = 0;
109 const int last_global_k_layer =
channel_data_.nb_elem_k_tot();
115 if (!
perio_k_ && (global_k_layer <= first_global_k_layer || global_k_layer >= last_global_k_layer))
126 for (
int j = 0; ; j++)
128 for (
int i = 0; i < imax; i += vsize)
130 Simd_double velocity;
131 velocity_dir.get_center(i, velocity);
132 double indm1, ind0, ind1, ind2;
133 input_indicatrice.get_leftleft_left_center_right(_DIR_,i, indm1, ind0, ind1, ind2);
134 const double diphm1 = indm1*(1-indm1)<DMINFLOAT?0:1;
135 const double diph0 = ind0*(1-ind0)<DMINFLOAT?0:1;
136 const double diph1 = ind1*(1-ind1)<DMINFLOAT?0:1;
137 const double diph2 = ind2*(1-ind2)<DMINFLOAT?0:1;
139 if ((!diphm1) && (!diph0) && (!diph1) && (!diph2))
142 Simd_double fram0, fram1;
143 Simd_double curv0, curv1;
144 input_field.get_left_center(_DIR_, i, T0, T1);
145 fram_values.get_left_center(_DIR_, i, fram0, fram1);
146 curv_values.get_left_center(_DIR_, i, curv0, curv1);
147 Simd_double fram = SimdMax(fram0, fram1);
148 Simd_double curv = SimdSelect<double>(velocity, 0., curv1, curv0);
149 Simd_double T_amont = SimdSelect<double>(velocity, 0., T1 , T0 );
150 Simd_double flux = (T0 + T1) * 0.5 - dx_squared_over_8 * curv;
151 flux = ((1. - fram) * flux + fram * T_amont) * velocity * surface;
152 resu_ptr.put_val(i, flux);
154 else if (((diph0) && (diph1)) || ((!diph0) && (!diph1) && (diph2 || diphm1)))
157 input_field.get_left_center(_DIR_, i, T0, T1);
158 Simd_double flux = (T0 + T1) * 0.5 ;
159 flux = flux * velocity * surface;
160 resu_ptr.put_val(i, flux);
162 else if ((diph1) && (!diph0) && (!diphm1))
164 Simd_double Tm1, T0, T1, T2;
165 input_field.get_leftleft_left_center_right(_DIR_, i, Tm1, T0, T1, T2);
166 Simd_double flux = T0 + (T0 - Tm1)*0.5 ;
167 flux = flux * velocity * surface;
168 resu_ptr.put_val(i, flux);
170 else if ((diph0) && (!diph1) && (!diph2))
172 Simd_double T0, T1, T2;
173 input_field.get_left_center_right(_DIR_, i, T0, T1, T2);
174 Simd_double flux = T1 - (T2 - T1)*0.5 ;
175 flux = flux * velocity * surface;
176 resu_ptr.put_val(i, flux);
178 else if ((diph1) && (!diph0) && (diphm1))
181 input_field.get_left_center(_DIR_, i, T0, T1);
182 Simd_double flux = T0;
183 flux = flux * velocity * surface;
184 resu_ptr.put_val(i, flux);
186 else if ((diph0) && (!diph1) && (diph2))
189 input_field.get_left_center(_DIR_, i, T0, T1);
190 Simd_double flux = T1;
191 flux = flux * velocity * surface;
192 resu_ptr.put_val(i, flux);
198 input_field.next_j();
199 velocity_dir.next_j();
200 fram_values.next_j();
201 curv_values.next_j();
void compute_flux_x(IJK_Field_local_double &resu, const int k_layer) override
OpConvDiscQuickIJKScalar_double()
void compute_flux_z(IJK_Field_local_double &resu, const int k_layer) override
void ajouter(const IJK_Field_double &field, const IJK_Field_double &vx, const IJK_Field_double &vy, const IJK_Field_double &vz, IJK_Field_double &result) override
const IJK_Field_local_double * input_indicatrice_
void calculer(const IJK_Field_double &field, const IJK_Field_double &vx, const IJK_Field_double &vy, const IJK_Field_double &vz, IJK_Field_double &result) override
void compute_flux_y(IJK_Field_local_double &resu, const int k_layer) override
const IJK_Field_double & get_input_velocity(DIRECTION _DIR_)
Operateur_IJK_data_channel channel_data_
const IJK_Field_double * input_field_
void compute_curv_fram(DIRECTION _DIR_, int k_layer)
void shift_curv_fram(IJK_Field_local_double &tmp_curv_fram)
IJK_Field_local_double tmp_curv_fram_
int stored_curv_fram_layer_z_