23 Base::defaultOptions();
24 m_options.addReal(
"damping",
"damping factor",1.0);
25 m_options.addReal(
"alpha",
"mass coefficient",2.0);
26 m_options.addReal(
"tolE",
"Kinetic energy tolerance",1e-6);
27 m_options.addInt(
"ResetIt",
"Reset rate of velocities if damping is zero",-1);
34 m_c = m_options.getReal(
"damping");
35 m_alpha = m_options.getReal(
"alpha");
36 m_tolE = m_options.getReal(
"tolE");
37 m_resetIterations = m_options.getInt(
"ResetIt");
44 gsInfo<<std::setw(4)<<std::left<<
"It.";
45 gsInfo<<std::setw(17)<<std::left<<
"|R|";
46 gsInfo<<std::setw(17)<<std::left<<
"|R|/|R0|";
47 gsInfo<<std::setw(17)<<std::left<<
" Ek";
48 gsInfo<<std::setw(17)<<std::left<<
" Ek/Ek0";
49 gsInfo<<std::setw(17)<<std::left<<
"|dU|";
50 gsInfo<<std::setw(17)<<std::left<<
"|dU|/|DU|";
51 gsInfo<<std::setw(17)<<std::left<<
"|dU|/|U+DU|";
52 gsInfo<<std::setw(17)<<std::left<<
"|dV|";
60 gsInfo<<std::setw(4)<<std::left<<k;
61 gsInfo<<std::setw(17)<<std::left<<m_residual;
62 gsInfo<<std::setw(17)<<std::left<<m_residual/m_residualIni;
63 gsInfo<<std::setw(17)<<std::left<<m_Ek;
64 gsInfo<<std::setw(17)<<std::left<<m_Ek/m_Ek0;
65 gsInfo<<std::setw(17)<<std::left<<m_deltaU.norm();
66 gsInfo<<std::setw(17)<<std::left<<m_deltaU.norm()/m_DeltaU.norm();
67 gsInfo<<std::setw(17)<<std::left<<m_deltaU.norm()/(m_U+m_DeltaU).norm();
68 gsInfo<<std::setw(17)<<std::left<<m_v.norm();
102 m_Eks.reserve(m_maxIterations);
104 if (m_verbose) initOutput();
109 m_Eks.push_back(m_Ek);
111 if (m_verbose != 0) stepOutput(0);
113 for (m_numIterations=1; m_numIterations!=m_maxIterations; m_numIterations++, resetIt++)
116 if ((m_c==0 && m_Ek_prev > m_Ek) || resetIt==m_resetIterations)
123 if (m_numIterations % m_verbose == 0 || m_verbose==-1 ) stepOutput(m_numIterations);
125 m_Eks.push_back(m_Ek);
127 m_residualOld = m_residual;
129 if (m_residual/m_residualIni < m_tolF && m_Ek/m_Ek0 < m_tolE && m_deltaU.norm()/m_DeltaU.norm() < m_tolU)
133 gsDebug <<
"\t |R|/|R0| = "<<m_residual/m_residualIni<<
" < tolF = "<<m_tolF<<
"\n";
134 gsDebug <<
"\t |E|/|E0| = "<<m_Ek/m_Ek0 <<
" < tolE = "<<m_tolE<<
"\n";
135 gsDebug <<
"\t |U|/|U0| = "<<m_deltaU.norm()/m_DeltaU.norm()<<
" < tolF = "<<m_tolU<<
"\n";
138 if (m_numIterations==m_maxIterations-1)
141 gsInfo<<
"Maximum iterations reached. Solution did not converge\n";
153 m_massInv *= 1./m_alpha;
154 m_damp = m_c * m_mass;
160 m_dofs = m_mass.rows();
161 m_massInv = m_mass.array().inverse();
181 if (!m_residualFun(U, resVec))
190 m_R = _computeResidual(m_U+m_DeltaU) - m_damp.cwiseProduct(m_v);
191 m_residual = m_R.norm();
193 m_v += m_dt * m_massInv.cwiseProduct(m_R);
194 m_deltaU = m_dt * m_v;
200 m_DeltaU += m_deltaU;
201 m_Ek = m_v.transpose() * m_mass.cwiseProduct(m_v);
207 m_R = _computeResidual(m_U+m_DeltaU)- m_damp.cwiseProduct(m_v);
208 m_deltaU = - 1.5 * m_dt * m_v + m_dt*m_dt / 2. * m_massInv.cwiseProduct(m_R);
209 m_DeltaU += m_deltaU;
229 m_DeltaU.setZero(m_dofs);
231 m_R = _computeResidual(m_U);
233 m_residual = m_forcing.norm();
235 if (m_residual==0) m_residual=1;
237 m_residualIni = m_residualOld = m_residual;
242 m_R = _computeResidual(m_U + m_DeltaU);
244 m_residual = m_forcing.norm();
246 if (m_residual==0) m_residual=1;
248 m_residualOld = m_residual;
250 m_residualIni = _computeResidual(m_U).norm();
252 if (m_residualIni==0) m_residualIni=1;
260 m_deltaU = 0.5*m_dt*m_dt*m_massInv.cwiseProduct(m_R);
264 m_DeltaU += m_deltaU;
266 m_Ek = m_v.transpose() * m_mass.cwiseProduct(m_v);
void getOptions() override
See gsStaticBase.
Definition: gsStaticDR.hpp:31
#define gsDebug
Definition: gsDebug.h:61
void initialize() override
See gsStaticBase.
Definition: gsStaticDR.hpp:149
gsStatus solve() override
gsStaticBase base functions
Definition: gsStaticDR.hpp:73
#define index_t
Definition: gsConfig.h:32
gsStatus
Definition: gsStructuralAnalysisTypes.h:20
void _start()
Starts the method.
Definition: gsStaticDR.hpp:217
void reset() override
See gsStaticBase.
Definition: gsStaticDR.hpp:158
#define gsInfo
Definition: gsDebug.h:43
Static solver using the Dynamic Relaxation method.
Definition: gsStaticDR.h:27
void _solve()
See solve()
Definition: gsStaticDR.hpp:99
void _iteration()
Performs an iteration.
Definition: gsStaticDR.hpp:187
void _peak()
Identifies a peak.
Definition: gsStaticDR.hpp:205
void _init()
Initializes the method.
Definition: gsStaticDR.hpp:170
void initOutput() override
See gsStaticBase.
Definition: gsStaticDR.hpp:41
void stepOutput(index_t k) override
See gsStaticBase.
Definition: gsStaticDR.hpp:57
void defaultOptions() override
See gsStaticBase.
Definition: gsStaticDR.hpp:21