20 #define protected public 23 #include "libmesh/libmesh.h" 24 #include "libmesh/elem.h" 25 #include "libmesh/equation_systems.h" 26 #include "libmesh/dof_map.h" 55 TEST_CASE(
"quad4_linear_structural_strain_displacement_matrix",
56 "[quad],[quad4],[linear],][structural],[2D],[element]")
59 coords << -1.0, 1.0, 1.0, -1.0,
74 const uint n_dofs_per_node = 6;
84 const uint n_phi = (
unsigned int)fe->get_phi().size();
86 const uint n2 = 6*n_phi;
107 strain, mat_x, mat_y, Bmat_lin, Bmat_nl_x, Bmat_nl_y, Bmat_nl_u,
125 const std::vector<std::vector<libMesh::RealVectorValue>>& dphi = fe->get_dphi();
127 SECTION(
"Linear in-plane strain displacement matrix size")
129 REQUIRE( Bmat_lin.
m() == 3 );
130 REQUIRE( Bmat_lin.
n() == test_elem.
n_nodes * n_dofs_per_node);
133 SECTION(
"Linear in-plane strain displacement matrix values")
138 uint m = Bmat_lin.
m();
139 uint n = Bmat_lin.
n();
141 for (uint i=0; i<n; i++)
147 Bmat_lin_mat.col(i) = result;
158 RealMatrixX Bmat_lin_true = RealMatrixX::Zero(m,n);
159 for (uint i=0; i<test_elem.
n_nodes; i++)
161 Bmat_lin_true(0,i) = dphi[i][qp](0);
162 Bmat_lin_true(2,i+test_elem.
n_nodes) = dphi[i][qp](0);
164 Bmat_lin_true(1,i+test_elem.
n_nodes) = dphi[i][qp](1);
165 Bmat_lin_true(2,i) = dphi[i][qp](1);
171 REQUIRE_THAT(Bmat_lin_test, Catch::Approx<double>(Bmat_lin_required));
virtual unsigned int n_direct_strain_components()
row dimension of the direct strain matrix, also used for the bending operator row dimension ...
libMesh::Elem * reference_elem
Pointer to the actual libMesh element object.
void reinit(unsigned int n_interpolated_vars, unsigned int n_discrete_vars, unsigned int n_discrete_dofs_per_var)
this initializes the operator for number of rows and variables, assuming that all variables has the s...
RealVectorX elem_solution
MAST::StructuralSystemInitialization structural_system
Real get_shoelace_area(RealMatrixX X)
Calcualtes the area of a 2D polygon using the shoelace formula.
MAST::Solid2DSectionElementPropertyCard section
void set_strain(MAST::StrainType strain)
sets the type of strain to be used, which is LINEAR_STRAIN by default
int n_nodes
Number of nodes per element in the test mesh.
unsigned int n_vars() const
virtual std::unique_ptr< MAST::FEBase > init_fe(bool init_grads, bool init_second_order_derivative, int extra_quadrature_order=0) const
initializes the finite element shape function and quadrature object with the order of quadrature rule...
std::vector< double > eigen_matrix_to_std_vector(RealMatrixX M)
Converts an Eigen Matrix object to a std::vector.
libMesh::LibMeshInit * p_global_init
TEST_CASE("quad4_linear_structural_strain_displacement_matrix", "[quad],[quad4],[linear],][structural],[2D],[element]")
References https://studiumbook.com/properties-of-shape-function-fea/ https://www.ccg.msm.cam.ac.uk/images/FEMOR_Lecture_2.pdf
Matrix< Real, Dynamic, Dynamic > RealMatrixX
Matrix< Real, Dynamic, 1 > RealVectorX
void vector_mult(T &res, const T &v) const
res = [this] * v
MAST::StructuralElement2D * elem
virtual void initialize_green_lagrange_strain_operator(const unsigned int qp, const MAST::FEBase &fe, const RealVectorX &local_disp, RealVectorX &epsilon, RealMatrixX &mat_x, RealMatrixX &mat_y, MAST::FEMOperatorMatrix &Bmat_lin, MAST::FEMOperatorMatrix &Bmat_nl_x, MAST::FEMOperatorMatrix &Bmat_nl_y, MAST::FEMOperatorMatrix &Bmat_nl_u, MAST::FEMOperatorMatrix &Bmat_nl_v)
virtual int extra_quadrature_order(const MAST::GeomElem &elem) const
returns the extra quadrature order (on top of the system) that this element should use...
virtual unsigned int n_von_karman_strain_components()
row dimension of the von Karman strain matrix