## Photon heating tally

*Created by: liangjg*

Following #1191 which implemented neutron heating tally, this PR attempts to implement the photon heating tally so to enable calculating the neutron-photon coupled energy deposition in the reactor, using heating cross sections.

### Heating tally

Since we have a tally filter for particle type, it would be good to use the existing score-type 'heating' for both neutron and photon heating. However, unlike neutron heating can be simply implemented as the tally of mt 301 reaction (this is not exactly true when it comes to analog estimator), photon heating needs to be treated separately. So a new `SCORE_HEATING`

case is added. It checks the current particle type and calculates neutron or photon heating scores respectively.

```
case SCORE_HEATING:
if (p->type_ == Particle::Type::neutron) {
...
} else if (p->type_ == Particle::Type::photon) {
...
}
```

The heating cross sections are special as they are total cross sections multiplied by energy release. For analog estimator tally cases, all reaction events should contribute to a heating rate bin like the total rate, so I use the macro heating xs and divide the weight by total xs in the scoring. The neutron heating step is separated from the default MT case as well because the analog treatment is different.

```
if (tally.estimator_ == ESTIMATOR_ANALOG) {
// Calculate material heating cross section
double macro_heating = 0.;
const Material& material {*model::materials[p->material_]};
...
// All events score to an heating rate bin
if (settings::survival_biasing) {
// We need to account for the fact that some weight was already
// absorbed
score = p->wgt_last_ + p->wgt_absorb_;
} else {
score = p->wgt_last_;
}
score *= macro_heating * flux / simulation::material_xs.total;
}
```

A question here is, for normal reaction tallies, currently we always try to calculate the MT xs from neutron cross section data, even when the photon particle type filter is turned on. For example, OpenMC can give the tally results like "Particle: photon, (n, gamma) reaction rate". I'm not sure if it is needed to do a particle type check before each of the tally scoring so to make sure the abnormal tally results are zero or just leave it and let user interpret the results by themselves. But if we want to add other photon reaction tallies in the future, this will be an issue.

### Photon library

Photon heating cross section is included in the photon library as well as the data structure. Some changes were made on the photon-related Python API to better treat photon data:

- added reading incident photon data from hdf5
- implemented from_hdf5() and to_had5() functions for the subclasses PhotonReaction and AtomicRelaxation

### Photon heating cross section

ACE library contains the photon heating cross section and it can be produced by NJOY's GAMINR module. However, our current photon library is directly generated from ENDF, which does not have heating cross sections. So to get the photon heating number, we need to either generate photon library from ACE (using NJOY, this is what we do for neutron data) or implement our own way to produce the heating number from ENDF.

- For the first approach, I tried to generate photon library from MCNP (mcplib84), but it turns out the library is not usable for openmc, it seems some data is missing for openmc photon calculation. Maybe the remaining data is stored in other files to be extracted?
- I think the second approach is worth a try, with the methodology introduced in GAMINR. I can try it later.

Currently, to test the photon heating tally capability, I used a mixed approach: generating the photon library from ENDF and borrowing the heating data from ACE. The preliminary results (see below) agree well with MCNP.

### Preliminary reseults

- model: vera-2b (3.1% pwr assembly lattice )
- calculation: neutron-photon coupled eigenvalue with a , compared with MCNP6.
- codes:
- openmc, nndc-endfb7, photon heating number exacted from mcnp
- mcnp 6, endf71x library

openmc(heating tally) | mcnp (F6) | ||
---|---|---|---|

fuel | neutron | 8.25E+07 | 8.29E+07 |

photon | 4.74E+06 | 4.86E+06 | |

coolant | neutron | 1.34E+06 | 1.34E+06 |

photon | 2.86E+05 | 2.88E+05 |

As there are issues to be solved, I'm submitting this PR as draft. But I think @openmc-dev/committers , especially @paulromano , @smharper may want to take a look and give some suggestions/comments before I move on. Thanks.

This is supposed to close #1196 (closed) .