# parameters for advection/attenuation SCATMOD = 1 ADV_DIM = 2 DO_CHECK_FINAL = 0 DO_CHECK_PROG = 1 DO_CHECK_INIT = 0 # young = 5.0e9 visc_rp = 0.0 # 13. duration = 20.0 * 3600 # length of simulation [s] int_prams = np.array([SCATMOD, ADV_DIM, DO_CHECK_FINAL, DO_CHECK_PROG, DO_CHECK_INIT]) real_prams = np.array([young, visc_rp, duration]) # do calculation in fortran: out_fields, outdir = Rwim.do_run(RUN_OPT=2, in_fields=in_fields, int_prams=int_prams, real_prams=real_prams) ###################################################### else: # load results of previous run: out_fields, outdir = Rwim.do_run(RUN_OPT=3) ######################################################### ######################################################### # calculate maxima of tau_x and get Wmiz: taux_max = np.zeros(ny) Wmiz = np.zeros(ny) for j in range(0, ny): Dmax = out_fields["dfloe"][:, j] taux = out_fields["taux"][:, j] ## taux_max[j] = taux.max() # max stress in Pa
sys.path.append(dd+"/bin") sys.path.append(w2d+"/fortran/py_funs") import run_WIM2d as Rwim import WIM2d_f2py as Mwim import fns_get_data as Fdat import fns_plot_data as Fplt testing = 1 grid_dir = 'grid' ########################################################################## if testing is 1: # run and plot figs later (no I/O) RUN_OPT = 0 out_fields,outdir = Rwim.do_run(RUN_OPT) sys.exit() ########################################################################## elif testing is 2: RUN_OPT = 2 # check passing in of 'in_fields' # - read in inputs from saved files: # (need to run without I/O first) if 1: in_dir = 'out_py/binaries' else: in_dir = 'out_py_io/binaries' gf = Fdat.fn_check_grid(in_dir)
outdir = '/Volumes/Tim_Ext_HD2/WORK/Model-Results/Boltzmann/convergence/16dirs/4km' figdir = outdir else: figdir0 = 'fig_scripts/figs/' figdir = figdir0+'TC2S' if not os.path.exists(figdir0): os.mkdir(figdir0) if not os.path.exists(figdir): os.mkdir(figdir) if RUN_OPT==3: outdir = 'out_io' # usual place # outdir = '../../matlab/main/m_out' # matlab results else: out_fields,outdir = \ Rwim.do_run(RUN_OPT=RUN_OPT,in_fields=in_fields,\ int_prams=int_prams,\ real_prams=real_prams) ########################################################################## # Make plots bindir = outdir+'/binaries' ########################################################################## grid_prams = Fdat.fn_check_grid(bindir) # load grid from binaries xx = 1.e-3*grid_prams['X'][:,0] # labs1 = ['x, km','$H_s$, m'] labs1 = ['','$H_s$, m'] labs2 = ['$x$, km',r'$\tau_x$, Pa'] ########################################################################## fig = plt.figure()
import run_WIM2d as Rwim import fns_get_data as Fdat import fns_plot_data as Fplt # RUN_OPT = 0 # non-IO version RUN_OPT = 1 # rerun then plot DO_PLOTTING = 1 # cancel plotting if desired by setting to 0 gf = Fdat.fn_check_grid('grid') gfl = gf['LANDMASK'] ICEMASK = 1.-gfl WAVEMASK = 1.-gfl grid_prams = gf if RUN_OPT==0: results = Rwim.do_run() else: # set inputs: (icec,iceh,dfloe), (Hs,Tp,mwd) xmin = gf['X'].min() xmax = gf['X'].max() xav = .5*(xmin+xmax) xm = .5*(gf['dx']+xmax-xmin) if 1: # "semi-infinite" ice sheet # ice edge xe = xav -.7*.5*(xmax-xmin) ICEMASK = 1+0*gf['X'] # ICEMASK[gf['X']<xe] = 0.