TRUST 1.9.8
HPC thermohydraulic platform
Loading...
Searching...
No Matches
IJK_Navier_Stokes_tools.h
1/****************************************************************************
2* Copyright (c) 2026, 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 IJK_Navier_Stokes_tools_included
17#define IJK_Navier_Stokes_tools_included
18
19#include <IJK_tools.h>
20
23
24double compute_fractionnal_timestep_rk3(const double dt_tot, int step);
25
26void compute_divergence_times_constant(const IJK_Field_double& vx, const IJK_Field_double& vy, const IJK_Field_double& vz,
27 const double constant, IJK_Field_double& resu);
28
29void compute_divergence(const IJK_Field_double& vx, const IJK_Field_double& vy, const IJK_Field_double& vz,
30 IJK_Field_double& resu);
31
32void add_gradient_times_constant(const IJK_Field_double& pressure, const double constant,
33 IJK_Field_double& vx, IJK_Field_double& vy, IJK_Field_double& vz);
34
35void add_gradient_times_constant_over_rho(const IJK_Field_double& pressure, const IJK_Field_double& rho, const double constant,
36 IJK_Field_double& vx, IJK_Field_double& vy, IJK_Field_double& vz);
37void add_gradient_times_constant_times_inv_rho(const IJK_Field_double& pressure, const IJK_Field_double& inv_rho, const double constant,
38 IJK_Field_double& vx, IJK_Field_double& vy, IJK_Field_double& vz);
39
40void pressure_projection(IJK_Field_double& vx, IJK_Field_double& vy, IJK_Field_double& vz,
41 IJK_Field_double& pressure, double dt,
42 IJK_Field_double& pressure_rhs,
43 Multigrille_Adrien& poisson_solver);
44
45void pressure_projection_with_rho(const IJK_Field_double& rho,
46 IJK_Field_double& vx, IJK_Field_double& vy, IJK_Field_double& vz,
47 IJK_Field_double& pressure, double dt,
48 IJK_Field_double& pressure_rhs,
49 Multigrille_Adrien& poisson_solver, int NoSym);
50
51void pressure_projection_with_inv_rho(const IJK_Field_double& rho,
52 IJK_Field_double& vx, IJK_Field_double& vy, IJK_Field_double& vz,
53 IJK_Field_double& pressure, double dt,
54 IJK_Field_double& pressure_rhs,
55 Multigrille_Adrien& poisson_solver, int NoSym);
56
57void forward_euler_update(const IJK_Field_double& dv, IJK_Field_double& v,
58 const int k_layer, double dt_tot);
59
60void runge_kutta3_update(const IJK_Field_double& dv, IJK_Field_double& F, IJK_Field_double& v,
61 const int step, const int k_layer, double dt_tot);
62
63void runge_kutta3_update_surfacic_fluxes(IJK_Field_double& dv, IJK_Field_double& F,
64 const int step, const int k_layer, double dt_tot);
65
66void force_zero_on_walls(IJK_Field_double& vz);
67
68template<class T, int N>
69void allocate_velocity(IJK_Field_vector<T, N>& v, const Domaine_IJK& s, int ghost, const Nom& nam=Nom(), double DU=0.)
70{
71 assert(static_cast<int>(N) == 3);
72
73 v.get_ptr(0) = std::make_shared<IJK_Field_template<T,TRUSTArray<T>>>();
74 v.get_ptr(1) = std::make_shared<IJK_Field_template<T,TRUSTArray<T>>>();
75 v.get_ptr(2) = std::make_shared<IJK_Field_template<T,TRUSTArray<T>>>();
76
77 v[0].allocate(s, Domaine_IJK::FACES_I, ghost);
78 v[1].allocate(s, Domaine_IJK::FACES_J, ghost);
79 v[2].allocate(s, Domaine_IJK::FACES_K, ghost);
80 v[0].get_shear_BC_helpler().set_dU_(DU);
81 v[1].get_shear_BC_helpler().set_dU_(0.);
82 v[2].get_shear_BC_helpler().set_dU_(0.);
83
84 v.nommer(nam);
85 v.localisation() = Entity::FACE;
86}
87
88template<class T, int N>
89void allocate_cell_vector(IJK_Field_vector<T, N>& v, const Domaine_IJK& s, int ghost, const Nom& nam=Nom())
90{
91 for (int i=0; i<N ; i++)
92 {
93 v.get_ptr(i) = std::make_shared<IJK_Field_template<T,TRUSTArray<T>>>();
94 v[i].allocate(s, Domaine_IJK::ELEM, ghost);
95 IJK_Field_template<T,TRUSTArray<T>>::increase_alloc_counter();
96 }
97 v.nommer(nam);
98 v.localisation() = Entity::ELEMENT;
99}
100
101void calculer_rho_v(const IJK_Field_double& rho,
102 const IJK_Field_vector3_double& v,
103 IJK_Field_vector3_double& rho_v);
104
105void calculer_rho_harmonic_v(const IJK_Field_double& rho,
106 const IJK_Field_vector3_double& v,
107 IJK_Field_vector3_double& rho_v);
108
109double get_channel_control_volume(IJK_Field_double& field, int local_k_layer, const ArrOfDouble_with_ghost& delta_z_local);
110
111void mass_solver_with_rho(IJK_Field_double& velocity, const IJK_Field_double& rho, const ArrOfDouble_with_ghost& delta_z_local, const int k);
112void mass_solver_with_inv_rho(IJK_Field_double& velocity, const IJK_Field_double& inv_rho, const ArrOfDouble_with_ghost& delta_z_local, const int k);
113
114void mass_solver_scalar(IJK_Field_double& dv, const ArrOfDouble_with_ghost& delta_z_local, int k_index);
115
116void density_solver_with_rho(IJK_Field_double& velocity, const IJK_Field_double& rho, const ArrOfDouble_with_ghost& delta_z_local, const int k);
117
118// fonction moyenne en temps du champs de vitesse utilise dans le cas de bulles fixes
119void update_integral_velocity(const IJK_Field_vector3_double& v_instant, IJK_Field_vector3_double& v_tmp,
120 const IJK_Field_double& indic, const IJK_Field_double& indic_tmp);
121void compute_and_store_gradU_cell(const IJK_Field_double& vitesse_i,
122 const IJK_Field_double& vitesse_j,
123 const IJK_Field_double& vitesse_k,
124 /* Et les champs en sortie */
125 IJK_Field_double& dudx, IJK_Field_double& dvdy, IJK_Field_double& dwdx,
126 IJK_Field_double& dudz, IJK_Field_double& dvdz, IJK_Field_double& dwdz,
127 const int compute_all,
128 /* Following will be untouched if compute_all is 0 */
129 IJK_Field_double& dudy, IJK_Field_double& dvdx, IJK_Field_double& dwdy,
130 IJK_Field_double& lambda2);
131
132void supprimer_chevauchement(IJK_Field_double& ind);
133
134void update_integral_pressure(const IJK_Field_double& p_instant, IJK_Field_double& p_tmp, const IJK_Field_double& indic, const IJK_Field_double& indic_tmp);
135void update_integral_indicatrice(const IJK_Field_double& indic, const double deltat, IJK_Field_double& out);
136
137double calculer_v_moyen(const IJK_Field_double& vx);
138double calculer_vl_moyen(const IJK_Field_double& vx, const IJK_Field_double& indic);
139double calculer_rho_cp_u_moyen(const IJK_Field_double& vx, const IJK_Field_double& cp_rhocp, const IJK_Field_double& rho_field, const double& rho_cp, const int rho_cp_case);
140
141
142
143//double compute_spatial_mean(const IJK_Field_double& vx, const IJK_Field_double& variable, const IJK_Field_double& cp, const IJK_Field_double& rho_field, const int kmin, const int nktot, const int k);
144double calculer_temperature_adimensionnelle_theta_moy(const IJK_Field_double& vx,
145 const IJK_Field_double& temperature_adimensionnelle_theta,
146 const IJK_Field_double& cp_rhocp_rhocpinv,
147 const IJK_Field_double& rho_field,
148 const double& rho_cp,
149 const int rho_cp_case);
150
151double calculer_temperature_theta_moy(const IJK_Field_double& vx, const IJK_Field_double& temperature,
152 const IJK_Field_double& cp, const IJK_Field_double& rho_field);
153
154double calculer_variable_wall(const IJK_Field_double& variable, const IJK_Field_double& cp_rhocp_rhocpinv, const IJK_Field_double& rho_field, const double& rho_cp, const int kmin, const int kmax, const int rho_cp_case);
155void calculer_rho_cp_var(const IJK_Field_double& variable, const IJK_Field_double& cp_rhocp_rhocpinv, const IJK_Field_double& rho, const double& rho_cp, double& rho_cp_moy, double& variable_moy, int k, const int rho_cp_case);
156
157double calculer_tauw(const IJK_Field_double& vx, const double mu_liquide);
158
159void calculer_gradient_temperature(const IJK_Field_double& temperature, IJK_Field_vector3_double& grad_T);
160void add_gradient_temperature(const IJK_Field_double& temperature, const double constant, IJK_Field_double& vx,
161 IJK_Field_double& vy, IJK_Field_double& vz, const Boundary_Conditions_Thermique& boundary, const IJK_Field_double& lambda);
162
163void force_entry_velocity(IJK_Field_double& vx, IJK_Field_double& vy, IJK_Field_double& vz, double v_imposed, const int& dir, const int& compo, const int& stencil);
164
165double calculer_v_moyen(const IJK_Field_double& vx);
166double calculer_vl_moyen(const IJK_Field_double& vx, const IJK_Field_double& indic);
167double calculer_rho_cp_u_moyen(const IJK_Field_double& vx, const IJK_Field_double& cp_rhocp, const IJK_Field_double& rho_field, const double& rho_cp, const int rho_cp_case);
168
169#endif /* IJK_Navier_Stokes_tools_included */
: class Boundary_Conditions_Thermique
This class encapsulates all the information related to the eulerian mesh for TrioIJK.
Definition Domaine_IJK.h:47
: This class is an IJK_Field_local with parallel informations.
The class IJK_Field_vector is a fixed array of polymorphic IJK fields.
std::shared_ptr< IJK_Field_template< T, TRUSTArray< T > > > & get_ptr(int i)
Entity & localisation()
void nommer(const Nom &nam) override
Donne un nom au champ.
class Nom Une chaine de caractere pour nommer les objets de TRUST
Definition Nom.h:31