Creating and handling meshesΒΆ

Grids for CRTomo can be created in multiple ways. We now support two ways:

This example only shows the usage of the former approach.

Note

The CRTomo documentation is inconsistent in the use of the terms mesh and grid. Usually, a grid refers to a mesh with regularly spaced node locations in x and z direction. CRTomo also supports triangular meshes, which are still referred to as grids throughout the code and documentation.

The top level crtomo import suffices for most tasks

import crtomo

Create a simple surface grid with this wrapper

grid = crtomo.crt_grid.create_surface_grid(
   nr_electrodes=10,
   spacing=1.5,
)
grid.plot_grid()

# number the electrodes (useful for numerical studies)
grid.plot_grid(plot_electrode_numbers=True)

# save this grid to disc
grid.save_elem_file('elem.dat')
grid.save_elec_file('elec.dat')
  • plot grid1
  • plot grid1
This grid was sorted using CutMcK. The nodes were resorted!
Triangular grid found

The mesh can be read from disk:

grid1 = crtomo.crt_grid('elem.dat', 'elec.dat')
print(grid1)
grid1.plot_grid()
plot grid1
This grid was sorted using CutMcK. The nodes were resorted!
Triangular grid found
CRMod/CTRomo grid instance
number of elements: 1332
number of nodes: 722
number of electrodes: 10
grid dimsensions:
X: -3.375 16.875
Z: -6.75 0.0

Create a grid with layering

grid = crtomo.crt_grid.create_surface_grid(
    nr_electrodes=10,
    spacing=1.5,
    lines=[0.5, 1],
)
print(grid)
grid.plot_grid()
plot grid1
[[-3.375 -1.    11.   ]
 [-3.375 -0.5   11.   ]]
[[16.875 -0.5   11.   ]
 [16.875 -1.    11.   ]]
This grid was sorted using CutMcK. The nodes were resorted!
Triangular grid found
CRMod/CTRomo grid instance
number of elements: 1428
number of nodes: 770
number of electrodes: 10
grid dimsensions:
X: -3.375 16.875
Z: -6.75 0.0

Gallery generated by Sphinx-Gallery