domain.cc
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: 1097 $
7 //LIC//
8 //LIC// $LastChangedDate: 2015-12-17 11:53:17 +0000 (Thu, 17 Dec 2015) $
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 "quadtree.h"
31 
32 
33 #include "macro_element.h"
34 #include "geom_objects.h"
35 #include "domain.h"
36 
37 namespace oomph
38 {
39 
40 
41 
42 /////////////////////////////////////////////////////////////////////////
43 /////////////////////////////////////////////////////////////////////////
44 // Warped cube domain
45 /////////////////////////////////////////////////////////////////////////
46 /////////////////////////////////////////////////////////////////////////
47 
48 
49 
50 //=================================================================
51 /// \short Vector representation of the imacro-th macro element
52 /// boundary idirect (L/R/D/B/F) at time level t (t=0: present; t>0: previous):
53 /// f(s)
54 //=================================================================
56  const unsigned& t,
57  const unsigned& imacro,
58  const unsigned& idirect,
59  const Vector<double>& s,
60  Vector<double>& f)
61 {
62  using namespace OcTreeNames;
63 
64 #ifdef WARN_ABOUT_SUBTLY_CHANGED_OOMPH_INTERFACES
65  // Warn about time argument being moved to the front
67  "Order of function arguments has changed between versions 0.8 and 0.85",
68  "WarpedCubeDomain::macro_element_boundary(...)",
69  OOMPH_EXCEPTION_LOCATION);
70 #endif
71 
72  // Which direction?
73  if (idirect==L)
74  {
75  r_L(t,s,f);
76  }
77  else if (idirect==R)
78  {
79  r_R(t,s,f);
80  }
81  else if (idirect==D)
82  {
83  r_D(t,s,f);
84  }
85  else if (idirect==U)
86  {
87  r_U(t,s,f);
88  }
89  else if (idirect==B)
90  {
91  r_B(t,s,f);
92  }
93  else if (idirect==F)
94  {
95  r_F(t,s,f);
96  }
97  else
98  {
99  std::ostringstream error_stream;
100  error_stream << "idirect is " << idirect
101  << " not one of U, D, L, R, B, F" << std::endl;
102 
103  throw OomphLibError(
104  error_stream.str(),
105  OOMPH_CURRENT_FUNCTION,
106  OOMPH_EXCEPTION_LOCATION);
107  }
108 
109 
110 }
111 
112 
113 
114 //#####################################################################
115 
116 
117 
118 
119  //=======================================================================
120  /// \short Left boundary face
121  /// zeta \f$ \in [-1,1]^2 \f$
122  //=======================================================================
123  void WarpedCubeDomain::r_L(const unsigned& t, const Vector<double>& zeta,
124  Vector<double>& f)
125 {
126 
127  f[0]=-1.0;
128  f[1]=zeta[0];
129  f[2]=zeta[1];
130 
131 
132  // Warp it
133  warp_it(f);
134 }
135 
136 
137 
138 
139  //=======================================================================
140  /// \short Right boundary face
141  /// zeta \f$ \in [-1,1]^2 \f$
142  //=======================================================================
143  void WarpedCubeDomain::r_R(const unsigned& t, const Vector<double>& zeta,
144  Vector<double>& f)
145 {
146 
147  f[0]=1.0;
148  f[1]=zeta[0];
149  f[2]=zeta[1];
150 
151  // Warp it
152  warp_it(f);
153 }
154 
155 
156 
157  //=======================================================================
158  /// \short Down boundary face
159  /// zeta \f$ \in [-1,1]^2 \f$
160  //=======================================================================
161  void WarpedCubeDomain::r_D(const unsigned& t, const Vector<double>& zeta,
162  Vector<double>& f)
163 {
164 
165  f[0]=zeta[0];
166  f[1]=-1.0;
167  f[2]=zeta[1];
168 
169  // Warp it
170  warp_it(f);
171 }
172 
173 
174 
175  //=======================================================================
176  /// \short Up boundary face
177  /// zeta \f$ \in [-1,1]^2 \f$
178  //=======================================================================
179  void WarpedCubeDomain::r_U(const unsigned& t, const Vector<double>& zeta,
180  Vector<double>& f)
181 {
182 
183  f[0]=zeta[0];
184  f[1]=1.0;
185  f[2]=zeta[1];
186 
187 
188  // Warp it
189  warp_it(f);
190 }
191 
192 
193  //=======================================================================
194  /// \short Back boundary face
195  /// zeta \f$ \in [-1,1]^2 \f$
196  //=======================================================================
197  void WarpedCubeDomain::r_B(const unsigned& t, const Vector<double>& zeta,
198  Vector<double>& f)
199 {
200 
201  f[0]=zeta[0];
202  f[1]=zeta[1];
203  f[2]=-1.0;
204 
205  // Warp it
206  warp_it(f);
207 
208 }
209 
210 
211 
212  //=======================================================================
213  /// \short Front boundary face
214  /// zeta \f$ \in [-1,1]^2 \f$
215  //=======================================================================
216  void WarpedCubeDomain::r_F(const unsigned& t, const Vector<double>& zeta,
217  Vector<double>& f)
218 {
219 
220  f[0]=zeta[0];
221  f[1]=zeta[1];
222  f[2]=1.0;
223 
224  // Warp it
225  warp_it(f);
226 
227 }
228 
229 
230 //=======================================================================
231 /// Warp the unit cube
232 //=======================================================================
234 {
235 
236  Vector<double> f_aux(f);
237  double x=0.5*(1.0+f_aux[0]);
238  double y=0.5*(1.0+f_aux[1]);
239  double z=0.5*(1.0+f_aux[2]);
240  f[0]=(1.0+x)*cos(y+0.5*z);
241  f[1]=(2.0+3*x)*sin(y+0.5*z);
242  f[2]=sin(z)+0.1*(x*x+y*y);
243 }
244 
245 
246 
247 
248 }
void warp_it(Vector< double > &f)
Warp the unit cube.
Definition: domain.cc:233
char t
Definition: cfortran.h:572
void r_L(const unsigned &t, const Vector< double > &zeta, Vector< double > &f)
Left boundary face zeta .
Definition: domain.cc:123
void r_F(const unsigned &t, const Vector< double > &zeta, Vector< double > &f)
Front boundary face zeta .
Definition: domain.cc:216
static char t char * s
Definition: cfortran.h:572
void r_D(const unsigned &t, const Vector< double > &zeta, Vector< double > &f)
Down boundary face zeta .
Definition: domain.cc:161
void macro_element_boundary(const unsigned &t, const unsigned &i_macro, const unsigned &i_direct, const Vector< double > &s, Vector< double > &f)
Vector representation of the i_macro-th macro element boundary i_direct (L/R/D/U/B/F) at time level t...
Definition: domain.cc:55
void r_U(const unsigned &t, const Vector< double > &zeta, Vector< double > &f)
Up boundary face zeta .
Definition: domain.cc:179
void r_B(const unsigned &t, const Vector< double > &zeta, Vector< double > &f)
Back boundary face zeta .
Definition: domain.cc:197
void r_R(const unsigned &t, const Vector< double > &zeta, Vector< double > &f)
Right boundary face zeta .
Definition: domain.cc:143