1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180
  
     | 
    
      # Title: Cyclone-generated wave field
#
# Description:
#
# The wave model is used to simulate the evolution of the wave field
# generated by a model cyclone. See Popinet et al, 2009, Ocean
# Modelling for a detailed description.
#
# The simulation domain is $3328\times 3328$ km and the evolution is
# simulated for 48 hours, during which the maximum wind velocity
# increases from 0 to 50 m/s.
#
# The evolution of the significant wave height and corresponding
# adaptive mesh is illustrated in Figure \ref{hs}. The maximum
# significant wave height and wind speed evolutions are illustrated in
# Figure \ref{hsmax}.
#
# Interestingly the extrema of significant wave height are shifted
# compared to the wind speed extrema (Figure \ref{shifted}). This
# shift has also been observed in real cyclone-generated wave fields.
#
# \begin{figure}
# \caption{\label{hs}Evolution of the significant wave height (left
# column) and adaptive mesh (right column).}
# \begin{center}
# \begin{tabular}{cc}
# \includegraphics*[width=0.45\hsize]{hs-12.eps} &
# \includegraphics*[width=0.45\hsize]{mesh-12.eps} \\
# \multicolumn{2}{c}{$t=12$ hours} \\
# \\
# \includegraphics*[width=0.45\hsize]{hs-24.eps} &
# \includegraphics*[width=0.45\hsize]{mesh-24.eps} \\
# \multicolumn{2}{c}{$t=24$ hours} \\
# \\
# \includegraphics*[width=0.45\hsize]{hs-36.eps} &
# \includegraphics*[width=0.45\hsize]{mesh-36.eps} \\
# \multicolumn{2}{c}{$t=36$ hours} \\
# \\
# \includegraphics*[width=0.45\hsize]{hs-48.eps} &
# \includegraphics*[width=0.45\hsize]{mesh-48.eps} \\
# \multicolumn{2}{c}{$t=48$ hours}
# \end{tabular}
# \end{center}
# \end{figure}
#
# \begin{figure}
# \caption{\label{hsmax}Evolution of the maximum significant wave
# height and maximum wind speed.}
# \begin{center}
# \includegraphics*[width=\hsize]{hsmax.eps}
# \end{center}
# \end{figure}
#
# \begin{figure}
# \caption{\label{shifted}Significant wave height (colours) and wind field.}
# \begin{center}
# \includegraphics*[width=0.8\hsize]{shifted.eps}
# \end{center}
# \end{figure}
#
# Author: St\'ephane Popinet
# Command: gerris2D -DLEVEL=7 -DALPHA=3. cyclone.gfs | gfsview2D cyclone.gfv
# Version: 20091105
# Required files: cyclone.gfv hs.gfv mesh.gfv shifted.gfv
# Running time: 15 minutes
# Generated files: hs-12.eps hs-36.eps mesh-12.eps mesh-36.eps hs-24.eps hs-48.eps mesh-24.eps mesh-48.eps hsmax.eps shifted.eps
#
# Use the spectral wave model 'GfsWave'
1 0 GfsWave GfsBox GfsGEdge {} {
    Refine 4
    # Run for 48 hours
    Time { end = 48 }
    # Domain size is 3328 km
    PhysicalParams { L = 3328 }
    # Define some useful functions
    Global {
        /* gaussian distribution */
        static double gaussian (double f, double fmean, double fsigma) {
            return exp (-((f - fmean)*(f - fmean))/(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.;
        }
        /* Holland cyclone model */
        static double holland(double r, double Rmax, double Vmax) {
            if (r < Rmax/1e3) return 0.;
            return Vmax*pow(Rmax/r, 2)*exp(2.*(1. - Rmax/r));
        }
        /* Position of the center of the cyclone */
        double ut = 555./24.; /* km/h */
        static double xc (double t) {
            return 0.;
        }
        static double yc (double t) {
            return 1110. - ut*t;
        }
        /* Intensity of the cyclone as a function of time */
        static double vmax (double t) {
            return 50.*(t < 25. ? t/25. : 1.);
        }
        /* velocity components */
        static double ur (double x, double y, double t) {
            x -= xc (t);
            y -= yc (t);
            double r = sqrt (x*x + y*y);
            return holland (r, 100., vmax (t))*y/r;
        }
        static double vr (double x, double y, double t) {
            x -= xc (t);
            y -= yc (t);
            double r = sqrt (x*x + y*y);
            return - holland (r, 100., vmax (t))*x/r;
        }
    }
    # Use source terms from WaveWatch III
    GModule wavewatch
    Init { istep = 1 } {
        # Wind at 10 metres
        U10 = ur(x, y, t)
        V10 = vr(x, y, t)
    }
    # Adapt the mesh according to the error in significant wave height
    AdaptError { istep = 1 } { cmax = 0.1 minlevel = 4 maxlevel = LEVEL c = Hse } Hs
    # Adapt the mesh according to the error in the norm of the forcing wind field
    AdaptError { istep = 1 } { 
        cmax = 0.2 minlevel = 4 maxlevel = LEVEL c = Ve 
    } sqrt(U10*U10 + V10*V10)
    # Output time at every timestep
    OutputTime { istep = 1 } stderr
    # Output simulation size
    OutputBalance { istep = 1 } stderr
    # Output timing statistics every 100 timesteps
    OutputTiming { istep = 100 } stderr
    # Output significant wave height to file hs, every quarter of an hour
    OutputScalarStats { step = 0.25 } hs { v = Hs }
    # Output norm of wind velocity to file vr, every quarter of an hour
    OutputScalarStats { step = 0.25 } vr { v = sqrt(U10*U10 + V10*V10) }
    # Output simulation to standard output for visualisation with GfsView
    OutputSimulation { istep = 10 } stdout
    # Output simulation results every 4 hours
    OutputSimulation { step = 4 } sim-%g.gfs
    # Compress the files to save disk space
    EventScript { step = 4 } { gzip -f sim-*.gfs }
    # Create movies of significant wave height and level of refinement
    OutputPPM { istep = 1 } { ppm2mpeg > hs.mpg } { v = Hs maxlevel = 9 }
    OutputPPM { istep = 1 } { ppm2mpeg > level.mpg } { v = Level min = 4 max = LEVEL maxlevel = 9 }
    # Create figures at the end of the simulation
    EventScript { start = end } {
	for i in 12 24 36 48; do
	    echo "Save hs-$i.eps { format = EPS }" | gfsview-batch2D sim-$i.gfs.gz hs.gfv
	    echo "Save mesh-$i.eps { format = EPS }" | gfsview-batch2D sim-$i.gfs.gz mesh.gfv
	done
	echo "Save shifted.eps { format = EPS }" | gfsview-batch2D sim-48.gfs.gz shifted.gfv
	cat <<EOF | gnuplot
        set term postscript eps color lw 2 18
        set output 'hsmax.eps'
        set xlabel 'Time (hours)'
        set ylabel 'Amplitude (m or m/s)'
        set xtics 0,12,48
        set grid
        plot 'hs' u 3:11 w l t 'max(Hs)', 'vr' u 3:11 w l t 'max(|U10|)'
EOF
    }
} {
    # Garden Sprinkler Effect alleviation parameter
    alpha_s = ALPHA
}
GfsBox {}
 
     |