TRUST 1.9.8
HPC thermohydraulic platform
Loading...
Searching...
No Matches
IJK_Shear_Periodic_helpler.cpp
1/****************************************************************************
2* Copyright (c) 2025, 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 <IJK_Shear_Periodic_helpler.h>
17#include <Domaine_IJK.h>
18
25
26void IJK_Shear_Periodic_helpler::allocate(const int ni_local, const int nj_local, const int nk_local, int ghost_size, int ncompo, int type, double rov, double rol, int use_inv_rho_in_pressure_solver)
27{
29 x_.resize_array(order_interpolation_+1);
30 denum_.resize_array(order_interpolation_+1);
31 res_.resize_array(order_interpolation_+1);
32 send_i_real_.resize_array(order_interpolation_+1);
34 use_inv_rho_in_pressure_solver_= use_inv_rho_in_pressure_solver;
35 // monofluide_variable_==1 is for pressure field in case of shear periodicity
36 // monofluide_variable_==2 is for physical proerties (rho, mu, nu etc.) in case of shear periodicity
38 {
39 indicatrice_ghost_zmin_.allocate(ni_local, nj_local, 4, ghost_size, 0, ncompo);
40 indicatrice_ghost_zmax_.allocate(ni_local, nj_local, 4, ghost_size, 0, ncompo);
41 I_sig_kappa_zmin_.allocate(ni_local, nj_local, 4, ghost_size, 0, ncompo);
42 I_sig_kappa_zmax_.allocate(ni_local, nj_local, 4, ghost_size, 0, ncompo);
43 Phi_ppty_v_ = rov;
44 Phi_ppty_l_ = rol;
45 }
46 else if (monofluide_variable_==1)
47 {
48 I_sig_kappa_zmin_.allocate(ni_local, nj_local, 4, ghost_size, 0, ncompo);
49 I_sig_kappa_zmax_.allocate(ni_local, nj_local, 4, ghost_size, 0, ncompo);
50 Phi_ppty_v_ = rov;
51 Phi_ppty_l_ = rol;
52 }
53}
54
55
56void IJK_Shear_Periodic_helpler::prepare_interpolation_for_shear_periodicity(const int send_i, const double istmp, const int real_size_i)
57{
58 // prepare the shear-periodicity interpolation at a given i elevation.
59 // shear periodicity is only available on the component DU/DZ
60 int nb_points = order_interpolation_+1;
61
62 if (nb_points==2)
63 {
64 x_[0] = (int) floor(istmp);
65 x_[1] = (int) floor(istmp)+1;
66 }
67 else if(nb_points==3)
68 {
69 x_[0] = send_i-1;
70 x_[1] = send_i;
71 x_[2] = send_i+1;
72 }
73 else if(nb_points==5)
74 {
75 x_[0] = send_i-2;
76 x_[1] = send_i-1;
77 x_[2] = send_i;
78 x_[3] = send_i+1;
79 x_[4] = send_i+2;
80 }
81 else if(nb_points==7)
82 {
83 x_[0] = send_i-3;
84 x_[1] = send_i-2;
85 x_[2] = send_i-1;
86 x_[3] = send_i;
87 x_[4] = send_i+1;
88 x_[5] = send_i+2;
89 x_[6] = send_i+3;
90 }
91
92 for (int pt = 0; pt < nb_points ; pt++)
93 {
94 send_i_real_[pt]=(x_[pt] % real_size_i + real_size_i) % real_size_i;
95 denum_[pt] = 1.;
96 res_[pt] = 1.;
97 for (int pt_autre = 0; pt_autre < nb_points ; pt_autre++)
98 {
99 if (pt_autre!=pt)
100 {
101 denum_[pt] *= (double)(x_[pt] - x_[pt_autre]);
102 res_[pt] *= (istmp - x_[pt_autre]);
103 }
104 }
105 }
106
107 return;
108}
109
IJK_Field_local_template< double, ArrOfDouble > I_sig_kappa_zmax_
IJK_Field_local_template< double, ArrOfDouble > I_sig_kappa_zmin_
IJK_Field_local_template< double, ArrOfDouble > indicatrice_ghost_zmin_
void allocate(const int ni_local, const int nj_local, const int nk_local, int ghost_size, int ncompo, int type, double rov, double rol, int use_inv_rho_in_pressure_solver)
void prepare_interpolation_for_shear_periodicity(const int send_i, const double istmp, const int real_size_i)
IJK_Field_local_template< double, ArrOfDouble > indicatrice_ghost_zmax_