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-2022 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  //======================================================================
104  //======================================================================
106  {
107  public:
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",
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 
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 
211 
212 
214  void operator=(const DisplacementControlElement&) = delete;
215 
216 
220  {
222  }
223 
224 
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 
249  {
250  if (Displ_ctrl_local_eqn >= 0)
251  {
252  residuals[Displ_ctrl_local_eqn] =
256  }
257  }
258 
261  unsigned ndof_types() const
262  {
263  return 1;
264  }
265 
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:
305 
309 
313 
316 
320 
325 
328  unsigned Load_data_index;
329 
332  };
333 
334 } // namespace oomph
335 
336 #endif
Definition: nodes.h:86
unsigned nvalue() const
Return number of values stored in data object (incl pinned ones).
Definition: nodes.h:483
Definition: displacement_control_element.h:106
void fill_in_contribution_to_residuals(Vector< double > &residuals)
Definition: displacement_control_element.h:248
void operator=(const DisplacementControlElement &)=delete
Broken assignment operator.
Data * displacement_control_load_pt() const
Definition: displacement_control_element.h:219
SolidFiniteElement * Controlled_element_pt
Pointer to SolidFiniteElement at which control displacement is applied.
Definition: displacement_control_element.h:315
double * Control_position_value_pt
Definition: displacement_control_element.h:308
DisplacementControlElement(SolidFiniteElement *controlled_element_pt, const Vector< double > &controlled_point, const unsigned &controlled_direction, double *control_position_value_pt, Data *displacement_control_load_pt)
Definition: displacement_control_element.h:122
Vector< double > Controlled_point
Definition: displacement_control_element.h:319
void assign_additional_local_eqn_numbers()
Store local equation number of displacement control equation.
Definition: displacement_control_element.h:226
unsigned Load_data_index
Definition: displacement_control_element.h:328
void get_dof_numbers_for_unknowns(std::list< std::pair< unsigned long, unsigned >> &dof_lookup_list) const
Definition: displacement_control_element.h:274
DisplacementControlElement(SolidFiniteElement *controlled_element_pt, const Vector< double > &controlled_point, const unsigned &controlled_direction, double *control_position_value_pt)
Definition: displacement_control_element.h:177
bool Load_data_created_internally
Definition: displacement_control_element.h:324
unsigned ndof_types() const
Definition: displacement_control_element.h:261
DisplacementControlElement(const DisplacementControlElement &)=delete
Broken copy constructor.
unsigned Controlled_direction
Definition: displacement_control_element.h:312
Data * Displacement_control_load_pt
Definition: displacement_control_element.h:304
int Displ_ctrl_local_eqn
Local equation number of the control-displacement equation.
Definition: displacement_control_element.h:331
Node *& node_pt(const unsigned &n)
Return a pointer to the local node n.
Definition: elements.h:2175
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:3962
unsigned nnode() const
Return the number of nodes.
Definition: elements.h:2210
Definition: elements.h:73
unsigned long eqn_number(const unsigned &ieqn_local) const
Definition: elements.h:704
int local_eqn_number(const unsigned long &ieqn_global) const
Definition: elements.h:726
unsigned add_external_data(Data *const &data_pt, const bool &fd=true)
Definition: elements.cc:307
int internal_local_eqn(const unsigned &i, const unsigned &j) const
Definition: elements.h:267
int external_local_eqn(const unsigned &i, const unsigned &j)
Definition: elements.h:311
unsigned add_internal_data(Data *const &data_pt, const bool &fd=true)
Definition: elements.cc:62
Definition: oomph_definitions.h:222
Definition: elements.h:3561
Definition: nodes.h:1686
Data *const & variable_position_pt() const
Pointer to variable_position data (const version)
Definition: nodes.h:1765
DRAIG: Change all instances of (SPATIAL_DIM) to (DIM-1).
Definition: AnisotropicHookean.h:10
#define OOMPH_EXCEPTION_LOCATION
Definition: oomph_definitions.h:61
#define OOMPH_CURRENT_FUNCTION
Definition: oomph_definitions.h:86
std::ptrdiff_t j
Definition: tut_arithmetic_redux_minmax.cpp:2