cylinder_with_flag_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 #ifndef OOMPH_CYLINDER_WITH_FLAG_DOMAIN_HEADER
31 #define OOMPH_CYLINDER_WITH_FLAG_DOMAIN_HEADER
32 
33 
34 // Generic includes
35 #include "../generic/geom_objects.h"
36 #include "../generic/macro_element.h"
37 #include "../generic/domain.h"
38 
39 
40 namespace oomph
41 {
42 
43 
44 //===========================================================
45 /// Domain for cylinder with flag as in Turek benchmark.
46 //===========================================================
47 class CylinderWithFlagDomain : public Domain
48 {
49 
50 public:
51 
52  /// Constructor. Pass the pointers to the GeomObjects that parametrise
53  /// the cylinder, the three edges of the flag, the length and height of the
54  /// domain, the length and height of the flag, the coordinates of the
55  /// centre of the cylinder and its radius.
57  GeomObject* top_flag_pt,
58  GeomObject* bottom_flag_pt,
59  GeomObject* tip_flag_pt,
60  const double &length,
61  const double &height,
62  const double &flag_length,
63  const double &flag_height,
64  const double &centre_x,
65  const double &centre_y,
66  const double &a);
67 
68 
69  /// \short Destructor: Kill macro elements
71  {
72  for (unsigned i=0;i<31;i++){delete Macro_element_pt[i];}
73  }
74 
75 
76  /// \short Parametrisation of macro element boundaries: f(s) is the position
77  /// vector to macro-element m's boundary in the specified direction [N/S/E/W]
78  /// at the specfied discrete time level (time=0: present; time>0: previous)
79  void macro_element_boundary(const unsigned &time,
80  const unsigned &m,
81  const unsigned &direction,
82  const Vector<double> &s,
83  Vector<double>& f);
84 
85  /// \short Access fct to GeomObject (of type Circle)
86  /// that represents the cylinder
87  Circle* cylinder_pt() {return Cylinder_pt;}
88 
89  /// \short Access fct to GeomObjects for top, bottom and tip
90  GeomObject*& bottom_flag_pt() {return Bottom_flag_pt;}
91  GeomObject*& top_flag_pt() {return Top_flag_pt;}
92  GeomObject*& tip_flag_pt() {return Tip_flag_pt;}
93 
94 private:
95 
96  /// \short Helper function to interpolate linearly between the
97  /// "right" and "left" points; \f$ s \in [-1,1] \f$
98  void linear_interpolate(const Vector<double>& left,
99  const Vector<double>& right,
100  const double &s,
101  Vector<double> &f)
102  {
103  for(unsigned i=0;i<2;i++)
104  {
105  f[i] = left[i] + (right[i] - left[i])*0.5*(s+1.0);
106  }
107  }
108 
109  // Helper points
110  Vector<double> p1;
111  Vector<double> p2;
112  Vector<double> p3;
113  Vector<double> p4;
114  Vector<double> p5;
115  Vector<double> p6;
116  Vector<double> p7;
117  Vector<double> p8;
118  Vector<double> p9;
119  Vector<double> p10;
120  Vector<double> p11;
121  Vector<double> p12;
122  Vector<double> p13;
123  Vector<double> p14;
124  Vector<double> p15;
125  Vector<double> p16;
126  Vector<double> p17;
127  Vector<double> p18;
128  Vector<double> p19;
129  Vector<double> p20;
130  Vector<double> p21;
131  Vector<double> p22;
132  Vector<double> p23;
133  Vector<double> p24;
134  Vector<double> p25;
135  Vector<double> p26;
136  Vector<double> p27;
137  Vector<double> p28;
138  Vector<double> p29;
139  Vector<double> p30;
140  Vector<double> p31;
141  Vector<double> p32;
142  Vector<double> p33;
143  Vector<double> p34;
144  Vector<double> p35;
145  Vector<double> p36;
146  Vector<double> p37;
147  Vector<double> p38;
148  Vector<double> p39;
149  Vector<double> p40;
150  Vector<double> p41;
151  Vector<double> p42;
152  Vector<double> p43;
153  Vector<double> p44;
154  Vector<double> p45;
155  Vector<double> p46;
156  Vector<double> p47;
157  Vector<double> p48;
158  Vector<double> p49;
159  Vector<double> p50;
160 
161 
162  /// Pointer to geometric object that represents the central cylinder
163  Circle* Cylinder_pt;
164 
165  ///Pointer to geometric object that represents the top of the flag
166  GeomObject* Top_flag_pt;
167 
168  ///Pointer to geometric object that represents the bottom of the flag
169  GeomObject* Bottom_flag_pt;
170 
171  ///Pointer to geometric object that represents the tip of the flag
172  GeomObject* Tip_flag_pt;
173 
174  //Length of the flag
175  double Lx;
176 
177  //Thickness of the flag
178  double Ly;
179 
180  //Centre of the cylinder : x coordinate
181  double Centre_x;
182 
183  //Centre of the cylinder : y coordinate
184  double Centre_y;
185 
186  //Radius of the cylinder
187  double A;
188 
189 
190 };//end of domain
191 
192 }
193 
194 #endif
GeomObject *& bottom_flag_pt()
Access fct to GeomObjects for top, bottom and tip.
GeomObject * Tip_flag_pt
Pointer to geometric object that represents the tip of the flag.
CylinderWithFlagDomain(Circle *cylinder_pt, GeomObject *top_flag_pt, GeomObject *bottom_flag_pt, GeomObject *tip_flag_pt, const double &length, const double &height, const double &flag_length, const double &flag_height, const double &centre_x, const double &centre_y, const double &a)
GeomObject * Top_flag_pt
Pointer to geometric object that represents the top of the flag.
Circle * cylinder_pt()
Access fct to GeomObject (of type Circle) that represents the cylinder.
~CylinderWithFlagDomain()
Destructor: Kill macro elements.
void macro_element_boundary(const unsigned &time, const unsigned &m, const unsigned &direction, const Vector< double > &s, Vector< double > &f)
Parametrisation of macro element boundaries: f(s) is the position vector to macro-element m&#39;s boundar...
Domain for cylinder with flag as in Turek benchmark.
GeomObject * Bottom_flag_pt
Pointer to geometric object that represents the bottom of the flag.
void linear_interpolate(const Vector< double > &left, const Vector< double > &right, const double &s, Vector< double > &f)
Helper function to interpolate linearly between the "right" and "left" points; .
Circle * Cylinder_pt
Pointer to geometric object that represents the central cylinder.