simple_cubic_mesh.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-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_SIMPLE_CUBIC_MESH_HEADER
27#define OOMPH_SIMPLE_CUBIC_MESH_HEADER
28
29// Config header
30#ifdef HAVE_CONFIG_H
31#include <oomph-lib-config.h>
32#endif
33
34// Include the OOMPH-LIB header files
35#include "generic/mesh.h"
36#include "generic/matrices.h"
37#include "generic/brick_mesh.h"
39
40namespace oomph
41{
42 //=======================================================================
43 /// Simple cubic 3D Brick mesh class.
44 //=======================================================================
45 template<class ELEMENT>
46 class SimpleCubicMesh : public virtual BrickMeshBase
47 {
48 public:
49 /// Constructor: Pass number of elements in the x, y, and z
50 /// directions, and the corresponding dimensions. Assume that the back lower
51 /// left corner is located at (0,0,0) Timestepper defaults to Steady.
52 SimpleCubicMesh(const unsigned& nx,
53 const unsigned& ny,
54 const unsigned& nz,
55 const double& lx,
56 const double& ly,
57 const double& lz,
58 TimeStepper* time_stepper_pt = &Mesh::Default_TimeStepper)
59 : Nx(nx),
60 Ny(ny),
61 Nz(nz),
62 Xmin(0.0),
63 Xmax(lx),
64 Ymin(0.0),
65 Ymax(ly),
66 Zmin(0.0),
67 Zmax(lz)
68 {
69 // Mesh can only be built with 3D Qelements.
70 MeshChecker::assert_geometric_element<QElementGeometricBase, ELEMENT>(3);
71
72 // Call the generic build function
73 build_mesh(time_stepper_pt);
74 }
75
76 /// Constructor: Pass the number of elements in the x,y and z
77 /// directions and the correspoding minimum and maximum values of the
78 /// coordinates in each direction
79 SimpleCubicMesh(const unsigned& nx,
80 const unsigned& ny,
81 const unsigned& nz,
82 const double& xmin,
83 const double& xmax,
84 const double& ymin,
85 const double& ymax,
86 const double& zmin,
87 const double& zmax,
88 TimeStepper* time_stepper_pt = &Mesh::Default_TimeStepper)
89 : Nx(nx),
90 Ny(ny),
91 Nz(nz),
92 Xmin(xmin),
93 Xmax(xmax),
94 Ymin(ymin),
95 Ymax(ymax),
96 Zmin(zmin),
97 Zmax(zmax)
98 {
99 // Mesh can only be built with 3D Qelements.
100 MeshChecker::assert_geometric_element<QElementGeometricBase, ELEMENT>(3);
101
102 // Call the generic mesh constructor
103 build_mesh(time_stepper_pt);
104 }
105
106 /// Access function for number of elements in x directions
107 const unsigned& nx() const
108 {
109 return Nx;
110 }
111
112 /// Access function for number of elements in y directions
113 const unsigned& ny() const
114 {
115 return Ny;
116 }
117
118 /// Access function for number of elements in y directions
119 const unsigned& nz() const
120 {
121 return Nz;
122 }
123
124 protected:
125 /// Number of elements in x direction
126 unsigned Nx;
127
128 /// Number of elements in y direction
129 unsigned Ny;
130
131 /// Number of elements in y direction
132 unsigned Nz;
133
134 /// Minimum value of x coordinate
135 double Xmin;
136
137 /// Maximum value of x coordinate
138 double Xmax;
139
140 /// Minimum value of y coordinate
141 double Ymin;
142
143 /// Minimum value of y coordinate
144 double Ymax;
145
146 /// Minimum value of z coordinate
147 double Zmin;
148
149 /// Maximum value of z coordinate
150 double Zmax;
151
152 /// Generic mesh construction function: contains all the hard work
153 void build_mesh(TimeStepper* time_stepper_pt = &Mesh::Default_TimeStepper);
154 };
155
156
157 ////////////////////////////////////////////////////////////////////////////
158 ////////////////////////////////////////////////////////////////////////////
159 ////////////////////////////////////////////////////////////////////////////
160
161 //=======================================================================
162 /// Refineable version of simple cubic 3D Brick mesh class.
163 //=======================================================================
164 template<class ELEMENT>
165 class RefineableSimpleCubicMesh : public virtual SimpleCubicMesh<ELEMENT>,
166 public virtual RefineableBrickMesh<ELEMENT>
167 {
168 public:
169 /// Constructor: Pass number of elements in the x, y, and z
170 /// directions, and the corresponding dimensions. Assume that the back lower
171 /// left corner is located at (0,0,0) Timestepper defaults to Steady.
173 const unsigned& nx,
174 const unsigned& ny,
175 const unsigned& nz,
176 const double& lx,
177 const double& ly,
178 const double& lz,
179 TimeStepper* time_stepper_pt = &Mesh::Default_TimeStepper)
180 : SimpleCubicMesh<ELEMENT>(nx, ny, nz, lx, ly, lz, time_stepper_pt)
181 {
182 // Nodal positions etc. were created in constructor for
183 // base class Only need to setup octree forest
184 this->setup_octree_forest();
185 }
186
187
188 /// Constructor: Pass the number of elements in the x,y and z
189 /// directions and the correspoding minimum and maximum values of the
190 /// coordinates in each direction.
192 const unsigned& nx,
193 const unsigned& ny,
194 const unsigned& nz,
195 const double& xmin,
196 const double& xmax,
197 const double& ymin,
198 const double& ymax,
199 const double& zmin,
200 const double& zmax,
201 TimeStepper* time_stepper_pt = &Mesh::Default_TimeStepper)
202 : SimpleCubicMesh<ELEMENT>(
203 nx, ny, nz, xmin, xmax, ymin, ymax, zmin, zmax, time_stepper_pt)
204 {
205 // Nodal positions etc. were created in constructor for
206 // base class Only need to setup octree forest
207 this->setup_octree_forest();
208 }
209 };
210
211} // namespace oomph
212
214#endif
Base class for brick meshes (meshes made of 3D brick elements).
Definition brick_mesh.h:178
static Steady< 0 > Default_TimeStepper
Default Steady Timestepper, to be used in default arguments to Mesh constructors.
Definition mesh.h:75
Intermediate mesh class that implements the mesh adaptation functions specified in the TreeBasedRefin...
void setup_octree_forest()
Do what it says...
Refineable version of simple cubic 3D Brick mesh class.
RefineableSimpleCubicMesh(const unsigned &nx, const unsigned &ny, const unsigned &nz, const double &xmin, const double &xmax, const double &ymin, const double &ymax, const double &zmin, const double &zmax, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
Constructor: Pass the number of elements in the x,y and z directions and the correspoding minimum and...
RefineableSimpleCubicMesh(const unsigned &nx, const unsigned &ny, const unsigned &nz, const double &lx, const double &ly, const double &lz, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
Constructor: Pass number of elements in the x, y, and z directions, and the corresponding dimensions....
Simple cubic 3D Brick mesh class.
unsigned Ny
Number of elements in y direction.
const unsigned & nx() const
Access function for number of elements in x directions.
SimpleCubicMesh(const unsigned &nx, const unsigned &ny, const unsigned &nz, const double &xmin, const double &xmax, const double &ymin, const double &ymax, const double &zmin, const double &zmax, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
Constructor: Pass the number of elements in the x,y and z directions and the correspoding minimum and...
const unsigned & nz() const
Access function for number of elements in y directions.
unsigned Nz
Number of elements in y direction.
SimpleCubicMesh(const unsigned &nx, const unsigned &ny, const unsigned &nz, const double &lx, const double &ly, const double &lz, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
Constructor: Pass number of elements in the x, y, and z directions, and the corresponding dimensions....
double Ymax
Minimum value of y coordinate.
double Ymin
Minimum value of y coordinate.
const unsigned & ny() const
Access function for number of elements in y directions.
unsigned Nx
Number of elements in x direction.
double Xmin
Minimum value of x coordinate.
void build_mesh(TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
Generic mesh construction function: contains all the hard work.
double Zmax
Maximum value of z coordinate.
double Zmin
Minimum value of z coordinate.
double Xmax
Maximum value of x coordinate.
TAdvectionDiffusionReactionElement<NREAGENT,DIM,NNODE_1D> elements are isoparametric triangular DIM-d...
Base class for time-stepping schemes. Timestepper provides an approximation of the temporal derivativ...
DRAIG: Change all instances of (SPATIAL_DIM) to (DIM-1).