How Can I Define the Simulation Grid?

How Can I Define the Simulation Grid?#

Date

Category

2025-08-26 10:06:59

Charge

There are two classes available for defining the grid specification:

  • UniformUnstructuredGrid:

    • This class implements a simple uniform unstructured grid, with the grid size defined by the dl argument. For an application example, see this example.

heat_grid = UniformUnstructuredGrid(dl=0.1)
  • DistanceUnstructuredGrid:

    • This class specifies the mesh size based on the distance from material interfaces. The finer grid near interfaces is defined by the dl_interface argument, while the coarser bulk grid size is set using dl_bulk. The distances over which dl_interface and dl_bulk are enforced can be controlled with the distance_interface and distance_bulk arguments, respectively. For an application example, see this example notebook.

heat_grid = DistanceUnstructuredGrid(
     dl_interface=0.1,
     dl_bulk=1,
     distance_interface=0.3,
     distance_bulk=2,
 )

The user can also add refinement regions to enforce a minimum grid size in a given region using the GridRefinementRegion object, or along a line using the GridRefinementLine object. An example of this can be found in our charge solver example.