MAST
surface_integrated_pressure_output.h
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 #ifndef __mast__surface_integrated_pressure_output__
21 #define __mast__surface_integrated_pressure_output__
22 
23 // C++ includes
24 #include <map>
25 #include <vector>
26 
27 // MAST includes
28 #include "base/mast_data_types.h"
30 
31 
32 namespace MAST {
33 
34 
35  // Forward declerations
36  class FunctionBase;
37 
38 
48 
49  public:
50 
51  enum OutputMode {
52  L2_NORM, // L2 norm of the lift
53  UNIT_VEC // dot product of the lift with a user provided unit vector
54  };
55 
56 
61  const RealVectorX& n_vec = RealVectorX::Zero(3,1));
62 
64 
65 
69  void clear();
70 
78  const RealVectorX* n_vec = nullptr);
79 
80 
84  void set_load(const RealVectorX& v) {
85 
86  libmesh_assert_equal_to(v.size(), 3);
87  _load = v;
88  }
89 
90 
94  Real value() const;
95 
96 
101  const RealVectorX& v) {
102 
103  libmesh_assert_equal_to(v.size(), 3);
104  libmesh_assert(_load_sensitivity.find(&f) == _load_sensitivity.end());
105 
106  _load_sensitivity[&f] = v;
107  }
108 
109 
114  Real sensitivity(const MAST::FunctionBase& f) const;
115 
116 
121 
122  libmesh_assert_equal_to(m.rows(), 3);
123 
124  _dload_dX = m;
125  }
126 
131  RealVectorX derivative() const;
132 
133 
134  protected:
135 
140 
141 
146 
147 
152 
156  std::map<const MAST::FunctionBase*, RealVectorX> _load_sensitivity;
157 
158 
164  };
165 }
166 
167 #endif // __mast__surface_integrated_pressure_output__
RealMatrixX _dload_dX
derivative of load wrt state vector.
void set_load(const RealVectorX &v)
sets the value of the load
The surface integrated pressure calculation in the fluid element will provide a force vector for the ...
void set_load_sensitivity(const MAST::FunctionBase &f, const RealVectorX &v)
sets the value of the load sensitivity wrt function f.
This provides the base class for definitin of element level contribution of output quantity in an ana...
Real sensitivity(const MAST::FunctionBase &f) const
libMesh::Real Real
MAST::SurfaceIntegratedPressureOutput::OutputMode _mode
output calculation mode
void set_output_mode(MAST::SurfaceIntegratedPressureOutput::OutputMode o, const RealVectorX *n_vec=nullptr)
sets the mode that will be used for calculation of the output functional from the load vector...
SurfaceIntegratedPressureOutput(MAST::SurfaceIntegratedPressureOutput::OutputMode o, const RealVectorX &n_vec=RealVectorX::Zero(3, 1))
default constructor
Matrix< Real, Dynamic, Dynamic > RealMatrixX
void set_load_derivative(const RealMatrixX &m)
sets the value of the load sensitivity wrt function f.
RealVectorX _load
This is the 3x1 vector of the integrated load.
RealVectorX _n_vec
unit vector used for output, if _mode = UNIT_VEC
Matrix< Real, Dynamic, 1 > RealVectorX
std::map< const MAST::FunctionBase *, RealVectorX > _load_sensitivity
map of sensitivity of the stress with respect to a parameter