21 #include "libmesh/libmesh.h" 22 #include "libmesh/elem.h" 23 #include "libmesh/dof_map.h" 46 "[quad],[quad4],[linear],[structural],[2D]")
49 coords << -1.0, 1.0, 1.0, -1.0,
61 test_elem.
kappa = 0.0;
73 double val_margin = (test_elem.
jacobian0.array().abs()).mean() * 1.490116119384766e-08;
76 SECTION(
"Internal Jacobian (stiffness matrix) finite difference check")
81 val_margin = (test_elem.
jacobian_fd.array().abs()).mean() * 1.490116119384766e-08;
88 SECTION(
"Internal Jacobian (stiffness matrix) should be symmetric")
95 SECTION(
"Determinant of undeformed internal Jacobian (stiffness matrix) should be zero")
97 REQUIRE(test_elem.
jacobian0.determinant() == Approx(0.0).margin(1e-06));
101 SECTION(
"Internal Jacobian (stiffness matrix) is invariant to displacement solution")
104 elem_sol << -0.04384355, 0.03969142, -0.09470648, -0.05011107,
105 -0.02989082, -0.01205296, 0.08846868, 0.04522207,
106 0.06435953, -0.07282706, 0.09307561, -0.06250143,
107 0.03332844, -0.00040089, -0.00423108, -0.07258241,
108 0.06636534, -0.08421098, -0.0705489 , -0.06004976,
109 0.03873095, -0.09194373, 0.00055061, 0.046831;
118 SECTION(
"Internal Jacobian (stiffness matrix) is invariant to element x-location")
121 1.0, 1.0, 0.0, 0.0, 0.0);
130 SECTION(
"Internal Jacobian (stiffness matrix) is invariant to element y-location")
133 1.0, 1.0, 0.0, 0.0, 0.0);
142 SECTION(
"Internal Jacobian (stiffness matrix) is invariant to element z-location")
145 1.0, 1.0, 0.0, 0.0, 0.0);
154 SECTION(
"Internal Jacobian (stiffness matrix) checks for element rotated about z-axis")
158 1.0, 1.0, 0.0, 0.0, 63.4);
164 val_margin = (test_elem.
jacobian_fd.array().abs()).mean() * 1.490116119384766e-08;
173 REQUIRE(test_elem.
jacobian.determinant() == Approx(0.0).margin(1e-06));
177 SECTION(
"Internal Jacobian (stiffness matrix) checks for element rotated about y-axis")
181 1.0, 1.0, 0.0, 35.8, 0.0);
187 val_margin = (test_elem.
jacobian_fd.array().abs()).mean() * 1.490116119384766e-08;
196 REQUIRE(test_elem.
jacobian.determinant() == Approx(0.0).margin(1e-06));
200 SECTION(
"Internal Jacobian (stiffness matrix) checks for element rotated about x-axis")
204 1.0, 1.0, 15.8, 0.0, 0.0);
210 val_margin = (test_elem.
jacobian_fd.array().abs()).mean() * 1.490116119384766e-08;
219 REQUIRE(test_elem.
jacobian.determinant() == Approx(0.0).margin(1e-06));
223 SECTION(
"\"Internal Jacobian (stiffness matrix) checks for element sheared in x-direction\"")
227 1.0, 1.0, 0.0, 0.0, 0.0, 6.7, 0.0);
233 val_margin = (test_elem.
jacobian_fd.array().abs()).mean() * 1.490116119384766e-08;
242 REQUIRE(test_elem.
jacobian.determinant() == Approx(0.0).margin(1e-06));
246 SECTION(
"\"Internal Jacobian (stiffness matrix) checks for element sheared in y-direction\"")
250 1.0, 1.0, 0.0, 0.0, 0.0, 0.0, -11.2);
256 val_margin = (test_elem.
jacobian_fd.array().abs()).mean() * 1.490116119384766e-08;
265 REQUIRE(test_elem.
jacobian.determinant() == Approx(0.0).margin(1e-06));
269 SECTION(
"Internal Jacobian (stiffness matrix) checks for element stretched in x-direction")
272 3.2, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0);
278 val_margin = (test_elem.
jacobian_fd.array().abs()).mean() * 1.490116119384766e-08;
287 REQUIRE(test_elem.
jacobian.determinant() == Approx(0.0).margin(1e-06));
290 SECTION(
"Internal Jacobian (stiffness matrix) checks for element stretched in y-direction")
293 1.0, 0.64, 0.0, 0.0, 0.0, 0.0, 0.0);
299 val_margin = (test_elem.
jacobian_fd.array().abs()).mean() * 1.490116119384766e-08;
308 REQUIRE(test_elem.
jacobian.determinant() == Approx(0.0).margin(1e-06));
312 SECTION(
"Internal Jacobian (stiffness matrix) checks for element arbitrarily scaled, stretched, rotated, and sheared")
316 2.7, 6.4, 20.0, 47.8, -70.1, 5.7, -6.3);
322 val_margin = (test_elem.
jacobian_fd.array().abs()).mean() * 1.490116119384766e-08;
331 REQUIRE(test_elem.
jacobian.determinant() == Approx(0.0).margin(1e-06));
335 SECTION(
"Internal Jacobian (stiffness matrix) checks for element arbitrarily scaled, stretched, rotated, and displaced")
343 elem_sol << -0.04384355, 0.03969142, -0.09470648, -0.05011107,
344 -0.02989082, -0.01205296, 0.08846868, 0.04522207,
345 0.06435953, -0.07282706, 0.09307561, -0.06250143,
346 0.03332844, -0.00040089, -0.00423108, -0.07258241,
347 0.06636534, -0.08421098, -0.0705489 , -0.06004976,
348 0.03873095, -0.09194373, 0.00055061, 0.046831;
356 val_margin = (test_elem.
jacobian_fd.array().abs()).mean() * 1.490116119384766e-08;
365 REQUIRE(test_elem.
jacobian.determinant() == Approx(0.0).margin(1e-06));
MAST::Parameter offset
Section offset.
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...
TEST_CASE("quad4_linear_extension_structural", "[quad],[quad4],[linear],[structural],[2D]")
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
libMesh::LibMeshInit * p_global_init
void set_bending_model(MAST::BendingOperatorType b)
returns the bending model to be used for the 2D element
MAST::StructuralElement2D * elem
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.