1 0 GfsRiver GfsBox GfsGEdge { x = 0.5 } {
    Global {
	#define LENGTH 21.
	#define WIDTH 5.75
	#define HEIGHT 0.2
	#define Q 1.
	#define HE 0.6
	#define G 9.81
    }
    Layers NL
    PhysicalParams { L = LENGTH g = G }
    Refine LEVEL
    InitMask {} (y < LENGTH*(0.5 - 1./pow(2,LEVEL)))
    Init {} {
	Zb = MAX(0., HEIGHT*(1. - 1./(WIDTH/2.)/(WIDTH/2.)*(x - 10.)*(x - 10.)))
	P = 0.6 - Zb
    }
    AdvectionParams { 
	# Sweby seems to oscillate in this case
#	gradient = gfs_center_sweby_gradient 
    }
    # Stop when stationary solution is reached
    EventStop { step = 1 } H 1e-3
    Time { end = 1000 }
    # uncomment this for on-the-fly animation
    # OutputSimulation { step = 0.1 } {
    # 	gfsplot "
    #       set term wxt noraise
    #       set xlabel 'x'
    #       set ylabel 'z'
    #       set xrange [0:21]
    #       set xtics 0,2,20
    #       set key bottom right
    #       plot '-' u (x):(Zb) t 'topography' w l, \
    #            '-' u (x):(H) w p t 'free surface'
    #     "
    # } { format = text }
    OutputLocation { start = end } { awk -v nl=NL -f uprof.awk > uprof-10-LEVEL-NL } 10. 10.49 0
    OutputLocation { start = end } { awk -v nl=NL -f uprof.awk > uprof-15-LEVEL-NL } 15. 10.49 0
    OutputLocation { start = end } { awk -v nl=NL -f uprof.awk > uprof-20-LEVEL-NL } 20. 10.49 0
    OutputSimulation { start = end } {
	awk '{ if ($1 != "#") print $1,$8; }' > prof-LEVEL-NL
    } { format = text }
    OutputSimulation { start = end } end-LEVEL-NL { format = text }
} {
    # vertical viscosity
    nu = 0.01
    # Gauckler-Manning-Strickler bottom friction, G = 9.81 m/s^2,
    # Strickler coefficient S = 25 m^(1/3)/s.
    k = (G/(25.*25.*pow(P,1./3.)))*Velocity
}
GfsBox {
    right = Boundary {
	# set water depth at outlet
	BcDirichlet P HE
	BcNeumann U 0
    }
    left = Boundary {
	# set flow rate at inlet, evenly distributed over all layers
	BcDirichlet U Q/NL
    }
}