Repository navigation
Conversation
LucLavier
left a comment
There was a problem hiding this comment.
Review of the Mohr-Coulomb return changes. Three points should be fixed before merge, marked Fix before merge inline:
- The corner return's strength update and the recorded plastic strain disagree under softening (
rheology.cxx:475). - The corner return is disabled in the 2D tension-clipped modes, where mode 12 always breaks the stress ordering (
rheology.cxx:902). - A rejected return keeps an out-of-order stress without a fallback or warning (
rheology.cxx:641).
The other six are cleanup, test robustness and conventions. Nothing here was compiled or run.
| if (!std::isfinite(candidate[0]) || !std::isfinite(candidate[1]) || !std::isfinite(candidate[2]) || | ||
| candidate[0] > candidate[1] + tolerance || candidate[1] > candidate[2] + tolerance || | ||
| candidate[2] > ten_max + tolerance) continue; | ||
| const double strength = amc + hardening * (multiplier[0] + multiplier[1]); |
There was a problem hiding this comment.
Fix before merge. The corner return reduces strength by hardening·(m0+m1) here, but the depls that shear_return records for an edge return comes from the plastic strain vector. At ψ=0 in 3D, plastic = {-m0, -m1, m0+m1} (up to ordering) gives depls = sqrt(m0² + m0·m1 + m1²) < m0 + m1; plane strain has the same mismatch (0.5·(m0+m1+max(m0,m1))). With strain softening (hardn != 0), the stress is returned to a surface whose cohesion dropped by more than plstrain grows, so on the next step MatProps rebuilds amc from plstrain and the stress is off the yield surface. The single-face path is consistent at ψ=0. The new tests use constant strength, so they can't catch this; a softening case would. Either use the same measure for the strength update and for depls, or define hardening per unit depls.
There was a problem hiding this comment.
Thanks, @LucLavier . The strength update now uses the saved plastic strain. Edge returns stay enabled after tensile clipping, and failed returns stop with an error. The local material tests pass.
The 2D tiny results are unchanged. The 400-step 3D case changes by up to 12.81% in viscosity and 0.0735% in stress II. Restoring the old edge-hardening calculation restores the old results exactly.
Could you review whether the saved plastic-strain measure is appropriate for softening with nonzero dilation, and whether these 3D changes make sense before we merge?
There was a problem hiding this comment.
Thanks. I checked cfafc56 by reading it and by running the 400-step test-3d-equ-tiny case (3D, CPU, 1 thread).
Is the stored plastic strain the right hardening measure with dilation?
Yes. The softening law is a function of plstrain, which MatProps rebuilds cohesion from every step, so the return has to soften by exactly the depls it adds. cfafc56 now does that in 3D and in plane strain. I checked the corner solve by hand: the 2×2 system is symmetric for both corners, the sum/difference cross term vanishes so depls² = A·s² + B·d² holds exactly, the rationalized quadratic root is correct and stays finite as 1 − a·h² → 0, and the plane-strain branch is linear as it should be.
The measure itself is DES's existing one. Per unit multiplier on a single face it is 1.00 / 1.22 / 1.57 / 2.13 at ψ = 0 / 10 / 20 / 30° in 3D, and 1.00 / 1.21 / 1.52 / 2.00 in plane strain. I'd keep it, since pls0/pls1 are calibrated against it. Four points with dilation or softening:
- 3D dilatant runs now change on every yielding face, not only at corners. The single-face denominator uses
hardening·g(ψ)instead ofhardening. Every cfg inexamples/andbenchmarks-cores/has ψ = 0, so the regression tests can't see this. Could you run one 3D case with ψ ≠ 0 and softening, and add a CHANGELOG line? - The
ndims=2single-face path still has the mismatch fixed here. It softens per unitalam(alam = fs/(… + shear_hardening)) but storesdepls = |alam|·sqrt((3 + 2Nψ + 3Nψ²)/8). At ψ = 0 that factor is 1, which is why the 2D tiny results don't move. Multiplyingshear_hardeningby that factor in the denominator would make it consistent. - Only cohesion softening is consistent.
hardnis dc/dpls; friction and dilation angles also soften withplstrainand aren't in the return, so with friction softening the stress is still slightly off the surface next step. That predates this PR; a CHANGELOG note or follow-up is enough. - Some softening cases now stop the run. An element that crosses
pls1within a step with residual cohesion near 0 can get a negative strength, whichadmissible_shearrejects; a very narrow softening window can make the single-face denominator ≤ 0. Both now end indie()where the run used to continue. The current examples (cohesion1 = 4e6) are safe, but capping the softening atpls1, or falling back to a non-softening return for that element and counting it, may be kinder than aborting.
Do the 3D changes make sense?
Yes. I reproduced your numbers and checked they aren't noise. Maximum relative difference at step 400 (RMS in parentheses):
| comparison | viscosity | strain rate II | stress II | plastic strain | z velocity |
|---|---|---|---|---|---|
cfd6dda vs cfafc56 |
12.6% (0.35%) | 8.2% | 0.071% | 1.3e-5 | 1.8% |
base 82e1cfb vs cfafc56 (whole PR) |
32.7% (1.3%) | 15% | 0.59% | 5.8% | 4.8% |
| noise check: 1 vs 6 OpenMP threads | identical | identical | identical | identical | identical |
noise check: inertial_scaling × (1 + 1e-10) |
3e-7 | 8e-8 | 3e-9 | 7e-10 | 2e-8 |
- The run is deterministic and a 1e-10 perturbation stays near 1e-7 after 400 steps, so the 12.6% is a real, systematic effect of the fix, not noise amplification.
- It's a small mechanical change: plastic strain moves ~1e-5 and stress II < 0.1%. Velocity moves ~2%, the strain rate (a velocity gradient) up to 8%, and the power law amplifies that into viscosity. With ψ = 0 the single-face return is unchanged, so this all comes from corner returns, where the old code softened by
hardening·(m0+m1)against a storedsqrt(m0² + m0·m1 + m1²)(a factor up to 2/√3 ≈ 1.15). Because cohesion is rebuilt fromplstraineach step, the old error was a one-step lag in strength rather than drift, which fits the small stress change. - Most of the PR's effect comes from the first commit (
82e1cfbvscfd6ddais essentially the same as base vs head);cfafc56adds little.
From my side this is fine to merge once point 2 is fixed and a ψ ≠ 0 softening run has been checked; points 3 and 4 can be follow-ups if you prefer.
| depls = 0.5 * std::fabs(alams + alams * anpsi); | ||
| const double trial[3] = {p[0], p[1], p[2]}; | ||
| shear_return(trial, p, depls, a1, a2, anphi, anpsi, amc, hardn, ten_max, | ||
| true, failure_mode == 10); |
There was a problem hiding this comment.
Fix before merge. allow_edge = (failure_mode == 10) turns the corner return off in modes 12 and 13. In mode 12 (p[1] = p[2] = ten_max) the single-face return always breaks the ordering: p1 drops by |alam|·a2·(Nψ−1) and p2 by |alam|·(a1·Nψ − a2), and since a1 > a2, p2 ends below p1. That's the case the corner return (p1 = p2) is for, but it's never tried, so rotate_stress2d maps misordered values and the stress stays above yield in plane strain, which the CHANGELOG says is fixed. Could the corner return be allowed here too, with the result checked against ten_max?
| failure_mode = 10; | ||
|
|
||
| #ifdef THREED | ||
| shear_return(trial, p, depls, a1, a2, anphi, anpsi, amc, |
There was a problem hiding this comment.
Fix before merge. The bool from shear_return is ignored here (and in the 2D mode-10 path). When no corner is admissible (strong softening makes the 2×2 determinant ≤ 0, a multiplier is negative, or the candidate exceeds ten_max), shear_edge_return returns false and p keeps the out-of-order single-face stress. It's then rotated back and stays above yield at the corner with no diagnostic. Suggest a defined fallback (e.g. apex or tension return) or at least a counter or warning when the return is rejected.
| // A tensile elastic predictor does not imply tensile plastic flow when | ||
| // the shear return itself finishes below the cap. | ||
| if (ft > 0 && fs < 0 && | ||
| shear_return(trial, candidate, increment, a1, a2, anphi, anpsi, amc, |
There was a problem hiding this comment.
When this attempt is rejected and h < 0, shear_return runs again at line 641 on identical inputs (trial, same constants) and gives the same result. Every yielding 3D element with ft > 0, fs < 0, h < 0 whose return lands above ten_max does the single-face plus 2×2 corner solve twice, inside the OpenACC kernel. Reusing candidate/increment from this call would avoid it.
| } | ||
| // The elastic trial exceeds c/tan(phi), but its admissible | ||
| // associated shear return lies below it; no tensile flow. | ||
| const double trial[3]={169e3,185e3,200e3}; |
There was a problem hiding this comment.
This check depends on dilation = 30 and the MatProps left by the last pass of the preceding for (int dilation : {0, 30}) loop. Reordering that loop, adding a value, or moving this block leaves ψ = 0, and the hard-coded associated targets (165347.65…, 170585.93…) then fail or test the wrong case. Could the block set the dilation angle and rebuild m->var.mat itself?
| } | ||
| else | ||
| depls = std::fabs(alam) * std::sqrt((7 + 4*anpsi + 7*anpsi*anpsi) / 18); | ||
| const double scale = std::max(std::fabs(amc), |
There was a problem hiding this comment.
The scale/tolerance computation is a copy of the one in shear_edge_return (line 444), and the two can drift apart. Also, the non-edge depls branches (0.5·|alam·(1+Nψ)| and |alam|·sqrt((7+4Nψ+7Nψ²)/18)) are special cases of the edge formula applied to plastic = {alam, 0, −alam·Nψ}. One helper computing depls from plastic[3], plus one shared tolerance helper, would remove both duplications.
| #endif | ||
| } | ||
|
|
||
| // Test the uncut trial first: shear flow may return below the tensile cap. |
There was a problem hiding this comment.
A design question, since this is part 2 of 8 and it may already be planned: "try shear before the tensile limit" is added in two shapes, a 3D if/else ahead of the h test and this 2D early return ahead of clipping. The rejected cases then go through the old separate logic, so 3D and plane strain pick between shear, corner and tension by different rules for the same principal stresses. Is a single principal-space return selector shared by elasto_plastic and elasto_plastic2d (shear face, corner, tension, apex, tried in order with an admissibility check) part of a later PR? The CHANGELOG's "apex and combined returns remain separate" caveat points at the same gap.
| } | ||
|
|
||
| // Test the uncut trial first: shear flow may return below the tensile cap. | ||
| if (p[2] > ten_max && p[0] - p[2]*anphi + amc < 0) { |
There was a problem hiding this comment.
This test uses p[2] > ten_max, but the clipping below uses >=. At exactly p[2] == ten_max, this early attempt is skipped, clipping sets failure_mode = 13, and shear_return then runs with allow_edge = false, so the corner fix is lost for that boundary state. The two comparisons should match.
| build copied into a container) instead of failing to link its library; a | ||
| failed `./build.sh` keeps the previous image instead of deleting it ([#119]). | ||
|
|
||
| - Plane-strain and 3D Mohr-Coulomb shear returns preserve principal-stress |
There was a problem hiding this comment.
The two new Unreleased entries have no ([#136]) link and no matching link-reference definition, unlike the neighbouring entries ([#113], [#114], [#118], [#119]).
There was a problem hiding this comment.
Thanks, @LucLavier . The new commits address your points:
- Pure 2D now uses the same factor
ufor hardening as for the storeddepls. ψ = 0 runs are unchanged, and a new 2D softening test covers ψ = 30°. - A 3D run with ψ = 10° and cohesion softening completes. The CHANGELOG is updated.
- When the closed form doesn't apply, 3D and plane strain now use a general return over the whole strength law. It continues to the residual strength and stops only on a non-finite stress (exit 54). Pure 2D is left for later.
Two other things changed: plane-strain tension no longer clips stresses, so those results change, and RSF now follows the residual cohesion with the state updated once per step. The tiny regression cases are bit-identical. I haven't checked OpenACC.
There was a problem hiding this comment.
Correction to my last reply: not all tiny cases are bit-identical. Against cfafc56, test-tiny, test-rect-tiny and test-3d-tiny are bit-identical, but test-3d-equ-tiny changes by up to 4.4e-5 in plastic strain, 1.3e-3 in stress II and 6.1e-2 in viscosity. Its friction softening now takes the whole-law return.
|
The whole-law return covers 3D and plane strain only, but |
A single-face correction can reverse the principal-stress ordering and leave a symmetric material state outside yield. The zero-dilation affine cell has a 70.192 kPa yield violation. Pre-clipping an elastic predictor at the tensile cap also misses an admissible shear-only return. Return crossed shear faces to their common edge and combine their plastic increments. Accept an admissible shear projection before tensile clipping, checking principal ordering, yield and the tensile bound. The parent fails 178 new assertions in 2D and 194 in 3D. The corrected material suite passes 7036/10415 assertions, including both edges, rotations and the tensile-predictor counterexample. Dry 2D tiny/core and 3D tiny comparisons are bit-exact; C++17/C++20 build in both dimensions. These checks cover the constant-strength components, not general apex or combined-return accuracy. Co-Authored-By: Codex <codex@openai.com>
The two new return-case groups use the same material selection but repeat the identical surrounding condition. Keep both sets of assertions together. The material suite still passes 7,036 assertions in 2D and 10,415 in 3D. Co-Authored-By: Codex <codex@openai.com>
The edge return advances cohesion using face-multiplier sums but records a different plastic increment. Rebuilding properties from that history changes the yield surface on an unloaded step. Plane-strain tensile clipping also disables edge correction, and rejected candidates are consumed as stress. Solve face and edge consistency with the stored increment as the hardening variable, including the plane-strain yield-intercept conversion. Keep edges enabled after clipping and use the same tensile-boundary comparison. Report rejected 3D/plane-strain returns on the host with status 54. Test fixed-angle linear cohesion segments, unequal multipliers, unloaded updates and rejection. The new material checks fail 396 assertions in 2D and 344 in 3D before these corrections. They pass 7,590/10,999 assertions afterward in serial and OpenMP, including the separate status-54 process. The standard 40,000-step 2D and 400-step 3D functional runs complete, and C++17/C++20 build both dimensions. The 2D tiny comparison is bit-exact. At step 400 of test-3d-equ-tiny.cfg, maximum relative changes are 0.1281 for viscosity, 0.000735 for stress II and 0.00001276 for plastic strain. Restoring only the old edge-hardening measure recovers bit-exact fields, isolating the effect of the consistency correction. Co-Authored-By: Codex <codex@openai.com>
The closed-form returns assume one linear piece of the softening law with fixed friction, dilation and tensile cap. A step that crosses a weakening breakpoint, or softens friction or dilation, leaves the stress off the surface rebuilt from the stored history; a cohesion drop faster than elastic unloading has no closed-form root and stopped the run. Plane-strain tension clips principal stresses and records no plastic strain. Pure 2D softens per unit multiplier but stores a larger increment when dilation is nonzero. Keep a closed-form result only while it stays on its linear piece. Otherwise solve depls = recorded(return at strength(plstrain + depls)) piece by piece, with a fixed-strength active-set return over the three shear faces and three tensile caps. Plane-strain tension uses this return from the elastic trial. Rate-and-state models evaluate the same law with the step's slip rate and state held fixed, update the state once per step and store the friction coefficient of the final history. Only a non-finite trial now stops the run with status 54, naming the first element. Material checks pass 7,832 assertions in 2D and 11,286 in 3D with OpenMP, including the status-54 process. Against "fix: match Mohr-Coulomb strength to stored plastic history", test-tiny, test-rect-tiny and test-3d-tiny are bit-exact. In test-3d-equ-tiny (friction 30 -> 5..20 deg) the maximum relative changes at step 400 are 4.4e-5 for plastic strain, 1.3e-3 for stress II and 6.1e-2 for viscosity. With dilation 10 deg the same case completes 400 steps (2.4e-5, 7.3e-4, 0.14). OpenACC was not built. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The whole-law return covered 3D and plane strain only. Pure 2D, the default (`mat.is_plane_strain = no`) and the setting of every shipped 2D example, kept the single-face shear and tensile closed forms. A tensile return could end outside the shear face, and a step that crossed a weakening breakpoint or softened friction or dilation kept the strength and flow of the old history. Write the fixed-strength and whole-law returns for nd principal stresses, one shear face and two tensile caps in pure 2D. Pure 2D now tries the uncut shear return first, as 3D does, keeps the closed form only where it applies, and otherwise uses the whole-law return. 3D and plane strain are unchanged. The material test adds pure 2D property checks: softening past the segment, also from a history one ulp short of a breakpoint, friction and dilation softening, tension at the cap and its corners, and the apex. The previous code fails 46 of them. 2D 7992 and 3D 11286 checks pass. test-tiny, test-core and test-3d-tiny are bit-exact against the parent. rifting-2d (constant friction) is bit-exact for 50 kyr, then 5 breakpoint crossings in 1.7e8 shear returns change it locally. accretionary-wedge (friction 30 -> 15 deg) sends 42% of shear returns to the whole-law return; at 10 kyr plastic strain changes by up to 0.54% and stress II by 2.4%, and the run takes about 35% longer. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Since the whole-law return covers pure 2D, a non-finite pure 2D trial also stops with exit status 54, but check.sh ran only the plane-strain case in 2D, and the CHANGELOG did not say which modes stop. Run the rejected-return process in pure 2D as well. The CHANGELOG now names 3D, plane strain and pure 2D, the stop within a PT iteration, and the elasto-visco-plastic case that selects the viscous stress and continues. 2D 7992 and 3D 11286 checks pass; both rejected-return processes exit 54. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2f089d5 to
045b315
Compare
|
@tan2 Thanks. Pure 2D now uses the same returns, in the same order, as 3D and plane strain (ded3059). The previous pure 2D code fails 46 of the new material checks. test-tiny, test-core and test-3d-tiny are bit-exact. The shipped accretionary-wedge example, which softens friction, now runs about 35% slower and changes by up to 0.54% in plastic strain at 10 kyr. |
|
@sungho91 The whole point of the 3D oedometer test was to verify the single-face correction for the stress evolving along an "edge" of the MC hexagonal cone. As usual, the small increment inherent in the FLAC algorithm was the solution: the net effect of DES's alternating single-face update was equivalent to the analytic solution for the simultaneous two-face update. However, the oedometer benchmark was worked out only for the strain-hardening (constant C and phi) cases. So, this fix might be a fundamental improvement if it works regardless of strain weakening and increment size.
|
|
@echoi Thanks, these are the right questions. 1. Motivating symptom. It came from the poromechanics benchmarks in #134. In the plane-strain Salençon plastic tunnel, some elements lay outside the yield surface even though the PT iterations had converged. A single cell under equal in-plane extension, whose stress must stay on the edge of two faces, reproduced it: one step left σxx ≠ σzz and the stress 70 kPa outside yield, and 16 or 64 sub-steps only reduced the violation. I added this to the description. 2. Algorithm. Yes, it is Koiter's rule:
3. Oedometer. I ran
As you found, the alternating single-face update gets the stress right. But it adds a single-face plastic strain each step instead of measuring the combined increment, so it overstates the plastic strain. With constant c and φ this does not affect the stress; with softening, elements on an edge weaken too early. 4. Relative quantities. Those numbers were already relative, but I hadn't said so: 5. Run time. Yes. In accretionary-wedge each step costs about 35% more, because 42% of its shear returns need the full softening-law solve. The 0.54% is the largest change in plastic strain at 10 kyr, relative to its maximum; after that frame, remeshing makes the meshes differ, so element-by-element comparison is no longer possible. |
|
@sungho91 The statement about the motivating symptom is illuminating.
I'm asking these questions just in case the poor accuracy in plastic strain calculation was due to large increments taken by PT. They will also provide answers to whether 30 % increase in computation time is worth paying. Regardless, the tunnel problem (https://docs.itascacg.com/itasca940/3dec/docproject/source/examples/CylindricalHoleInAnIMCM.html) seems to be another excellent benchmark for the EP.
|
|
@echoi Thanks. Oedometer: DR. Both runs used
Master's stress error shrinks with the step, but its plastic strain stays 41.5% too large. So the excess does not come from large increments; it comes from adding a single-face measure every step. The single cell that first exposed the edge problem calls the material update directly, without PT or DR, and 16 or 64 increments did not remove its yield violation either. Tunnel: PT only. I haven't run it with DR. The manual's Salençon page (below) also records a separate limit: mixed stress averages the stress after the return, so the tunnel result depends on the number of unloading steps; the edge problem itself was isolated in the single cell, which has no mixed stress. Cost. The ~35% comes from accretionary-wedge, a pure 2D model, which has no edges. The time goes into the whole-law return for its friction softening (42% of its shear returns), not into the edge return. Benchmark location. Agreed, it is a mechanics benchmark. In the des3d manual I moved the Kirsch and Salençon pages to the mechanics benchmarks (des3d#125). In DynEarthSol they will move to Input files. They are on the Salençon page of the manual: |
Picks up #135 (1/8).
tan2
left a comment
There was a problem hiding this comment.
"In accretionary-wedge each step costs about 35% more, because 42% of its shear returns need the full softening-law solve."
If I understand the code correctly, the full solve happens only when plastic strain crosses either pls0 or pls1. Otherwise, a linear formula is used for the shear return.
I am surprised that 42% requires a full solve.
| // Why no admissible Mohr-Coulomb state was found; failure_mode = -reason. | ||
| enum ReturnRejection { | ||
| reject_nonfinite = 1, // trial stress is not finite | ||
| reject_no_return = 2, // no set of shear faces and tensile caps satisfies KKT |
|
@sungho91 Thanks, it's good to confirm that the new edge handling works regardless of the solution scheme, as it should.
Sorry, I don't clearly understand any part of this after "I haven't run it with DR." What does "mixed stress" mean and why is it mentioned? "Mixed" in the sense of mixed nodal discretization? What does "unloading steps" mean? Steps required to resolve the process reaching a post-yielding equilibrium? What does "isolated in the single cell" mean?
|
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- update_stress evaluates each element's strength once per step as a piece of the weakening law (MatProps::StrengthPiece); a yielding element adds the angle slopes and the end of the piece, and the returns reuse it instead of rebuilding the marker means for every trial increment. The per-material slopes are computed once, with the materials. - The piece says whether friction or dilation changes along it. Where neither does, the closed-form returns apply as before, and the strength at a trial increment needs no trigonometry; elsewhere the closed-form result is the starting guess. Rate-and-state pieces keep this step's rate and state terms, as before. - consistent_return takes secant steps from that guess and stops at the relative 1e-12 of the yield checks: about 3 fixed-strength returns per call instead of 6. - fixed_strength_return is a template on the number of principal stresses. Wall time against master (median of three, 1 and 4 threads): accretionary-wedge 10 kyr 8.7 and 3.3 s, before 10.9 and 5.1 s, after 10.0 and 4.3 s; core-complex 8 kyr, 1 thread, 9.1 s, before and after 10.0 s. Material checks pass in 2D and 3D; test-tiny, test-rect-tiny, test-core and test-3d-tiny stay bit-exact against master; test-3d-equ-tiny changes by 2.5e-12 against the previous commit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@tan2 @echoi Thanks. You were right to be surprised: I gave the wrong reason. Crossing pls0 or pls1 is rare (5 times in 1.7e8 corrections in rifting-2d). The extra work comes from friction that weakens with plastic strain. When the slow path runs. Most plastic corrections use one formula, as on master. It works when only cohesion weakens, because the yield condition then changes in a straight line with plastic strain. When friction (or dilation) weakens too, there is no such formula, so the code iterates. In accretionary-wedge friction weakens from 30° to 15°, so every yielding element whose friction is still weakening iterates: 42% of the corrections. Master avoids the iteration by using the friction from the start of the step, but then the stress does not sit on the yield surface for the plastic strain it stores. Making it cheaper. a3a187e makes the iteration cheaper without changing what it solves:
Constant-strength cases stay bit-exact against master; test-3d-equ-tiny changes only at round-off level (2.5e-12). Rate-and-state goes through the same path, with this step's rate and state held fixed, as before. Run time against master (median of three runs):
These replace the 35% I gave earlier. The cost depends on whether friction weakens, not on how spread out the deformation is. The 10% in core-complex is not the iteration: it is the checks every correction now makes (principal stresses still in order, below the tension limit, and consistent with the strength at the end of the step). On 4 threads the wedge also loses time because the iterating elements sit together in one part of the mesh, so one thread gets most of them. How DES spreads uneven work over threads is a question for all its OpenMP loops, so I'd look at it separately. How the iteration works. It looks for the plastic strain increment that agrees with itself: take cohesion, friction and dilation at the end-of-step plastic strain, correct the stress with them, and the correction must give back the same increment. Each try is a correction with fixed strength: keep the strength fixed and find where the stress goes back to, trying one shear face or the tension limit first, then the line where two of them meet, then a corner of three. It keeps the first one that is valid: plastic flow pointing outward, the stress inside every limit, and the principal stresses still in order. This is how the tension limits are included. The search starts from the one-formula answer and improves it with secant steps; where the softening law has a kink, it works on one straight piece of the law at a time. The tunnel.
The tunnel needs the wall-pressure boundary condition from #134, which master does not have yet, so I could not run it with DR. KKT stands for the Karush–Kuhn–Tucker conditions, the usual conditions for a valid correction: plastic flow only outward, the stress inside every limit, and plastic flow only on a limit the stress actually touches. The code comment now says this in words (12a58e0). Documentation. Agreed. From now on I will keep unmerged features out of the manual and follow the release plan you set in the new issue. |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@sungho91 Thanks again for the detailed response! It's helpful to know that increased numerical cost is coming from a new iterative process introduced for friction/dilation angle reduction; and that it is independent of the application of the Koiter's rule for the MC corner treatment. Although personally inclining towards the more accurate approach, I'm still split between "fast and simple but dependent on dt (increment size)" and "more accurate but slower". Yes, we are talking about ~10-15 % of increase in execution time (30 % for 4 threads because the small size of the problem?). However, this type of increase in numerical cost is compounding: the next 10 % increase would be 21 % increase relative to the current master (1.1*1.1 = 1.21). Furthermore, for a small enough dt, DES showed a good match with both the Python ("analytic") and COMSOL calculations in the oedometer test with cohesion, friction angle and dilation angle reduction: from my old AGU poster (AGU16, T23C-2952):
So, how about merging only the KKT implementation to master, while reserving the backward Euler iteration as an experimental option rather than a new default? BTW, is the PT going to be the default solver for poromechanical problems? Is that why PT is the default solver for the tests in this PR? Let's not forget that even in the PT, dt cannot be arbitrarily large to accurately capture the strain weakening process. |
|
_> So, how about merging only the KKT implementation to master, while reserving the backward Euler iteration as an experimental option rather than a new default?_
I think this is a good compromise.
|
control.iterative_return_mapping_option = 0 (default) keeps friction and dilation at their values at the start of the step, as master does, and keeps the active-set return for corners, the tensile cap and weakening breakpoints. Option 1 (experimental) is the backward-Euler iteration that matches cohesion, friction and dilation to the end-of-step plastic strain. The residual-assembly Mohr-Coulomb tests run with both options. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
With NVHPC the conditional updates of the rejection count and reasons were lost on the GPU, so a non-finite trial did not stop the run with exit 54. Update the three reductions without a branch. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@echoi @tan2 Thanks, I agree. The one-formula correction works well in most cases, and the iteration is only needed in special cases, so an option is the right place for it. Now in the PR:
Cost against master, one thread, median of three runs:
The 41% oedometer error I reported came from the corner treatment, which stays in the default; that fits your poster, where small dt works for the weakening itself. PT. No, DR stays the default for poromechanics, and this PR's tests don't use PT. PT is needed when the initial condition comes from a sudden load, e.g. a traction applied at the start that changes stress and pore pressure at once; that is hard to reach with DR (a very small dt might work, but I haven't tried). And agreed: dt still has to stay small enough for the weakening, even with PT. |

Why
Found in #134's plane-strain Salençon plastic tunnel: some elements lay outside the yield surface even though the PT iterations had converged. A single-face correction can cross principal-stress order, and closed forms hold only on one linear piece of the softening law. Crossing a breakpoint, softening friction or dilation, or plane-strain tensile clipping leaves stress off the surface rebuilt from the stored history.
Part 2/8, split from #134.
What
control.iterative_return_mapping_option = 1(experimental) instead iterates until cohesion, friction and dilation all match the end-of-step plastic strain.mat.is_plane_strain = no, the default) use the same returns.Production code: +1,144/−236 lines in
rheology.cxx,matprops,input.cxxandparameters.hpp; the rest is tests and documentation.For the reviewer
rheology.cxx:consistent_return,fixed_strength_return,hold_start_angles, thenelasto_plastic2dandelasto_plastic.closed_form_consistentandnext_break. Mesh regularization of strong softening is separate.Try it
control.iterative_return_mapping_option = 1: the end-of-step iteration; try it onexamples/accretionary-wedge.cfg, where friction weakens.make -C tests/residual-assembly-test check ndims=2 backend=omp, thenndims=3; both options are tested.Numerical effect
intended. Changes are relative to each field's maximum, with the default option. Against master, test-tiny, test-rect-tiny and test-3d-tiny are bit-exact; test-core (pure 2D) is bit-exact for 7.5 kyr, then changes; test-3d-equ-tiny (friction softening, 3D edges) changes by up to 6.2% in plastic strain, 0.02% in stress and 33% in viscosity. Pure 2D: rifting-2d is bit-exact for 50 kyr, then changes locally; accretionary-wedge (friction softening) changes plastic strain by up to 0.20% at 10 kyr (0.86% with option 1). Run time against master on one thread: accretionary-wedge takes about 6% longer (13% with option 1); core-complex, where only cohesion weakens, about 5% longer with either option, for the checks every correction now makes. Plane-strain tension changes.
make set/make cmpinbenchmarks-cores/; material checks: 9,185 assertions in 2D, 12,487 in 3D, the Mohr–Coulomb ones with both options.New or retired names
control.iterative_return_mapping_option(0 default, 1 experimental); status 54 with its cause for a rejected return.Checklist
ndims=2andndims=3: yes; 2D/3D CPU, and OpenACC (NVHPC 25.7, H100): the material checks pass on the GPU.## [Unreleased]in CHANGELOG.md: yes.input.cxxand documented inexamples/defaults.cfg: yes.tests/functional/orbenchmarks-cores/: intests/residual-assembly-test/, run by the functional-test workflow.AI disclosure
Codex wrote the edge return and tests and ran validation. Claude wrote the whole-law return, its speed-up and the option that turns its iteration on, the plane-strain, pure-2D, rate-and-state and GPU fixes and their tests, and this description.
🤖 Generated with Claude Code