jax_sn.domain.domain_generation module

create_cartesian_setup(dimension: int, region_size_res: List[List[Tuple]], cross_sections_regions: List[CrossSectionData], source_regions: List[float], inhomogeneity_direction: int)[source]

Convenience function to create a Cartesian mesh with layered cross sections and sources. This is not necessarily a differentiable function and is therefore not intended to be used in optimization. Mainly for testing purposes.

Parameters:
  • dimension (int) – The spatial dimension of the domain (1, 2, or 3).

  • region_size_res (List[List[Tuple]]) – A list of lists specifying the size and resolution of each region in each dimension. Each inner list corresponds to a dimension and contains tuples of (size, resolution) for each region in that dimension.

  • cross_sections_regions (List[CrossSectionData]) – A list of cross section values for each region in the inhomogeneity direction.

  • source_regions (List[float]) – A list of source values for each region in the inhomogeneity direction.

  • inhomogeneity_direction (int) – The dimension index (0-indexed) along which the cross sections and sources vary.

Returns:

  • vertices (jnp.ndarray) – The vertices of the Cartesian mesh.

  • connectivity (jnp.ndarray) – The connectivity of the Cartesian mesh.

  • layered_cross_section (jnp.ndarray) – The cross section values for each element in the mesh.

  • layered_source (jnp.ndarray) – The source values for each element in the mesh.