From GRASS-Wiki
Revision as of 19:20, 25 July 2019 by HamishBowman (talk | contribs) (Importing the fort.14 mesh grid)

Jump to: navigation, search

Interfacing with the ADCIRC coastal ocean model

Grid preparation


OceanMesh2D is an open source (GPL3) generator of 2D triangular meshes suitable for use with ADCIRC. It likes to work in lat/lon coordinate system.

You can output your DEM as NetCDF format with r.out.gdal.

You can create a domain boundary polyline with r.contour. You can then output the domain boundary polyline either as Shapefiles with v.out.ogr, or as two column x,y ASCII data with the v.out.ascii.mat addon module for GRASS 6.

Post processing output data

Importing the fort.14 mesh grid

The addon module for GRASS 6 will import a 3D triangular mesh from the ADCIRC coastal ocean model into a GRASS vector map.

  • does not yet support loading in node type (boundary, etc.) as point attributes -- vector tables can be a bit slow for maps with potentially millions of features. In the mean time here is a little shell script to extract the boundary nodes on the first open boundary into a separate vector points map:
bdymap=mesh_bdy_pts -p in=$infile out=$inmap
num_pts=`grep ' = Number of nodes for open boundary' "$infile" | head -n 1 | awk '{print $1}'`
cat_list=`grep -A"$num_pts" ' = Number of nodes for open boundary' "$infile" | \
   tail -n +2 | tr '\n' ',' | sed -e 's/ //g' -e 's/,$//'`
v.extract in=$inmap out=$bdymap list="$cat_list"

Importing elevation or velocity reporting stations

With a little awk you can load in the elevation reporting stations for unit 61 with

example goes here

Visualizing sub-domains

If you wish to have a look at where the sub-domains of a parallel run are, you can use the following Bash script:

mkdir fort14s
for DIR in PE00?? ; do
   cp -a $DIR/fort.14 fort14s/${DIR}.14
cd fort14s
for file in *.14 ; do
   base=`echo "$file" | sed -e 's/PE00//' -e 's/\.14//'`
   echo -n "[$base]" in="$file" out="submesh_$base" --quiet -p in="$file" out="submesh_${base}_pts" --quiet

Here is a loop for displaying 80 sub-meshes, with random dark colors:

for PE in {00..79} ; do
  echo -n "[$PE]"
  R=`expr $RANDOM / 256`
  G=`expr $RANDOM / 256`
  B=`expr $RANDOM / 256`

  d.vect "submesh_$PE" color="$R:$G:$B"

d.vect US_medium_shoreline color=black width=2

d.vect station_map color=black fcolor=red size=8 icon=basic/circle

Importing unit 61, 62, 63, 64 results

- addme: bash code + +

d.barb addon module for GRASS 6 for rendering u,v vector arrows