ADCIRC: Difference between revisions

From GRASS-Wiki
Jump to navigation Jump to search
Line 18: Line 18:


The {{AddonCmd|v.in.adcirc_grid}} addon module for GRASS 6 will import a 3D triangular mesh from the [[ADCIRC]] coastal ocean model into a GRASS vector map.
The {{AddonCmd|v.in.adcirc_grid}} addon module for GRASS 6 will import a 3D triangular mesh from the [[ADCIRC]] coastal ocean model into a GRASS vector map.
* <tt>v.in.adcirc_grid</tt> 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:
infile=fort.14
inmap=mesh_grid_pts
bdymap=mesh_bdy_pts
v.in.adcirc_grid -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 v.in.ascii.
With a little awk you can load in the elevation reporting stations for unit 61 with v.in.ascii.
: example goes here
: 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:
If you wish to have a look at where the sub-domains of a parallel run are, you can use the following Bash script:

Revision as of 02:20, 26 July 2019

Interfacing with the ADCIRC coastal ocean model

Grid preparation

OceanMesh2D

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 v.in.adcirc_grid addon module for GRASS 6 will import a 3D triangular mesh from the ADCIRC coastal ocean model into a GRASS vector map.

  • v.in.adcirc_grid 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:
infile=fort.14
inmap=mesh_grid_pts
bdymap=mesh_bdy_pts

v.in.adcirc_grid -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 v.in.ascii.

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
done
 
cd fort14s
for file in *.14 ; do
   base=`echo "$file" | sed -e 's/PE00//' -e 's/\.14//'`
   echo -n "[$base]"
   v.in.adcirc_grid in="$file" out="submesh_$base" --quiet
   v.in.adcirc_grid -p in="$file" out="submesh_${base}_pts" --quiet
done

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"
done

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 + r.in.xyz + r.surf.nnbathy

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