Jet  v1.3.3
pci_sph_solver3.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_SOLVER3_H_
8 #define INCLUDE_JET_PCI_SPH_SOLVER3_H_
9 
10 #include <jet/sph_solver3.h>
11 
12 namespace jet {
13 
23 class PciSphSolver3 : public SphSolver3 {
24  public:
25  class Builder;
26 
29 
33  double targetDensity,
34  double targetSpacing,
35  double relativeKernelRadius);
36 
37  virtual ~PciSphSolver3();
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  ParticleSystemData3::VectorData _tempPositions;
76  ParticleSystemData3::VectorData _tempVelocities;
77  ParticleSystemData3::VectorData _pressureForces;
78  ParticleSystemData3::ScalarData _densityErrors;
79 
80  double computeDelta(double timeStepInSeconds);
81  double computeBeta(double timeStepInSeconds);
82 };
83 
85 typedef std::shared_ptr<PciSphSolver3> PciSphSolver3Ptr;
86 
91  : public SphSolverBuilderBase3<PciSphSolver3::Builder> {
92  public:
95 
98 };
99 
100 } // namespace jet
101 
102 #endif // INCLUDE_JET_PCI_SPH_SOLVER3_H_
jet::Array< T, 1 >
1-D array class.
Definition: array1.h:31
jet::SphSolverBuilderBase3
Base class for SPH-based fluid solver builder.
Definition: sph_solver3.h:195
jet::PciSphSolver3::maxDensityErrorRatio
double maxDensityErrorRatio() const
Returns max allowed density error ratio.
jet::PciSphSolver3
3-D PCISPH solver.
Definition: pci_sph_solver3.h:23
jet::PciSphSolver3::builder
static Builder builder()
Returns builder fox PciSphSolver3.
jet::PciSphSolver3::setMaxNumberOfIterations
void setMaxNumberOfIterations(unsigned int n)
Sets max number of PCISPH iterations.
jet::PciSphSolver3::Builder
Front-end to create PciSphSolver3 objects step by step.
Definition: pci_sph_solver3.h:91
jet::PciSphSolver3Ptr
std::shared_ptr< PciSphSolver3 > PciSphSolver3Ptr
Shared pointer type for the PciSphSolver3.
Definition: pci_sph_solver3.h:85
jet::PciSphSolver3::Builder::makeShared
PciSphSolver3Ptr makeShared() const
Builds shared pointer of PciSphSolver3 instance.
jet::PciSphSolver3::PciSphSolver3
PciSphSolver3()
Constructs a solver with empty particle set.
jet::PciSphSolver3::accumulatePressureForce
void accumulatePressureForce(double timeIntervalInSeconds) override
jet::PciSphSolver3::PciSphSolver3
PciSphSolver3(double targetDensity, double targetSpacing, double relativeKernelRadius)
jet
Definition: advection_solver2.h:18
sph_solver3.h
jet::SphSolver3
3-D SPH solver.
Definition: sph_solver3.h:29
jet::PciSphSolver3::~PciSphSolver3
virtual ~PciSphSolver3()
jet::PciSphSolver3::Builder::build
PciSphSolver3 build() const
Builds PciSphSolver3.
jet::PciSphSolver3::maxNumberOfIterations
unsigned int maxNumberOfIterations() const
Returns max number of iterations.
jet::PciSphSolver3::onBeginAdvanceTimeStep
void onBeginAdvanceTimeStep(double timeStepInSeconds) override
Performs pre-processing step before the simulation.
jet::PciSphSolver3::setMaxDensityErrorRatio
void setMaxDensityErrorRatio(double ratio)
Sets max allowed density error ratio.