File: tides.sh

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 (48 lines) | stat: -rw-r--r-- 1,488 bytes parent folder | download | duplicates (5)
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
#
# Bathymetry
#

# happrox is distributed with GTS. Do 'happrox -h' for more info.
# 'bathymetry' contains the (negative) depth as a function of space i.e. three columns:
# lon (deg) lat (deg) depth (m).
# 0.05 is the relative depth error allowed.
happrox -f -r 1 -c 0.05 < bathymetry | transform --revert > bath.gts

#
# M2 tidal coefficients
#

# 'coefficients' contains the amplitude and phase of the M2
# tide as a function of space i.e. four columns:
# lon (deg) lat (deg) amplitude (m) phase (degree)

# just counts the number of lines in the input file
lines=`wc -l coefficients | awk '{print $1}'`

# Gerris defines the tidal M2 mode as:
# AM2*cos (omega*t) + BM2*sin (omega*t)
#
# We first compute AM2 from the amplitude and phase.
awk -v lines=$lines '
BEGIN {
  print lines " 0 0"
} {
  print $1 " " $2 " " $3*cos($4*3.14159265357/180.)
}' < coefficients | delaunay > AM2.gts

# Now compute BM2
awk -v lines=$lines '
BEGIN {
  print lines " 0 0"
} {
  print $1 " " $2 " " $3*sin($4*3.14159265357/180.)
}' < coefficients | delaunay > BM2.gts

# Run the simulation
gerris3D -m tides.gfs | gfsview3D tides.gfv

# Use batch mode of gfsview to generate figures
echo "Save amplitude.eps { format = EPS }" | gfsview-batch3D end.gfs amplitude.gfv
echo "Save phase.eps { format = EPS }" | gfsview-batch3D end.gfs phase.gfv
echo "Save ellipses.eps { format = EPS }" | gfsview-batch3D end.gfs ellipses.gfv
echo "Save residual.eps { format = EPS }" | gfsview-batch3D end.gfs residual.gfv