[GRASSLIST:7509] Re: r.terraflow failured
Hamish
hamish_nospam at yahoo.com
Sun Jul 10 03:30:53 EDT 2005
> My PhD research (nearly done!) is on the morphology of low-energy
> beaches in fjords and its relationship with sea grasses on the
> low-tide terrace. I've been meaning to contact you about using GRASS
> with SWAN. Check this out:
>
> http://students.washington.edu/dfinlays/waves/
Nice.
Some tips on using GRASS with the SWAN nearshore wave model follow.
SWAN (GPL'd): http://fluidmechanics.tudelft.nl/swan/default.htm
"Simulating WAves Nearshore"
Unknown to me if SWAN works with GCC 4's new fortran 90/95 compiler.
If so, we have an all Free-software chain.
You can use GRASS to make an elevation map then export it directly into
something that can be loaded by the model with r.out.ascii. You can
parse the top lines of that ASCII file to get the region extents for the
model, but be warned that SWAN's use of grid-points vs. cell-center
coordinate conventions aren't terribly consistent, so be careful adding
and subtracting one cell to get everything to match up where you intend
it to be (& triple check).
This can be a problem when you reload the data into GRASS if the data is
shifted by half a cell. If you don't reset the bounds correctly or
double the resolution, the data at each grid point will shift itself to
match the current region (ie by 1/2 a cell both in x and y) and you'll
see all the raster data no longer matching up with e.g. vector coastline
data. Changing the region settings or fixing your adjustments will make
it ok again.
SWAN crashes with a segfault (for me anyway) if you try and make your
computational grid bigger than about 500x500 (give or take period and
radial resolution settings). SWAN's memory handling is IMO pretty
wasteful, but it's a lot better than it used to be. Buy 2gb RAM.
SWAN's "BLOCK" output command can send data to a Matlab array. Do any
post-processing there (obligatory "or use Octave" plug) (well, r.mapcalc
could work too), re-save and import into GRASS with r.in.mat. (Importing
SWAN data into grass is why I wrote r.in.mat by the way) Once you have
your scripts set up to automate the creation of the swan command file
from r.out.ascii output & script the post processing to give you a .mat
file that GRASS can load, it's a really smooth process you can apply to
many different shorelines just by using d.zoom!
To get the shape of the beach correct (which is kind of critical if
you're looking at modelling waves crashing against them) make sure you
are careful when you merge any bathymetry data with coastline, island,
and topography elevation data. They are sure to use different vertical
datums (lowest low water vs. mean high water springs, etc).
good luck,
Hamish
More information about the grass-user
mailing list