|
#include <SubcriticalMaserBoundaryTEST.h>
Public Member Functions | |
SubcriticalMaserBoundaryTEST () | |
MaserBoundary constructor. More... | |
~SubcriticalMaserBoundaryTEST () override | |
destructor More... | |
SubcriticalMaserBoundaryTEST * | copy () const override |
Creates a copy of this maser on the heap. More... | |
void | read (std::istream &is) override |
reads boundary properties from istream More... | |
void | write (std::ostream &os) const override |
writes boundary properties to ostream More... | |
std::string | getName () const override |
Returns the name of the object. More... | |
void | actionsBeforeTimeLoop () override |
void | createPeriodicParticle (BaseParticle *p, ParticleHandler &pH) override |
Creates periodic particles when the particle is a maser particle and is sufficiently close to one of the boundary walls. More... | |
bool | checkBoundaryAfterParticleMoved (BaseParticle *p, ParticleHandler &pH) const |
Shifts the particle to its 'periodic' position if it is a maser particle and has crossed either of the walls. Creates a 'normal' particle at its current position if it is a maser particle which crossed the RIGHT boundary wall. More... | |
void | checkBoundaryAfterParticlesMove (ParticleHandler &pH) override |
Evaluates what the particles have to do after they have changed position. More... | |
void | activateMaser () |
Activates the maser functionaly of this periodic boundary. More... | |
void | deactivateMaser () |
Stops copying particles, and act merely as a periodic domain. More... | |
bool | isActivated () const |
Returns whether the maser is activated or not. More... | |
void | setActivationTime (Mdouble time) |
sets the activate time of the maser More... | |
Mdouble | getDistance (const Vec3D &position) const override |
gets the distance to the closest wall if maser is inactive, otherwise distance to right wall More... | |
Mdouble | getDistanceFromRight (const Vec3D &position) const |
returns the distance to the right wall More... | |
void | modifyPeriodicComplexity (std::vector< int > &complexity, int &totalPeriodicComplexity, BaseParticle *particle, int i) const override |
modifies the periodic complexity to support a maser boundary More... | |
void | modifyGhostAfterCreation (BaseParticle *particle, int i) override |
void | performActionsBeforeAddingParticles () override |
Checks before adding particles if the maser needs to be activated. More... | |
void | extendBottom () const |
void | copyExtraParticles () const |
void | setCopyFlowParticles (bool copyFlowParticles) |
Public Member Functions inherited from PeriodicBoundary | |
PeriodicBoundary () | |
default constructor More... | |
~PeriodicBoundary () override | |
destructor More... | |
PeriodicBoundary (const PeriodicBoundary &other) | |
copy constructor More... | |
void | set (Vec3D normal, Mdouble distanceLeft, Mdouble distanceRight) |
Defines a PeriodicBoundary by its normal and positions. More... | |
void | set (Vec3D normal, Vec3D positionLeft, Vec3D positionRight) |
As above, but by specifying two positions that the boundaries go through instead of distanceLeft and distanceRight. More... | |
void | set (Vec3D normal, Mdouble distanceLeft, Mdouble distanceRight, Vec3D shiftDirection) |
For general parallelogramic domains, the direction of the shift vector can to be set manually. More... | |
void | setPlanewiseShift (Vec3D planewiseShift) |
Set the planewise shift (projected onto the planewise direction, and zero by default). More... | |
Vec3D | getNormal () const |
returns the vector normal to the periodic boundary More... | |
Mdouble | getDistanceLeft () const |
Returns the distance of the left wall to the origin, in normal direction. More... | |
Mdouble | getDistanceRight () const |
Returns the distance of the right wall to the origin, in normal direction. More... | |
Vec3D | getShift () const |
Returns the vector going from the left to the right side of the periodic boundary. More... | |
void | moveLeft (Mdouble distanceLeft) |
Sets the distance from the origin of the 'left' periodic wall. More... | |
void | moveRight (Mdouble distanceRight) |
Sets the distance from the origin of the 'right' periodic wall. More... | |
Mdouble | getDistance (const BaseParticle &p) const override |
Returns the distance of the edge to the particle. More... | |
virtual void | shiftPosition (BaseParticle *p) const override |
shifts the particle More... | |
void | shiftPosition (Vec3D &p) const |
virtual void | shiftPositions (Vec3D &postition1, Vec3D &postion2) const |
shifts two positions More... | |
virtual bool | isClosestToLeftBoundary (const BaseParticle &p) const |
Returns TRUE if particle checked is closest to the 'left' edge, and FALSE if it is closest to the 'right' edge. More... | |
bool | isClosestToLeftBoundary (const Vec3D &p) const override |
virtual void | createPeriodicParticles (ParticleHandler &pH) override |
Checks distance of particle to closer edge and creates a periodic copy if necessary. More... | |
void | createGhostParticle (BaseParticle *pReal) |
Creates and adds a ghost particle from a given real particle. More... | |
void | createPeriodicParticle (BaseParticle *p, ParticleHandler &pH) override |
Creates a single periodic particle if required from a given particle. More... | |
MERCURYDPM_DEPRECATED void | oldRead (std::istream &is) |
deprecated version of CubeInsertionBoundary::read(). More... | |
Public Member Functions inherited from BasePeriodicBoundary | |
BasePeriodicBoundary () | |
default constructor. More... | |
BasePeriodicBoundary (const BasePeriodicBoundary &b) | |
copy constructor More... | |
~BasePeriodicBoundary () override | |
destructor More... | |
void | setPeriodicHandler (PeriodicBoundaryHandler *periodicHandler) |
Sets the periodicBoundaryHandler, required for parallel periodic boundaries. More... | |
PeriodicBoundaryHandler * | getPeriodicHandler () const |
Returns the periodic boundary handler. More... | |
void | createPeriodicParticles (ParticleHandler &pH) override |
Creates periodic ocpies of given particle in case of periodic boundaries in serial build. More... | |
Public Member Functions inherited from BaseBoundary | |
BaseBoundary () | |
default constructor. More... | |
BaseBoundary (const BaseBoundary &b) | |
copy constructor More... | |
~BaseBoundary () override | |
destructor More... | |
virtual void | createPeriodicParticle (BaseParticle *p UNUSED, ParticleHandler &pH UNUSED) |
Creates a periodic particle in case of periodic boundaries in serial build. More... | |
virtual void | createPeriodicParticles (ParticleHandler &pH UNUSED) |
Creates periodic copies of given particle in case of periodic boundaries. More... | |
virtual void | checkBoundaryBeforeTimeStep (DPMBase *md) |
Virtual function that does things before each time step. More... | |
virtual void | writeVTK (std::fstream &file) |
void | setHandler (BoundaryHandler *handler) |
Sets the boundary's BoundaryHandler. More... | |
BoundaryHandler * | getHandler () const |
Returns the boundary's BoundaryHandler. More... | |
Public Member Functions inherited from BaseObject | |
BaseObject ()=default | |
Default constructor. More... | |
BaseObject (const BaseObject &p)=default | |
Copy constructor, copies all the objects BaseObject contains. More... | |
virtual | ~BaseObject ()=default |
virtual destructor More... | |
virtual void | moveInHandler (unsigned int index) |
Except that it is virtual, it does the same thing as setIndex() does. More... | |
void | setIndex (unsigned int index) |
Allows one to assign an index to an object in the handler/container. More... | |
void | setId (unsigned long id) |
Assigns a unique identifier to each object in the handler (container) which remains constant even after the object is deleted from the container/handler. More... | |
unsigned int | getIndex () const |
Returns the index of the object in the handler. More... | |
unsigned int | getId () const |
Returns the unique identifier of any particular object. More... | |
void | setGroupId (unsigned groupId) |
unsigned | getGroupId () const |
Private Attributes | |
bool | maserIsActivated_ |
Flag whether or not the gap is created and particles transformed already. More... | |
Mdouble | activationTime_ |
Time at which the maser opens. More... | |
bool | copyFlowParticles_ |
Flag for whether or not we copy a few blocks of flow particles in the front when activating the maser. More... | |
Additional Inherited Members | |
Protected Attributes inherited from PeriodicBoundary | |
Vec3D | normal_ |
outward unit normal vector for right edge More... | |
Mdouble | distanceLeft_ |
position of left edge, s.t. normal*x = distanceLeft_ More... | |
Mdouble | distanceRight_ |
position of right edge, s.t. normal*x = distanceRight_ More... | |
Mdouble | scaleFactor_ |
This is the normal to rescale the normal vector to a unit vectors. More... | |
Vec3D | shift_ |
shift from left to right boundary More... | |
SubcriticalMaserBoundaryTEST::SubcriticalMaserBoundaryTEST | ( | ) |
MaserBoundary constructor.
MaserBoundary constructor, sets all scalars to non-sensible values.
References activationTime_, copyFlowParticles_, PeriodicBoundary::distanceLeft_, PeriodicBoundary::distanceRight_, and maserIsActivated_.
Referenced by copy().
|
override |
destructor
destructor
|
overridevirtual |
Helper function to make sure that the particles are maser particles after restarting.
Reimplemented from BaseBoundary.
References getDistance(), BaseBoundary::getHandler(), and maserIsActivated_.
void SubcriticalMaserBoundaryTEST::activateMaser | ( | ) |
Activates the maser functionaly of this periodic boundary.
Activates the maser boundary by flagging all particles within as isMaserParticles. These maser particle will generate real particles at the right side of the maser.
References PeriodicBoundaryHandler::addNewParticles(), PeriodicBoundaryHandler::clearCommunicationLists(), copyExtraParticles(), copyFlowParticles_, extendBottom(), getDistance(), BaseHandler< T >::getDPMBase(), BaseBoundary::getHandler(), BasePeriodicBoundary::getPeriodicHandler(), INFO, logger, maserIsActivated_, and DPMBase::particleHandler.
Referenced by checkBoundaryAfterParticlesMove(), and performActionsBeforeAddingParticles().
bool SubcriticalMaserBoundaryTEST::checkBoundaryAfterParticleMoved | ( | BaseParticle * | p, |
ParticleHandler & | pH | ||
) | const |
Shifts the particle to its 'periodic' position if it is a maser particle and has crossed either of the walls. Creates a 'normal' particle at its current position if it is a maser particle which crossed the RIGHT boundary wall.
Checks whether a given particle (a) is in the Maser and (b) has crossed the closest wall. If so, shifts its position so as to have it appear at the other wall, and creates a 'real' equivalent in the outflow domain.
[in] | p | The particle to be checked and possibly shifted and copied |
pH | The ParticleHandler, which is unused in this implementation |
References ParticleHandler::addObject(), BaseParticle::copy(), getDistance(), getDistanceFromRight(), BaseInteractable::getPosition(), BaseParticle::isMaserParticle(), logger, maserIsActivated_, BaseParticle::setMaserParticle(), PeriodicBoundary::shiftPosition(), and VERBOSE.
Referenced by checkBoundaryAfterParticlesMove().
|
overridevirtual |
Evaluates what the particles have to do after they have changed position.
After particles have moved, check if the maser needs to be update or not. This function also updates the particles in the particleHandler based on their new position
[in] | pH | The particle handler, is used to loop over all particles to flag maser particles |
Reimplemented from PeriodicBoundary.
References activateMaser(), activationTime_, checkBoundaryAfterParticleMoved(), BaseBoundary::getHandler(), INFO, logger, maserIsActivated_, and NUMBER_OF_PROCESSORS.
|
overridevirtual |
Creates a copy of this maser on the heap.
Copy method, creates a copy of the object on the heap and returns a pointer to it.
Reimplemented from PeriodicBoundary.
References SubcriticalMaserBoundaryTEST().
void SubcriticalMaserBoundaryTEST::copyExtraParticles | ( | ) | const |
when activating the maser, extend the bottom periodically until the end of the domain, by copying the fixed particles of the periodic part of the maser with intervals of shift_.
References ParticleHandler::addObject(), MPIContainer::broadcast(), DPMBase::domainHandler, BaseHandler< T >::getDPMBase(), BaseBoundary::getHandler(), DomainHandler::getParticleDomainGlobalIndex(), DomainHandler::getParticleProcessor(), constants::i, INFO, MPIContainer::Instance(), logger, NUMBER_OF_PROCESSORS, DPMBase::particleHandler, PROCESSOR_ID, and PeriodicBoundary::shift_.
Referenced by activateMaser().
|
override |
Creates periodic particles when the particle is a maser particle and is sufficiently close to one of the boundary walls.
If the maser is active only maser particles can create a ghost of they are close to the right boundary. If this is the case a ghost will be created and added to the particleHandler at the appropriate position. If the maser is not active then this acts as a normal periodic boundary and so the left boundary is also allowed to create ghosts.
[in] | p | Particle to be checked and possibly periodically copied |
[in,out] | pH | System's ParticleHandler, (1) from which the interaction radius of its largest particle is retrieved to determine the maximum distance from the wall at which a particle should still have a periodic copy created, and (2) to which a possible periodic copy of the particle will be added |
References PeriodicBoundary::createGhostParticle(), getDistance(), getDistanceFromRight(), ParticleHandler::getLargestParticle(), BaseParticle::getMaxInteractionRadius(), BaseInteractable::getPosition(), BaseParticle::isMaserParticle(), and maserIsActivated_.
void SubcriticalMaserBoundaryTEST::deactivateMaser | ( | ) |
Stops copying particles, and act merely as a periodic domain.
References getDistance(), BaseBoundary::getHandler(), logger, maserIsActivated_, and WARN.
void SubcriticalMaserBoundaryTEST::extendBottom | ( | ) | const |
when activating the maser, extend the bottom periodically until the end of the domain, by copying the fixed particles of the periodic part of the maser with intervals of shift_.
References ParticleHandler::addObject(), MPIContainer::broadcast(), DPMBase::domainHandler, BaseHandler< T >::getDPMBase(), BaseBoundary::getHandler(), DPMBase::getMax(), DPMBase::getMin(), DomainHandler::getParticleDomainGlobalIndex(), DomainHandler::getParticleProcessor(), constants::i, INFO, MPIContainer::Instance(), logger, NUMBER_OF_PROCESSORS, DPMBase::particleHandler, PROCESSOR_ID, PeriodicBoundary::shift_, Vec3D::X, Vec3D::Y, and Vec3D::Z.
Referenced by activateMaser().
gets the distance to the closest wall if maser is inactive, otherwise distance to right wall
getDistance is used in a periodic boundary to measure the distance from a certain position to the periodic boundary that actually mirrors are particle. For a maser boundary, if the boundary is active, this is only the right boundary and hence the generic getDistance function is overwritten with getDistanceFromRight()
[in] | position | The position of which we want to know the distance towards the nearest active boundary |
Reimplemented from PeriodicBoundary.
References PeriodicBoundary::getDistance(), getDistanceFromRight(), and maserIsActivated_.
Referenced by actionsBeforeTimeLoop(), activateMaser(), checkBoundaryAfterParticleMoved(), createPeriodicParticle(), and deactivateMaser().
returns the distance to the right wall
The maser only requires particles at the right boundary to create ghosts therefore the distance towards the right boundary is an important quantity to compute.
[in] | Position | from which the distance to the right wall is computd |
References PeriodicBoundary::distanceRight_, Vec3D::dot(), and PeriodicBoundary::normal_.
Referenced by checkBoundaryAfterParticleMoved(), createPeriodicParticle(), getDistance(), and modifyPeriodicComplexity().
|
overridevirtual |
Returns the name of the object.
Returns the name of the object class
Reimplemented from PeriodicBoundary.
bool SubcriticalMaserBoundaryTEST::isActivated | ( | ) | const |
Returns whether the maser is activated or not.
References maserIsActivated_.
|
overridevirtual |
Reimplemented from BaseBoundary.
References BaseParticle::getPeriodicComplexity(), constants::i, BaseParticle::isMaserParticle(), maserIsActivated_, and BaseParticle::setPeriodicComplexity().
|
overridevirtual |
modifies the periodic complexity to support a maser boundary
In the parallel periodic boundary, everything is computed by the periodic complexity of a particle. Generally it is not possible to be a real particle outside a periodic boundary, but in case of a maser this is definetly possible. To accomodate this the periodic complexity needs to be modified such that this particle remains to be marked as a real particle. When the distance from the maser boundary is negative we give the flag 3 of the periodic complexity to mark that this is actually a real particle outside the maser boundary
[in,out] | complexity | The periodic complexity, indicates how a position/particle is related to periodioc boundaries |
[in] | position | The position of the given periodic complexity |
[in] | The | index in the complexity vector that this boundary corresponds to |
Reimplemented from BasePeriodicBoundary.
References getDistanceFromRight(), BaseInteractable::getPosition(), constants::i, INFO, BaseParticle::isMaserParticle(), logger, and maserIsActivated_.
|
overridevirtual |
Checks before adding particles if the maser needs to be activated.
Before adding particles a check is made to see if the maser needs to be activated or not This check is based on the give activation time, if not set by default it is NaN and the maser will never be activated
Reimplemented from BasePeriodicBoundary.
References activateMaser(), activationTime_, BaseBoundary::getHandler(), INFO, logger, and maserIsActivated_.
|
overridevirtual |
reads boundary properties from istream
Reads the boundary properties from an istream
[in,out] | is | the istream from which the boundary must be read |
Reimplemented from PeriodicBoundary.
References activationTime_, INFO, logger, maserIsActivated_, and PeriodicBoundary::read().
void SubcriticalMaserBoundaryTEST::setActivationTime | ( | Mdouble | time | ) |
sets the activate time of the maser
The maser is disabled by default and has to be activated. The activation can be done by setting the activation time.
[in] | time | The time at which the maser needs to be activated |
References activationTime_.
Referenced by MaserRepeatedOutInMPI2Test::setupInitialConditions(), and MpiMaserChuteTest::setupInitialConditions().
void SubcriticalMaserBoundaryTEST::setCopyFlowParticles | ( | bool | copyFlowParticles | ) |
References copyFlowParticles_.
|
overridevirtual |
writes boundary properties to ostream
Writes boundary's properties to an ostream
[in] | os | the ostream to which the boundary must be written |
Reimplemented from PeriodicBoundary.
References activationTime_, maserIsActivated_, and PeriodicBoundary::write().
|
private |
Time at which the maser opens.
Referenced by checkBoundaryAfterParticlesMove(), performActionsBeforeAddingParticles(), read(), setActivationTime(), SubcriticalMaserBoundaryTEST(), and write().
|
private |
Flag for whether or not we copy a few blocks of flow particles in the front when activating the maser.
Referenced by activateMaser(), setCopyFlowParticles(), and SubcriticalMaserBoundaryTEST().
|
private |
Flag whether or not the gap is created and particles transformed already.
Referenced by actionsBeforeTimeLoop(), activateMaser(), checkBoundaryAfterParticleMoved(), checkBoundaryAfterParticlesMove(), createPeriodicParticle(), deactivateMaser(), getDistance(), isActivated(), modifyGhostAfterCreation(), modifyPeriodicComplexity(), performActionsBeforeAddingParticles(), read(), SubcriticalMaserBoundaryTEST(), and write().