In [1]:
import os
import python_subgrid.wrapper
import ctypes

In [2]:
mdu = os.path.abspath('../../models/purmer/purmer.mdu')

In [3]:
subgrid = python_subgrid.wrapper.SubgridWrapper(mdu=mdu)

In [4]:
subgrid.start()


INFO:python_subgrid.wrapper:Using subgrid fortran library /home/fedor/.local/lib/libsubgrid.so
INFO:python_subgrid.wrapper:Loading library from path /home/fedor/.local/lib/libsubgrid.so
INFO:python_subgrid.wrapper:Current version: Deltares, 3Di - subgrid Version 0.1.1.968M, Dec 23 2013, 15:33:13
INFO:python_subgrid.wrapper:Startup complete.
INFO:python_subgrid.wrapper:Loading model /home/fedor/Checkouts/models/purmer/purmer.mdu in directory /home/fedor/Checkouts/models/purmer
INFO:python_subgrid.wrapper:Start loadModel for '/home/fedor/Checkouts/models/purmer/purmer.mdu'.
INFO:python_subgrid.wrapper:Wrong LogOut. Set to              1
WARNING:python_subgrid.wrapper:CrossSectionFile is not specified. Channel network is disabled.
WARNING:python_subgrid.wrapper:CrossSectionDefinitionFile is not specified. Channel network is disabled.
INFO:python_subgrid.wrapper:Wrong NumLayers. Ground water calculations switched off.
INFO:python_subgrid.wrapper:Reading bathmetry file ' subgrid/purmer.tif '...
DEBUG:python_subgrid.wrapper:          51   51.7052803      dps(0:imax+1, 0:jmax+1)
INFO:python_subgrid.wrapper:Completed reading bathymetry file.
INFO:python_subgrid.wrapper:Opened file : polygons/purmer_grof.pol
INFO:python_subgrid.wrapper:Start initialization of grid administration.
DEBUG:python_subgrid.wrapper:         471   419.430389      ip,jp
DEBUG:python_subgrid.wrapper:         471  0.264196008      ls(k)
DEBUG:python_subgrid.wrapper:         471   6.65640011E-02  ls(k)
DEBUG:python_subgrid.wrapper:         471   1.68999992E-02  ls(k)
DEBUG:python_subgrid.wrapper:         471   4.35600011E-03  ls(k)
DEBUG:python_subgrid.wrapper:         471   1.15599995E-03  ls(k)
INFO:python_subgrid.wrapper: Internal nodes =      4969
INFO:python_subgrid.wrapper: Boundary nodes =   0
DEBUG:python_subgrid.wrapper:         471   4.97200014E-03  nodk,nodm,nodn
DEBUG:python_subgrid.wrapper:         471   4.96899989E-03  ks(nodall)
DEBUG:python_subgrid.wrapper:         471   9.93799977E-03  xz,yz
ERROR:python_subgrid.wrapper:No network found, 1d boundaries are ignored.
DEBUG:python_subgrid.wrapper:         471   2.07339991E-02  line
DEBUG:python_subgrid.wrapper:         471   4.14679982E-02  lik,lim,lin,kcu
DEBUG:python_subgrid.wrapper:         471   3.97600010E-02  nru,nrv
INFO:python_subgrid.wrapper:Initializing boundaries took:   0.2000D-02 seconds.
DEBUG:python_subgrid.wrapper:         471   1.03669995E-02  flod
DEBUG:python_subgrid.wrapper:         471   1.03669995E-02  flou
DEBUG:python_subgrid.wrapper:         471   3.11009996E-02  dpumin
DEBUG:python_subgrid.wrapper:         471   3.11009996E-02  dpumax
ERROR:python_subgrid.wrapper:No 1d network found. Structures are disabled.
INFO:python_subgrid.wrapper:Grid Admin initialisation took:  0.1700D-01 seconds.
INFO:python_subgrid.wrapper:Completed initialization of grid administration.
DEBUG:python_subgrid.wrapper:         471   4.96899989E-03  dmax(1:nodall)
DEBUG:python_subgrid.wrapper:         471   4.96899989E-03  dmin(1:nodall)
DEBUG:python_subgrid.wrapper:         471   4.96899989E-03  sumax(1:nodtot)
DEBUG:python_subgrid.wrapper:         471   1.98759995E-02  dqmin(1:nodtot)
DEBUG:python_subgrid.wrapper:         471   1.98759995E-02  dqmax(1:nodtot)
DEBUG:python_subgrid.wrapper:         471   1.98759995E-02  suqmax(1:nodtot)
DEBUG:python_subgrid.wrapper:         471   1.98759995E-02  ksq(1:nodtot)
DEBUG:python_subgrid.wrapper:         471   1.49100004E-02  s1(0:nodall)
DEBUG:python_subgrid.wrapper:         471   1.49100004E-02  si(0:nodall)
DEBUG:python_subgrid.wrapper:         471   3.11040003E-02  u1(0:linall)
DEBUG:python_subgrid.wrapper:         471   1.03679998E-02  kf(0:linall)
DEBUG:python_subgrid.wrapper:         471   4.97000013E-03  vol1(0:nodall)
DEBUG:python_subgrid.wrapper:         471   9.94000025E-03  vol2(0:nodall)
DEBUG:python_subgrid.wrapper:         471   9.94000025E-03  su(0:nodall)
DEBUG:python_subgrid.wrapper:         471   9.94000025E-03  volErr(0:nodall)
DEBUG:python_subgrid.wrapper:         471   1.03669995E-02  conv(linall)
DEBUG:python_subgrid.wrapper:         471   1.98800005E-02  vq1(0:4*nodall)
DEBUG:python_subgrid.wrapper:         471   4.97000013E-03  implis(0:nodall)
DEBUG:python_subgrid.wrapper:         471   2.48499997E-02  aii,bi,d0,a00,b0(0:nodall)
DEBUG:python_subgrid.wrapper:         471   1.98800005E-02  vol0(0:nodall),vq0(0:4*nodall)
DEBUG:python_subgrid.wrapper:         472   7.95079991E-02  vqt,denom(0:4*nodall),fbq(0:4*nodall),umq(0:4*nodall)
DEBUG:python_subgrid.wrapper:         472   2.98170000E-02  qs,qs1,qs2(0:2*nodall)
DEBUG:python_subgrid.wrapper:         472   3.11040003E-02  u0,uh(0:linall)
DEBUG:python_subgrid.wrapper:         472   4.97000013E-03  uc(0:nodall,2)
DEBUG:python_subgrid.wrapper:         472   4.97000013E-03  vnorm(0:nodall)
DEBUG:python_subgrid.wrapper:         472   5.18350005E-02  cu,ru(linall)
DEBUG:python_subgrid.wrapper:         472   3.11040003E-02  au1(linall,0:2)
DEBUG:python_subgrid.wrapper:         472   3.11040003E-02  au0(linall,0:2)
DEBUG:python_subgrid.wrapper:         472   2.07359996E-02  as0(linall,1:2)
DEBUG:python_subgrid.wrapper:         472   2.07359996E-02  as1(linall,1:2)
DEBUG:python_subgrid.wrapper:         472   1.03669995E-02  cz(linall)
DEBUG:python_subgrid.wrapper:         472   2.07359996E-02  qh1,qh2(0:linall)
DEBUG:python_subgrid.wrapper:         472   2.07359996E-02  ade,adi(0:linall)
INFO:python_subgrid.wrapper:Calculation of bathymetry statistics took:   0.5530D+00 seconds.
INFO:python_subgrid.wrapper:Setting initial water levels  from WaterLevelFile took:   0.0000D+00 seconds.
INFO:python_subgrid.wrapper:Initial floodfill from FloodFill file took:   0.0000D+00 seconds.
INFO:python_subgrid.wrapper:loadModel complete.

