# create vertical grid: z = np.asarray(np.linspace(-4000, 0, 80)) # create initial guess for buoyancy profile in the Atl def b_Atl(z): return bs * np.exp(z / 300.) + z / z[0] * bbot #def b_Atl(z): return 0.3*bs+z/z[0]*(bbot-0.3*bs) def b_Pac(z): return bs * np.exp(z / 300.) + z / z[0] * bbot # create N.A. overturning model instance AMOC = Psi_Thermwind(z=z, b1=b_Atl, b2=0.01 * b_Atl(z)) # and solve for initial overturning streamfunction: AMOC.solve() # map North Atlantic overturning to isopycnal space: [Psi_iso_Atl, Psi_iso_N] = AMOC.Psibz() # create interbasin zonal overturning model instance ZOC = Psi_Thermwind(z=z, b1=b_Atl, b2=b_Pac, f=1e-4) # and solve for initial overturning streamfunction: ZOC.solve() # map inter-basin overturning to isopycnal space: [Psi_zonal_Atl, Psi_zonal_Pac] = ZOC.Psibz() # create S.O. overturning model instance for Atlantic sector SO_Atl = Psi_SO(z=z, y=y, b=b_Atl(z), bs=bs_SO, tau=tau, L=Latl, KGM=K) SO_Atl.solve()
# number of vertical buoyancy levels for isopycnal computations nb = 500 # Set initial conditions if pickup is not None: b_basin = 1.0 * pickup['arr_0'] b_north = 1.0 * pickup['arr_1'] bs_SO = 1.0 * pickup['arr_2'] else: b_basin = bs * np.exp(z / 400.) - 0.0001 * z / z[0] b_north = bs_north - 0.0001*(z / z[0])**2. bs_SO = bs_SO_eq.copy(); bs_SO[:6]= -0.0001 # create N.A. overturning model instance AMOC = Psi_Thermwind(z=z, b1=b_basin, b2=b_north, f=1.2e-4) # and solve for initial overturning streamfunction: AMOC.solve() # create S.O. overturning model instance PsiSO = Psi_SO( z=z, y=y, b=b_basin, bs=bs_SO, tau=tau, f=1.2e-4, L=L, KGM=kapGM ) # and solve for initial overturning streamfunction: PsiSO.solve() # notice that the next few lines need to come after Psi_SO is computed # in case the latter is fixed to the pickup conditions bs_SO[-1] = bs # make sure buoyancy at northern end of channel (serves as BC for diffusion) equals surface b in basin
# create vertical grid: z = np.asarray(np.linspace(-4000, 0, 80)) # Initial conditions for buoyancy profile in the basin def b_basin(z): return bs * np.exp(z / 300.) def b_north(z): return bs_north * np.exp(z / 300.) # create N.A. overturning model instance AMOC = Psi_Thermwind(z=z, b1=b_basin, b2=b_north, f=1e-4) # and solve for initial overturning streamfunction: AMOC.solve() # evaluate overturning in isopycnal space: [Psi_iso_b, Psi_iso_n] = AMOC.Psibz() # create S.O. overturning model instance SO = Psi_SO(z=z, y=y, b=b_basin(z), bs=bs_SO, tau=tau, f=1e-4, L=5e6, KGM=1000., c=0.1,
Diag=np.load('diags.npz') # Notice that some of these variables may need to be adjusted to match the # simulations to be plotted: L=2e7 l=2e6; nb=500 b_basin=1.0*Diag['arr_2'][:,-1]; b_north=1.0*Diag['arr_3'][:,-1]; bs_SO=1.0*Diag['arr_4'][:,-1]; z=1.0*Diag['arr_5']; y=1.0*Diag['arr_7']; tau=1.0*Diag['arr_9']; kapGM=1.0*Diag['arr_10']; AMOC = Psi_Thermwind(z=z,b1=b_basin,b2=b_north,f=1.2e-4) AMOC.solve() PsiSO=Psi_SO(z=z,y=y,b=b_basin,bs=bs_SO,tau=tau,f=1.2e-4,L=L,KGM=kapGM) PsiSO.solve() blevs=np.arange(-0.01,0.03,0.001) plevs=np.arange(-28.,28.,2.0) bs=1.*bs_SO;bn=1.*b_basin; if bs[0]>bs[1]: # due to the way the time-stepping works bs[0] can be infinitesimally larger # than bs[0] here, which messe up interpolation bs[0]=bs[1] if bs[0]<bn[0]: # Notice that bn[0] can at most be infinitesimally larger than bs[0]
# create grid: z = np.asarray(np.linspace(-4000, 0, 80)) # Initial conditions for buoyancy profile in the basin: def b_basin(z): return bs * np.exp(z / 300.) def b_north(z): return 1e-3 * bs * np.exp(z / 300.) # create overturning model instance AMOC = Psi_Thermwind(z=z, b1=b_basin, b2=b_north) # and solve for initial overturning streamfunction: AMOC.solve() # evaluate overturning in isopycnal space: [Psi_iso_b, Psi_iso_n] = AMOC.Psibz() # Create figure: fig = plt.figure(figsize=(6, 10)) ax1 = fig.add_subplot(111) ax2 = ax1.twiny() plt.ylim((-4e3, 0)) ax1.set_xlim((-5, 20)) ax2.set_xlim((-0.01, 0.04)) ax1.set_xlabel('$\Psi$', fontsize=14) ax2.set_xlabel('b', fontsize=14)
# buoyancy profile in the basin: def b_basin(z): return 0.03 * np.exp(z / 300.) - 0.0004 # We will here assume b_N=0 (the default) z = np.asarray(np.linspace(-4000, 0, 100)) # the next line would turn b_basin from a function to an array, # which is also a valid input to Model_PsiNA #b_basin=b_basin(z) # create column model instance: m = Psi_Thermwind(z=z, b1=b_basin) # solve the model: m.solve() # Plot results: fig = plt.figure(figsize=(6, 10)) ax1 = fig.add_subplot(111) ax2 = ax1.twiny() ax2.plot(b_basin(m.z), m.z, color='b') ax1.plot(m.Psi, m.z, color='r') plt.ylim((-4e3, 0)) ax1.set_xlim((-5, 20)) ax2.set_xlim((-0.01, 0.04)) ax1.set_xlabel('$\Psi$', fontsize=14) ax2.set_xlabel('b', fontsize=14) plt.show()
# create grid z = np.asarray(np.linspace(-3500, 0, 70)) # we could also use an irregular grid that's finer near the surface: #z=np.asarray(np.linspace(-(3500.**(3./4.)), 0, 40)) #z[:-1]=-(-z[:-1])**(4./3.) # create initial guess for buoyancy profile in the basin def b_basin(z): return bs * np.exp(z / 300.) + bbot # create overturning model instance AMOC = Psi_Thermwind(z=z, b1=b_basin) # and solve for initial overturning streamfunction: AMOC.solve() # Create figure and plot initial conditions: fig = plt.figure(figsize=(6, 10)) ax1 = fig.add_subplot(111) ax2 = ax1.twiny() ax1.plot(AMOC.Psi, AMOC.z) #ax2.plot(m.b_N, m.z) ax2.plot(b_basin(z), z) plt.ylim((-4e3, 0)) ax1.set_xlim((-5, 20)) ax2.set_xlim((-0.01, 0.04)) ax1.set_xlabel('$\Psi$', fontsize=14) ax2.set_xlabel('b', fontsize=14)
kappa_s = 3e-5 kappa_4k = 3e-4 kappa = lambda z: (kappa_back + kappa_s * np.exp(z / 100) + kappa_4k * np.exp( -z / 1000 - 4)) # create grid z = np.asarray(np.linspace(-3500, 0, 100)) # create initial guess for buoyancy profile in the basin def b_basin(z): return bs * np.exp(z / 300.) + bbot # create overturning model instance AMOC = Psi_Thermwind(z=z, b1=b_basin) # and solve for initial overturning streamfunction: AMOC.solve() # Create figure and plot initial conditions: fig = plt.figure(figsize=(6, 10)) ax1 = fig.add_subplot(111) ax2 = ax1.twiny() ax1.plot(AMOC.Psi, AMOC.z) #ax2.plot(m.b_N, m.z) ax2.plot(b_basin(z), z) plt.ylim((-4e3, 0)) ax1.set_xlim((-5, 20)) ax2.set_xlim((-0.01, 0.04)) ax1.set_xlabel('$\Psi$', fontsize=14) ax2.set_xlabel('b', fontsize=14)