MPS-Basic
|
#include <mps.hpp>
Public Member Functions | |
MPS ()=default | |
MPS (const Input &input, std::unique_ptr< PressureCalculator::Interface > &&pressureCalculator, std::unique_ptr< SurfaceDetector::Interface > &&surfaceDetector) | |
void | stepForward () |
Public Attributes | |
Settings | settings |
Settings for the simulation. | |
RefValues | refValuesForNumberDensity |
Reference values for the simulation ( \(n^0\), \(\lambda^0\)) | |
RefValues | refValuesForLaplacian |
Reference values for the simulation ( \(n^0\), \(\lambda^0\)) | |
RefValues | refValuesForGradient |
Reference values for the simulation ( \(n^0\), \(\lambda^0\)) | |
Particles | particles |
Particles in the simulation. | |
Domain | domain {} |
Domain of the simulation. | |
std::unique_ptr< PressureCalculator::Interface > | pressureCalculator |
Interface for pressure calculation. | |
double | courant {} |
Maximum courant number among all particles. | |
Private Member Functions | |
void | calGravity () |
calculate gravity term | |
void | calViscosity (const double &re) |
calculate viscosity term of Navier-Stokes equation | |
void | moveParticle () |
move particles in prediction step | |
void | collision () |
calculate collision between particles when they are too close | |
void | calNumberDensity (const double &re) |
calculate number density of each particle | |
void | setBoundaryCondition () |
set boundary condition of pressure Poisson equation | |
bool | isFreeSurface (const Particle &pi) |
bool | isParticleDistributionBiased (const Particle &pi) |
check if particle distribution is biased. | |
void | setMinimumPressure (const double &re) |
set minimum pressure for pressure gradient calculation | |
void | calPressureGradient (const double &re) |
calculate pressure gradient term | |
void | moveParticleUsingPressureGradient () |
move particles in correction step | |
void | calCourant () |
calculate Courant number | |
Private Attributes | |
NeighborSearcher | neighborSearcher |
Neighbor searcher for neighbor search. | |
std::unique_ptr< SurfaceDetector::Interface > | surfaceDetector |
Interface for free surface detection. | |
MPS simulation class.
Executes the MPS simulation. This class does not handle the simulation process itself, but only the calculation of the MPS method.
|
default |
MPS::MPS | ( | const Input & | input, |
std::unique_ptr< PressureCalculator::Interface > && | pressureCalculator, | ||
std::unique_ptr< SurfaceDetector::Interface > && | surfaceDetector ) |
Definition at line 15 of file mps.cpp.
void MPS::stepForward | ( | ) |
Definition at line 32 of file mps.cpp.
|
private |
|
private |
calculate viscosity term of Navier-Stokes equation
re | effective radius \(r_e\) |
The viscosity term of the Navier-Stokes equation is calculated as follows:
\[ \nu\langle \nabla^2\mathbf{u}\rangle_i = \nu\frac{2 d}{n^0\lambda^0}\sum_{j\neq i} (\mathbf{u}_j - \mathbf{u}_i) w_{ij} \]
Definition at line 75 of file mps.cpp.
|
private |
move particles in prediction step
The position and velocity of each particle are updated as
\[ \mathbf{u}_i^* = \mathbf{u}_i^k + (\nu\langle \nabla^2\mathbf{u}\rangle^k_i+\mathbf{g})\Delta t. \]
Definition at line 101 of file mps.cpp.
|
private |
calculate collision between particles when they are too close
Definition at line 112 of file mps.cpp.
|
private |
calculate number density of each particle
re | effective radius \(r_e\) |
Definition at line 148 of file mps.cpp.
|
private |
set boundary condition of pressure Poisson equation
Definition at line 161 of file mps.cpp.
|
private |
|
private |
check if particle distribution is biased.
Particle number density can be low even in the fluid region, making the free surface detection based on particle number density vulnerable. Even when a specific particle's the particle number density is lower than criteria, it can be considered as inner particle if the particle distribution around the particle is not biased. In this way we can avoid the free surface detection error. This is based on Khayyer et al. (https://doi.org/10.1016/j.apor.2009.06.003)
pi | Particle to check |
|
private |
set minimum pressure for pressure gradient calculation
re | effective radius \(r_e\) |
Definition at line 177 of file mps.cpp.
|
private |
calculate pressure gradient term
re |
The pressure gradient term of the Navier-Stokes equation is calculated as
\[ -\frac{1}{\rho^0}\langle\nabla P\rangle_i = -\frac{1}{\rho^0}\frac{d}{n^0}\sum_{j\neq i} \frac{P_j-P'_i}{\|\mathbf{r}_{ij}\|^2}\mathbf{r}_{ij} w_{ij} \]
where \(P'_i\) is the minimum pressure of the particle \(i\).
Definition at line 202 of file mps.cpp.
|
private |
move particles in correction step
The position and velocity of each particle are updated as
\[ \mathbf{u}_i^{k+1} = \mathbf{u}_i^* - \frac{1}{\rho^0} \langle\nabla P^{k+1} \rangle_i \Delta t. \]
Definition at line 229 of file mps.cpp.
|
private |
RefValues MPS::refValuesForNumberDensity |
RefValues MPS::refValuesForLaplacian |
RefValues MPS::refValuesForGradient |
std::unique_ptr<PressureCalculator::Interface> MPS::pressureCalculator |
double MPS::courant {} |
|
private |
|
private |