Medium

Package: kwave.toolbox Superclasses: kwave.toolbox.GridInput

Class used to define the spatial distribution of material types using indices from a kwave.toolbox.Materials object, and a grid from a kwave.toolbox.Grid object.

Syntax

medium = Medium(kgrid, materials);

Description

The Medium class defines the material properties by specifying, at each grid point, an integer material identifier.

All material properties, sound speed, density, etc. are stored in a separate kwave.toolbox.Materials object. Each material in a Materials object is assigned a unique uint8 index in the range [0, 255].

The materialIndexGrid property is a uint8 array with the same size as the computational grid defined by the input kwave.toolbox.Grid object. Each element specifies which material is present at that point. The Medium object maps these material indices to the corresponding material properties using the lookup table in the Materials object.

All grid-valued medium properties (listed below) are registered as GridInput virtual properties. This means: * Reading medium.prop returns the *unpadded map. * A hidden **padded * backing store medium.propPadded is created automatically and used internally by solvers when required.

Properties

  • materialIndexGrid — A uint8 array with the same size as the grid. Each element stores a material index referring to an entry in the associated kwave.toolbox.Materials object.

Grid-valued virtual properties (unpadded by default, padded versions available internally as ...Padded):

  • soundSpeed — [m/s]
  • density — [kg/m^3]
  • absorptionCoeff — power‑law absorption prefactor [dB/cm/MHz^y]
  • absorptionPowerMap — power‑law exponent y [dimensionless]
  • BonA — nonlinearity parameter B/A [dimensionless]
  • specificHeat — specific heat capacity [J/(kg·K)]
  • thermalConductivity — thermal conductivity [W/(m·K)]

Scalar properties (user-settable; default computed on first map build):

  • referenceSoundSpeed — scalar. Default = max(soundSpeed(:))
  • referenceDiffusion — scalar. Default = max(thermalConductivity ./ ... (density .* specificHeat))

These are set automatically the first time the derived maps are built (e.g., when materialIndexGrid is first assigned). If the user later assigns a value to either scalar, that value is preserved on subsequent updates to the maps (i.e., not auto-overwritten).

Note: The acoustic solver uses the single scalar value absorptionPower at all voxels (algorithmic constraint).

See Also

  • Grid
  • Materials