'H1': 500.0, 'H2': 2000.0, 'U1': 5e-2, 'U2': 1e-2, 'bottomDrag': 1e-7, 'nx': 128, 'dt': 1e3, 'visc': 1e9, 'viscOrder': 4.0, 'timeStepper': 'AB3', 'nThreads': 4, 'useFilter': False, } # Create the two-layer model qg = twoLayerQG.model(**qgParams) qg.describe_model() # Initial condition to seed baroclinic instability Ro = 1.0e-3 f0 = 1.0e-4 q1 = Ro * f0 * np.random.standard_normal(qg.physVarShape) q2 = Ro * f0 * np.random.standard_normal(qg.physVarShape) qg.set_q1_and_q2(q1, q2) # Gaussian hill topography (x0, y0, r) = (qg.Lx / 2.0, qg.Ly / 2.0, qg.Lx / 20.0) h = 0.1 * qg.H2 * np.exp(-((qg.x - x0)**2.0 + (qg.y - y0)**2.0) / (2.0 * r**2.0))
'H1': 500.0, 'H2': 2000.0, 'U1': 2.5e-2, 'U2': 0.0, 'bottomDrag': 1.0e-7, 'nx': 128, 'dt': 1.0e3, 'visc': 2.0e8, 'viscOrder': 4.0, 'timeStepper': 'AB3', 'nThreads': 4, 'useFilter': False, } # Create the two-layer model qg = twoLayerQG.model(**params) qg.describe_model() # Initial condition: Ro = 1.0e-3 f0 = 1.0e-4 q1 = Ro * f0 * np.random.standard_normal(qg.physVarShape) q2 = Ro * f0 * np.random.standard_normal(qg.physVarShape) qg.set_q1_and_q2(q1, q2) # Run a loop nt = 1e3 for ii in np.arange(0, 1e3):
'H1': pyqgParams['H1'], 'H2': pyqgParams['H1'] / pyqgParams['delta'], 'U1': pyqgParams['U1'], 'U2': pyqgParams['U2'], 'bottomDrag': pyqgParams['rek'], 'nx': pyqgParams['nx'], 'dt': pyqgParams['dt'], 'visc': 0e6, 'viscOrder': 4.0, 'timeStepper': 'AB3', 'nThreads': pyqgParams['ntd'], 'useFilter': True, } m = pyqg.QGModel(**pyqgParams) qg = twoLayerQG.model(**myParams) qg.describe_model() # Initial condition (f0, Ro) = (1.0e-4, 1.0e-3) q1 = Ro * f0 * np.random.standard_normal((m.ny, m.nx)) q2 = Ro * f0 * np.random.standard_normal((m.ny, m.nx)) m.set_q1q2(q1, q2) qg.set_q1_and_q2(q1, q2) # Run models, interleaved within one another. nt = 1e3 for snapshot in m.run_with_snapshots(tsnapstart=0, tsnapint=nt * m.dt):