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 cmm/test_pipe_3d #191

Closed
1 task done
mrp089 opened this issue Feb 21, 2024 · 4 comments
Closed
1 task done

Slow nonlinear convergence in cmm/test_pipe_3d #191

mrp089 opened this issue Feb 21, 2024 · 4 comments
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 cmm/test_pipe_3d (steps 3a-inflate-cmm and 3b-prestress-cmm) have a very slow nonlinear convergence.

Reproduction

In tests, run pytest -vrx -k pipe_3d. The second simulation output corresponds to step 3a-inflate-cmm, the second to last to 3b-prestress-cmm.

This is the output I get for 3a-inflate-cmm:

---------------------------------------------------------------------
 Eq     N-i     T       dB  Ri/R1   Ri/R0    R/Ri     lsIt   dB  %t
---------------------------------------------------------------------
 CM 1-1  8.150e-01  [0 1.000e+00 1.000e+00 1.331e-09]  !510 -19 88!
 CM 1-2  1.636e+00  [-24 5.971e-02 5.971e-02 7.006e-11]  !510 -20 88!
 CM 1-3  2.451e+00  [-48 3.758e-03 3.758e-03 1.125e-11]  !510 -19 88!
 CM 1-4  3.282e+00  [-70 3.053e-04 3.053e-04 1.497e-11]  !510 -19 88!
 CM 1-5  4.029e+00  [-90 2.876e-05 2.876e-05 1.255e-10]  [458 -21 86]
 CM 1-6  4.711e+00  [-109 3.288e-06 3.288e-06 1.112e-09]  [405 -17 85]
 CM 1-7  5.289e+00  [-129 3.506e-07 3.506e-07 1.056e-08]  [340 -11 83]
 CM 1-8  5.791e+00  [-146 4.982e-08 4.982e-08 7.380e-08]  [288 -11 80]
 CM 1-9  6.184e+00  [-163 6.346e-09 6.346e-09 5.752e-07]  [201 -18 74]
 CM 1-10  6.525e+00  [-179 1.076e-09 1.076e-09 3.337e-06]  [171 -7 70]
 CM 1-11  6.760e+00  [-195 1.622e-10 1.622e-10 2.272e-05]  [96 -18 57]
 CM 1-12  6.925e+00  [-211 2.647e-11 2.647e-11 1.336e-04]  [45 -89 39]
 CM 1-13  7.060e+00  [-227 4.230e-12 4.230e-12 8.472e-04]  [27 -71 23]
 CM 1-14  7.188e+00  [-243 6.915e-13 6.915e-13 5.041e-03]  [18 -53 14]
 CM 2-1  8.027e+00  [0 1.000e+00 1.530e+00 2.659e-10]  !510 -21 88!
 CM 2-2  8.863e+00  [-11 2.662e-01 4.073e-01 3.149e-11]  !510 -20 88!
 CM 2-3  9.717e+00  [-47 4.220e-03 6.458e-03 2.659e-11]  !510 -21 88!
 CM 2-4  1.056e+01  [-65 5.078e-04 7.771e-04 2.749e-11]  !510 -18 88!
 CM 2-5  1.131e+01  [-90 2.953e-05 4.519e-05 8.013e-11]  [450 -17 86]
 CM 2-6  1.203e+01  [-112 2.501e-06 3.827e-06 9.356e-10]  [400 -15 85]
 CM 2-7  1.267e+01  [-129 3.460e-07 5.295e-07 6.919e-09]  [356 -18 83]
 CM 2-8  1.321e+01  [-149 3.411e-08 5.220e-08 6.868e-08]  [289 -12 80]
 CM 2-9  1.361e+01  [-171 2.662e-09 4.074e-09 8.946e-07]  [198 -18 73]
 CM 2-10  1.395e+01  [-188 3.902e-10 5.971e-10 5.976e-06]  [164 -3 69]
 CM 2-11  1.421e+01  [-206 4.517e-11 6.912e-11 5.352e-05]  [112 -2 59]
 CM 2-12  1.437e+01  [-228 3.627e-12 5.550e-12 6.657e-04]  [41 -73 36]
 CM 2-13  1.452e+01  [-245 5.177e-13 7.922e-13 4.503e-03]  [25 -54 20]
 CM 3-1  1.539e+01  [0 1.000e+00 1.680e+00 3.004e-09]  !510 -16 88!
 CM 3-2  1.625e+01  [-6 4.626e-01 7.770e-01 4.546e-11]  !510 -20 88!
 CM 3-3  1.712e+01  [-31 2.542e-02 4.270e-02 5.074e-12]  !510 -19 88!
 CM 3-4  1.801e+01  [-57 1.321e-03 2.219e-03 1.362e-11]  !510 -18 88!
 CM 3-5  1.883e+01  [-81 8.104e-05 1.361e-04 2.709e-11]  [487 -10 87]
 CM 3-6  1.954e+01  [-103 6.546e-06 1.100e-05 3.227e-10]  [401 -16 85]
 CM 3-7  2.012e+01  [-123 6.924e-07 1.163e-06 3.183e-09]  [322 -6 82]
 CM 3-8  2.059e+01  [-142 7.723e-08 1.297e-07 2.786e-08]  [251 -16 79]
 CM 3-9  2.098e+01  [-161 8.801e-09 1.478e-08 2.454e-07]  [194 -16 73]
 CM 3-10  2.129e+01  [-179 1.016e-09 1.707e-09 2.092e-06]  [143 -16 66]
 CM 3-11  2.151e+01  [-198 1.187e-10 1.993e-10 1.852e-05]  [86 -14 53]
 CM 3-12  2.167e+01  [-217 1.396e-11 2.344e-11 1.537e-04]  [40 -88 34]
 CM 3-13  2.180e+01  [-235 1.650e-12 2.772e-12 1.271e-03]  [20 -67 17]
 CM 3-14  2.193e+01  [-254 1.962e-13 3.295e-13 9.565e-03]  [12 -46 11]
 CM 4-1  2.282e+01  [0 1.000e+00 1.131e+00 1.849e-10]  !510 -22 87!
 CM 4-2  2.369e+01  [-12 2.320e-01 2.624e-01 2.980e-11]  !510 -20 88!
 CM 4-3  2.456e+01  [-46 4.713e-03 5.330e-03 2.731e-11]  !510 -18 88!
 CM 4-4  2.543e+01  [-71 2.545e-04 2.879e-04 2.364e-11]  !510 -19 88!
 CM 4-5  2.616e+01  [-101 8.709e-06 9.850e-06 3.616e-10]  [431 -8 86]
 CM 4-6  2.677e+01  [-127 4.431e-07 5.011e-07 7.370e-09]  [342 -11 83]
 CM 4-7  2.727e+01  [-152 2.489e-08 2.815e-08 1.274e-07]  [268 -3 79]
 CM 4-8  2.764e+01  [-175 1.692e-09 1.914e-09 1.875e-06]  [185 -12 72]
 CM 4-9  2.793e+01  [-197 1.267e-10 1.433e-10 2.577e-05]  [126 -7 63]
 CM 4-10  2.811e+01  [-219 1.007e-11 1.138e-11 3.156e-04]  [47 -81 39]
 CM 4-11  2.824e+01  [-241 8.180e-13 9.251e-13 4.006e-03]  [18 -55 14]
 CM 5-1  2.911e+01  [0 1.000e+00 9.722e-01 4.469e-10]  !510 -19 88!
 CM 5-2  3.000e+01  [-15 1.729e-01 1.681e-01 2.508e-11]  !510 -20 88!
 CM 5-3  3.087e+01  [-45 5.518e-03 5.364e-03 2.346e-11]  !510 -19 88!
 CM 5-4  3.173e+01  [-75 1.775e-04 1.726e-04 2.040e-11]  [507 -18 88]
 CM 5-5  3.246e+01  [-105 5.504e-06 5.351e-06 6.746e-10]  [414 -1 85]
 CM 5-6  3.303e+01  [-136 1.484e-07 1.442e-07 2.530e-08]  [313 -2 82]
 CM 5-7  3.347e+01  [-166 4.901e-09 4.765e-09 7.565e-07]  [230 -9 76]
 CM 5-8  3.376e+01  [-194 1.918e-10 1.865e-10 1.981e-05]  [123 -7 63]
 CM 5-9  3.395e+01  [-221 8.059e-12 7.835e-12 4.644e-04]  [65 -3 46]
 CM 5-10s 3.411e+01  [-244 6.001e-13 5.834e-13 6.064e-03]  [15 -51 10]

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

