MAST
conservative_fluid_transient_assembly.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
26 #include "base/assembly_base.h"
27 
28 
32 
33 }
34 
35 
36 
37 
40 
41 }
42 
43 
44 
45 void
47 elem_calculations(bool if_jac,
48  RealVectorX& f_m,
49  RealVectorX& f_x,
50  RealMatrixX& f_m_jac_xdot,
51  RealMatrixX& f_m_jac,
52  RealMatrixX& f_x_jac) {
53 
54  libmesh_assert(_physics_elem);
55 
57  dynamic_cast<MAST::ConservativeFluidElementBase&>(*_physics_elem);
58 
59  f_m.setZero();
60  f_x.setZero();
61  f_m_jac_xdot.setZero();
62  f_m_jac.setZero();
63  f_x_jac.setZero();
64 
65  // assembly of the flux terms
66  e.internal_residual(if_jac, f_x, f_x_jac);
67  e.side_external_residual(if_jac, f_x, f_x_jac, _discipline->side_loads());
68 
69  //assembly of the capacitance term
70  e.velocity_residual(if_jac, f_m, f_m_jac_xdot, f_m_jac);
71 }
72 
73 
74 
75 void
78 
79  libmesh_assert(_physics_elem);
80 
82  dynamic_cast<MAST::ConservativeFluidElementBase&>(*_physics_elem);
83 
84  const unsigned int
85  n = (unsigned int) f.size();
86 
88  dummy = RealMatrixX::Zero(n, n);
89 
90  f.setZero();
91 
92 
93  e.linearized_internal_residual(false, f, dummy);
95 
96  // velocity term
97  e.linearized_velocity_residual(false, f, dummy, dummy);
98 }
99 
100 
101 
102 
103 void
106  RealVectorX& f_m,
107  RealVectorX& f_x) {
108 
109  libmesh_assert(_physics_elem);
110 
112  dynamic_cast<MAST::ConservativeFluidElementBase&>(*_physics_elem);
113 
114  unsigned int
115  n = (unsigned int)f_m.size();
116 
118  dummy = RealMatrixX::Zero(n, n);
119 
120  f_m.setZero();
121  f_x.setZero();
122 
123  // assembly of the flux terms
124  e.internal_residual_sensitivity(f, false, f_x, dummy);
125  e.side_external_residual_sensitivity(f, false, f_x, dummy, _discipline->side_loads());
126 
127  //assembly of the capacitance term
128  e.velocity_residual_sensitivity(f, false, f_m, dummy, dummy);
129 
130 }
131 
132 
133 
134 void
137 
138  libmesh_error(); // to be implemented
139 }
140 
141 
142 void
144 init(const MAST::GeomElem& elem) {
145 
146  libmesh_assert(!_physics_elem);
147  libmesh_assert(_system);
148  libmesh_assert(_assembly);
149 
150  const MAST::FlightCondition& p =
151  dynamic_cast<MAST::ConservativeFluidDiscipline&>
152  (_assembly->discipline()).flight_condition();
153 
154  _physics_elem =
156 }
157 
virtual void linearized_jacobian_solution_product(RealVectorX &f)
Calculates the product of Jacobian-solution, and Jacobian-velocity over the element for a system of t...
This class provides the necessary functionality for spatial discretization of the conservative fluid ...
virtual bool linearized_velocity_residual(bool request_jacobian, RealVectorX &f, RealMatrixX &jac_xdot, RealMatrixX &jac)
inertial force contribution to system residual of the linearized problem
virtual void elem_second_derivative_dot_solution_assembly(RealMatrixX &mat)
calculates over elem, and returns the matrix in vec .
virtual void elem_calculations(bool if_jac, RealVectorX &f_m, RealVectorX &f_x, RealMatrixX &f_m_jac_x_dot, RealMatrixX &f_m_jac, RealMatrixX &f_x_jac)
performs the element calculations over elem, and returns the element vector and matrix quantities in ...
virtual bool linearized_internal_residual(bool request_jacobian, RealVectorX &f, RealMatrixX &jac)
internal force contribution to system residual of the linearized problem.
virtual bool velocity_residual(bool request_jacobian, RealVectorX &f, RealMatrixX &jac_xdot, RealMatrixX &jac)
inertial force contribution to system residual
bool side_external_residual(bool request_jacobian, RealVectorX &f, RealMatrixX &jac, std::multimap< libMesh::boundary_id_type, MAST::BoundaryConditionBase * > &bc)
side external force contribution to system residual
MAST::PhysicsDisciplineBase * _discipline
bool side_external_residual_sensitivity(const MAST::FunctionBase &p, bool request_jacobian, RealVectorX &f, RealMatrixX &jac, std::multimap< libMesh::boundary_id_type, MAST::BoundaryConditionBase * > &bc)
sensitivity of the side external force contribution to system residual
virtual bool velocity_residual_sensitivity(const MAST::FunctionBase &p, bool request_jacobian, RealVectorX &f, RealMatrixX &jac_xdot, RealMatrixX &jac)
sensitivity of the damping force contribution to system residual
bool linearized_side_external_residual(bool request_jacobian, RealVectorX &f, RealMatrixX &jac, std::multimap< libMesh::boundary_id_type, MAST::BoundaryConditionBase * > &bc)
side external force contribution to system residual
virtual ~ConservativeFluidTransientAssemblyElemOperations()
destructor resets the association of this assembly object with the system
Matrix< Real, Dynamic, Dynamic > RealMatrixX
Matrix< Real, Dynamic, 1 > RealVectorX
virtual bool internal_residual(bool request_jacobian, RealVectorX &f, RealMatrixX &jac)
internal force contribution to system residual
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 elem_sensitivity_calculations(const MAST::FunctionBase &f, RealVectorX &f_m, RealVectorX &f_x)
performs the element sensitivity calculations over elem, and returns the element residual sensitivity...
virtual bool internal_residual_sensitivity(const MAST::FunctionBase &p, bool request_jacobian, RealVectorX &f, RealMatrixX &jac)
sensitivity of the internal force contribution to system residual
const MAST::SideBCMapType & side_loads() const
ConservativeFluidTransientAssemblyElemOperations()
constructor associates this assembly object with the system
MAST::SystemInitialization * _system
virtual void init(const MAST::GeomElem &elem)
initializes the object for the geometric element elem.
const MAST::PhysicsDisciplineBase & discipline() const