Skip to content

Commit

Permalink
Merge pull request #692 from ukaea/develop
Browse files Browse the repository at this point in the history
new double down build and mesh tally arg names
  • Loading branch information
shimwell authored Jan 25, 2021
2 parents 3ce4c71 + d46d687 commit 8188fb5
Show file tree
Hide file tree
Showing 8 changed files with 99 additions and 62 deletions.
18 changes: 9 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ RUN if [ "$include_neutronics" = "true" ] ; \

# Clone and install NJOY2016
RUN if [ "$include_neutronics" = "true" ] ; \
then git clone https://github.com/njoy/NJOY2016 /opt/NJOY2016 ; \
then git clone --single-branch --branch master https://github.com/njoy/NJOY2016.git /opt/NJOY2016 ; \
cd /opt/NJOY2016 ; \
mkdir build ; \
cd build ; \
Expand All @@ -101,7 +101,7 @@ RUN if [ "$include_neutronics" = "true" ] ; \

# Clone and install Embree
RUN if [ "$include_neutronics" = "true" ] ; \
then git clone https://github.com/embree/embree ; \
then git clone --single-branch --branch master https://github.com/embree/embree.git ; \
cd embree ; \
mkdir build ; \
cd build ; \
Expand All @@ -117,7 +117,7 @@ RUN if [ "$include_neutronics" = "true" ] ; \
mkdir MOAB ; \
cd MOAB ; \
mkdir build ; \
git clone --single-branch --branch develop https://bitbucket.org/fathomteam/moab/ ; \
git clone --single-branch --branch develop https://bitbucket.org/fathomteam/moab.git ; \
cd build ; \
cmake ../moab -DENABLE_HDF5=ON \
-DENABLE_NETCDF=ON \
Expand All @@ -144,13 +144,13 @@ RUN if [ "$include_neutronics" = "true" ] ; \

# Clone and install Double-Down
RUN if [ "$include_neutronics" = "true" ] ; \
then git clone https://github.com/pshriwise/double-down ; \
then git clone --single-branch --branch main https://github.com/pshriwise/double-down.git ; \
cd double-down ; \
mkdir build ; \
cd build ; \
cmake .. -DMOAB_DIR=/MOAB \
-DCMAKE_INSTALL_PREFIX=.. \
-DEMBREE_DIR=/embree/lib/cmake/embree-3.12.1 ; \
-DEMBREE_DIR=/embree ; \
make -j"$compile_cores" ; \
make -j"$compile_cores" install ; \
fi
Expand All @@ -159,16 +159,16 @@ RUN if [ "$include_neutronics" = "true" ] ; \
RUN if [ "$include_neutronics" = "true" ] ; \
then mkdir DAGMC ; \
cd DAGMC ; \
git clone -b develop https://github.com/svalinn/dagmc ; \
git clone --single-branch --branch develop https://github.com/svalinn/DAGMC.git ; \
mkdir build ; \
cd build ; \
cmake ../dagmc -DBUILD_TALLY=ON \
cmake ../DAGMC -DBUILD_TALLY=ON \
-DMOAB_DIR=/MOAB \
-DBUILD_STATIC_EXE=OFF \
-DBUILD_STATIC_LIBS=OFF \
-DCMAKE_INSTALL_PREFIX=/dagmc/ ; \
-DCMAKE_INSTALL_PREFIX=/DAGMC/ ; \
make -j"$compile_cores" install ; \
rm -rf /DAGMC/dagmc /DAGMC/build ; \
rm -rf /DAGMC/DAGMC /DAGMC/build ; \
fi

# Clone and install OpenMC with DAGMC
Expand Down
18 changes: 9 additions & 9 deletions DockerfileDependencies
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ RUN if [ "$include_neutronics" = "true" ] ; \

# Clone and install NJOY2016
RUN if [ "$include_neutronics" = "true" ] ; \
then git clone https://github.com/njoy/NJOY2016 /opt/NJOY2016 ; \
then git clone --single-branch --branch master https://github.com/njoy/NJOY2016.git /opt/NJOY2016 ; \
cd /opt/NJOY2016 ; \
mkdir build ; \
cd build ; \
Expand All @@ -101,7 +101,7 @@ RUN if [ "$include_neutronics" = "true" ] ; \

