Skip to content
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

Initial Release #1

Open
wants to merge 44 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 34 commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
800dfc0
Starting point based on cyclus_fusion
dean-krueger Jan 19, 2024
64fc99e
Fixed Lithium over extraction crashing code, simplified OperateReactor
dean-krueger Jan 30, 2024
7a281f1
Added some unit tests, fixed some bugs
dean-krueger Feb 11, 2024
56d94b5
added unit tests and fixed the formatting mistake of last week
dean-krueger Feb 25, 2024
eefc5fd
Added schedule buy, reworked EnterNotify() to match new cyclus
kroogs3 Mar 1, 2024
97289fd
added EnterNotify() unit tests
kroogs3 Mar 3, 2024
faad810
Formatted all code except reactor.h, tested correctly with no breaks
kroogs3 Mar 3, 2024
4065e4a
made Li7_contribution a cyclus var, set default to 0.03, delted comme…
kroogs3 Mar 14, 2024
a3dbbc5
fixed default language at begining of header
kroogs3 Mar 14, 2024
0256d9c
changed default note to describe agent
kroogs3 Mar 14, 2024
dcd1b01
Added UI Type to Fusion Power
dean-krueger Mar 14, 2024
cace768
added uitypes to variables, changed buy_frequency from double to int
kroogs3 Mar 14, 2024
534d171
added combobox to refuel_mode as suggested
kroogs3 Mar 14, 2024
530240e
deleted commented code from reactor.h
kroogs3 Mar 14, 2024
dc6a0ba
changed README from default Hello, Cyclus! Still a placeholder
kroogs3 Mar 14, 2024
a64a881
Tried to fix readme formatting for website
kroogs3 Mar 14, 2024
5e88457
Second attempt at fixing readme file formatting
kroogs3 Mar 14, 2024
30ba796
removed ascii art from readme
kroogs3 Mar 14, 2024
97c2dec
changed internal inventories to better match Abdou 2021, made appropr…
dean-krueger Apr 7, 2024
1aa8ee1
added test case for 0% and 100% Li7_contribution, cleaned up some mor…
dean-krueger Apr 8, 2024
ddb2bbc
simplified the way spent blanket material is popped for disposal
dean-krueger Apr 8, 2024
30fd9de
added blanket_turnover variable to only calculate that value once
dean-krueger Apr 8, 2024
8ed0747
new attempt at fixing README. Deleted README.md (redundant)
dean-krueger Apr 8, 2024
30910ba
removed magic numbers, made tritium breeding calc more precise, updat…
dean-krueger Apr 12, 2024
1de3a06
added tritium sequestration as per a comment Matthew made in our ffh …
dean-krueger Apr 15, 2024
c428ea2
simplified removal of surplus from storage with pop(qty)
dean-krueger Apr 21, 2024
cfa03de
added buffer for spent lithium, and record it in the inventories table
dean-krueger Apr 21, 2024
3920d35
changed GetComp to compmath::AlmostEq() with a 1e-7 threshold
dean-krueger Apr 21, 2024
d0e5f3e
remove extra parentheses in if statement
dean-krueger Apr 21, 2024
c536e38
changed the startup if/else block to be more readable
dean-krueger Apr 21, 2024
a889a86
trying to resolve changes after a pull, doing what git said to do...
dean-krueger Apr 21, 2024
994096d
last commit was just the conflicting files bit, this one should fix it
dean-krueger Apr 21, 2024
2e84bc0
changed the conditional behavior of blanket cycling
dean-krueger Apr 21, 2024
032ec4d
changed atomic masses source from wolfram to pyne
dean-krueger Apr 21, 2024
14deba4
changed number of seconds in a year to match cyclus
dean-krueger Apr 22, 2024
fe6dff0
removed unused str method, moved conditional in blanket cycle to simp…
dean-krueger Apr 27, 2024
34a83f1
changed sequestered_tritium from a resbuf to a materail
dean-krueger Apr 27, 2024
5b8e2a4
removed several instances of compmap c --> normalize and replaced wit…
dean-krueger Apr 27, 2024
beb87c2
removed GetComp() function and modified relevant unit tests
dean-krueger Apr 27, 2024
71564a0
changed DepleteBlanket from mass to atom basis, simplified greatly, f…
dean-krueger Apr 27, 2024
3f7bcc9
cleaned up comments and commented code
dean-krueger Apr 27, 2024
a887c77
changed atom to mole basis in depleteblanket, cleaned up code some more
dean-krueger Apr 28, 2024
431b3d4
fixed cyclus-dangerous method of depleting blanket
dean-krueger Apr 30, 2024
75ad3d0
removed uncaught std::cout statement
dean-krueger Apr 30, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
Language: Cpp
BasedOnStyle: Google
# only allow single line functions if they are inlined in class def'n
AllowShortFunctionsOnASingleLine: Inline
# do not force new line after template declarations
AlwaysBreakTemplateDeclarations: false
# Automatically detect whether a given fuction's arguments are one-per-line
ExperimentalAutoDetectBinPacking: true
# Use C++11 standard
Standard: Cpp11
...
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
build
cmake
docker
input
*.sh
138 changes: 138 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
# DO NOT DELETE THIS LINE:: .:tricycle:Reactor

CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
# taken from http://geant4.cern.ch/support/source/geant4/CMakeLists.txt
IF(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
message(STATUS "Stub requires an out-of-source build.")
message(STATUS "Please remove these files from ${CMAKE_BINARY_DIR} first:")
message(STATUS "CMakeCache.txt")
message(STATUS "CMakeFiles")
message(STATUS "Once these files are removed, create a separate directory")
message(STATUS "and run CMake from there")
message(FATAL_ERROR "in-source build detected")
ENDIF()

PROJECT(tricycle)

# check for and enable c++11 support
INCLUDE(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
IF(COMPILER_SUPPORTS_CXX11)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
ELSE()
MESSAGE(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++11
support. Please use a different C++ compiler.")
ENDIF()

# quiets fortify_source warnings when not compiling with optimizations
# in linux distros where compilers were compiled with fortify_source enabled by
# default (e.g. Arch linux).
MESSAGE("${CMAKE_BUILD_TYPE}")
STRING(TOLOWER "${CMAKE_BUILD_TYPE}" BUILD_TYPE)
IF(NOT ${BUILD_TYPE} STREQUAL "release")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0")
ENDIF()
# no overflow warnings because of silly coin-ness
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-overflow")

# Direct any out-of-source builds to this directory
SET(STUB_SOURCE_DIR ${CMAKE_SOURCE_DIR})

# Direct any binary installation paths to this directory
SET(STUB_BINARY_DIR ${CMAKE_BINARY_DIR})

# This makes all the libraries build as SHARED
SET(BUILD_SHARED_LIBS true)

# Setup build locations.
IF(NOT CMAKE_RUNTIME_OUTPUT_DIRECTORY)
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${STUB_BINARY_DIR}/bin)
endif()
IF(NOT CMAKE_LIBRARY_OUTPUT_DIRECTORY)
SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${STUB_BINARY_DIR}/lib)
endif()
IF(NOT CMAKE_ARCHIVE_OUTPUT_DIRECTORY)
SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${STUB_BINARY_DIR}/lib)
ENDIF()

SET(STUB_EXECUTABLE_DIR ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})

# use, i.e. don't skip the full RPATH for the build tree
SET(CMAKE_SKIP_BUILD_RPATH FALSE)

# when building, don't use the install RPATH already
# (but later on when installing)
SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)

SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")

# add the automatically determined parts of the RPATH
# which point to directories outside the build tree to the install RPATH
SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)