In [5]:
s1 = subgrid.get_nd('s1')

In [6]:
plt.plot(s1)


Out[6]:
[<matplotlib.lines.Line2D at 0x47cdc90>]

In [7]:
s1[s1.shape[0]//2:]+=1
subgrid.update(-1)
s1 = subgrid.get_nd('s1')
plt.plot(s1)


INFO:python_subgrid.wrapper:Start timestep-update.
DEBUG:python_subgrid.wrapper:Start initFlowAdmin, flow_init=              3
DEBUG:python_subgrid.wrapper:         472   2.07339991E-02  tables
DEBUG:python_subgrid.wrapper:         472   1.98759995E-02  tables
DEBUG:python_subgrid.wrapper:         472   1.98759995E-02  tables
DEBUG:python_subgrid.wrapper:         472   1.98759995E-02  tables
DEBUG:python_subgrid.wrapper:         472   2.07339991E-02  tables
DEBUG:python_subgrid.wrapper:         472   1.98759995E-02  tables
DEBUG:python_subgrid.wrapper:         472   1.98759995E-02  tables
DEBUG:python_subgrid.wrapper:         472   4.96899989E-03  tables
DEBUG:python_subgrid.wrapper:         472   4.96899989E-03  tables
DEBUG:python_subgrid.wrapper:         474   1.90759194      autb
DEBUG:python_subgrid.wrapper:         476   1.79662395      vltb
DEBUG:python_subgrid.wrapper:         481   5.18847990      vq1tb,dentb
INFO:python_subgrid.wrapper:Initialization of Flow Values took:   0.9000D-02 seconds.
DEBUG:python_subgrid.wrapper:         481   4.96899989E-03  ij(nodtot)
DEBUG:python_subgrid.wrapper:         481   4.96899989E-03  noel(nodtot)
DEBUG:python_subgrid.wrapper:         481   4.96899989E-03  noddgr(nodtot)
DEBUG:python_subgrid.wrapper:         481   4.96899989E-03  nodstk(nodtot)
DEBUG:python_subgrid.wrapper:         481   4.96899989E-03  row(nodtot)
DEBUG:python_subgrid.wrapper:         481   1.03669995E-02  ijl(lintot)
DEBUG:python_subgrid.wrapper:         481   4.96899989E-03  ia(nodtot)
INFO:python_subgrid.wrapper:reduce time:       0.044000
INFO:python_subgrid.wrapper: noactive=      4969 nogauss=      3116 nocg      1853
DEBUG:python_subgrid.wrapper:         481   4.96899989E-03  pk(nodtot)
DEBUG:python_subgrid.wrapper:         481   4.96899989E-03  rk(nodtot)
DEBUG:python_subgrid.wrapper:         481   4.96899989E-03  zk(nodtot)
DEBUG:python_subgrid.wrapper:         481   4.96899989E-03  apk(nodtot)
DEBUG:python_subgrid.wrapper:         481   2.36109998E-02  aij(ijtot)
DEBUG:python_subgrid.wrapper:         481   2.36109998E-02  aij0(ijtot)
DEBUG:python_subgrid.wrapper:         481   1.03669995E-02  aijl(lintot)
DEBUG:python_subgrid.wrapper:Completed initFlowAdmin.
INFO:python_subgrid.wrapper:Timestep 1 number of iterations 7 epsmax   0.0000E+00 idthalf 3  np = 1
INFO:python_subgrid.wrapper:Timestep complete.
Out[7]:
[<matplotlib.lines.Line2D at 0x3dc6e50>]

In [8]:
subgrid.update(-1)
s1 = subgrid.get_nd('s1')
plt.plot(s1)


INFO:python_subgrid.wrapper:Start timestep-update.
DEBUG:python_subgrid.wrapper:Start initFlowAdmin, flow_init=              0
INFO:python_subgrid.wrapper:Timestep 2 number of iterations 4 epsmax   0.0000E+00 idthalf 3  np = 1
INFO:python_subgrid.wrapper:Timestep complete.
Out[8]:
[<matplotlib.lines.Line2D at 0x5bc9ed0>]

In [ ]: