MAST
Multidisciplinary-design Adaptation and Sensitivity Toolkit (MAST)
check_frequency_domain_jacobian.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 // MAST includes
25 #include "tests/fluid/build_conservative_fluid_elem.h"
26 #include "tests/base/test_comparisons.h"
27 #include "examples/base/rigid_surface_motion.h"
31 #include "base/parameter.h"
32 
33 // libMesh includes
34 #include "libmesh/dof_map.h"
35 
36 
37 BOOST_FIXTURE_TEST_SUITE (FreqDomainJacobianEvaluation, MAST::BuildConservativeFluidElem)
38 
39 void
41  Real omega) {
42 
43  // set the frequency value
44  *v._omega = omega;
45 
46  // make sure there is only one element in the mesh.
47  libmesh_assert_equal_to(v._mesh->n_elem(), 1);
48  libMesh::Elem& e = **v._mesh->local_elements_begin();
49 
50  const MAST::FlightCondition& p =
51  dynamic_cast<MAST::ConservativeFluidDiscipline*>(v._discipline)->flight_condition();
52 
53  std::unique_ptr<MAST::FrequencyDomainLinearizedConservativeFluidElem>
55  elem->freq = v._freq_function;
56 
57 
58  const Real
59  delta = 1.e-5,
60  tol = 1.e-2;
61 
62  const Complex
63  iota(0., 1.);
64 
65 
66  // number of dofs in this element
67  const unsigned int ndofs = 16;
68 
69  // now get the residual and Jacobian evaluations
71  x_base =RealVectorX::Zero(ndofs);
72 
74  x = ComplexVectorX::Zero(ndofs),
75  res0 = ComplexVectorX::Zero(ndofs),
76  res = ComplexVectorX::Zero(ndofs);
77 
79  jac_x = ComplexMatrixX::Zero(ndofs, ndofs),
80  jac_x_fd = ComplexMatrixX::Zero(ndofs, ndofs),
81  dummy;
82 
83 
84 
85  // set velocity to be zero
86  elem->set_velocity(x_base);
87 
88  // initialize the base solution vector. The 2D elem has 4 variables
89  for (unsigned int i=0; i<4; i++) {
90  for (unsigned int j=0; j<4; j++) {
91  x_base(i*4+j) = v._base_sol(i);
92  }
93  }
94  elem->set_solution(x_base);
95 
96 
97  // both x and x0 are zero at this point.
98  // tell the element about the solution and velocity
99  elem->set_complex_solution(x);
100 
101  // get the base residual vector and the Jacobians for numerical comparisons
102  // later.
103  elem->internal_residual(true, res0, jac_x);
104 
105 
106  for (unsigned int i=0; i<ndofs; i++) {
107 
108 
109  // first the Jacobian due to x
110  x = ComplexVectorX::Zero(ndofs);
111  // perturb the i^th element of the solution
112  x(i) += delta;
113  elem->set_complex_solution(x);
114 
115  // get the new residual
116  res.setZero();
117  elem->internal_residual(false, res, dummy);
118 
119  // set the i^th column of the finite-differenced Jacobian
120  jac_x_fd.col(i) = (res-res0)/delta;
121  }
122 
123  // now compare the matrices
124  BOOST_TEST_MESSAGE("** Checking Real Part of Jacobian with Real Perturbation **");
125  BOOST_CHECK(MAST::compare_matrix( jac_x_fd.real(), jac_x.real(), tol));
126 
127  BOOST_TEST_MESSAGE("** Checking Imaginary Part of Jacobian with Real Perturbation **");
128  BOOST_CHECK(MAST::compare_matrix( jac_x_fd.imag(), jac_x.imag(), tol));
129 
130  if (fabs(omega) > 0.) {
131  // now perturb the imaginary part of the solution
132  for (unsigned int i=0; i<ndofs; i++) {
133 
134 
135  // first the Jacobian due to x
136  x = ComplexVectorX::Zero(ndofs);
137  // perturb the i^th element of the solution
138  x(i) += delta * iota;
139  elem->set_complex_solution(x);
140 
141  // get the new residual
142  res.setZero();
143  elem->internal_residual(false, res, dummy);
144 
145  // set the i^th column of the finite-differenced Jacobian
146  jac_x_fd.col(i) = (res-res0)/delta/iota;
147  }
148 
149  // now compare the matrices
150  BOOST_TEST_MESSAGE("** Checking Real Part of Jacobian with Imaginary Perturbation **");
151  BOOST_CHECK(MAST::compare_matrix( jac_x_fd.real(), jac_x.real(), tol));
152 
153  BOOST_TEST_MESSAGE("** Checking Imaginary Part of Jacobian with Imaginary Perturbation **");
154  BOOST_CHECK(MAST::compare_matrix( jac_x_fd.imag(), jac_x.imag(), tol));
155  }
156 }
157 
158 
159 void
161  Real omega) {
162 
163  // set the frequency value
164  *v._omega = omega;
165 
166  // make sure there is only one element in the mesh.
167  libmesh_assert_equal_to(v._mesh->n_elem(), 1);
168  libMesh::Elem& e = **v._mesh->local_elements_begin();
169 
170  const MAST::FlightCondition& p =
171  dynamic_cast<MAST::ConservativeFluidDiscipline*>(v._discipline)->flight_condition();
172 
173  std::unique_ptr<MAST::FrequencyDomainLinearizedConservativeFluidElem>
175  elem->freq = v._freq_function;
176 
177 
178  const Real
179  delta = 1.e-5,
180  tol = 1.e-2;
181 
182 
183  const Complex
184  iota(0., 1.);
185 
186 
187  // number of dofs in this element
188  const unsigned int ndofs = 16;
189 
190  // now get the residual and Jacobian evaluations
192  x_base =RealVectorX::Zero(ndofs);
193 
195  x = ComplexVectorX::Zero(ndofs),
196  res0 = ComplexVectorX::Zero(ndofs),
197  res = ComplexVectorX::Zero(ndofs);
198 
200  jac_x = ComplexMatrixX::Zero(ndofs, ndofs),
201  jac_x_fd = ComplexMatrixX::Zero(ndofs, ndofs),
202  dummy;
203 
204 
205  MAST::SideBCMapType bc_map;
206  bc_map.insert(std::pair<libMesh::boundary_id_type, MAST::BoundaryConditionBase*>
207  (1, v._far_field));
208 
209  // set velocity to be zero
210  elem->set_velocity(x_base);
211 
212  // initialize the base solution vector. The 2D elem has 4 variables
213  for (unsigned int i=0; i<4; i++) {
214  for (unsigned int j=0; j<4; j++) {
215  x_base(i*4+j) = v._base_sol(i);
216  }
217  }
218  elem->set_solution(x_base);
219 
220 
221  // both x and x0 are zero at this point.
222  // tell the element about the solution and velocity
223  elem->set_complex_solution(x);
224 
225  // get the base residual vector and the Jacobians for numerical comparisons
226  // later.
227  elem->side_external_residual(true, res0, jac_x, bc_map);
228 
229 
230  for (unsigned int i=0; i<ndofs; i++) {
231 
232 
233  // first the Jacobian due to x
234  x = ComplexVectorX::Zero(ndofs);
235  // perturb the i^th element of the solution
236  x(i) += delta;
237  elem->set_complex_solution(x);
238 
239  // get the new residual
240  res.setZero();
241  elem->side_external_residual(false, res, dummy, bc_map);
242 
243  // set the i^th column of the finite-differenced Jacobian
244  jac_x_fd.col(i) = (res-res0)/delta;
245  }
246 
247  // now compare the matrices
248  BOOST_TEST_MESSAGE("** Checking Real Part of Jacobian with Real Perturbation **");
249  BOOST_CHECK(MAST::compare_matrix( jac_x_fd.real(), jac_x.real(), tol));
250 
251  BOOST_TEST_MESSAGE("** Checking Imaginary Part of Jacobian with Real Perturbation **");
252  BOOST_CHECK(MAST::compare_matrix( jac_x_fd.imag(), jac_x.imag(), tol));
253 
254 
255 
256  if (fabs(omega) > 0.) {
257  for (unsigned int i=0; i<ndofs; i++) {
258 
259 
260  // first the Jacobian due to x
261  x = ComplexVectorX::Zero(ndofs);
262  // perturb the i^th element of the solution
263  x(i) += delta*iota;
264  elem->set_complex_solution(x);
265 
266  // get the new residual
267  res.setZero();
268  elem->side_external_residual(false, res, dummy, bc_map);
269 
270  // set the i^th column of the finite-differenced Jacobian
271  jac_x_fd.col(i) = (res-res0)/delta/iota;
272  }
273 
274  // now compare the matrices
275  BOOST_TEST_MESSAGE("** Checking Real Part of Jacobian with Imaginary Perturbation **");
276  BOOST_CHECK(MAST::compare_matrix( jac_x_fd.real(), jac_x.real(), tol));
277 
278  BOOST_TEST_MESSAGE("** Checking Imaginary Part of Jacobian with Imaginary Perturbation **");
279  BOOST_CHECK(MAST::compare_matrix( jac_x_fd.imag(), jac_x.imag(), tol));
280  }
281 }
282 
283 
284 void
286  Real omega) {
287 
288  // set the frequency value
289  *v._omega = omega;
290 
291  // make sure there is only one element in the mesh.
292  libmesh_assert_equal_to(v._mesh->n_elem(), 1);
293  libMesh::Elem& e = **v._mesh->local_elements_begin();
294 
295  const MAST::FlightCondition& p =
296  dynamic_cast<MAST::ConservativeFluidDiscipline*>(v._discipline)->flight_condition();
297 
298  std::unique_ptr<MAST::FrequencyDomainLinearizedConservativeFluidElem>
300  elem->freq = v._freq_function;
301 
302 
303  const Real
304  delta = 1.e-5,
305  tol = 1.e-2;
306 
307  const Complex
308  iota(0., 1.);
309 
310  // number of dofs in this element
311  const unsigned int ndofs = 16;
312 
313  // now get the residual and Jacobian evaluations
315  x_base =RealVectorX::Zero(ndofs);
316 
318  x = ComplexVectorX::Zero(ndofs),
319  res0 = ComplexVectorX::Zero(ndofs),
320  res = ComplexVectorX::Zero(ndofs);
321 
323  jac_x = ComplexMatrixX::Zero(ndofs, ndofs),
324  jac_x_fd = ComplexMatrixX::Zero(ndofs, ndofs),
325  dummy;
326 
327 
328  MAST::SideBCMapType bc_map;
329  bc_map.insert(std::pair<libMesh::boundary_id_type, MAST::BoundaryConditionBase*>
330  (0, v._slip_wall));
331 
332  // set velocity to be zero
333  elem->set_velocity(x_base);
334 
335  // initialize the base solution vector. The 2D elem has 4 variables
336  for (unsigned int i=0; i<4; i++) {
337  for (unsigned int j=0; j<4; j++) {
338  x_base(i*4+j) = v._base_sol(i);
339  }
340  }
341  elem->set_solution(x_base);
342 
343 
344  // both x and x0 are zero at this point.
345  // tell the element about the solution and velocity
346  elem->set_complex_solution(x);
347 
348  // get the base residual vector and the Jacobians for numerical comparisons
349  // later.
350  elem->side_external_residual(true, res0, jac_x, bc_map);
351 
352 
353  for (unsigned int i=0; i<ndofs; i++) {
354 
355 
356  // first the Jacobian due to x
357  x = ComplexVectorX::Zero(ndofs);
358  // perturb the i^th element of the solution
359  x(i) += delta;
360  elem->set_complex_solution(x);
361 
362  // get the new residual
363  res.setZero();
364  elem->side_external_residual(false, res, dummy, bc_map);
365 
366  // set the i^th column of the finite-differenced Jacobian
367  jac_x_fd.col(i) = (res-res0)/delta;
368  }
369 
370  // now compare the matrices
371  BOOST_TEST_MESSAGE("** Checking Real Part of Jacobian with Real Perturbation**");
372  BOOST_CHECK(MAST::compare_matrix( jac_x_fd.real(), jac_x.real(), tol));
373 
374  BOOST_TEST_MESSAGE("** Checking Imaginary Part of Jacobian with Real Perturbation**");
375  BOOST_CHECK(MAST::compare_matrix( jac_x_fd.imag(), jac_x.imag(), tol));
376 
377 
378 
379  if (fabs(omega) > 0.) {
380 
381  for (unsigned int i=0; i<ndofs; i++) {
382 
383 
384  // first the Jacobian due to x
385  x = ComplexVectorX::Zero(ndofs);
386  // perturb the i^th element of the solution
387  x(i) += delta * iota;
388  elem->set_complex_solution(x);
389 
390  // get the new residual
391  res.setZero();
392  elem->side_external_residual(false, res, dummy, bc_map);
393 
394  // set the i^th column of the finite-differenced Jacobian
395  jac_x_fd.col(i) = (res-res0)/delta/iota;
396  }
397 
398  // now compare the matrices
399  BOOST_TEST_MESSAGE("** Checking Real Part of Jacobian with Imaginary Perturbation **");
400  BOOST_CHECK(MAST::compare_matrix( jac_x_fd.real(), jac_x.real(), tol));
401 
402  BOOST_TEST_MESSAGE("** Checking Imaginary Part of Jacobian with Imaginary Perturbation **");
403  BOOST_CHECK(MAST::compare_matrix( jac_x_fd.imag(), jac_x.imag(), tol));
404  }
405 }
406 
407 
408 BOOST_AUTO_TEST_CASE (InternalForceJacobianZeroFreq) {
409 
411 
412 }
413 
414 
415 
416 BOOST_AUTO_TEST_CASE (InternalForceJacobianNonZeroFreq) {
417 
418  check_internal_force_jacobian(*this, 200.);
419 
420 }
421 
422 
423 
424 
425 BOOST_AUTO_TEST_CASE (FarFieldJacobianZeroFreq) {
426 
427  check_far_field_jacobian(*this, 0.);
428 }
429 
430 
431 
432 BOOST_AUTO_TEST_CASE (FarFieldJacobianNonZeroFreq) {
433 
434  check_far_field_jacobian(*this, 200.);
435 }
436 
437 
438 
439 BOOST_AUTO_TEST_CASE (MovingWallJacobianZeroFreq) {
440 
441  check_moving_wall_jacobian(*this, 0.);
442 }
443 
444 
445 BOOST_AUTO_TEST_CASE (MovingWallJacobianNonZeroFreq) {
446 
447  check_moving_wall_jacobian(*this, 200.);
448 }
449 
450 
451 
452 BOOST_AUTO_TEST_CASE (InternalForceFreqSens) {
453 
454  // set the frequency value to some arbitrary value
455  *_omega = 100.;
456 
457  // make sure there is only one element in the mesh.
458  libmesh_assert_equal_to(_mesh->n_elem(), 1);
459  libMesh::Elem& e = **_mesh->local_elements_begin();
460 
461  const MAST::FlightCondition& p =
462  dynamic_cast<MAST::ConservativeFluidDiscipline*>(_discipline)->flight_condition();
463 
464  std::unique_ptr<MAST::FrequencyDomainLinearizedConservativeFluidElem>
465  elem(new MAST::FrequencyDomainLinearizedConservativeFluidElem(*_fluid_sys, e, p));
466  elem->freq = _freq_function;
467  elem->sensitivity_param = _omega;
468 
469 
470  const Real
471  delta = 1.e-5,
472  tol = 1.e-2;
473 
474  const Complex
475  iota(0., 1.);
476 
477 
478  // number of dofs in this element
479  const unsigned int ndofs = 16;
480 
481  // now get the residual and Jacobian evaluations
483  x_base =RealVectorX::Zero(ndofs);
484 
486  x = ComplexVectorX::Zero(ndofs),
487  res0 = ComplexVectorX::Zero(ndofs),
488  res_sens = ComplexVectorX::Zero(ndofs),
489  res_sens_fd = ComplexVectorX::Zero(ndofs);
490 
492  jac_x = ComplexMatrixX::Zero(ndofs, ndofs),
493  jac_x_fd = ComplexMatrixX::Zero(ndofs, ndofs),
494  dummy;
495 
496 
497 
498  // set velocity to be zero
499  elem->set_velocity(x_base);
500 
501  // initialize the base solution vector. The 2D elem has 4 variables
502  for (unsigned int i=0; i<4; i++) {
503  for (unsigned int j=0; j<4; j++) {
504  x_base(i*4+j) = _base_sol(i);
505  }
506  }
507  elem->set_solution(x_base);
508 
509 
510  // both x and x0 are zero at this point.
511  // tell the element about the solution and velocity
512  elem->set_complex_solution(x);
513  elem->set_complex_solution(x, true);
514 
515  // get the base residual vector and the Jacobians for numerical comparisons
516  // later.
517  elem->internal_residual(true, res0, jac_x);
518 
519  // calculate the sensitivity of the residual
520  elem->internal_residual_sensitivity(false, res_sens, dummy);
521 
522  // now perturb the frequency parameter
523  *_omega = ((1. + delta) * (*_omega)());
524 
525  elem->internal_residual(false, res_sens_fd, dummy);
526  res_sens_fd -= res0;
527  res_sens_fd /= delta;
528 
529  // now compare the two sensitivity vectors
530  BOOST_TEST_MESSAGE("** Checking Real Part of Internal Residual Sensitivity **");
531  BOOST_CHECK(MAST::compare_vector( res_sens_fd.real(), res_sens.real(), tol));
532 
533  BOOST_TEST_MESSAGE("** Checking Real Part of Internal Residual Sensitivity **");
534  BOOST_CHECK(MAST::compare_vector( res_sens_fd.real(), res_sens.real(), tol));
535 }
536 
537 BOOST_AUTO_TEST_CASE (FarFieldResidualFreqSens) {
538 
539  // set the frequency value to some arbitrary value
540  *_omega = 100.;
541 
542 
543  MAST::SideBCMapType bc_map;
544  bc_map.insert(std::pair<libMesh::boundary_id_type, MAST::BoundaryConditionBase*>
545  (0, _far_field));
546 
547 
548  // make sure there is only one element in the mesh.
549  libmesh_assert_equal_to(_mesh->n_elem(), 1);
550  libMesh::Elem& e = **_mesh->local_elements_begin();
551 
552  const MAST::FlightCondition& p =
553  dynamic_cast<MAST::ConservativeFluidDiscipline*>(_discipline)->flight_condition();
554 
555  std::unique_ptr<MAST::FrequencyDomainLinearizedConservativeFluidElem>
556  elem(new MAST::FrequencyDomainLinearizedConservativeFluidElem(*_fluid_sys, e, p));
557  elem->freq = _freq_function;
558  elem->sensitivity_param = _omega;
559 
560 
561  const Real
562  delta = 1.e-5,
563  tol = 1.e-2;
564 
565  const Complex
566  iota(0., 1.);
567 
568 
569  // number of dofs in this element
570  const unsigned int ndofs = 16;
571 
572  // now get the residual and Jacobian evaluations
574  x_base =RealVectorX::Zero(ndofs);
575 
577  x = ComplexVectorX::Zero(ndofs),
578  res0 = ComplexVectorX::Zero(ndofs),
579  res_sens = ComplexVectorX::Zero(ndofs),
580  res_sens_fd = ComplexVectorX::Zero(ndofs);
581 
583  jac_x = ComplexMatrixX::Zero(ndofs, ndofs),
584  jac_x_fd = ComplexMatrixX::Zero(ndofs, ndofs),
585  dummy;
586 
587 
588 
589  // set velocity to be zero
590  elem->set_velocity(x_base);
591 
592  // initialize the base solution vector. The 2D elem has 4 variables
593  for (unsigned int i=0; i<4; i++) {
594  for (unsigned int j=0; j<4; j++) {
595  x_base(i*4+j) = _base_sol(i);
596  }
597  }
598  elem->set_solution(x_base);
599 
600 
601  // both x and x0 are zero at this point.
602  // tell the element about the solution and velocity
603  elem->set_complex_solution(x);
604  elem->set_complex_solution(x, true);
605 
606  // get the base residual vector and the Jacobians for numerical comparisons
607  // later.
608  elem->side_external_residual(true, res0, jac_x, bc_map);
609 
610  // calculate the sensitivity of the residual
611  elem->side_external_residual_sensitivity(false, res_sens, dummy, bc_map);
612 
613  // now perturb the frequency parameter
614  *_omega = ((1. + delta) * (*_omega)());
615 
616  elem->side_external_residual(false, res_sens_fd, dummy, bc_map);
617  res_sens_fd -= res0;
618  res_sens_fd /= delta;
619 
620  // now compare the two sensitivity vectors
621  BOOST_TEST_MESSAGE("** Checking Real Part of Internal Residual Sensitivity **");
622  BOOST_CHECK(MAST::compare_vector( res_sens_fd.real(), res_sens.real(), tol));
623 
624  BOOST_TEST_MESSAGE("** Checking Real Part of Internal Residual Sensitivity **");
625  BOOST_CHECK(MAST::compare_vector( res_sens_fd.real(), res_sens.real(), tol));
626 }
627 
628 
629 BOOST_AUTO_TEST_CASE (MovingWallResidualFreqSens) {
630 
631  // set the frequency value to some arbitrary value
632  *_omega = 100.;
633 
634 
635  MAST::SideBCMapType bc_map;
636  bc_map.insert(std::pair<libMesh::boundary_id_type, MAST::BoundaryConditionBase*>
637  (0, _slip_wall));
638 
639 
640  // make sure there is only one element in the mesh.
641  libmesh_assert_equal_to(_mesh->n_elem(), 1);
642  libMesh::Elem& e = **_mesh->local_elements_begin();
643 
644  const MAST::FlightCondition& p =
645  dynamic_cast<MAST::ConservativeFluidDiscipline*>(_discipline)->flight_condition();
646 
647  std::unique_ptr<MAST::FrequencyDomainLinearizedConservativeFluidElem>
648  elem(new MAST::FrequencyDomainLinearizedConservativeFluidElem(*_fluid_sys, e, p));
649  elem->freq = _freq_function;
650  elem->sensitivity_param = _omega;
651 
652 
653  const Real
654  delta = 1.e-5,
655  tol = 1.e-2;
656 
657  const Complex
658  iota(0., 1.);
659 
660 
661  // number of dofs in this element
662  const unsigned int ndofs = 16;
663 
664  // now get the residual and Jacobian evaluations
666  x_base =RealVectorX::Zero(ndofs);
667 
669  x = ComplexVectorX::Zero(ndofs),
670  res0 = ComplexVectorX::Zero(ndofs),
671  res_sens = ComplexVectorX::Zero(ndofs),
672  res_sens_fd = ComplexVectorX::Zero(ndofs);
673 
675  jac_x = ComplexMatrixX::Zero(ndofs, ndofs),
676  jac_x_fd = ComplexMatrixX::Zero(ndofs, ndofs),
677  dummy;
678 
679 
680 
681  // set velocity to be zero
682  elem->set_velocity(x_base);
683 
684  // initialize the base solution vector. The 2D elem has 4 variables
685  for (unsigned int i=0; i<4; i++) {
686  for (unsigned int j=0; j<4; j++) {
687  x_base(i*4+j) = _base_sol(i);
688  }
689  }
690  elem->set_solution(x_base);
691 
692 
693  // both x and x0 are zero at this point.
694  // tell the element about the solution and velocity
695  elem->set_complex_solution(x);
696  elem->set_complex_solution(x, true);
697 
698  // get the base residual vector and the Jacobians for numerical comparisons
699  // later.
700  elem->side_external_residual(true, res0, jac_x, bc_map);
701 
702  // calculate the sensitivity of the residual
703  elem->side_external_residual_sensitivity(false, res_sens, dummy, bc_map);
704 
705  // now perturb the frequency parameter
706  *_omega = ((1. + delta) * (*_omega)());
707 
708  elem->side_external_residual(false, res_sens_fd, dummy, bc_map);
709  res_sens_fd -= res0;
710  res_sens_fd /= delta;
711 
712  // now compare the two sensitivity vectors
713  BOOST_TEST_MESSAGE("** Checking Real Part of Internal Residual Sensitivity **");
714  BOOST_CHECK(MAST::compare_vector( res_sens_fd.real(), res_sens.real(), tol));
715 
716  BOOST_TEST_MESSAGE("** Checking Real Part of Internal Residual Sensitivity **");
717  BOOST_CHECK(MAST::compare_vector( res_sens_fd.real(), res_sens.real(), tol));
718 }
719 
720 
721 BOOST_AUTO_TEST_SUITE_END()
722 
723 
724 
MAST::ConservativeFluidDiscipline * _discipline
MAST::BoundaryConditionBase * _far_field
void check_moving_wall_jacobian(MAST::BuildConservativeFluidElem &v, Real omega)
Matrix< Complex, Dynamic, 1 > ComplexVectorX
bool compare_vector(const RealVectorX &v0, const RealVectorX &v, const Real tol)
BOOST_FIXTURE_TEST_SUITE(PanelSmallDisturbanceFrequencyDomain2D, MAST::PanelInviscidSmallDisturbanceFrequencyDomain2DAnalysis) BOOST_AUTO_TEST_CASE(FreqDomainSensitivityWrtOmega)
bool compare_matrix(const RealMatrixX &m0, const RealMatrixX &m, const Real tol)
libMesh::Real Real
libMesh::Complex Complex
MAST::ConservativeFluidSystemInitialization * _fluid_sys
std::multimap< libMesh::boundary_id_type, MAST::BoundaryConditionBase * > SideBCMapType
MAST::FrequencyFunction * _freq_function
frequency object
Matrix< Complex, Dynamic, Dynamic > ComplexMatrixX
BOOST_AUTO_TEST_CASE(InternalForceJacobianZeroFreq)
Matrix< Real, Dynamic, 1 > RealVectorX
MAST::BoundaryConditionBase * _slip_wall
void check_internal_force_jacobian(MAST::BuildConservativeFluidElem &v, Real omega)
void check_far_field_jacobian(MAST::BuildConservativeFluidElem &v, Real omega)