PerezFougetSubstepperMarkII.h
Go to the documentation of this file.
1 /* ---------------------------------------------------------------------
2  * _
3  * _ __ ___ __ _ _ __ _ __ ___ ___ | |_
4  * | '_ ` _ \ / _` | '__| '_ ` _ \ / _ \| __|
5  * | | | | | | (_| | | | | | | | | (_) | |_
6  * |_| |_| |_|\__,_|_| |_| |_| |_|\___/ \__|
7  *
8  * Unit of Strength of Materials and Structural Analysis
9  * University of Innsbruck,
10  * 2020 - today
11  *
12  * festigkeitslehre@uibk.ac.at
13  *
14  * Matthias Neuner matthias.neuner@uibk.ac.at
15  *
16  * This file is part of the MAteRialMOdellingToolbox (marmot).
17  *
18  * This library is free software; you can redistribute it and/or
19  * modify it under the terms of the GNU Lesser General Public
20  * License as published by the Free Software Foundation; either
21  * version 2.1 of the License, or (at your option) any later version.
22  *
23  * The full text of the license can be found in the file LICENSE.md at
24  * the top level directory of marmot.
25  * ---------------------------------------------------------------------
26  */
27 
28 #pragma once
29 #include "Marmot/MarmotJournal.h"
30 #include "Marmot/MarmotMath.h"
31 #include "Marmot/MarmotTypedefs.h"
32 
34 
38  template < int nSizeMatTangent >
39  class PerezFougetSubstepper {
40 
41  public:
42  typedef Eigen::Matrix< double, nSizeMatTangent, nSizeMatTangent > TangentSizedMatrix;
44  double minimumStepSize,
45  double scaleUpFactor,
46  double scaleDownFactor,
48  const Matrix6d& Cel );
49 
51  bool isFinished();
52 
54  double getNextSubstep();
55 
58 
61 
63  void finishSubstep( const TangentSizedMatrix& dXdY );
64 
67 
68  private:
70  const int nPassesToIncrease;
71 
72  double currentProgress;
73  double currentSubstepSize;
74  int passedSubsteps;
75 
76  const Matrix6d& Cel;
77 
79  };
80 } // namespace Marmot::NumericalAlgorithms
81 
83  template < int n >
85  double minimumStepSize,
86  double scaleUpFactor,
87  double scaleDownFactor,
88  int nPassesToIncrease,
89  const Matrix6d& Cel )
90  :
91 
92  initialStepSize( initialStepSize ),
93  minimumStepSize( minimumStepSize ),
94  scaleUpFactor( scaleUpFactor ),
95  scaleDownFactor( scaleDownFactor ),
96  nPassesToIncrease( nPassesToIncrease ),
97  currentProgress( 0.0 ),
98  currentSubstepSize( initialStepSize ),
99  passedSubsteps( 0 ),
100  Cel( Cel )
101  {
102  consistentTangent = TangentSizedMatrix::Zero();
103  }
104 
105  template < int n >
107  {
108  // this is due to numerical accuracy ...
109  return ( 1.0 - currentProgress ) <= 2e-16;
110  }
111 
112  template < int n >
114  {
115  if ( passedSubsteps >= nPassesToIncrease )
116  currentSubstepSize *= scaleUpFactor;
117 
118  const double remainingProgress = 1.0 - currentProgress;
119  if ( remainingProgress < currentSubstepSize )
120  currentSubstepSize = remainingProgress;
121 
122  passedSubsteps++;
123  currentProgress += currentSubstepSize;
124 
125  return currentSubstepSize;
126  }
127 
128  template < int n >
130  {
131  currentProgress -= currentSubstepSize;
132  passedSubsteps = 0;
133 
134  currentSubstepSize *= scaleDownFactor;
135 
136  if ( currentSubstepSize < minimumStepSize )
137  return MarmotJournal::warningToMSG( "UMAT: Substepper: Minimal stepzsize reached" );
138  else
139  return MarmotJournal::notificationToMSG( "UMAT: Substepper: Decreasing stepsize" );
140  }
141 
142  template < int n >
144  {
145  consistentTangent += currentSubstepSize * TangentSizedMatrix::Identity();
146  }
147 
148  template < int n >
150  {
151  finishElasticSubstep();
152  consistentTangent.applyOnTheLeft( dXdY );
153 
154  for ( int i = 0; i < consistentTangent.rows(); i++ )
155  for ( int j = 0; j < consistentTangent.cols(); j++ )
156  if ( std::abs( consistentTangent( i, j ) ) < 1e-12 )
157  consistentTangent( i, j ) = 0.0;
158  }
159 
160  template < int n >
162  {
163  return consistentTangent.topLeftCorner( 6, 6 ) * Cel;
164  }
165 } // namespace Marmot::NumericalAlgorithms
Marmot::NumericalAlgorithms
Definition: MarmotNumericalDifferentiation.h:34
Marmot::NumericalAlgorithms::PerezFougetSubstepper::Cel
const Matrix6d & Cel
Definition: PerezFougetSubstepperExplicitMarkII.h:75
Marmot::NumericalAlgorithms::PerezFougetSubstepper::PerezFougetSubstepper
PerezFougetSubstepper(double initialStepSize, double minimumStepSize, double scaleUpFactor, double scaleDownFactor, int nPassesToIncrease, const Matrix6d &Cel)
Marmot::NumericalAlgorithms::PerezFougetSubstepper::scaleDownFactor
const double scaleDownFactor
Definition: PerezFougetSubstepperExplicitMarkII.h:68
MarmotJournal.h
Marmot::NumericalAlgorithms::PerezFougetSubstepper::currentProgress
double currentProgress
Definition: PerezFougetSubstepperExplicitMarkII.h:71
MarmotTypedefs.h
MarmotMath.h
Marmot::Matrix6d
Eigen::Matrix< double, 6, 6 > Matrix6d
Definition: MarmotTypedefs.h:35
Marmot::NumericalAlgorithms::PerezFougetSubstepper::consistentTangent
TangentSizedMatrix consistentTangent
Definition: PerezFougetSubstepperMarkII.h:78
Marmot::NumericalAlgorithms::PerezFougetSubstepper::decreaseSubstepSize
bool decreaseSubstepSize()
decrease the next subincrement
Definition: PerezFougetSubstepperExplicitMarkII.h:133
Marmot::NumericalAlgorithms::PerezFougetSubstepper::currentSubstepSize
double currentSubstepSize
Definition: PerezFougetSubstepperExplicitMarkII.h:72
Marmot::NumericalAlgorithms::PerezFougetSubstepper::finishElasticSubstep
void finishElasticSubstep()
finish an elastic only subincrement
MarmotJournal::notificationToMSG
static bool notificationToMSG(const std::string &message)
Marmot::NumericalAlgorithms::PerezFougetSubstepper::PerezFougetSubstepper
PerezFougetSubstepper(double initialStepSize, double minimumStepSize, double scaleUpFactor, double scaleDownFactor, int nPassesToIncrease, const Matrix6d &Cel)
Definition: PerezFougetSubstepperExplicitMarkII.h:85
Marmot::NumericalAlgorithms::PerezFougetSubstepper::consistentStiffness
Matrix6d consistentStiffness()
get the overall consistent algorithmic tangent
Marmot::NumericalAlgorithms::PerezFougetSubstepper::finishSubstep
void finishSubstep(const TangentSizedMatrix &dXdY, const TangentSizedMatrix &dYdXOld)
Definition: PerezFougetSubstepperExplicitMarkII.h:153
Marmot::NumericalAlgorithms::PerezFougetSubstepper::getNextSubstep
double getNextSubstep()
get the next subincrement size
Definition: PerezFougetSubstepperExplicitMarkII.h:117
Marmot::NumericalAlgorithms::PerezFougetSubstepper::isFinished
bool isFinished()
check if subincrementation process has finished
Definition: PerezFougetSubstepperExplicitMarkII.h:110
Marmot::NumericalAlgorithms::PerezFougetSubstepper::TangentSizedMatrix
Eigen::Matrix< double, nSizeMatTangent, nSizeMatTangent > TangentSizedMatrix
Definition: PerezFougetSubstepperMarkII.h:42
Marmot::NumericalAlgorithms::PerezFougetSubstepper::nPassesToIncrease
const int nPassesToIncrease
Definition: PerezFougetSubstepperExplicitMarkII.h:69
Marmot::NumericalAlgorithms::PerezFougetSubstepper::scaleUpFactor
const double scaleUpFactor
Definition: PerezFougetSubstepperExplicitMarkII.h:68
Marmot::NumericalAlgorithms::PerezFougetSubstepper::passedSubsteps
int passedSubsteps
Definition: PerezFougetSubstepperExplicitMarkII.h:73
Marmot::NumericalAlgorithms::PerezFougetSubstepper::getNextSubstep
double getNextSubstep()
get the next subincrement size
Marmot::NumericalAlgorithms::PerezFougetSubstepper::isFinished
bool isFinished()
check if the subincrement process has finished
Marmot::NumericalAlgorithms::PerezFougetSubstepper::finishElasticSubstep
void finishElasticSubstep()
finish an elastic only subincrement
Definition: PerezFougetSubstepperExplicitMarkII.h:147
Marmot::NumericalAlgorithms::PerezFougetSubstepper::minimumStepSize
const double minimumStepSize
Definition: PerezFougetSubstepperExplicitMarkII.h:68
Marmot::NumericalAlgorithms::PerezFougetSubstepper::initialStepSize
const double initialStepSize
Definition: PerezFougetSubstepperExplicitMarkII.h:68
MarmotJournal::warningToMSG
static bool warningToMSG(const std::string &message)
Marmot::NumericalAlgorithms::PerezFougetSubstepper::decreaseSubstepSize
bool decreaseSubstepSize()
decreas the subincrement size
Marmot::NumericalAlgorithms::PerezFougetSubstepper::consistentStiffness
Matrix6d consistentStiffness()
get the consistent algorithmic tangent
Definition: PerezFougetSubstepperExplicitMarkII.h:161