topologically_rectangular_domain.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 //Include guards
31 #ifndef OOMPH_TOPOLOGICALLY_RECTANGULAR_DOMAIN_HEADER
32 #define OOMPH_TOPOLOGICALLY_RECTANGULAR_DOMAIN_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/domain.h"
43 
44 
45 namespace oomph
46 {
47 
48 //=============================================================================
49 /// \short Topologically Rectangular Domain - a domain dexcribing a
50 /// topologically rectangular problem - primarily contains functions to access
51 /// the position of the global boundary relative to the macro element boundary,
52 /// as well as first and second derivates of the global boundary wrt the macro
53 /// element boundary
54 /// NOTE : suitable for HermiteElementQuadMesh
55 //=============================================================================
56 class TopologicallyRectangularDomain : public Domain
57 {
58 
59 public:
60 
61 
62  /// \short boundary function pointer - for a given boundary takes the
63  /// macro element coordinate position on that boundary and for that position
64  /// returns the global coordinates (x) coordinates, or derivatives - dx_i/dm_t
65  /// or second derivatives d2x_i/dm_t^2
66  typedef void (*BoundaryFctPt)(const double& s, Vector<double>& r);
67 
68 
69  /// \short Constructor - domain boundaries are described with four boundary
70  /// function pointers describing the topology of the north, east, south, and
71  /// west boundaries
73  BoundaryFctPt south_pt, BoundaryFctPt west_pt);
74 
75 
76  /// \short Constructor - takes length of domain in x and y direction as
77  /// arguements. Assumes domain is rectangular, and the south west (lower
78  /// left) corner is at 0,0.
79  TopologicallyRectangularDomain(const double& l_x, const double& l_y);
80 
81 
82  /// \short Constructor - takes the minimum and maximum coordinates of the
83  /// of an assumed rectanguler domain in the x and y direction
84  TopologicallyRectangularDomain(const double& x_min, const double& x_max,
85  const double& y_min, const double& y_max);
86 
87 
88  /// Broken copy constructor
90  {
91  BrokenCopy::broken_copy("TopologicallyRectangularDomain");
92  }
93 
94 
95  /// Broken assignment operator
97  {
98  BrokenCopy::broken_assign("TopologicallyRectangularDomain");
99  }
100 
101 
102  /// Destructor - deletes the underlying macro element
104  {
105  delete Macro_element_pt[0];
106  Macro_element_pt[0] = 0;
107  }
108 
109 
110  /// \short allows the boundary derivate function pointers to be set. To
111  /// compute the derivatives of the problem domain global coordinates (x_i) wrt
112  /// the macro element coordinates (m_i), dx_i/dm_t is required along the
113  /// domain boundaries (where dm_t is the macro element coordinate tangential
114  /// to the domain boundary). The derivatives dx_i/dm_t can either be
115  /// prescribed with function pointers, or if the function pointers are not
116  /// provided then dx_i/dm_t is computed with finite differencing.
117  /// Note - these functions are only required for domains contructed with
118  /// boundary function pointers
120  BoundaryFctPt d_east_pt,
121  BoundaryFctPt d_south_pt,
122  BoundaryFctPt d_west_pt);
123 
124 
125  /// \short allows the boundary second derivate function pointers to be set.
126  /// To compute the second derivatives of the problem domain global
127  /// coordinates (x_i) wrt the macro element coordinates (m_i), d2x_i/dm_t^2
128  /// is required along the domain boundaries (where dm_t is the macro element
129  /// coordinate tangential to the domain boundary). The derivatives
130  /// d2x_i/dm_t^2 can either be prescribed with function pointers, or if the
131  /// function pointers are not provided then dx_i/dm_t is computed with finite
132  /// differencing.
133  /// Note - these functions are only required for domains contructed with
134  /// boundary function pointers
136  BoundaryFctPt d2_east_pt,
137  BoundaryFctPt d2_south_pt,
138  BoundaryFctPt d2_west_pt);
139 
140 
141  /// returns the global coordinate position (f) of macro element position s
142  /// on boundary i_direct (e.g. N/S/W/E in 2D) at time t (no time dependence)
143  void macro_element_boundary(const unsigned& t,
144  const unsigned& i_macro,
145  const unsigned& i_direct,
146  const Vector<double>& s,
147  Vector<double>& f);
148 
149 
150  /// returns the derivates of the global coordinate position (f) wrt to the
151  /// macro element coordinate at macro macro element position s on boundary
152  /// i_direct (e.g. N/S/W/E in 2D) at time t (no time dependence)
153  void dmacro_element_boundary(const unsigned& t,
154  const unsigned& i_macro,
155  const unsigned& i_direct,
156  const Vector<double>& s,
157  Vector<double>& f);
158 
159 
160  /// returns the second derivates of the global coordinate position (f) wrt to
161  /// the macro element coordinate at macro macro element position s on boundary
162  /// i_direct (e.g. N/S/W/E in 2D) at time t (no time dependence)
163  void d2macro_element_boundary(const unsigned& t,
164  const unsigned& i_macro,
165  const unsigned& i_direct,
166  const Vector<double>& s,
167  Vector<double>& f);
168 
169 
170 private:
171 
172  /// \short Function pointer to prescribe the north boundary of this
173  /// topologically rectangular domain
175 
176  /// \short Function pointer to prescribe the east boundary of this
177  /// topologically rectangular domain
179 
180  /// \short Function pointer to prescribe the north boundary of this
181  /// topologically rectangular domain
183 
184  /// \short Function pointer to prescribe the west boundary of this
185  /// topologically rectangular domain
187 
188 
189  /// \short Function pointer to prescribe the derivates of global coordinates
190  /// wrt to the macro element coordinate tangential to the north boundary
192 
193  /// \short Function pointer to prescribe the derivates of global coordinates
194  /// wrt to the macro element coordinate tangential to the east boundary
196 
197  /// \short Function pointer to prescribe the derivates of global coordinates
198  /// wrt to the macro element coordinate tangential to the south boundary
200 
201  /// \short Function pointer to prescribe the derivates of global coordinates
202  /// wrt to the macro element coordinate tangential to the west boundary
204 
205 
206  /// \short Function pointer to prescribe the second derivates of global
207  /// coordinates wrt to the macro element coordinate tangential to the north
208  /// boundary
210 
211  /// \short Function pointer to prescribe the second derivates of global
212  /// coordinates wrt to the macro element coordinate tangential to the east
213  /// boundary
215 
216  /// \short Function pointer to prescribe the second derivates of global
217  /// coordinates wrt to the macro element coordinate tangential to the south
218  /// boundary
220 
221  /// \short Function pointer to prescribe the second derivates of global
222  /// coordinates wrt to the macro element coordinate tangential to the west
223  /// boundary
225 
226 
227  /// \short coordinate position of south west corner of domain (only used if
228  /// boundary functions are not used)
229  Vector<double> x_south_west;
230 
231  /// \short coordinate position of north east corner of domain (only used if
232  /// boundary functions are not used)
233  Vector<double> x_north_east;
234 
235 
236  /// \short takes the macro element coordinate position along the north
237  /// boundary and returns the global coordinate position along that boundary
238  void r_N(const Vector<double>& s, Vector<double>& f);
239 
240  /// \short takes the macro element coordinate position along the east
241  /// boundary and returns the global coordinate position along that boundary
242  void r_E(const Vector<double>& s, Vector<double>& f);
243 
244  /// \short takes the macro element coordinate position along the south
245  /// boundary and returns the global coordinate position along that boundary
246  void r_S(const Vector<double>& s, Vector<double>& f);
247 
248  /// \short takes the macro element coordinate position along the west
249  /// boundary and returns the global coordinate position along that boundary
250  /// access down boundary function pointer
251  void r_W(const Vector<double>& s, Vector<double>& f);
252 
253 
254  /// \short takes the macro element coordinate position along the north
255  /// boundary and returns the derivates of the global coordinates with respect
256  /// to the boundary
257  void dr_N(const Vector<double>& s, Vector<double>& dr);
258 
259  /// \short takes the macro element coordinate position along the E
260  /// boundary and returns the derivates of the global coordinates with respect
261  /// to the boundary
262  void dr_E(const Vector<double>& s, Vector<double>& dr);
263 
264  /// \short takes the macro element coordinate position along the south
265  /// boundary and returns the derivates of the global coordinates with respect
266  /// to the boundary
267  void dr_S(const Vector<double>& s, Vector<double>& dr);
268 
269  /// \short takes the macro element coordinate position along the W
270  /// boundary and returns the derivates of the global coordinates with respect
271  /// to the boundary
272  void dr_W(const Vector<double>& s, Vector<double>& dr);
273 
274 
275  /// \short takes the macro element coordinate position along the north
276  /// boundary and returns the second derivates of the global coordinates with
277  /// respect to the boundary
278  void d2r_N(const Vector<double>& s, Vector<double>& d2r);
279 
280  /// \short takes the macro element coordinate position along the east
281  /// boundary and returns the second derivates of the global coordinates with
282  /// respect to the boundary
283  void d2r_E(const Vector<double>& s, Vector<double>& d2r);
284 
285  /// \short takes the macro element coordinate position along the south
286  /// boundary and returns the second derivates of the global coordinates with
287  /// respect to the boundary
288  void d2r_S(const Vector<double>& s, Vector<double>& d2r);
289 
290  /// \short takes the macro element coordinate position along the west
291  /// boundary and returns the second derivates of the global coordinates with
292  /// respect to the boundary
293  void d2r_W(const Vector<double>& s, Vector<double>& d2r);
294 
295 };
296 }
297 #endif
void d2r_S(const Vector< double > &s, Vector< double > &d2r)
takes the macro element coordinate position along the south boundary and returns the second derivates...
void set_boundary_derivative_functions(BoundaryFctPt d_north_pt, BoundaryFctPt d_east_pt, BoundaryFctPt d_south_pt, BoundaryFctPt d_west_pt)
allows the boundary derivate function pointers to be set. To compute the derivatives of the problem d...
BoundaryFctPt d2East_boundary_fn_pt
Function pointer to prescribe the second derivates of global coordinates wrt to the macro element coo...
void dr_E(const Vector< double > &s, Vector< double > &dr)
takes the macro element coordinate position along the E boundary and returns the derivates of the glo...
BoundaryFctPt d2North_boundary_fn_pt
Function pointer to prescribe the second derivates of global coordinates wrt to the macro element coo...
BoundaryFctPt dSouth_boundary_fn_pt
Function pointer to prescribe the derivates of global coordinates wrt to the macro element coordinate...
TopologicallyRectangularDomain(const TopologicallyRectangularDomain &)
Broken copy constructor.
void dr_W(const Vector< double > &s, Vector< double > &dr)
takes the macro element coordinate position along the W boundary and returns the derivates of the glo...
BoundaryFctPt dEast_boundary_fn_pt
Function pointer to prescribe the derivates of global coordinates wrt to the macro element coordinate...
void dmacro_element_boundary(const unsigned &t, const unsigned &i_macro, const unsigned &i_direct, const Vector< double > &s, Vector< double > &f)
BoundaryFctPt West_boundary_fn_pt
Function pointer to prescribe the west boundary of this topologically rectangular domain...
void dr_S(const Vector< double > &s, Vector< double > &dr)
takes the macro element coordinate position along the south boundary and returns the derivates of the...
BoundaryFctPt dWest_boundary_fn_pt
Function pointer to prescribe the derivates of global coordinates wrt to the macro element coordinate...
void d2r_W(const Vector< double > &s, Vector< double > &d2r)
takes the macro element coordinate position along the west boundary and returns the second derivates ...
void r_W(const Vector< double > &s, Vector< double > &f)
takes the macro element coordinate position along the west boundary and returns the global coordinate...
TopologicallyRectangularDomain(BoundaryFctPt north_pt, BoundaryFctPt east_pt, BoundaryFctPt south_pt, BoundaryFctPt west_pt)
Constructor - domain boundaries are described with four boundary function pointers describing the top...
BoundaryFctPt South_boundary_fn_pt
Function pointer to prescribe the north boundary of this topologically rectangular domain...
BoundaryFctPt dNorth_boundary_fn_pt
Function pointer to prescribe the derivates of global coordinates wrt to the macro element coordinate...
void operator=(const TopologicallyRectangularDomain &)
Broken assignment operator.
void r_S(const Vector< double > &s, Vector< double > &f)
takes the macro element coordinate position along the south boundary and returns the global coordinat...
BoundaryFctPt d2South_boundary_fn_pt
Function pointer to prescribe the second derivates of global coordinates wrt to the macro element coo...
Topologically Rectangular Domain - a domain dexcribing a topologically rectangular problem - primaril...
void set_boundary_second_derivative_functions(BoundaryFctPt d2_north_pt, BoundaryFctPt d2_east_pt, BoundaryFctPt d2_south_pt, BoundaryFctPt d2_west_pt)
allows the boundary second derivate function pointers to be set. To compute the second derivatives of...
void d2r_E(const Vector< double > &s, Vector< double > &d2r)
takes the macro element coordinate position along the east boundary and returns the second derivates ...
void r_N(const Vector< double > &s, Vector< double > &f)
takes the macro element coordinate position along the north boundary and returns the global coordinat...
void(* BoundaryFctPt)(const double &s, Vector< double > &r)
boundary function pointer - for a given boundary takes the macro element coordinate position on that ...
BoundaryFctPt d2West_boundary_fn_pt
Function pointer to prescribe the second derivates of global coordinates wrt to the macro element coo...
BoundaryFctPt North_boundary_fn_pt
Function pointer to prescribe the north boundary of this topologically rectangular domain...
Vector< double > x_south_west
coordinate position of south west corner of domain (only used if boundary functions are not used) ...
void macro_element_boundary(const unsigned &t, const unsigned &i_macro, const unsigned &i_direct, const Vector< double > &s, Vector< double > &f)
~TopologicallyRectangularDomain()
Destructor - deletes the underlying macro element.
void d2r_N(const Vector< double > &s, Vector< double > &d2r)
takes the macro element coordinate position along the north boundary and returns the second derivates...
BoundaryFctPt East_boundary_fn_pt
Function pointer to prescribe the east boundary of this topologically rectangular domain...
Vector< double > x_north_east
coordinate position of north east corner of domain (only used if boundary functions are not used) ...
void d2macro_element_boundary(const unsigned &t, const unsigned &i_macro, const unsigned &i_direct, const Vector< double > &s, Vector< double > &f)
void dr_N(const Vector< double > &s, Vector< double > &dr)
takes the macro element coordinate position along the north boundary and returns the derivates of the...
void r_E(const Vector< double > &s, Vector< double > &f)
takes the macro element coordinate position along the east boundary and returns the global coordinate...