get_hx_h0

emg3d.meshes.get_hx_h0(freq, res, domain, fixed=0.0, possible_nx=None, min_width=None, pps=3, alpha=None, max_domain=100000.0, raise_error=True, verb=1, return_info=False)[source]

Return cell widths and origin for given parameters.

Returns cell widths for the provided frequency, resistivity, domain extent, and other parameters using a flexible amount of cells. See input parameters for more details. A maximum of three hard/fixed boundaries can be provided (one of which is the grid center).

The minimum cell width is computed through \(\delta/\rm{pps}\), where the skin depth is given by \(\delta = 503.3 \sqrt{\rho/f}\), and the parameter pps stands for ‘points-per-skindepth’. The minimum cell width can be restricted with the parameter min_width.

The actual computation domain adds a buffer zone around the (survey) domain. The thickness of the buffer is six times the skin depth. The field is basically zero after two wavelengths. A wavelength is \(2\pi\delta\), hence roughly 6 times the skin depth. Taking a factor 6 gives therefore almost two wavelengths, as the field travels to the boundary and back. The actual buffer thickness can be steered with the res parameter.

One has to take into account that the air is very resistive, which has to be considered not just in the vertical direction, but also in the horizontal directions, as the airwave will bounce back from the sides otherwise. In the marine case this issue reduces with increasing water depth.

Parameters:
freq : float

Frequency (Hz) to compute the skin depth. The skin depth is a concept defined in the frequency domain. If a negative frequency is provided, it is assumed that the computation is carried out in the Laplace domain. To compute the skin depth, the value of freq is then multiplied by \(-2\pi\), to simulate the closest frequency-equivalent.

res : float or list

Resistivity (Ohm m) to compute the skin depth. The skin depth is used to compute the minimum cell width and the boundary thicknesses. Up to three resistivities can be provided:

  • float: Same resistivity for everything;
  • [min_width, boundaries];
  • [min_width, left boundary, right boundary].
domain : list

Contains the survey-domain limits [min, max]. The actual computation domain consists of this domain plus a buffer zone around it, which depends on frequency and resistivity.

fixed : list, optional

Fixed boundaries, one, two, or maximum three values. The grid is centered around the first value. Hence it is the center location with the smallest cell. Two more fixed boundaries can be added, at most one on each side of the first one. Default is 0.

possible_nx : list, optional

List of possible numbers of cells. See good_mg_cell_nr(). Default is good_mg_cell_nr(1024, 5, 3), which corresponds to numbers 16, 24, 32, 40, 48, 64, 80, 96, 128, 160, 192, 256, 320, 384, 512, 640, 768, 1024.

min_width : float, list or None, optional

Minimum cell width restriction:

  • None : No restriction;
  • float : Fixed to this value, ignoring skin depth and pps.
  • list [min, max] : Lower and upper bounds.

Default is None.

pps : int, optional

Points per skindepth; minimum cell width is computed via dmin = skindepth/pps. Default = 3.

alpha : list, optional

Maximum alpha and step size to find a good alpha. The first value is the maximum alpha of the survey domain, the second value is the maximum alpha for the buffer zone, and the third value is the step size. Default = [1, 1.5, .01], hence no stretching within the survey domain and a maximum stretching of 1.5 in the buffer zone; step size is 0.01.

max_domain : float, optional

Maximum computation domain from fixed[0] (usually source position). Default is 100,000.

raise_error : bool, optional

If True, an error is raised if no suitable grid is found. Otherwise it just prints a message and returns None’s. Default is True.

verb : int, optional

Verbosity, 0 or 1. Default = 1.

return_info : bool

If True, a dictionary is returned with some grid info (min and max cell width and alpha).

Returns:
hx : ndarray

Cell widths of mesh.

x0 : float

Origin of the mesh.

info : dict

Dictionary with mesh info; only if return_info=True.

Keys:

  • dmin: Minimum cell width;
  • dmax: Maximum cell width;
  • amin: Minimum alpha;
  • amax: Maximum alpha.

See also

get_stretched_h
Get hx for a fixed number nx and within a fixed domain.