mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-28 14:15:42 -04:00
Merge pull request #2228 from paulromano/sourcefile-fix
Fix reading source file with time attribute
This commit is contained in:
commit
9a86c9c065
3 changed files with 23 additions and 0 deletions
|
|
@ -527,6 +527,7 @@ hid_t h5banktype()
|
|||
H5Tinsert(banktype, "r", HOFFSET(SourceSite, r), postype);
|
||||
H5Tinsert(banktype, "u", HOFFSET(SourceSite, u), postype);
|
||||
H5Tinsert(banktype, "E", HOFFSET(SourceSite, E), H5T_NATIVE_DOUBLE);
|
||||
H5Tinsert(banktype, "time", HOFFSET(SourceSite, time), H5T_NATIVE_DOUBLE);
|
||||
H5Tinsert(banktype, "wgt", HOFFSET(SourceSite, wgt), H5T_NATIVE_DOUBLE);
|
||||
H5Tinsert(banktype, "delayed_group", HOFFSET(SourceSite, delayed_group),
|
||||
H5T_NATIVE_INT);
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -75,3 +75,25 @@ def test_wrong_source_attributes(run_in_tmpdir):
|
|||
with pytest.raises(RuntimeError) as excinfo:
|
||||
openmc.run()
|
||||
assert 'platypus, axolotl, narwhal' in str(excinfo.value)
|
||||
|
||||
|
||||
def test_source_file_transport(run_in_tmpdir):
|
||||
# Create a source file with a single particle
|
||||
particle = openmc.SourceParticle()
|
||||
openmc.write_source_file([particle], 'source.h5')
|
||||
|
||||
# Created simple model to use source file
|
||||
model = openmc.Model()
|
||||
al = openmc.Material()
|
||||
al.add_element('Al', 1.0)
|
||||
al.set_density('g/cm3', 2.7)
|
||||
sph = openmc.Sphere(r=10.0, boundary_type='vacuum')
|
||||
cell = openmc.Cell(fill=al, region=-sph)
|
||||
model.geometry = openmc.Geometry([cell])
|
||||
model.settings.source = openmc.Source(filename='source.h5')
|
||||
model.settings.particles = 10
|
||||
model.settings.batches = 3
|
||||
model.settings.run_mode = 'fixed source'
|
||||
|
||||
# Try running OpenMC
|
||||
model.run()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue