From f5a470d09710d988b328cd539596a29e0c192a51 Mon Sep 17 00:00:00 2001
From: Van Dung NGUYEN <vdg.nguyen@gmail.com>
Date: Thu, 4 Jul 2024 16:37:59 +0200
Subject: [PATCH] compute correct tangent when using BFGS

---
 NonLinearSolver/nlsolver/nonLinearMechSolver.cpp | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/NonLinearSolver/nlsolver/nonLinearMechSolver.cpp b/NonLinearSolver/nlsolver/nonLinearMechSolver.cpp
index 892db3fc5..70a6ae567 100644
--- a/NonLinearSolver/nlsolver/nonLinearMechSolver.cpp
+++ b/NonLinearSolver/nlsolver/nonLinearMechSolver.cpp
@@ -3348,6 +3348,14 @@ void nonLinearMechSolver::oneStepPostSolve(const double curtime, const int numst
   {
     // copy current to initial state
     (*_initialState) = (*_currentState);
+    
+    if ((_stiffnessModificationMonitoring->quasiNewtonUpdate() and _tangentflag) and 
+        (_systemType == DISP_ELIM or _systemType == DISP_MULT))
+    {
+      Msg::Info("stiffness matrix is reevaluated");
+      this->computeStiffMatrix();
+    }
+    
 
     this->extractAverageProperties(_tangentflag);
     if (getDamageToCohesiveJumpFlag() and !_multiscaleFlag){
@@ -10821,7 +10829,6 @@ double nonLinearMechSolver::solveSNL()
       // write the stress*.msh and disp*.msh files to check
       // loaded values
       /*
-      Msg::Info("Write stress and disp file after loading internal state");
       double DT = _timeManager->getTimeStep();
       double CURtime = DT+_timeManager->getLastTime();
       int NStep = _timeManager->getLastIterationIndex();
-- 
GitLab