Jet  v1.3.3
pci_sph_solver2.h
Go to the documentation of this file.
1 // Copyright (c) 2018 Doyub Kim
2 //
3 // I am making my contributions/submissions to this project solely in my
4 // personal capacity and am not conveying any rights to any intellectual
5 // property of any third parties.
6 
7 #ifndef INCLUDE_JET_PCI_SPH_SOLVER2_H_
8 #define INCLUDE_JET_PCI_SPH_SOLVER2_H_
9 
10 #include <jet/sph_solver2.h>
11 
12 namespace jet {
13 
23 class PciSphSolver2 : public SphSolver2 {
24  public:
25  class Builder;
26 
29 
33  double targetDensity,
34  double targetSpacing,
35  double relativeKernelRadius);
36 
37  virtual ~PciSphSolver2();
38 
40  double maxDensityErrorRatio() const;
41 
48  void setMaxDensityErrorRatio(double ratio);
49 
51  unsigned int maxNumberOfIterations() const;
52 
58  void setMaxNumberOfIterations(unsigned int n);
59 
61  static Builder builder();
62 
63  protected:
66  void accumulatePressureForce(double timeIntervalInSeconds) override;
67 
69  void onBeginAdvanceTimeStep(double timeStepInSeconds) override;
70 
71  private:
72  double _maxDensityErrorRatio = 0.01;
73  unsigned int _maxNumberOfIterations = 5;
74 
75  ParticleSystemData2::VectorData _tempPositions;
76  ParticleSystemData2::VectorData _tempVelocities;
77  ParticleSystemData2::VectorData _pressureForces;
78  ParticleSystemData2::ScalarData _densityErrors;
79 
80  double computeDelta(double timeStepInSeconds);
81  double computeBeta(double timeStepInSeconds);
82 };
83 
85 typedef std::shared_ptr<PciSphSolver2> PciSphSolver2Ptr;
86 
91  : public SphSolverBuilderBase2<PciSphSolver2::Builder> {
92  public:
95 
98 };
99 
100 } // namespace jet
101 
102 #endif // INCLUDE_JET_PCI_SPH_SOLVER2_H_
jet::Array< T, 1 >
1-D array class.
Definition: array1.h:31
jet::PciSphSolver2::setMaxNumberOfIterations
void setMaxNumberOfIterations(unsigned int n)
Sets max number of PCISPH iterations.
jet::PciSphSolver2::builder
static Builder builder()
Returns builder fox PciSphSolver2.
jet::PciSphSolver2::Builder::build
PciSphSolver2 build() const
Builds PciSphSolver2.
jet::PciSphSolver2::accumulatePressureForce
void accumulatePressureForce(double timeIntervalInSeconds) override
jet::SphSolverBuilderBase2
Base class for SPH-based fluid solver builder.
Definition: sph_solver2.h:195
jet::PciSphSolver2::maxNumberOfIterations
unsigned int maxNumberOfIterations() const
Returns max number of iterations.
jet::PciSphSolver2::setMaxDensityErrorRatio
void setMaxDensityErrorRatio(double ratio)
Sets max allowed density error ratio.
jet::PciSphSolver2
2-D PCISPH solver.
Definition: pci_sph_solver2.h:23
jet::PciSphSolver2::PciSphSolver2
PciSphSolver2(double targetDensity, double targetSpacing, double relativeKernelRadius)
jet::PciSphSolver2::onBeginAdvanceTimeStep
void onBeginAdvanceTimeStep(double timeStepInSeconds) override
Performs pre-processing step before the simulation.
jet
Definition: advection_solver2.h:18
jet::PciSphSolver2::Builder::makeShared
PciSphSolver2Ptr makeShared() const
Builds shared pointer of PciSphSolver2 instance.
jet::PciSphSolver2::Builder
Front-end to create PciSphSolver2 objects step by step.
Definition: pci_sph_solver2.h:91
jet::PciSphSolver2::~PciSphSolver2
virtual ~PciSphSolver2()
jet::PciSphSolver2::maxDensityErrorRatio
double maxDensityErrorRatio() const
Returns max allowed density error ratio.
sph_solver2.h
jet::PciSphSolver2::PciSphSolver2
PciSphSolver2()
Constructs a solver with empty particle set.
jet::PciSphSolver2Ptr
std::shared_ptr< PciSphSolver2 > PciSphSolver2Ptr
Shared pointer type for the PciSphSolver2.
Definition: pci_sph_solver2.h:85
jet::SphSolver2
2-D SPH solver.
Definition: sph_solver2.h:29