Tlinear_elasticity_elements.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 Tri/Tet linear elasticity elements
27 #ifndef OOMPH_TLINEAR_ELASTICITY_ELEMENTS_HEADER
28 #define OOMPH_TLINEAR_ELASTICITY_ELEMENTS_HEADER
29 
30 
31 // Config header generated by autoconfig
32 #ifdef HAVE_CONFIG_H
33 #include <oomph-lib-config.h>
34 #endif
35 
36 
37 // OOMPH-LIB headers
38 #include "../generic/nodes.h"
39 #include "../generic/oomph_utilities.h"
40 #include "../generic/Telements.h"
42 #include "../generic/error_estimator.h"
43 
44 
45 namespace oomph
46 {
47  /// //////////////////////////////////////////////////////////////////////
48  /// //////////////////////////////////////////////////////////////////////
49  // TLinearElasticityElement
50  /// /////////////////////////////////////////////////////////////////////
51  /// /////////////////////////////////////////////////////////////////////
52 
53 
54  //======================================================================
55  /// TLinearElasticityElement<DIM,NNODE_1D> elements are
56  /// isoparametric triangular
57  /// DIM-dimensional LinearElasticity elements with
58  /// NNODE_1D nodal points along each
59  /// element edge. Inherits from TElement and LinearElasticityEquations
60  //======================================================================
61  template<unsigned DIM, unsigned NNODE_1D>
63  : public virtual TElement<DIM, NNODE_1D>,
64  public virtual LinearElasticityEquations<DIM>,
65  public virtual ElementWithZ2ErrorEstimator
66  {
67  public:
68  /// Constructor: Call constructors for TElement and
69  /// LinearElasticity equations
71  : TElement<DIM, NNODE_1D>(), LinearElasticityEquations<DIM>()
72  {
73  }
74 
75 
76  /// Broken copy constructor
78  const TLinearElasticityElement<DIM, NNODE_1D>& dummy) = delete;
79 
80  /// Broken assignment operator
81  // Commented out broken assignment operator because this can lead to a
82  // conflict warning when used in the virtual inheritence hierarchy.
83  // Essentially the compiler doesn't realise that two separate
84  // implementations of the broken function are the same and so, quite
85  // rightly, it shouts.
86  /*void operator=(const TLinearElasticityElement<DIM,NNODE_1D>&) = delete;*/
87 
88  /// Output function:
89  void output(std::ostream& outfile)
90  {
92  }
93 
94  /// Output function:
95  void output(std::ostream& outfile, const unsigned& nplot)
96  {
98  }
99 
100 
101  /// C-style output function:
102  void output(FILE* file_pt)
103  {
105  }
106 
107  /// C-style output function:
108  void output(FILE* file_pt, const unsigned& n_plot)
109  {
111  }
112 
113  /// Number of vertex nodes in the element
114  unsigned nvertex_node() const
115  {
117  }
118 
119  /// Pointer to the j-th vertex node in the element
120  Node* vertex_node_pt(const unsigned& j) const
121  {
123  }
124 
125  /// Order of recovery shape functions for Z2 error estimation:
126  /// Same order as shape functions.
127  unsigned nrecovery_order()
128  {
129  return NNODE_1D - 1;
130  }
131 
132  /// Number of 'flux' terms for Z2 error estimation
133  unsigned num_Z2_flux_terms()
134  {
135  // DIM Diagonal strain rates and DIM*(DIM-1)/2 off diagonal terms
136  return (DIM + DIM * (DIM - 1) / 2);
137  }
138 
139  /// Get 'flux' for Z2 error recovery: Upper triangular entries
140  /// in strain tensor.
142  {
143 #ifdef PARANOID
144  unsigned num_entries = (DIM + ((DIM * DIM) - DIM) / 2);
145  if (flux.size() != num_entries)
146  {
147  std::ostringstream error_message;
148  error_message << "The flux vector has the wrong number of entries, "
149  << flux.size() << ", whereas it should be " << num_entries
150  << std::endl;
151  throw OomphLibError(error_message.str(),
152  OOMPH_CURRENT_FUNCTION,
153  OOMPH_EXCEPTION_LOCATION);
154  }
155 #endif
156 
157  // Get strain matrix
158  DenseMatrix<double> strain(DIM);
159  this->get_strain(s, strain);
160 
161  // Pack into flux Vector
162  unsigned icount = 0;
163 
164  // Start with diagonal terms
165  for (unsigned i = 0; i < DIM; i++)
166  {
167  flux[icount] = strain(i, i);
168  icount++;
169  }
170 
171  // Off diagonals row by row
172  for (unsigned i = 0; i < DIM; i++)
173  {
174  for (unsigned j = i + 1; j < DIM; j++)
175  {
176  flux[icount] = strain(i, j);
177  icount++;
178  }
179  }
180  }
181  };
182 
183  //=======================================================================
184  /// Face geometry for the TLinearElasticityElement elements: The spatial
185  /// dimension of the face elements is one lower than that of the
186  /// bulk element but they have the same number of points
187  /// along their 1D edges.
188  //=======================================================================
189  template<unsigned DIM, unsigned NNODE_1D>
191  : public virtual TElement<DIM - 1, NNODE_1D>
192  {
193  public:
194  /// Constructor: Call the constructor for the
195  /// appropriate lower-dimensional QElement
196  FaceGeometry() : TElement<DIM - 1, NNODE_1D>() {}
197  };
198 
199  //=======================================================================
200  /// Face geometry for the 1D TLinearElasticityElement elements: Point elements
201  //=======================================================================
202  template<unsigned NNODE_1D>
204  : public virtual PointElement
205  {
206  public:
207  /// Constructor: Call the constructor for the
208  /// appropriate lower-dimensional TElement
210  };
211 
212 
213 } // namespace oomph
214 
215 #endif
static char t char * s
Definition: cfortran.h:568
cstr elem_len * i
Definition: cfortran.h:603
Base class for finite elements that can compute the quantities that are required for the Z2 error est...
FaceGeometry()
Constructor: Call the constructor for the appropriate lower-dimensional TElement.
FaceGeometry()
Constructor: Call the constructor for the appropriate lower-dimensional QElement.
//////////////////////////////////////////////////////////////////// ////////////////////////////////...
Definition: elements.h:5002
void get_strain(const Vector< double > &s, DenseMatrix< double > &strain) const
Return the strain tensor.
//////////////////////////////////////////////////////////////////// ////////////////////////////////...
void output(std::ostream &outfile)
Output: x,y,[z],u,v,[w].
Nodes are derived from Data, but, in addition, have a definite (Eulerian) position in a space of a gi...
Definition: nodes.h:906
An OomphLibError object which should be thrown when an run-time error is encountered....
/////////////////////////////////////////////////////////////////////// /////////////////////////////...
Definition: elements.h:3443
General TElement class.
Definition: Telements.h:1208
//////////////////////////////////////////////////////////////////////
unsigned num_Z2_flux_terms()
Number of 'flux' terms for Z2 error estimation.
unsigned nvertex_node() const
Number of vertex nodes in the element.
unsigned nrecovery_order()
Order of recovery shape functions for Z2 error estimation: Same order as shape functions.
Node * vertex_node_pt(const unsigned &j) const
Pointer to the j-th vertex node in the element.
void get_Z2_flux(const Vector< double > &s, Vector< double > &flux)
Get 'flux' for Z2 error recovery: Upper triangular entries in strain tensor.
TLinearElasticityElement(const TLinearElasticityElement< DIM, NNODE_1D > &dummy)=delete
Broken copy constructor.
void output(std::ostream &outfile)
Broken assignment operator.
void output(FILE *file_pt, const unsigned &n_plot)
C-style output function:
void output(std::ostream &outfile, const unsigned &nplot)
Output function:
void output(FILE *file_pt)
C-style output function:
TLinearElasticityElement()
Constructor: Call constructors for TElement and LinearElasticity equations.
//////////////////////////////////////////////////////////////////// ////////////////////////////////...