# the RPATH to be used when installing, but only if it's not a system directory
LIST(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/lib" isSystemDir)
IF("${isSystemDir}" STREQUAL "-1")
SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib:${CMAKE_INSTALL_PREFIX}/lib/cyclus")
GET_FILENAME_COMPONENT(cxxCompilerRoot ${CMAKE_CXX_COMPILER} DIRECTORY)
GET_FILENAME_COMPONENT(cxxCompilerRoot ${cxxCompilerRoot} DIRECTORY)
IF (NOT "${CMAKE_INSTALL_RPATH}" STREQUAL "${cxxCompilerRoot}")
SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_RPATH}:${cxxCompilerRoot}/lib:${cxxCompilerRoot}/lib/cyclus")
ENDIF (NOT "${CMAKE_INSTALL_RPATH}" STREQUAL "${cxxCompilerRoot}")
SET(CMAKE_BUILD_RPATH "${CMAKE_INSTALL_RPATH}")
ENDIF("${isSystemDir}" STREQUAL "-1")

# Tell CMake where the modules are
SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_INSTALL_PREFIX}/share/cyclus/cmake")
SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${STUB_SOURCE_DIR}/cmake)
MESSAGE("--CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}")

# Find cyclus
FIND_PACKAGE(Cyclus REQUIRED)
SET(STUB_INCLUDE_DIRS ${STUB_INCLUDE_DIRS} ${CYCLUS_CORE_INCLUDE_DIR})
SET(LIBS ${LIBS} ${CYCLUS_CORE_LIBRARIES})

# Include macros
INCLUDE(UseCyclus)

MESSAGE("--LD_LIBRARY_PATH: $ENV{LD_LIBRARY_PATH}")

# Include the boost header files, system, and filesystem libraries
SET(Boost_USE_STATIC_LIBS OFF)
SET(Boost_USE_STATIC_RUNTIME OFF)
FIND_PACKAGE(Boost COMPONENTS filesystem system REQUIRED)
SET(STUB_INCLUDE_DIRS ${STUB_INCLUDE_DIRS} ${Boost_INCLUDE_DIR})
SET(LIBS ${LIBS} ${Boost_FILESYSTEM_LIBRARY})
SET(LIBS ${LIBS} ${Boost_SYSTEM_LIBRARY})

# Find HDF5
FIND_PACKAGE(HDF5 REQUIRED)
ADD_DEFINITIONS(${HDF5_DEFINITIONS})
SET(STUB_INCLUDE_DIRS ${STUB_INCLUDE_DIRS} ${HDF5_INCLUDE_DIR})
set(LIBS ${LIBS} ${HDF5_LIBRARIES})
MESSAGE("-- HDF5 Root: ${HDF5_ROOT}")
MESSAGE("-- HDF5 Include directory: ${HDF5_INCLUDE_DIR}")
MESSAGE("-- HDF5 Library directories: ${HDF5_LIBRARY_DIRS}")
MESSAGE("-- HDF5 Libraries: ${HDF5_LIBRARIES}")

# find Coin
FIND_PACKAGE(COIN REQUIRED)
SET(STUB_INCLUDE_DIRS ${STUB_INCLUDE_DIRS} ${COIN_INCLUDE_DIR})
set(LIBS ${LIBS} ${COIN_LIBRARIES})


# include all the directories we just found
INCLUDE_DIRECTORIES(${STUB_INCLUDE_DIRS})


# add the agents
ADD_SUBDIRECTORY(src)

# uninstall target
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
IMMEDIATE @ONLY)

