executing-plans
executing-plans
Use when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available
discretizeCreate finite-volume meshes and discrete differential operators with discretize. Use for TensorMesh or TreeMesh geometry, cell/face/edge ordering, divergence, interpolation and meshes supporting SimPEG; use a physics solver for inversion itself.
Independent GitHub snapshot · Automated classification · Original documentation governs
Construct the mesh and location-aware operators before attaching physical data. The library does not determine the CRS or the physical units of its coordinates.
Use TensorMesh for separable rectangular grids; choose TreeMesh when local
refinement substantially reduces cost. Finalize a tree before using its operators.
Pad model boundaries and refine sources, receivers and property contrasts as
required by the forward problem, then test domain and resolution sensitivity.
Record axis meanings, origin, units, cell widths and active-cell mask. In a 2D
vertical section the second coordinate can mean elevation, but this is a project
convention. A vector of length n_cells is not a face or edge vector.
The synthetic velocity field is u = (2x, -3y) per second. Its divergence is -1 s⁻¹, including on this nonuniform mesh. Boundary fluxes are represented at their actual face locations; no zero boundary condition is imposed implicitly.
# example: nonuniform-divergence
import numpy as np
from discretize import TensorMesh
mesh = TensorMesh([[1.0, 2.0, 3.0], [2.0, 4.0]], origin=[0.0, 0.0])
face_velocity_m_s = np.r_[2 * mesh.faces_x[:, 0], -3 * mesh.faces_y[:, 1]]
divergence_s_inv = mesh.face_divergence @ face_velocity_m_s
integrated_divergence_m2_s = np.dot(mesh.cell_volumes, divergence_s_inv)
The rectangular area is 36 m², so the area-integrated divergence and outward
boundary flux are both -36 m²/s. In 2D, cell_volumes are cell areas.
cell_centers, faces_x, faces_y and the operator shape. Keep cell,
face, node and edge quantities distinct when interpolating or plotting.See the operator tutorials and API for the chosen mesh.