Preserve face orientation in intflux - #49
Conversation
|
I do not review draft PRs. But you can encourage me by providing a detailed explanation of why this change is required. |
There was a problem hiding this comment.
🟡 Changes recommended
AD-generated intflux_* implementations in src/differentiation/** still use abs(fcQalf) and will be inconsistent with the updated forward model until regenerated/updated.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Updates the face-to-cell flux interpolation in intflux to preserve face-orientation sign (via fcQalf) when computing effective velocities, with accompanying in-code rationale.
Changes:
- Clarified the algorithm comment to explain why face orientation sign must be preserved across topology cuts.
- Changed effective-velocity computation to divide by the signed projected face area
geo%fcS * geo%fcQalf(removingabs(...)).
File summaries
| File | Description |
|---|---|
| src/utility/intflux.F | Preserve face orientation sign in effective-velocity calculation and document the rationale. |
Review details
- Files reviewed: 1/1 changed files
- Comments generated: 2
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Use the signed fcQalf projection in the primal and differentiated intflux routines so face orientation is retained across topology cuts.
791d485 to
d6a25f5
Compare
Requested changes applied, thank you. Still need to see an example of why this is needed.
|
Ok, should be ready now. |
|
I'll wait for the KUL review, since you ignored my request for a documented example of where this change matters. |
|
@hrdoktorx Here are some examples, the 2nd one is an ITER case |
|
It does look ugly. Walk me through them, please. |
|
@pshenovaa @shtirx Do you also see such things in your ITER runs? |
|
I added a description to the PR, but here is another description: intflux reconstructs a face velocity as |
|
And the ITER case I am plotting is from Andrei |
|
Note this is just a b2plot error, it's already handled correctly elsewhere as I noted in the description |
|
Is |
|
Yes, from what I can see. Only in b2plot and caltraj, which is only used by b2plot. |
hrdoktorx
left a comment
There was a problem hiding this comment.
Since it is only a b2plot error, I am satisfied. Trust, but verify.


Corrects the reconstruction of cell-centered fluxes in
intfluxby preserving the sign of the face projection factorfcQalf.intfluxderives an effective face velocity by dividing the signed face flux by the interpolated density and projected face area:The previous implementation used
abs(fcQalf). On WG grids, face orientation can reverse across topology cuts, causingfcQalfto change sign. Taking its absolute value discarded that orientation information and could produce an incorrect sign in the reconstructed velocity and interpolated cell-centered flux.Using the signed value of
fcQalfensures that equivalent physical flows retain a consistent direction across topology cuts. This also matches the signed-area convention already used bydivide_by_areainb2us_geo.F