21 #include "libmesh/libmesh.h" 22 #include "libmesh/elem.h" 23 #include "libmesh/dof_map.h" 46 "[quad],[quad4],[linear],[structural],[2D],[element]")
49 coords << -1.0, 1.0, 1.0, -1.0,
63 double val_margin = (test_elem.
jacobian0.array().abs()).mean() * 1.490116119384766e-08;
66 SECTION(
"Internal Jacobian (stiffness matrix) finite difference check")
71 val_margin = (test_elem.
jacobian_fd.array().abs()).mean() * 1.490116119384766e-08;
78 SECTION(
"Internal Jacobian (stiffness matrix) should be symmetric")
85 SECTION(
"Determinant of undeformed internal Jacobian (stiffness matrix) should be zero")
87 REQUIRE(test_elem.
jacobian0.determinant() == Approx(0.0).margin(1e-06));
91 SECTION(
"Internal Jacobian (stiffness matrix) is invariant to displacement solution")
94 elem_sol << -0.04384355, 0.03969142, -0.09470648, -0.05011107,
95 -0.02989082, -0.01205296, 0.08846868, 0.04522207,
96 0.06435953, -0.07282706, 0.09307561, -0.06250143,
97 0.03332844, -0.00040089, -0.00423108, -0.07258241,
98 0.06636534, -0.08421098, -0.0705489 , -0.06004976,
99 0.03873095, -0.09194373, 0.00055061, 0.046831;
108 SECTION(
"Internal Jacobian (stiffness matrix) is invariant to element x-location")
111 1.0, 1.0, 0.0, 0.0, 0.0);
120 SECTION(
"Internal Jacobian (stiffness matrix) is invariant to element y-location")
123 1.0, 1.0, 0.0, 0.0, 0.0);
132 SECTION(
"Internal Jacobian (stiffness matrix) is invariant to element z-location")
135 1.0, 1.0, 0.0, 0.0, 0.0);
144 SECTION(
"Internal Jacobian (stiffness matrix) checks for element rotated about z-axis")
148 1.0, 1.0, 0.0, 0.0, 63.4);
154 val_margin = (test_elem.
jacobian_fd.array().abs()).mean() * 1.490116119384766e-08;
163 REQUIRE(test_elem.
jacobian.determinant() == Approx(0.0).margin(1e-06));
167 SECTION(
"Internal Jacobian (stiffness matrix) checks for element rotated about y-axis")
171 1.0, 1.0, 0.0, 35.8, 0.0);
177 val_margin = (test_elem.
jacobian_fd.array().abs()).mean() * 1.490116119384766e-08;
186 REQUIRE(test_elem.
jacobian.determinant() == Approx(0.0).margin(1e-06));
190 SECTION(
"Internal Jacobian (stiffness matrix) checks for element rotated about x-axis")
194 1.0, 1.0, 15.8, 0.0, 0.0);
200 val_margin = (test_elem.
jacobian_fd.array().abs()).mean() * 1.490116119384766e-08;
209 REQUIRE(test_elem.
jacobian.determinant() == Approx(0.0).margin(1e-06));
213 SECTION(
"\"Internal Jacobian (stiffness matrix) checks for element sheared in x-direction\"")
217 1.0, 1.0, 0.0, 0.0, 0.0, 6.7, 0.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 sheared in y-direction\"")
240 1.0, 1.0, 0.0, 0.0, 0.0, 0.0, -11.2);
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 stretched in x-direction")
262 3.2, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0);
268 val_margin = (test_elem.
jacobian_fd.array().abs()).mean() * 1.490116119384766e-08;
277 REQUIRE(test_elem.
jacobian.determinant() == Approx(0.0).margin(1e-06));
280 SECTION(
"Internal Jacobian (stiffness matrix) checks for element stretched in y-direction")
283 1.0, 0.64, 0.0, 0.0, 0.0, 0.0, 0.0);
289 val_margin = (test_elem.
jacobian_fd.array().abs()).mean() * 1.490116119384766e-08;
298 REQUIRE(test_elem.
jacobian.determinant() == Approx(0.0).margin(1e-06));
302 SECTION(
"Internal Jacobian (stiffness matrix) checks for element arbitrarily scaled, stretched, rotated, and sheared")
306 2.7, 6.4, 20.0, 47.8, -70.1, 5.7, -6.3);
312 val_margin = (test_elem.
jacobian_fd.array().abs()).mean() * 1.490116119384766e-08;
321 REQUIRE(test_elem.
jacobian.determinant() == Approx(0.0).margin(1e-06));
325 SECTION(
"Internal Jacobian (stiffness matrix) checks for element arbitrarily scaled, stretched, rotated, and displaced")
333 elem_sol << -0.04384355, 0.03969142, -0.09470648, -0.05011107,
334 -0.02989082, -0.01205296, 0.08846868, 0.04522207,
335 0.06435953, -0.07282706, 0.09307561, -0.06250143,
336 0.03332844, -0.00040089, -0.00423108, -0.07258241,
337 0.06636534, -0.08421098, -0.0705489 , -0.06004976,
338 0.03873095, -0.09194373, 0.00055061, 0.046831;
346 val_margin = (test_elem.
jacobian_fd.array().abs()).mean() * 1.490116119384766e-08;
355 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.
libMesh::Elem * reference_elem
Pointer to the actual libMesh element object.
RealVectorX elem_solution
void update_residual_and_jacobian0()
TEST_CASE("quad4_linear_structural", "[quad],[quad4],[linear],[structural],[2D],[element]")
void update_residual_and_jacobian()
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
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...
libMesh::LibMeshInit * p_global_init
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...
Matrix< Real, Dynamic, Dynamic > RealMatrixX
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...
RealMatrixX jacobian0
Matrix storage for Jacobian of baseline/undeformed element.
Matrix< Real, Dynamic, 1 > RealVectorX
MAST::StructuralElement2D * elem
libMesh::ReplicatedMesh mesh
The actual libMesh mesh object.
RealMatrixX jacobian_fd
Matrix storage for element Jacobian approximated by finite difference.