acc2_test.py 文件源码

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

项目:veros 作者: dionhaefner 项目源码 文件源码
def set_initial_conditions(self):
        m = self.main_module

        # initial conditions
        m.temp[:, :, :, 0:2] = ((1 - m.zt[None, None, :] / m.zw[0]) * 15 * m.maskT)[..., None]
        m.salt[:, :, :, 0:2] = 35.0 * m.maskT[..., None]

        # wind stress forcing
        taux = np.zeros(m.ny + 1, dtype=self.default_float_type)
        yt = m.yt[2:m.ny + 3]
        taux = (.1e-3 * np.sin(np.pi * (m.yu[2:m.ny + 3] - yu_start) / (-20.0 - yt_start))) * (yt < -20) \
            + (.1e-3 * (1 - np.cos(2 * np.pi *
                                   (m.yu[2:m.ny + 3] - 10.0) / (yu_end - 10.0)))) * (yt > 10)
        m.surface_taux[:, 2:m.ny + 3] = taux * m.maskU[:, 2:m.ny + 3, -1]

        # surface heatflux forcing
        self.t_star = 15 * np.invert((m.yt < -20) | (m.yt > 20)) \
            + 15 * (m.yt - yt_start) / (-20 - yt_start) * (m.yt < -20) \
            + 15 * (1 - (m.yt - 20) / (yt_end - 20)) * (m.yt > 20.)
        self.t_rest = m.dzt[None, -1] / (30. * 86400.) * m.maskT[:, :, -1]

        t = self.tke_module
        if t.enable_tke:
            t.forc_tke_surface[2:-2, 2:-2] = np.sqrt((0.5 * (m.surface_taux[2:-2, 2:-2] + m.surface_taux[1:-3, 2:-2]))**2
                                                     + (0.5 * (m.surface_tauy[2:-2, 2:-2] + m.surface_tauy[2:-2, 1:-3]))**2)**(1.5)

        i = self.idemix_module
        if i.enable_idemix:
            i.forc_iw_bottom[:] = 1.0e-6 * m.maskW[:, :, -1]
            i.forc_iw_surface[:] = 0.1e-6 * m.maskW[:, :, -1]
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号