homo_lin_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-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 general solid mechanics elements
27 
28 //Include guards to prevent multiple inclusion of the header
29 #ifndef OOMPH_HOMOGENISED_LINEAR_ELASTICITY_ELEMENTS_HEADER
30 #define OOMPH_HOMOGENISED_LINEAR_ELASTICITY_ELEMENTS_HEADER
31 
32 // Config header generated by autoconfig
33 #ifdef HAVE_CONFIG_H
34  #include <oomph-lib-config.h>
35 #endif
36 
37 
38 //OOMPH-LIB headers
39 #include "generic/Qelements.h"
40 #include "generic/mesh.h"
43 
44 
45 namespace oomph
46 {
47 //=======================================================================
51 //=======================================================================
53  public virtual FiniteElement
54  {
55  public:
56 
60 
64  virtual inline unsigned u_index_linear_elasticity(const unsigned i) const
65  {return i;}
66 
69  Vector<double>& disp)
70  const
71  {
72  //Find number of nodes
73  unsigned n_node = nnode();
74  //Local shape function
75  Shape psi(n_node);
76  //Find values of shape function
77  shape(s,psi);
78 
79  for (unsigned i=0;i<3;i++)
80  {
81  //Index at which the nodal value is stored
82  unsigned u_nodal_index = u_index_linear_elasticity(i);
83  //Initialise value of u
84  disp[i] = 0.0;
85  //Loop over the local nodes and sum
86  for(unsigned l=0;l<n_node;l++)
87  {
88  disp[i] += nodal_value(l,u_nodal_index)*psi[l];
89  }
90  }
91  }
92 
95  const unsigned &i) const
96  {
97  //Find number of nodes
98  unsigned n_node = nnode();
99  //Local shape function
100  Shape psi(n_node);
101  //Find values of shape function
102  shape(s,psi);
103 
104  //Get nodal index at which i-th velocity is stored
105  unsigned u_nodal_index = u_index_linear_elasticity(i);
106 
107  //Initialise value of u
108  double interpolated_u = 0.0;
109  //Loop over the local nodes and sum
110  for(unsigned l=0;l<n_node;l++)
111  {
112  interpolated_u += nodal_value(l,u_nodal_index)*psi[l];
113  }
114 
115  return(interpolated_u);
116  }
117 
123  {}
124 
126  unsigned* &p_pt() {return P_pt;}
127 
129  unsigned get_p()
130  {
131  if(P_pt==0)
132  {
133  throw OomphLibError("Integer P pointer not set\n",
136  return 0;
137  }
138  else {return *P_pt;}
139  }
140 
142  unsigned* &m_pt() {return M_pt;}
143 
145  unsigned get_m()
146  {
147  if(M_pt==0)
148  {
149  throw OomphLibError("Integer M pointer not set\n",
152  return 0;
153  }
154  else {return *M_pt;}
155  }
156 
159  {return Elasticity_tensor_fct_pt;}
160 
164  {return Elasticity_tensor_fct_pt;}
165 
169  {
170  if(this->Elasticity_tensor_fct_pt==0)
171  {
172  throw OomphLibError("Elasticity tensor function pointer not set\n",
175  }
176  else
177  {
178  (*this->Elasticity_tensor_fct_pt)(x,E_pt);
179  }
180  }
181 
183  const double& lambda_sq() const {return *Lambda_sq_pt;}
184 
186  double* &lambda_sq_pt() {return Lambda_sq_pt;}
187 
189  bool& unsteady() {return Unsteady;}
190 
192  bool unsteady() const {return Unsteady;}
193 
194  virtual FaceElement* make_face_element(const unsigned &s_fixed_index,
195  const int&s_limit)
196  {
197  throw OomphLibError(
198  "make_face_element not implemented",
201  }
202 
203  protected:
204 
207 
209  double* Lambda_sq_pt;
210 
212  unsigned *P_pt;
213 
215  unsigned *M_pt;
216 
218  bool Unsteady;
219 
221  static double Default_lambda_sq_value;
222 
223  };
224 
225 
226 //=======================================================================
229 //=======================================================================
230 template<unsigned DIM>
233  {
234  public:
235 
238 
240  unsigned required_nvalue(const unsigned &n) const {return 3;}
241 
245  {
248  }
249 
253  Vector<double> &residuals, DenseMatrix<double> &jacobian, unsigned flag);
254 
259  DenseMatrix<double> &jacobian)
260  {
261  //Add the contribution to the residuals
263  residuals,jacobian,1);
264  }
265 
268 
270  void output(std::ostream &outfile)
271  {
272  unsigned n_plot=5;
273  output(outfile,n_plot);
274  }
275 
277  void output(std::ostream &outfile, const unsigned &n_plot);
278 
279 
281  void output(FILE* file_pt)
282  {
283  unsigned n_plot=5;
284  output(file_pt,n_plot);
285  }
286 
288  void output(FILE* file_pt, const unsigned &n_plot);
289 
290  };
291 
292 
293 }
294 
295 #endif
296 
297 
298 
299 
int i
Definition: BiCGSTAB_step_by_step.cpp:9
const unsigned n
Definition: CG3DPackingUnitTest.cpp:11
MatrixXf H
Definition: HessenbergDecomposition_matrixH.cpp:4
Definition: linear_elasticity/elasticity_tensor.h:55
Definition: elements.h:4338
Definition: elements.h:1313
double nodal_value(const unsigned &n, const unsigned &i) const
Definition: elements.h:2593
virtual void shape(const Vector< double > &s, Shape &psi) const =0
unsigned nnode() const
Return the number of nodes.
Definition: elements.h:2210
static DenseMatrix< double > Dummy_matrix
Definition: elements.h:227
Definition: homo_lin_elasticity_elements.h:54
virtual unsigned u_index_linear_elasticity(const unsigned i) const
Definition: homo_lin_elasticity_elements.h:64
void interpolated_u_linear_elasticity(const Vector< double > &s, Vector< double > &disp) const
Compute vector of FE interpolated displacement u at local coordinate s.
Definition: homo_lin_elasticity_elements.h:68
virtual FaceElement * make_face_element(const unsigned &s_fixed_index, const int &s_limit)
Definition: homo_lin_elasticity_elements.h:194
bool Unsteady
Flag that switches inertia on/off.
Definition: homo_lin_elasticity_elements.h:218
bool & unsteady()
Access function to flag that switches inertia on/off.
Definition: homo_lin_elasticity_elements.h:189
double interpolated_u_linear_elasticity(const Vector< double > &s, const unsigned &i) const
Return FE interpolated displacement u[i] at local coordinate s.
Definition: homo_lin_elasticity_elements.h:94
unsigned *& p_pt()
Access function for the pointer to the p value.
Definition: homo_lin_elasticity_elements.h:126
HomLinElasticityTensorFctPt elasticity_tensor_fct_pt() const
Definition: homo_lin_elasticity_elements.h:163
unsigned * P_pt
Pointer to the index P in the cell problem.
Definition: homo_lin_elasticity_elements.h:212
HomLinElasticityTensorFctPt Elasticity_tensor_fct_pt
Pointer to the elasticity tensor.
Definition: homo_lin_elasticity_elements.h:206
bool unsteady() const
Access function to flag that switches inertia on/off (const version)
Definition: homo_lin_elasticity_elements.h:192
double *& lambda_sq_pt()
Access function for pointer to timescale ratio (nondim density)
Definition: homo_lin_elasticity_elements.h:186
HomogenisedLinearElasticityEquationsBase()
Definition: homo_lin_elasticity_elements.h:121
unsigned * M_pt
Pointer to the index M in the cell problem.
Definition: homo_lin_elasticity_elements.h:215
HomLinElasticityTensorFctPt & elasticity_tensor_fct_pt()
Access function to set the function pointer for the elasticity tensor.
Definition: homo_lin_elasticity_elements.h:158
static double Default_lambda_sq_value
Static default value for timescale ratio (1.0 – for natural scaling)
Definition: homo_lin_elasticity_elements.h:221
unsigned get_m()
Get the value of m.
Definition: homo_lin_elasticity_elements.h:145
void get_E_pt(const Vector< double > &x, ElasticityTensor *&E_pt)
Definition: homo_lin_elasticity_elements.h:168
double * Lambda_sq_pt
Timescale ratio (non-dim. density)
Definition: homo_lin_elasticity_elements.h:209
const double & lambda_sq() const
Access function for timescale ratio (nondim density)
Definition: homo_lin_elasticity_elements.h:183
void(* HomLinElasticityTensorFctPt)(const Vector< double > &x, ElasticityTensor *&E_pt)
Function pointer to a return a pointer to an elasticity tensor.
Definition: homo_lin_elasticity_elements.h:58
unsigned get_p()
Get the value of p.
Definition: homo_lin_elasticity_elements.h:129
unsigned *& m_pt()
Access function for the pointer to the m value.
Definition: homo_lin_elasticity_elements.h:142
Definition: homo_lin_elasticity_elements.h:233
void fill_in_contribution_to_jacobian(Vector< double > &residuals, DenseMatrix< double > &jacobian)
Definition: homo_lin_elasticity_elements.h:258
void calculate_effective_modulus(DenseMatrix< double > &H)
Compute contribution to the effective modulus.
Definition: homo_lin_elasticity_elements.cc:210
virtual void fill_in_generic_contribution_to_residuals_linear_elasticity(Vector< double > &residuals, DenseMatrix< double > &jacobian, unsigned flag)
Definition: homo_lin_elasticity_elements.cc:47
unsigned required_nvalue(const unsigned &n) const
Always have three displacement components.
Definition: homo_lin_elasticity_elements.h:240
HomogenisedLinearElasticityEquations()
Constructor.
Definition: homo_lin_elasticity_elements.h:237
void output(std::ostream &outfile)
Output: x,y,[z],xi0,xi1,[xi2],gamma.
Definition: homo_lin_elasticity_elements.h:270
void fill_in_contribution_to_residuals(Vector< double > &residuals)
Definition: homo_lin_elasticity_elements.h:244
void output(FILE *file_pt)
C-style output: x,y,[z],xi0,xi1,[xi2],gamma.
Definition: homo_lin_elasticity_elements.h:281
Definition: oomph_definitions.h:222
Definition: shape.h:76
RealScalar s
Definition: level1_cplx_impl.h:130
Vector< TimeHarmonicIsotropicElasticityTensor * > E_pt
The elasticity tensors for the two regions.
Definition: unstructured_acoustic_fsi.cc:135
DRAIG: Change all instances of (SPATIAL_DIM) to (DIM-1).
Definition: AnisotropicHookean.h:10
list x
Definition: plotDoE.py:28
#define OOMPH_EXCEPTION_LOCATION
Definition: oomph_definitions.h:61
#define OOMPH_CURRENT_FUNCTION
Definition: oomph_definitions.h:86