File: hump.gfs

package info (click to toggle)
gerris 20131206%2Bdfsg-21
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 14,252 kB
  • sloc: ansic: 66,595; sh: 15,922; f90: 1,513; makefile: 1,150; fortran: 696; python: 493; awk: 104; lisp: 89; xml: 27
file content (104 lines) | stat: -rw-r--r-- 4,071 bytes parent folder | download | duplicates (6)
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
# Title: Small amplitude solitary wave interacting with a parabolic hump
#
# Description:
#
# This test case was proposed by LeVeque (JCP, 1998) as a check for
# the accuracy of hydrostatic balance for the Saint-Venant equations
# with variable topography. A solitary wave of small amplitude is
# generated by an initial discontinuity on the left-hand-side of the
# domain and moves past a parabolic hump creating complex focusing and
# diffraction (Figure \ref{hump}). Any inaccuracy in hydrostatic
# balance will clearly affect the solution given the small amplitude
# of the initial perturbation.
#
# \begin{figure}[htbp]
# \caption{\label{hump}Animation of the topography (coloured) and free
# surface (white). The vertical scale is exagerated.}
# \begin{center}
# \htmladdnormallinkfoot{\includegraphics[width=0.6\hsize]{hump.eps}}{hump.mpg}
# \end{center}
# \end{figure}
#
# Figure \ref{evolution} illustrates the free surface and
# corresponding adaptive mesh evolution. This figure agrees well with
# the results reported by
# \htmladdnormallinkfoot{LeVeque}{http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.57.5450}
# using a non-adaptive high-resolution Godunov method (Figure 7, right
# column, note that the resolution of the results by LeVeque is
# slightly larger: $600\times 300$ compared to $512\times 256$ here).
#
# \begin{figure}[htbp]
# \caption{\label{evolution}Evolution of the free surface and adaptive mesh.}
# \begin{center}
# \begin{tabular}{cc}
# \includegraphics[width=0.5\hsize]{iso-0.6.eps} &
# \includegraphics[width=0.5\hsize]{cells-0.6.eps} \\
# \multicolumn{2}{c}{$t = 0.6$} \\
# \includegraphics[width=0.5\hsize]{iso-0.9.eps} &
# \includegraphics[width=0.5\hsize]{cells-0.9.eps} \\
# \multicolumn{2}{c}{$t = 0.9$} \\
# \includegraphics[width=0.5\hsize]{iso-1.2.eps} &
# \includegraphics[width=0.5\hsize]{cells-1.2.eps} \\
# \multicolumn{2}{c}{$t = 1.2$} \\
# \includegraphics[width=0.5\hsize]{iso-1.5.eps} &
# \includegraphics[width=0.5\hsize]{cells-1.5.eps} \\
# \multicolumn{2}{c}{$t = 1.5$} \\
# \includegraphics[width=0.5\hsize]{iso-1.8.eps} &
# \includegraphics[width=0.5\hsize]{cells-1.8.eps} \\
# \multicolumn{2}{c}{$t = 1.8$}
# \end{tabular}
# \end{center}
# \end{figure}
#
# Author: St\'ephane Popinet
# Command: gerris2D hump.gfs | gfsview2D hump.gfv | ppm2mpeg > hump.mpg
# Version: 1.3.1
# Required files: hump.gfv isolines.gfv cells.gfv
# Running time: 7 minutes
# Generated files: cells-0.6.eps cells-1.2.eps cells-1.8.eps iso-0.9.eps iso-1.5.eps cells-0.9.eps cells-1.5.eps iso-0.6.eps iso-1.2.eps iso-1.8.eps hump.eps hump.mpg
#
# Recenter the reference box on (0.5,0.5) (rather than the default (0,0))
2 1 GfsRiver GfsBox GfsGEdge { x = 0.5 y = 0.5 } {
    Refine 8
    Init {} {
	# Parabolic hump
	Zb = 0.8*exp(-5.*(x - 0.9)*(x - 0.9) - 50.*(y - 0.5)*(y - 0.5))
	# Initial free surface and perturbation
	P = (0.05 < x && x < 0.15 ? 1.01 : 1) - Zb
    }
    PhysicalParams { g = 1 }
    AdvectionParams { cfl = 0.5 }
    AdaptGradient { istep = 1 } { 
	cmax = 1e-4
	cfactor = 2
	maxlevel = 8
	minlevel = 6
    } (P + Zb)
    Time { end = 1.8 }
    OutputTime { istep = 10 } stderr
    OutputSimulation { istep = 10 } stdout
    EventScript { istep = 10 } { echo "Save stdout { width = 640 height = 480 }" }
    OutputSimulation { start = 0.6 step = 0.3 } sim-%g.gfs
    EventScript { start = end } {
	for i in 0.6 0.9 1.2 1.5 1.8; do
	    echo "Save stdout { format = EPS line_width = 0.2 }" | \
		gfsview-batch2D sim-$i.gfs isolines.gfv > iso-$i.eps
	    echo "Save stdout { format = EPS line_width = 0.2 }" | \
		gfsview-batch2D sim-$i.gfs cells.gfv > cells-$i.eps
	done
	echo "Save stdout { width = 1280 height = 960 }" | \
	    gfsview-batch2D sim-0.9.gfs hump.gfv | convert ppm:- hump.eps
    }
}
# "open" boundary conditions on all boundaries
GfsBox {
    left = Boundary { BcNeumann U 0 }
    top = Boundary { BcNeumann V 0 }
    bottom = Boundary { BcNeumann V 0 }
}
GfsBox {
    right = Boundary { BcNeumann U 0 }
    top = Boundary { BcNeumann V 0 }
    bottom = Boundary { BcNeumann V 0 }
}
1 2 right