ls1-MarDyn
ls1-MarDyn molecular dynamics code
Mirror.h
1//Calculation of the Fluid Wall interaction by a function
2
3#ifndef MIRROR_H_
4#define MIRROR_H_
5
6#include "PluginBase.h"
7#include "utils/Random.h"
8#include "utils/ObserverBase.h"
9#include "utils/Region.h"
10
11#include <string>
12#include <map>
13#include <list>
14#include <cstdint>
15#include <vector>
16#include <memory>
17#include <utility>
18
19#include "utils/CommVar.h"
20
21enum MirrorDirection : uint16_t {
22 MD_LEFT_MIRROR = 0,
23 MD_RIGHT_MIRROR = 1
24};
25
26enum MirrorType : uint16_t {
27 MT_UNKNOWN = 0,
28 MT_REFLECT = 1,
29 MT_FORCE_CONSTANT = 2,
30 MT_ZERO_GRADIENT = 3, // Deprecated
31 MT_NORMDISTR_MB = 4, // Deprecated
32 MT_MELAND_2004 = 5, // Algorithm proposed by Meland et al., Phys. Fluids, Vol. 16, No. 2 (2004)
33 MT_RAMPING = 6,
34};
35
38class Domain;
39
40class Mirror : public PluginBase, public ObserverBase, public ControlInstance
41{
42public:
43 // constructor and destructor
44 Mirror();
45 ~~Mirror() override = default;
46
75 void readXML(XMLfileUnits& xmlconfig) override;
76
77 void init(ParticleContainer *particleContainer,
78 DomainDecompBase *domainDecomp, Domain *domain) override;
79
80 void beforeForces(
81 ParticleContainer* particleContainer, DomainDecompBase* domainDecomp,
82 unsigned long simstep
83 ) override;
84
89 void afterForces(
90 ParticleContainer* particleContainer, DomainDecompBase* domainDecomp,
91 unsigned long simstep
92 ) override;
93
94 void endStep(
95 ParticleContainer *particleContainer,
96 DomainDecompBase *domainDecomp, Domain *domain,
97 unsigned long simstep) override {}
98
99 void finish(ParticleContainer *particleContainer,
100 DomainDecompBase *domainDecomp, Domain *domain) override {}
101
102 std::string getPluginName() override {return std::string("Mirror");}
103 static PluginBase* createInstance() {return new Mirror();}
104
105 // Getters, Setters
106 uint64_t getReflectedParticlesCountLocal(const uint16_t& componentid){return _particleManipCount.reflected.local.at(componentid);}
107 uint64_t getDeletedParticlesCountLocal(const uint16_t& componentid) {return _particleManipCount.deleted.local.at(componentid);}
108 uint32_t getPluginID() {return _pluginID;}
109 void setPluginID(const uint32_t& id) {_pluginID = id;}
110 double getPosition() {return _position.coord;}
111
112 // Observer, ControlInstance
113 SubjectBase* getSubject();
114 void update(SubjectBase* subject) override;
115 std::string getShortName() override {return "Mirr";}
116
117private:
118 void VelocityChange(ParticleContainer* particleContainer);
119
120private:
121 uint32_t _pluginID;
122 uint32_t _targetComp;
123 struct MirrorPosition {
124 uint16_t axis;
125 double coord;
126 struct RefPoint {
127 uint16_t id;
128 double origin;
129 double coord;
130 } ref;
131 } _position;
132 double _forceConstant;
133 MirrorDirection _direction;
134 MirrorType _type;
135
136 std::unique_ptr<Random> _rnd;
137
138 struct MelandParams {
139 double velo_target {0.4};
140 float fixed_probability_factor {-1};
141 } _melandParams;
142
143 struct RampingParams {
144 unsigned long startStep {1000};
145 unsigned long stopStep {2000};
146 int treatment {1};
147 } _rampingParams;
148
149 struct ParticleManipCount {
152 } _particleManipCount;
153
154 struct DiffuseMirror {
155 bool enabled;
156 float width;
157 std::map<uint64_t,double> pos_map;
158 } _diffuse_mirror;
159};
160
161#endif /*MIRROR_H_*/
Definition: CommVar.h:17
Definition: Region.h:29
handle boundary region and multiple processes
Definition: DomainDecompBase.h:51
This class is used to read in the phasespace and to handle macroscopic values.
Definition: Domain.h:47
Definition: Mirror.h:41
void init(ParticleContainer *particleContainer, DomainDecompBase *domainDecomp, Domain *domain) override
Method init will be called at the begin of the simulation.
Definition: Mirror.cpp:49
void beforeForces(ParticleContainer *particleContainer, DomainDecompBase *domainDecomp, unsigned long simstep) override
Method beforeForces will be called before forcefields have been applied no alterations w....
Definition: Mirror.cpp:189
void endStep(ParticleContainer *particleContainer, DomainDecompBase *domainDecomp, Domain *domain, unsigned long simstep) override
Method endStep will be called at the end of each time step.
Definition: Mirror.h:94
void readXML(XMLfileUnits &xmlconfig) override
Read in XML configuration for Mirror and all its included objects.
Definition: Mirror.cpp:53
std::string getPluginName() override
return the name of the plugin
Definition: Mirror.h:102
void afterForces(ParticleContainer *particleContainer, DomainDecompBase *domainDecomp, unsigned long simstep) override
Method afterForces will be called after forcefields have been applied.
Definition: Mirror.cpp:372
void finish(ParticleContainer *particleContainer, DomainDecompBase *domainDecomp, Domain *domain) override
Method finish will be called at the end of the simulation.
Definition: Mirror.h:99
Definition: ObserverBase.h:13
This Interface is used to get access to particles and pairs of particles.
Definition: ParticleContainer.h:69
The PluginBase class provides the interface for any kind of output/plugin classes - called "(output) ...
Definition: PluginBase.h:47
Definition: ObserverBase.h:20
XML file with unit attributes abstraction.
Definition: xmlfileUnits.h:25
::xsd::cxx::tree::id< char, ncname > id
C++ type corresponding to the ID XML Schema built-in type.
Definition: vtk-punstructured.h:322
::xsd::cxx::tree::string< char, simple_type > string
C++ type corresponding to the string XML Schema built-in type.
Definition: vtk-punstructured.h:270
Definition: Mirror.h:126