Expected behavior

Should converge to this tolerance in ~5 Newton iterations.

Additional context

@ktbolt, @wgyang, I don't understand how CMM works. Is it normal to converge this slowly?

Before, we had a very coarse tolerance of 1e-4, which might explain why we got different results on different machines (#137).

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
@mrp089
Copy link
Member Author

mrp089 commented Feb 21, 2024

@wgyang, can you try running a "real-world" CMM and see if it converges similarly to FORTRAN svFSI?

@wgyang
Copy link
Contributor

wgyang commented Feb 21, 2024

@wgyang, can you try running a "real-world" CMM and see if it converges similarly to FORTRAN svFSI?

Yes, will do.

@wgyang
Copy link
Contributor

wgyang commented Feb 23, 2024

Pulsatile flow poses challenges for CMM simulations. The required number of iterations is influenced by instantaneous flow. Even under steady flow conditions, achieving convergence, defined by a threshold of 1e-12, typically necessitates approximately 55 to 100 time steps, with around 7 Newton iterations needed. Note that the solver advances to the next time step when either Ri/R1 or Ri/R0 becomes smaller than the threshold. The convergence order for the relative residual at each time step is approximately 1. Achieving quadratic convergence is unlikely for the solver. In patient-specific cases, I found convergence more difficult compared to a simple cylinder. The threshold of 1e-12 is too strict.

Here is the output for steady flow in a cylinder using cmm,

 Eq     N-i     T       dB  Ri/R1   Ri/R0    R/Ri     lsIt   dB  %t
---------------------------------------------------------------------

 CM 52-1  5.043e+01  [0 1.000e+00 1.812e-03 9.932e-05]  [142 -92 74]
 CM 52-2  5.057e+01  [-27 4.289e-02 7.773e-05 9.784e-05]  [124 -92 75]
 CM 52-3  5.069e+01  [-59 1.062e-03 1.925e-06 9.838e-05]  [107 -92 71]
 CM 52-4  5.082e+01  [-93 2.165e-05 3.924e-08 9.964e-05]  [111 -92 72]
 CM 52-5  5.094e+01  [-126 4.842e-07 8.777e-10 9.633e-05]  [109 -92 73]
 CM 52-6  5.105e+01  [-158 1.208e-08 2.190e-11 1.646e-04]  [98 -87 70]
 CM 52-7  5.110e+01  [-188 3.555e-10 6.443e-13 5.535e-03]  [20 -52 15]

Using the same input files (a cylinder with pulsatile flow), svFSI and svFSIplus have similar output.

svFSI
---------------------------------------------------------------------
 Eq     N-i     T       dB  Ri/R1   Ri/R0    R/Ri     lsIt   dB  %t
---------------------------------------------------------------------
 New time step size: 5.000E-3
 CM     1-1  1.01E1  [   0 1.00000 1.00000 9.93E-5]  [ 236  -92  92]
 CM     1-2  1.91E1  [ -51 2.76E-3 2.76E-3 9.70E-5]  [ 222  -92  90]
 CM     1-3  2.30E1  [ -77 1.29E-4 1.29E-4 9.87E-5]  [ 126  -92  78]
 CM     1-4  2.71E1  [-104 5.63E-6 5.63E-6 9.77E-5]  [ 130  -92  79]
 CM     1-5  3.11E1  [-125 5.37E-7 5.37E-7 9.95E-5]  [ 128  -92  77]
 CM     1-6  3.57E1  [-151 2.71E-8 2.71E-8 9.80E-5]  [ 143  -92  81]
 CM     1-7  3.91E1  [-171 2.79E-9 2.79E-9 9.98E-5]  [ 116  -92  74]
 CM     1-8  4.33E1  [-195 1.5E-10 1.5E-10 9.71E-5]  [ 132  -92  79]
 CM     1-9  4.68E1  [-215 1.6E-11 1.6E-11 9.93E-5]  [ 119  -92  76]
 CM     1-10  4.90E1  [-239 1.0E-12 1.0E-12 4.83E-4]  [  74  -76  59]
 CM     2-1  5.70E1  [   0 1.00000 1.26583 9.92E-5]  [ 205  -92  89]
 CM     2-2  6.19E1  [ -28 3.75E-2 4.75E-2 9.88E-5]  [ 152  -92  83]
 CM     2-3  6.79E1  [ -68 3.81E-4 4.82E-4 9.98E-5]  [ 175  -92  85]
 CM     2-4  7.18E1  [ -91 2.64E-5 3.35E-5 9.81E-5]  [ 126  -92  77]
 CM     2-5  7.63E1  [-119 1.11E-6 1.40E-6 9.68E-5]  [ 143  -92  81]
 CM     2-6  8.07E1  [-144 6.24E-8 7.90E-8 9.83E-5]  [ 137  -92  79]
 CM     2-7  8.47E1  [-170 3.07E-9 3.88E-9 9.93E-5]  [ 132  -92  79]
 CM     2-8  8.91E1  [-195 1.7E-10 2.1E-10 9.79E-5]  [ 138  -92  80]
 CM     2-9  9.27E1  [-219 1.0E-11 1.2E-11 9.76E-5]  [ 119  -92  76]
 CM     2-10s 9.45E1  [-245 5.0E-13 6.4E-13 7.98E-4]  [  61  -71  51]

svFSIplus
---------------------------------------------------------------------
 Eq     N-i     T       dB  Ri/R1   Ri/R0    R/Ri     lsIt   dB  %t
---------------------------------------------------------------------
 CM 1-1  1.225e+01  [0 1.000e+00 1.000e+00 9.742e-05]  [237 -92 89]
 CM 1-2  2.316e+01  [-51 2.761e-03 2.761e-03 9.870e-05]  [221 -92 87]
 CM 1-3  2.812e+01  [-77 1.296e-04 1.296e-04 9.779e-05]  [127 -92 72]
 CM 1-4  3.322e+01  [-104 5.629e-06 5.629e-06 9.794e-05]  [131 -92 73]
 CM 1-5  3.832e+01  [-125 5.360e-07 5.360e-07 9.827e-05]  [131 -92 73]
 CM 1-6  4.409e+01  [-151 2.707e-08 2.707e-08 9.689e-05]  [143 -92 76]
 CM 1-7  4.861e+01  [-171 2.783e-09 2.783e-09 9.934e-05]  [117 -92 69]
 CM 1-8  5.395e+01  [-196 1.579e-10 1.579e-10 9.717e-05]  [135 -92 75]
 CM 1-9  5.848e+01  [-215 1.662e-11 1.662e-11 9.935e-05]  [118 -92 70]
 CM 1-10  6.128e+01  [-239 1.065e-12 1.065e-12 4.851e-04]  [73 -76 50]
 CM 2-1  7.095e+01  [0 1.000e+00 1.266e+00 9.920e-05]  [205 -92 86]
 CM 2-2  7.737e+01  [-28 3.756e-02 4.754e-02 9.885e-05]  [152 -92 79]
 CM 2-3  8.501e+01  [-68 3.815e-04 4.829e-04 9.987e-05]  [175 -92 82]
 CM 2-4  8.997e+01  [-91 2.649e-05 3.354e-05 9.817e-05]  [126 -92 73]
 CM 2-5  9.604e+01  [-119 1.112e-06 1.408e-06 9.685e-05]  [143 -92 74]
 CM 2-6  1.018e+02  [-144 6.248e-08 7.909e-08 9.831e-05]  [137 -92 75]
 CM 2-7  1.071e+02  [-170 3.072e-09 3.888e-09 9.944e-05]  [132 -92 75]
 CM 2-8  1.128e+02  [-195 1.706e-10 2.160e-10 9.796e-05]  [138 -92 76]
 CM 2-9  1.177e+02  [-219 1.005e-11 1.272e-11 9.769e-05]  [119 -92 71]
 CM 2-10s 1.202e+02  [-245 5.071e-13 6.419e-13 7.906e-04]  [61 -71 43]

@mrp089
Copy link
Member Author

mrp089 commented Feb 23, 2024

Thank you for looking into it, @wgyang!! We can close this issue. Even though the convergence is not great, it looks like it's "normal" for CMM. Maybe someone wants to dig that out in the future and check if the linearization is correct.

@mrp089 mrp089 closed this as completed Feb 23, 2024
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

No branches or pull requests

2 participants