MPS-Basic
Loading...
Searching...
No Matches
particle.hpp
Go to the documentation of this file.
1#pragma once
2
3#include "Eigen/Dense"
4#include "common.hpp"
5
6#include <vector>
7
11enum class ParticleType {
12 Ghost,
13 Fluid,
14 Wall,
15 DummyWall,
16};
17
21enum class FluidState {
22 Ignored,
25 Inner,
26 Splash
27};
28
32class Neighbor {
33private:
34public:
35 int id;
36 double distance;
37
38 Neighbor(int id, double distance) {
39 this->id = id;
40 this->distance = distance;
41 }
42};
43
47class Particle {
48private:
49public:
50 int id;
52 int fluidType = 0;
54
55 Eigen::Vector3d position;
56 Eigen::Vector3d velocity;
57 Eigen::Vector3d acceleration = Eigen::Vector3d::Zero();
58 double pressure = 0;
59 double numberDensity = 0;
60 double density = 0;
61
63 double sourceTerm = 0;
64 double minimumPressure = 0;
65
66 std::vector<Neighbor> neighbors;
67
77 Particle(int id, ParticleType type, Eigen::Vector3d pos, Eigen::Vector3d vel, double density, int fluidType = 0);
78
86 double inverseDensity() const;
87};
Class for neighbor particle.
Definition particle.hpp:32
Neighbor(int id, double distance)
Definition particle.hpp:38
double distance
distance between the particle and the neighbor particle
Definition particle.hpp:36
int id
index of the neighbor particle
Definition particle.hpp:35
Class for particle in MPS method.
Definition particle.hpp:47
FluidState boundaryCondition
boundary condition of the particle
Definition particle.hpp:62
double inverseDensity() const
calculate inverse of density for collision
Definition particle.cpp:12
int fluidType
Definition particle.hpp:52
Eigen::Vector3d position
position of the particle
Definition particle.hpp:55
double pressure
pressure of the particle
Definition particle.hpp:58
int id
index of the particle
Definition particle.hpp:50
Eigen::Vector3d acceleration
acceleration of the particle
Definition particle.hpp:57
double density
density of the particle. It is used only for fluid and wall particles.
Definition particle.hpp:60
double numberDensity
number density of the particle
Definition particle.hpp:59
double sourceTerm
source term of the particle
Definition particle.hpp:63
std::vector< Neighbor > neighbors
neighbors of the particle
Definition particle.hpp:66
Particle(int id, ParticleType type, Eigen::Vector3d pos, Eigen::Vector3d vel, double density, int fluidType=0)
constructor
Definition particle.cpp:3
double minimumPressure
minimum pressure of the particle
Definition particle.hpp:64
Eigen::Vector3d velocity
velocity of the particle
Definition particle.hpp:56
ParticleType type
type of the particle
Definition particle.hpp:51
FluidState
Enum class for fluid state.
Definition particle.hpp:21
@ Splash
splash fluid particle
@ SubFreeSurface
inner particle near free surface
@ Inner
inner fluid particle
@ FreeSurface
free surface particle
@ Ignored
Ghost or dummy.
ParticleType
Enum class for particle type.
Definition particle.hpp:11
@ Ghost
Ghost particle (outside of the domain, not used for calculation)
@ Wall
Wall particle.
@ DummyWall
Dummy wall particle (pressure is not calculated)
@ Fluid
Fluid particle.