Skip to content

Fill the six equation phasic energies in the primitive variables - #2055

Open
aliencaocao wants to merge 2 commits into
MFlowCode:masterfrom
aliencaocao:fix/six-equation-primitive-energy
Open

aliencaocao wants to merge 2 commits into
MFlowCode:masterfrom
aliencaocao:fix/six-equation-primitive-energy

Conversation

@aliencaocao

@aliencaocao aliencaocao commented Oct 13, 2026 •

Copy link
Copy Markdown

Fixes #2047.

Change

s_convert_conservative_to_primitive_variables in src/common/m_variables_conversion.fpp copies the phasic internal energies into their primitive slots for model_eqns = 3:

if (model_eqns == model_eqns_6eq) then
    $:GPU_LOOP(parallelism='[seq]')
    do i = eqn_idx%int_en%beg, eqn_idx%int_en%end
        qK_prim_vf(i)%sf(j, k, l) = qK_cons_vf(i)%sf(j, k, l)
    end do
end if

This is the same treatment the routine already gives the volume fractions, the magnetic field, and the color function. Their primitive and conservative forms coincide.

Why this is correct

In the six-equation model equations.md, Section 2.2), the extra variables are the phasic internal energies αₖρₖeₖ. MFC's serial output definition lists them in both the conservative and the primitive output. post_process also writes the same quantity as alpha_rho_e.

Before and after

The figure shows the shock and helium bubble from the issue, in the six-equation model. It shows the phasic energy of helium from t = 0.2 ms to 1.0 ms.

pr
  • Before: prim.8 and prim.9 are 0 in every cell.
  • After: both equal the stored cons.8 and cons.9 exactly.
  • All 1,584 conservative output files are byte-identical with and without the change.

Tests and goldens

No golden changes as this does not concern the final solution that the golden files checks for.

Contribution Policy

We do not accept pull requests generated primarily by AI without genuine understanding or real-world usage context.

All contributions are expected to demonstrate:

  • A clear understanding of the codebase
  • Alignment with product direction
  • Thoughtful reasoning behind changes
  • Evidence of real-world usage or hands-on experience with the problem

If these expectations are not met, we would prefer to implement the changes ourselves rather than spend time reviewing low-effort submissions.


Acknowledgement

  • I confirm this PR meets the above expectations and reflects my own understanding and real-world context.

PR template credit: junegunn

s_convert_conservative_to_primitive_variables copies the phasic
internal energies into their primitive slots, which the serial
primitive output writes; they were allocated but never filled. No
solver term reads them, so the solution and every golden are unchanged.
Copilot AI balanced review requested due to automatic review settings October 13, 2026 20:26

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions

github-actions Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

Claude Code Review

Head SHA: 193c9e0

Files changed:

  • 1
  • src/common/m_variables_conversion.fpp

Findings:
No issues found. Checked in step 4: src/common/m_variables_conversion.fpp (the new 6-equation int_en copy loop is consistent with the existing adv/MHD copy loops in the same kernel and with the 6eq convention in s_convert_primitive_to_conservative_variables).

@codecov

codecov Bot commented Oct 14, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 66.66667% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 61.91%. Comparing base (62f658a) to head (3ca2d89).
⚠️ Report is 5 commits behind head on master.

Files with missing lines Patch % Lines
src/common/m_variables_conversion.fpp 66.66% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           master    #2055   +/-   ##
=======================================
  Coverage   61.91%   61.91%           
=======================================
  Files          86       86           
  Lines       22848    22851    +3     
  Branches     3360     3361    +1     
=======================================
+ Hits        14147    14149    +2     
  Misses       6207     6207           
- Partials     2494     2495    +1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@sbryngelson sbryngelson reopened this Oct 14, 2026
@github-actions

Copy link
Copy Markdown

Lines of Code

File Lines Diff
src/common/m_variables_conversion.fpp 966 +6
Directory Lines Diff
common 10532 +6
total 47591 +6

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Bug: Six-equation model: primitive output of the phasic internal energies is never filled

4 participants