# \[openmc-users\] The external source file(hdf5 format) problem

**URL:** <https://openmc.discourse.group/t/openmc-users-the-external-source-file-hdf5-format-problem/388>\
**Category:** User Support\
**Created:** [January 4, 2019, 10:12pm UTC](https://openmc.discourse.group/t/openmc-users-the-external-source-file-hdf5-format-problem/388 "2019-01-04T22:12:34Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![paulromano](https://yyz2.discourse-cdn.com/free1/user_avatar/openmc.discourse.group/paulromano/32/486_2.png) [@paulromano](https://openmc.discourse.group/u/paulromano)\
**Post date:** [January 4, 2019, 10:12pm UTC](https://openmc.discourse.group/t/openmc-users-the-external-source-file-hdf5-format-problem/388/1 "2019-01-04T22:12:34Z")

</div>

When creating the source file, try making ‘filetype’ an attribute of the / group rather than a dataset. It looks like you already have a line commented out in your script that does this, but it needs a slight modification:

sourceyk\_h5.attrs[‘filetype’] = np.string\_(‘source’)

Let us know if that still doesn’t work.

Best,  
Paul

---

<div class="post-metadata">

**Author:** ![1112](https://avatars.discourse-cdn.com/v4/letter/1/ba8739/32.png) [@1112](https://openmc.discourse.group/u/1112)\
**Post date:** [January 5, 2019, 8:12am UTC](https://openmc.discourse.group/t/openmc-users-the-external-source-file-hdf5-format-problem/388/2 "2019-01-05T08:12:20Z")

</div>

Thank you very much. It works.  
best wish,  
Yin

在 2019年1月5日星期六 UTC+8上午6:12:47，Paul Romano写道：

---

<div class="post-metadata">

**Author:** ![Shimwell](https://yyz2.discourse-cdn.com/free1/user_avatar/openmc.discourse.group/shimwell/32/3876_2.png) [@Shimwell](https://openmc.discourse.group/u/Shimwell)\
**Post date:** [January 23, 2019, 8:37pm UTC](https://openmc.discourse.group/t/openmc-users-the-external-source-file-hdf5-format-problem/388/3 "2019-01-23T20:37:34Z")

</div>

Hi all

I am having a little trouble with a geometry that uses and external source file

The geometry appears to work for a basic point source and I can plot flux or absorption meshes

The geometry appears to half work for a source file when plotting flux as the flux is shown but the leakage is 1.0

The geometry does not work for a source file when plotting absorption as the but the leakage is 1.0

Can anyone see where I am going wrong here or does anyone have a simple technique for finding why the leakage is 1.0 ?

I think the only change between the examples is the file source for a basic source. The file source has similar energy and positions to the basic source

Many thanks

Jon

[example\_not\_working\_file\_source\_absor.py](https://openmc.discourse.group/uploads/short-url/t8LkosRxRqzpXaEEdlaqIOQvLhP.py) (4.16 KB)

[example\_working\_basic\_source.py](https://openmc.discourse.group/uploads/short-url/5ujxbI7HG8JVnqV5v7PYqxP9joR.py) (4.2 KB)

[example\_working\_file\_source\_with\_flux.py](https://openmc.discourse.group/uploads/short-url/7fMRvmJvY4ZxkhhjegStgYwiyz2.py) (4.21 KB)

[source\_7000\_particles.h5](https://openmc.discourse.group/uploads/short-url/jKKarACfNOsMGqBEmjcFUwnR4xn.h5) (467 KB)
