TrioCFD 1.9.8
TrioCFD documentation
Loading...
Searching...
No Matches
Collision_Model_FT_sphere.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 <Collision_Model_FT_sphere.h>
17#include <Probleme_FT_Disc_gen.h>
18#include <Solid_Particle_sphere.h>
19
20
21// XD Collision_Model_FT_sphere Collision_Model_FT_base Collision_Model_FT_sphere INHERITS_BRACE
22// XD_CONT This class enables to compute solid-solid
23// XD_CONT interactions for fpi module under the framework of
24// XD_CONT soft-sphere collision model. Under this framework,
25// XD_CONT multiple collisions can occurs at the same time (ie a
26// XD_CONT particle can collide with 2 or more particles). The
27// XD_CONT collision is spread out on multiple time steps. A slight
28// XD_CONT overlap (less than the mesh grid size) occurs during the process.
29
30Implemente_instanciable_sans_constructeur(Collision_Model_FT_sphere,"Collision_Model_FT_sphere",Collision_Model_FT_base);
31
35
37{
39 return is;
40}
41
43{
44 Cerr << "Error::printOn is not implemented." << finl;
46 return os;
47}
48
50 const DoubleTab& particles_position,
51 const DoubleTab& particles_velocity,
52 const double& deltat_simu)
53{
54 const int& id_fluid_phase= two_phase_fluid.get_id_fluid_phase();
55 const int& id_solid_phase=1-id_fluid_phase;
56 const auto& solid_particle=ref_cast(Solid_Particle_sphere,two_phase_fluid.fluide_phase(id_solid_phase));
57 const auto& incompressible_fluid=ref_cast(Fluide_Incompressible,
58 two_phase_fluid.fluide_phase(id_fluid_phase));
59 const double& solid_density = solid_particle.masse_volumique().valeurs()(0, 0);
60 const double& fluid_density = incompressible_fluid.masse_volumique().valeurs()(0, 0);
61 const double& fluid_viscosity = fluid_density
62 * incompressible_fluid.viscosite_cinematique().valeurs()(0, 0);
63 const double& radius_sphere=solid_particle.get_radius();
64 const double& volume_sphere=solid_particle.get_volume();
65 const double& e_dry=solid_particle.get_e_dry();
66 const double min_threshold=1e-10;
67 DoubleTab dX(dimension), dU(dimension);
71
72 for (int ind_particle_i = 0; ind_particle_i < nb_real_particles_; ind_particle_i++)
73 {
74 int particle_i=get_particle_i(ind_particle_i);
75 int nb_particles_j=get_nb_particles_j(ind_particle_i);
76 int ind_start_part_j=get_ind_start_particles_j(ind_particle_i);
77 for (int ind_particle_j =ind_start_part_j; ind_particle_j < nb_particles_j; ind_particle_j++)
78 {
79 dX = 0;
80 dU = 0;
81 int particle_j=get_particle_j(ind_particle_i,ind_particle_j);
82 int is_particle_particle_collision = particle_j < nb_particles_tot_;
83 compute_dX_dU(dX, dU, particle_i, particle_j, particles_position,
84 particles_velocity, is_particle_particle_collision);
85 double dist_gravity_center = sqrt(local_carre_norme_vect(dX));
86 double dist_between_particles = dist_gravity_center - 2 * radius_sphere;
87
88 F_now_(particle_i, particle_j) = 0;
89 if (dist_between_particles <= 0) // contact
90 {
91 add_collision(particle_i,particle_j,is_particle_particle_collision);
92 DoubleTab norm(dimension);
93 for (int d = 0; d < dimension; d++)
94 norm(d) = dX(d) / dist_gravity_center;
95
96 double dX_scal_dU = local_prodscal(dX,dU);
97 DoubleTab dUn(dimension);
98 for (int d = 0; d < dimension; d++)
99 dUn(d) = (dX_scal_dU / dist_gravity_center) * norm(d);
100
101 const double impact_velocity = sqrt(local_carre_norme_vect(dUn));
102
103 F_now_(particle_i, particle_j) = 1;
104 int is_start_of_collision = F_now_(particle_i, particle_j) >
105 F_old_(particle_i, particle_j); // We need to know
106 // if this is the first time step of the collision to compute the impact velocity
107
108 DoubleTab next_dX(dimension);
109 for (int d = 0; d < dimension; d++)
110 next_dX(d) = dX(d) + deltat_simu * dU(d);
111 const double next_dist_gravity_center = sqrt(local_carre_norme_vect(next_dX));
112 const double next_dist_between_particles = next_dist_gravity_center - 2 * radius_sphere;
113 const double effective_radius = is_particle_particle_collision ? radius_sphere/2 :
114 radius_sphere;
115 const double impact_Stokes = solid_density * 2 * effective_radius * impact_velocity /
116 (9 * fluid_viscosity);
117 if (is_start_of_collision)
118 e_eff_(particle_i,particle_j)=e_dry*compute_ewet_legendre(impact_Stokes);
119 DoubleTab force_contact=compute_contact_force(
120 next_dist_between_particles,
121 norm,
122 dUn,
123 particle_i,
124 particle_j,
125 dX_scal_dU<=0,
126 is_particle_particle_collision);
127 for (int d = 0; d < dimension; d++)
128 {
129 lagrangian_contact_forces_(particle_i, d) += fabs(force_contact(d)) <=
130 min_threshold ? 0 : force_contact(d) / volume_sphere;
131 if (!is_particle_particle_collision)
132 continue; // wall collision, no force to apply on the wall
133 lagrangian_contact_forces_(particle_j, d) -= fabs(force_contact(d)) <=
134 min_threshold ? 0 : force_contact(d) / volume_sphere;
135 }
136 }
137 F_old_(particle_i, particle_j) = F_now_(particle_i, particle_j);
138 }
139 }
140
142 {
149 }
150}
151
153 const DoubleTab& volumic_phase_indicator_function,
154 const Domaine_VF& domain_vf,
155 const IntTab& particles_eulerian_id_number,
156 DoubleTab& contact_force_source_term)
157{
158 const DoubleVect& interlaced_volumes=domain_vf.volumes_entrelaces();
159 const int nb_faces=interlaced_volumes.size_array();
160 const IntVect& orientation = domain_vf.orientation();
161 const IntTab& face_voisins=domain_vf.face_voisins();
162 for (int face=0; face<nb_faces; face++)
163 {
164 const int left_elem=face_voisins(face,0);
165 const int right_elem=face_voisins(face,1);
166 int id_left = left_elem != -1 ? particles_eulerian_id_number(left_elem) : -1;
167 int id_right = right_elem != -1 ? particles_eulerian_id_number(right_elem) : -1;
168 const int id_number=std::max(id_left,id_right);
169 if (id_number!=-1)
170 {
171 const int ori=orientation(face);
172 contact_force_source_term(face)=(1-volumic_phase_indicator_function(face))
173 *interlaced_volumes(face)*lagrangian_contact_forces_(id_number,ori);
174 }
175 }
176}
: class Collision_Model_FT
int get_particle_i(const int ind_particle_i)
int get_ind_start_particles_j(const int ind_particle_i) const
int get_nb_particles_j(const int ind_particle_i) const
void add_collision(const int part_i, const int part_j, const bool is_part_part_collision)
double compute_ewet_legendre(const double &St)
int get_particle_j(const int ind_particle_i, const int ind_particle_j)
DoubleTab compute_contact_force(const double &next_dist_int, const DoubleTab &norm, const DoubleTab &dUn, const int &particle_i, const int &particle_j, const int &is_compression_step, const double &is_collision_part_part)
void compute_dX_dU(DoubleTab &dX, DoubleTab &dU, const int &particle, const int &neighbor, const DoubleTab &particles_position, const DoubleTab &particles_velocity, const bool is_particle_particle_collision)
: class Collision_Model_FT
void discretize_contact_forces_eulerian_field(const DoubleTab &volumic_phase_indicator_function, const Domaine_VF &domain_vf, const IntTab &particles_eulerian_id_number, DoubleTab &contact_force_source_term) override
void compute_lagrangian_contact_forces(const Fluide_Diphasique &two_phase_fluid, const DoubleTab &particles_position, const DoubleTab &particles_velocity, const double &deltat_simu) override
class Domaine_VF
Definition Domaine_VF.h:44
DoubleVect & volumes_entrelaces()
Definition Domaine_VF.h:99
virtual const IntVect & orientation() const
Definition Domaine_VF.h:646
int face_voisins(int num_face, int i) const
renvoie l'element voisin de numface dans la direction i.
Definition Domaine_VF.h:418
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
const Fluide_Incompressible & fluide_phase(int la_phase) const
const int & get_id_fluid_phase() const
classe Fluide_Incompressible Cette classe represente un d'un fluide incompressible ainsi que
static int dimension
Definition Objet_U.h:99
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
static void mp_max_for_each_item(TRUSTArray< _TYPE_ > &x, int n=-1)
Definition Process.cpp:196
static int check_int_overflow(trustIdType)
Definition Process.cpp:428
static void mp_sum_for_each_item(TRUSTArray< _TYPE_ > &x, int n=-1)
Definition Process.cpp:193
static double mp_sum(double)
Calcule la somme de x sur tous les processeurs du groupe courant.
Definition Process.cpp:146
static void exit(int exit_code=-1)
Routine de sortie de TRUST dans une region Kokkos.
Definition Process.cpp:455
Classe de base des flux de sortie.
Definition Sortie.h:52
_SIZE_ size_array() const