Repository navigation
Conversation
Yurlungur
reviewed
Oct 7, 2026
Member
|
Can you describe what was wrong and what the solution is? |
Yurlungur
approved these changes
Oct 7, 2026
Comment on lines
+87
to
+101
| //---------------------------------------------------------------------------------------- | ||
| //! \fn VarNamePairList RiotUtils::GetPrimitiveAssociatedVars | ||
| //! \brief | ||
| VarNamePairList GetPrimitiveAssociatedVars(MeshData<Real> *md, | ||
| const Metadata::FlagCollection &flags) { | ||
| auto [flagged_vars, assoc_vars] = GetAssociatedVars(md, flags); | ||
| std::vector<std::string> conserved_vars, prims_vars; | ||
| for (int n = 0; n < flagged_vars.size(); n++) { | ||
| if (flagged_vars[n] != assoc_vars[n]) { | ||
| conserved_vars.push_back(flagged_vars[n]); | ||
| prims_vars.push_back(assoc_vars[n]); | ||
| } | ||
| } | ||
| return std::make_pair(conserved_vars, prims_vars); | ||
| } |
Collaborator
There was a problem hiding this comment.
given our discussion this morning is this still the way you want to do it? if so that's fine.
Collaborator
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Summary
TN
SharedSourcesSharedSourcesreceives TN'sdudtsubset as bothsourceinandsourceout. That subset holds onlyMetadata::Independentvars. The associated primitivesq(cm::ionization_zbar,cm::equivalent_plastic_strain,prim.<scalar>,bhr_*, …) areMetadata::Derived, so they aren't in it.GetAssociatedVars(sourceout, …)then threwCouldn't find variablefor any TN run that also had ionization, strength, Mix or material-tied scalars. The var names are now resolved fromstate, andqis packed fromstate.Metadata::Advectedvars whose "primitive" is the var itself (levelset, bulk scalars,electron_internal_energy,electron_entropy), reading the "primitive" fromstatewould givedU += U·dρ. TN now assumes that mass-weighted vars (ρq) are associated with a separate primitiveq, and that self-associated vars need no TNdρsource. The newRiotUtils::GetPrimitiveAssociatedVarskeeps only the pairs with a separate primitive, and only those vars getq·dρ.TN
CalculateTNBurnSourceccbulk::total_material_energy,ccmat::iso,ccmat::tn_reaction_densityandccmat::rhowere zeroed, butSharedSourcesalso accumulates intoccbulk::momentumand the anonymous conserved vars, so those built up across stages and steps. The whole TNdudtsubset (allMetadata::Independentvars) is now zeroed.ccbulk::cell_deltaisMetadata::OneCopyand notMetadata::Independent, so it isn't touched.r_id_1 == r_id_2(e.g. D+D), which corrects double counting in n²⟨σv⟩. Both reactant updates still take from that isotope, so two particles are consumed per reaction.TN reaction-count history
IntegratedReactionCountused the wrong index. It was passed the per-material reaction index, butccmat::tn_reaction_densityis indexed by global reaction ID. Its component offset was also wrong: it summednum_reactions_per_matoverccmat::rhocomponents, which overcounts with phases, when each TN material actually carriesnum_reactionscomponents. It now finds the material's firstccmat::tn_reaction_densitycomponent and offsets by the global reaction index.Advection: dense vars that use the association machinery
Metadata::Advectedvars associated with a separate primitive (Mix'srho_bhr_*,rho_reynolds_stress) were treated as anonymous scalars. Their flux wasq_upwind · riemann_vel, which is missing the density.PrimFluxPack::HasAssociatedPrimitivedetects these vars.AdvectionFluxesnow multiplies the upwinded primitive by the bulk mass flux, the sum of theccmat::rhoface fluxes over all materials and phases:F(ρq) = q_upwind · Σ_m F_ρ,m. That matches how sparse material-tied vars use their own material's mass flux. Self-associated vars still useriemann_vel. Mix results will change.Levelsets: scratch-field metadata
levelset0anddudt_reinitializewereMetadata::Independent+Metadata::OneCopy. That put them in every package'sdudtsubset, and because they'reMetadata::OneCopythe subset shares the state's memory instead of allocating new storage, soUpdateToNextStageadded each var to itself once per package, and TN's new zeroing would have wiped them. Both are scratch for the operator-splitLevelsets::Reinitializeand are rewritten before they're read, so they're nowMetadata::Derived+Metadata::OneCopy. This also drops them from restart output and AMR prolongation/restriction. The docs table inlevelsets.rstis updated.*PR summary aided by generative AI.
PR Checklist
scripts/format.shcommand or by using@par-hermes formatplan_historiesfolder, with a filename the same as the MR number.If preparing for a new release, in addition please check the following: