MPS-Basic
Loading...
Searching...
No Matches
implicit.cpp
Go to the documentation of this file.
1#include "implicit.hpp"
2
3#include "../refvalues.hpp"
4#include "../weight.hpp"
5
6#include <iostream>
7#include <queue>
8
10using std::cerr;
11using std::endl;
12
14 int dimension,
15 double particleDistance,
16 double reForNumberDensity,
17 double reForLaplacian,
18 double dt,
19 double compressibility,
20 double relaxationCoefficient,
21 std::unique_ptr<DirichletBoundaryConditionGenerator::Interface>&& dirichletBoundaryConditionGenerator
22) {
23 auto refValuesForNumberDensity = RefValues(dimension, particleDistance, reForNumberDensity);
24 auto refValuesForLaplacian = RefValues(dimension, particleDistance, reForLaplacian);
27 dimension,
28 dt,
29 relaxationCoefficient,
30 compressibility,
31 refValuesForNumberDensity.n0,
32 refValuesForLaplacian.n0,
33 refValuesForLaplacian.lambda,
34 reForLaplacian,
35 reForNumberDensity
36 );
37}
38
39std::vector<double> Implicit::calc(Particles& particles) {
40 auto dirichletBoundaryCondition = dirichletBoundaryConditionGenerator->generate(particles);
41 this->pressurePoissonEquation.setup(particles, dirichletBoundaryCondition);
44
45 return this->pressure;
46}
47
50
52#pragma omp parallel for
53 for (auto& p : pressure) {
54 if (p < 0) {
55 p = 0;
56 }
57 }
58}
A collection of particles.
Definition particles.hpp:10
Class for implicit pressure calculation.
Definition implicit.hpp:21
void removeNegativePressure()
remove negative pressure for stability
Definition implicit.cpp:51
std::vector< double > pressure
Solution of pressure calculation.
Definition implicit.hpp:43
PressurePoissonEquation pressurePoissonEquation
Definition implicit.hpp:45
std::unique_ptr< DirichletBoundaryConditionGenerator::Interface > dirichletBoundaryConditionGenerator
Definition implicit.hpp:44
Implicit(int dimension, double particleDistance, double re_forGradient, double re_forLaplacian, double dt, double compressibility, double relaxationCoefficient, std::unique_ptr< DirichletBoundaryConditionGenerator::Interface > &&dirichletBoundaryConditionGenerator)
Definition implicit.cpp:13
std::vector< double > calc(Particles &particles) override
calculate pressure
Definition implicit.cpp:39
Class for setting up and solving pressure Poisson equation.
std::vector< double > solve()
Solve pressure Poisson equation.
void setup(const Particles &particles, const DirichletBoundaryCondition &dirichletBoundaryCondition)
Setup pressure Poisson equation.
Struct for reference values of MPS method.
Definition refvalues.hpp:8