!  DO NOT EDIT THIS FILE
!  But edit spaceparams.tmpl and/or makeincludes.F90
!  compile makeincludes.F90 and run the compilate
!  Compiling and running is taken care of by the Makefile
      case(  1)
        if(allocated(s%x)) deallocate(s%x)
        allocate(s%x(s%nx+1,s%ny+1))
      case(  2)
        if(allocated(s%y)) deallocate(s%y)
        allocate(s%y(s%nx+1,s%ny+1))
      case(  3)
        if(allocated(s%xz)) deallocate(s%xz)
        allocate(s%xz(s%nx+1,s%ny+1))
      case(  4)
        if(allocated(s%yz)) deallocate(s%yz)
        allocate(s%yz(s%nx+1,s%ny+1))
      case(  5)
        if(allocated(s%xu)) deallocate(s%xu)
        allocate(s%xu(s%nx+1,s%ny+1))
      case(  6)
        if(allocated(s%yu)) deallocate(s%yu)
        allocate(s%yu(s%nx+1,s%ny+1))
      case(  7)
        if(allocated(s%xv)) deallocate(s%xv)
        allocate(s%xv(s%nx+1,s%ny+1))
      case(  8)
        if(allocated(s%yv)) deallocate(s%yv)
        allocate(s%yv(s%nx+1,s%ny+1))
      case(  9)
        if(allocated(s%dsu)) deallocate(s%dsu)
        allocate(s%dsu(s%nx+1,s%ny+1))
      case( 10)
        if(allocated(s%dsv)) deallocate(s%dsv)
        allocate(s%dsv(s%nx+1,s%ny+1))
      case( 11)
        if(allocated(s%dsz)) deallocate(s%dsz)
        allocate(s%dsz(s%nx+1,s%ny+1))
      case( 12)
        if(allocated(s%dsc)) deallocate(s%dsc)
        allocate(s%dsc(s%nx+1,s%ny+1))
      case( 13)
        if(allocated(s%dnu)) deallocate(s%dnu)
        allocate(s%dnu(s%nx+1,s%ny+1))
      case( 14)
        if(allocated(s%dnv)) deallocate(s%dnv)
        allocate(s%dnv(s%nx+1,s%ny+1))
      case( 15)
        if(allocated(s%dnz)) deallocate(s%dnz)
        allocate(s%dnz(s%nx+1,s%ny+1))
      case( 16)
        if(allocated(s%dnc)) deallocate(s%dnc)
        allocate(s%dnc(s%nx+1,s%ny+1))
      case( 17)
        if(allocated(s%dsdnui)) deallocate(s%dsdnui)
        allocate(s%dsdnui(s%nx+1,s%ny+1))
      case( 18)
        if(allocated(s%dsdnvi)) deallocate(s%dsdnvi)
        allocate(s%dsdnvi(s%nx+1,s%ny+1))
      case( 19)
        if(allocated(s%dsdnzi)) deallocate(s%dsdnzi)
        allocate(s%dsdnzi(s%nx+1,s%ny+1))
      case( 20)
        if(allocated(s%alfaz)) deallocate(s%alfaz)
        allocate(s%alfaz(s%nx+1,s%ny+1))
      case( 21)
        if(allocated(s%alfau)) deallocate(s%alfau)
        allocate(s%alfau(s%nx+1,s%ny+1))
      case( 22)
        if(allocated(s%alfav)) deallocate(s%alfav)
        allocate(s%alfav(s%nx+1,s%ny+1))
      case( 23)
        if(allocated(s%sdist)) deallocate(s%sdist)
        allocate(s%sdist(s%nx+1,s%ny+1))
      case( 24)
        if(allocated(s%ndist)) deallocate(s%ndist)
        allocate(s%ndist(s%nx+1,s%ny+1))
      case( 39)
        if(allocated(s%xyzs01)) deallocate(s%xyzs01)
        allocate(s%xyzs01(2))
      case( 40)
        if(allocated(s%xyzs02)) deallocate(s%xyzs02)
        allocate(s%xyzs02(2))
      case( 41)
        if(allocated(s%xyzs03)) deallocate(s%xyzs03)
        allocate(s%xyzs03(2))
      case( 42)
        if(allocated(s%xyzs04)) deallocate(s%xyzs04)
        allocate(s%xyzs04(2))
      case( 45)
        if(allocated(s%zb)) deallocate(s%zb)
        allocate(s%zb(s%nx+1,s%ny+1))
      case( 46)
        if(allocated(s%zb0)) deallocate(s%zb0)
        allocate(s%zb0(s%nx+1,s%ny+1))
      case( 47)
        if(allocated(s%theta)) deallocate(s%theta)
        allocate(s%theta(s%ntheta))
      case( 48)
        if(allocated(s%theta_s)) deallocate(s%theta_s)
        allocate(s%theta_s(s%ntheta_s))
      case( 54)
        if(allocated(s%thetamean)) deallocate(s%thetamean)
        allocate(s%thetamean(s%nx+1,s%ny+1))
      case( 55)
        if(allocated(s%Fx)) deallocate(s%Fx)
        allocate(s%Fx(s%nx+1,s%ny+1))
      case( 56)
        if(allocated(s%Fy)) deallocate(s%Fy)
        allocate(s%Fy(s%nx+1,s%ny+1))
      case( 57)
        if(allocated(s%Sxy)) deallocate(s%Sxy)
        allocate(s%Sxy(s%nx+1,s%ny+1))
      case( 58)
        if(allocated(s%Syy)) deallocate(s%Syy)
        allocate(s%Syy(s%nx+1,s%ny+1))
      case( 59)
        if(allocated(s%Sxx)) deallocate(s%Sxx)
        allocate(s%Sxx(s%nx+1,s%ny+1))
      case( 60)
        if(allocated(s%n)) deallocate(s%n)
        allocate(s%n(s%nx+1,s%ny+1))
      case( 61)
        if(allocated(s%H)) deallocate(s%H)
        allocate(s%H(s%nx+1,s%ny+1))
      case( 62)
        if(allocated(s%cgx)) deallocate(s%cgx)
        allocate(s%cgx(s%nx+1,s%ny+1,s%ntheta))
      case( 63)
        if(allocated(s%cgy)) deallocate(s%cgy)
        allocate(s%cgy(s%nx+1,s%ny+1,s%ntheta))
      case( 64)
        if(allocated(s%cx)) deallocate(s%cx)
        allocate(s%cx(s%nx+1,s%ny+1,s%ntheta))
      case( 65)
        if(allocated(s%cy)) deallocate(s%cy)
        allocate(s%cy(s%nx+1,s%ny+1,s%ntheta))
      case( 66)
        if(allocated(s%ctheta)) deallocate(s%ctheta)
        allocate(s%ctheta(s%nx+1,s%ny+1,s%ntheta))
      case( 67)
        if(allocated(s%ee)) deallocate(s%ee)
        allocate(s%ee(s%nx+1,s%ny+1,s%ntheta))
      case( 68)
        if(allocated(s%thet)) deallocate(s%thet)
        allocate(s%thet(s%nx+1,s%ny+1,s%ntheta))
      case( 69)
        if(allocated(s%costh)) deallocate(s%costh)
        allocate(s%costh(s%nx+1,s%ny+1,s%ntheta))
      case( 70)
        if(allocated(s%sinth)) deallocate(s%sinth)
        allocate(s%sinth(s%nx+1,s%ny+1,s%ntheta))
      case( 71)
        if(allocated(s%sigt)) deallocate(s%sigt)
        allocate(s%sigt(s%nx+1,s%ny+1,s%ntheta))
      case( 72)
        if(allocated(s%rr)) deallocate(s%rr)
        allocate(s%rr(s%nx+1,s%ny+1,s%ntheta))
      case( 73)
        if(allocated(s%cgx_s)) deallocate(s%cgx_s)
        allocate(s%cgx_s(s%nx+1,s%ny+1,s%ntheta_s))
      case( 74)
        if(allocated(s%cgy_s)) deallocate(s%cgy_s)
        allocate(s%cgy_s(s%nx+1,s%ny+1,s%ntheta_s))
      case( 75)
        if(allocated(s%ctheta_s)) deallocate(s%ctheta_s)
        allocate(s%ctheta_s(s%nx+1,s%ny+1,s%ntheta_s))
      case( 76)
        if(allocated(s%ee_s)) deallocate(s%ee_s)
        allocate(s%ee_s(s%nx+1,s%ny+1,s%ntheta_s))
      case( 77)
        if(allocated(s%thet_s)) deallocate(s%thet_s)
        allocate(s%thet_s(s%nx+1,s%ny+1,s%ntheta_s))
      case( 78)
        if(allocated(s%costh_s)) deallocate(s%costh_s)
        allocate(s%costh_s(s%nx+1,s%ny+1,s%ntheta_s))
      case( 79)
        if(allocated(s%sinth_s)) deallocate(s%sinth_s)
        allocate(s%sinth_s(s%nx+1,s%ny+1,s%ntheta_s))
      case( 80)
        if(allocated(s%k)) deallocate(s%k)
        allocate(s%k(s%nx+1,s%ny+1))
      case( 81)
        if(allocated(s%c)) deallocate(s%c)
        allocate(s%c(s%nx+1,s%ny+1))
      case( 82)
        if(allocated(s%cg)) deallocate(s%cg)
        allocate(s%cg(s%nx+1,s%ny+1))
      case( 83)
        if(allocated(s%sigm)) deallocate(s%sigm)
        allocate(s%sigm(s%nx+1,s%ny+1))
      case( 84)
        if(allocated(s%wm)) deallocate(s%wm)
        allocate(s%wm(s%nx+1,s%ny+1))
      case( 85)
        if(allocated(s%hh)) deallocate(s%hh)
        allocate(s%hh(s%nx+1,s%ny+1))
      case( 86)
        if(allocated(s%zs)) deallocate(s%zs)
        allocate(s%zs(s%nx+1,s%ny+1))
      case( 87)
        if(allocated(s%zs0)) deallocate(s%zs0)
        allocate(s%zs0(s%nx+1,s%ny+1))
      case( 88)
        if(allocated(s%tideinpt)) deallocate(s%tideinpt)
        allocate(s%tideinpt(s%tidelen))
      case( 89)
        if(allocated(s%tideinpz)) deallocate(s%tideinpz)
        allocate(s%tideinpz(s%tidelen,par%tideloc))
      case( 90)
        if(allocated(s%windinpt)) deallocate(s%windinpt)
        allocate(s%windinpt(s%windlen))
      case( 91)
        if(allocated(s%windvelts)) deallocate(s%windvelts)
        allocate(s%windvelts(s%windlen))
      case( 92)
        if(allocated(s%winddirts)) deallocate(s%winddirts)
        allocate(s%winddirts(s%windlen))
      case( 93)
        if(allocated(s%windxts)) deallocate(s%windxts)
        allocate(s%windxts(s%windlen))
      case( 94)
        if(allocated(s%windyts)) deallocate(s%windyts)
        allocate(s%windyts(s%windlen))
      case( 95)
        if(allocated(s%windsu)) deallocate(s%windsu)
        allocate(s%windsu(s%nx+1,s%ny+1))
      case( 96)
        if(allocated(s%windnv)) deallocate(s%windnv)
        allocate(s%windnv(s%nx+1,s%ny+1))
      case( 97)
        if(allocated(s%dzsdt)) deallocate(s%dzsdt)
        allocate(s%dzsdt(s%nx+1,s%ny+1))
      case( 98)
        if(allocated(s%dzsdx)) deallocate(s%dzsdx)
        allocate(s%dzsdx(s%nx+1,s%ny+1))
      case( 99)
        if(allocated(s%dzsdy)) deallocate(s%dzsdy)
        allocate(s%dzsdy(s%nx+1,s%ny+1))
      case(100)
        if(allocated(s%dzbdx)) deallocate(s%dzbdx)
        allocate(s%dzbdx(s%nx+1,s%ny+1))
      case(101)
        if(allocated(s%dzbdy)) deallocate(s%dzbdy)
        allocate(s%dzbdy(s%nx+1,s%ny+1))
      case(102)
        if(allocated(s%dzbdt)) deallocate(s%dzbdt)
        allocate(s%dzbdt(s%nx+1,s%ny+1))
      case(103)
        if(allocated(s%dzbnow)) deallocate(s%dzbnow)
        allocate(s%dzbnow(s%nx+1,s%ny+1))
      case(104)
        if(allocated(s%uu)) deallocate(s%uu)
        allocate(s%uu(s%nx+1,s%ny+1))
      case(105)
        if(allocated(s%vu)) deallocate(s%vu)
        allocate(s%vu(s%nx+1,s%ny+1))
      case(106)
        if(allocated(s%uv)) deallocate(s%uv)
        allocate(s%uv(s%nx+1,s%ny+1))
      case(107)
        if(allocated(s%vv)) deallocate(s%vv)
        allocate(s%vv(s%nx+1,s%ny+1))
      case(108)
        if(allocated(s%qx)) deallocate(s%qx)
        allocate(s%qx(s%nx+1,s%ny+1))
      case(109)
        if(allocated(s%qy)) deallocate(s%qy)
        allocate(s%qy(s%nx+1,s%ny+1))
      case(110)
        if(allocated(s%sedero)) deallocate(s%sedero)
        allocate(s%sedero(s%nx+1,s%ny+1))
      case(111)
        if(allocated(s%dcbdx)) deallocate(s%dcbdx)
        allocate(s%dcbdx(s%nx+1,s%ny+1))
      case(112)
        if(allocated(s%dcbdy)) deallocate(s%dcbdy)
        allocate(s%dcbdy(s%nx+1,s%ny+1))
      case(113)
        if(allocated(s%dcsdx)) deallocate(s%dcsdx)
        allocate(s%dcsdx(s%nx+1,s%ny+1))
      case(114)
        if(allocated(s%dcsdy)) deallocate(s%dcsdy)
        allocate(s%dcsdy(s%nx+1,s%ny+1))
      case(115)
        if(allocated(s%ui)) deallocate(s%ui)
        allocate(s%ui(s%nx+1,s%ny+1))
      case(116)
        if(allocated(s%vi)) deallocate(s%vi)
        allocate(s%vi(s%nx+1,s%ny+1))
      case(117)
        if(allocated(s%E)) deallocate(s%E)
        allocate(s%E(s%nx+1,s%ny+1))
      case(118)
        if(allocated(s%R)) deallocate(s%R)
        allocate(s%R(s%nx+1,s%ny+1))
      case(119)
        if(allocated(s%urms)) deallocate(s%urms)
        allocate(s%urms(s%nx+1,s%ny+1))
      case(120)
        if(allocated(s%D)) deallocate(s%D)
        allocate(s%D(s%nx+1,s%ny+1))
      case(121)
        if(allocated(s%Qb)) deallocate(s%Qb)
        allocate(s%Qb(s%nx+1,s%ny+1))
      case(122)
        if(allocated(s%ust)) deallocate(s%ust)
        allocate(s%ust(s%nx+1,s%ny+1))
      case(123)
        if(allocated(s%ueu)) deallocate(s%ueu)
        allocate(s%ueu(s%nx+1,s%ny+1))
      case(124)
        if(allocated(s%vev)) deallocate(s%vev)
        allocate(s%vev(s%nx+1,s%ny+1))
      case(125)
        if(allocated(s%vmagu)) deallocate(s%vmagu)
        allocate(s%vmagu(s%nx+1,s%ny+1))
      case(126)
        if(allocated(s%vmageu)) deallocate(s%vmageu)
        allocate(s%vmageu(s%nx+1,s%ny+1))
      case(127)
        if(allocated(s%vmagv)) deallocate(s%vmagv)
        allocate(s%vmagv(s%nx+1,s%ny+1))
      case(128)
        if(allocated(s%vmagev)) deallocate(s%vmagev)
        allocate(s%vmagev(s%nx+1,s%ny+1))
      case(129)
        if(allocated(s%u)) deallocate(s%u)
        allocate(s%u(s%nx+1,s%ny+1))
      case(130)
        if(allocated(s%v)) deallocate(s%v)
        allocate(s%v(s%nx+1,s%ny+1))
      case(131)
        if(allocated(s%ue)) deallocate(s%ue)
        allocate(s%ue(s%nx+1,s%ny+1))
      case(132)
        if(allocated(s%ve)) deallocate(s%ve)
        allocate(s%ve(s%nx+1,s%ny+1))
      case(133)
        if(allocated(s%hold)) deallocate(s%hold)
        allocate(s%hold(s%nx+1,s%ny+1))
      case(134)
        if(allocated(s%wetu)) deallocate(s%wetu)
        allocate(s%wetu(s%nx+1,s%ny+1))
      case(135)
        if(allocated(s%wetv)) deallocate(s%wetv)
        allocate(s%wetv(s%nx+1,s%ny+1))
      case(136)
        if(allocated(s%wetz)) deallocate(s%wetz)
        allocate(s%wetz(s%nx+1,s%ny+1))
      case(137)
        if(allocated(s%wete)) deallocate(s%wete)
        allocate(s%wete(s%nx+1,s%ny+1))
      case(138)
        if(allocated(s%hu)) deallocate(s%hu)
        allocate(s%hu(s%nx+1,s%ny+1))
      case(139)
        if(allocated(s%hv)) deallocate(s%hv)
        allocate(s%hv(s%nx+1,s%ny+1))
      case(140)
        if(allocated(s%hum)) deallocate(s%hum)
        allocate(s%hum(s%nx+1,s%ny+1))
      case(141)
        if(allocated(s%hvm)) deallocate(s%hvm)
        allocate(s%hvm(s%nx+1,s%ny+1))
      case(142)
        if(allocated(s%vmag)) deallocate(s%vmag)
        allocate(s%vmag(s%nx+1,s%ny+1))
      case(143)
        if(allocated(s%ccg)) deallocate(s%ccg)
        allocate(s%ccg(s%nx+1,s%ny+1,par%ngd))
      case(144)
        if(allocated(s%uwf)) deallocate(s%uwf)
        allocate(s%uwf(s%nx+1,s%ny+1))
      case(145)
        if(allocated(s%vwf)) deallocate(s%vwf)
        allocate(s%vwf(s%nx+1,s%ny+1))
      case(146)
        if(allocated(s%ustr)) deallocate(s%ustr)
        allocate(s%ustr(s%nx+1,s%ny+1))
      case(147)
        if(allocated(s%usd)) deallocate(s%usd)
        allocate(s%usd(s%nx+1,s%ny+1))
      case(148)
        if(allocated(s%bi)) deallocate(s%bi)
        allocate(s%bi(s%ny+1))
      case(149)
        if(allocated(s%DR)) deallocate(s%DR)
        allocate(s%DR(s%nx+1,s%ny+1))
      case(150)
        if(allocated(s%umean)) deallocate(s%umean)
        allocate(s%umean(s%nx+1,s%ny+1))
      case(151)
        if(allocated(s%vmean)) deallocate(s%vmean)
        allocate(s%vmean(s%nx+1,s%ny+1))
      case(152)
        if(allocated(s%ur)) deallocate(s%ur)
        allocate(s%ur(s%nx+1,s%ny+1))
      case(154)
        if(allocated(s%D15)) deallocate(s%D15)
        allocate(s%D15(par%ngd))
      case(155)
        if(allocated(s%D50)) deallocate(s%D50)
        allocate(s%D50(par%ngd))
      case(156)
        if(allocated(s%D90)) deallocate(s%D90)
        allocate(s%D90(par%ngd))
      case(157)
        if(allocated(s%sedcal)) deallocate(s%sedcal)
        allocate(s%sedcal(par%ngd))
      case(158)
        if(allocated(s%ucrcal)) deallocate(s%ucrcal)
        allocate(s%ucrcal(par%ngd))
      case(159)
        if(allocated(s%Tsg)) deallocate(s%Tsg)
        allocate(s%Tsg(s%nx+1,s%ny+1,par%ngd))
      case(160)
        if(allocated(s%Susg)) deallocate(s%Susg)
        allocate(s%Susg(s%nx+1,s%ny+1,par%ngd))
      case(161)
        if(allocated(s%Svsg)) deallocate(s%Svsg)
        allocate(s%Svsg(s%nx+1,s%ny+1,par%ngd))
      case(162)
        if(allocated(s%Subg)) deallocate(s%Subg)
        allocate(s%Subg(s%nx+1,s%ny+1,par%ngd))
      case(163)
        if(allocated(s%Svbg)) deallocate(s%Svbg)
        allocate(s%Svbg(s%nx+1,s%ny+1,par%ngd))
      case(164)
        if(allocated(s%ceqbg)) deallocate(s%ceqbg)
        allocate(s%ceqbg(s%nx+1,s%ny+1,par%ngd))
      case(165)
        if(allocated(s%ceqsg)) deallocate(s%ceqsg)
        allocate(s%ceqsg(s%nx+1,s%ny+1,par%ngd))
      case(166)
        if(allocated(s%ua)) deallocate(s%ua)
        allocate(s%ua(s%nx+1,s%ny+1))
      case(167)
        if(allocated(s%BR)) deallocate(s%BR)
        allocate(s%BR(s%nx+1,s%ny+1))
      case(168)
        if(allocated(s%kb)) deallocate(s%kb)
        allocate(s%kb(s%nx+1,s%ny+1))
      case(169)
        if(allocated(s%Tbore)) deallocate(s%Tbore)
        allocate(s%Tbore(s%nx+1,s%ny+1))
      case(170)
        if(allocated(s%dzav)) deallocate(s%dzav)
        allocate(s%dzav(s%nx+1,s%ny+1))
      case(171)
        if(allocated(s%maxzs)) deallocate(s%maxzs)
        allocate(s%maxzs(s%nx+1,s%ny+1))
      case(172)
        if(allocated(s%minzs)) deallocate(s%minzs)
        allocate(s%minzs(s%nx+1,s%ny+1))
      case(173)
        if(allocated(s%L1)) deallocate(s%L1)
        allocate(s%L1(s%nx+1,s%ny+1))
      case(174)
        if(allocated(s%Sk)) deallocate(s%Sk)
        allocate(s%Sk(s%nx+1,s%ny+1))
      case(175)
        if(allocated(s%As)) deallocate(s%As)
        allocate(s%As(s%nx+1,s%ny+1))
      case(176)
        if(allocated(s%gwhead)) deallocate(s%gwhead)
        allocate(s%gwhead(s%nx+1,s%ny+1))
      case(177)
        if(allocated(s%gwheadb)) deallocate(s%gwheadb)
        allocate(s%gwheadb(s%nx+1,s%ny+1))
      case(178)
        if(allocated(s%gwlevel)) deallocate(s%gwlevel)
        allocate(s%gwlevel(s%nx+1,s%ny+1))
      case(179)
        if(allocated(s%gwheight)) deallocate(s%gwheight)
        allocate(s%gwheight(s%nx+1,s%ny+1))
      case(180)
        if(allocated(s%gwbottom)) deallocate(s%gwbottom)
        allocate(s%gwbottom(s%nx+1,s%ny+1))
      case(181)
        if(allocated(s%gwu)) deallocate(s%gwu)
        allocate(s%gwu(s%nx+1,s%ny+1))
      case(182)
        if(allocated(s%gwv)) deallocate(s%gwv)
        allocate(s%gwv(s%nx+1,s%ny+1))
      case(183)
        if(allocated(s%gwqx)) deallocate(s%gwqx)
        allocate(s%gwqx(s%nx+1,s%ny+1))
      case(184)
        if(allocated(s%gwqy)) deallocate(s%gwqy)
        allocate(s%gwqy(s%nx+1,s%ny+1))
      case(185)
        if(allocated(s%gww)) deallocate(s%gww)
        allocate(s%gww(s%nx+1,s%ny+1))
      case(186)
        if(allocated(s%gwcurv)) deallocate(s%gwcurv)
        allocate(s%gwcurv(s%nx+1,s%ny+1))
      case(187)
        if(allocated(s%dinfil)) deallocate(s%dinfil)
        allocate(s%dinfil(s%nx+1,s%ny+1))
      case(188)
        if(allocated(s%infil)) deallocate(s%infil)
        allocate(s%infil(s%nx+1,s%ny+1))
      case(189)
        if(allocated(s%gw0back)) deallocate(s%gw0back)
        allocate(s%gw0back(2,s%ny+1))
      case(190)
        if(allocated(s%kturb)) deallocate(s%kturb)
        allocate(s%kturb(s%nx+1,s%ny+1))
      case(191)
        if(allocated(s%ero)) deallocate(s%ero)
        allocate(s%ero(s%nx+1,s%ny+1,par%ngd))
      case(192)
        if(allocated(s%depo_im)) deallocate(s%depo_im)
        allocate(s%depo_im(s%nx+1,s%ny+1,par%ngd))
      case(193)
        if(allocated(s%depo_ex)) deallocate(s%depo_ex)
        allocate(s%depo_ex(s%nx+1,s%ny+1,par%ngd))
      case(194)
        if(allocated(s%nd)) deallocate(s%nd)
        allocate(s%nd(s%nx+1,s%ny+1))
      case(195)
        if(allocated(s%pbbed)) deallocate(s%pbbed)
        allocate(s%pbbed(s%nx+1,s%ny+1,par%nd,par%ngd))
      case(196)
        if(allocated(s%dzbed)) deallocate(s%dzbed)
        allocate(s%dzbed(s%nx+1,s%ny+1,par%nd))
      case(197)
        if(allocated(s%z0bed)) deallocate(s%z0bed)
        allocate(s%z0bed(s%nx+1,s%ny+1))
      case(198)
        if(allocated(s%ureps)) deallocate(s%ureps)
        allocate(s%ureps(s%nx+1,s%ny+1))
      case(199)
        if(allocated(s%vreps)) deallocate(s%vreps)
        allocate(s%vreps(s%nx+1,s%ny+1))
      case(200)
        if(allocated(s%urepb)) deallocate(s%urepb)
        allocate(s%urepb(s%nx+1,s%ny+1))
      case(201)
        if(allocated(s%vrepb)) deallocate(s%vrepb)
        allocate(s%vrepb(s%nx+1,s%ny+1))
      case(202)
        if(allocated(s%umwci)) deallocate(s%umwci)
        allocate(s%umwci(s%nx+1,s%ny+1))
      case(203)
        if(allocated(s%vmwci)) deallocate(s%vmwci)
        allocate(s%vmwci(s%nx+1,s%ny+1))
      case(204)
        if(allocated(s%rolthick)) deallocate(s%rolthick)
        allocate(s%rolthick(s%nx+1,s%ny+1))
      case(205)
        if(allocated(s%zswci)) deallocate(s%zswci)
        allocate(s%zswci(s%nx+1,s%ny+1))
      case(206)
        if(allocated(s%pres)) deallocate(s%pres)
        allocate(s%pres(s%nx+1,s%ny+1))
      case(207)
        if(allocated(s%dU)) deallocate(s%dU)
        allocate(s%dU(s%nx+1,s%ny+1))
      case(208)
        if(allocated(s%dV)) deallocate(s%dV)
        allocate(s%dV(s%nx+1,s%ny+1))
      case(209)
        if(allocated(s%wb)) deallocate(s%wb)
        allocate(s%wb(s%nx+1,s%ny+1))
      case(210)
        if(allocated(s%ws)) deallocate(s%ws)
        allocate(s%ws(s%nx+1,s%ny+1))
      case(211)
        if(allocated(s%wscrit)) deallocate(s%wscrit)
        allocate(s%wscrit(s%nx+1,s%ny+1))
      case(212)
        if(allocated(s%bedfriccoef)) deallocate(s%bedfriccoef)
        allocate(s%bedfriccoef(s%nx+1,s%ny+1))
      case(213)
        if(allocated(s%taubx)) deallocate(s%taubx)
        allocate(s%taubx(s%nx+1,s%ny+1))
      case(214)
        if(allocated(s%tauby)) deallocate(s%tauby)
        allocate(s%tauby(s%nx+1,s%ny+1))
      case(215)
        if(allocated(s%Df)) deallocate(s%Df)
        allocate(s%Df(s%nx+1,s%ny+1))
      case(216)
        if(allocated(s%Dp)) deallocate(s%Dp)
        allocate(s%Dp(s%nx+1,s%ny+1))
      case(217)
        if(allocated(s%Sutot)) deallocate(s%Sutot)
        allocate(s%Sutot(s%nx+1,s%ny+1))
      case(218)
        if(allocated(s%Svtot)) deallocate(s%Svtot)
        allocate(s%Svtot(s%nx+1,s%ny+1))
      case(219)
        if(allocated(s%cctot)) deallocate(s%cctot)
        allocate(s%cctot(s%nx+1,s%ny+1))
      case(220)
        if(allocated(s%wi)) deallocate(s%wi)
        allocate(s%wi(2,s%ny+1))
      case(221)
        if(allocated(s%dUi)) deallocate(s%dUi)
        allocate(s%dUi(2,s%ny+1))
      case(222)
        if(allocated(s%zi)) deallocate(s%zi)
        allocate(s%zi(2,s%ny+1))
      case(223)
        if(allocated(s%nuh)) deallocate(s%nuh)
        allocate(s%nuh(s%nx+1,s%ny+1))
      case(224)
        if(allocated(s%cf)) deallocate(s%cf)
        allocate(s%cf(s%nx+1,s%ny+1))
      case(225)
        if(allocated(s%cfu)) deallocate(s%cfu)
        allocate(s%cfu(s%nx+1,s%ny+1))
      case(226)
        if(allocated(s%cfv)) deallocate(s%cfv)
        allocate(s%cfv(s%nx+1,s%ny+1))
      case(227)
        if(allocated(s%D50top)) deallocate(s%D50top)
        allocate(s%D50top(s%nx+1,s%ny+1))
      case(228)
        if(allocated(s%D90top)) deallocate(s%D90top)
        allocate(s%D90top(s%nx+1,s%ny+1))
      case(229)
        if(allocated(s%structdepth)) deallocate(s%structdepth)
        allocate(s%structdepth(s%nx+1,s%ny+1))
      case(230)
        if(allocated(s%zs0fac)) deallocate(s%zs0fac)
        allocate(s%zs0fac(s%nx+1,s%ny+1,2))
      case(231)
        if(allocated(s%tdisch)) deallocate(s%tdisch)
        allocate(s%tdisch(par%ntdischarge))
      case(232)
        if(allocated(s%pdisch)) deallocate(s%pdisch)
        allocate(s%pdisch(par%ndischarge,4))
      case(233)
        if(allocated(s%pntdisch)) deallocate(s%pntdisch)
        allocate(s%pntdisch(par%ndischarge))
      case(234)
        if(allocated(s%qdisch)) deallocate(s%qdisch)
        allocate(s%qdisch(par%ntdischarge,par%ndischarge))
      case(235)
        if(allocated(s%idrift)) deallocate(s%idrift)
        allocate(s%idrift(par%ndrifter))
      case(236)
        if(allocated(s%jdrift)) deallocate(s%jdrift)
        allocate(s%jdrift(par%ndrifter))
      case(237)
        if(allocated(s%tdriftb)) deallocate(s%tdriftb)
        allocate(s%tdriftb(par%ndrifter))
      case(238)
        if(allocated(s%tdrifte)) deallocate(s%tdrifte)
        allocate(s%tdrifte(par%ndrifter))
      case(239)
        if(allocated(s%runup)) deallocate(s%runup)
        allocate(s%runup(s%ny+1))
      case(240)
        if(allocated(s%Hrunup)) deallocate(s%Hrunup)
        allocate(s%Hrunup(s%ny+1))
      case(241)
        if(allocated(s%xHrunup)) deallocate(s%xHrunup)
        allocate(s%xHrunup(s%ny+1))
      case(242)
        if(allocated(s%istruct)) deallocate(s%istruct)
        allocate(s%istruct(s%ny+1))
      case(243)
        if(allocated(s%iwl)) deallocate(s%iwl)
        allocate(s%iwl(s%ny+1))
      case(244)
        if(allocated(s%strucslope)) deallocate(s%strucslope)
        allocate(s%strucslope(s%ny+1))
      case(245)
        if(allocated(s%Dc)) deallocate(s%Dc)
        allocate(s%Dc(s%nx+1,s%ny+1))
      case(246)
        if(allocated(s%ph)) deallocate(s%ph)
        allocate(s%ph(s%nx+1,s%ny+1))
      case(248)
        if(allocated(s%dobs)) deallocate(s%dobs)
        allocate(s%dobs(s%nx+1,s%ny+1))
      case(249)
        if(allocated(s%sig2prior)) deallocate(s%sig2prior)
        allocate(s%sig2prior(s%nx+1,s%ny+1))
      case(250)
        if(allocated(s%zbobs)) deallocate(s%zbobs)
        allocate(s%zbobs(s%nx+1,s%ny+1))
      case(251)
        if(allocated(s%shobs)) deallocate(s%shobs)
        allocate(s%shobs(s%nx+1,s%ny+1))
      case(252)
        if(allocated(s%bwalpha)) deallocate(s%bwalpha)
        allocate(s%bwalpha(s%nx+1,s%ny+1))
      case(253)
        if(allocated(s%dcmdo)) deallocate(s%dcmdo)
        allocate(s%dcmdo(s%nx+1,s%ny+1))
      case(254)
        if(allocated(s%dassim)) deallocate(s%dassim)
        allocate(s%dassim(s%nx+1,s%ny+1))
      case(255)
        if(allocated(s%cobs)) deallocate(s%cobs)
        allocate(s%cobs(s%nx+1,s%ny+1))
      case(256)
        if(allocated(s%shipxCG)) deallocate(s%shipxCG)
        allocate(s%shipxCG(par%nship))
      case(257)
        if(allocated(s%shipyCG)) deallocate(s%shipyCG)
        allocate(s%shipyCG(par%nship))
      case(258)
        if(allocated(s%shipzCG)) deallocate(s%shipzCG)
        allocate(s%shipzCG(par%nship))
      case(259)
        if(allocated(s%shipFx)) deallocate(s%shipFx)
        allocate(s%shipFx(par%nship))
      case(260)
        if(allocated(s%shipFy)) deallocate(s%shipFy)
        allocate(s%shipFy(par%nship))
      case(261)
        if(allocated(s%shipFz)) deallocate(s%shipFz)
        allocate(s%shipFz(par%nship))
      case(262)
        if(allocated(s%shipMx)) deallocate(s%shipMx)
        allocate(s%shipMx(par%nship))
      case(263)
        if(allocated(s%shipMy)) deallocate(s%shipMy)
        allocate(s%shipMy(par%nship))
      case(264)
        if(allocated(s%shipMz)) deallocate(s%shipMz)
        allocate(s%shipMz(par%nship))
      case(265)
        if(allocated(s%shipphi)) deallocate(s%shipphi)
        allocate(s%shipphi(par%nship))
      case(266)
        if(allocated(s%shipchi)) deallocate(s%shipchi)
        allocate(s%shipchi(par%nship))
      case(267)
        if(allocated(s%shippsi)) deallocate(s%shippsi)
        allocate(s%shippsi(par%nship))
      case(268)
        if(allocated(s%Dveg)) deallocate(s%Dveg)
        allocate(s%Dveg(s%nx+1,s%ny+1))
      case(269)
        if(allocated(s%Fvegu)) deallocate(s%Fvegu)
        allocate(s%Fvegu(s%nx+1,s%ny+1))
      case(270)
        if(allocated(s%Fvegv)) deallocate(s%Fvegv)
        allocate(s%Fvegv(s%nx+1,s%ny+1))
      case(271)
        if(allocated(s%ududx)) deallocate(s%ududx)
        allocate(s%ududx(s%nx+1,s%ny+1))
      case(272)
        if(allocated(s%vdvdy)) deallocate(s%vdvdy)
        allocate(s%vdvdy(s%nx+1,s%ny+1))
      case(273)
        if(allocated(s%udvdx)) deallocate(s%udvdx)
        allocate(s%udvdx(s%nx+1,s%ny+1))
      case(274)
        if(allocated(s%vdudy)) deallocate(s%vdudy)
        allocate(s%vdudy(s%nx+1,s%ny+1))
      case(275)
        if(allocated(s%viscu)) deallocate(s%viscu)
        allocate(s%viscu(s%nx+1,s%ny+1))
      case(276)
        if(allocated(s%viscv)) deallocate(s%viscv)
        allocate(s%viscv(s%nx+1,s%ny+1))
      case(277)
        if(allocated(s%setbathy)) deallocate(s%setbathy)
        allocate(s%setbathy(s%nx+1,s%ny+1,par%nsetbathy))
      case(278)
        if(allocated(s%tsetbathy)) deallocate(s%tsetbathy)
        allocate(s%tsetbathy(par%nsetbathy))
      case(279)
        if(allocated(s%breaking)) deallocate(s%breaking)
        allocate(s%breaking(s%nx+1,s%ny+1))
!directions for vi vim: filetype=fortran : syntax=fortran
