rectangular_quadmesh.template.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// Version 1.0; svn revision $LastChangedRevision$
7 //LIC//
8 //LIC// $LastChangedDate$
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 //Header file for a relatively simple Quad Meshe
31 #ifndef OOMPH_RECTANGULAR_QUADMESH_HEADER
32 #define OOMPH_RECTANGULAR_QUADMESH_HEADER
33 
34 // Config header generated by autoconfig
35 #ifdef HAVE_CONFIG_H
36  #include <oomph-lib-config.h>
37 #endif
38 
39 //OOMPH-LIB headers
40 #include "../generic/mesh.h"
41 #include "../generic/quad_mesh.h"
42 #include "../generic/refineable_quad_mesh.h"
43 
44 namespace oomph
45 {
46 
47 //==========================================================================
48 /// RectangularQuadMesh is a two-dimensional mesh of Quad elements with Nx
49 /// elements in the "x" (horizonal) direction and Ny elements in the "y"
50 /// (vertical) direction. Two Constructors are provided. The basic constructor
51 /// assumes that the lower-left-hand corner of the mesh is (0,0) and
52 /// takes only the arguments, Nx, Ny, Xmax and Ymax. The more complex
53 /// constructor takes the additional arguments Xmin and Ymin.
54 ///
55 /// This class is designed to be used as a Base class for more complex
56 /// two dimensional meshes. The virtual functions x_spacing_function()
57 /// and y_spacing_function() may be overloaded to provide arbitrary node
58 /// spacing. The default is uniformly spaced nodes in each direction.
59 ///
60 /// It is also possible to make the solution periodic in the x direction.
61 //===========================================================================
62 template <class ELEMENT>
63 class RectangularQuadMesh : public virtual QuadMeshBase
64 {
65  protected:
66  //Mesh variables
67  /// Nx: number of elements in x-direction
68  unsigned Nx;
69  /// Ny: number of elements in y-direction
70  unsigned Ny;
71  /// Np: number of (linear) points in the element
72  unsigned Np;
73 
74  /// Minimum value of x coordinate
75  double Xmin;
76  /// Maximum value of x coordinate
77  double Xmax;
78 
79  /// Minimum value of y coordinate
80  double Ymin;
81  /// Maximum value of y coordinate
82  double Ymax;
83 
84  /// \short Boolean variable used to determine whether the mesh
85  /// is periodic in the x-direction
86  bool Xperiodic;
87 
88  /// Generic mesh construction function: contains all the hard work
89  void build_mesh(TimeStepper* time_stepper_pt=&Mesh::Default_TimeStepper);
90 
91  /// \short Constructor that allows the specification of minimum and maximum
92  /// values of x and y coordinates and does not build the mesh
93  /// This is intend to be used in derived classes that overload the
94  /// spacing functions. THis is scheduled to be changed, however.
95  /// The reason why this MUST be done is because the virtual spacing functions
96  /// cannot be called in the base constructur, because they will not have
97  /// been overloaded yet!!
98  RectangularQuadMesh(const unsigned &nx, const unsigned &ny,
99  const double &xmin, const double &xmax,
100  const double &ymin, const double &ymax,
101  const bool &periodic_in_x,
102  const bool &build,
103  TimeStepper* time_stepper_pt=&Mesh::Default_TimeStepper) :
104  Nx(nx), Ny(ny), Xmin(xmin), Xmax(xmax), Ymin(ymin), Ymax(ymax),
105  Xperiodic(periodic_in_x)
106  {
107  if(build)
108  {
109  //Call the generic mesh constructor
110  build_mesh(time_stepper_pt);
111  }
112  }
113 
114 public:
115 
116  /// \short Simple constructor: nx: number of elements in x direction;
117  /// ny: number of elements in y direction; lx, length of domain in x
118  /// direction (0,lx); ly, length of domain in y direction (0,ly)
119  /// Also pass pointer to timestepper (defaults to Steady)
120  RectangularQuadMesh(const unsigned &nx, const unsigned &ny,
121  const double &lx, const double &ly,
122  TimeStepper* time_stepper_pt=&Mesh::Default_TimeStepper) :
123  Nx(nx), Ny(ny), Xmin(0.0), Xmax(lx), Ymin(0.0), Ymax(ly), Xperiodic(false)
124  {
125  // Mesh can only be built with 2D Qelements.
126  MeshChecker::assert_geometric_element<QElementGeometricBase,ELEMENT>(2);
127 
128  //Call the generic mesh constructor
129  build_mesh(time_stepper_pt);
130  }
131 
132  /// \short Constructor that allows the specification of minimum and maximum
133  /// values of x and y coordinates
134  RectangularQuadMesh(const unsigned &nx, const unsigned &ny,
135  const double &xmin, const double &xmax,
136  const double &ymin, const double &ymax,
137  TimeStepper* time_stepper_pt=&Mesh::Default_TimeStepper) :
138  Nx(nx), Ny(ny), Xmin(xmin), Xmax(xmax), Ymin(ymin), Ymax(ymax),
139  Xperiodic(false)
140  {
141  // Mesh can only be built with 2D Qelements.
142  MeshChecker::assert_geometric_element<QElementGeometricBase,ELEMENT>(2);
143 
144  //Call the generic mesh constructor
145  build_mesh(time_stepper_pt);
146  }
147 
148  /// \short Simple constructor: nx: number of elements in x direction;
149  /// ny: number of elements in y direction; lx, length of domain in x
150  /// direction (0,lx); ly, length of domain in y direction (0,ly)
151  /// Boolean flag specifies if the mesh is periodic in the x-direction.
152  /// Also pass pointer to timestepper (defaults to Steady)
153  RectangularQuadMesh(const unsigned &nx, const unsigned &ny,
154  const double &lx, const double &ly,
155  const bool& periodic_in_x,
156  TimeStepper* time_stepper_pt=&Mesh::Default_TimeStepper) :
157  Nx(nx), Ny(ny), Xmin(0.0), Xmax(lx), Ymin(0.0), Ymax(ly),
158  Xperiodic(periodic_in_x)
159  {
160  // Mesh can only be built with 2D Qelements.
161  MeshChecker::assert_geometric_element<QElementGeometricBase,ELEMENT>(2);
162 
163  //Call the generic mesh constructor
164  build_mesh(time_stepper_pt);
165  }
166 
167  /// \short Constructor that allows the specification of minimum and maximum
168  /// values of x and y coordinates.
169  /// Boolean flag specifies if the mesh is periodic in the x-direction.
170  RectangularQuadMesh(const unsigned &nx, const unsigned &ny,
171  const double &xmin, const double &xmax,
172  const double &ymin, const double &ymax,
173  const bool& periodic_in_x,
174  TimeStepper* time_stepper_pt=&Mesh::Default_TimeStepper) :
175  Nx(nx), Ny(ny), Xmin(xmin), Xmax(xmax), Ymin(ymin), Ymax(ymax),
176  Xperiodic(periodic_in_x)
177  {
178  // Mesh can only be built with 2D Qelements.
179  MeshChecker::assert_geometric_element<QElementGeometricBase,ELEMENT>(2);
180 
181  //Call the generic mesh constructor
182  build_mesh(time_stepper_pt);
183  }
184 
185  /// Return number of elements in x direction
186  const unsigned& nx() const
187  {
188  // Return the value of Nx
189  return Nx;
190  }
191 
192  /// Return number of elements in y direction
193  const unsigned& ny() const
194  {
195  // Return the value of Ny
196  return Ny;
197  }
198 
199  /// Return the minimum value of x coordinate
200  const double x_min() const
201  {
202  // Return the value of Xmin
203  return Xmin;
204  }
205 
206  /// Return the maximum value of x coordinate
207  const double x_max() const
208  {
209  // Return the value of Xmax
210  return Xmax;
211  }
212 
213  /// Return the minimum value of y coordinate
214  const double y_min() const
215  {
216  // Return the value of Ymin
217  return Ymin;
218  }
219 
220  /// Return the maximum value of y coordinate
221  const double y_max() const
222  {
223  // Return the value of Ymax
224  return Ymax;
225  }
226 
227  /// \short Reorder the elements: By default they are ordered
228  /// in "horizontal" layers (increasing in x, then in y). This
229  /// function changes this to an ordering in the vertical direction
230  /// (y first, then x). This is more efficient if a frontal solver
231  /// is used and the mesh has more elements in the x than the y direction.
232  /// Can be overloaded in specific derived meshes.
233  virtual void element_reorder();
234 
235  /// \short Return the value of the x-coordinate at the node given by the
236  /// local node number (xnode, ynode) in the element (xelement,yelement).
237  /// The description is in a "psudeo" two-dimensional coordinate system,
238  /// so the range of xelement is [0,Nx-1], yelement is [0,Ny-1], and
239  /// that of xnode and ynode is [0,Np-1]. The default is to return
240  /// nodes that are equally spaced in the x coodinate.
241  virtual double x_spacing_function(unsigned xelement, unsigned xnode,
242  unsigned yelement, unsigned ynode)
243  {
244  //Calculate the values of equal increments in nodal values
245  double xstep = (Xmax-Xmin)/((Np-1)*Nx);
246  //Return the appropriate value
247  return (Xmin + xstep*((Np-1)*xelement + xnode));
248  }
249 
250  /// \short Return the value of the y-coordinate at the node given by the
251  /// local node number (xnode, ynode) in the element (xelement,yelement).
252  /// The description is in a "psudeo" two-dimensional coordinate system,
253  /// so the range of xelement is [0,Nx-1], yelement is [0,Ny-1], and
254  /// that of xnode and ynode is [0,Np-1]. The default it to return
255  /// nodes that are equally spaced in the y coordinate.
256  virtual double y_spacing_function(unsigned xelement, unsigned xnode,
257  unsigned yelement, unsigned ynode)
258  {
259  double ystep = (Ymax-Ymin)/((Np-1)*Ny);
260  //Return the appropriate value
261  return (Ymin + ystep*((Np-1)*yelement + ynode));
262  }
263 
264 };
265 
266 
267 
268 
269 
270 //==========================================================================
271 /// Refineable version of the RectangularQuadMesh: A two-dimensional
272 /// mesh of Quad elements with Nx elements in the "x" (horizonal)
273 /// direction and Ny elements in the "y" (vertical) direction. Two
274 /// Constructors are provided. The basic constructor
275 /// assumes that the lower-left-hand corner of the mesh is (0,0) and
276 /// takes only the arguments, Nx, Ny, Xmax and Ymax. The more complex
277 /// constructor takes the additional arguments Xmin and Ymin.
278 ///
279 /// This class is designed to be used as a Base class for more complex
280 /// two dimensional meshes. The virtual functions x_spacing_function()
281 /// and y_spacing_function() may be overloaded to provide arbitrary node
282 /// spacing. The default is uniformly spaced nodes in each direction.
283 //===========================================================================
284 template <class ELEMENT>
286 public virtual RectangularQuadMesh<ELEMENT>,
287 public RefineableQuadMesh<ELEMENT>
288 {
289 
290 public:
291 
292  /// \short Simple constructor: nx: number of elements in x direction;
293  /// ny: number of elements in y direction; lx, length of domain in x
294  /// direction (0,lx); ly, length of domain in y direction (0,ly).
295  /// Also pass pointer to timestepper (defaults to Steady)
296  RefineableRectangularQuadMesh(const unsigned &nx, const unsigned &ny,
297  const double &lx, const double &ly,
298  TimeStepper* time_stepper_pt=
300  RectangularQuadMesh<ELEMENT>(nx,ny,lx,ly,time_stepper_pt)
301  {
302  // Nodal positions etc. were created in constructor for
303  // RectangularMesh<...>. Only need to setup quadtree forest
304  this->setup_quadtree_forest();
305  }
306 
307  /// \short Simple constructor: nx: number of elements in x direction;
308  /// ny: number of elements in y direction; lx, length of domain in x
309  /// direction (0,lx); ly, length of domain in y direction (0,ly);
310  /// periodic_in_x, periodicity in x.
311  /// Also pass pointer to timestepper (defaults to Steady)
312  RefineableRectangularQuadMesh(const unsigned &nx, const unsigned &ny,
313  const double &lx, const double &ly,
314  const bool &periodic_in_x,
315  TimeStepper* time_stepper_pt=
317  RectangularQuadMesh<ELEMENT>(nx,ny,lx,ly,periodic_in_x,time_stepper_pt)
318  {
319  // Nodal positions etc. were created in constructor for
320  // RectangularMesh<...>. Only need to setup quadtree forest
321  this->setup_quadtree_forest();
322  }
323 
324  /// \short Constructor that allows the specification of minimum and maximum
325  /// values of x and y coordinates
326  /// Also pass pointer to timestepper (defaults to Steady)
327  RefineableRectangularQuadMesh(const unsigned &nx, const unsigned &ny,
328  const double &xmin, const double &xmax,
329  const double &ymin, const double &ymax,
330  TimeStepper* time_stepper_pt=
332  RectangularQuadMesh<ELEMENT>(nx,ny,xmin,xmax,ymin,ymax,time_stepper_pt)
333  {
334  // Nodal positions etc. were created in constructor for
335  // RectangularMesh<...>. Only need to setup quadtree forest
336  this->setup_quadtree_forest();
337  }
338 
339  /// \short Constructor that allows the specification of minimum and maximum
340  /// values of x and y coordinates and periodicity
341  /// Also pass pointer to timestepper (defaults to Steady)
342  RefineableRectangularQuadMesh(const unsigned &nx, const unsigned &ny,
343  const double &xmin, const double &xmax,
344  const double &ymin, const double &ymax,
345  const bool &periodic_in_x,
346  TimeStepper* time_stepper_pt=
348  RectangularQuadMesh<ELEMENT>(nx,ny,xmin,xmax,ymin,ymax,periodic_in_x,time_stepper_pt)
349  {
350  // Nodal positions etc. were created in constructor for
351  // RectangularMesh<...>. Only need to setup quadtree forest
352  this->setup_quadtree_forest();
353  }
354 
355 };
356 
357 
358 //////////////////////////////////////////////////////////////////////////
359 //////////////////////////////////////////////////////////////////////////
360 //////////////////////////////////////////////////////////////////////////
361 
362 
363 
364 //================================================================
365 /// Elastic quad mesh with functionality to
366 /// attach traction elements to the specified boundaries. We "upgrade"
367 /// the RectangularQuadMesh to become an
368 /// SolidMesh and equate the Eulerian and Lagrangian coordinates,
369 /// thus making the domain represented by the mesh the stress-free
370 /// configuration.
371 //================================================================
372 template <class ELEMENT>
374  public virtual RectangularQuadMesh<ELEMENT>,
375  public virtual SolidMesh
376 {
377 
378 
379  public:
380 
381  /// \short Constructor: Build mesh and copy Eulerian coords to Lagrangian
382  /// ones so that the initial configuration is the stress-free one and
383  /// assign boundary coordinates. Origin specifies
384  /// an additional rigid-body displacement.
386  const unsigned& ny,
387  const double& lx,
388  const double& ly,
389  const Vector<double>& origin,
390  TimeStepper* time_stepper_pt=
392  RectangularQuadMesh<ELEMENT>(nx,ny,lx,ly,time_stepper_pt)
393  {
394 
395  //Translate the nodes
396  unsigned nnod=nnode();
397  for (unsigned j=0;j<nnod;j++)
398  {
399  node_pt(j)->x(0)+=origin[0];
400  node_pt(j)->x(1)+=origin[1];
401  }
402 
403  /// Make the current configuration the undeformed one by
404  /// setting the nodal Lagrangian coordinates to their current
405  /// Eulerian ones
406  set_lagrangian_nodal_coordinates();
407 
408  // Setup boundary coordinates
409  set_boundary_coordinates(origin);
410  }
411 
412 
413 
414 
415  /// \short Constructor: Build mesh and copy Eulerian coords to Lagrangian
416  /// ones so that the initial configuration is the stress-free one and
417  /// assign boundary coordinates
419  const unsigned& ny,
420  const double& lx,
421  const double& ly,
422  TimeStepper* time_stepper_pt=
424  RectangularQuadMesh<ELEMENT>(nx,ny,lx,ly,time_stepper_pt)
425  {
426 
427  // No shift
428  Vector<double> origin(2,0.0);
429 
430  /// Make the current configuration the undeformed one by
431  /// setting the nodal Lagrangian coordinates to their current
432  /// Eulerian ones
433  set_lagrangian_nodal_coordinates();
434 
435  // Setup boundary coordinates
436  set_boundary_coordinates(origin);
437  }
438 
439 
440  /// \short Constructor: Build mesh and copy Eulerian coords to Lagrangian
441  /// ones so that the initial configuration is the stress-free one and
442  /// assign boundary coordinates. This includes a boolean flag to specify
443  /// if the mesh is periodic in the x-direction
445  const unsigned& ny,
446  const double& lx,
447  const double& ly,
448  const bool& periodic_in_x,
449  TimeStepper* time_stepper_pt=
451  RectangularQuadMesh<ELEMENT>(nx,ny,lx,ly,periodic_in_x,time_stepper_pt)
452  {
453 
454  // No shift
455  Vector<double> origin(2,0.0);
456 
457  /// Make the current configuration the undeformed one by
458  /// setting the nodal Lagrangian coordinates to their current
459  /// Eulerian ones
460  set_lagrangian_nodal_coordinates();
461 
462  // Setup boundary coordinates
463  set_boundary_coordinates(origin);
464  }
465 
466  private:
467 
468  /// \short Setup the boundary coordinates. Vector
469  /// origin specifies the coordinates of the lower left corner of
470  /// the mesh.
472  {
473 
474  // 1D vector fo boundary coordinate
475  Vector<double> zeta(1);
476 
477  // Loop over boundaries 0 and 2 where xi_0 is the varying
478  // boundary coordinate
479  for (unsigned b=0;b<3;b+=2)
480  {
481  // Number of nodes on those boundaries
482  unsigned n_nod = nboundary_node(b);
483 
484  //Loop over the nodes
485  for(unsigned i=0;i<n_nod;i++)
486  {
487  // Boundary coordinate varies between 0 and L
488  zeta[0]=boundary_node_pt(b,i)->xi(0)-origin[0];
490  }
492  }
493 
494 
495  // Loop over boundaries 1 and 3 where xi_1 is the varying
496  // boundary coordinate
497  for (unsigned b=1;b<4;b+=2)
498  {
499  // Number of nodes on those boundaries
500  unsigned n_nod = nboundary_node(b);
501 
502  //Loop over the nodes
503  for(unsigned i=0;i<n_nod;i++)
504  {
505  // Boundary coordinate varies between +/- H/2
506  zeta[0]=boundary_node_pt(b,i)->xi(1) - origin[1]
507  -0.5*(this->Ymax-this->Ymin);
509  }
511  }
512 
513  }
514 
515 };
516 
517 
518 
519 
520 //////////////////////////////////////////////////////////////////////////
521 //////////////////////////////////////////////////////////////////////////
522 //////////////////////////////////////////////////////////////////////////
523 
524 
525 
526 //================================================================
527 /// Elastic refineable quad mesh with functionality to
528 /// attach traction elements to the specified boundaries. We "upgrade"
529 /// the RefineableRectangularQuadMesh to become an
530 /// SolidMesh and equate the Eulerian and Lagrangian coordinates,
531 /// thus making the domain represented by the mesh the stress-free
532 /// configuration. We also move the mesh "down" by half the
533 /// the "height" so x=0 is located on the centreline -- appropriate
534 /// for the beam-type problems for which this mesh was developed.
535 //================================================================
536 template <class ELEMENT>
538 public virtual ElasticRectangularQuadMesh<ELEMENT>,
539 public RefineableQuadMesh<ELEMENT>
540 {
541 
542  public:
543 
544  /// \short Constructor: Build mesh and copy Eulerian coords to Lagrangian
545  /// ones so that the initial configuration is the stress-free one and
546  /// assign boundary coordinates (variable Lagrangian coordinates along
547  /// the relevant boundaries).
549  const unsigned& ny,
550  const double& lx,
551  const double& ly,
552  TimeStepper* time_stepper_pt=
554  RectangularQuadMesh<ELEMENT>(nx,ny,lx,ly,time_stepper_pt),
555  ElasticRectangularQuadMesh<ELEMENT>(nx,ny,lx,ly,time_stepper_pt)
556 
557  {
558  // Nodal positions etc. were created in base class.
559  // Only need to setup quadtree forest
560  this->setup_quadtree_forest();
561  }
562 
563 
564  /// \short Constructor: Build mesh and copy Eulerian coords to Lagrangian
565  /// ones so that the initial configuration is the stress-free one and
566  /// assign boundary coordinates. This includes a boolean flag to specify
567  /// if the mesh is periodic in the x-direction
569  const unsigned& ny,
570  const double& lx,
571  const double& ly,
572  const bool& periodic_in_x,
573  TimeStepper* time_stepper_pt=
575  RectangularQuadMesh<ELEMENT>(nx,ny,lx,ly,periodic_in_x,time_stepper_pt),
576  ElasticRectangularQuadMesh<ELEMENT>(nx,ny,lx,ly,periodic_in_x,
577  time_stepper_pt)
578  {
579  // Nodal positions etc. were created in base class.
580  // Only need to setup quadtree forest
581  this->setup_quadtree_forest();
582  }
583 
584 
585  /// \short Constructor: Build mesh and copy Eulerian coords to Lagrangian
586  /// ones so that the initial configuration is the stress-free one and
587  /// assign boundary coordinates (variable Lagrangian coordinates along
588  /// the relevant boundaries). Origin specifies an additional rigid-body
589  /// displacement.
591  const unsigned& ny,
592  const double& lx,
593  const double& ly,
594  const Vector<double>& origin,
595  TimeStepper* time_stepper_pt=
597  RectangularQuadMesh<ELEMENT>(nx,ny,lx,ly,time_stepper_pt),
598  ElasticRectangularQuadMesh<ELEMENT>(nx,ny,lx,ly,origin,time_stepper_pt)
599 
600  {
601  // Nodal positions etc. were created in base class.
602  // Only need to setup quadtree forest
603  this->setup_quadtree_forest();
604  }
605 
606 };
607 
608 
609 
610 
611 }
612 
613 #endif
const unsigned & nx() const
Return number of elements in x direction.
virtual void set_coordinates_on_boundary(const unsigned &b, const unsigned &k, const Vector< double > &boundary_zeta)
Set the vector of the k-th generalised boundary coordinates on mesh boundary b. Broken virtual interf...
Definition: nodes.cc:2315
Node *& boundary_node_pt(const unsigned &b, const unsigned &n)
Return pointer to node n on boundary b.
Definition: mesh.h:497
RefineableRectangularQuadMesh(const unsigned &nx, const unsigned &ny, const double &xmin, const double &xmax, const double &ymin, const double &ymax, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
Constructor that allows the specification of minimum and maximum values of x and y coordinates Also p...
static Steady< 0 > Default_TimeStepper
Default Steady Timestepper, to be used in default arguments to Mesh constructors. ...
Definition: mesh.h:85
std::vector< bool > Boundary_coordinate_exists
Vector of boolean data that indicates whether the boundary coordinates have been set for the boundary...
Definition: mesh.h:201
cstr elem_len * i
Definition: cfortran.h:607
virtual double x_spacing_function(unsigned xelement, unsigned xnode, unsigned yelement, unsigned ynode)
Return the value of the x-coordinate at the node given by the local node number (xnode, ynode) in the element (xelement,yelement). The description is in a "psudeo" two-dimensional coordinate system, so the range of xelement is [0,Nx-1], yelement is [0,Ny-1], and that of xnode and ynode is [0,Np-1]. The default is to return nodes that are equally spaced in the x coodinate.
RectangularQuadMesh(const unsigned &nx, const unsigned &ny, const double &lx, const double &ly, const bool &periodic_in_x, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
Simple constructor: nx: number of elements in x direction; ny: number of elements in y direction; lx...
unsigned long nboundary_node(const unsigned &ibound) const
Return number of nodes on a particular boundary.
Definition: mesh.h:809
unsigned Ny
Ny: number of elements in y-direction.
const double x_min() const
Return the minimum value of x coordinate.
virtual double y_spacing_function(unsigned xelement, unsigned xnode, unsigned yelement, unsigned ynode)
Return the value of the y-coordinate at the node given by the local node number (xnode, ynode) in the element (xelement,yelement). The description is in a "psudeo" two-dimensional coordinate system, so the range of xelement is [0,Nx-1], yelement is [0,Ny-1], and that of xnode and ynode is [0,Np-1]. The default it to return nodes that are equally spaced in the y coordinate.
double & x(const unsigned &i)
Return the i-th nodal coordinate.
Definition: nodes.h:995
RefineableRectangularQuadMesh(const unsigned &nx, const unsigned &ny, const double &lx, const double &ly, const bool &periodic_in_x, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
Simple constructor: nx: number of elements in x direction; ny: number of elements in y direction; lx...
RefineableRectangularQuadMesh(const unsigned &nx, const unsigned &ny, const double &lx, const double &ly, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
Simple constructor: nx: number of elements in x direction; ny: number of elements in y direction; lx...
RefineableRectangularQuadMesh(const unsigned &nx, const unsigned &ny, const double &xmin, const double &xmax, const double &ymin, const double &ymax, const bool &periodic_in_x, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
Constructor that allows the specification of minimum and maximum values of x and y coordinates and pe...
const unsigned & ny() const
Return number of elements in y direction.
const double x_max() const
Return the maximum value of x coordinate.
unsigned Nx
Nx: number of elements in x-direction.
RectangularQuadMesh(const unsigned &nx, const unsigned &ny, const double &xmin, const double &xmax, const double &ymin, const double &ymax, const bool &periodic_in_x, const bool &build, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
Constructor that allows the specification of minimum and maximum values of x and y coordinates and do...
unsigned Np
Np: number of (linear) points in the element.
bool Xperiodic
Boolean variable used to determine whether the mesh is periodic in the x-direction.
RectangularQuadMesh(const unsigned &nx, const unsigned &ny, const double &lx, const double &ly, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
Simple constructor: nx: number of elements in x direction; ny: number of elements in y direction; lx...
virtual void element_reorder()
Reorder the elements: By default they are ordered in "horizontal" layers (increasing in x...
Node *& node_pt(const unsigned long &n)
Return pointer to global node n.
Definition: mesh.h:456
void build_mesh(TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
Generic mesh construction function: contains all the hard work.
unsigned long nnode() const
Return number of nodes in the mesh.
Definition: mesh.h:590
General SolidMesh class.
Definition: mesh.h:2213
Base class for quad meshes (meshes made of 2D quad elements).
Definition: quad_mesh.h:61
RectangularQuadMesh(const unsigned &nx, const unsigned &ny, const double &xmin, const double &xmax, const double &ymin, const double &ymax, const bool &periodic_in_x, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
Constructor that allows the specification of minimum and maximum values of x and y coordinates...
const double y_max() const
Return the maximum value of y coordinate.
void set_boundary_coordinates(const Vector< double > &origin)
Setup the boundary coordinates. Vector origin specifies the coordinates of the lower left corner of t...
RectangularQuadMesh(const unsigned &nx, const unsigned &ny, const double &xmin, const double &xmax, const double &ymin, const double &ymax, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
Constructor that allows the specification of minimum and maximum values of x and y coordinates...
double Xmin
Minimum value of x coordinate.
double Ymax
Maximum value of y coordinate.
const double y_min() const
Return the minimum value of y coordinate.
Base class for time-stepping schemes. Timestepper provides an approximation of the temporal derivativ...
Definition: timesteppers.h:219
double Xmax
Maximum value of x coordinate.
double Ymin
Minimum value of y coordinate.