MAST
Multidisciplinary-design Adaptation and Sensitivity Toolkit (MAST)
fluid_structure_assembly_elem_operations.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 // MAST includes
27 #include "mesh/geom_elem.h"
28 
29 
33 _base_sol (false),
34 _qty_type (MAST::INVALID_QTY) {
35 
36 }
37 
38 
39 
41 
42 }
43 
44 
45 void
47 set_elem_data(unsigned int dim,
48  const libMesh::Elem& ref_elem,
49  MAST::GeomElem& elem) const {
50 
51  libmesh_assert(!_physics_elem);
52 
53  if (dim == 1) {
54 
56  dynamic_cast<const MAST::ElementPropertyCard1D&>(_discipline->get_property_card(ref_elem));
57 
58  elem.set_local_y_vector(p.y_vector());
59  }
60 }
61 
62 
63 void
65 
66  libmesh_assert(!_physics_elem);
67 
69  dynamic_cast<const MAST::ElementPropertyCardBase&>(_discipline->get_property_card(elem));
70 
72  MAST::build_structural_element(*_system, elem, p).release();
73 }
74 
75 
76 
77 void
79  RealVectorX& vec,
80  RealMatrixX& mat) {
81 
82  libmesh_assert(if_jac);
83 
85  dynamic_cast<MAST::StructuralElementBase&>(*_physics_elem);
86 
88  dummy = RealMatrixX::Zero(mat.rows(), mat.cols());
89  mat.setZero();
90  vec.setZero();
91 
92  switch (_qty_type) {
93  case MAST::MASS: {
94 
95  e.inertial_residual(true, vec, mat, dummy, dummy);
96  }
97  break;
98 
99 
100  case MAST::DAMPING: {
101 
102  e.inertial_residual(true, vec, dummy, mat, dummy);
103  e.side_external_residual(true,
104  vec,
105  mat,
106  dummy,
109  vec,
110  mat,
111  dummy,
113  }
114  break;
115 
116  case MAST::STIFFNESS: {
117 
118  // create
119 
120  e.internal_residual(true, vec, mat);
121  e.inertial_residual(true, vec, dummy, dummy, mat);
122  e.side_external_residual(true,
123  vec,
124  dummy,
125  mat,
128  vec,
129  dummy,
130  mat,
132  }
133  break;
134 
135  default:
136  libmesh_error(); // should not get here
137  }
138 
139 
140 }
141 
142 
143 void
145 
147  dynamic_cast<MAST::StructuralElementBase&>(*_physics_elem);
148 
150  dummy = ComplexMatrixX::Zero(vec.size(), vec.size());
151  vec.setZero();
152 
154  vec,
155  dummy,
158  vec,
159  dummy,
161 }
162 
163 
164 
165 
166 void
168  bool if_jac,
169  RealVectorX& vec,
170  RealMatrixX& mat) {
171 
172  libmesh_assert(if_jac);
173 
175  dynamic_cast<MAST::StructuralElementBase&>(*_physics_elem);
176 
178  dummy = RealMatrixX::Zero(vec.size(), vec.size());
179  mat.setZero();
180  vec.setZero();
181 
182  switch (_qty_type) {
183  case MAST::MASS: {
184 
185  e.inertial_residual_sensitivity(f, true, vec, mat, dummy, dummy);
186  }
187  break;
188 
189  case MAST::DAMPING: {
190 
191  e.inertial_residual_sensitivity(f, true, vec, dummy, mat, dummy);
193  true,
194  vec,
195  mat,
196  dummy,
199  true,
200  vec,
201  mat,
202  dummy,
204  }
205  break;
206 
207 
208  case MAST::STIFFNESS: {
209 
210  e.internal_residual_sensitivity(f, true, vec, mat);
211 
212  // if the linearization is about a base state, then the sensitivity of
213  // the base state will influence the sensitivity of the Jacobian
214  if (_base_sol)
216 
217  e.inertial_residual_sensitivity(f, true, vec, dummy, dummy, mat);
219  vec,
220  dummy,
221  mat,
224  vec,
225  dummy,
226  mat,
228  }
229  break;
230 
231  default:
232  libmesh_error(); // should not get here
233  }
234 
235 
236 }
237 
238 
239 
240 void
243 
244  libmesh_error(); // to be implemented
245 }
246 
247 
bool linearized_frequency_domain_volume_external_residual(bool request_jacobian, ComplexVectorX &f, ComplexMatrixX &jac, std::multimap< libMesh::subdomain_id_type, MAST::BoundaryConditionBase *> &bc)
Calculates the frequency domain volume external force contribution to system residual.
MAST::StructuralQuantityType _qty_type
this defines the quantity to be assembled
const MAST::ElementPropertyCardBase & get_property_card(const libMesh::Elem &elem) const
get property card for the specified element
virtual bool inertial_residual_sensitivity(const MAST::FunctionBase &p, bool request_jacobian, RealVectorX &f, RealMatrixX &jac_xddot, RealMatrixX &jac_xdot, RealMatrixX &jac)
sensitivity of the inertial force contribution to system residual
bool _base_sol
whether or not the base solution was included for linearization
RealVectorX & y_vector()
returns value of the property val.
virtual void set_elem_data(unsigned int dim, const libMesh::Elem &ref_elem, MAST::GeomElem &elem) const
sets the structural element y-vector if 1D element is used.
Matrix< Complex, Dynamic, 1 > ComplexVectorX
void set_local_y_vector(const RealVectorX &y_vec)
for 1D elements the transformed coordinate system attached to the element defines the local x-axis al...
Definition: geom_elem.cpp:119
virtual bool inertial_residual(bool request_jacobian, RealVectorX &f, RealMatrixX &jac_xddot, RealMatrixX &jac_xdot, RealMatrixX &jac)
inertial force contribution to system residual
virtual bool internal_residual_sensitivity(const MAST::FunctionBase &p, bool request_jacobian, RealVectorX &f, RealMatrixX &jac)=0
sensitivity of the internal force contribution to system residual
MAST::PhysicsDisciplineBase * _discipline
const MAST::SideBCMapType & side_loads() const
virtual void init(const MAST::GeomElem &elem)
initializes the object for the geometric element elem.
Matrix< Real, Dynamic, Dynamic > RealMatrixX
Matrix< Complex, Dynamic, Dynamic > ComplexMatrixX
bool side_external_residual(bool request_jacobian, RealVectorX &f, RealMatrixX &jac_xdot, RealMatrixX &jac, std::multimap< libMesh::boundary_id_type, MAST::BoundaryConditionBase *> &bc)
side external force contribution to system residual.
Matrix< Real, Dynamic, 1 > RealVectorX
bool volume_external_residual(bool request_jacobian, RealVectorX &f, RealMatrixX &jac_xdot, RealMatrixX &jac, std::multimap< libMesh::subdomain_id_type, MAST::BoundaryConditionBase *> &bc)
volume external force contribution to system residual.
std::unique_ptr< MAST::StructuralElementBase > build_structural_element(MAST::SystemInitialization &sys, const MAST::GeomElem &elem, const MAST::ElementPropertyCardBase &p)
builds the structural element for the specified element type
virtual void elem_calculations(bool if_jac, RealVectorX &vec, RealMatrixX &mat)
This class acts as a wrapper around libMesh::Elem for the purpose of providing a uniform interface fo...
Definition: geom_elem.h:59
const MAST::VolumeBCMapType & volume_loads() const
virtual void elem_sensitivity_calculations(const MAST::FunctionBase &f, bool if_jac, RealVectorX &vec, RealMatrixX &mat)
bool side_external_residual_sensitivity(const MAST::FunctionBase &p, bool request_jacobian, RealVectorX &f, RealMatrixX &jac_xdot, RealMatrixX &jac, std::multimap< libMesh::boundary_id_type, MAST::BoundaryConditionBase *> &bc)
sensitivity of the side external force contribution to system residual
virtual bool internal_residual_jac_dot_state_sensitivity(RealMatrixX &jac)=0
calculates d[J]/d{x} .
bool linearized_frequency_domain_side_external_residual(bool request_jacobian, ComplexVectorX &f, ComplexMatrixX &jac, std::multimap< libMesh::boundary_id_type, MAST::BoundaryConditionBase *> &bc)
Calculates the external force due to frequency domain side external force contribution to system resi...
bool volume_external_residual_sensitivity(const MAST::FunctionBase &p, bool request_jacobian, RealVectorX &f, RealMatrixX &jac_xdot, RealMatrixX &jac, std::multimap< libMesh::subdomain_id_type, MAST::BoundaryConditionBase *> &bc)
sensitivity of the volume external force contribution to system residual
virtual bool internal_residual(bool request_jacobian, RealVectorX &f, RealMatrixX &jac)=0
internal force contribution to system residual
MAST::SystemInitialization * _system