# Clone and install Embree
RUN if [ "$include_neutronics" = "true" ] ; \
then git clone https://github.com/embree/embree ; \
then git clone --single-branch --branch master https://github.com/embree/embree.git ; \
cd embree ; \
mkdir build ; \
cd build ; \
Expand All @@ -117,7 +117,7 @@ RUN if [ "$include_neutronics" = "true" ] ; \
mkdir MOAB ; \
cd MOAB ; \
mkdir build ; \
git clone --single-branch --branch develop https://bitbucket.org/fathomteam/moab/ ; \
git clone --single-branch --branch develop https://bitbucket.org/fathomteam/moab.git ; \
cd build ; \
cmake ../moab -DENABLE_HDF5=ON \
-DENABLE_NETCDF=ON \
Expand All @@ -144,13 +144,13 @@ RUN if [ "$include_neutronics" = "true" ] ; \

# Clone and install Double-Down
RUN if [ "$include_neutronics" = "true" ] ; \
then git clone https://github.com/pshriwise/double-down ; \
then git clone --single-branch --branch main https://github.com/pshriwise/double-down.git ; \
cd double-down ; \
mkdir build ; \
cd build ; \
cmake .. -DMOAB_DIR=/MOAB \
-DCMAKE_INSTALL_PREFIX=.. \
-DEMBREE_DIR=/embree/lib/cmake/embree-3.12.1 ; \
-DEMBREE_DIR=/embree ; \
make -j"$compile_cores" ; \
make -j"$compile_cores" install ; \
fi
Expand All @@ -159,16 +159,16 @@ RUN if [ "$include_neutronics" = "true" ] ; \
RUN if [ "$include_neutronics" = "true" ] ; \
then mkdir DAGMC ; \
cd DAGMC ; \
git clone -b develop https://github.com/svalinn/dagmc ; \
git clone --single-branch --branch develop https://github.com/svalinn/DAGMC.git ; \
mkdir build ; \
cd build ; \
cmake ../dagmc -DBUILD_TALLY=ON \
cmake ../DAGMC -DBUILD_TALLY=ON \
-DMOAB_DIR=/MOAB \
-DBUILD_STATIC_EXE=OFF \
-DBUILD_STATIC_LIBS=OFF \
-DCMAKE_INSTALL_PREFIX=/dagmc/ ; \
-DCMAKE_INSTALL_PREFIX=/DAGMC/ ; \
make -j"$compile_cores" install ; \
rm -rf /DAGMC/dagmc /DAGMC/build ; \
rm -rf /DAGMC/DAGMC /DAGMC/build ; \
fi

