Open tarun-mitruka opened 5 months ago
Attention: Patch coverage is 57.55396%
with 59 lines
in your changes missing coverage. Please review.
Project coverage is 84.53%. Comparing base (
fa0c806
) to head (f37f798
).:exclamation: Current head f37f798 differs from pull request most recent head 26a8620
Please upload reports for the commit 26a8620 to get more accurate results.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Here is a part of an output as example obtained from testpathfollowing.cpp
.
The below code uses ArcLength
along with the class PathFollowing
.
==========================================================================================
Started Path following with Arc length
Load step: 0 Step size = 1.000e-01
------------------------------------------------------------------------------------------
Non-linear solver started:
Ite FirstOrderOptimality CorrectionNorm SubsidiaryFunction LoadFactor
------------------------------------------------------------------------------------------
1 6.452e-10 8.237e-05 -1.388e-17 9.927e-02
Number of iterations by the non-linear solver: 1
Load factor: 9.927e-02
==========================================================================================
Load step: 1 Step size = 1.000e-01
------------------------------------------------------------------------------------------
Non-linear solver started:
Ite FirstOrderOptimality CorrectionNorm SubsidiaryFunction LoadFactor
------------------------------------------------------------------------------------------
1 5.272e-08 4.993e-04 2.316e-08 1.981e-01
2 8.504e-07 1.038e-06 8.504e-07 1.981e-01
3 2.439e-16 3.608e-14 2.359e-16 1.981e-01
Number of iterations by the non-linear solver: 3
Load factor: 1.981e-01
==========================================================================================
Load step: 2 Step size = 1.000e-01
------------------------------------------------------------------------------------------
Non-linear solver started:
Ite FirstOrderOptimality CorrectionNorm SubsidiaryFunction LoadFactor
------------------------------------------------------------------------------------------
1 2.971e-07 1.025e-03 -1.388e-17 2.962e-01
2 3.575e-06 4.358e-06 3.575e-06 2.962e-01
3 8.230e-15 9.900e-13 8.230e-15 2.962e-01
Number of iterations by the non-linear solver: 3
Load factor: 2.962e-01
==========================================================================================
Load step: 3 Step size = 1.000e-01
------------------------------------------------------------------------------------------
Non-linear solver started:
Ite FirstOrderOptimality CorrectionNorm SubsidiaryFunction LoadFactor
------------------------------------------------------------------------------------------
1 9.574e-07 1.609e-03 0.000e+00 3.929e-01
2 8.751e-06 1.063e-05 8.751e-06 3.929e-01
3 8.078e-14 8.346e-12 8.078e-14 3.929e-01
Number of iterations by the non-linear solver: 3
Load factor: 3.929e-01
==========================================================================================
Load step: 4 Step size = 1.000e-01
------------------------------------------------------------------------------------------
Non-linear solver started:
Ite FirstOrderOptimality CorrectionNorm SubsidiaryFunction LoadFactor
------------------------------------------------------------------------------------------
1 2.349e-06 2.288e-03 0.000e+00 4.878e-01
2 1.754e-05 2.120e-05 1.754e-05 4.878e-01
3 4.538e-13 4.522e-11 4.538e-13 4.878e-01
Number of iterations by the non-linear solver: 3
Load factor: 4.878e-01
==========================================================================================
End of Path following with Arc length
Total number of iterations: 13
Elapsed time: 15 ms
The below code uses the class LoadControl
. It is to note that the line which shows the displacement being printed explicitly is just an outcome of a user-defined observer included in the tests and is not part of the ControlLogger
itself.
==========================================================================================
Started Load Control Method
The displacement is 0 0
Load step: 0 Step size = 1.000e-01
------------------------------------------------------------------------------------------
Non-linear solver started:
Ite FirstOrderOptimality CorrectionNorm
------------------------------------------------------------------------------------------
1 4.110e-04 7.118e-02
2 2.462e-09 9.726e-05
Number of iterations by the non-linear solver: 2
The displacement is 0.01715872957844366 0.06918063748415847
Load factor: 1.000e-01
==========================================================================================
Load step: 0 Step size = 1.000e-01
------------------------------------------------------------------------------------------
Non-linear solver started:
Ite FirstOrderOptimality CorrectionNorm
------------------------------------------------------------------------------------------
1 1.661e-03 7.147e-02
2 8.313e-08 3.990e-04
3 2.559e-16 2.253e-08
Number of iterations by the non-linear solver: 3
The displacement is 0.03454644287301918 0.1389097864303651
Load factor: 2.000e-01
==========================================================================================
Load step: 1 Step size = 1.000e-01
------------------------------------------------------------------------------------------
Non-linear solver started:
Ite FirstOrderOptimality CorrectionNorm
------------------------------------------------------------------------------------------
1 2.999e-03 7.237e-02
2 4.312e-07 7.396e-04
3 1.101e-14 1.196e-07
Number of iterations by the non-linear solver: 3
The displacement is 0.05241261128656169 0.2097895325120464
Load factor: 3.000e-01
==========================================================================================
Load step: 2 Step size = 1.000e-01
------------------------------------------------------------------------------------------
Non-linear solver started:
Ite FirstOrderOptimality CorrectionNorm
------------------------------------------------------------------------------------------
1 4.520e-03 7.396e-02
2 1.428e-06 1.160e-03
3 1.757e-13 4.098e-07
Number of iterations by the non-linear solver: 3
The displacement is 0.07105346894026039 0.2825443193976918
Load factor: 4.000e-01
==========================================================================================
Load step: 3 Step size = 1.000e-01
------------------------------------------------------------------------------------------
Non-linear solver started:
Ite FirstOrderOptimality CorrectionNorm
------------------------------------------------------------------------------------------
1 6.366e-03 7.642e-02
2 4.017e-06 1.728e-03
3 1.946e-12 1.210e-06
Number of iterations by the non-linear solver: 3
The displacement is 0.09085338848350603 0.3581294588381903
Load factor: 5.000e-01
==========================================================================================
End of Load Control Method
Total number of iterations: 14
Elapsed time: 1 ms
Ok I refactored the whole observer observable pattern such that it is much more scalable: https://godbolt.org/z/b9cM5e714 Can you have a look and try to understand and refactor the existing code? Ignore the thread-safe parts.
Further things to do:
Concepts::NonLinearSolverCheckForPathFollowing<NLS>
should also be used by the class LoadControl
ikarus/solver/nonlinearsolver/newtonraphsonwithscalarsubsidiaryfunction.hh
This PR heavily refactors the interface of the observer patterns. By the addition of
struct ControlLoggerInformation
andstruct NonLinearSolverLoggingInformation
, the functionupdateImpl
of the classIObserver
can be simplified by just passing thesestruct
and thus removes the overloading of this function. This simplifies the whole interface of the classIObservable
as well. Moreover, theswitch
statements incontrollogger.cpp
andnonlinearsolverlogger.cpp
can be combined in one function which increases code readability and extensibility. The information of the load factorlambda
is now also moved from a solver logger to a control logger as it is expected to be. This leads to small fixes in the classLoadControl
which now then shows the same output as by the classPathFollowing
as confirmed by an additional test added intestpathfollowing.cpp
.