Ttime_harmonic_linear_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// 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 Tri/Tet linear elasticity elements
31 #ifndef OOMPH_TTIME_HARMONIC_LINEAR_ELASTICITY_ELEMENTS_HEADER
32 #define OOMPH_TTIME_HARMONIC_LINEAR_ELASTICITY_ELEMENTS_HEADER
33 
34 
35 // Config header generated by autoconfig
36 #ifdef HAVE_CONFIG_H
37  #include <oomph-lib-config.h>
38 #endif
39 
40 
41 //OOMPH-LIB headers
42 #include "../generic/nodes.h"
43 #include "../generic/oomph_utilities.h"
44 #include "../generic/Telements.h"
46 #include "../generic/error_estimator.h"
47 
48 namespace oomph
49 {
50 
51 /////////////////////////////////////////////////////////////////////////
52 /////////////////////////////////////////////////////////////////////////
53 // TTimeHarmonicLinearElasticityElement
54 ////////////////////////////////////////////////////////////////////////
55 ////////////////////////////////////////////////////////////////////////
56 
57 
58 
59 //======================================================================
60 /// TTimeHarmonicLinearElasticityElement<DIM,NNODE_1D> elements are
61 /// isoparametric triangular
62 /// DIM-dimensional TimeHarmonicLinearElasticity elements with
63 /// NNODE_1D nodal points along each
64 /// element edge. Inherits from TElement and
65 /// TimeHarmonicLinearElasticityEquations
66 //======================================================================
67 template <unsigned DIM, unsigned NNODE_1D>
68  class TTimeHarmonicLinearElasticityElement : public TElement<DIM,NNODE_1D>,
70  public virtual ElementWithZ2ErrorEstimator
71  {
72 
73  public:
74 
75  ///\short Constructor: Call constructors for TElement and
76  /// TimeHarmonicLinearElasticity equations
79 
80 
81  /// Broken copy constructor
83  {
84  BrokenCopy::broken_copy("TTimeHarmonicLinearElasticityElement");
85  }
86 
87  /// Broken assignment operator
88 //Commented out broken assignment operator because this can lead to a conflict warning
89 //when used in the virtual inheritence hierarchy. Essentially the compiler doesn't
90 //realise that two separate implementations of the broken function are the same and so,
91 //quite rightly, it shouts.
92  /*void operator=(const TTimeHarmonicLinearElasticityElement<DIM,NNODE_1D>&)
93  {
94  BrokenCopy::broken_assign("TTimeHarmonicLinearElasticityElement");
95  }*/
96 
97  /// \short Output function:
98  void output(std::ostream &outfile)
99  {
101  }
102 
103  /// \short Output function:
104  void output(std::ostream &outfile, const unsigned &nplot)
105  {
107  }
108 
109 
110  /// \short C-style output function:
111  void output(FILE* file_pt)
112  {
114  }
115 
116  /// \short C-style output function:
117  void output(FILE* file_pt, const unsigned &n_plot)
118  {
120  }
121 
122 
123  /// \short Number of vertex nodes in the element
124  unsigned nvertex_node() const
126 
127  /// \short Pointer to the j-th vertex node in the element
128  Node* vertex_node_pt(const unsigned& j) const
129  {
131  }
132 
133  /// \short Order of recovery shape functions for Z2 error estimation:
134  /// Same order as shape functions.
135  unsigned nrecovery_order() {return NNODE_1D-1;}
136 
137  /// Number of 'flux' terms for Z2 error estimation
138  unsigned num_Z2_flux_terms()
139  {
140  // DIM Diagonal strain rates and DIM*(DIM-1)/2 off diagonal terms
141  return 2*(DIM + DIM*(DIM-1)/2);
142  }
143 
144  /// \short Get 'flux' for Z2 error recovery: Upper triangular entries
145  /// in strain tensor.
147  {
148 #ifdef PARANOID
149  unsigned num_entries=2*(DIM+((DIM*DIM)-DIM)/2);
150  if (flux.size()!=num_entries)
151  {
152  std::ostringstream error_message;
153  error_message << "The flux vector has the wrong number of entries, "
154  << flux.size() << ", whereas it should be "
155  << num_entries << std::endl;
156  throw OomphLibError(
157  error_message.str(),
158  OOMPH_CURRENT_FUNCTION,
159  OOMPH_EXCEPTION_LOCATION);
160  }
161 #endif
162 
163  // Get strain matrix
164  DenseMatrix<std::complex<double> > strain(DIM);
165  this->get_strain(s,strain);
166 
167  // Pack into flux Vector
168  unsigned icount=0;
169 
170  // Start with diagonal terms
171  for(unsigned i=0;i<DIM;i++)
172  {
173  flux[icount]=strain(i,i).real();
174  icount++;
175  flux[icount]=strain(i,i).imag();
176  icount++;
177  }
178 
179  //Off diagonals row by row
180  for(unsigned i=0;i<DIM;i++)
181  {
182  for(unsigned j=i+1;j<DIM;j++)
183  {
184  flux[icount]=strain(i,j).real();
185  icount++;
186  flux[icount]=strain(i,j).imag();
187  icount++;
188  }
189  }
190  }
191 
192 
193 
194 };
195 
196 //=======================================================================
197 /// Face geometry for the TTimeHarmonicLinearElasticityElement elements:
198 /// The spatial
199 /// dimension of the face elements is one lower than that of the
200 /// bulk element but they have the same number of points
201 /// along their 1D edges.
202 //=======================================================================
203 template<unsigned DIM, unsigned NNODE_1D>
205  public virtual TElement<DIM-1,NNODE_1D>
206 {
207 
208  public:
209 
210  /// \short Constructor: Call the constructor for the
211  /// appropriate lower-dimensional QElement
212  FaceGeometry() : TElement<DIM-1,NNODE_1D>() {}
213 
214 };
215 
216 //=======================================================================
217 /// Face geometry for the 1D TTimeHarmonicLinearElasticityElement elements:
218 /// Point elements
219 //=======================================================================
220 template<unsigned NNODE_1D>
222  public virtual PointElement
223 {
224 
225  public:
226 
227  /// \short Constructor: Call the constructor for the
228  /// appropriate lower-dimensional TElement
230 
231 };
232 
233 
234 
235 
236 }
237 
238 #endif
void broken_copy(const std::string &class_name)
Issue error message and terminate execution.
Base class for finite elements that can compute the quantities that are required for the Z2 error est...
unsigned nrecovery_order()
Order of recovery shape functions for Z2 error estimation: Same order as shape functions.
unsigned nvertex_node() const
Number of vertex nodes in the element.
void output(std::ostream &outfile)
Broken assignment operator.
FaceGeometry()
Constructor: Call the constructor for the appropriate lower-dimensional TElement. ...
cstr elem_len * i
Definition: cfortran.h:607
Nodes are derived from Data, but, in addition, have a definite (Eulerian) position in a space of a gi...
Definition: nodes.h:852
void output(std::ostream &outfile)
Output: x,y,[z],u_r,v_r,[w_r],u_i,v_i,[w_i].
FaceGeometry()
Constructor: Call the constructor for the appropriate lower-dimensional QElement. ...
unsigned num_Z2_flux_terms()
Number of &#39;flux&#39; terms for Z2 error estimation.
void get_Z2_flux(const Vector< double > &s, Vector< double > &flux)
Get &#39;flux&#39; for Z2 error recovery: Upper triangular entries in strain tensor.
void output(std::ostream &outfile, const unsigned &nplot)
Output function:
static char t char * s
Definition: cfortran.h:572
Node * vertex_node_pt(const unsigned &j) const
Pointer to the j-th vertex node in the element.
void get_strain(const Vector< double > &s, DenseMatrix< std::complex< double > > &strain) const
Return the strain tensor.
Class for dense matrices, storing all the values of the matrix as a pointer to a pointer with assorte...
Definition: communicator.h:50
TTimeHarmonicLinearElasticityElement(const TTimeHarmonicLinearElasticityElement< DIM, NNODE_1D > &dummy)
Broken copy constructor.
void output(FILE *file_pt, const unsigned &n_plot)
C-style output function:
TTimeHarmonicLinearElasticityElement()
Constructor: Call constructors for TElement and TimeHarmonicLinearElasticity equations.