def velocity(self, velocity: u.m / u.s):
"""Defines the velocity throughout the simulation, and automatically
updates the momentum based on the current density values.
Parameters
----------
velocity : ndarray
Array of velocity vectors with shape (3, x, [y, z]) where x, y and
z are the spatial grid sizes of the simulation.
Note that a full 3D vector is required even if the simulation is
run for fewer than 3 dimensions.
Must have units of velocity.
"""
assert velocity.shape == (3, *self.domain_shape), """Specified velocity
array shape does not match simulation grid."""
self.momentum = velocity * self.density
评论列表
文章目录