channel_spine_mesh.template.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-2025 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_SPINE_MESH_TEMPLATE_HEADER
27#define OOMPH_CHANNEL_SPINE_MESH_TEMPLATE_HEADER
28
29#ifndef OOMPH_CHANNEL_SPINE_MESH_HEADER
30#error __FILE__ should only be included from channel_spine_mesh.h.
31#endif // OOMPH_CHANNEL_SPINE_MESH_HEADER
32
34
35namespace oomph
36{
37 //===========================================================================
38 /// Constructor for spine 2D mesh: Pass number of elements in x-direction,
39 /// number of elements in y-direction, axial length and height of layer,
40 /// and pointer to timestepper (defaults to Static timestepper).
41 ///
42 /// The mesh contains a layer of spinified fluid elements (of type ELEMENT;
43 /// e.g SpineElement<QCrouzeixRaviartElement<2>)
44 /// and a surface layer of corresponding Spine interface elements
45 /// of type INTERFACE_ELEMENT, e.g.
46 /// SpineLineFluidInterfaceElement<ELEMENT> for 2D planar
47 /// problems.
48 //===========================================================================
49 template<class ELEMENT>
51 const unsigned& nx1,
52 const unsigned& nx2,
53 const unsigned& ny,
54 const double& lx0,
55 const double& lx1,
56 const double& lx2,
57 const double& h,
58 GeomObject* wall_pt,
59 TimeStepper* time_stepper_pt)
60 : RectangularQuadMesh<ELEMENT>(nx0 + nx1 + nx2,
61 ny,
62 0.0,
63 lx0 + lx1 + lx2,
64 0.0,
65 h,
66 false,
67 false,
68 time_stepper_pt),
69 Nx0(nx0),
70 Nx1(nx1),
71 Nx2(nx2),
72 Lx0(lx0),
73 Lx1(lx1),
74 Lx2(lx2),
75 Wall_pt(wall_pt)
76 {
77 // Mesh can only be built with 2D Qelements.
78 MeshChecker::assert_geometric_element<QElementGeometricBase, ELEMENT>(2);
79
80 // Mesh can only be built with spine elements
81 MeshChecker::assert_geometric_element<SpineFiniteElement, ELEMENT>(2);
82
83 // We've called the "generic" constructor for the RectangularQuadMesh
84 // which doesn't do much...
85
86 // Build the straight line object
88
89 // Now build the mesh:
90 build_channel_spine_mesh(time_stepper_pt);
91 }
92
93 //===========================================================================
94 /// Constuctor for spine 2D mesh: Pass number of elements in x-direction,
95 /// number of elements in y-direction, axial length and height of layer,
96 /// a boolean flag to make the mesh periodic in the x-direction,
97 /// and pointer to timestepper (defaults to Static timestepper).
98 ///
99 /// The mesh contains a layer of elements (of type ELEMENT)
100 /// and a surface layer of corresponding Spine interface elements (of type
101 /// SpineLineFluidInterfaceElement<ELEMENT>).
102 //===========================================================================
103 template<class ELEMENT>
105 const unsigned& nx1,
106 const unsigned& nx2,
107 const unsigned& ny,
108 const double& lx0,
109 const double& lx1,
110 const double& lx2,
111 const double& h,
112 GeomObject* wall_pt,
113 const bool& periodic_in_x,
114 TimeStepper* time_stepper_pt)
115 : RectangularQuadMesh<ELEMENT>(nx0 + nx1 + nx2,
116 ny,
117 0.0,
118 lx0 + lx1 + lx2,
119 0.0,
120 h,
122 false,
123 time_stepper_pt),
124 Nx0(nx0),
125 Nx1(nx1),
126 Nx2(nx2),
127 Lx0(lx0),
128 Lx1(lx1),
129 Lx2(lx2),
130 Wall_pt(wall_pt)
131 {
132 // Mesh can only be built with 2D Qelements.
133 MeshChecker::assert_geometric_element<QElementGeometricBase, ELEMENT>(2);
134
135 // Mesh can only be built with spine elements
136 MeshChecker::assert_geometric_element<SpineFiniteElement, ELEMENT>(2);
137
138 // We've called the "generic" constructor for the RectangularQuadMesh
139 // which doesn't do much...
140
141 // Build the straight line object
143
144 // Now build the mesh:
145 build_channel_spine_mesh(time_stepper_pt);
146 }
147
148 //===========================================================================
149 /// Helper function that actually builds the channel-spine mesh
150 /// based on the parameters set in the various constructors
151 //===========================================================================
152 template<class ELEMENT>
154 TimeStepper* time_stepper_pt)
155 {
156 // Build the underlying quad mesh:
158
159 // Read out the number of elements in the x-direction and y-direction
160 // and in each of the left, centre and right regions
161 unsigned n_x = this->Nx;
162 unsigned n_y = this->Ny;
163 unsigned n_x0 = this->Nx0;
164 unsigned n_x1 = this->Nx1;
165 unsigned n_x2 = this->Nx2;
166
167 // Set up the pointers to elements in the left region
168 unsigned nleft = n_x0 * n_y;
169 ;
170 Left_element_pt.reserve(nleft);
171 unsigned ncentre = n_x1 * n_y;
172 ;
173 Centre_element_pt.reserve(ncentre);
174 unsigned nright = n_x2 * n_y;
175 ;
176 Right_element_pt.reserve(nright);
177 for (unsigned irow = 0; irow < n_y; irow++)
178 {
179 for (unsigned e = 0; e < n_x0; e++)
180 {
181 Left_element_pt.push_back(this->finite_element_pt(irow * n_x + e));
182 }
183 for (unsigned e = 0; e < n_x1; e++)
184 {
185 Centre_element_pt.push_back(
186 this->finite_element_pt(irow * n_x + (n_x0 + e)));
187 }
188 for (unsigned e = 0; e < n_x2; e++)
189 {
190 Right_element_pt.push_back(
191 this->finite_element_pt(irow * n_x + (n_x0 + n_x1 + e)));
192 }
193 }
194
195#ifdef PARANOID
196 // Check that we have the correct number of elements
197 if (nelement() != nleft + ncentre + nright)
198 {
199 throw OomphLibError("Incorrect number of element pointers!",
202 }
203#endif
204
205 // Allocate memory for the spines and fractions along spines
206 //---------------------------------------------------------
207
208 // Read out number of linear points in the element
209 unsigned n_p = dynamic_cast<ELEMENT*>(finite_element_pt(0))->nnode_1d();
210
211 unsigned nspine;
212 // Allocate store for the spines:
213 if (this->Xperiodic)
214 {
215 nspine = (n_p - 1) * n_x;
216 Spine_pt.reserve(nspine);
217 // Number of spines in each region
218 // NOTE that boundary spines are in both regions
219 Nleft_spine = (n_p - 1) * n_x0 + 1;
220 Ncentre_spine = (n_p - 1) * n_x1 + 1;
221 Nright_spine = (n_p - 1) * n_x2;
222 }
223 else
224 {
225 nspine = (n_p - 1) * n_x + 1;
226 Spine_pt.reserve(nspine);
227 // Number of spines in each region
228 // NOTE that boundary spines are in both regions
229 Nleft_spine = (n_p - 1) * n_x0 + 1;
230 Ncentre_spine = (n_p - 1) * n_x1 + 1;
231 Nright_spine = (n_p - 1) * n_x2 + 1;
232 }
233
234 // end Allocating memory
235
236 // set up the vectors of geometric data & objects for building spines
237 Vector<double> r_wall(2), zeta(1), s_wall(1);
239
240 // LEFT REGION
241 // ===========
242
243 // SPINES IN LEFT REGION
244 // ---------------------
245
246 // Set up zeta increments
247 double zeta_lo = 0.0;
248 double dzeta = Lx0 / n_x0;
249
250 // Initialise number of elements in previous regions:
251 unsigned n_prev_elements = 0;
252
253 // FIRST SPINE
254 //-----------
255
256 // Element 0
257 // Node 0
258 // Assign the new spine with unit length
259 Spine* new_spine_pt = new Spine(1.0);
260 new_spine_pt->spine_height_pt()->pin(0);
261 Spine_pt.push_back(new_spine_pt);
262
263 // Get pointer to node
264 SpineNode* nod_pt = element_node_pt(0, 0);
265 // Set the pointer to the spine
266 nod_pt->spine_pt() = new_spine_pt;
267 // Set the fraction
268 nod_pt->fraction() = 0.0;
269 // Pointer to the mesh that implements the update fct
270 nod_pt->spine_mesh_pt() = this;
271 // Set update fct id
272 nod_pt->node_update_fct_id() = 0;
273
274 // Provide spine with additional storage for wall coordinate
275 // and wall geom object:
276
277 {
278 // Get the Lagrangian coordinate in the Lower Wall
279 zeta[0] = 0.0;
280 // Get the geometric object and local coordinate
281 Straight_wall_pt->locate_zeta(zeta, geometric_object_pt, s_wall);
282
283 // The local coordinate is a geometric parameter
284 // This needs to be set (rather than added) because the
285 // same spine may be visited more than once
287 nod_pt->spine_pt()->set_geom_parameter(parameters);
288
289 // Get position of wall
290 Straight_wall_pt->position(s_wall, r_wall);
291
292 // Adjust spine height
293 nod_pt->spine_pt()->height() = r_wall[1];
294
295 // The sub geom object is one (and only) geom object
296 // for spine:
297 Vector<GeomObject*> geom_object_pt(1);
298 geom_object_pt[0] = geometric_object_pt;
299
300 // Pass geom object(s) to spine
301 nod_pt->spine_pt()->set_geom_object_pt(geom_object_pt);
302 }
303
304 // Loop vertically along the spine
305 // Loop over the elements
306 for (unsigned long i = 0; i < n_y; i++)
307 {
308 // Loop over the vertical nodes, apart from the first
309 for (unsigned l1 = 1; l1 < n_p; l1++)
310 {
311 // Get pointer to node
312 SpineNode* nod_pt = element_node_pt(i * n_x, l1 * n_p);
313 // Set the pointer to the spine
314 nod_pt->spine_pt() = new_spine_pt;
315 // Set the fraction
316 nod_pt->fraction() =
317 (double(i) + double(l1) / double(n_p - 1)) / double(n_y);
318 // Pointer to the mesh that implements the update fct
319 nod_pt->spine_mesh_pt() = this;
320 // Set update fct id
321 nod_pt->node_update_fct_id() = 0;
322 }
323 } // end loop over elements
324
325 // LOOP OVER OTHER SPINES
326 //----------------------
327
328 // Now loop over the elements horizontally
329 for (unsigned long j = 0; j < n_x0; j++)
330 {
331 // Loop over the nodes in the elements horizontally, ignoring
332 // the first column
333 unsigned n_pmax = n_p;
334 for (unsigned l2 = 1; l2 < n_pmax; l2++)
335 {
336 // Assign the new spine with unit height
337 new_spine_pt = new Spine(1.0);
338 new_spine_pt->spine_height_pt()->pin(0);
339 Spine_pt.push_back(new_spine_pt);
340
341 // Get the node
342 SpineNode* nod_pt = element_node_pt(j, l2);
343 // Set the pointer to spine
344 nod_pt->spine_pt() = new_spine_pt;
345 // Set the fraction
346 nod_pt->fraction() = 0.0;
347 // Pointer to the mesh that implements the update fct
348 nod_pt->spine_mesh_pt() = this;
349 // Set update fct id
350 nod_pt->node_update_fct_id() = 0;
351
352 {
353 // Provide spine with additional storage for wall coordinate
354 // and wall geom object:
355
356 // Get the Lagrangian coordinate in the Lower Wall
357 zeta[0] =
358 zeta_lo + double(j) * dzeta + double(l2) * dzeta / (n_p - 1.0);
359 // Get the geometric object and local coordinate
360 Straight_wall_pt->locate_zeta(zeta, geometric_object_pt, s_wall);
361
362 // The local coordinate is a geometric parameter
363 // This needs to be set (rather than added) because the
364 // same spine may be visited more than once
366 nod_pt->spine_pt()->set_geom_parameter(parameters);
367
368 // Get position of wall
369 Straight_wall_pt->position(s_wall, r_wall);
370
371 // Adjust spine height
372 nod_pt->spine_pt()->height() = r_wall[1];
373
374 // The sub geom object is one (and only) geom object
375 // for spine:
376 Vector<GeomObject*> geom_object_pt(1);
377 geom_object_pt[0] = geometric_object_pt;
378
379 // Pass geom object(s) to spine
380 nod_pt->spine_pt()->set_geom_object_pt(geom_object_pt);
381 }
382
383 // Loop vertically along the spine
384 // Loop over the elements
385 for (unsigned long i = 0; i < n_y; i++)
386 {
387 // Loop over the vertical nodes, apart from the first
388 for (unsigned l1 = 1; l1 < n_p; l1++)
389 {
390 // Get the node
391 SpineNode* nod_pt = element_node_pt(i * n_x + j, l1 * n_p + l2);
392 // Set the pointer to the spine
393 nod_pt->spine_pt() = new_spine_pt;
394 // Set the fraction
395 nod_pt->fraction() =
396 (double(i) + double(l1) / double(n_p - 1)) / double(n_y);
397 // Pointer to the mesh that implements the update fct
398 nod_pt->spine_mesh_pt() = this;
399 // Set update fct id
400 nod_pt->node_update_fct_id() = 0;
401 }
402 }
403 }
404 }
405
406 // Increment number of previous elements
408
409 // CENTRE REGION
410 // ===========
411
412 zeta_lo = Lx0;
413 dzeta = Lx1 / n_x1;
414
415 // SPINES IN LEFT REGION
416 // ---------------------
417
418 // LOOP OVER OTHER SPINES
419 //----------------------
420
421 // Now loop over the elements horizontally
422 for (unsigned long j = n_x0; j < n_x0 + n_x1; j++)
423 {
424 // Loop over the nodes in the elements horizontally, ignoring
425 // the first column
426 unsigned n_pmax = n_p;
427 for (unsigned l2 = 1; l2 < n_pmax; l2++)
428 {
429 // Assign the new spine with unit height
430 new_spine_pt = new Spine(1.0);
431 new_spine_pt->spine_height_pt()->pin(0);
432 Spine_pt.push_back(new_spine_pt);
433
434 // Get the node
435 SpineNode* nod_pt = element_node_pt(j, l2);
436 // Set the pointer to spine
437 nod_pt->spine_pt() = new_spine_pt;
438 // Set the fraction
439 nod_pt->fraction() = 0.0;
440 // Pointer to the mesh that implements the update fct
441 nod_pt->spine_mesh_pt() = this;
442 // Set update fct id
443 nod_pt->node_update_fct_id() = 1;
444
445 {
446 // Provide spine with additional storage for wall coordinate
447 // and wall geom object:
448
449 // Get the Lagrangian coordinate in the Lower Wall
450 zeta[0] = zeta_lo + double(j - n_x0) * dzeta +
451 double(l2) * dzeta / (n_p - 1.0);
452 // Get the geometric object and local coordinate
454
455 // The local coordinate is a geometric parameter
456 // This needs to be set (rather than added) because the
457 // same spine may be visited more than once
459 nod_pt->spine_pt()->set_geom_parameter(parameters);
460
461 // Get position of wall
462 Wall_pt->position(s_wall, r_wall);
463
464 // Adjust spine height
465 nod_pt->spine_pt()->height() = r_wall[1];
466
467 // The sub geom object is one (and only) geom object
468 // for spine:
469 Vector<GeomObject*> geom_object_pt(1);
470 geom_object_pt[0] = geometric_object_pt;
471
472 // Pass geom object(s) to spine
473 nod_pt->spine_pt()->set_geom_object_pt(geom_object_pt);
474 }
475
476 // Loop vertically along the spine
477 // Loop over the elements
478 for (unsigned long i = 0; i < n_y; i++)
479 {
480 // Loop over the vertical nodes, apart from the first
481 for (unsigned l1 = 1; l1 < n_p; l1++)
482 {
483 // Get the node
484 SpineNode* nod_pt = element_node_pt(i * n_x + j, l1 * n_p + l2);
485 // Set the pointer to the spine
486 nod_pt->spine_pt() = new_spine_pt;
487 // Set the fraction
488 nod_pt->fraction() =
489 (double(i) + double(l1) / double(n_p - 1)) / double(n_y);
490 // Pointer to the mesh that implements the update fct
491 nod_pt->spine_mesh_pt() = this;
492 // Set update fct id
493 nod_pt->node_update_fct_id() = 1;
494 }
495 }
496 }
497 }
498
499 // Increment number of previous elements
501
502 // RIGHT REGION
503 // ===========
504
505 // SPINES IN RIGHT REGION
506 // ----------------------
507
508 // Set up zeta increments
509 zeta_lo = Lx0 + Lx1;
510 dzeta = Lx2 / n_x2;
511
512 // LOOP OVER OTHER SPINES
513 //----------------------
514
515 // Now loop over the elements horizontally
516 for (unsigned long j = n_x0 + n_x1; j < n_x0 + n_x1 + n_x2; j++)
517 {
518 // Need to copy last spine in previous element over to first spine
519 // in next elements, for all elements other than the first
520 if (j > 0)
521 {
522 // For first spine, re-assign the geometric objects, since
523 // we treat it as part of the right region.
524 if (j == n_x0 + n_x1)
525 {
526 SpineNode* nod_pt = element_node_pt(j, 0);
527 // Set update fct id
528 nod_pt->node_update_fct_id() = 2;
529 {
530 // Provide spine with additional storage for wall coordinate
531 // and wall geom object:
532
533 // Get the Lagrangian coordinate in the Lower Wall
534 zeta[0] = zeta_lo + double(j - n_x0 - n_x1) * dzeta;
535 // Get the geometric object and local coordinate
536 Straight_wall_pt->locate_zeta(zeta, geometric_object_pt, s_wall);
537
538 // The local coordinate is a geometric parameter
539 // This needs to be set (rather than added) because the
540 // same spine may be visited more than once
542 nod_pt->spine_pt()->set_geom_parameter(parameters);
543
544 // Get position of wall
545 Straight_wall_pt->position(s_wall, r_wall);
546
547 // Adjust spine height
548 nod_pt->spine_pt()->height() = r_wall[1];
549
550 // The sub geom object is one (and only) geom object
551 // for spine:
552 Vector<GeomObject*> geom_object_pt(1);
553 geom_object_pt[0] = geometric_object_pt;
554
555 // Pass geom object(s) to spine
556 nod_pt->spine_pt()->set_geom_object_pt(geom_object_pt);
557 }
558 }
559 }
560 // Loop over the nodes in the elements horizontally, ignoring
561 // the first column
562
563 // Last spine needs special treatment in x-periodic meshes:
564 unsigned n_pmax = n_p;
565 if ((this->Xperiodic) && (j == n_x - 1)) n_pmax = n_p - 1;
566
567 for (unsigned l2 = 1; l2 < n_pmax; l2++)
568 {
569 // Assign the new spine with unit height
570 new_spine_pt = new Spine(1.0);
571 new_spine_pt->spine_height_pt()->pin(0);
572 Spine_pt.push_back(new_spine_pt);
573
574 // Get the node
575 SpineNode* nod_pt = element_node_pt(j, l2);
576 // Set the pointer to spine
577 nod_pt->spine_pt() = new_spine_pt;
578 // Set the fraction
579 nod_pt->fraction() = 0.0;
580 // Pointer to the mesh that implements the update fct
581 nod_pt->spine_mesh_pt() = this;
582 // Set update fct id
583 nod_pt->node_update_fct_id() = 2;
584
585 {
586 // Provide spine with additional storage for wall coordinate
587 // and wall geom object:
588
589 // Get the Lagrangian coordinate in the Lower Wall
590 zeta[0] = zeta_lo + double(j - n_x0 - n_x1) * dzeta +
591 double(l2) * dzeta / (n_p - 1.0);
592 // Get the geometric object and local coordinate
593 Straight_wall_pt->locate_zeta(zeta, geometric_object_pt, s_wall);
594
595 // The local coordinate is a geometric parameter
596 // This needs to be set (rather than added) because the
597 // same spine may be visited more than once
599 nod_pt->spine_pt()->set_geom_parameter(parameters);
600
601 // Get position of wall
602 Straight_wall_pt->position(s_wall, r_wall);
603
604 // Adjust spine height
605 nod_pt->spine_pt()->height() = r_wall[1];
606
607 // The sub geom object is one (and only) geom object
608 // for spine:
609 Vector<GeomObject*> geom_object_pt(1);
610 geom_object_pt[0] = geometric_object_pt;
611
612 // Pass geom object(s) to spine
613 nod_pt->spine_pt()->set_geom_object_pt(geom_object_pt);
614 }
615
616 // Loop vertically along the spine
617 // Loop over the elements
618 for (unsigned long i = 0; i < n_y; i++)
619 {
620 // Loop over the vertical nodes, apart from the first
621 for (unsigned l1 = 1; l1 < n_p; l1++)
622 {
623 // Get the node
624 SpineNode* nod_pt = element_node_pt(i * n_x + j, l1 * n_p + l2);
625 // Set the pointer to the spine
626 nod_pt->spine_pt() = new_spine_pt;
627 // Set the fraction
628 nod_pt->fraction() =
629 (double(i) + double(l1) / double(n_p - 1)) / double(n_y);
630 // Pointer to the mesh that implements the update fct
631 nod_pt->spine_mesh_pt() = this;
632 // Set update fct id
633 nod_pt->node_update_fct_id() = 2;
634 }
635 }
636 }
637 }
638
639 // Increment number of previous elements
641
642 // Last spine needs special treatment for periodic meshes
643 // because it's the same as the first one...
644 if (this->Xperiodic)
645 {
646 // Last spine is the same as first one...
647 Spine* final_spine_pt = Spine_pt[0];
648
649 // Get the node
650 SpineNode* nod_pt = element_node_pt((n_x - 1), (n_p - 1));
651
652 // Set the pointer for the first node
653 nod_pt->spine_pt() = final_spine_pt;
654 // Set the fraction to be the same as for the nodes on the first row
655 nod_pt->fraction() = element_node_pt(0, 0)->fraction();
656 // Pointer to the mesh that implements the update fct
657 nod_pt->spine_mesh_pt() = element_node_pt(0, 0)->spine_mesh_pt();
658
659 // Now loop vertically along the spine
660 for (unsigned i = 0; i < n_y; i++)
661 {
662 // Loop over the vertical nodes, apart from the first
663 for (unsigned l1 = 1; l1 < n_p; l1++)
664 {
665 // Get the node
667 element_node_pt(i * n_x + (n_x - 1), l1 * n_p + (n_p - 1));
668
669 // Set the pointer to the spine
670 nod_pt->spine_pt() = final_spine_pt;
671 // Set the fraction to be the same as in first row
672 nod_pt->fraction() = element_node_pt(i * n_x, l1 * n_p)->fraction();
673 // Pointer to the mesh that implements the update fct
674 nod_pt->spine_mesh_pt() =
675 element_node_pt(i * n_x, l1 * n_p)->spine_mesh_pt();
676 }
677 }
678 }
679
680 } // end of build_channel_spine_mesh
681
682 //======================================================================
683 /// Reorder the elements, so we loop over them vertically first
684 /// (advantageous in "wide" domains if a frontal solver is used).
685 //======================================================================
686 template<class ELEMENT>
688 {
689 unsigned n_x = this->Nx;
690 unsigned n_y = this->Ny;
691 // Find out how many elements there are
692 unsigned long Nelement = nelement();
693 // Find out how many fluid elements there are
694 unsigned long Nfluid = n_x * n_y;
695 // Create a dummy array of elements
697
698 // Loop over the elements in horizontal order
699 for (unsigned long j = 0; j < n_x; j++)
700 {
701 // Loop over the elements in lower layer vertically
702 for (unsigned long i = 0; i < n_y; i++)
703 {
704 // Push back onto the new stack
705 dummy.push_back(finite_element_pt(n_x * i + j));
706 }
707
708 // Push back the line element onto the stack
709 dummy.push_back(finite_element_pt(Nfluid + j));
710 }
711
712 // Now copy the reordered elements into the element_pt
713 for (unsigned long e = 0; e < Nelement; e++)
714 {
715 Element_pt[e] = dummy[e];
716 }
717
718 } // end of element_reorder
719
720} // namespace oomph
721
722#endif
e
Definition cfortran.h:571
cstr elem_len * i
Definition cfortran.h:603
virtual void build_channel_spine_mesh(TimeStepper *time_stepper_pt)
Helper function to actually build the channel-spine mesh (called from various constructors)
GeomObject * Straight_wall_pt
GeomObject for the straight upper wall.
ChannelSpineMesh(const unsigned &nx0, const unsigned &nx1, const unsigned &nx2, const unsigned &ny, const double &lx0, const double &lx1, const double &lx2, const double &h, GeomObject *wall_pt, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
Constructor: Pass number of elements in x-direction in regions 0,1 and 2, number of elements in y-dir...
void element_reorder()
Reorder the elements so we loop over them vertically first (advantageous in "wide" domains if a front...
void position(const Vector< double > &zeta, Vector< double > &r) const
Return the parametrised position of the FiniteElement in its incarnation as a GeomObject,...
Definition elements.h:2680
void locate_zeta(const Vector< double > &zeta, GeomObject *&geom_object_pt, Vector< double > &s, const bool &use_coordinate_as_initial_guess=false)
For a given value of zeta, the "global" intrinsic coordinate of a mesh of FiniteElements represented ...
Definition elements.cc:4764
virtual unsigned nnode_1d() const
Return the number of nodes along one edge of the element Default is to return zero — must be overload...
Definition elements.h:2222
A geometric object is an object that provides a parametrised description of its shape via the functio...
TimeStepper *& time_stepper_pt()
Access function for pointer to time stepper: Null if object is not time-dependent.
An OomphLibError object which should be thrown when an run-time error is encountered....
RectangularQuadMesh is a two-dimensional mesh of Quad elements with Nx elements in the "x" (horizonal...
void build_mesh(TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
Generic mesh construction function: contains all the hard work.
Class for nodes that live on spines. The assumption is that each Node lies at a fixed fraction on a s...
Definition spines.h:328
Spines are used for algebraic node update operations in free-surface fluid problems: They form the ba...
Definition spines.h:64
Steady, straight 1D line in 2D space.
TAdvectionDiffusionReactionElement<NREAGENT,DIM,NNODE_1D> elements are isoparametric triangular DIM-d...
TAdvectionDiffusionReactionElement()
Constructor: Call constructors for TElement and AdvectionDiffusionReaction equations.
Base class for time-stepping schemes. Timestepper provides an approximation of the temporal derivativ...
DRAIG: Change all instances of (SPATIAL_DIM) to (DIM-1).