21 #include "libmesh/libmesh.h" 22 #include "libmesh/elem.h" 23 #include "libmesh/dof_map.h" 45 TEST_CASE(
"quad4_linear_structural_inertial_consistent",
46 "[quad],[quad4],[dynamic],[2D],[element]")
49 coords << -1.0, 1.0, 1.0, -1.0,
68 double val_margin = (test_elem.
jacobian_xddot0.array().abs()).mean() * 1.490116119384766e-08;
70 libMesh::out <<
"Jac_xddot0:\n" << test_elem.
jacobian_xddot0 << std::endl;
73 SECTION(
"Inertial Jacobian (mass matrix) finite difference check")
78 val_margin = (test_elem.
jacobian_fd.array().abs()).mean() * 1.490116119384766e-08;
85 SECTION(
"Inertial Jacobian (mass matrix) should be symmetric")
92 SECTION(
"Determinant of undeformed inertial Jacobian (mass matrix) should be zero")
94 REQUIRE(test_elem.
jacobian_xddot0.determinant() == Approx(0.0).margin(1e-06));
98 SECTION(
"Inertial Jacobian (mass matrix) eigenvalues should all be positive")
100 SelfAdjointEigenSolver<RealMatrixX> eigensolver(test_elem.
jacobian_xddot0,
false);
101 RealVectorX eigenvalues = eigensolver.eigenvalues();
102 libMesh::out <<
"Eigenvalues are:\n" << eigenvalues << std::endl;
103 REQUIRE(eigenvalues.minCoeff()>0.0);
109 "[quad],[quad4],[dynamic],[2D],[element]")
112 coords << -1.0, 1.0, 1.0, -1.0,
113 -1.0, -1.0, 1.0, 1.0,
131 double val_margin = (test_elem.
jacobian_xddot0.array().abs()).mean() * 1.490116119384766e-08;
133 libMesh::out <<
"Jac_xddot0:\n" << test_elem.
jacobian_xddot0 << std::endl;
136 SECTION(
"Inertial Jacobian (mass matrix) finite difference check")
141 val_margin = (test_elem.
jacobian_fd.array().abs()).mean() * 1.490116119384766e-08;
148 SECTION(
"Inertial Jacobian (mass matrix) should be symmetric")
155 SECTION(
"Determinant of undeformed inertial Jacobian (mass matrix) should be zero")
157 REQUIRE(test_elem.
jacobian_xddot0.determinant() == Approx(0.0).margin(1e-06));
161 SECTION(
"Inertial Jacobian (mass matrix) eigenvalues should all be positive")
163 SelfAdjointEigenSolver<RealMatrixX> eigensolver(test_elem.
jacobian_xddot0,
false);
164 RealVectorX eigenvalues = eigensolver.eigenvalues();
165 libMesh::out <<
"Eigenvalues are:\n" << eigenvalues << std::endl;
166 REQUIRE(eigenvalues.minCoeff()>0.0);
void approximate_inertial_jacobian_with_finite_difference(MAST::StructuralElementBase &elem, const RealVectorX &initial_elem_solution, RealMatrixX &jacobian)
Approximates the inertial jacobian using a 6th order accurate central finite difference scheme...
libMesh::Elem * reference_elem
Pointer to the actual libMesh element object.
RealMatrixX jacobian_xddot0
Matrix storage for acceleration Jacobian of baseline/undeformed element.
void set_diagonal_mass_matrix(bool m)
sets the mass matrix to be diagonal or consistent
RealVectorX elem_solution
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
libMesh::LibMeshInit * p_global_init
std::vector< double > eigen_matrix_to_std_vector(RealMatrixX M)
Converts an Eigen Matrix object to a std::vector.
Matrix< Real, Dynamic, Dynamic > RealMatrixX
void update_inertial_residual_and_jacobian0()
TEST_CASE("quad4_linear_structural_inertial_consistent", "[quad],[quad4],[dynamic],[2D],[element]")
Matrix< Real, Dynamic, 1 > RealVectorX
void set_bending_model(MAST::BendingOperatorType b)
returns the bending model to be used for the 2D element
bool if_diagonal_mass_matrix() const
returns the type of strain to be used for this element
MAST::StructuralElement2D * elem
RealMatrixX jacobian_fd
Matrix storage for element Jacobian approximated by finite difference.