SPHinXsys  alpha version
fluid_dynamics_complex.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 * --------------------------------------------------------------------------*/
31 #ifndef FLUID_DYNAMICS_COMPLEX_H
32 #define FLUID_DYNAMICS_COMPLEX_H
33 
34 #include "fluid_dynamics_inner.h"
35 #include "fluid_dynamics_inner.hpp"
36 #include "solid_body.h"
37 #include "solid_particles.h"
38 
39 namespace SPH
40 {
41  namespace fluid_dynamics
42  {
43  typedef DataDelegateContact<FluidBody, FluidParticles, Fluid,
44  SolidBody, SolidParticles, Solid, DataDelegateEmptyBase>
45  FluidWallData;
46  typedef DataDelegateContact<FluidBody, FluidParticles, Fluid,
47  SPHBody, BaseParticles, BaseMaterial, DataDelegateEmptyBase>
48  FluidContactData;
49  typedef DataDelegateContact<FluidBody, FluidParticles, Fluid,
50  SolidBody, SolidParticles, Solid>
51  FSIContactData;
56  template <class BaseRelaxationType>
58  {
59  public:
60  template <class BaseBodyRelationType>
61  RelaxationWithWall(BaseBodyRelationType &base_body_relation,
62  BaseBodyRelationContact &wall_contact_relation);
63  virtual ~RelaxationWithWall(){};
64 
65  protected:
66  StdVec<Real> wall_inv_rho0_;
67  StdVec<StdLargeVec<Real> *> wall_mass_, wall_Vol_;
68  StdVec<StdLargeVec<Vecd> *> wall_vel_ave_, wall_acc_ave_, wall_n_;
69  };
70 
75  template <class DensitySummationInnerType>
76  class DensitySummation : public ParticleDynamicsComplex<DensitySummationInnerType, FluidContactData>
77  {
78  public:
79  DensitySummation(BaseBodyRelationInner &inner_relation, BaseBodyRelationContact &contact_relation);
80  explicit DensitySummation(ComplexBodyRelation &complex_relation);
81  DensitySummation(ComplexBodyRelation &complex_relation, BaseBodyRelationContact &extra_contact_relation);
82  virtual ~DensitySummation(){};
83 
84  protected:
85  StdVec<Real> contact_inv_rho0_;
86  StdVec<StdLargeVec<Real> *> contact_mass_;
87 
88  virtual void prepareContactData() override;
89  virtual void Interaction(size_t index_i, Real dt = 0.0) override;
90  };
93 
98  template <class BaseViscousAccelerationType>
99  class ViscousWithWall : public RelaxationWithWall<BaseViscousAccelerationType>
100  {
101  public:
102  // template for different combination of constructing body relations
103  template <class BaseBodyRelationType>
104  ViscousWithWall(BaseBodyRelationType &base_body_relation,
105  BaseBodyRelationContact &wall_contact_relation);
106  virtual ~ViscousWithWall(){};
107 
108  protected:
109  virtual void Interaction(size_t index_i, Real dt = 0.0) override;
110  };
111 
113  template <class BaseViscousAccelerationType>
114  class BaseViscousAccelerationWithWall : public BaseViscousAccelerationType
115  {
116  public:
117  explicit BaseViscousAccelerationWithWall(ComplexBodyRelation &fluid_wall_relation);
119  BaseBodyRelationContact &wall_contact_relation);
121  BaseBodyRelationContact &wall_contact_relation);
122  };
129  : public ParticleDynamicsComplex<TransportVelocityCorrectionInner, FluidContactData>
130  {
131  public:
133  BaseBodyRelationContact &contact_relation);
134 
135  explicit TransportVelocityCorrectionComplex(ComplexBodyRelation &complex_relation);
136 
138  BaseBodyRelationContact &extra_contact_relation);
140 
141  protected:
142  StdVec<StdLargeVec<Real> *> contact_Vol_;
143 
144  virtual void prepareContactData() override;
145  virtual void Interaction(size_t index_i, Real dt = 0.0) override;
146  };
147 
152  template <class BasePressureRelaxationType>
153  class PressureRelaxation : public RelaxationWithWall<BasePressureRelaxationType>
154  {
155  public:
156  // template for different combination of constructing body relations
157  template <class BaseBodyRelationType>
158  PressureRelaxation(BaseBodyRelationType &base_body_relation,
159  BaseBodyRelationContact &wall_contact_relation);
160  virtual ~PressureRelaxation(){};
161 
162  protected:
163  virtual void Interaction(size_t index_i, Real dt = 0.0) override;
164  virtual Vecd computeNonConservativeAcceleration(size_t index_i) override;
165  };
166 
173  template <class BasePressureRelaxationType>
174  class ExtendPressureRelaxation : public PressureRelaxation<BasePressureRelaxationType>
175  {
176  public:
177  // template for different combination of constructing body relations
178  template <class BaseBodyRelationType>
179  ExtendPressureRelaxation(BaseBodyRelationType &base_body_relation,
180  BaseBodyRelationContact &wall_contact_relation, Real penalty_strength = 1.0);
181 
182  virtual ~ExtendPressureRelaxation(){};
183 
184  protected:
185  Real penalty_strength_;
186  StdLargeVec<Vecd> non_cnsrv_acc_;
187 
188  virtual void Initialization(size_t index_i, Real dt = 0.0) override;
189  virtual void Interaction(size_t index_i, Real dt = 0.0) override;
190  virtual Vecd computeNonConservativeAcceleration(size_t index_i) override;
191  };
192 
194  template <class BasePressureRelaxationType>
195  class BasePressureRelaxationWithWall : public BasePressureRelaxationType
196  {
197  public:
198  explicit BasePressureRelaxationWithWall(ComplexBodyRelation &fluid_wall_relation);
200  BaseBodyRelationContact &wall_contact_relation);
201  BasePressureRelaxationWithWall(ComplexBodyRelation &fluid_complex_relation,
202  BaseBodyRelationContact &wall_contact_relation);
203  };
206 
208  template <class BasePressureRelaxationType>
209  class ExtendPressureRelaxationWithWall : public BasePressureRelaxationType
210  {
211  public:
212  explicit ExtendPressureRelaxationWithWall(ComplexBodyRelation &fluid_wall_relation, Real penalty_strength = 1.0);
214  BaseBodyRelationContact &wall_contact_relation, Real penalty_strength = 1.0);
216  BaseBodyRelationContact &wall_contact_relation, Real penalty_strength = 1.0);
217  };
219 
225  template <class BaseDensityRelaxationType>
226  class DensityRelaxation : public RelaxationWithWall<BaseDensityRelaxationType>
227  {
228  public:
229  // template for different combination of constructing body relations
230  template <class BaseBodyRelationType>
231  DensityRelaxation(BaseBodyRelationType &base_body_relation,
232  BaseBodyRelationContact &wall_contact_relation);
233  virtual ~DensityRelaxation(){};
234 
235  protected:
236  virtual void Interaction(size_t index_i, Real dt = 0.0) override;
237  };
238 
240  template <class BaseDensityRelaxationType>
241  class BaseDensityRelaxationWithWall : public DensityRelaxation<BaseDensityRelaxationType>
242  {
243  public:
244  explicit BaseDensityRelaxationWithWall(ComplexBodyRelation &fluid_wall_relation);
246  BaseBodyRelationContact &wall_contact_relation);
247  BaseDensityRelaxationWithWall(ComplexBodyRelation &fluid_complex_relation,
248  BaseBodyRelationContact &wall_contact_relation);
249  };
252 
257  class PressureRelaxationWithWallOldroyd_B : public PressureRelaxation<PressureRelaxationInnerOldroyd_B>
258  {
259  public:
260  explicit PressureRelaxationWithWallOldroyd_B(ComplexBodyRelation &fluid_wall_relation)
261  : PressureRelaxation<PressureRelaxationInnerOldroyd_B>(fluid_wall_relation.inner_relation_,
262  fluid_wall_relation.contact_relation_){};
263 
265 
266  protected:
267  virtual void Interaction(size_t index_i, Real dt = 0.0) override;
268  };
269 
274  class DensityRelaxationWithWallOldroyd_B : public DensityRelaxation<DensityRelaxationInnerOldroyd_B>
275  {
276  public:
277  explicit DensityRelaxationWithWallOldroyd_B(ComplexBodyRelation &fluid_wall_relation)
278  : DensityRelaxation<DensityRelaxationInnerOldroyd_B>(fluid_wall_relation.inner_relation_,
279  fluid_wall_relation.contact_relation_){};
280 
282 
283  protected:
284  virtual void Interaction(size_t index_i, Real dt = 0.0) override;
285  };
286  }
287 }
288 #endif //FLUID_DYNAMICS_COMPLEX_H
The base relation between a SPH body and its contact SPH bodies.
Definition: base_body_relation.h:136
transport velocity correction consdiering the contribution from contact bodies
Definition: fluid_dynamics_complex.h:128
Here, we define the algorithm classes for fluid dynamics within the body.
computing density by summation considering contribution from contact bodies
Definition: fluid_dynamics_complex.h:76
Definition: fluid_dynamics_complex.h:195
virtual void Interaction(size_t index_i, Real dt=0.0) override
Definition: fluid_dynamics_complex.cpp:44
template class pressure relaxation scheme with wall boundary
Definition: fluid_dynamics_complex.h:153
prepare data for contact particle dynamics
Definition: base_particle_dynamics.h:240
virtual void Interaction(size_t index_i, Real dt=0.0) override
Definition: fluid_dynamics_complex.hpp:76
Definition: fluid_dynamics_complex.h:114
template density relaxation scheme without using different Riemann solvers. The difference from the f...
Definition: fluid_dynamics_complex.h:226
virtual void Interaction(size_t index_i, Real dt=0.0) override
Definition: fluid_dynamics_complex.cpp:70
Definition: fluid_dynamics_complex.h:241
The relation combined an inner and a contact body relation. The interaction is in a inner-boundary-co...
Definition: complex_body_relation.h:42
template class for pressure relaxation scheme with wall boundary and considering non-conservative acc...
Definition: fluid_dynamics_complex.h:174
virtual void Interaction(size_t index_i, Real dt=0.0) override
Definition: fluid_dynamics_complex.hpp:215
Abstract base class for general relaxation algorithms with wall.
Definition: fluid_dynamics_complex.h:57
template class viscous acceleration with wall boundary
Definition: fluid_dynamics_complex.h:99
This is the derived class of base particles.
The abstract relation within a SPH body.
Definition: base_body_relation.h:117
first half of the pressure relaxation scheme using Riemann solver.
Definition: fluid_dynamics_complex.h:257
Definition: fluid_dynamics_complex.h:209
This is the class for bodies used for solid BCs or Elastic structure.
Definition: solid_body_supplementary.cpp:9
second half of the pressure relaxation scheme using Riemann solver.
Definition: fluid_dynamics_complex.h:274
particle dynamics by considering contribution from extra contact bodies
Definition: base_particle_dynamics.h:281