21 #include "libmesh/libmesh.h" 22 #include "libmesh/elem.h" 23 #include "libmesh/dof_map.h" 45 TEST_CASE(
"edge2_linear_structural_inertial_consistent",
46 "[1D],[dynamic],[edge],[edge2],[element]")
49 coords << -1.0, 1.0, 0.0,
59 double val_margin = (test_elem.
jacobian_xddot0.array().abs()).mean() * 1.490116119384766e-08;
61 libMesh::out <<
"Jac_xddot0:\n" << test_elem.
jacobian_xddot0 << std::endl;
64 SECTION(
"Inertial Jacobian (mass matrix) finite difference check")
69 val_margin = (test_elem.
jacobian_fd.array().abs()).mean() * 1.490116119384766e-08;
76 SECTION(
"Inertial Jacobian (mass matrix) should be symmetric")
83 SECTION(
"Determinant of undeformed inertial Jacobian (mass matrix) should be zero")
85 REQUIRE(test_elem.
jacobian_xddot0.determinant() == Approx(0.0).margin(1e-06));
89 SECTION(
"Inertial Jacobian (mass matrix) eigenvalues should all be positive")
91 SelfAdjointEigenSolver<RealMatrixX> eigensolver(test_elem.
jacobian_xddot0,
false);
92 RealVectorX eigenvalues = eigensolver.eigenvalues();
94 REQUIRE(eigenvalues.minCoeff()>0.0);
99 TEST_CASE(
"edge2_linear_structural_inertial_lumped",
100 "[1D],[dynamic],[edge],[edge2]")
103 coords << -1.0, 1.0, 0.0,
113 double val_margin = (test_elem.
jacobian_xddot0.array().abs()).mean() * 1.490116119384766e-08;
115 libMesh::out <<
"Jac_xddot0:\n" << test_elem.
jacobian_xddot0 << std::endl;
118 SECTION(
"Inertial Jacobian (mass matrix) finite difference check")
123 val_margin = (test_elem.
jacobian_fd.array().abs()).mean() * 1.490116119384766e-08;
130 SECTION(
"Inertial Jacobian (mass matrix) should be symmetric")
137 SECTION(
"Determinant of undeformed inertial Jacobian (mass matrix) should be zero")
139 REQUIRE(test_elem.
jacobian_xddot0.determinant() == Approx(0.0).margin(1e-06));
143 SECTION(
"Inertial Jacobian (mass matrix) eigenvalues should all be positive")
145 SelfAdjointEigenSolver<RealMatrixX> eigensolver(test_elem.
jacobian_xddot0,
false);
146 RealVectorX eigenvalues = eigensolver.eigenvalues();
148 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...
TEST_CASE("edge2_linear_structural_inertial_consistent", "[1D],[dynamic],[edge],[edge2],[element]")
RealVectorX elem_solution
RealMatrixX jacobian_xddot0
Matrix storage for acceleration Jacobian of baseline/undeformed element.
libMesh::Elem * reference_elem
Pointer to the actual libMesh element object.
void set_diagonal_mass_matrix(bool m)
sets the mass matrix to be diagonal or consistent
MAST::StructuralElement1D * elem
MAST::Solid1DSectionElementPropertyCard section
std::vector< double > eigen_matrix_to_std_vector(RealMatrixX M)
Converts an Eigen Matrix object to a std::vector.
Matrix< Real, Dynamic, Dynamic > RealMatrixX
RealMatrixX jacobian_fd
Matrix storage for element Jacobian approximated by finite difference.
Matrix< Real, Dynamic, 1 > RealVectorX
libMesh::LibMeshInit * p_global_init
void update_inertial_residual_and_jacobian0()