MAST
frequency_function.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 // MAST includes
22 #include "base/parameter.h"
23 
24 
27  MAST::FieldFunction<Real>& velocity,
29 MAST::FieldFunction<Real>(nm),
30 _if_red_freq(false),
31 _omega(omega),
32 _velocity(velocity),
33 _b_ref(b_ref) {
34 
35  _functions.insert(&_omega);
36  _functions.insert(&_velocity);
37  _functions.insert(&_b_ref);
38 }
39 
40 
41 
43 
44 }
45 
46 
47 
48 void
50 
51  Real b, V;
52 
53  _omega(v);
54 
55  /*if (_if_red_freq) {
56 
57  _b_ref (b);
58  _velocity(V);
59 
60  v *= b/V;
61  }*/
62 }
63 
64 
65 
66 
67 void
69  Real& v) const {
70 
71  Real w, b, vel, dw, db, dvel;
72 
73  _omega(w); _omega.derivative( f, dw);
74  v = dw;
75 
76  /*if (_if_red_freq) {
77 
78  _b_ref (b); _b_ref.derivative (d, f, db);
79  _velocity(vel); _velocity.derivative( f, dvel);
80 
81  v *= b/vel;
82  v += w * (db/vel - b/vel/vel*dvel);
83  }*/
84 }
85 
86 
87 
88 
89 void
91 
92  if (!_if_red_freq)
93  v = 1.;
94  else {
95 
96  Real vel;
97  _velocity(vel);
98  _b_ref(v);
99  v /= vel;
100  }
101 }
102 
MAST::FieldFunction< Real > & _b_ref
virtual void operator()(Real &v) const
calculates the value of the function and returns it in v.
std::set< const MAST::FunctionBase * > _functions
set of functions that this function depends on
libMesh::Real Real
MAST::FieldFunction< Real > & _velocity
virtual void derivative(const MAST::FunctionBase &f, Real &v) const
calculates the value of the function derivative and returns it in v.
void nondimensionalizing_factor(Real &v)
virtual void derivative(const MAST::FunctionBase &f, ValType &v) const
calculates the value of the function derivative and returns it in v.
MAST::FieldFunction< Real > & _omega
FrequencyFunction(const std::string &nm, MAST::FieldFunction< Real > &omega, MAST::FieldFunction< Real > &velocity, MAST::FieldFunction< Real > &b_ref)