NewmarkBetaIntegrator.h
Go to the documentation of this file.
1 /* ---------------------------------------------------------------------
2  * _
3  * _ __ ___ __ _ _ __ _ __ ___ ___ | |_
4  * | '_ ` _ \ / _` | '__| '_ ` _ \ / _ \| __|
5  * | | | | | | (_| | | | | | | | | (_) | |_
6  * |_| |_| |_|\__,_|_| |_| |_| |_|\___/ \__|
7  *
8  * Unit of Strength of Materials and Structural Analysis
9  * University of Innsbruck,
10  * 2020 - today
11  *
12  * festigkeitslehre@uibk.ac.at
13  *
14  * Matthias Neuner matthias.neuner@uibk.ac.at
15  *
16  * This file is part of the MAteRialMOdellingToolbox (marmot).
17  *
18  * This library is free software; you can redistribute it and/or
19  * modify it under the terms of the GNU Lesser General Public
20  * License as published by the Free Software Foundation; either
21  * version 2.1 of the License, or (at your option) any later version.
22  *
23  * The full text of the license can be found in the file LICENSE.md at
24  * the top level directory of marmot.
25  * ---------------------------------------------------------------------
26  */
27 
28 #pragma once
29 
30 #include <algorithm>
32 
51  template < int nDim >
52  void newmarkBetaIntegration( const double* du,
53  double* v,
54  double* a,
55  double dT,
56  double newmarkBeta,
57  double newmarkGamma,
58  double* da_ddu )
59  {
60  for ( int i = 0; i < nDim; i++ ) {
61  dT = std::max( dT, 1e-16 );
62  const double du_tilde = dT * v[i] + 0.5 * dT * dT * ( ( 1 - 2 * newmarkBeta ) * a[i] );
63  const double v_tilde = v[i] + dT * ( 1 - newmarkGamma ) * a[i];
64 
65  a[i] = newmarkBeta != 0 ? ( du[i] - du_tilde ) / ( newmarkBeta * dT * dT ) : 0;
66  da_ddu[i + i * nDim] = newmarkBeta != 0 ? 1. / ( newmarkBeta * dT * dT ) : 0.0;
67  v[i] = v_tilde + newmarkGamma * dT * a[i];
68  }
69  }
70 
71 } // namespace Marmot::TimeIntegration
Marmot::TimeIntegration
Definition: NewmarkBetaIntegrator.h:31
Marmot::FiniteElement::Spatial2D::nDim
constexpr int nDim
Definition: MarmotFiniteElement.h:112
Marmot::TimeIntegration::newmarkBetaIntegration
void newmarkBetaIntegration(const double *du, double *v, double *a, double dT, double newmarkBeta, double newmarkGamma, double *da_ddu)
Newmark-Beta time integration.
Definition: NewmarkBetaIntegrator.h:52