28 class gsVisitorNonLinearElasticity
31 gsVisitorNonLinearElasticity(
const gsPde<T> & pde_,
const gsMultiPatch<T> & displacement_)
32 : pde_ptr(static_cast<const gsBasePde<T>*>(&pde_)),
33 displacement(displacement_) { }
35 void initialize(
const gsBasisRefs<T> & basisRefs,
37 const gsOptionList & options,
41 dim = basisRefs.front().dim();
46 materialLaw = options.getInt(
"MaterialLaw");
47 T YM = options.getReal(
"YoungsModulus");
48 T PR = options.getReal(
"PoissonsRatio");
49 lambda = YM * PR / ( ( 1. + PR ) * ( 1. - 2. * PR ) );
50 mu = YM / ( 2. * ( 1. + PR ) );
51 forceScaling = options.getReal(
"ForceScaling");
52 localStiffening = options.getReal(
"LocalStiff");
54 I = gsMatrix<T>::Identity(dim,dim);
57 matrixTraceTensor<T>(C,I,I);
59 symmetricIdentityTensor<T>(Ctemp,I);
63 globalIndices.resize(dim);
64 blockNumbers.resize(dim);
67 inline void evaluate(
const gsBasisRefs<T> & basisRefs,
68 const gsGeometry<T> & geo,
69 const gsMatrix<T> & quNodes)
80 basisRefs.front().active_into(quNodes.col(0),localIndicesDisp);
81 N_D = localIndicesDisp.rows();
83 basisRefs.front().evalAllDers_into(quNodes,1,basisValuesDisp);
85 pde_ptr->rhs()->eval_into(md.values[0],forceValues);
87 mdDisplacement.points = quNodes;
91 displacement.patch(patch).computeMap(mdDisplacement);
94 inline void assemble(gsDomainIterator<T> & element,
95 const gsVector<T> & quWeights)
98 localMat.setZero(dim*N_D,dim*N_D);
99 localRhs.setZero(dim*N_D,1);
101 for (
index_t q = 0; q < quWeights.rows(); ++q)
103 const T weightForce = quWeights[q] * md.measure(q);
105 transformGradients(md,q,basisValuesDisp[1],physGrad);
107 physDispJac = mdDisplacement.jacobian(q)*(md.jacobian(q).cramerInverse());
111 T J = F.determinant();
113 RCG = F.transpose() * F;
116 const T weightBody = quWeights[q] * pow(md.measure(q),-1.*localStiffening) * md.measure(q);
118 if (materialLaw == 0)
119 S = lambda*E.trace()*I + 2*mu*E;
120 if (materialLaw == 1)
123 RCGinv = RCG.cramerInverse();
124 S = (lambda*log(J)-mu)*RCGinv + mu*I;
126 matrixTraceTensor<T>(C,RCGinv,RCGinv);
128 symmetricIdentityTensor<T>(Ctemp,RCGinv);
129 C += (mu-lambda*log(J))*Ctemp;
131 if (materialLaw == 2)
133 RCGinv = RCG.cramerInverse();
134 S = (lambda*(J*J-1)/2-mu)*RCGinv + mu*I;
136 matrixTraceTensor<T>(C,RCGinv,RCGinv);
138 symmetricIdentityTensor<T>(Ctemp,RCGinv);
139 C += (mu-lambda*(J*J-1)/2)*Ctemp;
142 for (
index_t i = 0; i < N_D; i++)
145 setB<T>(B_i,F,physGrad.col(i));
146 materialTangentTemp = B_i.transpose() * C;
148 geometricTangentTemp = S * physGrad.col(i);
150 for (
index_t j = 0; j < N_D; j++)
152 setB<T>(B_j,F,physGrad.col(j));
154 materialTangent = materialTangentTemp * B_j;
155 T geometricTangent = geometricTangentTemp.transpose() * physGrad.col(j);
157 for (
short_t d = 0; d < dim; ++d)
158 materialTangent(d,d) += geometricTangent;
160 for (
short_t di = 0; di < dim; ++di)
161 for (
short_t dj = 0; dj < dim; ++dj)
162 localMat(di*N_D+i, dj*N_D+j) += weightBody * materialTangent(di,dj);
165 voigtStress<T>(Svec,S);
167 localResidual = B_i.transpose() * Svec;
168 for (
short_t d = 0; d < dim; d++)
169 localRhs(d*N_D+i) -= weightBody * localResidual(d);
172 for (
short_t d = 0; d < dim; ++d)
173 localRhs.middleRows(d*N_D,N_D).noalias() += weightForce * forceScaling * forceValues(d,q) * basisValuesDisp[0].col(q);
177 inline void localToGlobal(
const int patchIndex,
178 const std::vector<gsMatrix<T> > & eliminatedDofs,
179 gsSparseSystem<T> & system)
182 for (
short_t d = 0; d < dim; ++d)
184 system.mapColIndices(localIndicesDisp, patchIndex, globalIndices[d], d);
185 blockNumbers.at(d) = d;
188 system.pushToRhs(localRhs,globalIndices,blockNumbers);
189 system.pushToMatrix(localMat,globalIndices,eliminatedDofs,blockNumbers,blockNumbers);
196 const gsBasePde<T> * pde_ptr;
199 T lambda, mu, forceScaling;
203 gsMatrix<T> localMat;
204 gsMatrix<T> localRhs;
206 gsMatrix<index_t> localIndicesDisp;
211 std::vector<gsMatrix<T> > basisValuesDisp;
213 gsMatrix<T> forceValues;
215 const gsMultiPatch<T> & displacement;
217 gsMapData<T> mdDisplacement;
220 gsMatrix<T> C, Ctemp, physGrad, physDispJac, F, RCG, E, S, RCGinv, B_i, materialTangentTemp, B_j, materialTangent, I;
221 gsVector<T> geometricTangentTemp, Svec, localResidual;
224 std::vector< gsMatrix<index_t> > globalIndices;
225 gsVector<index_t> blockNumbers;
Gradient of the object.
Definition: gsForwardDeclarations.h:73
#define short_t
Definition: gsConfig.h:35
#define index_t
Definition: gsConfig.h:32
#define GISMO_ENSURE(cond, message)
Definition: gsDebug.h:102
static gsQuadRule< T > get(const gsBasis< T > &basis, const gsOptionList &options, short_t fixDir=-1)
Constructs a quadrature rule based on input options.
Definition: gsQuadrature.h:48
Creates a variety of quadrature rules.
IMHO, a useless class, but it is necessary to use the gsAssembler class. Contains proper information ...
The density of the measure pull back.
Definition: gsForwardDeclarations.h:76
Tensor operations for elasticity.
Value of the object.
Definition: gsForwardDeclarations.h:72
Gradient transformation matrix.
Definition: gsForwardDeclarations.h:77
This object is a cache for computed values from an evaluator.