SPHinXsys  alpha version
fluid_boundary.h
Go to the documentation of this file.
1 /* -------------------------------------------------------------------------*
2  * SPHinXsys *
3  * --------------------------------------------------------------------------*
4  * SPHinXsys (pronunciation: s'finksis) is an acronym from Smoothed Particle *
5  * Hydrodynamics for industrial compleX systems. It provides C++ APIs for *
6  * physical accurate simulation and aims to model coupled industrial dynamic *
7  * systems including fluid, solid, multi-body dynamics and beyond with SPH *
8  * (smoothed particle hydrodynamics), a meshless computational method using *
9  * particle discretization. *
10  * *
11  * SPHinXsys is partially funded by German Research Foundation *
12  * (Deutsche Forschungsgemeinschaft) DFG HU1527/6-1, HU1527/10-1 *
13  * and HU1527/12-1. *
14  * *
15  * Portions copyright (c) 2017-2020 Technical University of Munich and *
16  * the authors' affiliations. *
17  * *
18  * Licensed under the Apache License, Version 2.0 (the "License"); you may *
19  * not use this file except in compliance with the License. You may obtain a *
20  * copy of the License at http://www.apache.org/licenses/LICENSE-2.0. *
21  * *
22  * --------------------------------------------------------------------------*/
30 #ifndef FLUID_BOUNDARY_H
31 #define FLUID_BOUNDARY_H
32 
33 #include "fluid_dynamics_inner.h"
34 
35 namespace SPH
36 {
37  namespace fluid_dynamics
38  {
46  {
47  public:
48  FlowRelaxationBuffer(FluidBody &fluid_body, BodyPartByCell &body_part);
49  virtual ~FlowRelaxationBuffer(){};
50 
51  protected:
52  StdLargeVec<Vecd> &pos_, &vel_;
55 
58  virtual Vecd getTargetVelocity(Vecd &position, Vecd &velocity) = 0;
59  virtual void Update(size_t index_i, Real dt = 0.0) override;
60  };
61 
67  {
68  public:
69  InflowBoundaryCondition(FluidBody &fluid_body, BodyAlignedBoxByCell &aligned_box_part);
70  virtual ~InflowBoundaryCondition(){};
71 
72  protected:
73  Transformd &transform_;
74  Vecd halfsize_;
75 
76  virtual void Update(size_t index_i, Real dt = 0.0) override;
77  };
78 
87  {
88  public:
89  DampingBoundaryCondition(FluidBody &fluid_body, BodyRegionByCell &body_part);
90  virtual ~DampingBoundaryCondition(){};
91 
92  protected:
93  StdLargeVec<Vecd> &pos_, &vel_;
95  Real strength_;
96  BoundingBox damping_zone_bounds_;
97  virtual void Update(size_t index_particle_i, Real dt = 0.0) override;
98  };
99 
106  {
107  public:
108  explicit EmitterInflowCondition(FluidBody &fluid_body, BodyAlignedBoxByParticle &aligned_box_part);
109  virtual ~EmitterInflowCondition(){};
110 
111  protected:
112  StdLargeVec<Vecd> &pos_, &vel_;
113  StdLargeVec<Real> &rho_, &p_;
116  Real rho0_;
117  AlignedBoxShape &aligned_box_;
118  Transformd &updated_transform_, old_transform_;
119 
121  virtual void updateTransform(){};
122  virtual Vecd getTargetVelocity(Vecd &position, Vecd &velocity) = 0;
123  virtual void setupDynamics(Real dt = 0.0) override { updateTransform(); };
124  virtual void Update(size_t unsorted_index_i, Real dt = 0.0) override;
125  };
126 
132  {
133  public:
134  explicit EmitterInflowInjecting(FluidBody &fluid_body, BodyAlignedBoxByParticle &aligned_box_part,
135  size_t body_buffer_width, int axis_direction, bool positive);
136  virtual ~EmitterInflowInjecting(){};
137 
139  virtual void parallel_exec(Real dt = 0.0) override { exec(); };
140  AlignedBoxShape &getBodyPartByParticle(){};
141 
142  protected:
143  StdLargeVec<Vecd> &pos_;
144  StdLargeVec<Real> &rho_, &p_;
145  const int axis_;
146  size_t body_buffer_width_;
147  AlignedBoxShape &aligned_box_;
148 
149  virtual void checkLowerBound(size_t unsorted_index_i, Real dt = 0.0);
150  virtual void checkUpperBound(size_t unsorted_index_i, Real dt = 0.0);
151  ParticleFunctor checking_bound_;
152 
153  virtual void Update(size_t unsorted_index_i, Real dt = 0.0) override
154  {
155  checking_bound_(unsorted_index_i, dt);
156  };
157  };
158 
164  {
165  public:
166  StaticConfinementDensity(FluidBody &fluid_body, NearShapeSurface &near_surface);
167  virtual ~StaticConfinementDensity(){};
168 
169  protected:
170  Real rho0_, inv_sigma0_;
171  StdLargeVec<Real> &mass_, &rho_sum_;
172  StdLargeVec<Vecd> &pos_;
173  LevelSetShape *level_set_shape_;
174 
175  virtual void Update(size_t index_i, Real dt = 0.0) override;
176  };
177 
183  {
184  public:
187 
188  protected:
189  StdLargeVec<Real> &rho_, &p_;
190  StdLargeVec<Vecd> &pos_, &vel_, &acc_;
191  LevelSetShape *level_set_shape_;
192  AcousticRiemannSolver riemann_solver_;
193 
194  virtual void Update(size_t index_i, Real dt = 0.0) override;
195  };
196 
202  {
203  public:
206 
207  protected:
208  StdLargeVec<Real> &rho_, &p_, &drho_dt_;
209  StdLargeVec<Vecd> &pos_, &vel_;
210  LevelSetShape *level_set_shape_;
211  AcousticRiemannSolver riemann_solver_;
212 
213  virtual void Update(size_t index_i, Real dt = 0.0) override;
214  };
215 
221  {
222  public:
223  StaticConfinementDensity density_summation_;
224  StaticConfinementPressureRelaxation pressure_relaxation_;
225  StaticConfinementDensityRelaxation density_relaxation_;
226 
227  StaticConfinement(FluidBody &fluid_body, NearShapeSurface &near_surface);
228  virtual ~StaticConfinement(){};
229  };
230 
231  }
232 }
233 #endif // FLUID_BOUNDARY_H
Fluid body uses smoothing length to particle spacing 1.3 and carry out particle sorting every 100 ite...
Definition: fluid_body.h:43
A body part with a collection of cell lists.
Definition: base_body_part.h:100
const int axis_
Definition: fluid_boundary.h:145
Here, we define the algorithm classes for fluid dynamics within the body.
Flow buffer in which the particles relaxes to a given target velocity profile. This technique will be...
Definition: fluid_boundary.h:45
static confinement condition for density summation
Definition: fluid_boundary.h:163
Abstract class for body part simple particle dynamics.
Definition: particle_dynamics_bodypart.h:70
damping boundary condition which relaxes the particles to zero velocity profile. TODO: one can using ...
Definition: fluid_boundary.h:86
A body part with the cell lists within a prescribed shape.
Definition: base_body_part.h:168
virtual void parallel_exec(Real dt=0.0) override
Definition: fluid_boundary.h:139
static confinement condition for density relaxation
Definition: fluid_boundary.h:201
Used to describe a bounding box in which the plane vertical to axis direction is aligned to a planar ...
Definition: complex_shape.h:68
A shape using level set to define geometry.
Definition: level_set_shape.h:46
A body part with the cell lists near the surface of a prescribed shape.
Definition: base_body_part.h:187
Inject particles into the computational domain.
Definition: fluid_boundary.h:131
A template body part with the collection of particles within by an AlignedBoxShape.
Definition: base_body_part.h:213
virtual void exec(Real dt=0.0) override
Definition: particle_dynamics_bodypart.cpp:69
virtual void checkLowerBound(size_t unsorted_index_i, Real dt=0.0)
Definition: fluid_boundary.cpp:112
virtual void updateTransform()
Definition: fluid_boundary.h:121
Coordinate transform in 2D Note that the rotation is around the frame (or local) origin.
Definition: base_data_type.h:453
Inflow boundary condition imposed on an emitter, in which pressure and density profile are imposed to...
Definition: fluid_boundary.h:105
Real relaxation_rate_
Definition: fluid_boundary.h:54
virtual void setupDynamics(Real dt=0.0) override
Definition: fluid_boundary.h:123
Abstract class for imposing Eulerian constrain to a body. The constrained particles are in the tagged...
Definition: particle_dynamics_bodypart.h:143
static confinement condition for pressure relaxation
Definition: fluid_boundary.h:182
Real strength_
Definition: fluid_boundary.h:95
virtual Vecd getTargetVelocity(Vecd &position, Vecd &velocity)=0
Inflow boundary condition which imposes directly to a given velocity profile.
Definition: fluid_boundary.h:66
Definition: riemann_solver.h:74
Static confined boundary condition for complex structures.
Definition: fluid_boundary.h:220
prepare data for simple particle dynamics.
Definition: base_particle_dynamics.h:185
std::function< void(size_t, Real)> ParticleFunctor
Definition: base_particle_dynamics.h:49
virtual void checkUpperBound(size_t unsorted_index_i, Real dt=0.0)
Definition: fluid_boundary.cpp:89
Definition: solid_body_supplementary.cpp:9
Real inflow_pressure_
Definition: fluid_boundary.h:115