Describe the feature you'd like.
Currently, Ghastly hard-codes some unit conversions because it assumes the only converting needed is changing the meters in the Ghastly input/LAMMPS output to centimeters for OpenMC for values like the pebble radius, vessel geometry, and pebble coordinates. This method works for now, but will become tedious later, harder to fix as the code develops, and it limits units options to meters and centimeters.
The goal is to improve how Ghastly tracks the units certain parameters are stored as, and convert when and where it is needed. There will likely never be a single unit that can be used from start to finish - LAMMPS uses meters for its 'real world' SI units setting, and OpenMC only uses centimeters.
Ideally, unit conversions happen as little as possible. This can be achieved by using one set of units for all 'internal'/backend Ghastly calculations - then all outputs read into Ghastly are converted to this unit set, after which conversion only happens again when writing to an input file.
Additional context.
There are many packages to handle units in python - pint is a popular one. It will likely be easiest to use such a package. Coffee chat would be a good place to talk about the pros and cons of various implementations before you begin coding.
How can this issue be closed?
This issue can be closed with a PR that implements this feature.
Describe the feature you'd like.
Currently, Ghastly hard-codes some unit conversions because it assumes the only converting needed is changing the meters in the Ghastly input/LAMMPS output to centimeters for OpenMC for values like the pebble radius, vessel geometry, and pebble coordinates. This method works for now, but will become tedious later, harder to fix as the code develops, and it limits units options to meters and centimeters.
The goal is to improve how Ghastly tracks the units certain parameters are stored as, and convert when and where it is needed. There will likely never be a single unit that can be used from start to finish - LAMMPS uses meters for its 'real world' SI units setting, and OpenMC only uses centimeters.
Ideally, unit conversions happen as little as possible. This can be achieved by using one set of units for all 'internal'/backend Ghastly calculations - then all outputs read into Ghastly are converted to this unit set, after which conversion only happens again when writing to an input file.
Additional context.
There are many packages to handle units in python - pint is a popular one. It will likely be easiest to use such a package. Coffee chat would be a good place to talk about the pros and cons of various implementations before you begin coding.
How can this issue be closed?
This issue can be closed with a PR that implements this feature.