MAST
pressure_function.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 
21 #ifndef __mast__pressure_function_h__
22 #define __mast__pressure_function_h__
23 
24 
25 // MAST includes
27 
28 
29 // libMesh includes
30 #include "libmesh/system.h"
31 #include "libmesh/mesh_function.h"
32 
33 
34 namespace MAST {
35 
36  // Forward declerations
37  class FrequencyFunction;
38  class SystemInitialization;
39  class FlightCondition;
40 
41 
43  public MAST::FieldFunction<Real> {
44 
45  public:
46 
49 
50 
51  virtual ~PressureFunction();
52 
53 
57  void set_calculate_cp(bool if_cp) {
58 
59  _if_cp = if_cp;
60  }
61 
62 
66  void use_reference_pressure(Real ref_press) {
67 
68  // only if cp is not being used
69  libmesh_assert(!_if_cp);
70 
71  _ref_pressure = ref_press;
72  }
73 
74 
78  void init(const libMesh::NumericVector<Real>& steady_sol,
79  const libMesh::NumericVector<Real>* small_dist_sol = nullptr);
80 
81 
85  virtual void
86  operator() (const libMesh::Point& p,
87  const Real t,
88  Real& press) const;
89 
90 
95  virtual void
96  perturbation(const libMesh::Point& p,
97  const Real t,
98  Real& dpress) const;
99 
100 
101  protected:
102 
107  bool _if_cp;
108 
114 
119 
120 
125 
126 
130  std::unique_ptr<libMesh::MeshFunction>
133 
137  std::unique_ptr<libMesh::NumericVector<Real> > _sol;
138 
142  std::unique_ptr<libMesh::NumericVector<Real> > _dsol;
143  };
144 }
145 
146 
147 #endif // __mast__pressure_function_h__
std::unique_ptr< libMesh::MeshFunction > _sol_function
mesh function that interpolates the solution
PressureFunction(MAST::SystemInitialization &sys, MAST::FlightCondition &flt)
void init(const libMesh::NumericVector< Real > &steady_sol, const libMesh::NumericVector< Real > *small_dist_sol=nullptr)
initiate the mesh function for this solution
Real _ref_pressure
the function will return pressure differential with respect to reference pressue defined in the fligh...
MAST::FlightCondition & _flt_cond
flight condition
virtual void operator()(const libMesh::Point &p, const Real t, Real &press) const
provides the value of the pressure at the specified point and time
libMesh::Real Real
std::unique_ptr< libMesh::NumericVector< Real > > _sol
steady part of solution
virtual void perturbation(const libMesh::Point &p, const Real t, Real &dpress) const
provides the pressure perturbation.
void use_reference_pressure(Real ref_press)
sets the mode of the pressure value return
This creates the base class for functions that have a saptial and temporal dependence, and provide sensitivity operations with respect to the functions and parameters.
std::unique_ptr< libMesh::NumericVector< Real > > _dsol
small-disturbance solution
std::unique_ptr< libMesh::MeshFunction > _dsol_function
void set_calculate_cp(bool if_cp)
sets the mode of the pressure value return
MAST::SystemInitialization & _system
system associated with the mesh and solution vector
bool _if_cp
the function will return cp instead of pressure if this option is true.