22 #include <boost/test/unit_test.hpp> 26 #include "examples/fluid/panel_small_disturbance_frequency_domain_analysis_2D/panel_small_disturbance_frequency_domain_analysis_2d.h" 29 #include "tests/base/test_comparisons.h" 32 #include "libmesh/numeric_vector.h" 36 MAST::PanelInviscidSmallDisturbanceFrequencyDomain2DAnalysis)
60 nm_re = _sys->name() +
"real_sol",
61 nm_im = _sys->name() +
"imag_sol",
62 nm_re_sens = _sys->name() +
"real_sol_sens",
63 nm_im_sens = _sys->name() +
"imag_sol_sens";
65 libMesh::NumericVector<Real>
66 & sol_vec_re = _sys->get_vector(nm_re),
67 & sol_vec_im = _sys->get_vector(nm_im);
70 n_dofs = sol_vec_re.size();
72 sol_re = RealVectorX::Zero(n_dofs);
73 sol_im = RealVectorX::Zero(n_dofs);
74 dsol_re = RealVectorX::Zero(n_dofs);
75 dsol_im = RealVectorX::Zero(n_dofs);
76 dsol_fd_re = RealVectorX::Zero(n_dofs);
77 dsol_fd_im = RealVectorX::Zero(n_dofs);
80 for (
unsigned int i=0; i<n_dofs; i++) {
82 sol_re(i) = sol_vec_re(i);
83 sol_im(i) = sol_vec_im(i);
101 dsol_re = RealVectorX::Zero(n_dofs);
102 dsol_im = RealVectorX::Zero(n_dofs);
103 dsol_fd_re = RealVectorX::Zero(n_dofs);
104 dsol_fd_im = RealVectorX::Zero(n_dofs);
110 sensitivity_solve(f);
112 libMesh::NumericVector<Real>
113 & dsol_vec_re = _sys->get_vector(nm_re_sens),
114 & dsol_vec_im = _sys->get_vector(nm_im_sens);
117 for (
unsigned int j=0; j<n_dofs; j++) {
119 dsol_re(j) = dsol_vec_re(j);
120 dsol_im(j) = dsol_vec_im(j);
127 (fabs(p0) > 0)? dp=delta*p0 : dp=delta;
133 libMesh::NumericVector<Real>
134 & dsol_vec_re_fd = _sys->get_vector(nm_re),
135 & dsol_vec_im_fd = _sys->get_vector(nm_im);
138 for (
unsigned int j=0; j<n_dofs; j++) {
140 dsol_fd_re(j) = dsol_vec_re_fd(j);
141 dsol_fd_im(j) = dsol_vec_im_fd(j);
145 dsol_fd_re -= sol_re;
146 dsol_fd_im -= sol_im;
154 BOOST_TEST_MESSAGE(
" ** dX_re/dp (total) wrt : " << f.
name() <<
" **");
157 BOOST_TEST_MESSAGE(
" ** dX_im/dp (total) wrt : " << f.
name() <<
" **");
166 BOOST_AUTO_TEST_SUITE_END()
const std::string & name() const
returns the name of this function
bool compare_vector(const RealVectorX &v0, const RealVectorX &v, const Real tol)
This is a scalar function whose value can be changed and one that can be used as a design variable in...
BOOST_FIXTURE_TEST_SUITE(PanelSmallDisturbanceFrequencyDomain2D, MAST::PanelInviscidSmallDisturbanceFrequencyDomain2DAnalysis) BOOST_AUTO_TEST_CASE(FreqDomainSensitivityWrtOmega)
BOOST_AUTO_TEST_CASE(InternalForceJacobianZeroFreq)
Matrix< Real, Dynamic, 1 > RealVectorX