Set axis range for plots

Discussion on the serpentTools python package

Moderator: drewejohnson

Post Reply
User avatar
ondrejch
Posts: 24
Joined: Sat Oct 12, 2013 3:56 am
Security question 1: No
Security question 2: 92
Contact:

Set axis range for plots

Post by ondrejch » Wed Mar 11, 2020 5:12 pm

Great work with Serpent Tools! I love it and recommend to everyone :-)

Is there an easy way to set axis range in the plot? For instance, how to set an arbitrary X and Y ranges in your example:

Code: Select all

res.plot('burnup', ['absKeff', 'colKeff'])
I tried some syntax from matplotlib, but to no avail. Thanks.
Ondrej Chvala, UT Knoxville

User avatar
ondrejch
Posts: 24
Joined: Sat Oct 12, 2013 3:56 am
Security question 1: No
Security question 2: 92
Contact:

Re: Set axis range for plots

Post by ondrejch » Wed Mar 11, 2020 6:28 pm

It seems I figured it out. Either, while plotting, one can adjust one axis only:

Code: Select all

res.plot('burnup', ['absKeff', 'colKeff']).set_xlim([min,max])
res.plot('burnup', ['absKeff', 'colKeff']).set_ylim([min,max])
Or one can get the matplotlib.axes object, fix it up, and replot:

Code: Select all

fig=res.plot('burnup', ['absKeff', 'colKeff'])
fig.set_xlim([min,max])
fig.set_ylim([min,max])
fig.get_figure()
Ondrej Chvala, UT Knoxville

User avatar
ondrejch
Posts: 24
Joined: Sat Oct 12, 2013 3:56 am
Security question 1: No
Security question 2: 92
Contact:

Material has no burnup

Post by ondrejch » Wed Mar 11, 2020 7:20 pm

For some reason when the material is selected, fuel=dep.materials['fuel0'], fuel.burnup is an array full of zeros, while fuel.days has the correct array of nonzero depletion steps.

This can be fixed by fuel.data['burnup'] = dep.metadata['burnup']
Ondrej Chvala, UT Knoxville

drewejohnson
Posts: 56
Joined: Thu Oct 20, 2016 4:25 pm
Security question 1: No
Security question 2: 84

Re: Set axis range for plots

Post by drewejohnson » Wed Mar 11, 2020 8:53 pm

Ondrej,

Thank you for those nice words! I'm glad you find this a useful tool.

Per your first question, setting the axes limits is done through matplotlib, as you expressed. I think the second way,

Code: Select all

ax = r.plot('burnup', ['absKeff', 'colKeff'])
ax.set_ylim(...)
ax.set_xlim(...)
would be the best. It avoids redundant calls to the plot method.

Per the second item, this is most suspicious. Can you provide me with the following information:
  • serpentTools version from "serpentTools.__version__"
  • serpent version
  • python version
and I will take a look. I will need some more information to try and reproduce, as I don't encounter this issue on my end (using 0.9.2).

Best regards,

Andrew

User avatar
ondrejch
Posts: 24
Joined: Sat Oct 12, 2013 3:56 am
Security question 1: No
Security question 2: 92
Contact:

Re: Set axis range for plots

Post by ondrejch » Thu Mar 12, 2020 7:29 am

Thanks Andrew for your reply.

Serpent tools:

Code: Select all

In [62]: serpentTools.__version__
Out[62]: '0.9.2'
Serpent is Version 2.1.31

Python (in spyder3)

Code: Select all

Python 3.7.5 (default, Nov 20 2019, 09:21:52)
IPython 5.8.0 -- An enhanced Interactive Python.
Ondrej Chvala, UT Knoxville

User avatar
ondrejch
Posts: 24
Joined: Sat Oct 12, 2013 3:56 am
Security question 1: No
Security question 2: 92
Contact:

Re: Set axis range for plots

Post by ondrejch » Thu Mar 12, 2020 3:30 pm

Here is the example: https://msr.ne.utk.edu/~o/test_dep.m

Code: Select all

fd=serpentTools.read("test_dep.m")
s=fd.materials['salt']
s.plot('burnup','adens',names=['U235','Pu239'])
Ondrej Chvala, UT Knoxville

drewejohnson
Posts: 56
Joined: Thu Oct 20, 2016 4:25 pm
Security question 1: No
Security question 2: 84

Re: Set axis range for plots

Post by drewejohnson » Fri Mar 13, 2020 1:08 pm

Thank you for providing the test file.
If you look at the salt's burnup with

Code: Select all

grep MAT_salt_BURNUP test_dep.m
you see an array of zeros present in the file. This is most curious.

My best guess as to why the salt has zero burnup would be that it's specific power (MW/kgHM) is zero. The fact that the salt contains fissile isotopes which should contribute to power production and heavy metal mass would go contrary to that. I wonder if it is due to some of the MSR refueling / material inventory mechanics (assuming this is indeed an MSR model)

User avatar
ondrejch
Posts: 24
Joined: Sat Oct 12, 2013 3:56 am
Security question 1: No
Security question 2: 92
Contact:

Re: Set axis range for plots

Post by ondrejch » Sat Mar 14, 2020 5:23 am

Interesting. The salt is burned, its volume is set, and the only processing is an off-gas. I will email Jaakko.
Ondrej Chvala, UT Knoxville

User avatar
Jaakko Leppänen
Site Admin
Posts: 2410
Joined: Thu Mar 18, 2010 10:43 pm
Security question 2: 0
Location: Espoo, Finland
Contact:

Re: Set axis range for plots

Post by Jaakko Leppänen » Mon Mar 16, 2020 7:36 pm

Are these materials that are not part of the geometry? Could it just be that burnup is not passed with the mass flows (I can't think how it could even be calculated). Are the material densities reasonable?
- Jaakko

User avatar
ondrejch
Posts: 24
Joined: Sat Oct 12, 2013 3:56 am
Security question 1: No
Security question 2: 92
Contact:

Re: Set axis range for plots

Post by ondrejch » Tue Mar 17, 2020 7:30 pm

Jaakko, they are a part of geometry, everything is +- reasonable. I emailed you the input file.
Ondrej Chvala, UT Knoxville

Post Reply