22 #include <boost/test/unit_test.hpp> 26 #include "examples/structural/membrane_extension_uniaxial_stress/membrane_extension_uniaxial.h" 27 #include "examples/structural/membrane_extension_biaxial_stress/membrane_extension_biaxial.h" 28 #include "tests/base/check_sensitivity.h" 48 for (
unsigned int i=0; i<mem._outputs.size(); i++)
49 BOOST_CHECK((mem._outputs[i]->n_elem_in_storage() == 1));
52 press = (*mem._press)(),
63 libMesh::MeshBase::const_node_iterator
64 it = mem._mesh->local_nodes_begin(),
65 end = mem._mesh->local_nodes_end();
77 for (
unsigned int i=0; i<mem._params_for_sensitivity.size(); i++ ) {
85 const libMesh::NumericVector<Real>& dsol_vec = mem.sensitivity_solve(f);
88 for (
unsigned int i=0; i<mem._outputs.size(); i++)
89 BOOST_CHECK((mem._outputs[i]->n_elem_in_storage() == 1));
91 BOOST_TEST_MESSAGE(
" ** dX/dp (total) wrt : " << f.
name() <<
" **");
92 it = mem._mesh->local_nodes_begin();
93 for ( ; it!=end; it++) {
94 const libMesh::Node* node = *it;
97 dof_num = node->dof_number(mem._sys->number(),
98 mem._structural_sys->vars()[0],
102 analytical = -(*node)(0) * press/pow(Eval,2);
103 else if (f.
name() ==
"nu")
105 else if (f.
name() ==
"th")
109 numerical = dsol_vec.el(dof_num);
113 dof_num = node->dof_number(mem._sys->number(),
114 mem._structural_sys->vars()[1],
118 analytical = +nuval * (*node)(1) * press/pow(Eval,2);
119 else if (f.
name() ==
"nu")
120 analytical = - (*node)(1) * press/Eval;
121 else if (f.
name() ==
"th")
125 numerical = dsol_vec.el(dof_num);
132 BOOST_TEST_MESSAGE(
" ** dvm-stress/dp (total) wrt : " << f.
name() <<
" **");
133 for (
unsigned int i=0; i<mem._outputs.size(); i++) {
137 mem._outputs[i]->von_Mises_p_norm_functional_sensitivity_for_all_elems(p_val, &f);
158 MAST::MembraneExtensionUniaxial)
167 this->init(libMesh::QUAD4,
false);
180 libMesh::MeshBase::const_node_iterator
181 it = _mesh->local_nodes_begin(),
182 end = _mesh->local_nodes_end();
191 for ( ; it!=end; it++) {
192 const libMesh::Node* node = *it;
195 dof_num = node->dof_number(_sys->number(), _structural_sys->vars()[0], 0);
196 analytical = (*node)(0) * press/Eval;
197 numerical = _sys->solution->el(dof_num);
201 dof_num = node->dof_number(_sys->number(), _structural_sys->vars()[1], 0);
202 analytical = -nuval * (*node)(1) * press/Eval;
203 numerical = _sys->solution->el(dof_num);
208 for (
unsigned int i=0; i<_outputs.size(); i++) {
209 BOOST_CHECK(_outputs[i]->n_elem_in_storage() == 1);
214 for (
unsigned int i=0; i<_outputs.size(); i++) {
217 numerical = _outputs[i]->von_Mises_p_norm_functional_for_all_elems(2);
229 BOOST_AUTO_TEST_SUITE_END()
234 MAST::MembraneExtensionBiaxial)
242 BOOST_AUTO_TEST_SUITE_END()
const std::string & name() const
returns the name of this function
This is a scalar function whose value can be changed and one that can be used as a design variable in...
void check_sensitivity(ValType &v)
BOOST_FIXTURE_TEST_SUITE(Structural2DMembraneExtensionUniaxial, MAST::MembraneExtensionUniaxial) BOOST_AUTO_TEST_CASE(MembraneExtensionUniaxialSolution)
void uniaxial_membrane_sensitivity(MAST::MembraneExtensionUniaxial &mem)
Matrix< Real, Dynamic, 1 > RealVectorX
bool compare_value(const Real v0, const Real v, const Real tol)
BOOST_AUTO_TEST_CASE(MembraneExtensionUniaxialSensitivity)