Repository navigation
Fix XeHe molar fraction material construction - #276
Conversation
G4Material::AddElement interprets the numeric fraction argument as a mass fraction. GXeHe was using the requested Xe percentage directly, which made 85/15 Xe/He become 85/15 by mass rather than by molar fraction. Compute the enriched-xenon molar mass, form the Xe/He mixture molar mass from the requested molar fractions, and derive the mass fractions passed to Geant4 from those molar fractions. Use the same mixture molar mass for the gas density calculation so the material density and composition are internally consistent.
afd46b9 to
7ebad88
Compare
kvjmistry
left a comment
There was a problem hiding this comment.
I have reviewed this PR and it looks good. I have a few extra requests before merging:
- Please could you also fix the GXeAr function which suffers from this same issue.
- Please add a comment to the function that this is currently configured for enriched Xe + helium. In the future, we may want to add depleted Xe + He as an option. Or if you can think of a better way to include the Xe Enrichment that would be better.
Treat the XePercentage argument in GXeAr as a molar percentage, convert the resulting Xe/Ar molar fractions to mass fractions before adding elements to the G4Material, and compute the gas density from the mixture molar mass. Document that the current GXeHe material uses enriched xenon, leaving future depleted-Xe support as an explicit extension point.
7ebad88 to
e2d76fb
Compare
|
The GXeAr function is now updated, and there are comments in the .cc and .h stating that the Xe/He mixture is enriched Xe + He. We could continue by adding depleted Xe + He (or adding some way to select between natural, depleted, and enriched), or we can do that in a new PR |
If you have the time to add the option between switching between natural/depleted/enriched then that would be great. I think that would be useful for the tonne scale simulations in the future. |
Allow GXeHe to use natural, enriched, or depleted xenon isotope compositions, defaulting to natural xenon when no option is specified. Expose the XeHeXenonType messenger property in the geometries that construct XeHe mixtures, and give each XeHe material variant a distinct Geant4 material name. Example NextTonScale macro configuration: /Geometry/NextTonScale/gas XeHe /Geometry/NextTonScale/gas_pressure 13. bar /Geometry/NextTonScale/gas_temperature 300. kelvin /Geometry/NextTonScale/XePercentage 85. /Geometry/NextTonScale/helium_A 4 /Geometry/NextTonScale/XeHeXenonType enrichedXe
|
The last commit adds functionality to set the XeHeXenonType in the macro for The options are: |
| // Visibility | ||
| visibility_(0), | ||
| gas_("enrichedXe"), | ||
| xe_he_xe_type_("naturalXe"), |
There was a problem hiding this comment.
I think here i would prefer the var name xe_he_type_ which is a little easier to read.
There was a problem hiding this comment.
add a comment in the header for var definition that this refers to the xenon type mixed with the helium
| G4GenericMessenger::Command& xe_he_xe_type_cmd = | ||
| msg_->DeclareProperty("XeHeXenonType", xe_he_xe_type_, | ||
| "Xenon type used in XeHe mixtures."); | ||
| xe_he_xe_type_cmd.SetCandidates("naturalXe enrichedXe depletedXe"); |
There was a problem hiding this comment.
ive not see the use of SetCandidates before. Could you test this functionality by giving it a mis-spelled word and see if it works?
There was a problem hiding this comment.
The method does exist in the Geant4 source.
Running a test in a macro with a misspelling:
/Geometry/NextTonScale/XeHeXenonType enrichedXXe
gives:
parameter value (enrichedXXe) is not listed in the candidate List.
Candidates are: naturalXe enrichedXe depletedXe
-------- EEEE ------- G4Exception-START -------- EEEE -------
*** G4Exception : ExecCommand()
issued by : [BatchSession]
Illegal parameter: /Geometry/NextTonScale/XeHeXenonType enrichedXXe
*** Fatal Exception *** core dump ***
**** Track information is not available at this moment
**** Step information is not available at this moment
-------- EEEE -------- G4Exception-END --------- EEEE -------
There was a problem hiding this comment.
great, thanks for checking!
Rename the XeHe xenon-type member to xe_he_type_ for readability and document that it selects the xenon type mixed with helium. Verified that SetCandidates rejects misspelled XeHeXenonType values in a Next100 macro, aborting with the valid candidates listed.
|
Variable names changed to |
Fixes a bug in the creation of the Xe/He mixture, identified by @martinperezmaneiro
G4Material::AddElement interprets the numeric fraction argument as a mass fraction. GXeHe was using the requested Xe percentage directly, which made 85/15 Xe/He become 85/15 by mass rather than by molar fraction.
Compute the enriched-xenon molar mass, form the Xe/He mixture molar mass from the requested molar fractions, and derive the mass fractions passed to Geant4 from those molar fractions. Use the same mixture molar mass for the gas density calculation so the material density and composition are internally consistent.