forked from gismo/gsKLShell
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgsThinShellFunctions.hpp
138 lines (111 loc) · 4.83 KB
/
gsThinShellFunctions.hpp
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
/** @file gsThinShellFunctions.hpp
@brief Provides evaluation function for stresses.
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):
H.M. Verhelst (2019-..., TU Delft)
*/
#pragma once
#include <gsAssembler/gsExprEvaluator.h>
#include <gsAssembler/gsExprAssembler.h>
namespace gismo
{
template <class T>
void gsShellStressFunction<T>::eval_into(const gsMatrix<T> & u, gsMatrix<T> & result) const
{
result.setZero(targetDim(),u.cols());
m_assembler.cleanUp();
geometryMap m_ori = m_assembler.getMap(m_patches);
geometryMap m_def = m_assembler.getMap(*m_defpatches);
// Initialize stystem
// m_assembler.initSystem(false);
gsMaterialMatrixIntegrate<T,MaterialOutput::VectorN> m_S0(m_materialMatrices,m_defpatches);
variable S0 = m_assembler.getCoeff(m_S0);
gsMaterialMatrixIntegrate<T,MaterialOutput::VectorM> m_S1(m_materialMatrices,m_defpatches);
variable S1 = m_assembler.getCoeff(m_S1);
gsMaterialMatrixIntegrate<T,MaterialOutput::PStressN> m_Sp0(m_materialMatrices,m_defpatches);
variable Sp0 = m_assembler.getCoeff(m_Sp0);
gsMaterialMatrixIntegrate<T,MaterialOutput::PStressM> m_Sp1(m_materialMatrices,m_defpatches);
variable Sp1 = m_assembler.getCoeff(m_Sp1);
gsMaterialMatrixIntegrate<T,MaterialOutput::Stretch> m_lambda(m_materialMatrices,m_defpatches);
variable lambda = m_assembler.getCoeff(m_lambda);
gsMaterialMatrixIntegrate<T,MaterialOutput::StretchDir> m_lambdadir(m_materialMatrices,m_defpatches);
variable lambdadir = m_assembler.getCoeff(m_lambdadir);
gsFunctionExpr<> mult2t("1","0","0","0","1","0","0","0","2",2);
variable m_m2 = m_assembler.getCoeff(mult2t);
auto That = cartcon(m_ori);
auto Ttilde = cartcov(m_ori);
// auto Tmat = cartcov(m_def);
auto E_m = 0.5 * ( flat(jac(m_def).tr()*jac(m_def)) - flat(jac(m_ori).tr()* jac(m_ori)) ) * That;
auto E_f = ( deriv2(m_ori,sn(m_ori).normalized().tr()) - deriv2(m_def,sn(m_def).normalized().tr()) ) * reshape(m_m2,3,3) * That;
auto S_m = S0.tr() * Ttilde;
auto S_f = S1.tr() * Ttilde;
gsExprEvaluator<T> ev(m_assembler);
gsMatrix<T> tmp;
switch (m_stress_type)
{
case stress_type::membrane :
for (index_t k = 0; k != u.cols(); ++k)
result.col(k) = (ev.eval(S_m,u.col(k),m_patchID)).transpose();
break;
case stress_type::flexural :
for (index_t k = 0; k != u.cols(); ++k)
result.col(k) = (ev.eval(S_f,u.col(k),m_patchID)).transpose();
break;
// TO BE IMPLEMENTED
// -------------------------------------
case stress_type::von_mises :
break;
case stress_type::von_mises_membrane :
break;
case stress_type::von_mises_flexural :
break;
case stress_type::total :
break;
// -------------------------------------
case stress_type::membrane_strain :
for (index_t k = 0; k != u.cols(); ++k)
result.col(k) = ev.eval(E_m.tr(),u.col(k),m_patchID);
break;
case stress_type::flexural_strain :
for (index_t k = 0; k != u.cols(); ++k)
result.col(k) = ev.eval(E_f.tr(),u.col(k),m_patchID);
break;
case stress_type::principal_stretch :
for (index_t k = 0; k != u.cols(); ++k)
result.col(k) = ev.eval(lambda,u.col(k),m_patchID);
break;
case stress_type::principal_stress_membrane :
for (index_t k = 0; k != u.cols(); ++k)
result.col(k) = ev.eval(Sp0,u.col(k),m_patchID);
break;
case stress_type::principal_stress_flexural :
for (index_t k = 0; k != u.cols(); ++k)
result.col(k) = ev.eval(Sp1,u.col(k),m_patchID);
break;
case stress_type::principal_stretch_dir1 :
for (index_t k = 0; k != u.cols(); ++k)
{
tmp = ev.eval(lambdadir,u.col(k),m_patchID);
result.col(k) = tmp.reshape(3,3).col(0);
}
break;
case stress_type::principal_stretch_dir2 :
for (index_t k = 0; k != u.cols(); ++k)
{
tmp = ev.eval(lambdadir,u.col(k),m_patchID);
result.col(k) = tmp.reshape(3,3).col(1);
}
break;
case stress_type::principal_stretch_dir3 :
for (index_t k = 0; k != u.cols(); ++k)
{
tmp = ev.eval(lambdadir,u.col(k),m_patchID);
result.col(k) = tmp.reshape(3,3).col(2);
}
break;
}
}
} // namespace gismo ends