MAST
Multidisciplinary-design Adaptation and Sensitivity Toolkit (MAST)
plate_piston_theory_flutter.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/plate_piston_theory_flutter/plate_piston_theory_flutter.h"
27 #include "tests/base/test_comparisons.h"
29 #include "elasticity/structural_discipline.h"
31 #include "base/parameter.h"
35 #include "base/nonlinear_system.h"
36 
37 
38 BOOST_FIXTURE_TEST_SUITE (Structural2DPlatePistonTheoryFlutterAnalysis,
39  MAST::PlatePistonTheoryFlutterAnalysis)
40 
41 /*
42  BOOST_AUTO_TEST_CASE (PlatePistonTheoryFlutterSolution) {
43 
44  // initialize plate object
45  this->init(libMesh::QUAD4, false);
46 
47  const Real
48  tol = 1.e-2;
49 
50  std::vector<Real>
51  eig;
52 
53  this->solve(false, &eig);
54 
55  // check the solution
56  // iterate over each node, and compare the nodal solution with the
57  // expected anlaytical value
58  Real
59  th_y = (*_thy)(),
60  th_z = (*_thz)(),
61  Izz = pow(th_z,1)*pow(th_y,3)/12.,
62  A = th_z*th_y,
63  rho = (*_rho)(),
64  Eval = (*_E)(),
65  pi = acos(-1.),
66  analytical = 0.;
67 
68 
69  // analytical solution to the natural frequency of simply supported problem
70  // is
71  // lambda = omega^2 = (n pi/L)^4 EI/(rho A)
72  //
73  unsigned int
74  nconv = std::min(_sys->get_n_converged_eigenvalues(),
75  _sys->get_n_requested_eigenvalues());
76 
77  for (unsigned int i=0; i<nconv; i++) {
78 
79  analytical = Eval*Izz/(rho*A) * pow((i+1)*pi/_length, 4);
80 
81  // compare the eigenvalues
82  BOOST_CHECK(MAST::compare_value(analytical, eig[i], tol));
83  }
84  }
85  */
86 
87 
88 BOOST_AUTO_TEST_CASE (PlatePistonTheoryFlutterSolutionSensitivity) {
89 
90  // initialize plate object
91  this->init(libMesh::QUAD4, false);
92 
93  const Real
94  delta = 1.e-5,
95  tol = 1.e-3;
96 
97  Real
98  V0 = 0.,
99  dV = 0.,
100  dV_fd = 0.;
101 
102 
103  std::vector<Real>
104  eig_vec,
105  deig_vec;
106 
107  V0 = this->solve(false);
108 
109  // now iterate over all the parameters and calculate the analytical
110  // sensitivity and compare with the numerical sensitivity
111 
112  Real
113  p0 = 0.,
114  dp = 0.;
115 
117  // now evaluate the direct sensitivity
119 
120  for (unsigned int i=0; i<this->_params_for_sensitivity.size(); i++ ) {
121 
122  MAST::Parameter& f = *this->_params_for_sensitivity[i];
123 
124  // calculate the analytical sensitivity
125  // analysis is required at the baseline before sensitivity solution
126  // and the solution has changed after the previous perturbed solution
127  this->solve(false, 1.0e-4, 100);
128  dV = this->sensitivity_solve(f);
129 
130  // now calculate the finite difference sensitivity
131 
132  // identify the perturbation in the parameter
133  p0 = f();
134  (fabs(p0) > 0)? dp=delta*p0 : dp=delta;
135  f() += dp;
136 
137  // solve at the perturbed parameter value
138  dV_fd = this->solve(false);
139 
140  dV_fd -= V0;
141  dV_fd /= dp;
142 
143  // reset the parameter value
144  f() = p0;
145 
146  // now compare the eigenvalue sensitivity
147  BOOST_TEST_MESSAGE(" ** dV_F/dp (total) wrt : " << f.name() << " **");
148  BOOST_CHECK(MAST::compare_value( dV_fd, dV, tol));
149  }
150 }
151 
152 BOOST_AUTO_TEST_SUITE_END()
153 
154 
155 
const std::string & name() const
returns the name of this function
Definition: function_base.h:60
BOOST_FIXTURE_TEST_SUITE(Structural2DPlatePistonTheoryFlutterAnalysis, MAST::PlatePistonTheoryFlutterAnalysis) BOOST_AUTO_TEST_CASE(PlatePistonTheoryFlutterSolutionSensitivity)
This is a scalar function whose value can be changed and one that can be used as a design variable in...
Definition: parameter.h:35
libMesh::Real Real
BOOST_AUTO_TEST_CASE(InternalForceJacobianZeroFreq)
bool compare_value(const Real v0, const Real v, const Real tol)