28 class gsVisitorMixedLinearElasticity
31 gsVisitorMixedLinearElasticity(
const gsPde<T> & pde_)
32 : pde_ptr(static_cast<const gsBasePde<T>*>(&pde_)) {}
34 void initialize(
const gsBasisRefs<T> & basisRefs,
36 const gsOptionList & options,
40 dim = basisRefs.front().dim();
45 T E = options.getReal(
"YoungsModulus");
46 T pr = options.getReal(
"PoissonsRatio");
47 lambda_inv = ( 1. + pr ) * ( 1. - 2. * pr ) / E / pr ;
48 mu = E / ( 2. * ( 1. + pr ) );
49 forceScaling = options.getReal(
"ForceScaling");
50 I = gsMatrix<T>::Identity(dim,dim);
52 globalIndices.resize(dim+1);
53 blockNumbers.resize(dim+1);
56 inline void evaluate(
const gsBasisRefs<T> & basisRefs,
57 const gsGeometry<T> & geo,
58 const gsMatrix<T> & quNodes)
69 basisRefs.front().active_into(quNodes.col(0),localIndicesDisp);
70 N_D = localIndicesDisp.rows();
71 basisRefs.back().active_into(quNodes.col(0), localIndicesPres);
72 N_P = localIndicesPres.rows();
74 basisRefs.front().evalAllDers_into(quNodes,1,basisValuesDisp);
76 basisRefs.back().eval_into(quNodes,basisValuesPres);
78 pde_ptr->rhs()->eval_into(md.values[0],forceValues);
81 inline void assemble(gsDomainIterator<T> & element,
82 const gsVector<T> & quWeights)
85 localMat.setZero(dim*N_D + N_P, dim*N_D + N_P);
86 localRhs.setZero(dim*N_D + N_P,1);
88 symmetricIdentityTensor<T>(C,I);
91 for (
index_t q = 0; q < quWeights.rows(); ++q)
94 const T weight = quWeights[q] * md.measure(q);
97 transformGradients(md, q, basisValuesDisp[1], physGradDisp);
99 for (
index_t i = 0; i < N_D; i++)
101 setB<T>(B_i,I,physGradDisp.col(i));
102 tempK = B_i.transpose() * C;
104 for (
index_t j = 0; j < N_D; j++)
106 setB<T>(B_j,I,physGradDisp.col(j));
109 for (
short_t di = 0; di < dim; ++di)
110 for (
short_t dj = 0; dj < dim; ++dj)
111 localMat(di*N_D+i, dj*N_D+j) += weight * K(di,dj);
115 for (
short_t d = 0; d < dim; ++d)
117 block = weight*basisValuesPres.col(q)*physGradDisp.row(d);
118 localMat.block(dim*N_D,d*N_D,N_P,N_D) += block.block(0,0,N_P,N_D);
119 localMat.block(d*N_D,dim*N_D,N_D,N_P) += block.transpose().block(0,0,N_D,N_P);
123 if (
abs(lambda_inv) > 0)
124 localMat.block(dim*N_D,dim*N_D,N_P,N_P) -=
125 (weight*lambda_inv*basisValuesPres.col(q)*basisValuesPres.col(q).transpose()).block(0,0,N_P,N_P);
128 for (
short_t d = 0; d < dim; ++d)
129 localRhs.middleRows(d*N_D,N_D).noalias() += weight * forceScaling * forceValues(d,q) * basisValuesDisp[0].col(q) ;
133 inline void localToGlobal(
const int patchIndex,
134 const std::vector<gsMatrix<T> > & eliminatedDofs,
135 gsSparseSystem<T> & system)
138 for (
short_t d = 0; d < dim; ++d)
140 system.mapColIndices(localIndicesDisp,patchIndex,globalIndices[d],d);
141 blockNumbers.at(d) = d;
144 system.mapColIndices(localIndicesPres, patchIndex, globalIndices[dim], dim);
145 blockNumbers.at(dim) = dim;
147 system.pushToRhs(localRhs,globalIndices,blockNumbers);
148 system.pushToMatrix(localMat,globalIndices,eliminatedDofs,blockNumbers,blockNumbers);
154 const gsBasePde<T> * pde_ptr;
156 T lambda_inv, mu, forceScaling;
160 gsMatrix<T> localMat;
161 gsMatrix<T> localRhs;
163 gsMatrix<index_t> localIndicesDisp;
164 gsMatrix<index_t> localIndicesPres;
169 std::vector<gsMatrix<T> > basisValuesDisp;
172 gsMatrix<T> basisValuesPres;
174 gsMatrix<T> forceValues;
177 gsMatrix<T> C, physGradDisp, B_i, tempK, B_j, K, block, I;
179 std::vector< gsMatrix<index_t> > globalIndices;
180 gsVector<index_t> blockNumbers;
#define short_t
Definition: gsConfig.h:35
#define index_t
Definition: gsConfig.h:32
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.