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