MPS-Basic
Loading...
Searching...
No Matches
free_surface.cpp
Go to the documentation of this file.
1#include "free_surface.hpp"
2
3#include "../../refvalues.hpp"
4
7
8DirichletBoundaryCondition FreeSurface::generate(Particles& particles) {
9 setBoundaryCondition(particles);
10
11 // Boundary condition: Particles other than inner particles set pressure to 0
12 DirichletBoundaryCondition dirichletBoundaryCondition;
13 for (const auto& p : particles) {
14 if (p.boundaryCondition != FluidState::Inner) {
15 dirichletBoundaryCondition.set(p.id, 0.0);
16 }
17 }
18
19 return dirichletBoundaryCondition;
20}
21
24
25FreeSurface::FreeSurface(std::unique_ptr<SurfaceDetector::Interface>&& surfaceDetector) {
26 this->surfaceDetector = std::move(surfaceDetector);
27}
28
34#pragma omp parallel for
35 for (auto& pi : particles) {
36 if (pi.type == ParticleType::Ghost || pi.type == ParticleType::DummyWall) {
37 pi.boundaryCondition = FluidState::Ignored;
38
39 } else { // Fluid particles
40 if (surfaceDetector->isFreeSurface(particles, pi)) {
41 pi.boundaryCondition = FluidState::FreeSurface;
42 } else {
43 pi.boundaryCondition = FluidState::Inner;
44 }
45 }
46 }
47}
A collection of particles.
Definition particles.hpp:10
Dirichlet Boundary Condition Generator that sets the free surface pressure to 0.
FreeSurface(std::unique_ptr< SurfaceDetector::Interface > &&surfaceDetector)
std::unique_ptr< SurfaceDetector::Interface > surfaceDetector
void setBoundaryCondition(Particles &particles)
Set boundary condition for particles. It changes particle objects directly.
void set(int id, double value)
Set the boundary condition value.
@ Inner
inner fluid particle
@ FreeSurface
free surface particle
@ Ignored
Ghost or dummy.
@ Ghost
Ghost particle (outside of the domain, not used for calculation)
@ DummyWall
Dummy wall particle (pressure is not calculated)