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
5
using
PressureCalculator::DirichletBoundaryCondition
;
6
using
PressureCalculator::DirichletBoundaryConditionGenerator::FreeSurface
;
7
8
DirichletBoundaryCondition
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
22
FreeSurface::~FreeSurface
() {
23
}
24
25
FreeSurface::FreeSurface
(std::unique_ptr<SurfaceDetector::Interface>&& surfaceDetector) {
26
this->
surfaceDetector
= std::move(
surfaceDetector
);
27
}
28
33
void
FreeSurface::setBoundaryCondition
(
Particles
& particles) {
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
}
Particles
A collection of particles.
Definition
particles.hpp:10
PressureCalculator::DirichletBoundaryConditionGenerator::FreeSurface
Dirichlet Boundary Condition Generator that sets the free surface pressure to 0.
Definition
free_surface.hpp:13
PressureCalculator::DirichletBoundaryConditionGenerator::FreeSurface::~FreeSurface
~FreeSurface() override
Definition
free_surface.cpp:22
PressureCalculator::DirichletBoundaryConditionGenerator::FreeSurface::FreeSurface
FreeSurface(std::unique_ptr< SurfaceDetector::Interface > &&surfaceDetector)
Definition
free_surface.cpp:25
PressureCalculator::DirichletBoundaryConditionGenerator::FreeSurface::surfaceDetector
std::unique_ptr< SurfaceDetector::Interface > surfaceDetector
Definition
free_surface.hpp:25
PressureCalculator::DirichletBoundaryConditionGenerator::FreeSurface::setBoundaryCondition
void setBoundaryCondition(Particles &particles)
Set boundary condition for particles. It changes particle objects directly.
Definition
free_surface.cpp:33
PressureCalculator::DirichletBoundaryCondition
Dirichlet boundary condition.
Definition
dirichlet_boundary_condition.hpp:14
PressureCalculator::DirichletBoundaryCondition::set
void set(int id, double value)
Set the boundary condition value.
Definition
dirichlet_boundary_condition.cpp:13
free_surface.hpp
FluidState::Inner
@ Inner
inner fluid particle
FluidState::FreeSurface
@ FreeSurface
free surface particle
FluidState::Ignored
@ Ignored
Ghost or dummy.
ParticleType::Ghost
@ Ghost
Ghost particle (outside of the domain, not used for calculation)
ParticleType::DummyWall
@ DummyWall
Dummy wall particle (pressure is not calculated)
refvalues.hpp
src
pressure_calculator
dirichlet_boundary_condition_generator
free_surface.cpp
Generated by
1.12.0