HenryDane / climlab

Python package for process-oriented climate modeling
MIT License
1 stars 0 forks source link

Longitude-only diffusion has latitude dependence? #7

Closed HenryDane closed 1 year ago

HenryDane commented 1 year ago

For some reason, running the model with only zonal diffusion produces variation along the latitude axis which looks wrong to me.

HenryDane commented 1 year ago

Code to reproduce this:

import climlab
from climlab import constants as const
import numpy as np
import matplotlib.pyplot as plt

full_state = climlab.surface_state(num_lat=40, num_lon=30, water_depth=2.5)
model = climlab.TimeDependentProcess(state=full_state, timestep=const.seconds_per_hour)
zodif = climlab.dynamics.zonal_heat_diffusion.ZonalHeatDiffusion(state=full_state)
model.add_subprocess('zodif', zodif)

for i in range(8765):
    model.Ts[:,0,:] = 100.0
    model.step_forward()
plt.imshow(model.Ts)
plt.colorbar()

plt.imshow(zodif.heat_transport)
plt.xlabel('Lon (indices)')
plt.ylabel('Lat (indices)')
plt.title('Zonal heat transport')
plt.colorbar()
HenryDane commented 1 year ago

This was a mistake with the setup of the experiment. Appending:

model.Ts[:,:,:] = 20.0

before the for loop resolves this.