21 #include "libmesh/libmesh.h" 22 #include "libmesh/elem.h" 23 #include "libmesh/dof_map.h" 45 TEST_CASE(
"quad4_linear_extension_bending_coupling_structural",
46 "[quad],[quad4],[linear],[structural],[2D],[element]")
49 coords << -1.0, 1.0, 1.0, -1.0,
61 test_elem.
kappa = 0.0;
66 double val_margin = (test_elem.
jacobian0.array().abs()).mean() * 1.490116119384766e-08;
69 SECTION(
"Internal Jacobian (stiffness matrix) finite difference check")
74 val_margin = (test_elem.
jacobian_fd.array().abs()).mean() * 1.490116119384766e-08;
81 SECTION(
"Internal Jacobian (stiffness matrix) should be symmetric")
88 SECTION(
"Determinant of undeformed internal Jacobian (stiffness matrix) should be zero")
90 REQUIRE(test_elem.
jacobian0.determinant() == Approx(0.0).margin(1e-06));
94 SECTION(
"Internal Jacobian (stiffness matrix) is invariant to displacement solution")
97 elem_sol << -0.04384355, 0.03969142, -0.09470648, -0.05011107,
98 -0.02989082, -0.01205296, 0.08846868, 0.04522207,
99 0.06435953, -0.07282706, 0.09307561, -0.06250143,
100 0.03332844, -0.00040089, -0.00423108, -0.07258241,
101 0.06636534, -0.08421098, -0.0705489 , -0.06004976,
102 0.03873095, -0.09194373, 0.00055061, 0.046831;
111 SECTION(
"Internal Jacobian (stiffness matrix) is invariant to element x-location")
114 1.0, 1.0, 0.0, 0.0, 0.0);
123 SECTION(
"Internal Jacobian (stiffness matrix) is invariant to element y-location")
126 1.0, 1.0, 0.0, 0.0, 0.0);
135 SECTION(
"Internal Jacobian (stiffness matrix) is invariant to element z-location")
138 1.0, 1.0, 0.0, 0.0, 0.0);
147 SECTION(
"Internal Jacobian (stiffness matrix) checks for element rotated about z-axis")
151 1.0, 1.0, 0.0, 0.0, 63.4);
157 val_margin = (test_elem.
jacobian_fd.array().abs()).mean() * 1.490116119384766e-08;
166 REQUIRE(test_elem.
jacobian.determinant() == Approx(0.0).margin(1e-06));
170 SECTION(
"Internal Jacobian (stiffness matrix) checks for element rotated about y-axis")
174 1.0, 1.0, 0.0, 35.8, 0.0);
180 val_margin = (test_elem.
jacobian_fd.array().abs()).mean() * 1.490116119384766e-08;
189 REQUIRE(test_elem.
jacobian.determinant() == Approx(0.0).margin(1e-06));
193 SECTION(
"Internal Jacobian (stiffness matrix) checks for element rotated about x-axis")
197 1.0, 1.0, 15.8, 0.0, 0.0);
203 val_margin = (test_elem.
jacobian_fd.array().abs()).mean() * 1.490116119384766e-08;
212 REQUIRE(test_elem.
jacobian.determinant() == Approx(0.0).margin(1e-06));
216 SECTION(
"\"Internal Jacobian (stiffness matrix) checks for element sheared in x-direction\"")
220 1.0, 1.0, 0.0, 0.0, 0.0, 6.7, 0.0);
226 val_margin = (test_elem.
jacobian_fd.array().abs()).mean() * 1.490116119384766e-08;
235 REQUIRE(test_elem.
jacobian.determinant() == Approx(0.0).margin(1e-06));
239 SECTION(
"\"Internal Jacobian (stiffness matrix) checks for element sheared in y-direction\"")
243 1.0, 1.0, 0.0, 0.0, 0.0, 0.0, -11.2);
249 val_margin = (test_elem.
jacobian_fd.array().abs()).mean() * 1.490116119384766e-08;
258 REQUIRE(test_elem.
jacobian.determinant() == Approx(0.0).margin(1e-06));
262 SECTION(
"Internal Jacobian (stiffness matrix) checks for element stretched in x-direction")
265 3.2, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0);
271 val_margin = (test_elem.
jacobian_fd.array().abs()).mean() * 1.490116119384766e-08;
280 REQUIRE(test_elem.
jacobian.determinant() == Approx(0.0).margin(1e-06));
283 SECTION(
"Internal Jacobian (stiffness matrix) checks for element stretched in y-direction")
286 1.0, 0.64, 0.0, 0.0, 0.0, 0.0, 0.0);
292 val_margin = (test_elem.
jacobian_fd.array().abs()).mean() * 1.490116119384766e-08;
301 REQUIRE(test_elem.
jacobian.determinant() == Approx(0.0).margin(1e-06));
305 SECTION(
"Internal Jacobian (stiffness matrix) checks for element arbitrarily scaled, stretched, rotated, and sheared")
309 2.7, 6.4, 20.0, 47.8, -70.1, 5.7, -6.3);
315 val_margin = (test_elem.
jacobian_fd.array().abs()).mean() * 1.490116119384766e-08;
324 REQUIRE(test_elem.
jacobian.determinant() == Approx(0.0).margin(1e-06));
328 SECTION(
"Internal Jacobian (stiffness matrix) checks for element arbitrarily scaled, stretched, rotated, and displaced")
336 elem_sol << -0.04384355, 0.03969142, -0.09470648, -0.05011107,
337 -0.02989082, -0.01205296, 0.08846868, 0.04522207,
338 0.06435953, -0.07282706, 0.09307561, -0.06250143,
339 0.03332844, -0.00040089, -0.00423108, -0.07258241,
340 0.06636534, -0.08421098, -0.0705489 , -0.06004976,
341 0.03873095, -0.09194373, 0.00055061, 0.046831;
349 val_margin = (test_elem.
jacobian_fd.array().abs()).mean() * 1.490116119384766e-08;
358 REQUIRE(test_elem.
jacobian.determinant() == Approx(0.0).margin(1e-06));
libMesh::LibMeshInit * p_global_init
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()
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...
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
TEST_CASE("quad4_linear_extension_bending_coupling_structural", "[quad],[quad4],[linear],[structural],[2D],[element]")
MAST::Parameter kappa
Shear coefficient.
libMesh::ReplicatedMesh mesh
The actual libMesh mesh object.
RealMatrixX jacobian_fd
Matrix storage for element Jacobian approximated by finite difference.