MAST
frequency_domain_linearized_complex_assembly.cpp
Go to the documentation of this file.
1 /*
2  * MAST: Multidisciplinary-design Adaptation and Sensitivity Toolkit
3  * Copyright (C) 2013-2019 Manav Bhatia
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 // MAST includes
25 #include "base/assembly_base.h"
26 
27 
28 
32 _frequency(nullptr) {
33 
34 }
35 
36 
37 
38 
41 
42 }
43 
44 
45 
46 
47 void
50 
51  // make sure that is hasn't been set
52  libmesh_assert(!_frequency);
53 
54  _frequency = &f;
55 }
56 
57 
58 
59 
60 void
63 
64  _frequency = nullptr;
65 }
66 
67 
68 
69 void
71 elem_calculations(bool if_jac,
72  ComplexVectorX& vec,
73  ComplexMatrixX& mat) {
74 
75  libmesh_assert(_physics_elem);
76 
78  dynamic_cast<MAST::FrequencyDomainLinearizedConservativeFluidElem&>(*_physics_elem);
79 
80  vec.setZero();
81  mat.setZero();
82 
83  // assembly of the flux terms
84  e.internal_residual(if_jac, vec, mat);
85  e.side_external_residual(if_jac, vec, mat, _discipline->side_loads());
86 }
87 
88 
89 
90 void
93  ComplexVectorX& vec) {
94 
95  libmesh_assert(_physics_elem);
96 
98  dynamic_cast<MAST::FrequencyDomainLinearizedConservativeFluidElem&>(*_physics_elem);
99 
100  vec.setZero();
102  dummy = ComplexMatrixX::Zero(vec.size(), vec.size());
103 
104  // assembly of the flux terms
105  e.internal_residual_sensitivity(f, false, vec, dummy);
106  e.side_external_residual_sensitivity(f, false, vec, dummy, _discipline->side_loads());
107 }
108 
109 
110 
111 void
113 init(const MAST::GeomElem& elem) {
114 
115  libmesh_assert(!_physics_elem);
116  libmesh_assert(_system);
117  libmesh_assert(_assembly);
118 
119  const MAST::FlightCondition& p =
120  dynamic_cast<MAST::ConservativeFluidDiscipline&>
121  (_assembly->discipline()).flight_condition();
122 
124  *freq_elem =
126  freq_elem->freq = _frequency;
127 
128  _physics_elem = freq_elem;
129 }
130 
virtual void init(const MAST::GeomElem &elem)
initializes the object for the geometric element elem.
virtual bool internal_residual_sensitivity(const MAST::FunctionBase &p, bool request_jacobian, ComplexVectorX &f, ComplexMatrixX &jac)
sensitivity of internal force contribution to system residual.
bool side_external_residual(bool request_jacobian, ComplexVectorX &f, ComplexMatrixX &jac, std::multimap< libMesh::boundary_id_type, MAST::BoundaryConditionBase * > &bc)
side external force contribution to system residual
virtual bool internal_residual(bool request_jacobian, ComplexVectorX &f, ComplexMatrixX &jac)
internal force contribution to system residual
Matrix< Complex, Dynamic, 1 > ComplexVectorX
virtual void clear_frequency_function()
clears association with a system to this discipline, and vice-a-versa
MAST::PhysicsDisciplineBase * _discipline
MAST::FrequencyFunction * freq
frequency function that provides the frequency for computations.
virtual void elem_calculations(bool if_jac, ComplexVectorX &vec, ComplexMatrixX &mat)
performs the element calculations over elem, and returns the element vector and matrix quantities in ...
Matrix< Complex, Dynamic, Dynamic > ComplexMatrixX
MAST::FrequencyFunction * _frequency
frequency function used to define the oscillatory frequency
virtual void elem_sensitivity_calculations(const MAST::FunctionBase &f, ComplexVectorX &vec)
performs the element sensitivity calculations over elem, and returns the element residual sensitivity...
This class acts as a wrapper around libMesh::Elem for the purpose of providing a uniform interface fo...
Definition: geom_elem.h:59
void set_frequency_function(MAST::FrequencyFunction &f)
sets the frequency function for analysis
const MAST::SideBCMapType & side_loads() const
virtual bool side_external_residual_sensitivity(const MAST::FunctionBase &p, bool request_jacobian, ComplexVectorX &f, ComplexMatrixX &jac, std::multimap< libMesh::boundary_id_type, MAST::BoundaryConditionBase * > &bc)
sensitivity of internal force contribution to system residual.
MAST::SystemInitialization * _system
const MAST::PhysicsDisciplineBase & discipline() const