Hello,
I’m using RAVEN with OpenMC: an open-source Monte Carlo neutron transport code with a Python API.
I’ve written a python script (In this email I’ve renamed it OpenMC-script.py) that takes an input file with the “-i” argument (extension .i), builds the OpenMC input files and runs OpenMC, and then generates an output file with the name specified by the “-o” argument (extension .csv).
I’ve run into an issue where RAVEN is not using the specified file extension for my generic code output file
clarg.
From this sample of my RAVEN input file with the offending argument highlighted in orange (I’ve only included the relevant nodes to how RAVEN is executing my generic code):
...
<Files>
<Input name="commonInput" type="">input_file.i</Input>
</Files>
<Models>
<Code name="OpenMC_Model" subType="GenericCode">
<executable>/path/to/OpenMC-script.py</executable>
<clargs arg="'mpirun -n 1 /path/to/OpenMC-conda-env/python -m mpi4py " type="prepend"/>
<clargs arg=" -i " extension=".i" type="input"/>
<clargs arg=" -o " extension=".csv" type="output"/>
<clargs arg=" --run --mpi 24 " type="postpend"/>
</Code>
</Models>
<Steps>
<MultiRun name="sample" verbosity="all">
<Input class="Files" type="">commonInput</Input>
<Model class="Models" type="Code">OpenMC_Model</Model>
<Sampler class="Samplers" type="MonteCarlo">monteCarlo</Sampler>
<Output class="DataObjects" type="PointSet">samples</Output>
<Output class="DataObjects" type="HistorySet">histories</Output>
</MultiRun>
...
</Steps>
...
Note that I have replaced “/path/to” with the correct path, and I am calling an installation of python from another environment due to dependency incompatibility between RAVEN and the OpenMC Python API
Expected shell execution command:
$ mpirun -n 1 /path/to/OpenMC-conda-env/python -m mpi4py /path/to/OpenMC-script.py -i input_file.i -o out~input_file.csv --run --mpi 24
Actual shell execution command:
$ mpirun -n 1 /path/to/OpenMC-conda-env/python -m mpi4py /path/to/OpenMC-script.py -i input_file.i -o out~input_file --run --mpi 24
See attached RAVEN input file for full input.
Because of this, I am getting an error message:
Traceback (most recent call last):
File "/home/sprapp/.conda/envs/raven_openmc/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
self.run()
File "/home/sprapp/.conda/envs/raven_openmc/lib/python3.10/threading.py", line 953, in run
self._target(*self._args, **self._kwargs)
File "/home/sprapp/projects/raven/ravenframework/Runners/SharedMemoryRunner.py", line 115, in <lambda>
self.thread = InterruptibleThread(target = lambda q, *arg : q.append(self.functionToRun(*arg)),
File "/home/sprapp/projects/raven/ravenframework/Models/Code.py", line 671, in evaluateSample
csvData = csvLoader.loadCsvFile(outFile.getAbsFile(), nullOK=False, utility=loadUtility)
File "/home/sprapp/projects/raven/ravenframework/CsvLoader.py", line 53, in loadCsvFile
return self._loadCsvPandas(myFile, nullOK=nullOK)
File "/home/sprapp/projects/raven/ravenframework/CsvLoader.py", line 70, in _loadCsvPandas
df = pd.read_csv(myFile)
File "/home/sprapp/.conda/envs/raven_openmc/lib/python3.10/site-packages/pandas/io/parsers/readers.py", line 1026, in read_csv
return _read(filepath_or_buffer, kwds)
File "/home/sprapp/.conda/envs/raven_openmc/lib/python3.10/site-packages/pandas/io/parsers/readers.py", line 620, in _read
parser = TextFileReader(filepath_or_buffer, **kwds)
File "/home/sprapp/.conda/envs/raven_openmc/lib/python3.10/site-packages/pandas/io/parsers/readers.py", line 1620, in __init__
self._engine = self._make_engine(f, self.engine)
File "/home/sprapp/.conda/envs/raven_openmc/lib/python3.10/site-packages/pandas/io/parsers/readers.py", line 1880, in _make_engine
self.handles = get_handle(
File "/home/sprapp/.conda/envs/raven_openmc/lib/python3.10/site-packages/pandas/io/common.py", line 873, in get_handle
handle = open(
FileNotFoundError: [Errno 2] No such file or directory: '/path/to/wd/sample/10/out~common_input.csv'
I believe this is a RAVEN error, not an OpenMC error, as it is coming from the python installation used by RAVEN, not the one called in the Model.
Any suggestions? I hope this is an easy fix but could not find anything in the user guide or manual.
Thanks!
Paul Sprague (he/him/his)
Reactor Engineering Intern | MFC Reactor Engineering
paul.s...@inl.gov | 208-526-0025 | 541-200-4096
Idaho National Laboratory | PO Box 1625, MS 3605 | Idaho Falls, ID | 83415
_______________________________