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
14#include <Eigen/Dense>
15#include <Eigen/Sparse>
16#include <memory>
17#include <vector>
18
25class MPS {
26public:
33
34 std::unique_ptr<PressureCalculator::Interface> pressureCalculator;
35
36 double courant{};
37
38 MPS() = default;
39
40 MPS(const Input& input,
41 std::unique_ptr<PressureCalculator::Interface>&& pressureCalculator,
42 std::unique_ptr<SurfaceDetector::Interface>&& surfaceDetector);
43
44 void stepForward();
45
46private:
48 std::unique_ptr<SurfaceDetector::Interface> surfaceDetector;
49
53 void calGravity();
54
64 void calViscosity(const double& re);
65
74 void moveParticle();
75
79 void collision();
80
85 void calNumberDensity(const double& re);
86
91
92 bool isFreeSurface(const Particle& pi);
93
108
113 void setMinimumPressure(const double& re);
114
125 void calPressureGradient(const double& re);
126
136
140 void calCourant();
141};
represents the domain of the simulation
Definition domain.hpp:8
MPS simulation class.
Definition mps.hpp:25
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:177
void stepForward()
Definition mps.cpp:32
void calViscosity(const double &re)
calculate viscosity term of Navier-Stokes equation
Definition mps.cpp:75
std::unique_ptr< PressureCalculator::Interface > pressureCalculator
Interface for pressure calculation.
Definition mps.hpp:34
void moveParticleUsingPressureGradient()
move particles in correction step
Definition mps.cpp:229
Settings settings
Settings for the simulation.
Definition mps.hpp:27
bool isFreeSurface(const Particle &pi)
double courant
Maximum courant number among all particles.
Definition mps.hpp:36
void calPressureGradient(const double &re)
calculate pressure gradient term
Definition mps.cpp:202
MPS()=default
RefValues refValuesForLaplacian
Reference values for the simulation ( , )
Definition mps.hpp:29
void moveParticle()
move particles in prediction step
Definition mps.cpp:101
void setBoundaryCondition()
set boundary condition of pressure Poisson equation
Definition mps.cpp:161
RefValues refValuesForNumberDensity
Reference values for the simulation ( , )
Definition mps.hpp:28
void calCourant()
calculate Courant number
Definition mps.cpp:241
void collision()
calculate collision between particles when they are too close
Definition mps.cpp:112
NeighborSearcher neighborSearcher
Neighbor searcher for neighbor search.
Definition mps.hpp:47
std::unique_ptr< SurfaceDetector::Interface > surfaceDetector
Interface for free surface detection.
Definition mps.hpp:48
void calNumberDensity(const double &re)
calculate number density of each particle
Definition mps.cpp:148
RefValues refValuesForGradient
Reference values for the simulation ( , )
Definition mps.hpp:30
void calGravity()
calculate gravity term
Definition mps.cpp:63
Particles particles
Particles in the simulation.
Definition mps.hpp:31
Domain domain
Domain of the simulation.
Definition mps.hpp:32
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:8
Represents the input data for MPS simulation.
Definition input.hpp:12
Struct for settings of calculation.
Definition settings.hpp:15