21 #include "libmesh/libmesh.h" 22 #include "libmesh/elem.h" 23 #include "libmesh/dof_map.h" 45 TEST_CASE(
"edge2_linear_extension_bending_structural",
46 "[1D][structural][edge][edge2][linear]")
49 coords << -1.0, 1.0, 0.0,
66 double val_margin = (test_elem.
jacobian0.array().abs()).mean() * 1.490116119384766e-08;
68 libMesh::out <<
"J =\n" << test_elem.
jacobian0 << std::endl;
71 SECTION(
"Internal Jacobian (stiffness matrix) finite difference check")
76 val_margin = (test_elem.
jacobian_fd.array().abs()).mean() * 1.490116119384766e-08;
83 SECTION(
"Internal Jacobian (stiffness matrix) should be symmetric")
90 SECTION(
"Determinant of undeformed internal Jacobian (stiffness matrix) should be zero")
92 REQUIRE(test_elem.
jacobian0.determinant() == Approx(0.0).margin(1e-06));
96 SECTION(
"Internal Jacobian (stiffness matrix) eigenvalue check")
106 Real eps = 1.4901161193847656e-07;
107 SelfAdjointEigenSolver<RealMatrixX> eigensolver(test_elem.
jacobian0,
false);
108 RealVectorX eigenvalues = eigensolver.eigenvalues();
109 libMesh::out <<
"Eigenvalues are:\n" << eigenvalues << std::endl;
111 for (uint i=0; i<eigenvalues.size(); i++)
113 if (std::abs(eigenvalues(i))<
eps)
118 libMesh::out <<
"Eigenvalues:\n" << eigenvalues << std::endl;
124 REQUIRE(eigenvalues.minCoeff()>(-
eps));
128 SECTION(
"Internal Jacobian (stiffness matrix) is invariant to section orientation")
132 orientation(2) = 1.0;
142 SECTION(
"Internal Jacobian (stiffness matrix) is invariant to displacement solution")
145 elem_sol << 0.05727841, 0.08896581, 0.09541619, -0.03774913,
146 0.07510557, -0.07122266, -0.00979117, -0.08300009,
147 -0.03453369, -0.05487761, -0.01407677, -0.09268421;
156 SECTION(
"Internal Jacobian (stiffness matrix) is invariant to element x-location")
159 1.0, 1.0, 0.0, 0.0, 0.0);
168 SECTION(
"Internal Jacobian (stiffness matrix) is invariant to element y-location")
171 1.0, 1.0, 0.0, 0.0, 0.0);
180 SECTION(
"Internal Jacobian (stiffness matrix) is invariant to element z-location")
183 1.0, 1.0, 0.0, 0.0, 0.0);
192 SECTION(
"Internal Jacobian (stiffness matrix) checks for element aligned along y-axis")
200 new_coordinates << 0.0, 0.0, -1.0, 1.0, 0.0, 0.0;
207 val_margin = (test_elem.
jacobian_fd.array().abs()).mean() * 1.490116119384766e-08;
216 REQUIRE(test_elem.
jacobian.determinant() == Approx(0.0).margin(1e-06));
220 SECTION(
"Internal Jacobian (stiffness matrix) checks for element aligned along z-axis")
228 new_coordinates << 0.0, 0.0, 0.0, 0.0, -1.0, 1.0;
236 val_margin = (test_elem.
jacobian_fd.array().abs()).mean() * 1.490116119384766e-08;
245 REQUIRE(test_elem.
jacobian.determinant() == Approx(0.0).margin(1e-06));
249 SECTION(
"Internal Jacobian (stiffness matrix) checks for element rotated about z-axis")
253 1.0, 1.0, 0.0, 0.0, 63.4);
259 val_margin = (test_elem.
jacobian_fd.array().abs()).mean() * 1.490116119384766e-08;
268 REQUIRE(test_elem.
jacobian.determinant() == Approx(0.0).margin(1e-06));
272 SECTION(
"Internal Jacobian (stiffness matrix) checks for element rotated about y-axis")
276 1.0, 1.0, 0.0, 35.8, 0.0);
282 val_margin = (test_elem.
jacobian_fd.array().abs()).mean() * 1.490116119384766e-08;
291 REQUIRE(test_elem.
jacobian.determinant() == Approx(0.0).margin(1e-06));
295 SECTION(
"Internal Jacobian (stiffness matrix) checks for element stretched in x-direction")
298 3.2, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0);
304 val_margin = (test_elem.
jacobian_fd.array().abs()).mean() * 1.490116119384766e-08;
313 REQUIRE(test_elem.
jacobian.determinant() == Approx(0.0).margin(1e-06));
317 SECTION(
"Internal Jacobian (stiffness matrix) checks for element arbitrarily scaled, stretched, and rotated")
321 2.7, 6.4, 20.0, 47.8, -70.1);
327 val_margin = (test_elem.
jacobian_fd.array().abs()).mean() * 1.490116119384766e-08;
336 REQUIRE(test_elem.
jacobian.determinant() == Approx(0.0).margin(1e-06));
340 SECTION(
"Internal Jacobian (stiffness matrix) checks for element arbitrarily scaled, stretched, rotated, and displaced")
344 4.2, 1.5, -18.0, -24.8, 30.1);
348 elem_sol << 0.08158724, 0.07991906, -0.00719128, 0.02025461,
349 -0.04602193, 0.05280159, 0.03700081, 0.04636344,
350 0.05559377, 0.06448206, 0.08919238, -0.03079122;
358 val_margin = (test_elem.
jacobian_fd.array().abs()).mean() * 1.490116119384766e-08;
367 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.
virtual void init()
Only used by 1D sections.
RealVectorX elem_solution
libMesh::Elem * reference_elem
Pointer to the actual libMesh element object.
RealVectorX & y_vector()
returns value of the property val.
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...
TEST_CASE("edge2_linear_extension_bending_structural", "[1D][structural][edge][edge2][linear]")
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.
libMesh::ReplicatedMesh mesh
The actual libMesh mesh object.