#%% Relaxation profile def nudge_fun(x, a, b, c, lev_max_change = 2400,end = 3600*6): y = b * (np.pi/2+np.arctan(a* np.pi/2*(1-x/lev_max_change))) y = end + y**c # # plot # plt.figure(figsize=(6,9)) # plt.axhline(lev_max_change,c='k',lw=1,ls=':') # plt.axvline(end/3600/24,c='r',lw=1,ls=':',label='6 hours') # plt.axvline(5,c='r',lw=1,ls='--',label='5 days') # plt.plot(y/3600/24,x) # plt.ylim([0,4000]) # plt.xscale('log') # plt.legend() # plt.xlabel('Days') # plt.ylabel('Height (m)') # plt.title('Relaxation time scale',fontsize=24) return y nudge_time = nudge_fun(grid.z,a=2,b=3,c=6,lev_max_change=2400)