MAST
Multidisciplinary-design Adaptation and Sensitivity Toolkit (MAST)
elem_base.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 // MAST includes
21 #include "base/elem_base.h"
23 #include "base/nonlinear_system.h"
24 #include "mesh/fe_base.h"
25 
26 
28  const MAST::GeomElem& elem):
29 _system (sys),
30 _elem (elem),
31 _active_sol_function (nullptr),
32 _time (_system.system().time) {
33 
34 }
35 
36 
38 
39 }
40 
41 
44  return _system.system();
45 }
46 
47 
48 
49 
50 const RealVectorX&
51 MAST::ElementBase::sol(bool if_sens) const {
52  if (!if_sens)
53  return _sol;
54  else
55  return _sol_sens;
56 }
57 
58 
59 void
61  bool if_sens) {
62 
63  if (!if_sens)
64  _sol = vec;
65  else
66  _sol_sens = vec;
67 }
68 
69 
70 
71 void
73  bool if_sens) {
74 
75  if (!if_sens)
76  _delta_sol = vec;
77  else
78  _delta_sol_sens = vec;
79 
80 }
81 
82 
83 void
85  bool if_sens) {
86 
87  if (!if_sens)
88  _complex_sol = vec;
89  else
90  _complex_sol_sens = vec;
91 
92 }
93 
94 
95 
96 
97 void
99  bool if_sens) {
100 
101  if (!if_sens)
102  _vel = vec;
103  else
104  _vel_sens = vec;
105 }
106 
107 
108 
109 void
111  bool if_sens) {
112 
113  if (!if_sens)
114  _delta_vel = vec;
115  else
116  _delta_vel_sens = vec;
117 }
118 
119 
120 
121 void
123  bool if_sens) {
124 
125  if (!if_sens)
126  _accel = vec;
127  else
128  _accel_sens = vec;
129 }
130 
131 
132 
133 void
135  bool if_sens) {
136 
137  if (!if_sens)
138  _delta_accel = vec;
139  else
140  _delta_accel_sens = vec;
141 }
142 
143 
144 
145 void
147 
148  // make sure that this has not already been set
149  libmesh_assert(!_active_sol_function);
150 
152 }
153 
154 
155 void
157 
158  _active_sol_function = nullptr;
159 }
160 
161 
162 
MAST::FunctionBase * _active_sol_function
pointer to the active solution mesh field function.
Definition: elem_base.h:213
MAST::NonlinearSystem & system()
RealVectorX _accel
local acceleration
Definition: elem_base.h:284
This class implements a system for solution of nonlinear systems.
MAST::NonlinearSystem & system()
Definition: elem_base.cpp:43
RealVectorX _delta_vel
local velocity
Definition: elem_base.h:272
RealVectorX _delta_sol_sens
local solution used for linearized analysis
Definition: elem_base.h:255
virtual void set_velocity(const RealVectorX &vec, bool if_sens=false)
stores vec as velocity for element level calculations, or its sensitivity if if_sens is true...
Definition: elem_base.cpp:98
RealVectorX _accel_sens
local acceleration
Definition: elem_base.h:290
RealVectorX _delta_accel
local acceleration
Definition: elem_base.h:296
const RealVectorX & sol(bool if_sens=false) const
Definition: elem_base.cpp:51
RealVectorX _vel_sens
local velocity
Definition: elem_base.h:266
RealVectorX _delta_accel_sens
local acceleration
Definition: elem_base.h:302
ComplexVectorX _complex_sol
local solution used for frequency domain analysis
Definition: elem_base.h:237
void detach_active_solution_function()
Detaches the function object that may have been attached to the element.
Definition: elem_base.cpp:156
Matrix< Complex, Dynamic, 1 > ComplexVectorX
RealVectorX _vel
local velocity
Definition: elem_base.h:260
ElementBase(MAST::SystemInitialization &sys, const MAST::GeomElem &elem)
The default constructor.
Definition: elem_base.cpp:27
MAST::SystemInitialization & _system
SystemInitialization object associated with this element.
Definition: elem_base.h:200
RealVectorX _delta_sol
local solution used for linearized analysis
Definition: elem_base.h:249
virtual ~ElementBase()
Default virtual destructor.
Definition: elem_base.cpp:37
ComplexVectorX _complex_sol_sens
local solution used for frequency domain analysis
Definition: elem_base.h:243
Matrix< Real, Dynamic, 1 > RealVectorX
RealVectorX _sol_sens
local solution sensitivity
Definition: elem_base.h:231
RealVectorX _sol
local solution
Definition: elem_base.h:225
virtual void set_perturbed_solution(const RealVectorX &vec, bool if_sens=false)
This provides the perturbed solution (or its sensitivity if if_sens is true.) for linearized analysis...
Definition: elem_base.cpp:72
This class acts as a wrapper around libMesh::Elem for the purpose of providing a uniform interface fo...
Definition: geom_elem.h:59
virtual void set_solution(const RealVectorX &vec, bool if_sens=false)
stores vec as solution for element level calculations, or its sensitivity if if_sens is true...
Definition: elem_base.cpp:60
void attach_active_solution_function(MAST::FunctionBase &f)
Attaches the function that represents the system solution.
Definition: elem_base.cpp:146
virtual void set_perturbed_velocity(const RealVectorX &vec, bool if_sens=false)
stores vec as perturbed velocity for element level calculations, or its sensitivity if if_sens is tru...
Definition: elem_base.cpp:110
virtual void set_perturbed_acceleration(const RealVectorX &vec, bool if_sens=false)
stores vec as perturbed acceleration for element level calculations, or its sensitivity if if_sens is...
Definition: elem_base.cpp:134
virtual void set_complex_solution(const ComplexVectorX &vec, bool if_sens=false)
This provides the complex solution (or its sensitivity if if_sens is true.) for frequecy-domain analy...
Definition: elem_base.cpp:84
virtual void set_acceleration(const RealVectorX &vec, bool if_sens=false)
stores vec as acceleration for element level calculations, or its sensitivity if if_sens is true...
Definition: elem_base.cpp:122
RealVectorX _delta_vel_sens
local velocity
Definition: elem_base.h:278