discretize.tests.setup_mesh#

discretize.tests.setup_mesh(mesh_type, nC, nDim, random_seed=None)[source]#

Generate arbitrary mesh for testing.

For the mesh type, number of cells along each axis and dimension specified, setup_mesh will construct a random mesh that can be used for testing. By design, the domain width is 1 along each axis direction.

Parameters:
mesh_typestr

Defines the mesh type. Must be one of {‘uniformTensorMesh’, ‘randomTensorMesh’, ‘uniformCylindricalMesh’, ‘randomCylindricalMesh’, ‘uniformTree’, ‘randomTree’, ‘uniformCurv’, ‘rotateCurv’, ‘sphereCurv’}

nCint

Number of cells along each axis. If mesh_type is ‘Tree’, then nC defines the number of base mesh cells and must be a power of 2.

nDimint

The dimension of the mesh. Must be 1, 2 or 3.

random_seednumpy.random.Generator, int, optional

If random is in mesh_type, this is the random number generator to use for creating that random mesh. If an integer or None it is used to seed a new numpy.random.default_rng.

Returns:
discretize.base.BaseMesh

A discretize mesh of class specified by the input argument mesh_type