336 #if defined(LIBMESH_HAVE_EIGEN) && defined(LIBMESH_ENABLE_SECOND_DERIVATIVES) 339 libmesh_assert_equal_to (system_name,
"Shell");
353 const bool distributed_load = es.
parameters.
get<
bool> (
"distributed load");
360 0., 0., 0.5 * (1-nu);
361 Hm *= h * E/(1-nu*nu);
368 0., 0., 0.5 * (1-nu);
369 Hf *= h*h*h/12 * E/(1-nu*nu);
373 Hc0 *= h * 5./6*E/(2*(1+nu));
376 Hc1 *= h*h*h/12 * 5./6*E/(2*(1+nu));
382 std::unique_ptr<FEBase> fe (FEBase::build(
dim, fe_type));
384 fe->attach_quadrature_rule (&qrule);
387 const std::vector<Real> & JxW = fe->get_JxW();
391 const std::vector<RealGradient> & dxyzdxi = fe->get_dxyzdxi();
392 const std::vector<RealGradient> & dxyzdeta = fe->get_dxyzdeta();
394 const std::vector<RealGradient> & d2xyzdxi2 = fe->get_d2xyzdxi2();
395 const std::vector<RealGradient> & d2xyzdeta2 = fe->get_d2xyzdeta2();
396 const std::vector<RealGradient> & d2xyzdxideta = fe->get_d2xyzdxideta();
397 const std::vector<std::vector<Real>> & dphidxi = fe->get_dphidxi();
398 const std::vector<std::vector<Real>> & dphideta = fe->get_dphideta();
399 const std::vector<std::vector<Real>> & phi = fe->get_phi();
431 std::vector<dof_id_type> dof_indices;
432 std::vector<std::vector<dof_id_type>> dof_indices_var(6);
436 for (
const auto & elem :
mesh.active_local_element_ptr_range())
439 for (
unsigned int var=0; var<6; var++)
440 dof_map.
dof_indices (elem, dof_indices_var[var], var);
442 const unsigned int n_dofs = dof_indices.size();
443 const unsigned int n_var_dofs = dof_indices_var[0].size();
446 std::vector<Point> nodes;
447 for (
auto i : elem->node_index_range())
448 nodes.push_back(elem->reference_elem()->node_ref(i));
449 fe->reinit (elem, &nodes);
452 MyVector3d X1(elem->node_ref(0)(0), elem->node_ref(0)(1), elem->node_ref(0)(2));
453 MyVector3d X2(elem->node_ref(1)(0), elem->node_ref(1)(1), elem->node_ref(1)(2));
454 MyVector3d X3(elem->node_ref(2)(0), elem->node_ref(2)(1), elem->node_ref(2)(2));
455 MyVector3d X4(elem->node_ref(3)(0), elem->node_ref(3)(1), elem->node_ref(3)(2));
458 std::vector<MyMatrix3d> F0node;
459 std::vector<MyMatrix3d> Qnode;
460 for (
auto i : elem->node_index_range())
463 a1 << dxyzdxi[i](0), dxyzdxi[i](1), dxyzdxi[i](2);
465 a2 << dxyzdeta[i](0), dxyzdeta[i](1), dxyzdeta[i](2);
474 F0node.push_back(
F0);
479 if (std::abs(1.+C)<1e-6)
492 C+1./(1+C)*ny*ny, -1./(1+C)*nx*ny, nx,
493 -1./(1+C)*nx*ny, C+1./(1+C)*nx*nx, ny,
499 Ke.
resize (n_dofs, n_dofs);
500 for (
unsigned int var_i=0; var_i<6; var_i++)
501 for (
unsigned int var_j=0; var_j<6; var_j++)
502 Ke_var[var_i][var_j].reposition (var_i*n_var_dofs, var_j*n_var_dofs, n_var_dofs, n_var_dofs);
505 Fe_w.reposition(2*n_var_dofs,n_var_dofs);
511 for (
unsigned int qp=0; qp<qrule.n_points(); ++qp)
516 a1 << dxyzdxi[qp](0), dxyzdxi[qp](1), dxyzdxi[qp](2);
518 a2 << dxyzdeta[qp](0), dxyzdeta[qp](1), dxyzdeta[qp](2);
530 F0it =
F0.inverse().transpose();
537 if (std::abs(1.+C) < 1e-6)
547 C+1./(1+C)*ny*ny, -1./(1+C)*nx*ny, nx,
548 -1./(1+C)*nx*ny, C+1./(1+C)*nx*nx, ny,
553 C0 = F0it.block<3,2>(0,0).transpose()*Q.block<3,2>(0,0);
556 MyVector3d d2Xdxi2(d2xyzdxi2[qp](0), d2xyzdxi2[qp](1), d2xyzdxi2[qp](2));
557 MyVector3d d2Xdeta2(d2xyzdeta2[qp](0), d2xyzdeta2[qp](1), d2xyzdeta2[qp](2));
558 MyVector3d d2Xdxideta(d2xyzdxideta[qp](0), d2xyzdxideta[qp](1), d2xyzdxideta[qp](2));
563 n.dot(d2Xdxi2), n.dot(d2Xdxideta),
564 n.dot(d2Xdxideta), n.dot(d2Xdeta2);
566 MyVector3d dndxi = -b(0,0)*F0it.col(0) - b(0,1)*F0it.col(1);
567 MyVector3d dndeta = -b(1,0)*F0it.col(0) - b(1,1)*F0it.col(1);
571 F0it.col(1).dot(dndeta), -F0it.col(0).dot(dndeta),
572 -F0it.col(1).dot(dndxi), F0it.col(0).dot(dndxi);
578 Real H = 0.5*(dndxi.dot(F0it.col(0))+dndeta.dot(F0it.col(1)));
581 Real xi = qrule.qp(qp)(0);
582 Real eta = qrule.qp(qp)(1);
592 MyVector3d nA1 = 0.5*(Qnode[0].col(2)+Qnode[1].col(2));
595 MyVector3d nB2 = 0.5*(Qnode[1].col(2)+Qnode[2].col(2));
598 MyVector3d nA2 = 0.5*(Qnode[2].col(2)+Qnode[3].col(2));
601 MyVector3d nB1 = 0.5*(Qnode[3].col(2)+Qnode[0].col(2));
612 MyVector2d AS1A1(-aA1.dot(Qnode[0].col(1)), aA1.dot(Qnode[0].col(0)));
613 MyVector2d AS2A1(-aA1.dot(Qnode[1].col(1)), aA1.dot(Qnode[1].col(0)));
617 MyVector2d AS1A2(-aA2.dot(Qnode[3].col(1)), aA2.dot(Qnode[3].col(0)));
618 MyVector2d AS2A2(-aA2.dot(Qnode[2].col(1)), aA2.dot(Qnode[2].col(0)));
622 MyVector2d AS1B1(-aB1.dot(Qnode[0].col(1)), aB1.dot(Qnode[0].col(0)));
623 MyVector2d AS2B1(-aB1.dot(Qnode[3].col(1)), aB1.dot(Qnode[3].col(0)));
627 MyVector2d AS1B2(-aB2.dot(Qnode[1].col(1)), aB2.dot(Qnode[1].col(0)));
628 MyVector2d AS2B2(-aB2.dot(Qnode[2].col(1)), aB2.dot(Qnode[2].col(0)));
633 std::vector<MyMatrixXd> Bcnode;
636 Bc.block<1,3>(0,0) = -nA1.transpose();
637 Bc.block<1,2>(0,3) = AS1A1.transpose();
638 Bc.block<1,3>(1,0) = -nB1.transpose();
639 Bc.block<1,2>(1,3) = AS1B1.transpose();
640 Bcnode.push_back(Bc);
642 Bc.block<1,3>(0,0) = nA1.transpose();
643 Bc.block<1,2>(0,3) = AS2A1.transpose();
644 Bc.block<1,3>(1,0) = -nB2.transpose();
645 Bc.block<1,2>(1,3) = AS1B2.transpose();
646 Bcnode.push_back(Bc);
648 Bc.block<1,3>(0,0) = nA2.transpose();
649 Bc.block<1,2>(0,3) = AS2A2.transpose();
650 Bc.block<1,3>(1,0) = nB2.transpose();
651 Bc.block<1,2>(1,3) = AS2B2.transpose();
652 Bcnode.push_back(Bc);
654 Bc.block<1,3>(0,0) = -nA2.transpose();
655 Bc.block<1,2>(0,3) = AS1A2.transpose();
656 Bc.block<1,3>(1,0) = nB1.transpose();
657 Bc.block<1,2>(1,3) = AS2B1.transpose();
658 Bcnode.push_back(Bc);
661 for (
unsigned int i=0; i<n_var_dofs; ++i)
664 Real C1i = dphidxi[i][qp]*C0(0,0) + dphideta[i][qp]*C0(1,0);
665 Real C2i = dphidxi[i][qp]*C0(0,1) + dphideta[i][qp]*C0(1,1);
668 B0I = MyMatrixXd::Zero(3, 5);
669 B0I.block<1,3>(0,0) = C1i*Q.col(0).transpose();
670 B0I.block<1,3>(1,0) = C2i*Q.col(1).transpose();
671 B0I.block<1,3>(2,0) = C2i*Q.col(0).transpose()+C1i*Q.col(1).transpose();
674 Real bc1i = dphidxi[i][qp]*bc(0,0) + dphideta[i][qp]*bc(1,0);
675 Real bc2i = dphidxi[i][qp]*bc(0,1) + dphideta[i][qp]*bc(1,1);
677 MyVector2d V1i(-Q.col(0).dot(Qnode[i].col(1)),
678 Q.col(0).dot(Qnode[i].col(0)));
680 MyVector2d V2i(-Q.col(1).dot(Qnode[i].col(1)),
681 Q.col(1).dot(Qnode[i].col(0)));
684 B1I = MyMatrixXd::Zero(3,5);
685 B1I.block<1,3>(0,0) = bc1i*Q.col(0).transpose();
686 B1I.block<1,3>(1,0) = bc2i*Q.col(1).transpose();
687 B1I.block<1,3>(2,0) = bc2i*Q.col(0).transpose()+bc1i*Q.col(1).transpose();
689 B1I.block<1,2>(0,3) = C1i*V1i.transpose();
690 B1I.block<1,2>(1,3) = C2i*V2i.transpose();
691 B1I.block<1,2>(2,3) = C2i*V1i.transpose()+C1i*V2i.transpose();
695 B2I = MyMatrixXd::Zero(3,5);
697 B2I.block<1,2>(0,3) = bc1i*V1i.transpose();
698 B2I.block<1,2>(1,3) = bc2i*V2i.transpose();
699 B2I.block<1,2>(2,3) = bc2i*V1i.transpose()+bc1i*V2i.transpose();
703 Bc0I = C0.transpose()*Bcnode[i];
707 Bc1I = bc.transpose()*Bcnode[i];
710 MyVector2d BdxiI(dphidxi[i][qp],dphideta[i][qp]);
713 for (
unsigned int j=0; j<n_var_dofs; ++j)
717 Real C1j = dphidxi[j][qp]*C0(0,0) + dphideta[j][qp]*C0(1,0);
718 Real C2j = dphidxi[j][qp]*C0(0,1) + dphideta[j][qp]*C0(1,1);
721 B0J = MyMatrixXd::Zero(3,5);
722 B0J.block<1,3>(0,0) = C1j*Q.col(0).transpose();
723 B0J.block<1,3>(1,0) = C2j*Q.col(1).transpose();
724 B0J.block<1,3>(2,0) = C2j*Q.col(0).transpose()+C1j*Q.col(1).transpose();
727 Real bc1j = dphidxi[j][qp]*bc(0,0) + dphideta[j][qp]*bc(1,0);
728 Real bc2j = dphidxi[j][qp]*bc(0,1) + dphideta[j][qp]*bc(1,1);
730 MyVector2d V1j(-Q.col(0).dot(Qnode[j].col(1)),
731 Q.col(0).dot(Qnode[j].col(0)));
733 MyVector2d V2j(-Q.col(1).dot(Qnode[j].col(1)),
734 Q.col(1).dot(Qnode[j].col(0)));
737 B1J = MyMatrixXd::Zero(3,5);
738 B1J.block<1,3>(0,0) = bc1j*Q.col(0).transpose();
739 B1J.block<1,3>(1,0) = bc2j*Q.col(1).transpose();
740 B1J.block<1,3>(2,0) = bc2j*Q.col(0).transpose()+bc1j*Q.col(1).transpose();
742 B1J.block<1,2>(0,3) = C1j*V1j.transpose();
743 B1J.block<1,2>(1,3) = C2j*V2j.transpose();
744 B1J.block<1,2>(2,3) = C2j*V1j.transpose()+C1j*V2j.transpose();
748 B2J = MyMatrixXd::Zero(3,5);
750 B2J.block<1,2>(0,3) = bc1j*V1j.transpose();
751 B2J.block<1,2>(1,3) = bc2j*V2j.transpose();
752 B2J.block<1,2>(2,3) = bc2j*V1j.transpose()+bc1j*V2j.transpose();
756 Bc0J = C0.transpose()*Bcnode[j];
760 Bc1J = bc.transpose()*Bcnode[j];
763 MyVector2d BdxiJ(dphidxi[j][qp], dphideta[j][qp]);
769 local_KIJ = JxW[qp] * (
770 B0I.transpose() * Hm * B0J
771 + B2I.transpose() * Hf * B0J
772 + B0I.transpose() * Hf * B2J
773 + B1I.transpose() * Hf * B1J
774 + 2*H * B0I.transpose() * Hf * B1J
775 + 2*H * B1I.transpose() * Hf * B0J
776 + Bc0I.transpose() * Hc0 * Bc0J
777 + Bc1I.transpose() * Hc1 * Bc1J
778 + 2*H * Bc0I.transpose() * Hc1 * Bc1J
779 + 2*H * Bc1I.transpose() * Hc1 * Bc0J
784 full_local_KIJ = MyMatrixXd::Zero(6, 6);
785 full_local_KIJ.block<5,5>(0,0)=local_KIJ;
796 full_local_KIJ(5,5) =
Real(Hf(0,0)*JxW[qp]*BdI.transpose()*BdJ);
801 TI = MyMatrixXd::Identity(6,6);
802 TI.block<3,3>(3,3) = Qnode[i].transpose();
804 TJ = MyMatrixXd::Identity(6,6);
805 TJ.block<3,3>(3,3) = Qnode[j].transpose();
806 global_KIJ = TI.transpose()*full_local_KIJ*TJ;
811 for (
unsigned int k=0;k<6;k++)
812 for (
unsigned int l=0;l<6;l++)
813 Ke_var[k][l](i,j) += global_KIJ(k,l);
819 if (distributed_load)
822 for (
unsigned int shellface=0; shellface<2; shellface++)
824 std::vector<boundary_id_type> bids;
827 for (std::size_t k=0; k<bids.size(); k++)
829 for (
unsigned int qp=0; qp<qrule.n_points(); ++qp)
830 for (
unsigned int i=0; i<n_var_dofs; ++i)
831 Fe_w(i) -= JxW[qp] * phi[i][qp];
845 if (!distributed_load)
855 for (
const auto & node :
mesh.node_ptr_range())
856 if (((*node) - C).norm() < 1e-3)
857 system.
rhs->
set(node->dof_number(0, 2, 0), -q/4);
863 #endif // defined(LIBMESH_HAVE_EIGEN) && defined(LIBMESH_ENABLE_SECOND_DERIVATIVES) class FEType hides (possibly multiple) FEFamily and approximation orders, thereby enabling specialize...
void constrain_element_matrix_and_vector(DenseMatrix< Number > &matrix, DenseVector< Number > &rhs, std::vector< dof_id_type > &elem_dofs, bool asymmetric_constraint_rows=true) const
Constrains the element matrix and vector.
void dof_indices(const Elem *const elem, std::vector< dof_id_type > &di) const
Manages consistently variables, degrees of freedom, coefficient vectors, matrices and linear solvers ...
void resize(const unsigned int n)
Resize the vector.
virtual void add_vector(const T *v, const std::vector< numeric_index_type > &dof_indices)
Computes , where v is a pointer and each dof_indices[i] specifies where to add value v[i]...
Eigen::Matrix< libMesh::Real, Eigen::Dynamic, Eigen::Dynamic > MyMatrixXd
NumericVector< Number > * rhs
The system matrix.
Order default_quadrature_order() const
void shellface_boundary_ids(const Elem *const elem, const unsigned short int shellface, std::vector< boundary_id_type > &vec_to_fill) const
const BoundaryInfo & get_boundary_info() const
The information about boundary ids on the mesh.
const T_sys & get_system(std::string_view name) const
Eigen::Matrix< libMesh::Real, 3, 3 > MyMatrix3d
This is the MeshBase class.
Defines a dense subvector for use in finite element computations.
This class handles the numbering of degrees of freedom on a mesh.
void libmesh_ignore(const Args &...)
virtual void add_matrix(const DenseMatrix< T > &dm, const std::vector< numeric_index_type > &rows, const std::vector< numeric_index_type > &cols)=0
Add the full matrix dm to the SparseMatrix.
const T & get(std::string_view) const
Defines a dense submatrix for use in Finite Element-type computations.
Eigen::Matrix< libMesh::Real, 2, 2 > MyMatrix2d
virtual void close()=0
Calls the NumericVector's internal assembly routines, ensuring that the values are consistent across ...
const FEType & variable_type(const unsigned int i) const
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
const MeshBase & get_mesh() const
void resize(const unsigned int new_m, const unsigned int new_n)
Resizes the matrix to the specified size and calls zero().
This class implements specific orders of Gauss quadrature.
unsigned int mesh_dimension() const
Parameters parameters
Data structure holding arbitrary parameters.
virtual void set(const numeric_index_type i, const T value)=0
Sets v(i) = value.
Eigen::Matrix< libMesh::Real, 2, 1 > MyVector2d
const DofMap & get_dof_map() const
A Point defines a location in LIBMESH_DIM dimensional Real space.
const SparseMatrix< Number > & get_system_matrix() const
Eigen::Matrix< libMesh::Real, 3, 1 > MyVector3d