plasma.py 文件源码

python
阅读 30 收藏 0 点赞 0 评论 0

项目:Codes 作者: SP2RC-Coding-Club 项目源码 文件源码
def __init__(self, domain_x, domain_y, domain_z, gamma=5/3):
        # Define domain sizes
        self.x = domain_x
        self.y = domain_y
        self.z = domain_z

        x, y, z = self.x.si.value, self.y.si.value, self.z.si.value
        self.grid = np.meshgrid(x, y, z, indexing='ij') * u.m
        self.grid = np.squeeze(self.grid)
        self.domain_shape = []
        for length in (len(x), len(y), len(z)):
            if length > 1:
                self.domain_shape.append(length)
        self.domain_shape = tuple(self.domain_shape)
        print(self.domain_shape)
        self.gamma = gamma

        # Initiate core plasma variables
        self._density = np.zeros(self.domain_shape) * u.kg / u.m**3
        self._momentum = np.zeros((3, *self.domain_shape)) * u.kg \
            / (u.m**2 * u.s)
        self._energy = np.zeros(self.domain_shape) * u.J / u.m**3
        self._magnetic_field = np.zeros((3, *self.domain_shape)) * u.T

        # Collect core variables into a list for usefulness
        self.core_variables

        # Connect a simulation object for simulating
        self.simulation_physics = MHDSimulation(self)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号