21 #include "libmesh/libmesh.h" 22 #include "libmesh/elem.h" 23 #include "libmesh/dof_map.h" 46 "[1D][structural][edge][edge2][linear]")
49 coords << -1.0, 1.0, 0.0,
70 double val_margin = (test_elem.
jacobian0.array().abs()).mean() * 1.490116119384766e-08;
72 libMesh::out <<
"J =\n" << test_elem.
jacobian0 << std::endl;
75 SECTION(
"Internal Jacobian (stiffness matrix) finite difference check")
80 val_margin = (test_elem.
jacobian_fd.array().abs()).mean() * 1.490116119384766e-08;
87 SECTION(
"Internal Jacobian (stiffness matrix) should be symmetric")
94 SECTION(
"Determinant of undeformed internal Jacobian (stiffness matrix) should be zero")
96 REQUIRE(test_elem.
jacobian0.determinant() == Approx(0.0).margin(1e-06));
100 SECTION(
"Internal Jacobian (stiffness matrix) eigenvalue check")
111 SelfAdjointEigenSolver<RealMatrixX> eigensolver(test_elem.
jacobian0,
false);
112 RealVectorX eigenvalues = eigensolver.eigenvalues();
114 for (uint i=0; i<eigenvalues.size(); i++)
116 if (std::abs(eigenvalues(i))<1e-10)
126 REQUIRE(eigenvalues.minCoeff()>(-1e-10));
130 SECTION(
"Internal Jacobian (stiffness matrix) is invariant to displacement solution")
133 elem_sol << 0.05727841, 0.08896581, 0.09541619, -0.03774913,
134 0.07510557, -0.07122266, -0.00979117, -0.08300009,
135 -0.03453369, -0.05487761, -0.01407677, -0.09268421;
144 SECTION(
"Internal Jacobian (stiffness matrix) is invariant to element x-location")
147 1.0, 1.0, 0.0, 0.0, 0.0);
156 SECTION(
"Internal Jacobian (stiffness matrix) is invariant to element y-location")
159 1.0, 1.0, 0.0, 0.0, 0.0);
168 SECTION(
"Internal Jacobian (stiffness matrix) is invariant to element z-location")
171 1.0, 1.0, 0.0, 0.0, 0.0);
180 SECTION(
"Internal Jacobian (stiffness matrix) checks for element aligned along y-axis")
188 new_coordinates << 0.0, 0.0, -1.0, 1.0, 0.0, 0.0;
195 val_margin = (test_elem.
jacobian_fd.array().abs()).mean() * 1.490116119384766e-08;
204 REQUIRE(test_elem.
jacobian.determinant() == Approx(0.0).margin(1e-06));
208 SECTION(
"Internal Jacobian (stiffness matrix) checks for element aligned along z-axis")
216 new_coordinates << 0.0, 0.0, 0.0, 0.0, -1.0, 1.0;
223 val_margin = (test_elem.
jacobian_fd.array().abs()).mean() * 1.490116119384766e-08;
232 REQUIRE(test_elem.
jacobian.determinant() == Approx(0.0).margin(1e-06));
236 SECTION(
"Internal Jacobian (stiffness matrix) checks for element rotated about z-axis")
240 1.0, 1.0, 0.0, 0.0, 63.4);
246 val_margin = (test_elem.
jacobian_fd.array().abs()).mean() * 1.490116119384766e-08;
255 REQUIRE(test_elem.
jacobian.determinant() == Approx(0.0).margin(1e-06));
259 SECTION(
"Internal Jacobian (stiffness matrix) checks for element rotated about y-axis")
263 1.0, 1.0, 0.0, 35.8, 0.0);
269 val_margin = (test_elem.
jacobian_fd.array().abs()).mean() * 1.490116119384766e-08;
278 REQUIRE(test_elem.
jacobian.determinant() == Approx(0.0).margin(1e-06));
282 SECTION(
"Internal Jacobian (stiffness matrix) checks for element stretched in x-direction")
285 3.2, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0);
291 val_margin = (test_elem.
jacobian_fd.array().abs()).mean() * 1.490116119384766e-08;
300 REQUIRE(test_elem.
jacobian.determinant() == Approx(0.0).margin(1e-06));
304 SECTION(
"Internal Jacobian (stiffness matrix) checks for element arbitrarily scaled, stretched, and rotated")
308 2.7, 6.4, 20.0, 47.8, -70.1);
314 val_margin = (test_elem.
jacobian_fd.array().abs()).mean() * 1.490116119384766e-08;
323 REQUIRE(test_elem.
jacobian.determinant() == Approx(0.0).margin(1e-06));
327 SECTION(
"Internal Jacobian (stiffness matrix) checks for element arbitrarily scaled, stretched, rotated, and displaced")
331 4.2, 1.5, -18.0, -24.8, 30.1);
335 elem_sol << 0.08158724, 0.07991906, -0.00719128, 0.02025461,
336 -0.04602193, 0.05280159, 0.03700081, 0.04636344,
337 0.05559377, 0.06448206, 0.08919238, -0.03079122;
345 val_margin = (test_elem.
jacobian_fd.array().abs()).mean() * 1.490116119384766e-08;
354 REQUIRE(test_elem.
jacobian.determinant() == Approx(0.0).margin(1e-06));
RealMatrixX jacobian
Matrix storage for Jacobian of the element in a perturbed/modified state.
RealVectorX elem_solution
libMesh::Elem * reference_elem
Pointer to the actual libMesh element object.
TEST_CASE("edge2_linear_extension_structural", "[1D][structural][edge][edge2][linear]")
MAST::StructuralElement1D * elem
MAST::Solid1DSectionElementPropertyCard section
libMesh::LibMeshInit * p_global_init
int n_nodes
Number of nodes per element in the test mesh.
void transform_element(libMesh::MeshBase &mesh, const RealMatrixX X0, Real shift_x, Real shift_y, Real shift_z, Real scale_x, Real scale_y, Real rotation_x, Real rotation_y, Real rotation_z, Real shear_x=0, Real shear_y=0)
Transform an element by applying any combination of: shifts, scales, rotations, and shears...
std::vector< double > eigen_matrix_to_std_vector(RealMatrixX M)
Converts an Eigen Matrix object to a std::vector.
void approximate_internal_jacobian_with_finite_difference(MAST::StructuralElementBase &elem, const RealVectorX &initial_elem_solution, RealMatrixX &jacobian)
Approximates the internal Jacobian of an element using a 6th order accurate central finite difference...
RealMatrixX jacobian0
Matrix storage for Jacobian of baseline/undeformed element.
Matrix< Real, Dynamic, Dynamic > RealMatrixX
RealMatrixX jacobian_fd
Matrix storage for element Jacobian approximated by finite difference.
virtual void set_solution(const RealVectorX &vec, bool if_sens=false)
stores vec as solution for element level calculations, or its sensitivity if if_sens is true...
Matrix< Real, Dynamic, 1 > RealVectorX
void update_residual_and_jacobian0()
void update_residual_and_jacobian()
void update_coordinates(RealMatrixX &new_coordinates)
Update the nodal coordinates in the mesh.
void set_bending_model(MAST::BendingOperatorType b)
returns the bending model to be used for the 2D element
libMesh::ReplicatedMesh mesh
The actual libMesh mesh object.