MAST
Multidisciplinary-design Adaptation and Sensitivity Toolkit (MAST)
heat_conduction_nonlinear_assembly.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 
21 // MAST includes
23 #include "base/assembly_base.h"
28 
29 
33 
34 }
35 
36 
37 
40 
41 }
42 
43 
44 void
46 set_elem_data(unsigned int dim,
47  const libMesh::Elem& ref_elem,
48  MAST::GeomElem& elem) const {
49 
50  libmesh_assert(!_physics_elem);
51 
52  if (dim == 1) {
53 
55  dynamic_cast<const MAST::ElementPropertyCard1D&>(_discipline->get_property_card(ref_elem));
56 
57  elem.set_local_y_vector(p.y_vector());
58  }
59 }
60 
61 
62 void
64 init(const MAST::GeomElem& elem) {
65 
66  libmesh_assert(!_physics_elem);
67  libmesh_assert(_system);
68  libmesh_assert(_assembly);
69 
71  dynamic_cast<const MAST::ElementPropertyCardBase&>
73 
76 }
77 
78 
79 
80 
81 void
83 elem_calculations(bool if_jac,
84  RealVectorX& vec,
85  RealMatrixX& mat) {
86 
87  libmesh_assert(_physics_elem);
88 
90  dynamic_cast<MAST::HeatConductionElementBase&>(*_physics_elem);
91 
92  vec.setZero();
93  mat.setZero();
94 
95  e.internal_residual(if_jac, vec, mat);
96  e.side_external_residual(if_jac, vec, mat, _discipline->side_loads());
97  e.volume_external_residual(if_jac, vec, mat, _discipline->volume_loads());
98 }
99 
100 
101 
102 
103 void
106  RealVectorX& vec) {
107 
108  libmesh_assert(_physics_elem);
109 
111  dynamic_cast<MAST::HeatConductionElementBase&>(*_physics_elem);
112 
113  vec.setZero();
114 
118 }
119 
120 
121 void
124  RealVectorX& vec) {
125 
126  libmesh_assert(_physics_elem);
127  libmesh_assert(f.is_topology_parameter());
128 
129  std::pair<const MAST::FieldFunction<RealVectorX>*, unsigned int>
130  val = this->get_elem_boundary_velocity_data();
131 
132  if (val.first) {
133 
135  dynamic_cast<MAST::HeatConductionElementBase&>(*_physics_elem);
136 
137  vec.setZero();
139  dummy = RealMatrixX::Zero(vec.size(), vec.size());
140 
142  val.second,
143  *val.first);
145  val.second,
146  *val.first,
148  /*e.side_external_residual_sensitivity(f, false,
149  vec,
150  dummy,
151  dummy,
152  _discipline->side_loads());*/
153  }
154 }
155 
156 
157 void
161  RealVectorX& vec) {
162 
163  libmesh_assert(_physics_elem);
164  libmesh_assert(f.is_topology_parameter());
165 
167  &elem = dynamic_cast<const MAST::LevelSetIntersectedElem&>(_physics_elem->elem());
168 
169  // sensitivity only exists at the boundary. So, we proceed with calculation
170  // only if this element has an intersection in the interior, or with a side.
171  if (elem.if_elem_has_level_set_boundary() &&
172  elem.if_subelem_has_side_on_level_set_boundary()) {
173 
175  dynamic_cast<MAST::HeatConductionElementBase&>(*_physics_elem);
176 
177  vec.setZero();
179  dummy = RealMatrixX::Zero(vec.size(), vec.size());
180 
182  elem.get_subelem_side_on_level_set_boundary(),
183  vel);
185  elem.get_subelem_side_on_level_set_boundary(),
186  vel,
188  /*e.side_external_residual_sensitivity(f, false,
189  vec,
190  dummy,
191  dummy,
192  _discipline->side_loads());*/
193  }
194 }
195 
196 
197 void
200 
201  libmesh_error(); // to be implemented
202 }
203 
virtual void elem_second_derivative_dot_solution_assembly(RealMatrixX &mat)
calculates over elem, and returns the matrix in vec .
virtual void elem_sensitivity_calculations(const MAST::FunctionBase &f, RealVectorX &vec)
performs the element sensitivity calculations over elem, and returns the element residual sensitivity...
const MAST::ElementPropertyCardBase & get_property_card(const libMesh::Elem &elem) const
get property card for the specified element
virtual void internal_residual(bool request_jacobian, RealVectorX &f, RealMatrixX &jac)
internal force contribution to system residual
RealVectorX & y_vector()
returns value of the property val.
virtual void init(const MAST::GeomElem &elem)
initializes the object for the geometric element elem.
void set_local_y_vector(const RealVectorX &y_vec)
for 1D elements the transformed coordinate system attached to the element defines the local x-axis al...
Definition: geom_elem.cpp:119
MAST::PhysicsDisciplineBase * _discipline
HeatConductionNonlinearAssemblyElemOperations()
constructor associates this assembly object with the system
virtual ~HeatConductionNonlinearAssemblyElemOperations()
destructor resets the association of this assembly object with the system
virtual void elem_calculations(bool if_jac, RealVectorX &vec, RealMatrixX &mat)
performs the element calculations over elem, and returns the element vector and matrix quantities in ...
virtual std::pair< const MAST::FieldFunction< RealVectorX > *, unsigned int > get_elem_boundary_velocity_data()
searches through the side load data and populates the data with the boundary id and velocity function...
virtual void internal_residual_sensitivity(const MAST::FunctionBase &p, RealVectorX &f)
sensitivity of the internal force contribution to system residual
virtual bool is_topology_parameter() const
Definition: function_base.h:97
void 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
const MAST::SideBCMapType & side_loads() const
Matrix< Real, Dynamic, Dynamic > RealMatrixX
This class inherits from MAST::GeomElem and provides an interface to initialize FE objects on sub-ele...
Matrix< Real, Dynamic, 1 > RealVectorX
virtual void set_elem_data(unsigned int dim, const libMesh::Elem &ref_elem, MAST::GeomElem &elem) const
sets the structural element y-vector if 1D element is used.
void side_external_residual_sensitivity(const MAST::FunctionBase &p, RealVectorX &f, std::multimap< libMesh::boundary_id_type, MAST::BoundaryConditionBase *> &bc)
sensitivity of the side external 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
const MAST::VolumeBCMapType & volume_loads() const
const MAST::GeomElem & elem() const
Definition: elem_base.h:109
void volume_external_residual(bool request_jacobian, RealVectorX &f, RealMatrixX &jac, std::multimap< libMesh::subdomain_id_type, MAST::BoundaryConditionBase *> &bc)
volume external force contribution to system residual
void volume_external_residual_sensitivity(const MAST::FunctionBase &p, RealVectorX &f, std::multimap< libMesh::subdomain_id_type, MAST::BoundaryConditionBase *> &bc)
sensitivity of the volume external force contribution to system residual
void volume_external_residual_boundary_velocity(const MAST::FunctionBase &p, RealVectorX &f, const unsigned int s, const MAST::FieldFunction< RealVectorX > &vel_f, std::multimap< libMesh::subdomain_id_type, MAST::BoundaryConditionBase *> &bc)
boundary velocity contribution of volume external force.
This element implements the Galerkin discretization of the heat conduction problem with the flux pro...
virtual void internal_residual_boundary_velocity(const MAST::FunctionBase &p, RealVectorX &f, const unsigned int s, const MAST::FieldFunction< RealVectorX > &vel_f)
sensitivity of the internal force contribution to system residual
virtual void elem_topology_sensitivity_calculations(const MAST::FunctionBase &f, RealVectorX &vec)
performs the element topology sensitivity calculations over elem, and returns the element residual se...
MAST::SystemInitialization * _system