Esempio n. 1
0
 def setUp(self):
     lbnz.bind(RegularGrid(
         basis='lng,lat,alt',
         L=51, W=51, H=51,
         east=119.0, west=114.0,
         north=42.3, south=37.3,
         upper=16000.0, lower=0.0
     ), r0=6371000)
     lbnz.use('theta,phi,r')
     lbnz.use('thetaphir')
Esempio n. 2
0
    def __init__(self, grid):
        self.default_device = -1
        self.grid = grid
        lbnz.use('theta,phi,r')

        self.thx = -th.sin(lbnz.theta)
        self.thy = th.cos(lbnz.theta)
        self.thz = -lbnz.zero

        self.phx = -th.sin(lbnz.phi) * th.cos(lbnz.theta)
        self.phy = -th.sin(lbnz.phi) * th.sin(lbnz.theta)
        self.phz = th.cos(lbnz.phi)

        self.rx = th.cos(lbnz.phi) * th.cos(lbnz.theta)
        self.ry = th.cos(lbnz.phi) * th.sin(lbnz.theta)
        self.rz = th.sin(lbnz.phi)
Esempio n. 3
0
    def __init__(self, **kwargs):
        self.default_device = -1

        if lbnz._grid_.basis == 'theta,phi,r':
            self.dL1 = lbnz.r * th.cos(lbnz.phi) * lbnz.dtheta
            self.dL2 = lbnz.r * lbnz.dphi
            self.dL3 = lbnz.dr
        if lbnz._grid_.basis == 'x,y,z':
            self.dL1 = lbnz.dx
            self.dL2 = lbnz.dy
            self.dL3 = lbnz.dz
        if lbnz._grid_.basis == 'lng,lat,alt':
            lbnz.use('theta,phi,r', **kwargs)
            self.dL1 = lbnz.r * th.cos(lbnz.phi) * lbnz.dtheta
            self.dL2 = lbnz.r * lbnz.dphi
            self.dL3 = lbnz.dr

        self.dS3 = self.dL1 * self.dL2
        self.dS1 = self.dL3 * self.dL2
        self.dS2 = self.dL3 * self.dL1

        self.dVol = self.dL1 * self.dL2 * self.dL3
Esempio n. 4
0
 def setUp(self):
     lbnz.bind(
         RegularGrid(basis='x,y,z',
                     L=51,
                     W=51,
                     H=51,
                     east=6.0,
                     west=1.0,
                     north=6.0,
                     south=1.0,
                     upper=6.0,
                     lower=1.0))
     lbnz.use('xyz')
     lbnz.use('theta,phi,r')
     lbnz.use('thetaphir')
if __name__ == '__main__':
    from leibniz.core3d.gridsys.regular3 import RegularGrid

    lbnz.bind(
        RegularGrid(basis='x,y,z',
                    W=51,
                    L=51,
                    H=15,
                    east=16.0,
                    west=-16.0,
                    north=16.0,
                    south=-16.0,
                    upper=6.0,
                    lower=1.0))
    lbnz.use('x,y,z')

    dt = 1 / 120
    t_iter = 1000

    init = th.exp(-(((lbnz.x - 1) * 2)**2 + ((lbnz.y - 1) * 2)**2))  # Gaussian

    r = th.sqrt(lbnz.x**2 + lbnz.y**2)
    theta = th.atan2(lbnz.y, lbnz.x)
    wind = -r * th.sin(theta), r * th.cos(theta), lbnz.zero

    def derivitive(t, clouds):
        return -lbnz.upwind(wind, clouds)

    pred = odeint(derivitive, init, th.arange(0, 8, 1 / 200), method='rk4')
    sequence = [
Esempio n. 6
0
 def __init__(self, grid):
     self.grid = grid
     self.default_device = -1
     iza.use('x,y,z')