Skip to content

Commit cb1e706

Browse files
author
Milos Atz
committed
initial source commit
1 parent de2065a commit cb1e706

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+21623
-0
lines changed

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ misc_benchmarking_crap.py
1616
timing.py
1717
tmp_plot.py
1818

19+
# No tests (for now; need to clean)
20+
tests/
21+
1922
# None of the test results
2023
tests/test_results/
2124

LICENSE

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
Copyright © 2021, UChicago Argonne, LLC
2+
3+
All Rights Reserved
4+
5+
Software Name: Ducted Assembly Steady State Heat transfer software (DASSH)
6+
7+
By: Argonne National Laboratory
8+
9+
OPEN SOURCE LICENSE
10+
11+
Redistribution and use in source and binary forms, with or without
12+
modification, are permitted provided that the following conditions
13+
are met:
14+
15+
1. Redistributions of source code must retain the above copyright
16+
notice, this list of conditions and the following disclaimer.
17+
2. Redistributions in binary form must reproduce the above copyright
18+
notice, this list of conditions and the following disclaimer in
19+
the documentation and/or other materials provided with the
20+
distribution.
21+
3. Neither the name of the copyright holder nor the names of its
22+
contributors may be used to endorse or promote products derived
23+
from this software without specific prior written permission.
24+
25+
26+
************************************************************************
27+
DISCLAIMER
28+
29+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
30+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
31+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
32+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
33+
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
34+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
35+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
36+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
37+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
38+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
39+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
40+
************************************************************************

dassh/__init__.py

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
########################################################################
2+
# Copyright 2021, UChicago Argonne, LLC
3+
#
4+
# Licensed under the BSD-3 License (the "License"); you may not use
5+
# this file except in compliance with the License. You may obtain a
6+
# copy of the License at
7+
#
8+
# https://opensource.org/licenses/BSD-3-Clause
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
13+
# implied. See the License for the specific language governing
14+
# permissions and limitations under the License.
15+
########################################################################
16+
"""
17+
date: 2020-01-08
18+
author: Milos Atz, Micheal Smith
19+
"""
20+
########################################################################
21+
import sys
22+
import numpy as np
23+
from dassh.read_input import *
24+
from dassh.pin import *
25+
from dassh.subchannel import *
26+
from dassh.logged_class import *
27+
from dassh.region import *
28+
from dassh.region_rodded import *
29+
from dassh.region_unrodded import *
30+
from dassh.assembly import *
31+
from dassh.core import *
32+
from dassh.material import *
33+
from dassh.power import *
34+
from dassh.reactor import *
35+
from dassh.utils import *
36+
from dassh.table import *
37+
from dassh.fuel_pin import *
38+
from dassh._ascii import *
39+
from dassh.plot import *
40+
41+
42+
np.set_printoptions(threshold=sys.maxsize, linewidth=500)
43+
44+
45+
__version__ = '0.4.0-dev'

dassh/__main__.py

