benchmark_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
28// OOMPH-LIB headers
29#include "generic/nodes.h"
30#include "generic/Qelements.h"
31#include "generic/oomph_utilities.h"
32
33
34namespace oomph
35{
36 //=============================================================
37 /// A class for elements to solve the 1D radial displacement ODE
38 /// in the spherical shell compression benchmark problem.
39 //=============================================================
40 template<unsigned N_NODE1D>
41 class ShellBenchmarkElement : public virtual QElement<1, N_NODE1D>,
42 public virtual FiniteElement
43 {
44 public:
45 /// Constructor ()
47
48 /// Broken copy constructor
50
51 /// Broken assignment operator
52 void operator=(const ShellBenchmarkElement&) = delete;
53
54 /// Required # of `values' (pinned or dofs) at node n
55 inline unsigned required_nvalue(const unsigned& n) const
56 {
57 return 1;
58 }
59
60 /// Access function: Poisson ratio
61 const double& nu() const
62 {
63 return *Nu_pt;
64 }
65
66 /// Pointer to Poisson ratio
67 double*& nu_pt()
68 {
69 return Nu_pt;
70 }
71
72 /// Output FE representation of soln: x,y,u or x,y,z,u at
73 /// n_plot^DIM plot points
74 void output(std::ostream& outfile, const unsigned& n_plot);
75
76 /// Add the element's contribution to its residual vector (wrapper)
77 void fill_in_contribution_to_residuals(Vector<double>& residuals)
78 {
79 // Call the generic residuals function with flag set to 0
80 // using a dummy matrix argument
82 }
83
84 /// Return FE representation of function value u at local coordinate s
85 virtual inline double interpolated_u_shell_benchmark(
86 const Vector<double>& s) const
87 {
88 // Find number of nodes
89 const unsigned n_node = nnode();
90
91 // Get the index at which the poisson unknown is stored
92 const unsigned u_nodal_index = 0; // u_index_shell_benchmark();
93
94 // Local shape function
95 Shape psi(n_node);
96
97 // Find values of shape function
98 shape(s, psi);
99
100 // Initialise value of u
101 double interpolated_u = 0.0;
102
103 // Loop over the local nodes and sum
104 for (unsigned l = 0; l < n_node; l++)
105 {
106 interpolated_u += this->nodal_value(l, u_nodal_index) * psi[l];
107 }
108
109 return (interpolated_u);
110 }
111
112 protected:
113 /// Compute element residual Vector only (if flag=and/or element
114 /// Jacobian matrix
116 Vector<double>& residuals);
117
118 /// Pointer to the Poisson ratio
119 double* Nu_pt;
120 };
121
122
123 //======================================================================
124 /// Face elements for the application of an external pressure
125 //======================================================================
126 class ShellBenchmarkPressureElement : public virtual PointElement,
127 public virtual FaceElement
128 {
129 public:
130 /// Constructor, takes the pointer to the "bulk" element and the
131 /// index of the face to be created
132 ShellBenchmarkPressureElement(FiniteElement* const& bulk_el_pt,
133 const int& face_index)
134 {
135 // Let the bulk element build the FaceElement, i.e. setup the pointers
136 // to its nodes (by referring to the appropriate nodes in the bulk
137 // element), etc.
138 bulk_el_pt->build_face_element(face_index, this);
139 }
140
141 /// Broken copy constructor
143 delete;
144
145 /// Compute the element residual vector
146 inline void fill_in_contribution_to_residuals(Vector<double>& residuals)
147 {
148 // Call the generic residuals function with flag set to 0
149 // using a dummy matrix argument
151 }
152
153 /// Access function: Poisson ratio
154 const double& pressure() const
155 {
156 return *Pressure_pt;
157 }
158
159 /// Pointer to Poisson ratio
160 double*& pressure_pt()
161 {
162 return Pressure_pt;
163 }
164
165 protected:
166 /// Compute the element residual vector.
167 /// flag=1(or 0): do (or don't) compute the Jacobian as well.
169 Vector<double>& residuals);
170
171 /// Pointer to the applied pressure
172 double* Pressure_pt;
173
174 /// The index at which the unknown is stored at the nodes
176 };
177} // namespace oomph
A class for elements to solve the 1D radial displacement ODE in the spherical shell compression bench...
const double & nu() const
Access function: Poisson ratio.
void operator=(const ShellBenchmarkElement &)=delete
Broken assignment operator.
void output(std::ostream &outfile, const unsigned &n_plot)
Output FE representation of soln: x,y,u or x,y,z,u at n_plot^DIM plot points.
void fill_in_contribution_to_residuals(Vector< double > &residuals)
Add the element's contribution to its residual vector (wrapper)
ShellBenchmarkElement(const ShellBenchmarkElement &dummy)=delete
Broken copy constructor.
virtual void fill_in_generic_residual_contribution_shell_benchmark(Vector< double > &residuals)
Compute element residual Vector only (if flag=and/or element Jacobian matrix.
double *& nu_pt()
Pointer to Poisson ratio.
double * Nu_pt
Pointer to the Poisson ratio.
virtual double interpolated_u_shell_benchmark(const Vector< double > &s) const
Return FE representation of function value u at local coordinate s.
unsigned required_nvalue(const unsigned &n) const
Required # of ‘values’ (pinned or dofs) at node n.
Face elements for the application of an external pressure.
double * Pressure_pt
Pointer to the applied pressure.
void fill_in_generic_residual_contribution_shell_benchmark_pressure(Vector< double > &residuals)
Compute the element residual vector. flag=1(or 0): do (or don't) compute the Jacobian as well.
unsigned U_index_shell_benchmark_pressure
The index at which the unknown is stored at the nodes.
ShellBenchmarkPressureElement(const ShellBenchmarkPressureElement &dummy)=delete
Broken copy constructor.
ShellBenchmarkPressureElement(FiniteElement *const &bulk_el_pt, const int &face_index)
Constructor, takes the pointer to the "bulk" element and the index of the face to be created.
const double & pressure() const
Access function: Poisson ratio.
void fill_in_contribution_to_residuals(Vector< double > &residuals)
Compute the element residual vector.
double *& pressure_pt()
Pointer to Poisson ratio.