Version:

Layered Meshing 03: Meshing complex geophysical domains

The new "layered meshing" interface in Salvus allows us to declaratively build meshes for complex multi-layered domains. In this example we'll give an overview of how it can be used to create a mesh for a chunk of Monterey bay which includes topography, bathymetry, thin near-surface layers, and the ocean itself. We'll also use this opportunity to give a refresher on the different "policy" types, and how they interact to form our final mesh. Let's get started!
As always, the first step is to import the Salvus Python environment. Here we'll add an extra import to the canonical Salvus namespace to bring the layered meshing API into scope.
Copy
import pathlib

import numpy as np
import sympy
import xarray as xr

import salvus.namespace as sn

Selecting our domain

As outlined in the 3D Surface Topography tutorial, the first thing we want to do when working with areas of Earth's surface is to define our domain. We'll be working in UTM coordinates, and a convenient way to handle coordinate conversions is to use the specialized UtmDomain.from_spherical_chunk constructor that takes WGS84 coordinates and converts them to an appropriate UTM domain. The UTM zone and coordinates could of course also be specified directly.
We choose a small box around Monterey, California, as below.
# Define our domain.
d = sn.domain.dim3.UtmDomain.from_spherical_chunk(
    min_latitude=36.7,
    max_latitude=36.5,
    min_longitude=-122.5,
    max_longitude=-121.8,
)

# Have a look at the domain to make sure it is correct.
d.plot()