Ejemplo n.º 1
0
""" Test compiling and running MITgcm's exp4 verification experiment. """

import os, sys; sys.path.append('../../')
import numpy as np
import matplotlib.pyplot as plt
import pymitgcm

ntimesteps = 100

gcmpath = '/Users/glwagner/Numerics/pymitgcm/MITgcm'
templatepath = os.path.join(os.getcwd(), '../../templates/verif_exp4')
optfile = 'neve'

# Create and compile the setup
setup = pymitgcm.Setup(templatepath)
setup.compilesetup(gcmpath, optfile=optfile)


# ----------------------------------------------------------------------------- 
# Test extrating  and changing the setup's ntimesteps parameter
oldntimesteps = setup.getparam('ntimesteps')
print("Original ntimesteps: {}".format(oldntimesteps))

setup.setparam('ntimesteps', ntimesteps)
newntimesteps = setup.getparam('ntimesteps')
print("New ntimesteps: {}".format(newntimesteps))

setup.runsetup(overwrite=True)

# Return ntimesteps to its former value
setup.setparam('ntimesteps', oldntimesteps)
Ejemplo n.º 2
0
import os, sys
sys.path.append('../../..')
import numpy as np
from numpy import pi
import matplotlib.pyplot as plt
import pymitgcm

# Create setup object in current directory
setup = pymitgcm.Setup(os.getcwd())
f0 = setup.getparam('f0')

nt = pymitgcm.getoutputiters(setup.run)

# Kilometers
x, y, z, t, xg, yg = pymitgcm.getgrid(setup.run)
x, y, xg, yg = 1e-3 * x, 1e-3 * y, 1e-3 * xg, 1e-3 * yg

# Get initial condition
t0, vars0 = pymitgcm.getoutputstate(setup.run, iter=1)

# Plot limits
umax, wmax = 0.002, 1e-5
nlevs = 20
ulevs = np.linspace(-umax, umax, nlevs + 1)
wlevs = np.linspace(-wmax, wmax, nlevs + 1)

# x,z slice
fig, axs = plt.subplots(nrows=2, ncols=1)
im, cb = [None] * 2, [None] * 2
for i in range(nt):
Ejemplo n.º 3
0
import os, sys; sys.path.append('../../')
import numpy as np
import matplotlib.pyplot as plt
import pymitgcm

# Number of time steps
ntimesteps = 1000

# Paths and parameters custom to Greg's system
gcmpath = '/Users/glwagner/Numerics/pymitgcm/MITgcm'
setuppath = os.path.join(os.getcwd(), '../../templates/verif_internalwave')
optfile = 'neve'

# Create and compile setup
setup = pymitgcm.Setup(setuppath)
setup.compilesetup(gcmpath, optfile=optfile)

# Get current ntimesteps
oldntimesteps = setup.getparam('ntimesteps')
print('Old ntimesteps: {}'.format(oldntimesteps))

# Set new ntimesteps
setup.setparam('ntimesteps', ntimesteps)
newntimesteps = setup.getparam('ntimesteps')
print('New ntimesteps: {}'.format(newntimesteps))

# Run the setup and return ntimesteps to its former value
setup.runsetup(overwrite=True)
setup.setparam('ntimesteps', 100)