G+Smo  24.08.0
Geometry + Simulation Modules
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
gsDynamicWilson.hpp
Go to the documentation of this file.
1 
14 #pragma once
15 
16 namespace gismo
17 {
18 
19 template <class T, bool _NL>
21 {
22  Base::defaultOptions();
23  m_options.addReal("alpha","Beta parameter for Wilson's method, such that 0 =< 2 beta =< 1",0.25);
24  m_options.addReal("delta","Beta parameter for Wilson's method, such that 0 =< delta =< 1",0.50);
25  m_options.addReal("gamma","Beta parameter for Wilson's method, such that 0 =< gamma =< 1",1.4);
26 }
27 
28 
29 template <class T, bool _NL>
30 template <bool _nonlinear>
31 typename std::enable_if<(_nonlinear==false), gsStatus>::type
32 gsDynamicWilson<T,_NL>::_step_impl(const T t, const T dt, gsVector<T> & U, gsVector<T> & V, gsVector<T> & A) const
33 {
34  T alpha = m_options.getReal("alpha");
35  T delta = m_options.getReal("delta");
36  T gamma = m_options.getReal("gamma");
37 
38  gsVector<T> Uold = U;
39  gsVector<T> Vold = V;
40  gsVector<T> Aold = A;
41 
42  gsVector<T> Utmp = U;
43  gsVector<T> Vtmp = V;
44  gsVector<T> Atmp = A;
45 
46  // Perform a Newmark step with DT = gamma*dt
47  Base::_step(t,gamma*dt,Utmp,Vtmp,Atmp);
48 
49  // Compute solutions
50  A = (1-1/gamma)*Aold + 1/gamma*Atmp;
51  V += A*delta*dt;
52  U += A*alpha*dt*dt;
53 
54  return gsStatus::Success;
55 }
56 
57 
58 template <class T, bool _NL>
59 template <bool _nonlinear>
60 typename std::enable_if<(_nonlinear==true), gsStatus>::type
61 gsDynamicWilson<T,_NL>::_step_impl(const T t, const T dt, gsVector<T> & U, gsVector<T> & V, gsVector<T> & A) const
62 {
63  T alpha = m_options.getReal("alpha");
64  T delta = m_options.getReal("delta");
65  T gamma = m_options.getReal("gamma");
66 
67  gsVector<T> Uold = U;
68  gsVector<T> Vold = V;
69  gsVector<T> Aold = A;
70 
71  gsVector<T> Utmp = U;
72  gsVector<T> Vtmp = V;
73  gsVector<T> Atmp = A;
74 
76  Base::_step(t,gamma*dt,Utmp,Vtmp,Atmp);
77 
78  // Compute solutions (see Wilson et al. (1973) NONLINEAR DYNAMIC ANALYSIS OF COMPLEX STRUCTURES)
79  A = (1-1/gamma)*Aold + 1/gamma*Atmp;
80  U = Uold + dt*Vold + Aold*(0.5 - alpha)*dt*dt + alpha*dt*dt*A;
81  V = Vold + Aold*(1 - delta)*dt + delta*dt*A;
82 
83  return gsStatus::Success;
84 }
85 
86 template <class T, bool _NL>
88  gsVector<T> & U, gsVector<T> & V,
89  gsVector<T> & A) const
90 {
92  status = _step_impl<_NL>(t,dt,U,V,A);
93  return status;
94 }
95 
96 template <class T, bool _NL>
98 {
99  if (m_options.getSwitch("Verbose"))
100  {
101  gsInfo<<"Stage "<<stage<<":";
102  gsInfo<<"\n";
103  }
104 }
105 
106 template <class T, bool _NL>
107 void gsDynamicWilson<T,_NL>::_initOutput() const
108 {
109  if (m_options.getSwitch("Verbose"))
110  {
111  gsInfo<<"\t";
112  gsInfo<<std::setw(4)<<std::left<<"It.";
113  gsInfo<<std::setw(17)<<std::left<<"|R|/|R0|";
114  gsInfo<<std::setw(17)<<std::left<<"|dU|/|U0|"<<"\n";
115  }
116 }
117 
118 template <class T, bool _NL>
119 void gsDynamicWilson<T,_NL>::_stepOutput(const index_t it, const T resnorm, const T updatenorm) const
120 {
121  if (m_options.getSwitch("Verbose"))
122  {
123  gsInfo<<"\t";
124  gsInfo<<std::setw(4)<<std::left<<it;
125  gsInfo<<std::setw(17)<<std::left<<resnorm;
126  gsInfo<<std::setw(17)<<std::left<<updatenorm<<"\n";
127  }
128 }
129 
130 } // namespace gismo
#define index_t
Definition: gsConfig.h:32
gsStatus
Definition: gsStructuralAnalysisTypes.h:20
gsStatus _step(const T t, const T dt, gsVector< T > &U, gsVector< T > &V, gsVector< T > &A) const override
Initialize the ALM.
Definition: gsDynamicWilson.hpp:87
#define gsInfo
Definition: gsDebug.h:43
virtual void defaultOptions() override
Set default options.
Definition: gsDynamicWilson.hpp:20
ALM has not started yet.
Performs the arc length method to solve a nonlinear system of equations.
Definition: gsDynamicWilson.h:35