28class 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,
41 dim = basisRefs.front().dim();
46 T E = options.getReal(
"YoungsModulus");
47 T pr = options.getReal(
"PoissonsRatio");
48 lambda_inv = ( 1. + pr ) * ( 1. - 2. * pr ) / E / pr ;
49 mu = E / ( 2. * ( 1. + pr ) );
50 forceScaling = options.getReal(
"ForceScaling");
51 I = gsMatrix<T>::Identity(dim,dim);
53 globalIndices.resize(dim+1);
54 blockNumbers.resize(dim+1);
57 inline void evaluate(
const gsBasisRefs<T> & basisRefs,
58 const gsGeometry<T> & geo,
59 const gsMatrix<T> & quNodes)
70 basisRefs.front().active_into(quNodes.col(0),localIndicesDisp);
71 N_D = localIndicesDisp.rows();
72 basisRefs.back().active_into(quNodes.col(0), localIndicesPres);
73 N_P = localIndicesPres.rows();
75 basisRefs.front().evalAllDers_into(quNodes,1,basisValuesDisp);
77 basisRefs.back().eval_into(quNodes,basisValuesPres);
79 pde_ptr->rhs()->eval_into(md.values[0],forceValues);
82 inline void assemble(gsDomainIterator<T> & element,
83 const gsVector<T> & quWeights)
87 localMat.setZero(dim*N_D + N_P, dim*N_D + N_P);
88 localRhs.setZero(dim*N_D + N_P,1);
90 symmetricIdentityTensor<T>(C,I);
93 for (
index_t q = 0; q < quWeights.rows(); ++q)
96 const T weight = quWeights[q] * md.measure(q);
99 transformGradients(md, q, basisValuesDisp[1], physGradDisp);
101 for (
index_t i = 0; i < N_D; i++)
103 setB<T>(B_i,I,physGradDisp.col(i));
104 tempK = B_i.transpose() * C;
106 for (
index_t j = 0; j < N_D; j++)
108 setB<T>(B_j,I,physGradDisp.col(j));
111 for (
short_t di = 0; di < dim; ++di)
112 for (
short_t dj = 0; dj < dim; ++dj)
113 localMat(di*N_D+i, dj*N_D+j) += weight * K(di,dj);
117 for (
short_t d = 0; d < dim; ++d)
119 block = weight*basisValuesPres.col(q)*physGradDisp.row(d);
120 localMat.block(dim*N_D,d*N_D,N_P,N_D) += block.block(0,0,N_P,N_D);
121 localMat.block(d*N_D,dim*N_D,N_D,N_P) += block.transpose().block(0,0,N_D,N_P);
125 if (
abs(lambda_inv) > 0)
126 localMat.block(dim*N_D,dim*N_D,N_P,N_P) -=
127 (weight*lambda_inv*basisValuesPres.col(q)*basisValuesPres.col(q).transpose()).block(0,0,N_P,N_P);
130 for (
short_t d = 0; d < dim; ++d)
131 localRhs.middleRows(d*N_D,N_D).noalias() += weight * forceScaling * forceValues(d,q) * basisValuesDisp[0].col(q) ;
135 inline void localToGlobal(
const int patchIndex,
136 const std::vector<gsMatrix<T> > & eliminatedDofs,
137 gsSparseSystem<T> & system)
140 for (
short_t d = 0; d < dim; ++d)
142 system.mapColIndices(localIndicesDisp,patchIndex,globalIndices[d],d);
143 blockNumbers.at(d) = d;
146 system.mapColIndices(localIndicesPres, patchIndex, globalIndices[dim], dim);
147 blockNumbers.at(dim) = dim;
149 system.pushToRhs(localRhs,globalIndices,blockNumbers);
150 system.pushToMatrix(localMat,globalIndices,eliminatedDofs,blockNumbers,blockNumbers);
156 const gsBasePde<T> * pde_ptr;
158 T lambda_inv, mu, forceScaling;
162 gsMatrix<T> localMat;
163 gsMatrix<T> localRhs;
165 gsMatrix<index_t> localIndicesDisp;
166 gsMatrix<index_t> localIndicesPres;
171 std::vector<gsMatrix<T> > basisValuesDisp;
174 gsMatrix<T> basisValuesPres;
176 gsMatrix<T> forceValues;
179 gsMatrix<T> C, physGradDisp, B_i, tempK, B_j, K, block, I;
181 std::vector< gsMatrix<index_t> > globalIndices;
182 gsVector<index_t> blockNumbers;
IMHO, a useless class, but it is necessary to use the gsAssembler class. Contains proper information ...
#define short_t
Definition gsConfig.h:35
#define index_t
Definition gsConfig.h:32
#define GISMO_UNUSED(x)
Definition gsDebug.h:112
This object is a cache for computed values from an evaluator.
Creates a variety of quadrature rules.
Tensor operations for elasticity.
EIGEN_STRONG_INLINE abs_expr< E > abs(const E &u)
Absolute value.
Definition gsExpressions.h:4486
The G+Smo namespace, containing all definitions for the library.
@ NEED_VALUE
Value of the object.
Definition gsForwardDeclarations.h:72
@ NEED_GRAD_TRANSFORM
Gradient transformation matrix.
Definition gsForwardDeclarations.h:77
@ NEED_MEASURE
The density of the measure pull back.
Definition gsForwardDeclarations.h:76
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:51