22 #include <boost/test/unit_test.hpp> 26 #include "examples/structural/beam_bending/beam_bending.h" 27 #include "tests/base/check_sensitivity.h" 39 this->init(libMesh::EDGE2,
false);
47 libMesh::MeshBase::const_node_iterator
48 it = _mesh->local_nodes_begin(),
49 end = _mesh->local_nodes_end();
55 Izz = th_z*pow(th_y,3)/12.,
67 for ( ; it!=end; it++) {
68 const libMesh::Node* node = *it;
72 analytical = -press/Eval/Izz*(pow(x,4)/24. -
73 _length*pow(x,3)/12. +
74 pow(_length,2)*pow(x,2)/24.);
76 dof_num = node->dof_number(_sys->number(),
77 _structural_sys->vars()[1],
79 numerical = _sys->solution->el(dof_num);
84 analytical = -press/Eval/Izz*(pow(x,3)/6. -
86 pow(_length,2)*x/12.);
88 dof_num = node->dof_number(_sys->number(),
89 _structural_sys->vars()[5],
91 numerical = _sys->solution->el(dof_num);
98 for (
unsigned int i=0; i<_outputs.size(); i++) {
99 BOOST_CHECK(_outputs[i]->n_elem_in_storage() == 1);
104 for (
unsigned int i=0; i<_outputs.size(); i++) {
107 const libMesh::Elem& e = **(_outputs[i]->get_elem_subset().begin());
109 const std::vector<MAST::StressStrainOutputBase::Data*>&
110 data = _outputs[i]->get_stress_strain_data_for_elem(&e);
113 for (
unsigned int j=0; j<data.size(); j++) {
116 numerical = data[j]->stress()(0);
118 xi = data[j]->point_location_in_element_coordinate()(0);
119 eta = data[j]->point_location_in_element_coordinate()(1);
122 x = e.point(0)(0) * (1.-xi)/2. + e.point(1)(0) * (1.+xi)/2.;
124 analytical = -press/Eval/Izz*(pow(x,2)/2. -
129 analytical *= -Eval*th_y*eta/2.;
141 this->init(libMesh::EDGE2,
false);
146 BOOST_AUTO_TEST_SUITE_END()
BOOST_FIXTURE_TEST_SUITE(Structural1DBeamBending, MAST::BeamBending) BOOST_AUTO_TEST_CASE(BeamBendingSolution)
void check_sensitivity(ValType &v)
BOOST_AUTO_TEST_CASE(BeamBendingSensitivity)
bool compare_value(const Real v0, const Real v, const Real tol)