MPS-Basic
Loading...
Searching...
No Matches
mps.hpp
Go to the documentation of this file.
1#pragma once
2
3#include "bucket.hpp"
4#include "common.hpp"
5#include "domain.hpp"
6#include "input.hpp"
8#include "particles.hpp"
10#include "refvalues.hpp"
11#include "settings.hpp"
13#include "weight.hpp"
14
15#include <Eigen/Dense>
16#include <Eigen/Sparse>
17#include <memory>
18#include <vector>
19
26class MPS {
27public:
29 Eigen::Vector3d gravity;
35
36 std::unique_ptr<PressureCalculator::Interface> pressureCalculator;
37
38 double courant{};
39
40 MPS() = default;
41
42 MPS(const Input& input,
43 Eigen::Vector3d& gravity,
44 std::unique_ptr<PressureCalculator::Interface>&& pressureCalculator,
45 std::unique_ptr<SurfaceDetector::Interface>&& surfaceDetector);
46
47 void stepForward();
48
49private:
51 std::unique_ptr<SurfaceDetector::Interface> surfaceDetector;
54
58 void calGravity();
59
69 void calViscosity(const double& re);
70
79 void moveParticle();
80
84 void collision();
85
90 void calNumberDensity(const double& re);
91
106
112 void setMinimumPressure(const double& re);
113
124 void calPressureGradient(const double& re);
125
135
139 void calCourant();
140};
represents the domain of the simulation
Definition domain.hpp:8
MPS simulation class.
Definition mps.hpp:26
bool isParticleDistributionBiased(const Particle &pi)
check if particle distribution is biased.
void setMinimumPressure(const double &re)
set minimum pressure for pressure gradient calculation
Definition mps.cpp:184
void stepForward()
Definition mps.cpp:55
void calViscosity(const double &re)
calculate viscosity term of Navier-Stokes equation
Definition mps.cpp:98
std::unique_ptr< PressureCalculator::Interface > pressureCalculator
Interface for pressure calculation.
Definition mps.hpp:36
void moveParticleUsingPressureGradient()
move particles in correction step
Definition mps.cpp:238
Settings settings
Settings for the simulation.
Definition mps.hpp:28
Weight weightGrad
Weight function instance for the gradient calculation.
Definition mps.hpp:53
double courant
Maximum courant number among all particles.
Definition mps.hpp:38
void calPressureGradient(const double &re)
calculate pressure gradient term
Definition mps.cpp:209
MPS()=default
RefValues refValuesForLaplacian
Reference values for the simulation ( , )
Definition mps.hpp:31
void moveParticle()
move particles in prediction step
Definition mps.cpp:124
RefValues refValuesForNumberDensity
Reference values for the simulation ( , )
Definition mps.hpp:30
void calCourant()
calculate Courant number
Definition mps.cpp:250
void collision()
calculate collision between particles when they are too close
Definition mps.cpp:135
Eigen::Vector3d gravity
Gravity vector for the simulation.
Definition mps.hpp:29
NeighborSearcher neighborSearcher
Neighbor searcher for neighbor search.
Definition mps.hpp:50
std::unique_ptr< SurfaceDetector::Interface > surfaceDetector
Interface for free surface detection.
Definition mps.hpp:51
void calNumberDensity(const double &re)
calculate number density of each particle
Definition mps.cpp:171
RefValues refValuesForGradient
Reference values for the simulation ( , )
Definition mps.hpp:32
Weight weight
Weight function instance except for gradient calculation.
Definition mps.hpp:52
void calGravity()
calculate gravity term
Definition mps.cpp:87
Particles particles
Particles in the simulation.
Definition mps.hpp:33
Domain domain
Domain of the simulation.
Definition mps.hpp:34
Class for particle in MPS method.
Definition particle.hpp:47
A collection of particles.
Definition particles.hpp:10
Struct for reference values of MPS method.
Definition refvalues.hpp:9
Provides a weight function.
Definition weight.hpp:15
Represents the input data for MPS simulation.
Definition input.hpp:12
Struct for settings of calculation.
Definition settings.hpp:15