28 class gsVisitorMixedNonLinearElasticity
31 gsVisitorMixedNonLinearElasticity(
const gsPde<T> & pde_,
const gsMultiPatch<T> & displacement_,
32 const gsMultiPatch<T> & pressure_)
33 : pde_ptr(static_cast<const gsBasePde<T>*>(&pde_)),
34 displacement(displacement_),
37 void initialize(
const gsBasisRefs<T> & basisRefs,
39 const gsOptionList & options,
43 dim = basisRefs.front().dim();
49 T YM = options.getReal(
"YoungsModulus");
50 T PR = options.getReal(
"PoissonsRatio");
51 lambda_inv = ( 1. + PR ) * ( 1. - 2. * PR ) / YM / PR ;
52 mu = YM / ( 2. * ( 1. + PR ) );
53 forceScaling = options.getReal(
"ForceScaling");
54 I = gsMatrix<T>::Identity(dim,dim);
56 globalIndices.resize(dim+1);
57 blockNumbers.resize(dim+1);
60 inline void evaluate(
const gsBasisRefs<T> & basisRefs,
61 const gsGeometry<T> & geo,
62 const gsMatrix<T> & quNodes)
73 basisRefs.front().active_into(quNodes.col(0),localIndicesDisp);
74 N_D = localIndicesDisp.rows();
75 basisRefs.back().active_into(quNodes.col(0), localIndicesPres);
76 N_P = localIndicesPres.rows();
78 basisRefs.front().evalAllDers_into(quNodes,1,basisValuesDisp);
80 basisRefs.back().eval_into(quNodes,basisValuesPres);
82 pde_ptr->rhs()->eval_into(md.values[0],forceValues);
84 mdDisplacement.points = quNodes;
88 displacement.patch(patch).computeMap(mdDisplacement);
91 pressure.patch(patch).eval_into(quNodes,pressureValues);
94 inline void assemble(gsDomainIterator<T> & element,
95 const gsVector<T> & quWeights)
98 localMat.setZero(dim*N_D + N_P, dim*N_D + N_P);
99 localRhs.setZero(dim*N_D + N_P,1);
101 for (
index_t q = 0; q < quWeights.rows(); ++q)
104 const T weight = quWeights[q] * md.measure(q);
106 transformGradients(md,q,basisValuesDisp[1],physGradDisp);
108 physDispJac = mdDisplacement.jacobian(q)*(md.jacobian(q).cramerInverse());
112 T J = F.determinant();
114 RCG = F.transpose() * F;
117 RCGinv = RCG.cramerInverse();
119 S = (pressureValues.at(q)-mu)*RCGinv + mu*I;
121 symmetricIdentityTensor<T>(C,RCGinv);
122 C *= mu-pressureValues.at(q);
124 for (
index_t i = 0; i < N_D; i++)
126 setB<T>(B_i,F,physGradDisp.col(i));
127 materialTangentTemp = B_i.transpose() * C;
129 geometricTangentTemp = S * physGradDisp.col(i);
131 for (
index_t j = 0; j < N_D; j++)
133 setB<T>(B_j,F,physGradDisp.col(j));
134 materialTangent = materialTangentTemp * B_j;
135 T geometricTangent = geometricTangentTemp.transpose() * physGradDisp.col(j);
137 for (
short_t d = 0; d < dim; ++d)
138 materialTangent(d,d) += geometricTangent;
140 for (
short_t di = 0; di < dim; ++di)
141 for (
short_t dj = 0; dj < dim; ++dj)
142 localMat(di*N_D+i, dj*N_D+j) += weight * materialTangent(di,dj);
146 voigtStress<T>(Svec,S);
148 localResidual = B_i.transpose() * Svec;
149 for (
short_t d = 0; d < dim; d++)
150 localRhs(d*N_D+i) -= weight * localResidual(d);
153 divV = F.cramerInverse().transpose() * physGradDisp;
154 for (
short_t d = 0; d < dim; ++d)
156 block = weight*basisValuesPres.col(q)*divV.row(d);
157 localMat.block(dim*N_D,d*N_D,N_P,N_D) += block.block(0,0,N_P,N_D);
158 localMat.block(d*N_D,dim*N_D,N_D,N_P) += block.transpose().block(0,0,N_D,N_P);
161 if (
abs(lambda_inv) > 0)
162 localMat.block(dim*N_D,dim*N_D,N_P,N_P) -=
163 (weight*lambda_inv*basisValuesPres.col(q)*basisValuesPres.col(q).transpose()).block(0,0,N_P,N_P);
165 localRhs.middleRows(dim*N_D,N_P) += weight*basisValuesPres.col(q)*(lambda_inv*pressureValues.at(q)-log(J));
167 for (
short_t d = 0; d < dim; ++d)
168 localRhs.middleRows(d*N_D,N_D).noalias() += weight * forceScaling * forceValues(d,q) * basisValuesDisp[0].col(q) ;
172 inline void localToGlobal(
const int patchIndex,
173 const std::vector<gsMatrix<T> > & eliminatedDofs,
174 gsSparseSystem<T> & system)
177 for (
short_t d = 0; d < dim; ++d)
179 system.mapColIndices(localIndicesDisp,patchIndex,globalIndices[d],d);
180 blockNumbers.at(d) = d;
183 system.mapColIndices(localIndicesPres, patchIndex, globalIndices[dim], dim);
184 blockNumbers.at(dim) = dim;
186 system.pushToRhs(localRhs,globalIndices,blockNumbers);
187 system.pushToMatrix(localMat,globalIndices,eliminatedDofs,blockNumbers,blockNumbers);
193 const gsBasePde<T> * pde_ptr;
196 T lambda_inv, mu, forceScaling;
200 gsMatrix<T> localMat;
201 gsMatrix<T> localRhs;
203 gsMatrix<index_t> localIndicesDisp;
204 gsMatrix<index_t> localIndicesPres;
209 std::vector<gsMatrix<T> > basisValuesDisp;
212 gsMatrix<T> basisValuesPres;
214 gsMatrix<T> forceValues;
216 const gsMultiPatch<T> & displacement;
218 gsMapData<T> mdDisplacement;
220 const gsMultiPatch<T> & pressure;
222 gsMatrix<T> pressureValues;
225 gsMatrix<T> C, Ctemp, physGradDisp, physDispJac, F, RCG, E, S, RCGinv, B_i, materialTangentTemp, B_j, materialTangent, divV, block, I;
226 gsVector<T> geometricTangentTemp, Svec, localResidual;
228 std::vector< gsMatrix<index_t> > globalIndices;
229 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
EIGEN_STRONG_INLINE abs_expr< E > abs(const E &u)
Absolute value.
Definition: gsExpressions.h:4486
Gradient transformation matrix.
Definition: gsForwardDeclarations.h:77
This object is a cache for computed values from an evaluator.