22 #define protected public 25 #include "libmesh/libmesh.h" 26 #include "libmesh/elem.h" 27 #include "libmesh/dof_map.h" 50 TEST_CASE(
"edge2_nonlinear_structural_thermal_jacobian",
51 "[1D],[thermoelastic],[edge],[edge2],[nonlinear],[protected]")
54 coords << -1.0, 1.0, 0.0,
66 temperature_load.
add(temperature_f);
67 temperature_load.
add(ref_temperature_f);
80 double val_margin = (test_elem.
jacobian0.array().abs()).mean() * 1.490116119384766e-08;
83 libMesh::out <<
"J =\n" << test_elem.
jacobian0 << std::endl;
86 SECTION(
"Thermoelastic Jacobian finite difference check")
92 val_margin = (test_elem.
jacobian_fd.array().abs()).mean() * 1.490116119384766e-08;
99 SECTION(
"Thermoelastic Jacobian should be symmetric")
106 SECTION(
"Determinant of undeformed thermoelastic Jacobian should be zero")
108 REQUIRE(test_elem.
jacobian0.determinant() == Approx(0.0).margin(1e-06));
133 SECTION(
"Thermoelastic Jacobian is invariant to section orientation")
137 orientation(2) = 1.0;
147 SECTION(
"Thermoelastic Jacobian is invariant to displacement solution")
150 elem_sol << 0.05727841, 0.08896581, 0.09541619, -0.03774913,
151 0.07510557, -0.07122266, -0.00979117, -0.08300009,
152 -0.03453369, -0.05487761, -0.01407677, -0.09268421;
162 SECTION(
"Thermoelastic Jacobian is invariant to element x-location")
165 1.0, 1.0, 0.0, 0.0, 0.0);
174 SECTION(
"Thermoelastic Jacobian is invariant to element y-location")
177 1.0, 1.0, 0.0, 0.0, 0.0);
186 SECTION(
"Thermoelastic Jacobian is invariant to element z-location")
189 1.0, 1.0, 0.0, 0.0, 0.0);
198 SECTION(
"Thermoelastic Jacobian checks for element aligned along y-axis")
206 new_coordinates << 0.0, 0.0, -1.0, 1.0, 0.0, 0.0;
213 val_margin = (test_elem.
jacobian_fd.array().abs()).mean() * 1.490116119384766e-08;
222 REQUIRE(test_elem.
jacobian.determinant() == Approx(0.0).margin(1e-06));
225 SECTION(
"Thermoelastic Jacobian checks for element aligned along z-axis")
233 new_coordinates << 0.0, 0.0, 0.0, 0.0, -1.0, 1.0;
240 val_margin = (test_elem.
jacobian_fd.array().abs()).mean() * 1.490116119384766e-08;
249 REQUIRE(test_elem.
jacobian.determinant() == Approx(0.0).margin(1e-06));
253 SECTION(
"Thermoelastic Jacobian checks for element rotated about z-axis")
257 1.0, 1.0, 0.0, 0.0, 63.4);
263 val_margin = (test_elem.
jacobian_fd.array().abs()).mean() * 1.490116119384766e-08;
272 REQUIRE(test_elem.
jacobian.determinant() == Approx(0.0).margin(1e-06));
276 SECTION(
"Thermoelastic Jacobian checks for element rotated about y-axis")
280 1.0, 1.0, 0.0, 35.8, 0.0);
286 val_margin = (test_elem.
jacobian_fd.array().abs()).mean() * 1.490116119384766e-08;
295 REQUIRE(test_elem.
jacobian.determinant() == Approx(0.0).margin(1e-06));
299 SECTION(
"Thermoelastic Jacobian checks for element stretched in x-direction")
302 3.2, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0);
308 val_margin = (test_elem.
jacobian_fd.array().abs()).mean() * 1.490116119384766e-08;
317 REQUIRE(test_elem.
jacobian.determinant() == Approx(0.0).margin(1e-06));
321 SECTION(
"Thermoelastic Jacobian checks for element arbitrarily scaled, stretched, and rotated")
325 2.7, 6.4, 20.0, 47.8, -70.1);
331 val_margin = (test_elem.
jacobian_fd.array().abs()).mean() * 1.490116119384766e-08;
340 REQUIRE(test_elem.
jacobian.determinant() == Approx(0.0).margin(1e-06));
344 SECTION(
"Thermoelastic Jacobian checks for element arbitrarily scaled, stretched, rotated, and displaced")
348 4.2, 1.5, -18.0, -24.8, 30.1);
352 elem_sol << 0.08158724, 0.07991906, -0.00719128, 0.02025461,
353 -0.04602193, 0.05280159, 0.03700081, 0.04636344,
354 0.05559377, 0.06448206, 0.08919238, -0.03079122;
362 val_margin = (test_elem.
jacobian_fd.array().abs()).mean() * 1.490116119384766e-08;
371 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.
void add_volume_load(libMesh::subdomain_id_type bid, MAST::BoundaryConditionBase &load)
adds the specified volume loads for the elements with subdomain tag s_id
virtual void init()
Only used by 1D sections.
RealVectorX elem_solution
libMesh::Elem * reference_elem
Pointer to the actual libMesh element object.
MAST::PhysicsDisciplineBase discipline
RealVectorX & y_vector()
returns value of the property val.
MAST::StructuralElement1D * elem
MAST::Solid1DSectionElementPropertyCard section
This is a scalar function whose value can be changed and one that can be used as a design variable in...
void set_strain(MAST::StrainType strain)
sets the type of strain to be used, which is LINEAR_STRAIN by default
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...
void add(MAST::FunctionBase &f)
adds the function to this card and returns a reference to it.
std::vector< double > eigen_matrix_to_std_vector(RealMatrixX M)
Converts an Eigen Matrix object to a std::vector.
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.
TEST_CASE("edge2_nonlinear_structural_thermal_jacobian", "[1D],[thermoelastic],[edge],[edge2],[nonlinear],[protected]")
RealVectorX residual
Vector storage for element's residual vector.
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 approximate_thermal_jacobian_with_finite_difference(MAST::StructuralElementBase &elem, const RealVectorX &initial_elem_solution, RealMatrixX &jacobian, MAST::BoundaryConditionBase &thermal_bc)
Approximates the thermal jacobian using a 6th order accurate central finite difference scheme...
virtual bool thermal_residual(bool request_jacobian, RealVectorX &f, RealMatrixX &jac, MAST::BoundaryConditionBase &bc)
Calculates the force vector and Jacobian due to thermal stresses.
libMesh::LibMeshInit * p_global_init
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.