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