axisym_cylindrical_solid_traction_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-2026 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
27// Header file for elements that are used to apply surface loads to
28// the equations of elasticity
29
30#ifndef OOMPH_AXISYMM_SOLID_TRACTION_ELEMENTS_HEADER
31#define OOMPH_AXISYMM_SOLID_TRACTION_ELEMENTS_HEADER
32
33// Config header generated by autoconfig
34#ifdef HAVE_CONFIG_H
35#include <oomph-lib-config.h>
36#endif
37
38// OOMPH-LIB headers
39#include "../generic/Qelements.h"
40
41namespace oomph
42{
43 //======================================================================
44 /// A class for elements that allow the imposition of an applied traction
45 /// in the principle of virtual displacements.
46 /// The geometrical information can be read from the FaceGeometry<ELEMENT>
47 /// class and and thus, we can be generic enough without the need to have
48 /// a separate equations class.
49 //======================================================================
50 template<class ELEMENT>
52 : public virtual FaceGeometry<ELEMENT>,
53 public virtual SolidFaceElement
54 {
55 private:
56 /// Pointer to an imposed traction function
57 void (*Traction_fct_pt)(const double& time,
58 const Vector<double>& xi,
59 const Vector<double>& x,
60 const Vector<double>& n,
62
63 protected:
64 /// Return the surface traction force
65 void get_traction(const double& time,
66 const Vector<double>& xi,
67 const Vector<double>& x,
68 const Vector<double>& n,
70 {
71 // If the function pointer is zero return zero
72 if (Traction_fct_pt == 0)
73 {
74 // Loop over dimensions and set body forces to zero
75 // It's axisymmetric, so we only have "two" dimensions
76 for (unsigned i = 0; i < 2; i++)
77 {
78 result[i] = 0.0;
79 }
80 }
81 // Otherwise call the function
82 else
83 {
84 (*Traction_fct_pt)(time, xi, x, n, result);
85 }
86 }
87
88 public:
89 /// Constructor, which takes a "bulk" element and
90 /// the value of the index and its limit
92 FiniteElement* const& element_pt, const int& face_index)
93 : FaceGeometry<ELEMENT>(), FaceElement()
94 {
95 // Attach the geometrical information to the element. N.B. This function
96 // also assigns nbulk_value from the required_nvalue of the bulk element
97 element_pt->build_face_element(face_index, this);
98
99 // Set the body force function pointer to zero
100 Traction_fct_pt = 0;
101 }
102
103 /// Return the imposed traction pointer
104 void (*&traction_fct_pt())(const double&,
105 const Vector<double>&,
106 const Vector<double>&,
107 const Vector<double>&,
109 {
110 return Traction_fct_pt;
111 }
112
113 /// Return the residuals
115
116 /// Return the jacobian
125
126 /// Overload the output function
127 void output(std::ostream& outfile)
128 {
130 }
131
132 /// Output function: x,y,[z],u,v,[w],p in tecplot format
133 void output(std::ostream& outfile, const unsigned& n_plot)
134 {
136 }
137
138 /// Overload the output function
143
144 /// Output function: x,y,[z],u,v,[w],p in tecplot format
145 void output(FILE* file_pt, const unsigned& n_plot)
146 {
148 }
149 };
150
151
152 /// //////////////////////////////////////////////////////////////////////
153 /// //////////////////////////////////////////////////////////////////////
154 /// //////////////////////////////////////////////////////////////////////
155
156
157 //=======================================================================
158 /// Return the residuals for the AxisymmetricCylindricalSolidTractionElements
159 //=======================================================================
160 template<class ELEMENT>
161 void AxisymmetricCylindricalSolidTractionElement<
162 ELEMENT>::fill_in_contribution_to_residuals(Vector<double>& residuals)
163 {
164 // Find out how many nodes there are
165 unsigned n_node = nnode();
166
167 // Integer to hold the local equation number
168 int local_eqn = 0;
169
170 // Set up memory for the shape functions
171 // The surface is 1D, so we only have one local derivative
173 DShape dpsids(n_node, 1);
174
175 // Set the value of n_intpt
176 unsigned n_intpt = integral_pt()->nweight();
177
178 // Get the timestepper from the first node
179 TimeStepper* time_step_pt = this->node_pt(0)->time_stepper_pt();
180
181 // Loop over the integration points
182 for (unsigned ipt = 0; ipt < n_intpt; ipt++)
183 {
184 // Get the integral weight
185 double w = integral_pt()->weight(ipt);
186
187 // Only need to call the local derivatives
188 dshape_local_at_knot(ipt, psi, dpsids);
189
190 // Calculate the global position and lagrangian coordinate
191 Vector<double> interpolated_x(2, 0.0), interpolated_xi(2, 0.0);
192 // Calculate the global and lagrangian derivtives wrt the local
193 // coordinates
194 Vector<double> interpolated_dxds(2, 0.0), interpolated_dxids(2, 0.0);
195
196 // Calculate displacements and derivatives
197 for (unsigned l = 0; l < n_node; l++)
198 {
199 // Loop over the number of lagrangian coordinates (2)
200 for (unsigned i = 0; i < 2; i++)
201 {
202 // Calculate the global position
203 interpolated_x[i] += nodal_position(l, i) * psi(l);
204 interpolated_xi[i] += this->lagrangian_position(l, i) * psi(l);
205 // Calculate the derivatives of the global and lagrangian
206 // coordinates
207 interpolated_dxds[i] += nodal_position(l, i) * dpsids(l, 0);
208 interpolated_dxids[i] +=
209 this->lagrangian_position(l, i) * dpsids(l, 0);
210 }
211 }
212
213 // Now find the deformed local metric tensor (determinant) from the
214 // tangent vectors
215 double A_det = interpolated_x[0] * interpolated_x[0] *
218
219 // Premultiply the weights and the square-root of the determinant of
220 // the metric tensor
221 double W = w * sqrt(A_det);
222
223 // Also find the normal
225 outer_unit_normal(ipt, interpolated_normal);
226
227 // Now calculate the load
228 Vector<double> traction(2);
229
230 // Normal is outwards
231 get_traction(time_step_pt->time(),
232 interpolated_xi,
233 interpolated_x,
235 traction);
236
237 //=====LOAD TERMS FROM PRINCIPLE OF VIRTUAL DISPLACEMENTS========
238
239 // Loop over the test functions, nodes of the element
240 for (unsigned l = 0; l < n_node; l++)
241 {
242 // Loop over the displacement components
243 for (unsigned i = 0; i < 2; i++)
244 {
245 local_eqn = this->position_local_eqn(l, 0, i);
246 /*IF it's not a boundary condition*/
247 if (local_eqn >= 0)
248 {
249 // Add the loading terms to the residuals
250 residuals[local_eqn] -= traction[i] * psi(l) * W;
251 }
252 }
253 } // End of loop over shape functions
254 } // End of loop over integration points
255 }
256} // namespace oomph
257
258#endif
cstr elem_len * i
Definition cfortran.h:603
A class for elements that allow the imposition of an applied traction in the principle of virtual dis...
void fill_in_contribution_to_jacobian(Vector< double > &residuals, DenseMatrix< double > &jacobian)
Return the jacobian.
void output(std::ostream &outfile)
Overload the output function.
void get_traction(const double &time, const Vector< double > &xi, const Vector< double > &x, const Vector< double > &n, Vector< double > &result) const
Return the surface traction force.
void output(std::ostream &outfile, const unsigned &n_plot)
Output function: x,y,[z],u,v,[w],p in tecplot format.
void(* Traction_fct_pt)(const double &time, const Vector< double > &xi, const Vector< double > &x, const Vector< double > &n, Vector< double > &result)
Pointer to an imposed traction function.
AxisymmetricCylindricalSolidTractionElement(FiniteElement *const &element_pt, const int &face_index)
Constructor, which takes a "bulk" element and the value of the index and its limit.
void output(FILE *file_pt, const unsigned &n_plot)
Output function: x,y,[z],u,v,[w],p in tecplot format.
void(*&)(const double &, const Vector< double > &, const Vector< double > &, const Vector< double > &, Vector< double > &) traction_fct_pt()
Return the imposed traction pointer.
void fill_in_contribution_to_residuals(Vector< double > &residuals)
Return the residuals.
A Class for the derivatives of shape functions The class design is essentially the same as Shape,...
Definition shape.h:278
FaceElements are elements that coincide with the faces of higher-dimensional "bulk" elements....
Definition elements.h:4342
int & face_index()
Index of the face (a number that uniquely identifies the face in the element)
Definition elements.h:4630
FaceGeometry class definition: This policy class is used to allow construction of face elements that ...
Definition elements.h:5002
A general Finite Element class.
Definition elements.h:1317
virtual void output(std::ostream &outfile)
Output the element data — typically the values at the nodes in a format suitable for post-processing.
Definition elements.h:3054
virtual void build_face_element(const int &face_index, FaceElement *face_element_pt)
Function for building a lower dimensional FaceElement on the specified face of the FiniteElement....
Definition elements.cc:5163
TimeStepper *& time_stepper_pt()
Access function for pointer to time stepper: Null if object is not time-dependent.
A Class for shape functions. In simple cases, the shape functions have only one index that can be tho...
Definition shape.h:76
SolidFaceElements combine FaceElements and SolidFiniteElements and overload various functions so they...
Definition elements.h:4918
TAdvectionDiffusionReactionElement<NREAGENT,DIM,NNODE_1D> elements are isoparametric triangular DIM-d...
Base class for time-stepping schemes. Timestepper provides an approximation of the temporal derivativ...
virtual double weight(const unsigned &i, const unsigned &j) const
Access function for j-th weight for the i-th derivative.
DRAIG: Change all instances of (SPATIAL_DIM) to (DIM-1).