22 Base::defaultOptions();
23 m_options.addReal(
"damping",
"damping factor",1.0);
24 m_options.addReal(
"alpha",
"mass coefficient",2.0);
25 m_options.addReal(
"tolE",
"Kinetic energy tolerance",1e-6);
26 m_options.addInt(
"ResetIt",
"Reset rate of velocities if damping is zero",-1);
33 m_c = m_options.getReal(
"damping");
34 m_alpha = m_options.getReal(
"alpha");
35 m_tolE = m_options.getReal(
"tolE");
36 m_resetIterations = m_options.getInt(
"ResetIt");
43 gsInfo<<std::setw(4)<<std::left<<
"It.";
44 gsInfo<<std::setw(17)<<std::left<<
"|R|";
45 gsInfo<<std::setw(17)<<std::left<<
"|R|/|R0|";
46 gsInfo<<std::setw(17)<<std::left<<
" Ek";
47 gsInfo<<std::setw(17)<<std::left<<
" Ek/Ek0";
48 gsInfo<<std::setw(17)<<std::left<<
"|dU|";
49 gsInfo<<std::setw(17)<<std::left<<
"|dU|/|DU|";
50 gsInfo<<std::setw(17)<<std::left<<
"|dU|/|U+DU|";
51 gsInfo<<std::setw(17)<<std::left<<
"|dV|";
59 gsInfo<<std::setw(4)<<std::left<<k;
60 gsInfo<<std::setw(17)<<std::left<<m_residual;
61 gsInfo<<std::setw(17)<<std::left<<m_residual/m_residualIni;
62 gsInfo<<std::setw(17)<<std::left<<m_Ek;
63 gsInfo<<std::setw(17)<<std::left<<m_Ek/m_Ek0;
64 gsInfo<<std::setw(17)<<std::left<<m_deltaU.norm();
65 gsInfo<<std::setw(17)<<std::left<<m_deltaU.norm()/m_DeltaU.norm();
66 gsInfo<<std::setw(17)<<std::left<<m_deltaU.norm()/(m_U+m_DeltaU).norm();
67 gsInfo<<std::setw(17)<<std::left<<m_v.norm();
101 m_Eks.reserve(m_maxIterations);
103 if (m_verbose) initOutput();
108 m_Eks.push_back(m_Ek);
110 if (m_verbose != 0) stepOutput(0);
112 for (m_numIterations=1; m_numIterations!=m_maxIterations; m_numIterations++, resetIt++)
115 if ((m_c==0 && m_Ek_prev > m_Ek) || resetIt==m_resetIterations)
122 if (m_numIterations % m_verbose == 0 || m_verbose==-1 ) stepOutput(m_numIterations);
124 m_Eks.push_back(m_Ek);
126 m_residualOld = m_residual;
128 if (m_residual/m_residualIni < m_tolF && m_Ek/m_Ek0 < m_tolE && m_deltaU.norm()/m_DeltaU.norm() < m_tolU)
132 gsDebug <<
"\t |R|/|R0| = "<<m_residual/m_residualIni<<
" < tolF = "<<m_tolF<<
"\n";
133 gsDebug <<
"\t |E|/|E0| = "<<m_Ek/m_Ek0 <<
" < tolE = "<<m_tolE<<
"\n";
134 gsDebug <<
"\t |U|/|U0| = "<<m_deltaU.norm()/m_DeltaU.norm()<<
" < tolF = "<<m_tolU<<
"\n";
137 if (m_numIterations==m_maxIterations-1)
140 gsInfo<<
"Maximum iterations reached. Solution did not converge\n";
152 m_massInv *= 1./m_alpha;
153 m_damp = m_c * m_mass;
159 m_dofs = m_mass.rows();
160 m_massInv = m_mass.array().inverse();
180 if (!m_residualFun(U, resVec))
189 m_R = _computeResidual(m_U+m_DeltaU) - m_damp.cwiseProduct(m_v);
190 m_residual = m_R.norm();
192 m_v += m_dt * m_massInv.cwiseProduct(m_R);
193 m_deltaU = m_dt * m_v;
199 m_DeltaU += m_deltaU;
200 m_Ek = m_v.transpose() * m_mass.cwiseProduct(m_v);
206 m_R = _computeResidual(m_U+m_DeltaU)- m_damp.cwiseProduct(m_v);
207 m_deltaU = - 1.5 * m_dt * m_v + m_dt*m_dt / 2. * m_massInv.cwiseProduct(m_R);
208 m_DeltaU += m_deltaU;
228 m_DeltaU.setZero(m_dofs);
230 m_R = _computeResidual(m_U);
232 m_residual = m_forcing.norm();
234 if (m_residual==0) m_residual=1;
236 m_residualIni = m_residualOld = m_residual;
241 m_R = _computeResidual(m_U + m_DeltaU);
243 m_residual = m_forcing.norm();
245 if (m_residual==0) m_residual=1;
247 m_residualOld = m_residual;
249 m_residualIni = _computeResidual(m_U).norm();
251 if (m_residualIni==0) m_residualIni=1;
259 m_deltaU = 0.5*m_dt*m_dt*m_massInv.cwiseProduct(m_R);
263 m_DeltaU += m_deltaU;
265 m_Ek = m_v.transpose() * m_mass.cwiseProduct(m_v);
Static solver using the Dynamic Relaxation method.
Definition gsStaticDR.h:28
void _start()
Starts the method.
Definition gsStaticDR.hpp:216
void stepOutput(index_t k) override
See gsStaticBase.
Definition gsStaticDR.hpp:56
void _peak()
Identifies a peak.
Definition gsStaticDR.hpp:204
void initialize() override
See gsStaticBase.
Definition gsStaticDR.hpp:148
void _init()
Initializes the method.
Definition gsStaticDR.hpp:169
void initOutput() override
See gsStaticBase.
Definition gsStaticDR.hpp:40
void defaultOptions() override
See gsStaticBase.
Definition gsStaticDR.hpp:20
void getOptions() override
See gsStaticBase.
Definition gsStaticDR.hpp:30
gsStatus solve() override
gsStaticBase base functions
Definition gsStaticDR.hpp:72
void _iteration()
Performs an iteration.
Definition gsStaticDR.hpp:186
void _solve()
See solve()
Definition gsStaticDR.hpp:98
void reset() override
See gsStaticBase.
Definition gsStaticDR.hpp:157
A vector with arbitrary coefficient type and fixed or dynamic size.
Definition gsVector.h:37
#define index_t
Definition gsConfig.h:32
#define gsDebug
Definition gsDebug.h:61
#define gsInfo
Definition gsDebug.h:43
The G+Smo namespace, containing all definitions for the library.
gsStatus
Definition gsStructuralAnalysisTypes.h:21
@ NotStarted
ALM has not started yet.