Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Slow nonlinear convergence in struct/LV_Holzapfel_passive #189

Closed
1 task done
mrp089 opened this issue Feb 21, 2024 · 4 comments · Fixed by #190
Closed
1 task done

Slow nonlinear convergence in struct/LV_Holzapfel_passive #189

mrp089 opened this issue Feb 21, 2024 · 4 comments · Fixed by #190
Labels
bug Something isn't working

Comments

@mrp089
Copy link
Member

mrp089 commented Feb 21, 2024

Description

While adding missing results to test cases (#175), I noticed that the test struct/LV_Holzapfel_passive (using the Holzapfel material) has a very slow nonlinear convergence.

Reproduction

In tests, run pytest -vrx -k LV_Holzapfel

This is the output I get:

---------------------------------------------------------------------
 Eq     N-i     T       dB  Ri/R1   Ri/R0    R/Ri     lsIt   dB  %t
---------------------------------------------------------------------
 ST 1-1  3.470e-01  [0 1.000e+00 1.000e+00 8.598e-13]  [187 -45 35]
 ST 1-2  7.030e-01  [-26 4.651e-02 4.651e-02 5.679e-12]  [181 -36 33]
 ST 1-3  1.044e+00  [-46 4.694e-03 4.694e-03 5.971e-11]  [156 -2 30]
 ST 1-4  1.376e+00  [-60 9.761e-04 9.761e-04 2.513e-10]  [144 -58 29]
 ST 1-5  1.700e+00  [-71 2.766e-04 2.766e-04 9.835e-10]  [133 -44 27]
 ST 1-6  2.017e+00  [-81 8.715e-05 8.715e-05 2.911e-09]  [125 -32 25]
 ST 1-7  2.332e+00  [-90 2.845e-05 2.845e-05 9.251e-09]  [117 -19 23]
 ST 1-8  2.642e+00  [-100 9.439e-06 9.439e-06 2.672e-08]  [110 -7 23]
 ST 1-9  2.947e+00  [-110 3.162e-06 3.162e-06 8.636e-08]  [98 -71 22]
 ST 1-10  3.251e+00  [-119 1.066e-06 1.066e-06 2.274e-07]  [92 -61 20]
 ST 1-11  3.543e+00  [-128 3.618e-07 3.618e-07 6.808e-07]  [86 -50 18]
 ST 1-12  3.828e+00  [-138 1.234e-07 1.234e-07 2.239e-06]  [79 -38 16]
 ST 1-13  4.111e+00  [-147 4.225e-08 4.225e-08 6.368e-06]  [73 -28 15]
 ST 1-14  4.391e+00  [-156 1.454e-08 1.454e-08 1.748e-05]  [67 -17 14]
 ST 1-15  4.671e+00  [-165 5.022e-09 5.022e-09 5.320e-05]  [58 -6 14]
 ST 1-16  4.939e+00  [-175 1.742e-09 1.742e-09 1.504e-04]  [48 -88 12]
 ST 1-17  5.198e+00  [-184 6.076e-10 6.076e-10 4.638e-04]  [39 -77 8]
 ST 1-18  5.458e+00  [-193 2.159e-10 2.159e-10 1.163e-03]  [34 -68 7]
 ST 1-19s 5.729e+00  [-201 8.659e-11 8.659e-11 3.055e-03]  [28 -58 5]

I increased Max_iterations and set Tolerance = 1e-10.

Expected behavior

Should converge to this tolerance in ~5 Newton iterations.

Additional context

@ktbolt, @aabrown100-git, have you used this material outside this test case? If this slow convergence also appears outside of this test case, the linearization is incorrect.

Code of Conduct

  • I agree to follow this project's Code of Conduct and Contributing Guidelines
@mrp089 mrp089 added the bug Something isn't working label Feb 21, 2024
@aabrown100-git
Copy link
Collaborator

aabrown100-git commented Feb 21, 2024

I checked my old results when I created this test case, and the convergence is much better

---------------------------------------------------------------------
 Eq     N-i     T       dB  Ri/R1   Ri/R0    R/Ri     lsIt   dB  %t
---------------------------------------------------------------------
 ST 1-1  1.930e-01  [0 1.000e+00 1.000e+00 9.859e-07]  [113 -11 7]
 ST 1-2  3.680e-01  [-19 1.073e-01 1.073e-01 9.834e-07]  [98 -62 7]
 ST 1-3  5.670e-01  [-59 1.101e-03 1.101e-03 9.644e-07]  [97 -60 6]
 ST 1-4s 7.740e-01  [-154 1.977e-08 1.977e-08 1.332e-05]  [79 -34 5]

Perhaps something changed since I added this test? Maybe during material model restructuring here: #159

@aabrown100-git
Copy link
Collaborator

Found a tiny bug in mat_models_carray.h line 946

        for (int i = 0; i < N; i++) {
          for (int j = 0; j < N; j++) {
            for (int k = 0; k < N; k++) {
              for (int l = 0; l < N; l++) {
                CCb[i][j][k][l] += g1 * Hss_prod[i][j][k][l];
              }
            }
          }
        }
        //CCb = CCb + g2*ten_dyad_prod(Hss, Hss, nsd);

As shown in the commented line, it should be g2 instead of g1.

With this change, convergence is excellent

---------------------------------------------------------------------
 Eq     N-i     T       dB  Ri/R1   Ri/R0    R/Ri     lsIt   dB  %t
---------------------------------------------------------------------
 ST 1-1  4.700e-02  [0 1.000e+00 1.000e+00 8.962e-07]  [84 -45 17]
 ST 1-2  9.500e-02  [-25 5.159e-02 5.159e-02 9.870e-07]  [92 -55 15]
 ST 1-3  1.440e-01  [-74 1.835e-04 1.835e-04 9.218e-07]  [89 -51 18]
 ST 1-4s 2.060e-01  [-194 1.800e-10 1.800e-10 1.448e-03]  [47 -65 5]

Will make a pull request

@aabrown100-git
Copy link
Collaborator

Raises an interesting question. Is it possible to make our testing detect poor convergence, not just incorrect results?

@mrp089
Copy link
Member Author

mrp089 commented Feb 21, 2024

Thank you for looking into it! That's a good point. I'm currently cranking up all tolerances (#175) to get more reproducible results. I could then set the max number of Newton iterations to the current one. If the tests are sensitive enough, they should fail if the solver takes way more iterations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants