50 template <
class T,
bool _NL>
51 template <
bool _nonlinear>
52 typename std::enable_if<(_nonlinear==false), gsStatus>::type
53 gsDynamicExplicitEuler<T,_NL>::_step_impl(
const T t,
const T dt, gsVector<T> & U, gsVector<T> & V, gsVector<T> & A)
const
61 sol.topRows(N) = Uold;
62 sol.bottomRows(N) = Vold;
65 gsSparseMatrix<T> M, Minv, C, K;
68 this->_computeMass(t,M);
69 this->_computeMassInverse(M,Minv);
70 this->_computeForce(t,F);
71 this->_computeDamping(U,t,C);
72 this->_computeJacobian(U,t,K);
75 sol.topRows(N) += dt * Vold;
76 sol.bottomRows(N) += dt * Minv * (F - K * Uold - C * Vold);
77 this->_stepOutput(0,sol.norm(),0.);
78 gsDebugVar(sol.transpose());
81 V = sol.bottomRows(N);
83 if (math::isinf(sol.norm()) || math::isnan(sol.norm()))
90 template <
class T,
bool _NL>
91 template <
bool _nonlinear>
92 typename std::enable_if<(_nonlinear==true), gsStatus>::type
93 gsDynamicExplicitEuler<T,_NL>::_step_impl(
const T t,
const T dt, gsVector<T> & U, gsVector<T> & V, gsVector<T> & A)
const
100 gsVector<T> sol(2*N);
101 sol.topRows(N) = Uold;
102 sol.bottomRows(N) = Vold;
105 gsSparseMatrix<T> M, Minv, C, K;
108 this->_computeMass(t,M);
109 this->_computeMassInverse(M,Minv);
110 this->_computeDamping(Uold,t,C);
111 this->_computeResidual(Uold,t,R);
114 sol.topRows(N) += dt * Vold;
115 sol.bottomRows(N) += dt * Minv * ( - R - C * Vold);
116 this->_stepOutput(0,sol.norm(),0.);
119 V = sol.bottomRows(N);
121 if (math::isinf(sol.norm()) || math::isnan(sol.norm()))
127 template <
class T,
bool _NL>
133 status = _step_impl<_NL>(t,dt,U,V,A);
137 template <
class T,
bool _NL>
140 if (m_options.getSwitch(
"Verbose"))
143 gsInfo<<std::setw(4)<<std::left<<
"It.";
144 gsInfo<<std::setw(17)<<std::left<<
"|R|";
149 template <
class T,
bool _NL>
150 void gsDynamicExplicitEuler<T,_NL>::_stepOutput(
const index_t it,
const T resnorm,
const T updatenorm)
const
152 if (m_options.getSwitch(
"Verbose"))
155 gsInfo<<std::setw(4)<<std::left<<it;
156 gsInfo<<std::setw(17)<<std::left<<resnorm;
#define index_t
Definition: gsConfig.h:32
gsStatus
Definition: gsStructuralAnalysisTypes.h:20
Performs the arc length method to solve a nonlinear system of equations.
Definition: gsDynamicExplicitEuler.h:33
gsStatus _step(const T t, const T dt, gsVector< T > &U, gsVector< T > &V, gsVector< T > &A) const override
Initialize the ALM.
Definition: gsDynamicExplicitEuler.hpp:128
#define gsInfo
Definition: gsDebug.h:43