add_custom_target(uninstall
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
1 change: 0 additions & 1 deletion README.md

This file was deleted.

42 changes: 42 additions & 0 deletions README.rst
dean-krueger marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
.. code-block:: bash

....................................................................................................
....................................................................................................
...........................-@-............%@........................................................
..........................@.@@@-+%.#+=*#%%%%@@@@*...................................................
...........................@@@..-*==%...............................................................
..................................=*................................................................
.................................@=#.........................#%.....................................
................................%=*@@@%#=..................#@@%.....................................
................................*=%=======.+%.......@%%%%%@%%@@.....................................
...............................@=%===========:%..........%@%@@......................................
..............................@@++@============-#.........%%........................................
.......................-%@@%#@@@%-..+@@:[email protected]%@@@%@@@@+......................
.........................@@@%%@=+@+..+=%................:=%%....*@@@%*********#@....................
......................:@%@@@%%--%*:@..%=%...............*@.-*#.@@@#*************#@..................
....................@@@@+..:@#=@%***@+.%=%.............#=...@%%@@****@@@@@@@@@%**=@.................
...................@%*..@%##@-%@@@***@..@=%............+@..%%@@@***%%@..:%%:..@@#*%%................
..................@%..@====@=#%..@@**=@..%=================@%%%%**@@@.======+@.#@#*@................
.................@%%.%===@@@%@*%-@@#*+@...%===============@@@@@#**@@.:===%*==*#.@@@@................
.............-...@%*.@===@@@#-=%.@@@#%=...........%%%%%@@@@@@@@#@@@%..===@===*%.@@....+.............
..............=..%%@.#+=======%:.@@..=.......................@@@@@%@#.:======%.:@@...#..............
..........-:#....:%@@..@*===%@..@%-...........................@@@@@@%-%:.:=.::=@@[email protected]..#..........
.............-+@:%*%@@@......:@@@...............................@@@%@@@@....@@%@#%:+@:##............
.............%@%%@@%##@@%@@@%@%.....................................#@@@@@@@@@%@#*@%*@@..:..........
...........:@#********************#%%*=:................=##****************************##:..........
.......#************************************************************************************-.......
..*----------------------------------------------------------------------------------------------*..
..|| @@@@@@@@@@+ @@@@@@@@@@. @@@ @@@@@@@@@ .@@@ :@@@ .@@@@@@@@@ .@@: .@@@@@@@@@@ ||..
..|| .@@+ @@# @@@ @@@ @@@ @@@ @@@ *@@= .@@% .@@@ .@@: .@@. ||..
..|| .@@+ @@# -@@@ @@@ %@@ @@@%@@. @@@ .@@: .@@+======. ||..
..|| .@@+ @@@@@@@@@ @@@ @@@ #@@@. @@@ .@@: .@@@@@@@@@. ||..
..|| .@@+ @@# .@@@ @@@ -@@: @@. @@@ @@@ @# .@@: .@@. ||..
..|| .@@+ @@# @@@. @@@ @@@@ .@@@* @@@ @@@: .@@@. .@@: .@@. ||..
..|| .@@+ @@# @@@+ @@@ @@@@@@@ @@@ :@@@@@@% .@@@@@@@@@..@@@@@@@@@@ ||..
..*----------------------------------------------------------------------------------------------*..
....................................................................................................


Tricycle is a collection of CYCLUS archetypes designed to model the fusion fuel cycle. It is
currently under development at the University of Wisconsin-Madison, and in its alpha stage.
Epect more information to come as development continues!
137 changes: 137 additions & 0 deletions install.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
#! /usr/bin/env python
import os
import sys
import subprocess
import shutil

try:
import argparse as ap
except ImportError:
import pyne._argparse as ap

absexpanduser = lambda x: os.path.abspath(os.path.expanduser(x))


def check_windows_cmake(cmake_cmd):
if os.name == 'nt':
files_on_path = set()
for p in os.environ['PATH'].split(';')[::-1]:
if os.path.exists(p):
files_on_path.update(os.listdir(p))
if 'cl.exe' in files_on_path:
pass
elif 'sh.exe' in files_on_path:
cmake_cmd += ['-G "MSYS Makefiles"']
elif 'gcc.exe' in files_on_path:
cmake_cmd += ['-G "MinGW Makefiles"']
cmake_cmd = ' '.join(cmake_cmd)


def install(args):
if not os.path.exists(args.build_dir):
os.mkdir(args.build_dir)
elif args.clean_build:
shutil.rmtree(args.build_dir)
os.mkdir(args.build_dir)

root_dir = os.path.split(__file__)[0]
makefile = os.path.join(args.build_dir, 'Makefile')

if not os.path.exists(makefile):
rtn = subprocess.call(['which', 'cmake'], shell=(os.name == 'nt'))
if rtn != 0:
sys.exit("CMake could not be found, "
"please install CMake before developing Cyclus.")
cmake_cmd = ['cmake', os.path.abspath(root_dir)]
if args.prefix:
cmake_cmd += ['-DCMAKE_INSTALL_PREFIX=' +
absexpanduser(args.prefix)]
if args.cmake_prefix_path:
cmake_cmd += ['-DCMAKE_PREFIX_PATH=' +
absexpanduser(args.cmake_prefix_path)]
if args.coin_root:
cmake_cmd += ['-DCOIN_ROOT_DIR=' + absexpanduser(args.coin_root)]
if args.cyclus_root:
cmake_cmd += ['-DCYCLUS_ROOT_DIR='+absexpanduser(args.cyclus_root)]
if args.boost_root:
cmake_cmd += ['-DBOOST_ROOT=' + absexpanduser(args.boost_root)]
if args.build_type:
cmake_cmd += ['-DCMAKE_BUILD_TYPE=' + args.build_type]
check_windows_cmake(cmake_cmd)
rtn = subprocess.check_call(cmake_cmd, cwd=args.build_dir,
shell=(os.name == 'nt'))

make_cmd = ['make']
if args.threads:
make_cmd += ['-j' + str(args.threads)]
rtn = subprocess.check_call(make_cmd, cwd=args.build_dir,
shell=(os.name == 'nt'))

if args.test:
make_cmd += ['test']
elif not args.build_only:
make_cmd += ['install']

rtn = subprocess.check_call(make_cmd, cwd=args.build_dir,
shell=(os.name == 'nt'))

def uninstall(args):
makefile = os.path.join(args.build_dir, 'Makefile')
if not os.path.exists(args.build_dir) or not os.path.exists(makefile):
sys.exist("May not uninstall Cyclus since it has not yet been built.")
rtn = subprocess.check_call(['make', 'uninstall'], cwd=args.build_dir,
shell=(os.name == 'nt'))


def main():
localdir = absexpanduser('~/.local')

description = "An installation helper script. " +\
"For more information, please see fuelcycle.org."
parser = ap.ArgumentParser(description=description)

build_dir = 'where to place the build directory'
parser.add_argument('--build_dir', help=build_dir, default='build')

uninst = 'uninstall'
parser.add_argument('--uninstall', action='store_true', help=uninst, default=False)

clean = 'attempt to remove the build directory before building'
parser.add_argument('--clean-build', action='store_true', help=clean)

threads = "the number of threads to use in the make step"
parser.add_argument('-j', '--threads', type=int, help=threads)

prefix = "the relative path to the installation directory"
parser.add_argument('--prefix', help=prefix, default=localdir)

build_only = 'only build the package, do not install'
parser.add_argument('--build-only', action='store_true', help=build_only)

test = 'run tests after building'
parser.add_argument('--test', action='store_true', help=test)

coin = "the relative path to the Coin-OR libraries directory"
parser.add_argument('--coin_root', help=coin)

cyclus = "the relative path to Cyclus installation directory"
parser.add_argument('--cyclus_root',help=cyclus, default=localdir)

boost = "the relative path to the Boost libraries directory"
parser.add_argument('--boost_root', help=boost)

cmake_prefix_path = "the cmake prefix path for use with FIND_PACKAGE, " + \
"FIND_PATH, FIND_PROGRAM, or FIND_LIBRARY macros"
parser.add_argument('--cmake_prefix_path', help=cmake_prefix_path)

build_type = "the CMAKE_BUILD_TYPE"
parser.add_argument('--build_type', help=build_type)

args = parser.parse_args()
if args.uninstall:
uninstall(args)
else:
install(args)

if __name__ == "__main__":
main()
7 changes: 7 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
### DO NOT DELETE THIS COMMENT: INSERT_ARCHETYPES_HERE ###
USE_CYCLUS("tricycle" "reactor")

INSTALL_CYCLUS_MODULE("tricycle" "")

# install header files
FILE(GLOB h_files "${CMAKE_CURRENT_SOURCE_DIR}/*.h")
Loading