# Clone and install OpenMC with DAGMC
Expand Down
31 changes: 31 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,37 @@ have helped the development in the
The code has been professionally reviewed by [PullRequest.com](https://www.pullrequest.com/) who
produced a [report](https://github.com/ukaea/paramak/files/5704872/PULLREQUEST.Paramak.Project.Review.pdf) and inline [suggestions](https://github.com/ukaea/paramak/pull/639).

## Citing

If you use the Paramak in your research, please consider giving proper
attribution by citing the our [Publication](https://f1000research.com/articles/10-27/v1):

- J. Shimwell, J. Billingsley and R. Delaporte-Mathurin et al. The Paramak:
Automated Parametric Geometry Construction for Fusion Reactor Designs.
F1000Research, vol. 10, Jan. 2021, p. 27. DOI.org (Crossref),
doi:10.12688/f1000research.28224.1.

<details>
<summary>BibTex</summary>
<pre><code class="language-html">
@article{paramak,
title = {The {Paramak}: automated parametric geometry construction for fusion reactor designs.},
volume = {10},
issn = {2046-1402},
shorttitle = {The {Paramak}},
url = {https://f1000research.com/articles/10-27/v1},
doi = {10.12688/f1000research.28224.1},
language = {en},
urldate = {2021-01-22},
journal = {F1000Research},
author = {Shimwell, Jonathan and Billingsley, John and Delaporte-Mathurin, Rémi and Morbey, Declan and Bluteau, Matthew and Shriwise, Patrick and Davis, Andrew},
month = jan,
year = {2021},
pages = {27},
}
</code></pre>
</details>


## System Installation

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ def make_model_and_simulate():
source=source,
materials={'center_column_shield_mat': 'eurofer'},
cell_tallies=['heating', 'TBR'],
mesh_tally_2D=['heating'],
mesh_tally_3D=['heating'],
mesh_tally_2d=['heating'],
mesh_tally_3d=['heating'],
simulation_batches=10, # should be increased for more accurate result
simulation_particles_per_batch=10 # settings are low to reduce time required
)
Expand Down
58 changes: 32 additions & 26 deletions paramak/parametric_neutronics/neutronics_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,10 @@ class NeutronicsModel():
neutronics-material-maker.MultiMaterial. All components within the
geometry object must be accounted for. Material tags required
for a Reactor or Shape can be obtained with .material_tags.
mesh_tally_2D (list of strings): the mesh based tallies to calculate,
options include tritium_production, heating and flux
mesh_tally_2d (list of str): the 2D mesh based tallies to calculate,
options include tritium_production, heating and flux.
mesh_tally_3d (list of str): the 3D mesh based tallies to calculate,
options include tritium_production, heating and flux.
fusion_power (float): the power in watts emitted by the fusion
reaction recalling that each DT fusion reaction emitts 17.6 MeV or
2.819831e-12 Joules
Expand All @@ -69,10 +71,14 @@ class NeutronicsModel():
Defaults to 1e-4.
faceting_tolerance (float): the tolerance to use when faceting surfaces.
Defaults to 1e-1.
mesh_2D_resolution (tuple of ints): The mesh resolution in the height
mesh_2D_resolution (tuple of ints): The 3D mesh resolution in the height
and width directions. The larger the resolution the finer the mesh
and more computational intensity is required to converge each mesh
element.
mesh_3D_resolution (tuple of int): The 3D mesh resolution in the height,
width and depth directions. The larger the resolution the finer the
mesh and the more computational intensity is required to converge each
mesh element.
"""

def __init__(
Expand All @@ -81,8 +87,8 @@ def __init__(
source,
materials,
cell_tallies=None,
mesh_tally_2D=None,
mesh_tally_3D=None,
mesh_tally_2d=None,
mesh_tally_3d=None,
simulation_batches: int = 100,
simulation_particles_per_batch: int = 10000,
max_lost_particles: int = 10,
Expand All @@ -97,8 +103,8 @@ def __init__(
self.geometry = geometry
self.source = source
self.cell_tallies = cell_tallies
self.mesh_tally_2D = mesh_tally_2D
self.mesh_tally_3D = mesh_tally_3D
self.mesh_tally_2d = mesh_tally_2d
self.mesh_tally_3d = mesh_tally_3d
self.simulation_batches = simulation_batches
self.simulation_particles_per_batch = simulation_particles_per_batch
self.max_lost_particles = max_lost_particles
Expand Down Expand Up @@ -167,48 +173,48 @@ def cell_tallies(self, value):
self._cell_tallies = value

@property
def mesh_tally_2D(self):
return self._mesh_tally_2D
def mesh_tally_2d(self):
return self._mesh_tally_2d

@mesh_tally_2D.setter
def mesh_tally_2D(self, value):
@mesh_tally_2d.setter
def mesh_tally_2d(self, value):
if value is not None:
if not isinstance(value, list):
raise TypeError(
"NeutronicsModelFromReactor.mesh_tally_2D should be a\
"NeutronicsModelFromReactor.mesh_tally_2d should be a\
list")
output_options = ['tritium_production', 'heating', 'flux',
'fast flux', 'dose']
for entry in value:
if entry not in output_options:
raise ValueError(
"NeutronicsModelFromReactor.mesh_tally_2D argument",
"NeutronicsModelFromReactor.mesh_tally_2d argument",
entry,
"not allowed, the following options are supported",
output_options)
self._mesh_tally_2D = value
self._mesh_tally_2d = value

@property
def mesh_tally_3D(self):
return self._mesh_tally_3D
def mesh_tally_3d(self):
return self._mesh_tally_3d

@mesh_tally_3D.setter
def mesh_tally_3D(self, value):
@mesh_tally_3d.setter
def mesh_tally_3d(self, value):
if value is not None:
if not isinstance(value, list):
raise TypeError(
"NeutronicsModelFromReactor.mesh_tally_3D should be a\
"NeutronicsModelFromReactor.mesh_tally_3d should be a\
list")
output_options = ['tritium_production', 'heating', 'flux',
'fast flux', 'dose']
for entry in value:
if entry not in output_options:
raise ValueError(
"NeutronicsModelFromReactor.mesh_tally_3D argument",
"NeutronicsModelFromReactor.mesh_tally_3d argument",
entry,
"not allowed, the following options are supported",
output_options)
self._mesh_tally_3D = value
self._mesh_tally_3d = value

@property
def materials(self):
Expand Down Expand Up @@ -390,7 +396,7 @@ def _make_watertight(self):

def create_neutronics_model(self, method: str = None):
"""Uses OpenMC python API to make a neutronics model, including tallies
(cell_tallies and mesh_tally_2D), simulation settings (batches,
(cell_tallies and mesh_tally_2d), simulation settings (batches,
particles per batch).
Arguments:
Expand Down Expand Up @@ -422,7 +428,7 @@ def create_neutronics_model(self, method: str = None):
# details about what neutrons interactions to keep track of (tally)
self.tallies = openmc.Tallies()

if self.mesh_tally_3D is not None:
if self.mesh_tally_3d is not None:
mesh_xyz = openmc.RegularMesh(mesh_id=1, name='3d_mesh')
mesh_xyz.dimension = self.mesh_3D_resolution
mesh_xyz.lower_left = [
Expand All @@ -437,7 +443,7 @@ def create_neutronics_model(self, method: str = None):
self.geometry.largest_dimension
]

for standard_tally in self.mesh_tally_3D:
for standard_tally in self.mesh_tally_3d:
if standard_tally == 'tritium_production':
score = '(n,Xt)' # where X is a wild card
prefix = 'tritium_production'
Expand All @@ -451,7 +457,7 @@ def create_neutronics_model(self, method: str = None):
tally.scores = [score]
self.tallies.append(tally)

if self.mesh_tally_2D is not None:
if self.mesh_tally_2d is not None:

# Create mesh which will be used for tally
mesh_xz = openmc.RegularMesh(mesh_id=2, name='2d_mesh_xz')
Expand Down Expand Up @@ -512,7 +518,7 @@ def create_neutronics_model(self, method: str = None):
self.geometry.largest_dimension
]

for standard_tally in self.mesh_tally_2D:
for standard_tally in self.mesh_tally_2d:
if standard_tally == 'tritium_production':
score = '(n,Xt)' # where X is a wild card
prefix = 'tritium_production'
Expand Down
4 changes: 2 additions & 2 deletions paramak/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,8 @@ def find_center_point_of_circle(point_a: Tuple[float, float],
point_b (float, float): point 2 coordinates
point3 (float, float): point 3 coordinates
Returns:
float, float: center of the circle coordinates or
None if 3 points on a line are input.
(float, float), float: center of the circle coordinates or
None if 3 points on a line are input and the radius
"""

temp = point_b[0] * point_b[0] + point_b[1] * point_b[1]
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setuptools.setup(
name="paramak",
version="0.2.1",
version="0.2.2",
author="The Paramak Development Team",
author_email="[email protected]",
description="Create 3D fusion reactor CAD models based on input parameters",
Expand Down
Loading

0 comments on commit 8188fb5

Please sign in to comment.