Skip to content

Commit

Permalink
Response to Guill's comments, style corrections.
Browse files Browse the repository at this point in the history
  • Loading branch information
wuwenbin2006 committed Oct 15, 2018
1 parent ed6bbe6 commit aae0062
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 7 deletions.
9 changes: 6 additions & 3 deletions src/Universe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -756,6 +756,7 @@ void Universe::calculateBoundaries() {
for (s_iter = surfs.begin(); s_iter != surfs.end(); ++s_iter) {
surf = s_iter->second->_surface;
halfspace = s_iter->second->_halfspace;

if (surf->getSurfaceType() == XPLANE && halfspace == -1 &&
surf->getBoundaryType() != BOUNDARY_NONE) {
if(surf->getMaxX(halfspace) < cell_max_x) {
Expand Down Expand Up @@ -840,6 +841,7 @@ void Universe::calculateBoundaries() {
for (s_iter = surfs.begin(); s_iter != surfs.end(); ++s_iter) {
surf = s_iter->second->_surface;
halfspace = s_iter->second->_halfspace;

if (surf->getSurfaceType() == YPLANE && halfspace == -1 &&
surf->getBoundaryType() != BOUNDARY_NONE) {
if(surf->getMaxY(halfspace) < cell_max_y) {
Expand All @@ -863,12 +865,12 @@ void Universe::calculateBoundaries() {

_max_y = max_y;

/* Calculate the minimum reachable y-coordinate in the geometry and store it
/* Calculate the minimum reachable z-coordinate in the geometry and store it
* in _min_z */
double min_z = std::numeric_limits<double>::infinity();

/* Calculate the boundary condition at the minimum
* reachable y-coordinate in the Universe and store it in _min_y_bound
* reachable z-coordinate in the Universe and store it in _min_z_bound
*/
_min_z_bound = BOUNDARY_NONE;

Expand Down Expand Up @@ -910,7 +912,7 @@ void Universe::calculateBoundaries() {
double max_z = -std::numeric_limits<double>::infinity();

/* Calculate the boundary condition at the maximum
* reachable y-coordinate in the Universe and store it in _max_y_bound
* reachable z-coordinate in the Universe and store it in _max_z_bound
*/
_max_z_bound = BOUNDARY_NONE;

Expand All @@ -923,6 +925,7 @@ void Universe::calculateBoundaries() {
for (s_iter = surfs.begin(); s_iter != surfs.end(); ++s_iter) {
surf = s_iter->second->_surface;
halfspace = s_iter->second->_halfspace;

if (surf->getSurfaceType() == ZPLANE && halfspace == -1 &&
surf->getBoundaryType() != BOUNDARY_NONE) {
if(surf->getMaxZ(halfspace) < cell_max_z) {
Expand Down
23 changes: 19 additions & 4 deletions tests/test_calculate_boundaries/test_calculate_boundaries.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@


class CalculateBoundariesTestHarness(TestHarness):
"""A test of OpenMOC's logger module."""
"""A unit test of OpenMOC's Universe::calculateBoundaries routine."""

def __init__(self):
super(CalculateBoundariesTestHarness, self).__init__()
Expand All @@ -24,6 +24,7 @@ def _create_trackgenerator(self):

def _generate_tracks(self):
pass

def _creat_solver(self):
pass

Expand Down Expand Up @@ -232,6 +233,13 @@ def _run_openmoc(self):
sB.setBoundaryType(openmoc.PERIODIC)
sT.setBoundaryType(openmoc.REFLECTIVE)

sX_mid = openmoc.XPlane(15)
sY_mid = openmoc.YPlane(35)
sZ_mid = openmoc.ZPlane(55)
sX_mid.setBoundaryType(openmoc.BOUNDARY_NONE)
sY_mid.setBoundaryType(openmoc.BOUNDARY_NONE)
sZ_mid.setBoundaryType(openmoc.BOUNDARY_NONE)

cell = openmoc.Cell()
cell.addSurface(+1,sW)
cell.addSurface(-1,sE)
Expand All @@ -240,6 +248,13 @@ def _run_openmoc(self):
cell.addSurface(+1,sB)
cell.addSurface(-1,sT)

cell.addSurface(+1,sX_mid)
cell.addSurface(-1,sX_mid)
cell.addSurface(+1,sY_mid)
cell.addSurface(-1,sY_mid)
cell.addSurface(+1,sZ_mid)
cell.addSurface(-1,sZ_mid)

univ = openmoc.Universe()
univ.addCell(cell)

Expand All @@ -248,21 +263,21 @@ def _run_openmoc(self):
py_printf('NORMAL', 'MinY: %f', univ.getMinY())
py_printf('NORMAL', 'MinYBoundaryType: %s', univ.getMinYBoundaryType())
py_printf('NORMAL', 'MinZ: %f', univ.getMinZ())
py_printf('NORMAL', 'MinZBoundaryType: %s', univ.getMinZBoundaryType())
py_printf('NORMAL', 'MinZBoundaryType: %s', univ.getMinZBoundaryType())
py_printf('NORMAL', 'MaxX: %f', univ.getMaxX())
py_printf('NORMAL', 'MaxXBoundaryType: %s', univ.getMaxXBoundaryType())
py_printf('NORMAL', 'MaxY: %f', univ.getMaxY())
py_printf('NORMAL', 'MaxYBoundaryType: %s', univ.getMaxYBoundaryType())
py_printf('NORMAL', 'MaxZ: %f', univ.getMaxZ())
py_printf('NORMAL', 'MaxZBoundaryType: %s', univ.getMaxZBoundaryType())
py_printf('NORMAL', 'MaxZBoundaryType: %s', univ.getMaxZBoundaryType())

def _get_results(self, num_iters=False, keff=False, fluxes=False,
num_fsrs=False, num_tracks=False, num_segments=False,
hash_output=False):
"""Digest info in the log file and return as a string."""

# Find the log filename with the time and date
logfilename = glob.glob('log/openmoc-*')
print(logfilename)

# Read the file into a list of strings for each line
with open(logfilename[0], 'r') as myfile:
Expand Down

0 comments on commit aae0062

Please sign in to comment.