G+Smo  25.01.0
Geometry + Simulation Modules
 
Loading...
Searching...
No Matches
gsElTimeIntegrator.h
Go to the documentation of this file.
1
15#pragma once
16
21
22namespace gismo
23{
24
27template <class T>
29{
30public:
35 gsMassAssembler<T> & massAssembler_);
36
39
41 void setDisplacementVector(const gsMatrix<T> & displacementVector)
42 {
43 GISMO_ENSURE(displacementVector.rows() == massAssembler.numDofs(),
44 "Wrong size of the displacement vector: " + util::to_string(displacementVector.rows()) +
45 ". Must be: " + util::to_string(massAssembler.numDofs()));
46 solVector.middleRows(0,massAssembler.numDofs()) = displacementVector;
47 initialized = false;
48 }
49
50 void setVelocityVector(const gsMatrix<T> & velocityVector)
51 {
52 GISMO_ENSURE(velocityVector.rows() == massAssembler.numDofs(),
53 "Wrong size of the velocity vector: " + util::to_string(velocityVector.rows()) +
54 ". Must be: " + util::to_string(massAssembler.numDofs()));
56 initialized = false;
57 }
58
60 void makeTimeStep(T timeStep);
61
63 using Base::assemble;
64 virtual bool assemble(const gsMatrix<T> & solutionVector,
65 const std::vector<gsMatrix<T> > & fixedDoFs);
66
68 virtual int numDofs() const;
69
71 const gsMatrix<T> & solutionVector() const { return solVector; }
72
74 //const gsMatrix<T> & displacementVector() const { return solVector.middleRows(0,massAssembler.numDofs()); }
75
77 const gsMatrix<T> & velocityVector() const { return velVector; }
78
80 void saveState();
81
83 void recoverState();
84
87
89 void constructSolution(gsMultiPatch<T> & displacement) const;
90
93 void constructSolution(gsMultiPatch<T> & displacement, gsMultiPatch<T> & pressure) const;
94
97 gsBaseAssembler<T> & assembler() { return stiffAssembler; }
98
99protected:
100 void initialize();
101
103 gsMatrix<T> implicitLinear();
104 gsMatrix<T> implicitNonlinear();
105
107 T alpha1() {return 1./m_options.getReal("Beta")/pow(tStep,2); }
108 T alpha2() {return 1./m_options.getReal("Beta")/tStep; }
109 T alpha3() {return (1-2*m_options.getReal("Beta"))/2/m_options.getReal("Beta"); }
110 T alpha4() {return m_options.getReal("Gamma")/m_options.getReal("Beta")/tStep; }
111 T alpha5() {return 1 - m_options.getReal("Gamma")/m_options.getReal("Beta"); }
112 T alpha6() {return (1-m_options.getReal("Gamma")/m_options.getReal("Beta")/2)*tStep; }
113
114protected:
129 using Base::m_system;
130 using Base::m_options;
131 using Base::m_ddof;
136 gsMatrix<T> solVecSaved;
137 gsMatrix<T> velVecSaved;
138 gsMatrix<T> accVecSaved;
139 std::vector<gsMatrix<T> > ddofsSaved;
141 gsMatrix<T> newSolVector, oldVelVector, dispVectorDiff;
142 gsSparseMatrix<T> tempMassBlock;
143};
144
145}
146
147#ifndef GISMO_BUILD_LIB
148#include GISMO_HPP_HEADER(gsElTimeIntegrator.hpp)
149#endif
gsSparseSystem< T > m_system
Global sparse linear system.
Definition gsAssembler.h:290
gsOptionList m_options
Options.
Definition gsAssembler.h:285
std::vector< gsMatrix< T > > m_ddof
Definition gsAssembler.h:295
Extends the gsAssembler class by adding functionality necessary for a general nonlinear solver....
Definition gsBaseAssembler.h:27
virtual void assemble()
Main assemble routine, to be implemented in derived classes.
Definition gsBaseAssembler.h:40
virtual void constructSolution(const gsMatrix< T > &solVector, const std::vector< gsMatrix< T > > &fixedDDofs, gsMultiPatch< T > &result, const gsVector< index_t > &unknowns) const
Constructs solution as a gsMultiPatch object from the solution vector and fixed DoFs.
Definition gsBaseAssembler.hpp:23
Time integation for equations of dynamic elasticity with implicit schemes.
Definition gsElTimeIntegrator.h:29
bool hasSavedState
saved state
Definition gsElTimeIntegrator.h:135
gsMassAssembler< T > & massAssembler
assembler object that generates the mass matrix
Definition gsElTimeIntegrator.h:118
gsElasticityAssembler< T > & stiffAssembler
assembler object that generates the static system
Definition gsElTimeIntegrator.h:116
gsMatrix< T > accVector
vector of acceleration DoFs
Definition gsElTimeIntegrator.h:128
virtual void assemble()
assemble the linear system for the nonlinear solver
Definition gsBaseAssembler.h:40
index_t numIters
number of iterations Newton's method took to converge at the last time step
Definition gsElTimeIntegrator.h:133
const gsMatrix< T > & velocityVector() const
returns vector of displacement DoFs
Definition gsElTimeIntegrator.h:77
index_t numberIterations() const
number of iterations Newton's method required at the last time step
Definition gsElTimeIntegrator.h:86
const gsMatrix< T > & solutionVector() const
returns complete solution vector (displacement + possibly pressure)
Definition gsElTimeIntegrator.h:71
void constructSolution(gsMultiPatch< T > &displacement) const
construct displacement using the stiffness assembler
Definition gsElTimeIntegrator.hpp:159
void setDisplacementVector(const gsMatrix< T > &displacementVector)
set intial conditions
Definition gsElTimeIntegrator.h:41
void makeTimeStep(T timeStep)
make a time step according to a chosen scheme
Definition gsElTimeIntegrator.hpp:65
gsMatrix< T > implicitLinear()
time integraton schemes
Definition gsElTimeIntegrator.hpp:83
void recoverState()
recover solver state from saved state
Definition gsElTimeIntegrator.hpp:185
T tStep
time step length
Definition gsElTimeIntegrator.h:122
gsMatrix< T > solVector
vector of displacement DoFs ( + possibly pressure)
Definition gsElTimeIntegrator.h:124
void saveState()
save solver state
Definition gsElTimeIntegrator.hpp:173
gsBaseAssembler< T > & mAssembler()
assemblers' accessors
Definition gsElTimeIntegrator.h:96
T alpha1()
time integration scheme coefficients
Definition gsElTimeIntegrator.h:107
gsMatrix< T > newSolVector
temporary objects for memory efficiency
Definition gsElTimeIntegrator.h:141
static gsOptionList defaultOptions()
Returns the list of default options for assembly.
Definition gsElTimeIntegrator.hpp:44
bool initialized
initialization flag
Definition gsElTimeIntegrator.h:120
virtual int numDofs() const
return the number of free degrees of freedom
Definition gsElTimeIntegrator.hpp:128
gsMatrix< T > velVector
vector of velocity DoFs
Definition gsElTimeIntegrator.h:126
Assembles the stiffness matrix and the right-hand side vector for linear and nonlinear elasticity for...
Definition gsElasticityAssembler.h:32
Assembles the mass matrix and right-hand side vector for linear and nonlinear elasticity for 2D plain...
Definition gsMassAssembler.h:31
A matrix with arbitrary coefficient type and fixed or dynamic size.
Definition gsMatrix.h:41
Container class for a set of geometry patches and their topology, that is, the interface connections ...
Definition gsMultiPatch.h:100
Class which holds a list of parameters/options, and provides easy access to them.
Definition gsOptionList.h:33
Real getReal(const std::string &label) const
Reads value for option label from options.
Definition gsOptionList.cpp:44
Sparse matrix class, based on gsEigen::SparseMatrix.
Definition gsSparseMatrix.h:139
std::string to_string(const C &value)
Converts value to string, assuming "operator<<" defined on C.
Definition gsUtils.h:56
Base class for assemblers of gsElasticity.
Provides several simple utility and naming classes.
#define index_t
Definition gsConfig.h:32
#define GISMO_ENSURE(cond, message)
Definition gsDebug.h:102
Provides linear and nonlinear elasticity systems for 2D plain strain and 3D continua.
Provides mass matrix for elasticity systems in 2D plain strain and 3D continua.
The G+Smo namespace, containing all definitions for the library.