EGSnrc icon indicating copy to clipboard operation
EGSnrc copied to clipboard

Integrate ESTAR density effect corrections into EGSnrc

Open rtownson opened this issue 2 years ago • 11 comments

The ESTAR fortran code from NIST has been translated into C++ and integrated into EGSnrc, so that density effect corrections are now calculated on-the-fly during the initialization of a simulation. Materials can be defined directly in the input file, so .pegs4dat and .density (density correction files) are no longer needed.

Example:

:start media definition:
  :start water:
    elements = H, O
    number of atoms = 2, 1
    bulk density = 1.0 # g/cm^3 used for transport
    local density = 1.0 # g/cm^3 used for density corrections
    ivalue = 0.000075 # MeV, optional
    output density file = /mypath/water.density # full path to output density corrections to file, optional
  :stop water:
:stop media definition:

For mixtures of compounds:

    :start saltWater:
        mixture compounds = H2O, NaCl
        mass fractions = 0.95, 0.05
        bulk density = 1.0
    :stop saltWater:

For comparison, there's an option to output a density file when the simulation is run.

This adds the options for bulk and local densities to be specified separately. The bulk density is the density used for transport, and the local density is used for the density effect corrections (when a density file is not provided). Density correction files, if provided, will always override these inputs. If the local density is not provided, bulk density (or rho) is used for everything. The old rho input is still accepted, and if provided is used both as the bulk and local density.

Thanks to our co-op student @Sehmimul for this significant contribution!

rtownson avatar Jul 05 '22 17:07 rtownson

This will be merged in develop after 2022 release.

ftessier avatar Jul 05 '22 21:07 ftessier

Is there an option in the integrated estar code to compute density corrections for a density that is different from the bulk density, e.g., for the grain density in graphite? Perhaps we can have inputs for bulk density (which is simply passed through, and local density which is used for the density correction calculation?

ftessier avatar Jul 06 '22 11:07 ftessier

Is there an option in the integrated estar code to compute density corrections for a density that is different from the bulk density, e.g., for the grain density in graphite? Perhaps we can have inputs for bulk density (which is simply passed through, and local density which is used for the density correction calculation?

I like your suggestion, yes we could add those options. Currently density is just used for both, so you can't have a different bulk density.

rtownson avatar Jul 06 '22 13:07 rtownson

I'm also planning to change the I-value to be specified in MeV, like all other energy parameters..

rtownson avatar Jul 06 '22 17:07 rtownson

@rtownson What is the status of this draft? Should I start working on this branch towards merging, or should I hold off?

ftessier avatar Aug 08 '23 19:08 ftessier

I think hold off, I'm planning to add a few more features.

rtownson avatar Aug 08 '23 19:08 rtownson

Sounds good. I will start reviewing and "cleaning" it on the side, please add stuff on top of the existing estar-cpp-integration f21697d, so that I can integrate your new commits cleanly at the end. Don't forget to update to f21697d, I synced it with develop last week.

ftessier avatar Aug 08 '23 20:08 ftessier

Note that I started cleaning up this branch on the side on branch cleanup-estar-cpp-integration. CLeanup strategy is to keep a null diff between the two branches:

https://github.com/nrc-cnrc/EGSnrc/compare/estar-cpp-integration..cleanup-estar-cpp-integration

ftessier avatar Aug 09 '23 14:08 ftessier