19 template <
class T,
bool _NL>
22 Base::defaultOptions();
23 m_options.addReal(
"alpha",
"Beta parameter for Newmark's method, such that 0 =< 2 beta =< 1",0.25);
24 m_options.addReal(
"delta",
"Beta parameter for Newmark's method, such that 0 =< gamma =< 1",0.50);
28 template <
class T,
bool _NL>
29 template <
bool _nonlinear>
30 typename std::enable_if<(_nonlinear==false), gsStatus>::type
40 T alpha = m_options.getReal(
"alpha");
41 T delta = m_options.getReal(
"delta");
44 this->_computeMass(t+dt,M);
45 this->_computeForce(t+dt,F);
50 U = Uold + dt*Vold + Aold*(0.5 - alpha)*dt*dt;
51 V = Vold + Aold*(1 - delta)*dt;
53 this->_computeDamping(U,t+dt,C);
54 this->_computeJacobian(U,t+dt,K);
57 lhs = M + delta*dt*C + dt*dt*alpha*K;
58 rhs = F - K*U - C * V;
61 typename gsSparseSolver<T>::uPtr solver;
65 A = solver->solve(rhs);
69 this->_stepOutput(0,(F - K*U - M * A - C * V).norm(),U.norm());
70 if (math::isinf(U.norm()) || math::isnan(U.norm()))
77 template <
class T,
bool _NL>
78 template <
bool _nonlinear>
79 typename std::enable_if<(_nonlinear==true), gsStatus>::type
80 gsDynamicNewmark<T,_NL>::_step_impl(
const T t,
const T dt, gsVector<T> & U, gsVector<T> & V, gsVector<T> & A)
const
88 gsSparseMatrix<T> M, C, K;
90 T alpha = m_options.getReal(
"alpha");
91 T delta = m_options.getReal(
"delta");
93 gsSparseMatrix<T> lhs;
95 U = Uold + dt*Vold + Aold*(0.5 - alpha)*dt*dt + alpha*dt*dt*A;
96 V = Vold + Aold*(1 - delta)*dt + delta*dt*A;
98 this->_computeMass(t+dt,M);
99 this->_computeDamping(U,t+dt,C);
100 this->_computeResidual(U,t+dt,R);
102 gsMatrix<T> rhs = R - C * V - M*(A);
104 T tolU = m_options.getReal(
"TolU");
105 T tolF = m_options.getReal(
"TolF");
106 T updateNorm = 10.0*tolU;
107 T residualNorm = rhs.norm();
108 T residualNorm0 = (residualNorm!=0) ? residualNorm : 1;
112 typename gsSparseSolver<T>::uPtr solver;
113 for (
index_t numIterations = 0; numIterations < m_options.getInt(
"MaxIter"); ++numIterations)
115 if ((!m_options.getSwitch(
"Quasi")) || ((numIterations==0) || (numIterations % m_options.getInt(
"QuasiIterations") == 0)))
118 this->_computeDamping(U,t+dt,C);
119 this->_computeJacobian(U,t+dt,K);
122 lhs = M + delta*dt*C + dt*dt*alpha*K;
124 solver = gsSparseSolver<T>::get( m_options.getString(
"Solver") );
125 solver->compute(lhs);
127 dA = solver->solve(rhs);
134 updateNorm = (Anorm!=0) ? dAnorm/Anorm : dAnorm;
136 this->_computeResidual(U,t+dt,R);
138 residualNorm = rhs.norm() / residualNorm0;
140 this->_stepOutput(numIterations,residualNorm,updateNorm);
142 if ( (updateNorm<tolU && residualNorm<tolF) )
148 gsInfo<<
"maximum iterations reached. Solution did not converge\n";
152 template <
class T,
bool _NL>
158 status = _step_impl<_NL>(t,dt,U,V,A);
163 template <
class T,
bool _NL>
166 if (m_options.getSwitch(
"Verbose"))
169 gsInfo<<std::setw(4)<<std::left<<
"It.";
170 gsInfo<<std::setw(17)<<std::left<<
"|R|/|R0|";
171 gsInfo<<std::setw(17)<<std::left<<
"|dU|/|U0|"<<
"\n";
175 template <
class T,
bool _NL>
176 void gsDynamicNewmark<T,_NL>::_stepOutput(
const index_t it,
const T resnorm,
const T updatenorm)
const
178 if (m_options.getSwitch(
"Verbose"))
181 gsInfo<<std::setw(4)<<std::left<<it;
182 gsInfo<<std::setw(17)<<std::left<<resnorm;
183 gsInfo<<std::setw(17)<<std::left<<updatenorm<<
"\n";
gsStatus _step(const T t, const T dt, gsVector< T > &U, gsVector< T > &V, gsVector< T > &A) const override
Initialize the ALM.
Definition: gsDynamicNewmark.hpp:153
#define index_t
Definition: gsConfig.h:32
gsStatus
Definition: gsStructuralAnalysisTypes.h:20
#define gsInfo
Definition: gsDebug.h:43
virtual void defaultOptions() override
Set default options.
Definition: gsDynamicNewmark.hpp:20
Abstract class for solvers. The solver interface is base on 3 methods: -compute set the system matrix...
Definition: gsSparseSolver.h:66
Performs the arc length method to solve a nonlinear system of equations.
Definition: gsDynamicNewmark.h:34