z = [] z.append(z0) z.append(z1) ssz = 0.2 isource = np.ones((nrow, ncol), 'int') isource[0, 0] = 2 # stratified model modelname = 'swiex2_strat' print('creating...', modelname) ml = mf.Modflow(modelname, version='mf2005', exe_name=mf_name, model_ws=dirs[0]) discret = mf.ModflowDis(ml, nlay=1, ncol=ncol, nrow=nrow, delr=delr, delc=1, top=0, botm=[-40.0], nper=nper, perlen=perlen, nstp=nstp) bas = mf.ModflowBas(ml, ibound=ibound, strt=0.05) bcf = mf.ModflowBcf(ml, laycon=0, tran=2 * 40) swi = mf.ModflowSwi2(ml, nsrf=nsurf, istrat=1, toeslope=0.2, tipslope=0.2, nu=[0, 0.0125, 0.025], zeta=z, ssz=ssz, isource=isource, nsolver=1) oc = mf.ModflowOc88(ml, save_head_every=1000) pcg = mf.ModflowPcg(ml) ml.write_input() # run stratified model if not skipRuns: m = ml.run_model(silent=False) # read stratified results zetafile = os.path.join(dirs[0], '{}.zta'.format(modelname)) zobj = fu.CellBudgetFile(zetafile) zkstpkper = zobj.get_kstpkper() zeta = zobj.get_data(kstpkper=zkstpkper[-1], text=' ZETASRF 1')[0] zeta2 = zobj.get_data(kstpkper=zkstpkper[-1], text=' ZETASRF 2')[0] # # vd model modelname = 'swiex2_vd'
ocdict[key] = ['save head', 'save budget'] key = (0, idx+1) ocdict[key] = [] # create flopy modflow object ml = mf.Modflow(modelname, version='mf2005', exe_name=exe_name) # create flopy modflow package objects discret = mf.ModflowDis(ml, nlay=nlay, nrow=nrow, ncol=ncol, delr=delr, delc=delc, top=0, botm=[-40.0], perlen=400, nstp=200) bas = mf.ModflowBas(ml, ibound=ibound, strt=0.0) lpf = mf.ModflowLpf(ml, hk=2., vka=2.0, vkcb=0, laytyp=0, layavg=0) wel = mf.ModflowWel(ml, stress_period_data={0:[(0, 0, 0, 1)]}) swi = mf.ModflowSwi2(ml, npln=1, istrat=1, toeslope=0.2, tipslope=0.2, nu=[0, 0.025], zeta=z, ssz=0.2, isource=isource, nsolver=1) oc = mf.ModflowOc(ml, stress_period_data=ocdict) pcg = mf.ModflowPcg(ml) # create model files ml.write_input() # run the model m = ml.run_model(silent=False) # read model heads headfile = '{}.hds'.format(modelname) hdobj = fu.HeadFile(headfile) head = hdobj.get_alldata() head = np.array(head) # read model zeta zetafile = '{}.zta'.format(modelname) zobj = fu.CellBudgetFile(zetafile) zkstpkper = zobj.get_kstpkper()
botm=[-29, -30, -50], nper=2, perlen=[365 * 1000, 1000 * 365], nstp=[500, 500]) bas = mf.ModflowBas(ml, ibound=1, strt=1.0) bcf = mf.ModflowBcf(ml, laycon=[0, 0, 0], tran=[40.0, 1, 80.0], vcont=[0.005, 0.005]) wel = mf.ModflowWel(ml, stress_period_data={0: lrcQ1, 1: lrcQ2}) ghb = mf.ModflowGhb(ml, stress_period_data={0: lrchc}) swi = mf.ModflowSwi2(ml, nsrf=1, istrat=1, toeslope=0.01, tipslope=0.04, nu=[0, 0.025], zeta=[zini, zini, zini], ssz=0.2, isource=iso, nsolver=1) oc = mf.ModflowOc(ml, save_head_every=100) pcg = mf.ModflowPcg(ml) #--write the model files ml.write_input() #--run the model m = ml.run_model(silent=True) headfile = '{}.hds'.format(modelname) hdobj = fu.HeadFile(headfile) head = hdobj.get_data(totim=3.65000E+05)
savewords.append(twords) solver2params = {'mxiter': 100, 'iter1': 20, 'npcond': 1, 'zclose': 1.0e-6, 'rclose': 3e-3, 'relax': 1.0, 'nbpol': 2, 'damp': 1.0, 'dampt': 1.0} # --create model file and run model modelname = 'swi2ex5' mf_name = 'mf2005' if not skipRuns: ml = mf.Modflow(modelname, version='mf2005', exe_name=mf_name, model_ws=dirs[0]) discret = mf.ModflowDis(ml, nrow=nrow, ncol=ncol, nlay=nlay, delr=delr, delc=delc, top=0, botm=bot, laycbd=0, nper=nper, perlen=perlen, nstp=nstp, steady=steady) bas = mf.ModflowBas(ml, ibound=ibound, strt=ihead) lpf = mf.ModflowLpf(ml, hk=kh, vka=kv, ss=ss, sy=ssz, vkcb=0, laytyp=0, layavg=1) wel = mf.ModflowWel(ml, stress_period_data=well_data) swi = mf.ModflowSwi2(ml, npln=1, istrat=1, toeslope=0.025, tipslope=0.025, nu=[0, 0.025], \ zeta=z, ssz=ssz, isource=isource, nsolver=2, solver2params=solver2params) oc = mf.ModflowOc(ml, words=savewords) pcg = mf.ModflowPcg(ml, hclose=1.0e-6, rclose=3.0e-3, mxiter=100, iter1=50) # --write the modflow files ml.write_input() m = ml.run_model(silent=False) # --read model zeta get_stp = [364, 729, 1094, 1459, 364, 729, 1094, 1459] get_per = [0, 0, 0, 0, 1, 1, 1, 1] nswi_times = len(get_per) zetafile = os.path.join(dirs[0], '{}.zta'.format(modelname)) zobj = fu.CellBudgetFile(zetafile) zeta = [] for kk in zip(get_stp, get_per): zeta.append(zobj.get_data(kstpkper=kk, text=' ZETASRF 1')[0])
nstp=nstp, steady=steady) bas = mf.ModflowBas(ml, ibound=ibound, strt=ihead) lpf = mf.ModflowLpf(ml, laytyp=laytyp, hk=hk, vka=vka) wel = mf.ModflowWel(ml, stress_period_data=base_well_data) ghb = mf.ModflowGhb(ml, stress_period_data=ghb_data) rch = mf.ModflowRch(ml, rech=rch_data) swi = mf.ModflowSwi2(ml, nsrf=1, istrat=1, toeslope=toeslope, tipslope=tipslope, nu=nu, zeta=z, ssz=ssz, isource=iso, nsolver=1, adaptive=adaptive, nadptmx=nadptmx, nadptmn=nadptmn, nobs=nobs, iswiobs=iswiobs, obsnam=obsnam, obslrc=obslrc) oc = mf.ModflowOc(ml, words=savewords) pcg = mf.ModflowPcg(ml, hclose=1.0e-6, rclose=3.0e-3, mxiter=100, iter1=50) #--create model files ml.write_input() #--run the model m = ml.run_model(silent=False)