MPS-Basic
Loading...
Searching...
No Matches
PressureCalculator::DirichletBoundaryConditionGenerator::FreeSurface Class Reference

Dirichlet Boundary Condition Generator that sets the free surface pressure to 0. More...

#include <free_surface.hpp>

Inheritance diagram for PressureCalculator::DirichletBoundaryConditionGenerator::FreeSurface:
Collaboration diagram for PressureCalculator::DirichletBoundaryConditionGenerator::FreeSurface:

Public Member Functions

DirichletBoundaryCondition generate (Particles &particles) override
 Generate Dirichlet boundary condition.
 
 ~FreeSurface () override
 
 FreeSurface (std::unique_ptr< SurfaceDetector::Interface > &&surfaceDetector)
 
- Public Member Functions inherited from PressureCalculator::DirichletBoundaryConditionGenerator::Interface
virtual ~Interface ()
 

Private Member Functions

void setBoundaryCondition (Particles &particles)
 Set boundary condition for particles. It changes particle objects directly.
 

Private Attributes

std::unique_ptr< SurfaceDetector::InterfacesurfaceDetector
 

Detailed Description

Dirichlet Boundary Condition Generator that sets the free surface pressure to 0.

Definition at line 13 of file free_surface.hpp.

Constructor & Destructor Documentation

◆ ~FreeSurface()

FreeSurface::~FreeSurface ( )
override

Definition at line 22 of file free_surface.cpp.

22 {
23}

◆ FreeSurface()

FreeSurface::FreeSurface ( std::unique_ptr< SurfaceDetector::Interface > && surfaceDetector)

Definition at line 25 of file free_surface.cpp.

25 {
26 this->surfaceDetector = std::move(surfaceDetector);
27}
std::unique_ptr< SurfaceDetector::Interface > surfaceDetector

Member Function Documentation

◆ generate()

DirichletBoundaryCondition FreeSurface::generate ( Particles & particles)
overridevirtual

Generate Dirichlet boundary condition.

Parameters
particlesParticles
Returns
Dirichlet boundary condition

Implements PressureCalculator::DirichletBoundaryConditionGenerator::Interface.

Definition at line 8 of file free_surface.cpp.

8 {
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}
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
Here is the call graph for this function:

◆ setBoundaryCondition()

void FreeSurface::setBoundaryCondition ( Particles & particles)
private

Set boundary condition for particles. It changes particle objects directly.

Parameters
particlesParticles

Definition at line 33 of file free_surface.cpp.

33 {
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}
@ 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)
Here is the caller graph for this function:

Member Data Documentation

◆ surfaceDetector

std::unique_ptr<SurfaceDetector::Interface> PressureCalculator::DirichletBoundaryConditionGenerator::FreeSurface::surfaceDetector
private

Definition at line 25 of file free_surface.hpp.


The documentation for this class was generated from the following files: