refactor: simplify hypoelastic source terms in m_hypoelastic.fpp#1399
Draft
sbryngelson wants to merge 1 commit intoMFlowCode:masterfrom
Draft
refactor: simplify hypoelastic source terms in m_hypoelastic.fpp#1399sbryngelson wants to merge 1 commit intoMFlowCode:masterfrom
sbryngelson wants to merge 1 commit intoMFlowCode:masterfrom
Conversation
…s and drop zero-sum terms
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.
Summary
Addresses #1343 (readability only — no correctness change).
The source term formula is$S^e_{ij} = \rho(l_{ik}\tau_{kj} + \tau_{ik}l^T_{kj} - \tau_{ij},\mathrm{tr}(\mathbf{D}) + 2G,D^d_{ij})$ . Because $\mathbf{l}\tau + \tau\mathbf{l}^T$ is symmetric and doubles the off-diagonal contributions, the old code wrote e.g. $\mathbf{l}\tau + \tau\mathbf{l}^T$ before simplifying.
τ_12*du_dy + τ_12*du_dyas two separate lines. The zero-sum pairs (e.g.+ τ_12*du_dx - τ_12*du_dxin the τ_12 update) are algebraic cancellations from expandingThis PR collapses each duplicate pair to
2._wp * τ * dvand removes the zero-sum pairs, making the code match the formula directly. The change is purely cosmetic: no numerical values change.Changes
src/simulation/m_hypoelastic.fpp,idir == 2andidir == 3blocks:x + x→2._wp*xfor the doubled off-diagonal rotation terms+a - azero-sum pairs in the τ_12, τ_13, τ_23 shear updates2._wp*G*(1._wp/2._wp)*...→G*...and2._wp*G*(1._wp/3._wp)*...→(2._wp/3._wp)*G*...Net: 36 lines → 19 lines (−17 lines).
Test plan