displacement_control_element.h
Go to the documentation of this file.
1 // LIC// ====================================================================
2 // LIC// This file forms part of oomph-lib, the object-oriented,
3 // LIC// multi-physics finite-element library, available
4 // LIC// at http://www.oomph-lib.org.
5 // LIC//
6 // LIC// Copyright (C) 2006-2024 Matthias Heil and Andrew Hazel
7 // LIC//
8 // LIC// This library is free software; you can redistribute it and/or
9 // LIC// modify it under the terms of the GNU Lesser General Public
10 // LIC// License as published by the Free Software Foundation; either
11 // LIC// version 2.1 of the License, or (at your option) any later version.
12 // LIC//
13 // LIC// This library is distributed in the hope that it will be useful,
14 // LIC// but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // LIC// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 // LIC// Lesser General Public License for more details.
17 // LIC//
18 // LIC// You should have received a copy of the GNU Lesser General Public
19 // LIC// License along with this library; if not, write to the Free Software
20 // LIC// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21 // LIC// 02110-1301 USA.
22 // LIC//
23 // LIC// The authors may be contacted at oomph-lib@maths.man.ac.uk.
24 // LIC//
25 // LIC//====================================================================
26 // Header file for classes that define element objects
27 
28 // Include guard to prevent multiple inclusions of the header
29 #ifndef OOMPH_DISPLACEMENT_CONTROL_ELEMENT_HEADER
30 #define OOMPH_DISPLACEMENT_CONTROL_ELEMENT_HEADER
31 
32 
33 // Config header generated by autoconfig
34 #ifdef HAVE_CONFIG_H
35 #include <oomph-lib-config.h>
36 #endif
37 
38 #include <deque>
39 
40 // oomph-lib includes
41 #include "elements.h"
42 
43 namespace oomph
44 {
45  //======================================================================
46  /// Displacement control element: In the "normal" formulation
47  /// of solid mechanics problems, the external load is given and the
48  /// displacement throughout the solid body is computed.
49  /// For highly nonlinear problems it is sometimes helpful to
50  /// re-formulate the problem by prescribing the position of a
51  /// selected control point and treating the (scalar) load level
52  /// required to achieve this deformation as an unknown.
53  /// As an example consider the buckling of pressure-loaded,
54  /// thin-walled elastic shells.
55  /// The load-displacement characteristics of such structures tend to be highly
56  /// nonlinear and bifurcations from the structure's pre-buckling state
57  /// often occur via sub-critical bifurcations. If we have some
58  /// a-priori knowledge of the expected deformation (for example, during the
59  /// non-axisymmetric buckling of a circular cylindrical shell certain
60  /// material points will be displaced radially inwards), it
61  /// is advantageous to prescribe the radial displacement of a carefully
62  /// selected control point and treat the external pressure as an unknown.
63  ///
64  /// \c DisplacementControlElements facilitate the use of
65  /// such methods. They require the specification of
66  /// - the control point at which the displacement is prescribed. This is
67  /// done by specifying:
68  /// - a pointer, \c controlled_element_pt, to a \c SolidFiniteElement and
69  /// - the vector \c controlled_point which contains the local
70  /// coordinates of the control point in that \c SolidFiniteElement.
71  /// .
72  /// - the coordinate direction. \c controlled_direction. in which
73  /// the displacement is controlled.
74  /// - a pointer to a double, \c control_position_value_pt,
75  /// that specifies the desired value of the prescribed
76  /// coordinate after the deformation (i.e. if \c controlled_direction=1
77  /// then \c *control_position_value_pt specifies
78  /// the \f$ x_1 \f$ coordinate of the control point in the deformed
79  /// configuration.)
80  /// .
81  /// The \c DisplacementControlElement has two constructors:
82  /// - In the first version, we pass the pointer to the \c Data object whose
83  /// one-and-only value contains the scalar load level that is "traded"
84  /// for the displacement constraint. This is appropriate if the
85  /// load \c Data has already been created (and is included in the
86  /// overall equation numbering procedure) by some other element. In that
87  /// case the \c DisplacementControlElement treats the (already existing)
88  /// \c Data object external \c Data.
89  /// - In the second version, a \c Data object (with a single value)
90  /// is created by the constructor of the \c DisplacementControlElement
91  /// and stored in its internal \c Data. Once the
92  /// \c DisplacementControlElement has been included in one of the
93  /// \c Problem's meshes, it is therefore automatically included
94  /// in the equation numbering procedure. The (pointer to) the
95  /// newly created \c Data is accessible via the access function
96  /// \c displacement_control_load_pt(). It can be used to make
97  /// make the unknown load level accessible to the load function
98  /// that drives the deformation.
99  /// .
100  /// \b Note: The element inherits from the BlockPreconditionableElementBase
101  /// and can be used in the block-preconditioning context. The element
102  /// is "in charge" of the control load (if it's been created internally)
103  /// and classifies it as its one-and-only "DOF type"
104  //======================================================================
106  {
107  public:
108  /// Constructor. Pass:
109  /// - Pointer to \c SolidFiniteElement that contains the control point
110  /// - Vector that contains the local coordinates of the control point
111  /// in that element.
112  /// - the coordinate direction in which the position of the control
113  /// point is prescribed
114  /// - pointer to double that specifies the prescribed coordinate
115  /// of the control point
116  /// - Pointer to Data item whose one-and-only value
117  /// contains the load value that is being adjusted
118  /// to allow displacement control.
119  /// .
120  /// The load \c Data is treated as external \c Data for this
121  /// element.
123  const Vector<double>& controlled_point,
124  const unsigned& controlled_direction,
125  double* control_position_value_pt,
128  Control_position_value_pt(control_position_value_pt),
129  Controlled_direction(controlled_direction),
130  Controlled_element_pt(controlled_element_pt),
131  Controlled_point(controlled_point)
132  {
133 #ifdef PARANOID
135  {
136  throw OomphLibError(
137  "Displacement control data must only contain a single value!\n",
138  OOMPH_CURRENT_FUNCTION,
139  OOMPH_EXCEPTION_LOCATION);
140  }
141 #endif
142 
143  // The displacement control load is external Data for this element;
144  // add it to the container and and store its index in that container.
146 
147  // Store flag
149 
150  // The positional degrees of freedom of all the nodes in the
151  // controlled SolidFiniteElement are external Data
152  // for this element
153  unsigned nnode = Controlled_element_pt->nnode();
154  for (unsigned j = 0; j < nnode; j++)
155  {
157  static_cast<SolidNode*>(Controlled_element_pt->node_pt(j))
159  }
160  }
161 
162  /// Constructor. Pass:
163  /// - Pointer to \c SolidFiniteElement that contains the control point
164  /// - Vector that contains the local coordinates of the control point
165  /// in that element.
166  /// - the coordinate direction in which the position of the control
167  /// point is prescribed
168  /// - pointer to double that specifies the prescribed coordinate
169  /// of the control point
170  /// .
171  /// The pointer to a Data item whose one-and-only value
172  /// contains the load value that is being adjusted
173  /// to allow displacement control is created internally (and stored
174  /// in the element's internal \c Data. It is accessible (for use
175  /// the load function) via the access function
176  /// \c displacement_control_load_pt()
178  const Vector<double>& controlled_point,
179  const unsigned& controlled_direction,
180  double* control_position_value_pt)
181  : Control_position_value_pt(control_position_value_pt),
182  Controlled_direction(controlled_direction),
183  Controlled_element_pt(controlled_element_pt),
184  Controlled_point(controlled_point)
185  {
186  // Create displacement control load internally (below, we'll store it
187  // in the element's internal data so it'll be killed automatically --
188  // no need for a destructor)
190 
191  // The displacement control load is internal Data for this element
193 
194  // Store flag
196 
197  // The positional degrees of freedom of all the nodes in the
198  // controlled SolidFiniteElement are external Data
199  // for this element
200  unsigned nnode = Controlled_element_pt->nnode();
201  for (unsigned j = 0; j < nnode; j++)
202  {
204  static_cast<SolidNode*>(Controlled_element_pt->node_pt(j))
206  }
207  }
208 
209  /// Broken copy constructor
211 
212 
213  /// Broken assignment operator
214  void operator=(const DisplacementControlElement&) = delete;
215 
216 
217  /// Pointer to Data object whose one-and-only value represents the
218  /// load that is adjusted to allow displacement control
220  {
222  }
223 
224 
225  /// Store local equation number of displacement control equation
227  {
229  {
230  // Local equation number is the local equation number of the
231  // one and only (i.e. the zero-th value stored in the
232  // load data (which is stored in the internal data)
234  }
235  else
236  {
237  // Local equation number is the local equation number of the
238  // one and only (i.e. the zero-th value stored in the
239  // load data (which is stored in the external data)
241  }
242  }
243 
244 
245  /// Add the element's contribution to its residual vector:
246  /// The displacement constraint. [Note: Jacobian is computed
247  /// automatically by finite-differencing]
249  {
250  if (Displ_ctrl_local_eqn >= 0)
251  {
252  residuals[Displ_ctrl_local_eqn] =
256  }
257  }
258 
259  /// The number of "DOF" that degrees of freedom in this element
260  /// are sub-divided into: Just the control pressure.
261  unsigned ndof_types() const
262  {
263  return 1;
264  }
265 
266  /// Create a list of pairs for all unknowns in this element,
267  /// so that the first entry in each pair contains the global equation
268  /// number of the unknown, while the second one contains the number
269  /// of the "DOF type" that this unknown is associated with.
270  /// (Function can obviously only be called if the equation numbering
271  /// scheme has been set up.) The only dof this element is in charge
272  /// of is the control load, provided it's been created as
273  /// internal Data.
275  std::list<std::pair<unsigned long, unsigned>>& dof_lookup_list) const
276  {
278  {
279  // temporary pair (used to store dof lookup prior to being
280  // added to list)
281  std::pair<unsigned long, unsigned> dof_lookup;
282 
283  // determine local eqn number for displacement control eqn
285 
286  // Is it a dof or is it pinned?
287  if (local_eqn_number >= 0)
288  {
289  // store dof lookup in temporary pair: First entry in pair
290  // is global equation number; second entry is dof type
291  dof_lookup.first = this->eqn_number(local_eqn_number);
292  dof_lookup.second = 0;
293 
294  // Add to list
295  dof_lookup_list.push_front(dof_lookup);
296  }
297  }
298  }
299 
300  protected:
301  /// Pointer to Data item whose one-and-only value
302  /// contains the load value that is being adjusted
303  /// to allow displacement control.
305 
306  /// Pointer to the value that stores the prescribed coordinate
307  /// of the control point
309 
310  /// Coordinate direction in which the displacement of the
311  /// control point is controlled
313 
314  /// Pointer to SolidFiniteElement at which control displacement is applied
316 
317  /// Vector of local coordinates of point at which control
318  /// displacement is applied
320 
321  /// Flag to indicate if load data was created internally or
322  /// externally (and is therefore stored in the element's internal or
323  /// external Data)
325 
326  /// In which component (in the vector of the element's internal or
327  /// external Data) is the load stored?
328  unsigned Load_data_index;
329 
330  /// Local equation number of the control-displacement equation
332  };
333 
334 } // namespace oomph
335 
336 #endif
A class that represents a collection of data; each Data object may contain many different individual ...
Definition: nodes.h:86
unsigned nvalue() const
Return number of values stored in data object (incl pinned ones).
Definition: nodes.h:483
Displacement control element: In the "normal" formulation of solid mechanics problems,...
void fill_in_contribution_to_residuals(Vector< double > &residuals)
Add the element's contribution to its residual vector: The displacement constraint....
void operator=(const DisplacementControlElement &)=delete
Broken assignment operator.
Data * displacement_control_load_pt() const
Pointer to Data object whose one-and-only value represents the load that is adjusted to allow displac...
SolidFiniteElement * Controlled_element_pt
Pointer to SolidFiniteElement at which control displacement is applied.
double * Control_position_value_pt
Pointer to the value that stores the prescribed coordinate of the control point.
DisplacementControlElement(SolidFiniteElement *controlled_element_pt, const Vector< double > &controlled_point, const unsigned &controlled_direction, double *control_position_value_pt, Data *displacement_control_load_pt)
Constructor. Pass:
Vector< double > Controlled_point
Vector of local coordinates of point at which control displacement is applied.
void assign_additional_local_eqn_numbers()
Store local equation number of displacement control equation.
unsigned Load_data_index
In which component (in the vector of the element's internal or external Data) is the load stored?
void get_dof_numbers_for_unknowns(std::list< std::pair< unsigned long, unsigned >> &dof_lookup_list) const
Create a list of pairs for all unknowns in this element, so that the first entry in each pair contain...
DisplacementControlElement(SolidFiniteElement *controlled_element_pt, const Vector< double > &controlled_point, const unsigned &controlled_direction, double *control_position_value_pt)
Constructor. Pass:
bool Load_data_created_internally
Flag to indicate if load data was created internally or externally (and is therefore stored in the el...
unsigned ndof_types() const
The number of "DOF" that degrees of freedom in this element are sub-divided into: Just the control pr...
DisplacementControlElement(const DisplacementControlElement &)=delete
Broken copy constructor.
unsigned Controlled_direction
Coordinate direction in which the displacement of the control point is controlled.
Data * Displacement_control_load_pt
Pointer to Data item whose one-and-only value contains the load value that is being adjusted to allow...
int Displ_ctrl_local_eqn
Local equation number of the control-displacement equation.
Node *& node_pt(const unsigned &n)
Return a pointer to the local node n.
Definition: elements.h:2179
virtual double interpolated_x(const Vector< double > &s, const unsigned &i) const
Return FE interpolated coordinate x[i] at local coordinate s.
Definition: elements.cc:3992
unsigned nnode() const
Return the number of nodes.
Definition: elements.h:2214
A Generalised Element class.
Definition: elements.h:73
unsigned add_internal_data(Data *const &data_pt, const bool &fd=true)
Add a (pointer to an) internal data object to the element and return the index required to obtain it ...
Definition: elements.cc:67
unsigned long eqn_number(const unsigned &ieqn_local) const
Return the global equation number corresponding to the ieqn_local-th local equation number.
Definition: elements.h:708
int local_eqn_number(const unsigned long &ieqn_global) const
Return the local equation number corresponding to the ieqn_global-th global equation number....
Definition: elements.h:730
int internal_local_eqn(const unsigned &i, const unsigned &j) const
Return the local equation number corresponding to the j-th value stored at the i-th internal data.
Definition: elements.h:267
int external_local_eqn(const unsigned &i, const unsigned &j)
Return the local equation number corresponding to the j-th value stored at the i-th external data.
Definition: elements.h:311
unsigned add_external_data(Data *const &data_pt, const bool &fd=true)
Add a (pointer to an) external data object to the element and return its index (i....
Definition: elements.cc:312
An OomphLibError object which should be thrown when an run-time error is encountered....
////////////////////////////////////////////////////////////////////// //////////////////////////////...
Definition: elements.h:3565
A Class for nodes that deform elastically (i.e. position is an unknown in the problem)....
Definition: nodes.h:1686
Data *const & variable_position_pt() const
Pointer to variable_position data (const version)
Definition: nodes.h:1765
//////////////////////////////////////////////////////////////////// ////////////////////////////////...