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