Implement preliminary multigroup (MG) version of DDMC. - #29
Conversation
|
Note the added bullet points in the description checklist. |
|
The main code changes should now be ready - but a regression test is still needed - will add this shortly. (Removed the draft prefix to obtain the CI for the current changeset.) |
|
Ran |
|
Since this fixes the first capture issue, so let's get this in before #30. |
| struct cell_scat_args { | ||
| const int &b; // block index | ||
| const int &ip; // x/X1 block cell index | ||
| const int &jp; // y/X2 block cell index | ||
| const int &kp; // z/X3 block cell index | ||
| const Real &ff; // Fleck factor | ||
| const Real &aa; // absorption opacity (1/length) | ||
| const Real &ss; // scattering opacity (1/length) | ||
| // frequency data | ||
| const int &n_nubinsd; // number of frequency groups | ||
| const Real &numind; // mininmum frequency | ||
| const Real &numaxd; // maximum frequency | ||
| const Real &hd; // Planck constant | ||
| }; | ||
| struct ptcl_scat_args { | ||
| RngGen &rng_gen; | ||
| const Real &vv; | ||
| Real &vx; // particle x/X1-direction speed | ||
| Real &vy; // particle y/X2-direction speed | ||
| Real &vz; // particle z/X3-direction speed | ||
| Real ⅇ // particle frequency (in units of energy) | ||
| }; |
There was a problem hiding this comment.
I guess so long as you can guarantee the lifetime of these references extends beyond where the struct is used this if fine, but holding references in structs can be dangerous.
+ Add ddmc_mg_utils.hpp for MG-specific DDMC functionality. + Add MG DDMC integration and sampling routines and structs. + Add midpoint rule integral for non-dimensional Planck function. + Enable multigroup template in transport_ddmc. + Use DDMC->IMC out-scatter and DDMC leakage frequency sampling. + Use integrals at face over group for total leakage proabilities. + Replace ddmc_face_prob with ddmc_(lo|hi)_face_prob. Note: ddmc_face_prob is only symmetric at face for grey DDMC, so ddmc_(lo|hi)_face_prob for low and high side of face are needed.
+ Change Stefan-Boltzmann to Boltzmann constant in Planck function. + Use Rayleigh-Jeans approximation for nu/T<1e-4. + Return 0 for leakage probability if no groups contribute. + Sample isotropic direction after DDMC frequency out-scatter.
+ Convert frequency to energy when calling opacity. + Fix nu->dnu (ee->dee) in call to midpoint_Planck in leakage. + Check for 0-absorption opacity in DDMC, if 0 return 0 outscatter.
+ Update singularity-eos,-opac submodules. + Avoid some if constexpr capture build errors with maybe_unused.
+ Separate mcblock absorption/scattering input nodes (Artemis-like).
+ Build and store vector of log-space group frequency midpoints. + Demo use of frequency group/bin points in sourcing.cpp.
+ Make powerlaw offsets optional.
+ Use frequency in 1/time in singularity-opac API functions. + Check heuristic if elastic scattering is dominant (is_elastic). + Avoid frequency redistribution during cell leakage if is_elastic. Note: the elastic scattering-dominant mode is a provisional solution, which needs more work for better consistency with the original inelastic mode.
+ Suppress (for now) population control in multigroup mode. + Update metric for elastic-scattering based DDMC leakage. Note: the code with the new metric is motivated in a comment.
+ Add is_leaked parameter to DDMC step arguments. + Move face temperature evaluation out of leakage integrals. + Remove erroneous MG if-check around population control.
|
Added a power-law scattering version of the stepdiff test, along with the corresponding analytic solution (just a per-group form of the original stepdiff solution for elastic scattering). The analytic solution discretizes the frequency in the same way over the same number of groups. |
+ Use pure (elastic) scattering power-law. + Add analytic solution comparison to CI workflows and CI-launcher.
|
Tested out the shearing box with a power-law opacity (through artemis) - at a glance things didn't go crazy. Any objection to merging this? |
Since this is approved and there are no objections - will go ahead and merge. |
Background
transport_ddmc), which may be avoided if multigroup absorption and scattering are stored as fields.Description of Changes
Note: ddmc_face_prob is only symmetric at face for grey DDMC, so ddmc_(lo|hi)_face_prob for low and high side of face are needed.
Checklist