TrioCFD 1.9.8
TrioCFD documentation
Loading...
Searching...
No Matches
OpConvQuickIJKScalar_cut_cell.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 OpConvQuickIJKScalar_cut_cell_included
17#define OpConvQuickIJKScalar_cut_cell_included
18
19#include <OpConvQuickIJKScalar.h>
20
22{
23 Declare_instanciable_sans_constructeur(OpConvQuickIJKScalar_cut_cell_double);
24
25public:
27
28 void initialise_cut_cell(Cut_cell_conv_scheme cut_cell_conv_scheme,
29 bool ignore_small_cells,
31 IJK_Field_int& treatment_count,
32 int& new_treatment)
33 {
34 cut_cell_conv_scheme_ = cut_cell_conv_scheme;
35 ignore_small_cells_ = ignore_small_cells;
36 cut_cell_flux_ = &cut_cell_flux;
37 treatment_count_ = &treatment_count;
38 new_treatment_ = &new_treatment;
39 }
40
41 void set_runge_kutta(int rk_step, double dt_tot, IJK_Field_vector3_double& current_fluxes, IJK_Field_vector3_double& RK3_F_fluxes, Cut_field_int& cellule_rk_restreint_conv_main)
42 {
43 if (rk_step == -1)
44 {
46 rk_step_ = -1;
47 dt_tot_ = 0;
48 current_fluxes_ = nullptr;
49 RK3_F_fluxes_ = nullptr;
50 cellule_rk_restreint_conv_main_ = nullptr;
51 }
52 else
53 {
55 rk_step_ = rk_step;
56 dt_tot_ = dt_tot;
57 current_fluxes_ = &current_fluxes;
58 RK3_F_fluxes_ = &RK3_F_fluxes;
59 cellule_rk_restreint_conv_main_ = &cellule_rk_restreint_conv_main;
60 }
61 };
62
64 {
65 assert(&(*cut_cell_flux_)[0].get_cut_cell_disc() == &(*cut_cell_flux_)[1].get_cut_cell_disc());
66 assert(&(*cut_cell_flux_)[0].get_cut_cell_disc() == &(*cut_cell_flux_)[2].get_cut_cell_disc());
67 return &(*cut_cell_flux_)[0].get_cut_cell_disc();
68 }
69
71 {
72 return cut_cell_flux_;
73 }
74
76 const IJK_Field_local_double& flux_x,
77 const IJK_Field_local_double& flux_y,
78 const IJK_Field_local_double& flux_zmin,
79 const IJK_Field_local_double& flux_zmax,
80 IJK_Field_double& resu, int k_layer, bool add);
81
82 void Operator_IJK_div(const IJK_Field_local_double& flux_x, const IJK_Field_local_double& flux_y,
83 const IJK_Field_local_double& flux_zmin, const IJK_Field_local_double& flux_zmax,
84 IJK_Field_double& resu, int k_layer, bool add) override
85 {
86 Operateur_IJK_elem_base_double::Operator_IJK_div(flux_x, flux_y, flux_zmin, flux_zmax, resu, k_layer, add);
87
89 compute_cut_cell_divergence(cut_cell_flux, flux_x, flux_y, flux_zmin, flux_zmax, resu, k_layer, add);
90 }
91
92protected:
93
94 inline void compute_flux_x(IJK_Field_local_double& resu, const int k_layer) override
95 {
96 compute_flux_<DIRECTION::X>(resu,k_layer);
97 }
98 inline void compute_flux_y(IJK_Field_local_double& resu, const int k_layer) override
99 {
100 compute_flux_<DIRECTION::Y>(resu,k_layer);
101 }
102 inline void compute_flux_z(IJK_Field_local_double& resu, const int k_layer) override
103 {
104 compute_flux_<DIRECTION::Z>(resu,k_layer);
105 }
106
107private:
108 template <DIRECTION _DIR_>
109 void compute_flux_(IJK_Field_local_double& resu, const int k_layer);
110
111 template <DIRECTION _DIR_>
112 double compute_flux_local_(int i, int j, int k);
113
114 template <DIRECTION _DIR_>
115 double compute_flux_local_(int k_layer, double delta_xyz, double surface, double velocity, double input_left_left, double input_left, double input_centre, double input_right);
116
117 template <DIRECTION _DIR_>
118 double compute_flux_local_(double surface, double velocity, double input);
119
120 template <DIRECTION _DIR_>
121 bool flux_determined_by_wall_(int k);
122
123 template <DIRECTION _DIR_>
124 Vecteur3 compute_curv_fram_local_(int k_layer, double input_left, double input_centre, double input_right);
125
126 void correct_flux(IJK_Field_local_double *const flux, int k_layer, const int dir) override;
127
128 template <DIRECTION _DIR_>
129 inline void correct_flux_(IJK_Field_local_double *const flux, int k_layer);
130
131 bool ignore_small_cells_ = true;
132 Cut_cell_conv_scheme cut_cell_conv_scheme_;
133
134 FixedVector<Cut_cell_double, 3> *cut_cell_flux_ = nullptr;
135 Cut_field_int *cellule_rk_restreint_conv_main_ = nullptr;
136
137 IJK_Field_int *treatment_count_ = nullptr;
138 int *new_treatment_ = nullptr;
139
140};
141
142#include <OpConvQuickIJKScalar_cut_cell.tpp>
143
144#endif /* OpConvQuickScalarIJK_cut_cell_included */
void compute_cut_cell_divergence(const FixedVector< Cut_cell_double, 3 > &cut_cell_flux, const IJK_Field_local_double &flux_x, const IJK_Field_local_double &flux_y, const IJK_Field_local_double &flux_zmin, const IJK_Field_local_double &flux_zmax, IJK_Field_double &resu, int k_layer, bool add)
void compute_flux_z(IJK_Field_local_double &resu, const int k_layer) override
void set_runge_kutta(int rk_step, double dt_tot, IJK_Field_vector3_double &current_fluxes, IJK_Field_vector3_double &RK3_F_fluxes, Cut_field_int &cellule_rk_restreint_conv_main)
void initialise_cut_cell(Cut_cell_conv_scheme cut_cell_conv_scheme, bool ignore_small_cells, FixedVector< Cut_cell_double, 3 > &cut_cell_flux, IJK_Field_int &treatment_count, int &new_treatment)
FixedVector< Cut_cell_double, 3 > * get_cut_cell_flux()
void compute_flux_x(IJK_Field_local_double &resu, const int k_layer) override
void compute_flux_y(IJK_Field_local_double &resu, const int k_layer) override
void Operator_IJK_div(const IJK_Field_local_double &flux_x, const IJK_Field_local_double &flux_y, const IJK_Field_local_double &flux_zmin, const IJK_Field_local_double &flux_zmax, IJK_Field_double &resu, int k_layer, bool add) override
virtual void Operator_IJK_div(const IJK_Field_local_double &flux_x, const IJK_Field_local_double &flux_y, const IJK_Field_local_double &flux_zmin, const IJK_Field_local_double &flux_zmax, IJK_Field_double &resu, int k_layer, bool add)
IJK_Field_vector3_double * current_fluxes_
IJK_Field_vector3_double * RK3_F_fluxes_