+148
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
########################################################################
2+
# Copyright 2021, UChicago Argonne, LLC
3+
#
4+
# Licensed under the BSD-3 License (the "License"); you may not use
5+
# this file except in compliance with the License. You may obtain a
6+
# copy of the License at
7+
#
8+
# https://opensource.org/licenses/BSD-3-Clause
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
13+
# implied. See the License for the specific language governing
14+
# permissions and limitations under the License.
15+
########################################################################
16+
"""
17+
date: 2020-11-20
18+
author: matz
19+
Main DASSH calculation procedure
20+
"""
21+
########################################################################
22+
import os
23+
# import numpy as np
24+
import sys
25+
import dassh
26+
import argparse
27+
import cProfile
28+
_log_info = 20 # logging levels must be int
29+
30+
31+
def main():
32+
"""Perform temperature sweep in DASSH"""
33+
# Parse command line arguments to DASSH
34+
parser = argparse.ArgumentParser(description='Process DASSH cmd')
35+
parser.add_argument('inputfile',
36+
metavar='inputfile',
37+
help='The input file to run with DASSH')
38+
parser.add_argument('--verbose',
39+
action='store_true',
40+
help='Verbose; print summary with each axial step')
41+
parser.add_argument('--save_reactor',
42+
action='store_true',
43+
help='Save DASSH Reactor object after sweep')
44+
parser.add_argument('--profile',
45+
action='store_true',
46+
help='Profile the execution of DASSH')
47+
parser.add_argument('--no_power_calc',
48+
action='store_false',
49+
help='Skip VARPOW calculation if done previously')
50+
args = parser.parse_args()
51+
# dassh_path = os.path.dirname(os.path.abspath(__file__))
52+
53+
# Enable the profiler, if desired
54+
if args.profile:
55+
pr = cProfile.Profile()
56+
pr.enable()
57+
58+
# Initiate logger
59+
print(dassh._ascii._ascii_title)
60+
in_path = os.path.split(args.inputfile)[0]
61+
dassh_logger = dassh.logged_class.init_root_logger(in_path, 'dassh')
62+
63+
# Pre-processing: read input file and set up DASSH objects
64+
dassh_logger.log(_log_info, f'Reading input: {args.inputfile}')
65+
dassh_input = dassh.DASSH_Input(args.inputfile)
66+
reactor = dassh.Reactor(dassh_input,
67+
calc_power=args.no_power_calc,
68+
write_output=True)
69+
70+
# Perform the sweep
71+
dassh_logger.log(_log_info, 'Performing temperature sweep...')
72+
reactor.temperature_sweep(verbose=args.verbose)
73+
74+
# Post-processing: write output, save reactor if desired
75+
dassh_logger.log(_log_info, 'Temperature sweep complete')
76+
if args.save_reactor and sys.version_info >= (3, 7):
77+
reactor.save()
78+
elif dassh_input.data['Setup']['Plot']:
79+
reactor.save() # just in case figure generation fails
80+
else:
81+
pass
82+
dassh_logger.log(_log_info, 'Output written')
83+
84+
# Post-processing: generate figures, if desired
85+
if ('Plot' in dassh_input.data.keys()
86+
and len(dassh_input.data['Plot']) > 0):
87+
dassh_logger.log(_log_info, 'Generating figures')
88+
dassh.plot.plot_all(dassh_input, reactor)
89+
90+
# if dassh_input.orificing:
91+
# dassh_logger.log(_log_info, 'Entering orificing optimization')
92+
# while not converged:
93+
# predict groups and mass flow rates:
94+
# reactor.orificing() ??
95+
# dassh_logger.log(_log_info, 'Performing temperature sweep...')
96+
# reactor.temperature_sweep(verbose=args.verbose)
97+
# dassh_logger.log(_log_info, 'Temperature sweep complete')
98+
# check_convergence
99+
100+
# Finish the calculation
101+
dassh_logger.log(_log_info, 'DASSH execution complete')
102+
# Print/dump profiler results
103+
if args.profile:
104+
pr.disable()
105+
# pr.print_stats()
106+
pr.dump_stats('dassh_profile.out')
107+
108+
109+
def plot():
110+
"""Command-line interface to postprocess DASSH data to make
111+
matplotlib figures"""
112+
# Get input file from command line arguments
113+
parser = argparse.ArgumentParser(description='Process DASSH cmd')
114+
parser.add_argument('inputfile',
115+
metavar='inputfile',
116+
help='The input file to run with DASSH')
117+
args = parser.parse_args()
118+
119+
# Initiate logger
120+
print(dassh._ascii._ascii_title)
121+
in_path = os.path.split(args.inputfile)[0]
122+
dassh_logger = dassh.logged_class.init_root_logger(in_path,
123+
'dassh_plot')
124+
125+
# Check whether Reactor object exists; if so, process with
126+
# DASSHPlot_Input and get remaining info from Reactor object
127+
rpath = os.path.join(os.path.abspath(in_path), 'dassh_reactor.pkl')
128+
if os.path.exists(rpath):
129+
dassh_logger.log(_log_info, f'Loading DASSH Reactor: {rpath}')
130+
r = dassh.reactor.load(rpath)
131+
dassh_logger.log(_log_info, f'Reading input: {args.inputfile}')
132+
inp = dassh.DASSHPlot_Input(args.inputfile, r)
133+
134+
# Otherwise, build Reactor object from complete DASSH input
135+
else:
136+
dassh_logger.log(_log_info, f'Reading input: {args.inputfile}')
137+
inp = dassh.DASSH_Input(args.inputfile)
138+
dassh_logger.log(_log_info, f'Building DASSH Reactor from input')
139+
r = dassh.Reactor(inp, calc_power=False)
140+
141+
# Generate figures
142+
dassh_logger.log(_log_info, 'Generating figures')
143+
dassh.plot.plot_all(inp, r)
144+
dassh_logger.log(_log_info, 'DASSH_PLOT execution complete')
145+
146+
147+
if __name__ == '__main__':
148+
main()

dassh/_ascii.py

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
########################################################################
2+
# Copyright 2021, UChicago Argonne, LLC
3+
#
4+
# Licensed under the BSD-3 License (the "License"); you may not use
5+
# this file except in compliance with the License. You may obtain a
6+
# copy of the License at
7+
#
8+
# https://opensource.org/licenses/BSD-3-Clause
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
13+
# implied. See the License for the specific language governing
14+
# permissions and limitations under the License.
15+
########################################################################
16+
"""
17+
date: 2019-05-18
18+
author: Milos Atz, Micheal Smith
19+
ASCII art by Micheal A. Smith
20+
"""
21+
########################################################################
22+
_ascii_title = """
23+
...............................@@@@@@@@......@@@@@@......@@@@@@......@@@@@@....@@......@@...............................
24+
...............................@@@@@@@@@@...@@@@@@@@...@@@@@@@@@@..@@@@@@@@@@..@@......@@...............................
25+
...............................@@......@@..@@......@@..@@..........@@..........@@......@@...............................
26+
...............................@@......@@..@@......@@..@@..........@@..........@@......@@...............................
27+
...............................@@......@@..@@@@@@@@@@..@@@@@@@@....@@@@@@@@....@@@@@@@@@@...............................
28+
...............................@@......@@..@@@@@@@@@@....@@@@@@@@....@@@@@@@@..@@@@@@@@@@...............................
29+
...............................@@......@@..@@......@@..........@@..........@@..@@......@@...............................
30+
...............................@@......@@..@@......@@..........@@..........@@..@@......@@...............................
31+
...............................@@@@@@@@@@..@@......@@..@@@@@@@@@@..@@@@@@@@@@..@@......@@...............................
32+
...............................@@@@@@@@....@@......@@....@@@@@@......@@@@@@....@@......@@...............................
33+
"""

dassh/_se2anl/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)