Пример #1
0
 def setUp(self):
     self.m =  CoupledModel.Model(use_filter=False,nu4=1e14,nu4w=0.)
     self.m.tmax = 10*self.m.dt
     k, l  = 2*np.pi*5/self.m.L, 2*np.pi*9/self.m.L
     self.qi = np.sin(k*self.m.x + l*self.m.y)
     self.m.set_q(self.qi)
     self.m.set_phi(self.qi*0)
Пример #2
0
    def setUp(self):
        U0 = 0.05
        self.m = CoupledModel.Model(use_filter=False, U=-U0, tdiags=1)

        k0 = 10 * (2 * np.pi / self.m.L)
        q = ic.LambDipole(self.m, U=U0, R=2 * np.pi / k0)
        phi = (np.ones_like(q) + 1j) * 5 * U0 / np.sqrt(2)

        self.m.set_q(q)
        self.m.set_phi(phi)

        self.m.run()
Пример #3
0
#dt = .0025*Te
dt = .001 * Te
tmax = 10 * Te

## setup model class
model = Model.Model(L=L,
                    nx=nx,
                    tmax=tmax,
                    dt=dt,
                    m=m,
                    N=N,
                    f=f0,
                    twrite=int(0.1 * Te / dt),
                    nu4=nu4,
                    nu4w=nu4w,
                    nu=0,
                    nuw=0,
                    mu=0,
                    muw=0,
                    use_filter=False,
                    U=0,
                    tdiags=10,
                    save_to_disk=True,
                    tsave_snapshots=100,
                    path=patho,
                    use_mkl=True,
                    nthreads=2)

#model = Model.Model(L=L,nx=nx, tmax = tmax,dt = dt,
#                twrite=int(0.1*Te/dt),
#                nu4=nu4, use_filter=True,
#                U =0, tdiags=10,
Пример #4
0
 def setUp(self):
     self.m = CoupledModel.Model(use_filter=False)
     self.qi = randn(self.m.ny, self.m.nx)
     self.phii = randn(self.m.ny,
                       self.m.nx) + 1j * randn(self.m.ny, self.m.nx)
def Run_CoupledModel(lambdaz=400):
    """ Run the model given vertical wavelength m, which the dispersivity, and
        fixed initial NIW velocity """

    Uw = 0.1
    m = 2 * np.pi / lambdaz
    patho = "outputs/decaying_turbulence/parameter_exploration/"
    patho_qgniw = patho + "Uw" + str(
        round(Uw * 10) / 10) + "/lambdaz" + str(lambdaz) + "/"

    dt = .0025 * Te / 2
    tmax = 150 * Te

    # choose nu4w based on vertical wavelength

    if lambdaz <= 200:
        nu4w_ = nu4w / 10
    if lambdaz <= 285:
        nu4w_ = nu4w / 5.
    elif lambdaz <= 400:
        nu4w_ = nu4w
    elif lambdaz <= 600:
        nu4w_ = 5 * nu4w
    elif lambdaz <= 800:
        nu4w_ = 10 * nu4w
    else:
        nu4w_ = nu4w

    model = CoupledModel.Model(
        L=L,
        nx=nx,
        tmax=tmax,
        dt=dt,
        m=m,
        N=N,
        f=f0,
        twrite=int(0.1 * Te / dt),
        nu4=nu4,
        nu4w=nu4w_,
        nu=0,
        nuw=0,
        mu=0,
        muw=0,
        use_filter=False,
        U=0.,
        tdiags=10,
        save_to_disk=True,
        tsave_snapshots=25,
        path=patho_qgniw,
    )

    ## initial conditions
    model.set_q(q)
    phi = (np.ones_like(q) + 1j) * Uw / np.sqrt(2)
    model.set_phi(phi)

    # save parameters
    SaveParams(model=model, patho=patho_qgniw, m=m, Uw=Uw)

    # run the model
    model.run()
Пример #6
0
# simulation parameters
dt = .0025 * Te
tmax = 0.75 * Te

## setup model class
model = Model.Model(L=L,
                    nx=nx,
                    tmax=tmax,
                    dt=dt,
                    m=m,
                    N=N,
                    f=f0,
                    twrite=int(0.1 * Te / dt),
                    nu4=nu4 * 0,
                    nu4w=nu4w * 0,
                    nu=0,
                    nuw=0,
                    mu=0,
                    muw=0,
                    use_filter=True,
                    U=-Ue,
                    tdiags=10,
                    save_to_disk=True,
                    tsave_snapshots=25,
                    path=patho)

# a quasi-straining flow
psi = -np.sin(2 * np.pi * model.x / model.L) * np.sin(
    2 * np.pi * model.y / model.L)
psi_hat = np.fft.fft2(psi)
q = np.fft.ifft2(-model.wv2 * psi_hat).real / (Ue * ke)
#
## initial conditions
#q = ic.McWilliams1984(qgmodel, E=(Ue**2)/2,k0=ke)
#qgmodel.set_q(q)
#
#qgmodel.run()

dt = .0025*Te
tmax = 150*Te

#
# setup model classes
#

coupledmodel = CoupledModel.Model(L=L,nx=nx, tmax = tmax,dt = dt,
                m=m,N=N,f=f0, twrite=int(0.1*Te/dt),
                nu4=nu4,nu4w=nu4w,nu=0, nuw=0, mu=0, muw=0, use_filter=False,
                U = 0., tdiags=10, save_to_disk=True,tsave_snapshots=25, path=patho+"coupled/",)

coupledmodel.logger.info(" ")

#
# initial conditions
#
qinit = np.load("q_init_512.npz")
q = qinit['q']
phi = (np.ones_like(q) + 1j)*Uw/np.sqrt(2)

#model.set_q(qgmodel.q)
coupledmodel.set_q(q)
coupledmodel.set_phi(phi)
Пример #8
0
 def setUp(self):
     self.m =  CoupledModel.Model(use_filter=False)
     k, l  = 2*np.pi*5/self.m.L, 2*np.pi*9/self.m.L
     self.m.set_q(np.sin(k*self.m.x + l*self.m.y))
     self.m.set_phi(np.sin(k*self.m.x + l*self.m.y))
Пример #9
0
Te = (U0 * k0)**-1  # eddy turn-over time scale
Tf = 2 * np.pi / f0

dt = .025 * Te
tmax = 10 * Te
m = Model.Model(
    L=L,
    nx=nx,
    tmax=tmax,
    dt=dt,
    m=m,
    N=N,
    f=f0,
    twrite=int(1 * Tf / dt),
    nu4=5e11,
    nu4w=0e10,
    nu=20,
    nuw=50e0,
    mu=0.e-7,
    muw=0e-7,
    use_filter=False,
    U=-U,
    tdiags=1,
    save_to_disk=False,
    dealias=False,
)

# initial conditions
q = ic.LambDipole(m, U=U, R=2 * np.pi / k0)
phi = (np.ones_like(q) + 1j) * u0 / np.sqrt(2)