-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add mean atomic mass and number #439
base: main
Are you sure you want to change the base?
Conversation
Since this is built off of your other MR, I haven't reviewed everything, but I'm immediately struck by the need to modify all of the constructors to take a I also think the other issue is that it's not obvious to me right now how an ionization model (or different ionization models) would fit into this. I immediately think of a policy-based design where the ionization model is injected into the EOS, which also makes me think that a modifier that takes an ionization policy (e.g. constant ionization state) is more extensible. I think we maybe also talk in more detail about your roadmap for 3T physics so I can understand more about the grand vision here. |
Yeah sorry about that... This one is definitely still WIP.
I considered adding a
This piece is not about the ionization model---it's sort of a prerequisite. We need to know mean atomic mass and number for things like building a Zplit modifier that partially ionizes an EOS.
Sure let's talk about it at some point. I created an issue #440 describing a roadmap. But we should also discuss. |
I'm not sure I agree since both That said, you could consider a modifier type of approach for entropy, but another difference is that entropy is tightly connected to the EOS itself; an incomplete EOS doesn't really have a concept of entropy whereas a complete EOS does. I see 3T looking more like an energy shift which makes me think a modifier is more appropriate.
I get that, but I'm trying to think about the eventual dynamic case where we want to change their values (e.g. via an ionization model). I'm struggling to see what that would look like. With a modifier approach, I feel like it would be easy to inject the ionization model into the modifier class via the constructor. That could take a state and return an ionization that could be used in calculating the pressure (I'm not sure if this would have to be iterative at this point...). There's also the possibility that the host code could be dynamically changing at least Anyway, it's not clear to me how this sort of interaction would take place. |
Agreed. I added support for this. The base class implements For both of these models, calling the temperature independent function raises an error. You must call the dependent one.
Yeah for truly 3T stuff, I agree. But IMO the mean atomic mass and number are (for non-reactive EOS's) pretty intrinsically tied to the EOS since they are fundamental properties of the chemical structure of the material. For reactive EOS's, that's less clear. But that's why I try to support the density/temperature-dependent model too.
Ah, I think I see the confusion. Abar and Zbar are overloaded terms. The Abar and Zbar here don't change under ionization. These are the fundamental properties of the material. This is not the Z in the Zsplit. That is the ionization state. This is the average number of protons in the nucleus. We sometimes need these properties for computing the ionization state. For example, the Thomas-Fermi model takes the mean atomic mass and number as inputs.
👍 Yeah I agree that for ionization state we want to handle this with a modifier. Likely, as you say, by passing the ionization state in through the lambda. |
That said I could be convinced to remove the temperature-independent values for the mean atomic properties, since in full generality the temperature dependent ones are the right ones. But it seems like a useful convenience feature. IMO it's best to just warn users to use the dependent versions when they expect chemical properties to change via, e.g., burning. |
This isn't completely ready but I'm removing the WIP marking. I will also update the above description with some comments about the overall design and intent. |
Updated MR summaryThis MR adds mean atomic mass and number to the singularity-eos API, as required for 3T physics. To be clear these are not the ionization state. Rather they are fundamental properties of the atomic nuclei that make up a material. They are not integers, as they are the average over the molecular configuration. This also means they may change under chemical or nuclear burning, either by changing the nuclei themselves or by changing the chemical composition such that the average nucleus changes. This is required for 3T because ionization models that compute an ionization state, and pieces of approximate models such as z splitting require them. However, the ionization state is a separate quantity that will be treated elsewhere, possibly in a later MR. Tabulated EOS's will likely retrieve mean atomic mass and number from the underlying table. Sesame tables, for example, report it in table metadata. For most EOS's these are static quantities, but for some EOS's, like the stellar collapse tables which assume nuclear statistical equilibrium, they depend on density and temperature. To support these constraints, I define four new API functions: Real MeanAtomicMass() const;
Real MeanAtomicNumber() const;
Real MeanAtomicMassFromDensityTemperature(const Real rho, const Real T, LambdaIndexer lambda) const;
Real MeanAtomicNumberFromDensityTemperature(const Real rho, const Real T, LambdaIndexer lambda) const; (insert appropriate portability markings etc). The latter two have default implementations in the base class that call the former two. But a given EOS may overwrite. We may consider adding vector implementations for the latter two down the line. For now, I decided not to. But we may wish add them when we thread 3T through for the fortran codes, depending on which EOS's those codes want to use and whether or not we want to expose density/temperature dependence there. For the analytic EOS's, there's no intrinsic value for these quantities to take. It's another free parameter, like the Gruneisen coefficient. But it is physically and meaningfully tied to the underlying material model---it's a property of the constituent atoms. For this reason, I add mean atomic mass and number to the analytic EOS's as member fields and set them in the constructor. We don't want to require users to set the mean atomic mass and number, though, unless they need it. So we should make it an optional parameter. This could be difficult to disambiguate from other optional parameters such as reference entropy in multiple constructor overloads. So to avoid this ambiguity, and to minimize code, I define a struct struct MeanAtomicProperties which owns mean atomic mass and number. This struct is now passed in as the final optional argument of all analytic EOS constructors. (Though I don't think that should be a requirement.) I also take advantage of the existence of this struct as a member field to define default versions of I'd like feedback on this design (thanks @jhp-lanl for already providing quite a bit of it!), as I'm not 100% happy with it. That said, it adds the needed capability with a fairly minimal changeset (that albeit touches almost every file). The roadmap for 3T is here: #440 . Feel free to give feedback there too. |
Thanks for clearing up my confusion and adding more information! I'll think about this more tomorrow. |
PR Summary
This MR adds mean atomic mass and number to the singularity-eos API, as required for 3T physics. To be clear these are not the ionization state. Rather they are fundamental properties of the atomic nuclei that make up a material. They are not integers, as they are the average over the molecular configuration. This also means they may change under chemical or nuclear burning, either by changing the nuclei themselves or by changing the chemical composition such that the average nucleus changes.
This is required for 3T because ionization models that compute an ionization state, and pieces of approximate models such as z splitting require them. However, the ionization state is a separate quantity that will be treated elsewhere, possibly in a later MR.
Tabulated EOS's will likely retrieve mean atomic mass and number from the underlying table. Sesame tables, for example, report it in table metadata. For most EOS's these are static quantities, but for some EOS's, like the stellar collapse tables which assume nuclear statistical equilibrium, they depend on density and temperature.
To support these constraints, I define four new API functions:
(insert appropriate portability markings etc). The latter two have default implementations in the base class that call the former two. But a given EOS may overwrite. We may consider adding vector implementations for the latter two down the line. For now, I decided not to. But we may wish add them when we thread 3T through for the fortran codes, depending on which EOS's those codes want to use and whether or not we want to expose density/temperature dependence there.
For the analytic EOS's, there's no intrinsic value for these quantities to take. It's another free parameter, like the Gruneisen coefficient. But it is physically and meaningfully tied to the underlying material model---it's a property of the constituent atoms. For this reason, I add mean atomic mass and number to the analytic EOS's as member fields and set them in the constructor.
We don't want to require users to set the mean atomic mass and number, though, unless they need it. So we should make it an optional parameter. This could be difficult to disambiguate from other optional parameters such as reference entropy in multiple constructor overloads. So to avoid this ambiguity, and to minimize code, I define a struct
which owns mean atomic mass and number. This struct is now passed in as the final optional argument of all analytic EOS constructors. (Though I don't think that should be a requirement.) I also take advantage of the existence of this struct as a member field to define default versions of
MeanAtomicMass
andMeanAtomicNumber
which can be added to a class via a macro.I'd like feedback on this design (thanks @jhp-lanl for already providing quite a bit of it!), as I'm not 100% happy with it. That said, it adds the needed capability with a fairly minimal changeset (that albeit touches almost every file).
The roadmap for 3T is here: #440 . Feel free to give feedback there too.
PR Checklist
make format
command after configuring withcmake
.If preparing for a new release, in addition please check the following:
when='@main'
dependencies are updated to the release version in the package.py