1 0 GfsWave GfsBox GfsGEdge {} {
    Refine 6

    # Default time units for wave model is hours
    # 120 hours = 5 days
    Time { end = 120 }

    # Default length units for wave model is km
    PhysicalParams { L = 5000 }

    # Define some useful functions
    Global {
        /* gaussian distribution */
        static double gaussian (double f, double fmean, double fsigma) {
            return exp (-((f - fmean)*(f - fmean))/(2.*fsigma*fsigma));
        }
        /* cos(theta)^n distribution */
        static double costheta (double theta, double thetam, double thetapower) {
            double a = cos (theta - thetam);
            return a > 0. ? pow (a, thetapower) : 0.;
        }
    }

    # Initialise the wave spectrum
    InitWave {} {
        /* This function defines the spectral distribution:
         * a gaussian in frequency space and 
         * a cos(theta)^2 distribution in direction space 
	 */
        return gaussian (Frequency, 0.1, 0.02)*
               costheta (Direction, 30.*M_PI/180., 2.);
    } {
        /* This function defines the significant wave height:
         * the energy is a gaussian bump in (x,y) space,
         * the maximum significant wave height is 2.5 
	 */
        x -= -2000.;
        y -= -2000.;
        double Hsmax = 2.5;
        double E = (Hsmax*Hsmax/16.)*gaussian (sqrt (x*x + y*y), 0., 150.);
        return 4.*sqrt (E);
    }

    AdaptGradient { istep = 1 } { cmax = 0.04 minlevel = MINLEVEL maxlevel = 6 } Hs

    OutputTime { istep = 1 } log-MINLEVEL-NTHETA
    OutputScalarStats { step = 12 } hs-MINLEVEL-NTHETA { v = Hs }
    OutputSimulation { step = 12 } sim-MINLEVEL-NTHETA-%g.gfs
    EventScript { step = 12 } { gzip -f sim-*-*-*.gfs }
    OutputSimulation { start = end } end-MINLEVEL-NTHETA.gfs    
    EventScript { start = end } { gzip -f end-*-*.gfs }
    OutputPPM { step = 12 } { ppm2mpeg > hs-MINLEVEL-NTHETA.mpg } { v = Hs maxlevel = 7 }
} {
    # Number of discretised directions (default is 24)
    ntheta = NTHETA
}
GfsBox {}