def magnetic_field(self, magnetic_field: u.Tesla):
"""
Sets the simulation's magnetic field profile to the specified array.
Other arrays which depend on the magnetic field, such as the magnetic
pressure, are then redefined automatically.
Parameters
----------
magnetic_field : ndarray
Array of magnetic field values. Shape must be (3, x, [y, z]),
where x, y, and z are the grid sizes of the simulation in the x, y,
and z dimensions.
Note that a full 3D vector is necessary even if the simulation has
fewer than 3 dimensions.
"""
assert magnetic_field.shape == (3, *self.domain_shape), """
Specified density array shape {} does not match simulation grid {}.
""".format(magnetic_field.shape, (3, *self.domain_shape))
self._magnetic_field = magnetic_field
评论列表
文章目录