-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathgsElasticityAssembler.h
140 lines (107 loc) · 5.84 KB
/
gsElasticityAssembler.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
/** @file gsElasticityAssembler.h
@brief Provides linear and nonlinear elasticity systems for 2D plain strain and 3D continua.
This file is part of the G+Smo library.
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
Author(s):
O. Weeger (2012 - 2015, TU Kaiserslautern),
A.Shamanskiy (2016 - ...., TU Kaiserslautern)
*/
#pragma once
#include <gsElasticity/gsBaseAssembler.h>
#include <gsElasticity/gsElasticityFunctions.h>
#include <gsElasticity/gsBaseUtils.h>
namespace gismo
{
/** @brief Assembles the stiffness matrix and the right-hand side vector for linear and nonlinear elasticity
for 2D plain stress and 3D continua. The matrix and vector have a block structure associated with
components of the displacement vector, each block corresponding to one component.
Supports mixed displacement-pressure formulation.
*/
template <class T>
class gsElasticityAssembler : public gsBaseAssembler<T>
{
public:
typedef gsBaseAssembler<T> Base;
/// @brief Constructor for displacement formulation
gsElasticityAssembler(const gsMultiPatch<T> & patches,
const gsMultiBasis<T> & basis,
const gsBoundaryConditions<T> & bconditions,
const gsFunction<T> & body_force);
/// @brief Constructor of mixed formulation (displacement + pressure)
gsElasticityAssembler(const gsMultiPatch<T> & patches,
const gsMultiBasis<T> & basisDisp,
const gsMultiBasis<T> & basisPres,
const gsBoundaryConditions<T> & bconditions,
const gsFunction<T> & body_force);
/// @brief Returns the list of default options for assembly
static gsOptionList defaultOptions();
/// @brief Refresh routine to set dof-mappers
virtual void refresh();
//--------------------- SYSTEM ASSEMBLY ----------------------------------//
/// @brief Assembles the stiffness matrix and the RHS for the LINEAR ELASTICITY
/// set *assembleMatrix* to false to only assemble the RHS;
/// @{
virtual void assemble(bool saveEliminationMatrix);
virtual void assemble() { assemble(false); };
/// @}
/// Assembles the tangential linear system for Newton's method given the current solution
/// in the form of free and fixed/Dirichelt degrees of freedom.
/// Checks if the current solution is valid (Newton's solver can exit safely if invalid).
virtual bool assemble(const gsMatrix<T> & solutionVector,
const std::vector<gsMatrix<T> > & fixedDoFs);
protected:
/// @ brief Assembles the tangential matrix and the residual for a iteration of Newton's method for displacement formulation;
/// set *assembleMatrix* to false to only assemble the residual;
/// ATTENTION: rhs() returns a negative residual (-r) !!!
virtual void assemble(const gsMultiPatch<T> & displacement);
/// @ brief Assembles the tangential matrix and the residual for a iteration of Newton's method for mixed formulation;
/// set *assembleMatrix* to false to only assemble the residual;
/// ATTENTION: rhs() returns a negative residual (-r) !!!
virtual void assemble(const gsMultiPatch<T> & displacement, const gsMultiPatch<T> & pressure);
using Base::assemble;
//--------------------- SOLUTION CONSTRUCTION ----------------------------------//
public:
using Base::constructSolution;
/// @brief Construct displacement from computed solution vector and fixed degrees of freedom
virtual void constructSolution(const gsMatrix<T> & solVector,
const std::vector<gsMatrix<T> > & fixedDoFs,
gsMultiPatch<T> & displacement) const;
/// @brief Construct displacement and pressure from computed solution vector and fixed degrees of freedom
virtual void constructSolution(const gsMatrix<T> & solVector,
const std::vector<gsMatrix<T> > & fixedDoFs,
gsMultiPatch<T> & displacement,
gsMultiPatch<T> & pressure) const;
/// @ brief Construct pressure from computed solution vector
virtual void constructPressure(const gsMatrix<T> & solVector,
const std::vector<gsMatrix<T> > & fixedDoFs,
gsMultiPatch<T> & pressure) const;
//--------------------- SPECIALS ----------------------------------//
/// @brief Construct Cauchy stresses for evaluation or visualization
virtual void constructCauchyStresses(const gsMultiPatch<T> & displacement,
gsPiecewiseFunction<T> & result,
stress_components::components component = stress_components::von_mises) const;
/// @brief Construct Cauchy stresses for evaluation or visualization
virtual void constructCauchyStresses(const gsMultiPatch<T> & displacement,
const gsMultiPatch<T> & pressure,
gsPiecewiseFunction<T> & result,
stress_components::components component = stress_components::von_mises) const;
protected:
/// a custom reserve function to allocate memory for the sparse matrix
virtual void reserve();
protected:
/// Dimension of the problem
/// parametric dim = physical dim = deformation dim
short_t m_dim;
using Base::m_pde_ptr;
using Base::m_bases;
using Base::m_ddof;
using Base::m_options;
using Base::m_system;
using Base::eliminationMatrix;
};
} // namespace gismo ends
#ifndef GISMO_BUILD_LIB
#include GISMO_HPP_HEADER(gsElasticityAssembler.hpp)
#endif