-
Notifications
You must be signed in to change notification settings - Fork 456
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor and generalize the boundary condition implementation #1701
Merged
Merged
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
0f214eb
Move BC tracking software into separate functions
smharper 05ea9ea
Move reflective/white BCs to a new class
smharper 1d07f49
Move all BCs to the new BoundaryCondtion class
smharper 58a0aa3
Add surface indices to the PeriodicBC class
smharper 16d4c58
Move periodic translation from Surface class to BC
smharper 8e6842d
Move rotational periodic BCs to the new class
smharper 2fa449d
Remove the PeriodicSurface class
smharper 593a4ad
Remove the old Surface::bc_ attribute
smharper fe0cffe
Reimplement SurfacePlane translational BCs
smharper b64a3d3
Add general plane support for rotational BCs
smharper b403f87
Increase periodic BC test coverage
smharper f060b4e
Add docstrings to boundary_condition.h
smharper fb8bae8
Update BCs for DAGMC surfaces
smharper 1af80b1
Apply suggestions from code review
smharper 5fb806b
Add comments to periodic BC implementation
smharper 803ae8d
Simplify pairing logic for periodic surfaces
smharper c75790d
Remove unneeded plot from periodic BC test
smharper a8ecb79
Assume un-aligned normals for rotational BCs
smharper f8c7a74
Fix non-90-degree rotational periodic BCs
smharper 6ed023c
Add a test for non-90-degree periodic BCs
smharper 8879414
Merge remote-tracking branch 'upstream/develop' into bc_update
smharper b03b983
Add missing test __init__.py
smharper File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
#ifndef OPENMC_BOUNDARY_CONDITION_H | ||
#define OPENMC_BOUNDARY_CONDITION_H | ||
|
||
#include "openmc/position.h" | ||
|
||
namespace openmc { | ||
|
||
// Forward declare some types used in function arguments. | ||
class Particle; | ||
class Surface; | ||
|
||
//============================================================================== | ||
//! A class that tells particles what to do after they strike an outer boundary. | ||
//============================================================================== | ||
|
||
class BoundaryCondition { | ||
public: | ||
//! Perform tracking operations for a particle that strikes the boundary. | ||
//! \param p The particle that struck the boundary. This class is not meant | ||
//! to directly modify anything about the particle, but it will do so | ||
//! indirectly by calling the particle's appropriate cross_*_bc function. | ||
//! \param surf The specific surface on the boundary the particle struck. | ||
virtual void | ||
handle_particle(Particle& p, const Surface& surf) const = 0; | ||
|
||
//! Return a string classification of this BC. | ||
virtual std::string type() const = 0; | ||
}; | ||
|
||
//============================================================================== | ||
//! A BC that kills particles, indicating they left the problem. | ||
//============================================================================== | ||
|
||
class VacuumBC : public BoundaryCondition { | ||
public: | ||
void | ||
handle_particle(Particle& p, const Surface& surf) const override; | ||
|
||
std::string type() const override {return "vacuum";} | ||
}; | ||
|
||
//============================================================================== | ||
//! A BC that returns particles via specular reflection. | ||
//============================================================================== | ||
|
||
class ReflectiveBC : public BoundaryCondition { | ||
public: | ||
void | ||
handle_particle(Particle& p, const Surface& surf) const override; | ||
|
||
std::string type() const override {return "reflective";} | ||
}; | ||
|
||
//============================================================================== | ||
//! A BC that returns particles via diffuse reflection. | ||
//============================================================================== | ||
|
||
class WhiteBC : public BoundaryCondition { | ||
public: | ||
void | ||
handle_particle(Particle& p, const Surface& surf) const override; | ||
|
||
std::string type() const override {return "white";} | ||
}; | ||
|
||
//============================================================================== | ||
//! A BC that moves particles to another part of the problem. | ||
//============================================================================== | ||
|
||
class PeriodicBC : public BoundaryCondition { | ||
public: | ||
PeriodicBC(int i_surf, int j_surf) | ||
: i_surf_(i_surf), j_surf_(j_surf) | ||
{}; | ||
|
||
std::string type() const override {return "periodic";} | ||
|
||
protected: | ||
int i_surf_; | ||
int j_surf_; | ||
}; | ||
|
||
//============================================================================== | ||
//! A BC that moves particles to another part of the problem without rotation. | ||
//============================================================================== | ||
|
||
class TranslationalPeriodicBC : public PeriodicBC { | ||
public: | ||
TranslationalPeriodicBC(int i_surf, int j_surf); | ||
|
||
void | ||
handle_particle(Particle& p, const Surface& surf) const override; | ||
|
||
protected: | ||
//! Vector along which incident particles will be moved | ||
Position translation_; | ||
}; | ||
|
||
//============================================================================== | ||
//! A BC that rotates particles about a global axis. | ||
// | ||
//! Currently only rotations about the z-axis are supported. | ||
//============================================================================== | ||
|
||
class RotationalPeriodicBC : public PeriodicBC { | ||
public: | ||
RotationalPeriodicBC(int i_surf, int j_surf); | ||
|
||
void | ||
handle_particle(Particle& p, const Surface& surf) const override; | ||
|
||
protected: | ||
//! Angle about the axis by which particle coordinates will be rotated | ||
double angle_; | ||
}; | ||
|
||
} // namespace openmc | ||
#endif // OPENMC_BOUNDARY_CONDITION_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice to get rid of
PeriodicSurface
in the hierarchy