<s> from __future__ import print_function <EOL> import os <EOL> import sys <EOL> import math <EOL> import numpy as np <EOL> import flopy . modflow as mf <EOL> import flopy . utils as fu <EOL> import matplotlib . pyplot as plt <EOL> updates = { '<STR_LIT>' : [ '<STR_LIT>' , '<STR_LIT>' ] , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : <NUM_LIT:0> , <EOL> '<STR_LIT>' : <NUM_LIT> , <EOL> '<STR_LIT>' : <NUM_LIT:7> , <EOL> '<STR_LIT>' : <NUM_LIT:8> , <EOL> '<STR_LIT>' : <NUM_LIT:7> , <EOL> '<STR_LIT>' : <NUM_LIT:7> } <EOL> plt . rcParams . update ( updates ) <EOL> cleanFiles = False <EOL> fext = '<STR_LIT>' <EOL> narg = len ( sys . argv ) <EOL> iarg = <NUM_LIT:0> <EOL> if narg > <NUM_LIT:1> : <EOL> while iarg < narg - <NUM_LIT:1> : <EOL> iarg += <NUM_LIT:1> <EOL> basearg = sys . argv [ iarg ] . lower ( ) <EOL> if basearg == '<STR_LIT>' : <EOL> cleanFiles = True <EOL> elif basearg == '<STR_LIT>' : <EOL> fext = '<STR_LIT>' <EOL> if cleanFiles : <EOL> print ( '<STR_LIT>' ) <EOL> print ( '<STR_LIT>' ) <EOL> files = os . listdir ( '<STR_LIT:.>' ) <EOL> for f in files : <EOL> if os . path . isdir ( f ) : <EOL> continue <EOL> if '<STR_LIT>' != os . path . splitext ( f ) [ <NUM_LIT:1> ] . lower ( ) : <EOL> print ( '<STR_LIT>' . format ( os . path . basename ( f ) ) ) <EOL> os . remove ( f ) <EOL> sys . exit ( <NUM_LIT:1> ) <EOL> modelname = '<STR_LIT>' <EOL> exe_name = '<STR_LIT>' <EOL> nlay = <NUM_LIT:1> <EOL> nrow = <NUM_LIT:1> <EOL> ncol = <NUM_LIT:50> <EOL> delr = <NUM_LIT> <EOL> delc = <NUM_LIT:1.> <EOL> ibound = np . ones ( ( nrow , ncol ) , np . int ) <EOL> ibound [ <NUM_LIT:0> , - <NUM_LIT:1> ] = - <NUM_LIT:1> <EOL> z = np . zeros ( ( nrow , ncol ) , np . float ) <EOL> z [ <NUM_LIT:0> , <NUM_LIT:16> : <NUM_LIT> ] = np . arange ( - <NUM_LIT> , - <NUM_LIT> , - <NUM_LIT:5> ) <EOL> z [ <NUM_LIT:0> , <NUM_LIT> : ] = - <NUM_LIT> <EOL> z = [ z ] <EOL> isource = np . ones ( ( nrow , ncol ) , np . int ) <EOL> isource [ <NUM_LIT:0> , <NUM_LIT:0> ] = <NUM_LIT:2> <EOL> ocdict = { } <EOL> for idx in range ( <NUM_LIT> , <NUM_LIT:200> , <NUM_LIT:50> ) : <EOL> key = ( <NUM_LIT:0> , idx ) <EOL> ocdict [ key ] = [ '<STR_LIT>' , '<STR_LIT>' ] <EOL> key = ( <NUM_LIT:0> , idx + <NUM_LIT:1> ) <EOL> ocdict [ key ] = [ ] <EOL> ml = mf . Modflow ( modelname , version = '<STR_LIT>' , exe_name = exe_name ) <EOL> discret = mf . ModflowDis ( ml , nlay = nlay , nrow = nrow , ncol = ncol , <EOL> delr = delr , delc = delc , <EOL> top = <NUM_LIT:0> , botm = [ - <NUM_LIT> ] , <EOL> perlen = <NUM_LIT> , nstp = <NUM_LIT:200> ) <EOL> bas = mf . ModflowBas ( ml , ibound = ibound , strt = <NUM_LIT:0.0> ) <EOL> lpf = mf . ModflowLpf ( ml , hk = <NUM_LIT> , vka = <NUM_LIT> , vkcb = <NUM_LIT:0> , laytyp = <NUM_LIT:0> , layavg = <NUM_LIT:0> ) <EOL> wel = mf . ModflowWel ( ml , stress_period_data = { <NUM_LIT:0> : [ ( <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:1> ) ] } ) <EOL> swi = mf . ModflowSwi2 ( ml , npln = <NUM_LIT:1> , istrat = <NUM_LIT:1> , toeslope = <NUM_LIT> , tipslope = <NUM_LIT> , nu = [ <NUM_LIT:0> , <NUM_LIT> ] , <EOL> zeta = z , ssz = <NUM_LIT> , isource = isource , nsolver = <NUM_LIT:1> ) <EOL> oc = mf . ModflowOc ( ml , stress_period_data = ocdict ) <EOL> pcg = mf . ModflowPcg ( ml ) <EOL> ml . write_input ( ) <EOL> m = ml . run_model ( silent = False ) <EOL> headfile = '<STR_LIT>' . format ( modelname ) <EOL> hdobj = fu . HeadFile ( headfile ) <EOL> head = hdobj . get_alldata ( ) <EOL> head = np . array ( head ) <EOL> zetafile = '<STR_LIT>' . format ( modelname ) <EOL> zobj = fu . CellBudgetFile ( zetafile ) <EOL> zkstpkper = zobj . get_kstpkper ( ) <EOL> zeta = [ ] <EOL> for kk in zkstpkper : <EOL> zeta . append ( zobj . get_data ( kstpkper = kk , text = '<STR_LIT>' ) [ <NUM_LIT:0> ] ) <EOL> zeta = np . array ( zeta ) <EOL> x = np . arange ( <NUM_LIT:0.5> * delr , ncol * delr , delr ) <EOL> k = <NUM_LIT> <EOL> n = <NUM_LIT> <EOL> nu = <NUM_LIT> <EOL> H = <NUM_LIT> <EOL> tzero = H * n / ( k * nu ) / <NUM_LIT> <EOL> Ltoe = np . zeros ( <NUM_LIT:4> ) <EOL> v = <NUM_LIT> <EOL> t = np . arange ( <NUM_LIT:100> , <NUM_LIT> , <NUM_LIT:100> ) <EOL> fwid = <NUM_LIT> <EOL> fhgt = <NUM_LIT> <EOL> flft = <NUM_LIT> <EOL> frgt = <NUM_LIT> <EOL> fbot = <NUM_LIT> <EOL> ftop = <NUM_LIT> <EOL> fig = plt . figure ( figsize = ( fwid , fhgt ) , facecolor = '<STR_LIT:w>' ) <EOL> fig . subplots_adjust ( wspace = <NUM_LIT> , hspace = <NUM_LIT> , left = flft , right = frgt , bottom = fbot , top = ftop ) <EOL> ax = fig . add_subplot ( <NUM_LIT> ) <EOL> ax . text ( - <NUM_LIT> , <NUM_LIT> , '<STR_LIT:A>' , transform = ax . transAxes , va = '<STR_LIT>' , ha = '<STR_LIT>' , size = '<STR_LIT>' ) <EOL> ax . plot ( [ <NUM_LIT> , <NUM_LIT> ] , [ <NUM_LIT:0> , - <NUM_LIT> ] , '<STR_LIT:k>' ) <EOL> ax . set_xlim ( <NUM_LIT:0> , <NUM_LIT> ) <EOL> ax . set_ylim ( - <NUM_LIT> , <NUM_LIT:0> ) <EOL> ax . set_yticks ( np . arange ( - <NUM_LIT> , <NUM_LIT:1> , <NUM_LIT:10> ) ) <EOL> ax . text ( <NUM_LIT:50> , - <NUM_LIT:10> , '<STR_LIT>' ) <EOL> ax . text ( <NUM_LIT> , - <NUM_LIT:10> , '<STR_LIT>' ) <EOL> a = ax . annotate ( "<STR_LIT>" , xy = ( <NUM_LIT:50> , - <NUM_LIT> ) , xytext = ( <NUM_LIT:30> , - <NUM_LIT> ) , arrowprops = dict ( arrowstyle = '<STR_LIT>' , fc = '<STR_LIT:k>' ) ) <EOL> ax . text ( <NUM_LIT> , - <NUM_LIT> , '<STR_LIT>' , ha = '<STR_LIT>' , size = <NUM_LIT:7> ) <EOL> ax . set_ylabel ( '<STR_LIT>' ) <EOL> ax = fig . add_subplot ( <NUM_LIT> ) <EOL> ax . text ( - <NUM_LIT> , <NUM_LIT> , '<STR_LIT:B>' , transform = ax . transAxes , va = '<STR_LIT>' , ha = '<STR_LIT>' , size = '<STR_LIT>' ) <EOL> for i in range ( <NUM_LIT:4> ) : <EOL> Ltoe [ i ] = H * math . sqrt ( k * nu * ( t [ i ] + tzero ) / n / H ) <EOL> ax . plot ( [ <NUM_LIT:100> - Ltoe [ i ] + v * t [ i ] , <NUM_LIT:100> + Ltoe [ i ] + v * t [ i ] ] , [ <NUM_LIT:0> , - <NUM_LIT> ] , '<STR_LIT:k>' , label = '<STR_LIT>' ) <EOL> for i in range ( <NUM_LIT:4> ) : <EOL> zi = zeta [ i , <NUM_LIT:0> , <NUM_LIT:0> , : ] <EOL> p = ( zi < <NUM_LIT:0> ) & ( zi > - <NUM_LIT> ) <EOL> ax . plot ( x [ p ] , zeta [ i , <NUM_LIT:0> , <NUM_LIT:0> , p ] , '<STR_LIT>' , <EOL> markersize = <NUM_LIT:3> , markeredgecolor = '<STR_LIT>' , markerfacecolor = '<STR_LIT:None>' , label = '<STR_LIT>' ) <EOL> ipos = <NUM_LIT:0> <EOL> for jdx , t in enumerate ( zeta [ i , <NUM_LIT:0> , <NUM_LIT:0> , : ] ) : <EOL> if t > - <NUM_LIT> : <EOL> ipos = jdx <EOL> ax . text ( x [ ipos ] , - <NUM_LIT> , '<STR_LIT>' . format ( ( ( i + <NUM_LIT:1> ) * <NUM_LIT:100> ) ) , size = <NUM_LIT:5> , ha = '<STR_LIT:left>' , va = '<STR_LIT>' ) <EOL> ax . plot ( [ - <NUM_LIT> , - <NUM_LIT:100> ] , [ - <NUM_LIT> , - <NUM_LIT:100> ] , '<STR_LIT:k>' , label = '<STR_LIT>' ) <EOL> ax . plot ( [ - <NUM_LIT> , - <NUM_LIT:100> ] , [ - <NUM_LIT> , - <NUM_LIT:100> ] , '<STR_LIT>' , markersize = <NUM_LIT:3> , markeredgecolor = '<STR_LIT>' , markerfacecolor = '<STR_LIT:None>' , label = '<STR_LIT>' ) <EOL> leg = ax . legend ( loc = '<STR_LIT>' , numpoints = <NUM_LIT:1> ) <EOL> leg . _drawFrame = False <EOL> ax . set_xlim ( <NUM_LIT:0> , <NUM_LIT> ) <EOL> ax . set_ylim ( - <NUM_LIT> , <NUM_LIT:0> ) <EOL> ax . set_yticks ( np . arange ( - <NUM_LIT> , <NUM_LIT:1> , <NUM_LIT:10> ) ) <EOL> a = ax . annotate ( "<STR_LIT>" , xy = ( <NUM_LIT:50> , - <NUM_LIT> ) , xytext = ( <NUM_LIT:30> , - <NUM_LIT> ) , arrowprops = dict ( arrowstyle = '<STR_LIT>' , fc = '<STR_LIT:k>' ) ) <EOL> ax . text ( <NUM_LIT> , - <NUM_LIT> , '<STR_LIT>' , ha = '<STR_LIT>' , size = <NUM_LIT:7> ) <EOL> ax . set_ylabel ( '<STR_LIT>' ) <EOL> ax . set_xlabel ( '<STR_LIT>' ) <EOL> outfig = '<STR_LIT>' . format ( fext ) <EOL> fig . savefig ( outfig , dpi = <NUM_LIT> ) <EOL> print ( '<STR_LIT>' , outfig ) </s>
