MAST
Multidisciplinary-design Adaptation and Sensitivity Toolkit (MAST)
beam_bending_evaluation_with_offset.cpp
Go to the documentation of this file.
1 /*
2  * MAST: Multidisciplinary-design Adaptation and Sensitivity Toolkit
3  * Copyright (C) 2013-2020 Manav Bhatia and MAST authors
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18  */
19 
20 
21 // BOOST includes
22 #include <boost/test/unit_test.hpp>
23 
24 
25 // MAST includes
26 #include "examples/structural/beam_bending_with_offset/beam_bending_with_offset.h"
27 #include "tests/base/check_sensitivity.h"
28 
29 
30 
31 BOOST_FIXTURE_TEST_SUITE (Structural1DBeamBending,
32  MAST::BeamBendingWithOffset)
33 
34 //BOOST_AUTO_TEST_CASE (BeamBendingWithOffsetSolution) {
35 //
36 // this->solve();
37 //
38 // // check the solution
39 // // iterate over each node, and compare the nodal solution with the
40 // // expected anlaytical value
41 // unsigned int
42 // dof_num = 0;
43 // libMesh::MeshBase::const_node_iterator
44 // it = _mesh->local_nodes_begin(),
45 // end = _mesh->local_nodes_end();
46 //
47 // Real
48 // press = (*_press)(),
49 // th_y = (*_thy)(),
50 // th_z = (*_thz)(),
51 // Izz = th_z*pow(th_y,3)/12.+th_z*pow(th_y,3)/4.,
52 // x = 0.,
53 // xi = 0.,
54 // eta = 0.,
55 // Eval = (*_E)(),
56 // analytical = 0.,
57 // numerical = 0.;
58 //
59 // // analytical solution to the clamped-clamped problem is
60 // // w(x) = p/EI ( x^4/24 - L x^3/12 + L^2 x^2/24)
61 // // dwdx(x) = p/EI ( x^3/6 - L x^2/4 + L^2 x/12)
62 //
63 // BOOST_TEST_MESSAGE(" ** v-displacement and theta-z rotation **");
64 // for ( ; it!=end; it++) {
65 // const libMesh::Node* node = *it;
66 // x = (*node)(0);
67 //
68 // // v-displacement
69 // analytical = -press/Eval/Izz*(pow(x,4)/24. -
70 // _length*pow(x,3)/12. +
71 // pow(_length,2)*pow(x,2)/24.);
72 //
73 // dof_num = node->dof_number(_sys->number(),
74 // _structural_sys->vars()[1], // v-displ.
75 // 0);
76 // numerical = _sys->solution->el(dof_num);
77 //
78 // BOOST_CHECK(MAST::compare_value(analytical, numerical, tol));
79 //
80 // // theta-z rotation
81 // analytical = -press/Eval/Izz*(pow(x,3)/6. -
82 // _length*pow(x,2)/4. +
83 // pow(_length,2)*x/12.);
84 //
85 // dof_num = node->dof_number(_sys->number(),
86 // _structural_sys->vars()[5], // tz-rotation
87 // 0);
88 // numerical = _sys->solution->el(dof_num);
89 // BOOST_CHECK(MAST::compare_value(analytical, numerical, tol));
90 //
91 // }
92 //
93 //
94 // // make sure that each stress object has a single stored value
95 // for (unsigned int i=0; i<_outputs.size(); i++) {
96 // BOOST_CHECK(_outputs[i]->n_elem_in_storage() == 1);
97 // }
98 //
99 // // now check the stress value in each element, which should be the same as
100 // // the pressure value specified for the problem
101 // BOOST_TEST_MESSAGE(" ** Stress **");
102 // for (unsigned int i=0; i<_outputs.size(); i++) {
103 //
104 // // get the element and the nodes to evaluate the stress
105 // const libMesh::Elem& e = **(_outputs[i]->get_elem_subset().begin());
106 //
107 // const std::vector<MAST::StressStrainOutputBase::Data*>&
108 // data = _outputs[i]->get_stress_strain_data_for_elem(&e);
109 //
110 // // find the location of quadrature point
111 // for (unsigned int j=0; j<data.size(); j++) {
112 //
113 // // logitudinal strain for this location
114 // numerical = data[j]->stress()(0);
115 //
116 // xi = data[j]->point_location_in_element_coordinate()(0);
117 // eta = data[j]->point_location_in_element_coordinate()(1);
118 //
119 // // assuming linear Lagrange interpolation for elements
120 // x = e.point(0)(0) * (1.-xi)/2. + e.point(1)(0) * (1.+xi)/2.;
121 // // this gives the rotation at this point.
122 // analytical = press/Izz*(th_y*eta/2.+th_y/2.)*
123 // (pow(x,2)/2. - _length*x/2. + pow(_length,2)/12.);
124 //
125 //
126 // BOOST_CHECK(MAST::compare_value(analytical, numerical, tol));
127 // }
128 // }
129 //
130 //}
131 
132 
133 BOOST_AUTO_TEST_CASE (BeamBendingWithOffsetSensitivity) {
134 
136 }
137 
138 
139 BOOST_AUTO_TEST_SUITE_END()
140 
void check_sensitivity(ValType &v)
BOOST_AUTO_TEST_CASE(InternalForceJacobianZeroFreq)
BOOST_FIXTURE_TEST_SUITE(Structural1DBeamBending, MAST::BeamBendingWithOffset) BOOST_AUTO_TEST_CASE(BeamBendingWithOffsetSensitivity)