channel_with_leaflet_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_CHANNEL_WITH_LEAFLET_DOMAIN_HEADER
27 #define OOMPH_CHANNEL_WITH_LEAFLET_DOMAIN_HEADER
28 
29 
30 // Generic includes
31 #include "../generic/geom_objects.h"
32 #include "../generic/domain.h"
33 #include "../generic/macro_element.h"
34 
35 namespace oomph
36 {
37  //===========================================================
38  /// Rectangular domain with a leaflet blocking the lower
39  /// half
40  //===========================================================
42  {
43  public:
44  /// Constructor: Pass pointer to GeomObject that represents the
45  /// leaflet,
46  /// the length of the domain to left and right of the leaflet, the
47  /// height of the leaflet and the overall height of the channel,
48  /// the number of element columns to the left and right of the leaflet,
49  /// the number of rows of elements from the bottom of the channel to
50  /// the end of the leaflet, the number of rows of elements above the
51  /// end of the leaflet.
53  const double& lleft,
54  const double& lright,
55  const double& hleaflet,
56  const double& htot,
57  const unsigned& nleft,
58  const unsigned& nright,
59  const unsigned& ny1,
60  const unsigned& ny2)
61  {
62  // Copy assignments into private storage
63  Lleft = lleft;
64  Lright = lright;
66  Htot = htot;
67  Nleft = nleft;
68  Nright = nright;
69  Ny1 = ny1;
70  Ny2 = ny2;
72 
73  // Store origin of leaflet for fast reference
74  Vector<double> zeta(1);
75  zeta[0] = 0.0;
76  Vector<double> r(2);
77  Leaflet_pt->position(zeta, r);
78  X_0 = r[0];
79 
80  // Number of macro elements
81  unsigned nmacro = (Ny1 + Ny2) * (Nleft + Nright);
82  Macro_element_pt.resize(nmacro);
83 
84  // Build the 2D macro elements
85  for (unsigned i = 0; i < nmacro; i++)
86  {
87  Macro_element_pt[i] = new QMacroElement<2>(this, i);
88  }
89  }
90 
91  /// Destructor: Empty; cleanup done in base class
93 
94  /// Total height of domain (width of channel)
95  double htot()
96  {
97  return Htot;
98  }
99 
100  /// Height of leaflet
101  double hleaflet()
102  {
103  return Hleaflet;
104  }
105 
106  /// Length of domain to the left of leaflet
107  double lleft()
108  {
109  return Lleft;
110  }
111 
112  /// Length of domain to the right of leaflet
113  double lright()
114  {
115  return Lright;
116  }
117 
118  /// Pointer to the wall
120  {
121  return Leaflet_pt;
122  };
123 
124  /// Parametrisation of macro element boundaries
125  void macro_element_boundary(const unsigned& t,
126  const unsigned& imacro,
127  const unsigned& idirect,
128  const Vector<double>& zeta,
129  Vector<double>& r);
130 
131  protected:
132  /// Helper function
133  void macro_bound_I_N(const unsigned& t,
134  const Vector<double>& zeta,
135  Vector<double>& r,
136  const unsigned& i,
137  const unsigned& j);
138 
139  /// Helper function
140  void macro_bound_I_S(const unsigned& t,
141  const Vector<double>& zeta,
142  Vector<double>& r,
143  const unsigned& i,
144  const unsigned& j);
145 
146  /// Helper function
147  void macro_bound_I_W(const unsigned& t,
148  const Vector<double>& zeta,
149  Vector<double>& r,
150  const unsigned& i,
151  const unsigned& j);
152 
153  /// Helper function
154  void macro_bound_I_E(const unsigned& t,
155  const Vector<double>& zeta,
156  Vector<double>& r,
157  const unsigned& i,
158  const unsigned& j);
159 
160  /// Helper function
161  void macro_bound_II_N(const unsigned& t,
162  const Vector<double>& zeta,
163  Vector<double>& r,
164  const unsigned& i,
165  const unsigned& j);
166 
167  /// Helper function
168  void macro_bound_II_S(const unsigned& t,
169  const Vector<double>& zeta,
170  Vector<double>& r,
171  const unsigned& i,
172  const unsigned& j);
173 
174  /// Helper function
175  void macro_bound_II_W(const unsigned& t,
176  const Vector<double>& zeta,
177  Vector<double>& r,
178  const unsigned& i,
179  const unsigned& j);
180 
181  /// Helper function
182  void macro_bound_II_E(const unsigned& t,
183  const Vector<double>& zeta,
184  Vector<double>& r,
185  const unsigned& i,
186  const unsigned& j);
187 
188  /// Helper function
189  void macro_bound_III_N(const unsigned& t,
190  const Vector<double>& zeta,
191  Vector<double>& r,
192  const unsigned& i,
193  const unsigned& j);
194 
195  /// Helper function
196  void macro_bound_III_S(const unsigned& t,
197  const Vector<double>& zeta,
198  Vector<double>& r,
199  const unsigned& i,
200  const unsigned& j);
201 
202  /// Helper function
203  void macro_bound_III_W(const unsigned& t,
204  const Vector<double>& zeta,
205  Vector<double>& r,
206  const unsigned& i,
207  const unsigned& j);
208 
209  /// Helper function
210  void macro_bound_III_E(const unsigned& t,
211  const Vector<double>& zeta,
212  Vector<double>& r,
213  const unsigned& i,
214  const unsigned& j);
215 
216  /// Helper function
217  void macro_bound_IV_N(const unsigned& t,
218  const Vector<double>& zeta,
219  Vector<double>& r,
220  const unsigned& i,
221  const unsigned& j);
222 
223  /// Helper function
224  void macro_bound_IV_S(const unsigned& t,
225  const Vector<double>& zeta,
226  Vector<double>& r,
227  const unsigned& i,
228  const unsigned& j);
229 
230  /// Helper function
231  void macro_bound_IV_W(const unsigned& t,
232  const Vector<double>& zeta,
233  Vector<double>& r,
234  const unsigned& i,
235  const unsigned& j);
236 
237  /// Helper function
238  void macro_bound_IV_E(const unsigned& t,
239  const Vector<double>& zeta,
240  Vector<double>& r,
241  const unsigned& i,
242  const unsigned& j);
243  /// Helper function
244  void slanted_bound_up(const unsigned& t,
245  const Vector<double>& zeta,
246  Vector<double>& r);
247 
248 
249  /// Length of the domain to the right of the leaflet
250  double Lright;
251 
252  /// Length of the domain to the left of the leaflet
253  double Lleft;
254 
255  /// Lagrangian coordinate at end of leaflet
256  double Hleaflet;
257 
258  /// Total width of the channel
259  double Htot;
260 
261  /// Number of macro element columnns to the right of the leaflet
262  unsigned Nright;
263 
264  /// Number of macro element columns to the left of the leaflet
265  unsigned Nleft;
266 
267  /// Number of macro element rows up to the end of the leaflet
268  unsigned Ny1;
269 
270  /// Number of macro element rows above the leaflet
271  unsigned Ny2;
272 
273  /// Center of the domain : origin of the leaflet, extracted
274  /// from GeomObject and stored for fast access.
275  double X_0;
276 
277  /// Pointer to leaflet
279  };
280 
281 
282  //===================================================================
283  /// Parametrisation of macro element boundaries
284  //===================================================================
286  const unsigned& t,
287  const unsigned& imacro,
288  const unsigned& idirect,
289  const Vector<double>& zeta,
290  Vector<double>& r)
291  {
292 #ifdef WARN_ABOUT_SUBTLY_CHANGED_OOMPH_INTERFACES
293  // Warn about time argument being moved to the front
295  "Order of function arguments has changed between versions 0.8 and 0.85",
296  "ChannelWithLeafletDomain::macro_element_boundary(...)",
297  OOMPH_EXCEPTION_LOCATION);
298 #endif
299 
300  using namespace QuadTreeNames;
301 
302  // Number of the line and of the colum in the whole domain
303  // Beware : iline starts on zero
304  unsigned iline = int(floor(double(imacro) / double(Nleft + Nright)));
305  unsigned icol = imacro % (Nright + Nleft);
306 
307  // Number of the line and of the colum in the part considered
308  unsigned i, j;
309 
310  // Left low part of the domain : Part I
311  //------------------------------------
312  if ((iline < Ny1) && (icol < Nleft))
313  {
314  i = iline;
315  j = icol;
316 
317  switch (idirect)
318  {
319  case N:
320  macro_bound_I_N(t, zeta, r, i, j);
321  break;
322  case S:
323  macro_bound_I_S(t, zeta, r, i, j);
324  break;
325  case W:
326  macro_bound_I_W(t, zeta, r, i, j);
327  break;
328  case E:
329  macro_bound_I_E(t, zeta, r, i, j);
330  break;
331  }
332  }
333  // Right low part of the domain : Part II
334  //--------------------------------------
335  else if ((iline < Ny1) && (icol >= Nleft))
336  {
337  i = iline;
338  j = icol - Nleft;
339 
340  switch (idirect)
341  {
342  case N:
343  macro_bound_II_N(t, zeta, r, i, j);
344  break;
345  case S:
346  macro_bound_II_S(t, zeta, r, i, j);
347  break;
348  case W:
349  macro_bound_II_W(t, zeta, r, i, j);
350  break;
351  case E:
352  macro_bound_II_E(t, zeta, r, i, j);
353  break;
354  }
355  }
356  // Left upper part of the domain : Part III
357  //----------------------------------------
358  else if ((iline >= Ny1) && (icol < Nleft))
359  {
360  i = iline - Ny1;
361  j = icol;
362 
363  switch (idirect)
364  {
365  case N:
366  macro_bound_III_N(t, zeta, r, i, j);
367  break;
368  case S:
369  macro_bound_III_S(t, zeta, r, i, j);
370  break;
371  case W:
372  macro_bound_III_W(t, zeta, r, i, j);
373  break;
374  case E:
375  macro_bound_III_E(t, zeta, r, i, j);
376  break;
377  }
378  }
379  // Right upper part of the domain : Part IV
380  //-----------------------------------------
381  else if ((iline >= Ny1) && (icol >= Nleft))
382  {
383  i = iline - Ny1;
384  j = icol - Nleft;
385 
386  switch (idirect)
387  {
388  case N:
389  macro_bound_IV_N(t, zeta, r, i, j);
390  break;
391  case S:
392  macro_bound_IV_S(t, zeta, r, i, j);
393  break;
394  case W:
395  macro_bound_IV_W(t, zeta, r, i, j);
396  break;
397  case E:
398  macro_bound_IV_E(t, zeta, r, i, j);
399  break;
400  }
401  }
402  }
403 
404 
405  /// //////////////////////////////////////////////////////////////////
406  /// //////////////////////////////////////////////////////////////////
407  // Helper functions for region I (lower left region)
408  /// //////////////////////////////////////////////////////////////////
409  /// //////////////////////////////////////////////////////////////////
410 
411 
412  //=====================================================================
413  /// Helper function for eastern boundary in lower left region
414  //=====================================================================
416  const Vector<double>& zeta,
417  Vector<double>& r,
418  const unsigned& i,
419  const unsigned& j)
420  {
421  // Find x,y on the wall corresponding to the position of the macro element
422 
423  // xi_wall varies from xi0 to xi1 on the wall
424  double xi0, xi1;
425  xi0 = double(i) * Hleaflet / double(Ny1);
426  xi1 = double(i + 1) * Hleaflet / double(Ny1);
427 
428  Vector<double> xi_wall(1);
429  xi_wall[0] = xi0 + (1.0 + zeta[0]) / 2.0 * (xi1 - xi0);
430 
431  Vector<double> r_wall(2);
432  Leaflet_pt->position(t, xi_wall, r_wall);
433 
434  // Find x,y on a vertical line corresponding
435  // to the position of the macro element
436 
437  // the vertical line goes from y0 to y1
438  double y0, y1;
439  y0 = double(i) * Hleaflet / double(Ny1);
440  y1 = double(i + 1) * Hleaflet / double(Ny1);
441 
442  Vector<double> r_vert(2);
443  r_vert[0] = -Lleft + X_0;
444  r_vert[1] = y0 + (1.0 + zeta[0]) / 2.0 * (y1 - y0);
445 
446  // Parameter with value 0 in -Lleft and value 1 on the wall.
447  double s = double(j + 1) / double(Nleft);
448 
449  /// Final expression of r
450  r[0] = r_vert[0] + s * (r_wall[0] - r_vert[0]);
451  r[1] = r_vert[1] + s * (r_wall[1] - r_vert[1]);
452  }
453 
454 
455  //=====================================================================
456  /// Helper function for western boundary in lower left region
457  //=====================================================================
459  const Vector<double>& zeta,
460  Vector<double>& r,
461  const unsigned& i,
462  const unsigned& j)
463  {
464  // Find x,y on the wall corresponding to the position of the macro element
465 
466  // xi_wall varies from xi0 to xi1 on the wall
467  double xi0, xi1;
468  xi0 = double(i) * Hleaflet / double(Ny1);
469  xi1 = double(i + 1) * Hleaflet / double(Ny1);
470 
471  Vector<double> xi_wall(1);
472  xi_wall[0] = xi0 + (1.0 + zeta[0]) / 2.0 * (xi1 - xi0);
473 
474  Vector<double> r_wall(2);
475  Leaflet_pt->position(t, xi_wall, r_wall);
476 
477  // Find x,y on a vertical line corresponding
478  // to the position of the macro element
479 
480  // the vertical line goes from y0 to y1
481  double y0, y1;
482  y0 = double(i) * Hleaflet / double(Ny1);
483  y1 = double(i + 1) * Hleaflet / double(Ny1);
484 
485  Vector<double> r_vert(2);
486  r_vert[0] = -Lleft + X_0;
487  r_vert[1] = y0 + (1.0 + zeta[0]) / 2.0 * (y1 - y0);
488 
489  // Parameter with value 0 in -Lleft and value 1 on the wall.
490  double s = double(j) / double(Nleft);
491 
492  /// Final expression of r
493  r[0] = r_vert[0] + s * (r_wall[0] - r_vert[0]);
494  r[1] = r_vert[1] + s * (r_wall[1] - r_vert[1]);
495  }
496 
497 
498  //=====================================================================
499  /// Helper function for northern boundary in lower left region
500  //=====================================================================
502  const Vector<double>& zeta,
503  Vector<double>& r,
504  const unsigned& i,
505  const unsigned& j)
506  {
507  // Find the coordinates of the two corners of the north boundary
508  Vector<double> xi(1);
509  Vector<double> r_left(2);
510  Vector<double> r_right(2);
511  xi[0] = 1;
512  macro_bound_I_W(t, xi, r_left, i, j);
513  macro_bound_I_E(t, xi, r_right, i, j);
514 
515  // Connect those two points with a straight line
516  r[0] = r_left[0] + (1.0 + zeta[0]) / 2.0 * (r_right[0] - r_left[0]);
517  r[1] = r_left[1] + (1.0 + zeta[0]) / 2.0 * (r_right[1] - r_left[1]);
518  }
519 
520 
521  //=====================================================================
522  /// Helper function for southern boundary in lower left region
523  //=====================================================================
525  const Vector<double>& zeta,
526  Vector<double>& r,
527  const unsigned& i,
528  const unsigned& j)
529  {
530  /// Find the coordinates of the two corners of the south boundary
531  Vector<double> xi(1);
532  Vector<double> r_left(2);
533  Vector<double> r_right(2);
534  xi[0] = -1.0;
535  macro_bound_I_W(t, xi, r_left, i, j);
536  macro_bound_I_E(t, xi, r_right, i, j);
537 
538  // Connect those two points with a straight line
539  r[0] = r_left[0] + (1.0 + zeta[0]) / 2.0 * (r_right[0] - r_left[0]);
540  r[1] = r_left[1] + (1.0 + zeta[0]) / 2.0 * (r_right[1] - r_left[1]);
541  }
542 
543 
544  /// //////////////////////////////////////////////////////////////////
545  /// //////////////////////////////////////////////////////////////////
546  // Helper functions for region II (lower right region)
547  /// //////////////////////////////////////////////////////////////////
548  /// //////////////////////////////////////////////////////////////////
549 
550 
551  //=====================================================================
552  /// Helper function for eastern boundary in lower right region
553  //=====================================================================
555  const Vector<double>& zeta,
556  Vector<double>& r,
557  const unsigned& i,
558  const unsigned& j)
559 
560  {
561  // Find x,y on the wall corresponding to the position of the macro element
562 
563  // xi_wall varies from xi0 to xi1 on the wall
564  double xi0, xi1;
565  xi0 = double(i) * Hleaflet / double(Ny1);
566  xi1 = double(i + 1) * Hleaflet / double(Ny1);
567 
568  Vector<double> xi_wall(1);
569  xi_wall[0] = xi0 + (1.0 + zeta[0]) / 2.0 * (xi1 - xi0);
570 
571  Vector<double> r_wall(2);
572  Leaflet_pt->position(t, xi_wall, r_wall);
573 
574  // Find x,y on a vertical line corresponding
575  // to the position of the macro element
576 
577  // the vertical line goes from y0 to y1
578  double y0, y1;
579  y0 = double(i) * Hleaflet / double(Ny1);
580  y1 = double(i + 1) * Hleaflet / double(Ny1);
581 
582  Vector<double> r_vert(2);
583  r_vert[0] = Lright + X_0;
584  r_vert[1] = y0 + (1.0 + zeta[0]) / 2.0 * (y1 - y0);
585 
586  // Parameter with value 0 in Lright and value 1 on the wall.
587  double s = double(Nright - j - 1) / double(Nright); /***Change****/
588 
589  /// Final expression of r
590  r[0] = r_vert[0] + s * (r_wall[0] - r_vert[0]);
591  r[1] = r_vert[1] + s * (r_wall[1] - r_vert[1]);
592  }
593 
594 
595  //=====================================================================
596  /// Helper function for western boundary in lower right region
597  //=====================================================================
599  const Vector<double>& zeta,
600  Vector<double>& r,
601  const unsigned& i,
602  const unsigned& j)
603  {
604  // Abscissa of the origin of the boudary east
605 
606  // Find x,y on the wall corresponding to the position of the macro element
607 
608  // xi_wall varies from xi0 to xi1 on the wall
609  double xi0, xi1;
610  xi0 = double(i) * Hleaflet / double(Ny1);
611  xi1 = double(i + 1) * Hleaflet / double(Ny1);
612 
613  Vector<double> xi_wall(1);
614  xi_wall[0] = xi0 + (1.0 + zeta[0]) / 2.0 * (xi1 - xi0);
615 
616  Vector<double> r_wall(2);
617  Leaflet_pt->position(t, xi_wall, r_wall);
618 
619  // Find x,y on a vertical line corresponding
620  // to the position of the macro element
621 
622  // the vertical line goes from y0 to y1
623  double y0, y1;
624  y0 = double(i) * Hleaflet / double(Ny1);
625  y1 = double(i + 1) * Hleaflet / double(Ny1);
626 
627  Vector<double> r_vert(2);
628  r_vert[0] = Lright + X_0;
629  r_vert[1] = y0 + (1.0 + zeta[0]) / 2.0 * (y1 - y0);
630 
631  // Parameter with value 0 in -Lleft and value 1 on the wall.
632  double s = double(Nright - j) / double(Nright); /***Change****/
633 
634  // Final expression of r
635  r[0] = r_vert[0] + s * (r_wall[0] - r_vert[0]);
636  r[1] = r_vert[1] + s * (r_wall[1] - r_vert[1]);
637  }
638 
639 
640  //=====================================================================
641  /// Helper function for northern boundary in lower right region
642  //=====================================================================
644  const Vector<double>& zeta,
645  Vector<double>& r,
646  const unsigned& i,
647  const unsigned& j)
648  {
649  // Find the coordinates of the two corners of the north boundary
650  Vector<double> xi(1);
651  Vector<double> r_left(2);
652  Vector<double> r_right(2);
653  xi[0] = 1;
654  macro_bound_II_W(t, xi, r_left, i, j);
655  macro_bound_II_E(t, xi, r_right, i, j);
656 
657  // Connect those two points with a straight line
658  r[0] = r_left[0] + (1.0 + zeta[0]) / 2.0 * (r_right[0] - r_left[0]);
659  r[1] = r_left[1] + (1.0 + zeta[0]) / 2.0 * (r_right[1] - r_left[1]);
660  }
661 
662 
663  //=====================================================================
664  /// Helper function for southern boundary in lower right region
665  //=====================================================================
667  const Vector<double>& zeta,
668  Vector<double>& r,
669  const unsigned& i,
670  const unsigned& j)
671  {
672  // Find the coordinates of the two corners of the south boundary
673  Vector<double> xi(1);
674  Vector<double> r_left(2);
675  Vector<double> r_right(2);
676  xi[0] = -1.0;
677  macro_bound_II_W(t, xi, r_left, i, j);
678  macro_bound_II_E(t, xi, r_right, i, j);
679 
680  // Connect those two points with a straight line
681  r[0] = r_left[0] + (1.0 + zeta[0]) / 2.0 * (r_right[0] - r_left[0]);
682  r[1] = r_left[1] + (1.0 + zeta[0]) / 2.0 * (r_right[1] - r_left[1]);
683  }
684 
685 
686  /// //////////////////////////////////////////////////////////////////
687  /// //////////////////////////////////////////////////////////////////
688  // Helper functions for region III (upper left region)
689  /// //////////////////////////////////////////////////////////////////
690  /// //////////////////////////////////////////////////////////////////
691 
692 
693  //=====================================================================
694  /// Describe the line between the boundary north of the domain (at x=X_0)
695  /// and the top of the wall, when zeta goes from 0 to 1.
696  //=====================================================================
698  const Vector<double>& zeta,
699  Vector<double>& r)
700  {
701  // Coordinates of the point on the boundary beetween the upper
702  // and the lower part, in the same column, at the east.
703  Vector<double> xi(1);
704  xi[0] = Hleaflet;
705 
706  Vector<double> r_join(2);
707 
708  Leaflet_pt->position(t, xi, r_join);
709 
710  r[0] = r_join[0] + zeta[0] * (X_0 - r_join[0]);
711  r[1] = r_join[1] + zeta[0] * (Htot - r_join[1]);
712  }
713 
714 
715  //=====================================================================
716  /// Helper function for eastern boundary in upper left region
717  //=====================================================================
719  const Vector<double>& zeta,
720  Vector<double>& r,
721  const unsigned& i,
722  const unsigned& j)
723  {
724  // Find x,y on the slanted straight line (SSL) corresponding to
725  // the position of the macro element
726 
727  // xi_line varies from xi0 to xi1 on the SSL
728  double xi0, xi1;
729  xi0 = double(i) / double(Ny2);
730  xi1 = double(i + 1) / double(Ny2);
731 
732  Vector<double> xi_line(1);
733  xi_line[0] = xi0 + (1.0 + zeta[0]) / 2.0 * (xi1 - xi0);
734 
735  Vector<double> r_line(2);
736  slanted_bound_up(t, xi_line, r_line);
737 
738  // Find x,y on a vertical line corresponding
739  // to the position of the macro element
740 
741  // the vertical line goes from y0 to y1
742  double y0, y1;
743  y0 = double(i) * (Htot - Hleaflet) / double(Ny2) + Hleaflet;
744  y1 = double(i + 1) * (Htot - Hleaflet) / double(Ny2) + Hleaflet;
745  ;
746 
747  Vector<double> r_vert(2);
748  r_vert[0] = -Lleft + X_0;
749  r_vert[1] = y0 + (1.0 + zeta[0]) / 2.0 * (y1 - y0);
750 
751  // Parameter with value 0 in Lright and value 1 on the wall.
752  double s = double(j + 1) / double(Nleft); /***Change****/
753 
754  /// Final expression of r
755  r[0] = r_vert[0] + s * (r_line[0] - r_vert[0]);
756  r[1] = r_vert[1] + s * (r_line[1] - r_vert[1]);
757  }
758 
759 
760  //=====================================================================
761  /// Helper function for western boundary in upper left region
762  //=====================================================================
764  const Vector<double>& zeta,
765  Vector<double>& r,
766  const unsigned& i,
767  const unsigned& j)
768  {
769  // Find x,y on the slanted straight line (SSL) corresponding to
770  // the position of the macro element
771 
772  // xi_line varies from xi0 to xi1 on the SSL
773  double xi0, xi1;
774  xi0 = double(i) / double(Ny2);
775  xi1 = double(i + 1) / double(Ny2);
776 
777  Vector<double> xi_line(1);
778  xi_line[0] = xi0 + (1.0 + zeta[0]) / 2.0 * (xi1 - xi0);
779 
780  Vector<double> r_line(2);
781  slanted_bound_up(t, xi_line, r_line);
782 
783  // Find x,y on a vertical line corresponding
784  // to the position of the macro element
785 
786  // the vertical line goes from y0 to y1
787  double y0, y1;
788  y0 = double(i) * (Htot - Hleaflet) / double(Ny2) + Hleaflet;
789  y1 = double(i + 1) * (Htot - Hleaflet) / double(Ny2) + Hleaflet;
790  ;
791 
792  Vector<double> r_vert(2);
793  r_vert[0] = -Lleft + X_0;
794  r_vert[1] = y0 + (1.0 + zeta[0]) / 2.0 * (y1 - y0);
795 
796  // Parameter with value 0 in Lright and value 1 on the wall.
797  double s = double(j) / double(Nleft); /***Change****/
798 
799  // Final expression of r
800  r[0] = r_vert[0] + s * (r_line[0] - r_vert[0]);
801  r[1] = r_vert[1] + s * (r_line[1] - r_vert[1]);
802  }
803 
804 
805  //=====================================================================
806  /// Helper function for northern boundary in upper left region
807  //=====================================================================
809  const Vector<double>& zeta,
810  Vector<double>& r,
811  const unsigned& i,
812  const unsigned& j)
813  {
814  // Find the coordinates of the two corners of the north boundary
815  Vector<double> xi(1);
816  Vector<double> r_left(2);
817  Vector<double> r_right(2);
818  xi[0] = 1;
819  macro_bound_III_W(t, xi, r_left, i, j);
820  macro_bound_III_E(t, xi, r_right, i, j);
821 
822  // Connect those two points with a straight line
823  r[0] = r_left[0] + (1.0 + zeta[0]) / 2.0 * (r_right[0] - r_left[0]);
824  r[1] = r_left[1] + (1.0 + zeta[0]) / 2.0 * (r_right[1] - r_left[1]);
825  }
826 
827 
828  //=====================================================================
829  /// Helper function for southern boundary in upper left region
830  //=====================================================================
832  const Vector<double>& zeta,
833  Vector<double>& r,
834  const unsigned& i,
835  const unsigned& j)
836  {
837  // Find the coordinates of the two corners of the south boundary
838  Vector<double> xi(1);
839  Vector<double> r_left(2);
840  Vector<double> r_right(2);
841  xi[0] = -1;
842  macro_bound_III_W(t, xi, r_left, i, j);
843  macro_bound_III_E(t, xi, r_right, i, j);
844 
845  // Connect those two points with a straight line
846  r[0] = r_left[0] + (1.0 + zeta[0]) / 2.0 * (r_right[0] - r_left[0]);
847  r[1] = r_left[1] + (1.0 + zeta[0]) / 2.0 * (r_right[1] - r_left[1]);
848  }
849 
850 
851  /// //////////////////////////////////////////////////////////////////
852  /// //////////////////////////////////////////////////////////////////
853  // Helper functions for region IV (upper right region)
854  /// //////////////////////////////////////////////////////////////////
855  /// //////////////////////////////////////////////////////////////////
856 
857 
858  //=====================================================================
859  /// Helper function for eastern boundary in upper right region
860  //=====================================================================
862  const Vector<double>& zeta,
863  Vector<double>& r,
864  const unsigned& i,
865  const unsigned& j)
866  {
867  // Find x,y on the slanted straight line (SSL) corresponding to
868  // the position of the macro element
869 
870  // xi_line varies from xi0 to xi1 on the SSL
871  double xi0, xi1;
872  xi0 = double(i) / double(Ny2);
873  xi1 = double(i + 1) / double(Ny2);
874 
875  Vector<double> xi_line(1);
876  xi_line[0] = xi0 + (1.0 + zeta[0]) / 2.0 * (xi1 - xi0);
877 
878  Vector<double> r_line(2);
879  slanted_bound_up(t, xi_line, r_line);
880 
881  // Find x,y on a vertical line corresponding
882  // to the position of the macro element
883 
884  // the vertical line goes from y0 to y1
885  double y0, y1;
886  y0 = double(i) * (Htot - Hleaflet) / double(Ny2) + Hleaflet;
887  y1 = double(i + 1) * (Htot - Hleaflet) / double(Ny2) + Hleaflet;
888  ;
889 
890  Vector<double> r_vert(2);
891  r_vert[0] = Lright + X_0;
892  r_vert[1] = y0 + (1.0 + zeta[0]) / 2.0 * (y1 - y0);
893 
894  // Parameter with value 0 in Lright and value 1 on the wall.
895  double s = double(Nright - j - 1) / double(Nright); /***Change****/
896 
897  // Final expression of r
898  r[0] = r_vert[0] + s * (r_line[0] - r_vert[0]);
899  r[1] = r_vert[1] + s * (r_line[1] - r_vert[1]);
900  }
901 
902 
903  //=====================================================================
904  /// Helper function for western boundary in upper right region
905  //=====================================================================
907  const Vector<double>& zeta,
908  Vector<double>& r,
909  const unsigned& i,
910  const unsigned& j)
911  {
912  // Find x,y on the slanted straight line (SSL) corresponding to
913  // the position of the macro element
914 
915  // xi_line varies from xi0 to xi1 on the SSL
916  double xi0, xi1;
917  xi0 = double(i) / double(Ny2);
918  xi1 = double(i + 1) / double(Ny2);
919 
920  Vector<double> xi_line(1);
921  xi_line[0] = xi0 + (1.0 + zeta[0]) / 2.0 * (xi1 - xi0);
922 
923  Vector<double> r_line(2);
924  slanted_bound_up(t, xi_line, r_line);
925 
926  // Find x,y on a vertical line corresponding
927  // to the position of the macro element
928 
929  // The vertical line goes from y0 to y1
930  double y0, y1;
931  y0 = double(i) * (Htot - Hleaflet) / double(Ny2) + Hleaflet;
932  y1 = double(i + 1) * (Htot - Hleaflet) / double(Ny2) + Hleaflet;
933  ;
934 
935  Vector<double> r_vert(2);
936  r_vert[0] = Lright + X_0;
937  r_vert[1] = y0 + (1.0 + zeta[0]) / 2.0 * (y1 - y0);
938 
939  // Parameter with value 0 in Lright and value 1 on the wall.
940  double s = double(Nright - j) / double(Nright); /***Change****/
941 
942  // Final expression of r
943  r[0] = r_vert[0] + s * (r_line[0] - r_vert[0]);
944  r[1] = r_vert[1] + s * (r_line[1] - r_vert[1]);
945  }
946 
947 
948  //=====================================================================
949  /// Helper function for northern boundary in upper right region
950  //=====================================================================
952  const Vector<double>& zeta,
953  Vector<double>& r,
954  const unsigned& i,
955  const unsigned& j)
956  {
957  // Find the coordinates of the two corners of the north boundary
958  Vector<double> xi(1);
959  Vector<double> r_left(2);
960  Vector<double> r_right(2);
961  xi[0] = 1;
962  macro_bound_IV_W(t, xi, r_left, i, j);
963  macro_bound_IV_E(t, xi, r_right, i, j);
964 
965  // Connect those two points with a straight line
966  r[0] = r_left[0] + (1.0 + zeta[0]) / 2.0 * (r_right[0] - r_left[0]);
967  r[1] = r_left[1] + (1.0 + zeta[0]) / 2.0 * (r_right[1] - r_left[1]);
968  }
969 
970 
971  //=====================================================================
972  /// Helper function for southern boundary in upper right region
973  //=====================================================================
975  const Vector<double>& zeta,
976  Vector<double>& r,
977  const unsigned& i,
978  const unsigned& j)
979  {
980  // Find the coordinates of the two corners of the south boundary
981  Vector<double> xi(1);
982  Vector<double> r_left(2);
983  Vector<double> r_right(2);
984  xi[0] = -1;
985  macro_bound_IV_W(t, xi, r_left, i, j);
986  macro_bound_IV_E(t, xi, r_right, i, j);
987 
988  // Connect those two points with a straight line
989  r[0] = r_left[0] + (1.0 + zeta[0]) / 2.0 * (r_right[0] - r_left[0]);
990  r[1] = r_left[1] + (1.0 + zeta[0]) / 2.0 * (r_right[1] - r_left[1]);
991  }
992 
993 
994 } // namespace oomph
995 
996 
997 #endif
static char t char * s
Definition: cfortran.h:568
cstr elem_len * i
Definition: cfortran.h:603
char t
Definition: cfortran.h:568
Rectangular domain with a leaflet blocking the lower half.
void macro_bound_IV_S(const unsigned &t, const Vector< double > &zeta, Vector< double > &r, const unsigned &i, const unsigned &j)
Helper function.
void macro_bound_III_W(const unsigned &t, const Vector< double > &zeta, Vector< double > &r, const unsigned &i, const unsigned &j)
Helper function.
GeomObject * Leaflet_pt
Pointer to leaflet.
void macro_bound_I_N(const unsigned &t, const Vector< double > &zeta, Vector< double > &r, const unsigned &i, const unsigned &j)
Helper function.
double Lleft
Length of the domain to the left of the leaflet.
unsigned Nright
Number of macro element columnns to the right of the leaflet.
void macro_bound_II_N(const unsigned &t, const Vector< double > &zeta, Vector< double > &r, const unsigned &i, const unsigned &j)
Helper function.
unsigned Ny2
Number of macro element rows above the leaflet.
void macro_bound_I_W(const unsigned &t, const Vector< double > &zeta, Vector< double > &r, const unsigned &i, const unsigned &j)
Helper function.
double X_0
Center of the domain : origin of the leaflet, extracted from GeomObject and stored for fast access.
void macro_bound_IV_E(const unsigned &t, const Vector< double > &zeta, Vector< double > &r, const unsigned &i, const unsigned &j)
Helper function.
void macro_bound_I_S(const unsigned &t, const Vector< double > &zeta, Vector< double > &r, const unsigned &i, const unsigned &j)
Helper function.
unsigned Ny1
Number of macro element rows up to the end of the leaflet.
double lleft()
Length of domain to the left of leaflet.
void macro_bound_II_S(const unsigned &t, const Vector< double > &zeta, Vector< double > &r, const unsigned &i, const unsigned &j)
Helper function.
double Lright
Length of the domain to the right of the leaflet.
ChannelWithLeafletDomain(GeomObject *leaflet_pt, const double &lleft, const double &lright, const double &hleaflet, const double &htot, const unsigned &nleft, const unsigned &nright, const unsigned &ny1, const unsigned &ny2)
Constructor: Pass pointer to GeomObject that represents the leaflet, the length of the domain to left...
double Hleaflet
Lagrangian coordinate at end of leaflet.
~ChannelWithLeafletDomain()
Destructor: Empty; cleanup done in base class.
void macro_bound_III_N(const unsigned &t, const Vector< double > &zeta, Vector< double > &r, const unsigned &i, const unsigned &j)
Helper function.
void macro_bound_II_E(const unsigned &t, const Vector< double > &zeta, Vector< double > &r, const unsigned &i, const unsigned &j)
Helper function.
GeomObject *& leaflet_pt()
Pointer to the wall.
void slanted_bound_up(const unsigned &t, const Vector< double > &zeta, Vector< double > &r)
Helper function.
void macro_bound_III_S(const unsigned &t, const Vector< double > &zeta, Vector< double > &r, const unsigned &i, const unsigned &j)
Helper function.
double htot()
Total height of domain (width of channel)
void macro_bound_IV_W(const unsigned &t, const Vector< double > &zeta, Vector< double > &r, const unsigned &i, const unsigned &j)
Helper function.
void macro_bound_I_E(const unsigned &t, const Vector< double > &zeta, Vector< double > &r, const unsigned &i, const unsigned &j)
Helper function.
unsigned Nleft
Number of macro element columns to the left of the leaflet.
double Htot
Total width of the channel.
void macro_element_boundary(const unsigned &t, const unsigned &imacro, const unsigned &idirect, const Vector< double > &zeta, Vector< double > &r)
Parametrisation of macro element boundaries.
void macro_bound_IV_N(const unsigned &t, const Vector< double > &zeta, Vector< double > &r, const unsigned &i, const unsigned &j)
Helper function.
double lright()
Length of domain to the right of leaflet.
void macro_bound_III_E(const unsigned &t, const Vector< double > &zeta, Vector< double > &r, const unsigned &i, const unsigned &j)
Helper function.
void macro_bound_II_W(const unsigned &t, const Vector< double > &zeta, Vector< double > &r, const unsigned &i, const unsigned &j)
Helper function.
Base class for Domains with curvilinear and/or time-dependent boundaries. Domain boundaries are typic...
Definition: domain.h:67
Vector< MacroElement * > Macro_element_pt
Vector of pointers to macro elements.
Definition: domain.h:301
/////////////////////////////////////////////////////////////////////
Definition: geom_objects.h:101
virtual void position(const Vector< double > &zeta, Vector< double > &r) const =0
Parametrised position on object at current time: r(zeta).
An OomphLibWarning object which should be created as a temporary object to issue a warning....
QMacroElement specialised to 2 spatial dimensions.
//////////////////////////////////////////////////////////////////// ////////////////////////////////...