MAST
elem_base.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
21 #include "base/elem_base.h"
23 #include "base/nonlinear_system.h"
24 #include "mesh/fe_base.h"
25 
26 
28  MAST::AssemblyBase& assembly,
29  const MAST::GeomElem& elem):
30 _system (sys),
31 _assembly (assembly),
32 _elem (elem),
33 _active_sol_function (nullptr),
34 _time (_system.system().time) {
35 
36 }
37 
38 
40 
41 }
42 
43 
46  return _system.system();
47 }
48 
49 
50 
51 
52 const RealVectorX&
53 MAST::ElementBase::sol(bool if_sens) const {
54  if (!if_sens)
55  return _sol;
56  else
57  return _sol_sens;
58 }
59 
60 
61 void
63  bool if_sens) {
64 
65  if (!if_sens)
66  _sol = vec;
67  else
68  _sol_sens = vec;
69 }
70 
71 
72 
73 void
75  bool if_sens) {
76 
77  if (!if_sens)
78  _delta_sol = vec;
79  else
80  _delta_sol_sens = vec;
81 
82 }
83 
84 
85 void
87  bool if_sens) {
88 
89  if (!if_sens)
90  _complex_sol = vec;
91  else
92  _complex_sol_sens = vec;
93 
94 }
95 
96 
97 
98 
99 void
101  bool if_sens) {
102 
103  if (!if_sens)
104  _vel = vec;
105  else
106  _vel_sens = vec;
107 }
108 
109 
110 
111 void
113  bool if_sens) {
114 
115  if (!if_sens)
116  _delta_vel = vec;
117  else
118  _delta_vel_sens = vec;
119 }
120 
121 
122 
123 void
125  bool if_sens) {
126 
127  if (!if_sens)
128  _accel = vec;
129  else
130  _accel_sens = vec;
131 }
132 
133 
134 
135 void
137  bool if_sens) {
138 
139  if (!if_sens)
140  _delta_accel = vec;
141  else
142  _delta_accel_sens = vec;
143 }
144 
145 
146 
147 void
149 
150  // make sure that this has not already been set
151  libmesh_assert(!_active_sol_function);
152 
154 }
155 
156 
157 void
159 
160  _active_sol_function = nullptr;
161 }
162 
163 
164 
MAST::FunctionBase * _active_sol_function
pointer to the active solution mesh field function.
Definition: elem_base.h:226
MAST::NonlinearSystem & system()
const RealVectorX & sol(bool if_sens=false) const
Definition: elem_base.cpp:53
RealVectorX _accel
local acceleration
Definition: elem_base.h:297
This class implements a system for solution of nonlinear systems.
MAST::NonlinearSystem & system()
Definition: elem_base.cpp:45
RealVectorX _delta_vel
local velocity
Definition: elem_base.h:285
ElementBase(MAST::SystemInitialization &sys, MAST::AssemblyBase &assembly, const MAST::GeomElem &elem)
The default constructor.
Definition: elem_base.cpp:27
RealVectorX _delta_sol_sens
local solution used for linearized analysis
Definition: elem_base.h:268
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:100
RealVectorX _accel_sens
local acceleration
Definition: elem_base.h:303
RealVectorX _delta_accel
local acceleration
Definition: elem_base.h:309
RealVectorX _vel_sens
local velocity
Definition: elem_base.h:279
RealVectorX _delta_accel_sens
local acceleration
Definition: elem_base.h:315
ComplexVectorX _complex_sol
local solution used for frequency domain analysis
Definition: elem_base.h:250
void detach_active_solution_function()
Detaches the function object that may have been attached to the element.
Definition: elem_base.cpp:158
Matrix< Complex, Dynamic, 1 > ComplexVectorX
RealVectorX _vel
local velocity
Definition: elem_base.h:273
MAST::SystemInitialization & _system
SystemInitialization object associated with this element.
Definition: elem_base.h:208
RealVectorX _delta_sol
local solution used for linearized analysis
Definition: elem_base.h:262
virtual ~ElementBase()
Default virtual destructor.
Definition: elem_base.cpp:39
ComplexVectorX _complex_sol_sens
local solution used for frequency domain analysis
Definition: elem_base.h:256
Matrix< Real, Dynamic, 1 > RealVectorX
RealVectorX _sol_sens
local solution sensitivity
Definition: elem_base.h:244
RealVectorX _sol
local solution
Definition: elem_base.h:238
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:74
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:62
void attach_active_solution_function(MAST::FunctionBase &f)
Attaches the function that represents the system solution.
Definition: elem_base.cpp:148
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:112
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:136
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:86
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:124
RealVectorX _delta_vel_sens
local velocity
Definition: elem_base.h:291