[SCM] Gerris Flow Solver branch, upstream, updated. e8f73a07832050124d2b8bf6c6f35b33180e65a8

Stephane Popinet s.popinet at niwa.co.nz
Tue Nov 24 12:25:29 UTC 2009


The following commit has been merged in the upstream branch:
commit 0e2af88a406688290c6ff66f3d2b73cdad399046
Author: Stephane Popinet <s.popinet at niwa.co.nz>
Date:   Fri Nov 6 04:49:24 2009 +1100

    Wavewatch module supports versions 3.14 and 2.22
    
    Ignore-this: 31ddee6a056dd5d9f68c9d84280a6163
    
    darcs-hash:20091105174924-fbd8f-44889caf185f800c696629300d27c0fe15f4cf4f.gz

diff --git a/configure.in b/configure.in
index 0d9072c..88befb5 100644
--- a/configure.in
+++ b/configure.in
@@ -313,6 +313,15 @@ AM_CONDITIONAL(BUILD_STOKES, test x$F77 != x)
 
 # Build wavewatch module if wavewatch is installed
 AM_CONDITIONAL(BUILD_WAVEWATCH, test -r $HOME/.wwatch3.env)
+if test -r $HOME/.wwatch3.env; then
+   ww3_dir=`grep WWATCH3_DIR $HOME/.wwatch3.env | awk '{print $2}'`
+   ww3_version=`grep "WWVER  = " $ww3_dir/ftn/*.ftn | \
+                awk '{print substr($(NF-1),2)}' | \
+                sed 's/\.//'`
+   W3INIT="w3init$ww3_version"
+   AC_SUBST(W3INIT)
+   AC_DEFINE_UNQUOTED(WW3_VERSION, $ww3_version, [WaveWatch III version number])
+fi
 
 dnl header file checks
 AC_CHECK_HEADERS(fenv.h, AC_DEFINE(HAVE_FENV_H))
diff --git a/modules/Makefile.am b/modules/Makefile.am
index d1e67c6..bfa50ab 100644
--- a/modules/Makefile.am
+++ b/modules/Makefile.am
@@ -92,7 +92,9 @@ libstokes2D_la_CFLAGS = $(AM_CFLAGS) -DFTT_2D=1
 
 libwavewatch2D_la_SOURCES = wavewatch.c
 libwavewatch2D_la_LIBADD = -Lwavewatch -lwavewatch -L/usr/lib/gcc/i486-linux-gnu/4.2 -lgfortran
-libwavewatch2D_la_CFLAGS = $(AM_CFLAGS) -DFTT_2D=1
+libwavewatch2D_la_CFLAGS = $(AM_CFLAGS) -DFTT_2D=1 \
+  -DW3SRCE=`nm wavewatch/libwavewatch.a | grep w3srce | awk '{ if ($$2 == "T") print $$3; }'` \
+  -DGFSW3INIT=`nm wavewatch/libwavewatch.a | grep gfsw3_init | awk '{ if ($$2 == "T") print $$3; }'`
 libwavewatch2D_la_DEPENDENCIES = wavewatch/libwavewatch.a
 
 xyz2rsurface_SOURCES = xyz2rsurface.c rsurface.c rsurface.h
diff --git a/modules/wavewatch.mod b/modules/wavewatch.mod
index 75b770c..4c26c6f 100644
--- a/modules/wavewatch.mod
+++ b/modules/wavewatch.mod
@@ -21,7 +21,12 @@
 #include <unistd.h>
 #include <sys/wait.h>
 #include "wave.h"
-#include "wavewatch/wavewatch.h"
+#include "config.h"
+#if WW3_VERSION == 222
+#  include "wavewatch/wavewatch_222.h"
+#else /* 3.14 */
+#  include "wavewatch/wavewatch_314.h"
+#endif
 
 #define DEBUG 0
 
@@ -98,7 +103,6 @@ static void source (FttCell * cell, SourceParams * p)
 {
   energy_to_action (cell, p);
 
-  INTEGER IX, IY, IMOD = 1;
   REAL DEPTH = 1000.; /* fixme: depth is fixed at 1000 m for now */
   REAL U10ABS, U10DIR;
 
@@ -108,16 +112,29 @@ static void source (FttCell * cell, SourceParams * p)
   REAL FPI = GFS_VALUE (cell, p->fpi);
   REAL DTG = GFS_SIMULATION (p->wave)->advection_params.dt*3600.;
 
-  REAL USTDIR;
   REAL EMEAN, FMEAN, WMEAN, AMAX;
   REAL CD, Z0;
   REAL DTDYN, FCUT;
   
-  __w3srcemd__w3srce (&IX, &IY, &IMOD, p->A, p->ALPHA, p->WN, p->CG, &DEPTH, 
-		      &U10ABS, &U10DIR, &USTAR, &USTDIR,
-		      &EMEAN, &FMEAN, &WMEAN, &AMAX, 
-		      &FPI, &CD, &Z0, 
-		      &DTDYN, &FCUT, &DTG);
+#if WW3_VERSION == 222
+  REAL DTMIN = DTG/10., DTMAX = DTG;
+  W3SRCE (p->A, p->A, p->ALPHA, p->WN, p->CG, &DEPTH, 
+	  &U10ABS, &U10DIR, &USTAR,
+	  &EMEAN, &FMEAN, &WMEAN, &AMAX, 
+	  &FPI, &CD, &Z0, 
+	  &DTDYN, &FCUT, &DTG, &DTMIN, &DTMAX);
+#else /* 3.14 */
+  INTEGER IX, IY, IMOD = 1;
+  REAL AS = p->as ? GFS_VALUE (cell, p->as) : 0.;
+  REAL USTDIR;
+  REAL CX = 0., CY = 0.;
+  W3SRCE (&IX, &IY, &IMOD, p->A, p->ALPHA, p->WN, p->CG, &DEPTH, 
+	  &U10ABS, &U10DIR, &AS, &USTAR, &USTDIR,
+	  &CX, &CY,
+	  &EMEAN, &FMEAN, &WMEAN, &AMAX, 
+	  &FPI, &CD, &Z0, 
+	  &DTDYN, &FCUT, &DTG);
+#endif /* 3.14 */
 
 #if DEBUG
   guint i, j;
@@ -137,7 +154,9 @@ static void source (FttCell * cell, SourceParams * p)
 static void deletedir (const char * name)
 {
   gchar * command = g_strconcat ("rm -r -f ", name, NULL);
-  system (command);
+  int status = system (command);
+  if (status)
+    g_warning ("could not cleanup wavewatch setup");
   g_free (command);
 }
 
@@ -185,11 +204,15 @@ static void initialize (GfsWave * wave)
       "  1 1 1\n"
       "  1 1 1\n"
       "  1 1 1\n"
+#if WW3_VERSION == 222
+      "      0   0   F\n"
+#else /* version 3.14 */
       "   10 3 1 '(....)' 'PART' 'mapsta.inp'\n"
       "      0   0   F\n"
       "      0   0   F\n"
       "      0   0\n"
-      "     0.    0.    0.    0.       0\n";  
+#endif /* version 3.14 */
+      "     0.    0.    0.    0.       0\n";
     fputs (constant_parameters, input);
     fclose (input);
 
@@ -214,7 +237,7 @@ static void initialize (GfsWave * wave)
     }
 
     /* Initialize wavewatch */
-    __gfsw3init__gfsw3_init ();
+    GFSW3INIT ();
 
     /* cleanup */
     remove ("mod_def.ww3");
diff --git a/modules/wavewatch/Makefile.am b/modules/wavewatch/Makefile.am
index c99747c..e80d039 100644
--- a/modules/wavewatch/Makefile.am
+++ b/modules/wavewatch/Makefile.am
@@ -8,7 +8,7 @@ endif
 noinst_LIBRARIES = $(WAVEWATCH)
 noinst_PROGRAMS = $(CHECKTYPES)
 
-EXTRA_DIST = gfsad3 gfsw3initmd.ftn wavewatch.h fchecktypes.ftn
+EXTRA_DIST = gfsad3 w3init222.ftn w3init314.ftn wavewatch.h fchecktypes.ftn
 
 checktypes_SOURCES = cchecktypes.c
 checktypes_LDADD = fchecktypes.o
@@ -17,13 +17,14 @@ libwavewatch_a_SOURCES =
 
 CLEANFILES = cfortrantypes.h
 
-libwavewatch.a: gfsw3initmd.o
+libwavewatch.a: w3initmd.o
 	rm -f libwavewatch.a
-	$(AR) cru libwavewatch.a `grep WWATCH3_DIR $(HOME)/.wwatch3.env | awk '{print $$2 "/obj/w3*.o"}'` gfsw3initmd.o
+	$(AR) cru libwavewatch.a `grep WWATCH3_DIR $(HOME)/.wwatch3.env | awk '{print $$2 "/obj/w3*.o"}'` w3initmd.o
 	$(RANLIB) libwavewatch.a
 
-gfsw3initmd.o: gfsw3initmd.ftn $(HOME)/.wwatch3.env gfsad3 cfortrantypes.h
-	sh gfsad3 gfsw3initmd.ftn
+w3initmd.o: $(W3INIT).ftn $(HOME)/.wwatch3.env gfsad3 cfortrantypes.h
+	sh gfsad3 $(W3INIT).ftn
+	mv -f $(W3INIT).o w3initmd.o
 
 fchecktypes.o: fchecktypes.ftn $(HOME)/.wwatch3.env gfsad3
 	sh gfsad3 fchecktypes.ftn
diff --git a/modules/wavewatch/gfsw3initmd.ftn b/modules/wavewatch/gfsw3initmd.ftn
deleted file mode 100644
index aa8165b..0000000
--- a/modules/wavewatch/gfsw3initmd.ftn
+++ /dev/null
@@ -1,304 +0,0 @@
-!/ ------------------------------------------------------------------- /
-!
-! Initialisation of Wavewatch when used with Gerris
-! Adapted from ww3_shel.ftn, S. Popinet, 2009
-!
-!/ ------------------------------------------------------------------- /
-      MODULE GFSW3INIT
-!/
-!docb_ww3_shel.doc
-!/                  +-----------------------------------+
-!/                  | WAVEWATCH-III           NOAA/NCEP |
-!/                  |           H. L. Tolman            |
-!/                  |                        FORTRAN 90 |
-!/                  | Last update :         22-Jun-2007 |
-!/                  +-----------------------------------+
-!/
-!/    19-Jan-1999 : Final FORTRAN 77                    ( version 1.18 )
-!/    19-Jan-2000 : Upgrade to FORTRAN 90               ( version 2.00 )
-!/    08-Mar-2000 : Fix time managament bug.            ( version 2.04 )
-!/    09-Jan-2001 : Fix FOUT allocation bug.            ( version 2.05 )
-!/    24-Jan-2001 : Flat grid version.                  ( version 2.06 )
-!/    25-Jan-2002 : Data assimilation set up.           ( version 2.17 )
-!/    08-May-2002 : Clean up for timers.                ( version 2.21 )
-!/    26-Aug-2002 : Generalizing timer.                 ( version 2.22 )
-!/    26-Dec-2002 : Continuously moving grid.           ( version 3.02 )
-!/    01-Aug-2003 : Continuously moving grid, input.    ( version 3.03 )
-!/    07-Oct-2003 : Fixed NHMAX test.                   ( version 3.05 )
-!/    05-Jan-2005 : Multiple grid version.              ( version 3.06 )
-!/    04-May-2005 : Change to MPI_COMM[_WAVE.           ( version 3.07 )
-!/    26-Jun-2006 : Add wiring for output type 6.       ( version 3.07 )
-!/    28-Jun-2006 : Adding file name preamble.          ( version 3.09 )
-!/    28-Oct-2006 : Adding partitioning options.        ( version 3.10 )
-!/    21-Jun-2007 : Dedicated output processes.         ( version 3.11 )
-!/
-!  1. Purpose :
-!
-!     A generic shell for WAVEWATCH-III, using preformatted
-!     input fields.
-!
-!  2. Method :
-!
-!     Driver for the actual wave model (W3WAVE).
-!
-!     Files : ww3_shel.inp  Input commands for shell.
-!             level.ww3     Water level fields (optional).
-!             current.ww3   Current fields (optional).
-!             wind.ww3      Water level fields (optional).
-!             ice.ww3       Water level fields (optional).
-!             data0.ww3     Files with asiimlation data (optional).
-!             data1.ww3
-!             data2.ww3
-!
-!     The file names of the input files are set in W3FLDO
-!
-!  3. Parameters :
-!
-!     Local parameters.
-!     ----------------------------------------------------------------
-!       NDSO    Int.  General output unit number (shell only).
-!       NDSE    Int.  Error output unit number (shell only).
-!       NDST    Int.  Test output unit number (shell only).
-!     ----------------------------------------------------------------
-!
-!       NDS, NTRACE, ..., see W3WAVE
-!
-!  4. Subroutines used :
-!
-!      Name      Type  Module   Description
-!     ----------------------------------------------------------------
-!      W3NMOD    Subr. W3GDATMD Set nummber of data structures
-!      W3SETG    Subr.   Id.    Point to data structure.
-!      W3NDAT    Subr. W3WDATMD Set nummber of data structures
-!      W3SETW    Subr.   Id.    Point to data structure.
-!      W3NMOD    Subr. W3ADATMD Set nummber of data structures
-!      W3NAUX    Subr.   Id.    Point to data structure.
-!      W3NOUT    Subr. W3ODATMD Set nummber of data structures
-!      W3SETO    Subr.   Id.    Point to data structure.
-!      W3NINP    Subr. W3IDATMD Set nummber of data structures
-!      W3SETI    Subr.   Id.    Point to data structure.
-!
-!      NEXTLN    Subr. W3SERVMD Skip to next input line.
-!      STME21    Subr. W3TIMEMD Print date and time readable.
-!      DSEC21    Func.   Id.    Difference between times.
-!      TICK21    Subr.   Id.    Increment time.
-!
-!      W3FLDO    Subr. W3FLDSMD Opens and checks input files.
-!      W3FLDG    Subr.   Id.    Reads from input files.
-!      W3FLDD    Subr.   Id.    Reads from data files.
-!      W3FLDH    Subr.   Id.    Udates homogeneous fields.
-!
-!      W3INIT    Subr. W3INITMD Wave model initialization.
-!      W3WAVE    Subr. W3WAVEMD Wave model.
-!      W3WDAS    Subr. W3WDASMD Data assimilation interface.
-!
-!      MPI_INIT, MPI_COMM_SIZE, MPI_COMM_RANK, MPI_BARRIER,
-!         MPI_FINALIZE
-!                Subr.          Standard MPI routines.
-!     ----------------------------------------------------------------
-!
-!  5. Called by :
-!
-!     None, stand-alone program.
-!
-!  6. Error messages :
-!
-!     - Checks on I-O.
-!     - Check on time interval.
-!
-!  7. Remarks :
-!
-!     - A rigourous input check is made in W3INIT.
-!     - See W3WDAS for documentation on the set-up of the data
-!       assimilation.
-!
-!  8. Structure :
-!
-!     ----------------------------------------------------------------
-!        0.   Set up data structures.                ( W3NMOD, etc. )
-!        1.   I-O setup.
-!          a  For shell.
-!          b  For WAVEWATCH-III.
-!          c  Local parameters.
-!        2.   Define input fields
-!        3.   Set time frame.
-!        4.   Define output
-!          a  Loop over types, do
-!        +--------------------------------------------------------+
-!        | b    Process standard line                             |
-!        | c    If type 1: fields of mean wave parameters         |
-!        | d    If type 2: point output                           |
-!        | e    If type 3: track output                           |
-!        | f    If type 4: restart files                          |
-!        | g    If type 5: boundary output                        |
-!        | h    If type 6: separated wave fields                  |
-!        +--------------------------------------------------------+
-!        5.   Initialzations
-!          a  Wave model.                              ( W3INIT )
-!          b  Read homogeneous field data.
-!          c  Prepare input files.                     ( W3FLDO )
-!          d  Set field times.
-!        6.   If no input fields required, run model in a single
-!             sweep and exit.                          ( W3WAVE )
-!        7.   Run model with input
-!             Do until end time is reached
-!        +--------------------------------------------------------+
-!        | a  Determine next time interval and input fields.      |
-!        |   1  Preparation                                       |
-!        |      Loop over input fields                            |
-!        | +------------------------------------------------------|
-!        | | 2  Check if update is needed                         |
-!        | | 3  Update time and fields                 ( W3FLDG ) |
-!        | |                                           ( W3FLDH ) |
-!        | | 4  Update next ending time                           |
-!        | +------------------------------------------------------|
-!        | b  Run wave model.                          ( W3WAVE ) |
-!        | c  If requested, data assimilation.         ( W3WDAS ) |
-!        | d  Final output if needed.                  ( W3WAVE ) |
-!        | e  Check time                                          |
-!        +--------------------------------------------------------+
-!     ----------------------------------------------------------------
-!
-!  9. Switches :
-!
-!       !/SHRD  Switch for shared / distributed memory architecture.
-!       !/DIST  Id.
-!       !/MPI   Id.
-!
-!       !/LLG   Spherical grid.
-!       !/XYG   Cartesian grid.
-!       !/MGW   Moving grid wind correction.
-!       !/MGP   Moving grid propagation correction.
-!
-!       !/T     Enable test output.
-!       !/O7    Echo input homogeneous fields.
-!
-!       !/NCO   NCEP NCO modifications for operational implementation.
-!
-!       !/F90   Timer function included for F90.
-!
-! 10. Source code :
-!
-!/ ------------------------------------------------------------------- /
-      USE W3GDATMD
-      USE W3WDATMD, ONLY: TIME, W3NDAT, W3DIMW, W3SETW
-      USE W3ADATMD, ONLY: W3NAUX, W3DIMA, W3SETA
-      USE W3IDATMD
-      USE W3ODATMD, ONLY: W3NOUT, W3SETO
-      USE W3ODATMD, ONLY: NAPROC, IAPROC, NAPOUT, NAPERR,             &
-                          NOGRD, IDOUT, FNMPRE, IOSTYP
-!/
-      USE W3INITMD
-!/
-      IMPLICIT NONE
-!
-!/
-!/ ------------------------------------------------------------------- /
-!/ Local parameters
-!/
-      INTEGER             :: NDSO, NDSE, NDST,     &
-                             NDS(13), NTRACE(2),      &
-                             ODAT(30),       &
-                             MPI_COMM = -99, &
-                             IPRT(6)
-      REAL, ALLOCATABLE   :: X(:), Y(:)
-      LOGICAL             :: FLGRD(NOGRD), PRTFRM
-      CHARACTER(LEN=10),                                              &
-              ALLOCATABLE :: PNAMES(:)
-!/
-!/ ------------------------------------------------------------------- /
-!/
-      PUBLIC
-CONTAINS
-      SUBROUTINE GFSW3_INIT ( )
-      IMPLICIT NONE
-!
-!--- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-! 0.  Set up data structures
-!
-      CALL W3NMOD ( 1, 6, 6 )
-      CALL W3NDAT (    6, 6 )
-      CALL W3NAUX (    6, 6 )
-      CALL W3NOUT (    6, 6 )
-      CALL W3NINP (    6, 6 )
-!
-      CALL W3SETG ( 1, 6, 6 )
-      CALL W3SETW ( 1, 6, 6 )
-      CALL W3SETA ( 1, 6, 6 )
-      CALL W3SETO ( 1, 6, 6 )
-      CALL W3SETI ( 1, 6, 6 )
-
-! Time is not set
-      TIME(1) = -1
-!
-!/SHRD      NAPROC = 1
-!/SHRD      IAPROC = 1
-!
-!/MPI      IAPROC = IAPROC + 1
-!
-!/NCO/!     IF ( IAPROC .EQ. 1 ) CALL W3TAGB                         &
-!/NCO/!                         ('WAVEFCST',1998,0007,0050,'NP21   ')
-!
-!--- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-! 1.  IO set-up
-! 1.a For shell
-!
-      NDSO   =  20
-      NDSE   =  20
-      NDST   =  20
-!
-!/NCO/!
-!/NCO/! Redo according to NCO standard and docblock
-!/NCO/!
-!/NCO      NDSO   =  6
-!/NCO      NDSE   = NDSO
-!/NCO      NDST   = NDSO
-!
-      NAPOUT = 1
-      NAPERR = 1
-!
-! 1.b For WAVEWATCH-III (See W3INIT)
-!
-      NDS( 1) = 20
-      NDS( 2) = 20
-!     NDS( 3) = 20
-      NDS( 3) = 20
-      NDS( 4) = 20
-      NDS( 5) = 30
-      NDS( 6) = 30
-      NDS( 7) = 31
-      NDS( 8) = 32
-      NDS( 9) = 33
-      NDS(10) = 35
-      NDS(11) = 22
-      NDS(12) = 23
-      NDS(13) = 34
-!
-      NTRACE(1) =  NDS(3)
-      NTRACE(2) =  10
-!
-!/NCO/!
-!/NCO/! Redo according to NCO standard and docblock
-!/NCO/!
-!/NCO      NDS( 1) = 51
-!/NCO      NDS( 2) = NDSO
-!/NCO      NDS( 3) = NDSO
-!/NCO      NDS( 4) = NDSO
-!/NCO      NDS( 5) = 20
-!/NCO      NDS( 6) = 21
-!/NCO      NDS( 7) = 52
-!/NCO      NDS( 8) = 53
-!/NCO      NDS( 9) = 22
-!/NCO      NDS(10) = 71
-!/NCO      NDS(11) = 23
-!/NCO      NDS(12) = 54
-!/NCO      NDS(13) = 55
-!/NCO      NTRACE(1) = NDSO
-!
-! 5.a Wave model
-!
-      CALL W3INIT ( 1, 'ww3', NDS, NTRACE, ODAT, FLGRD, 0, X, Y,   &
-                    PNAMES, IPRT, PRTFRM, -99 )
-      RETURN
-      END SUBROUTINE GFSW3_INIT
-    END MODULE GFSW3INIT
diff --git a/modules/wavewatch/w3init222.ftn b/modules/wavewatch/w3init222.ftn
new file mode 100644
index 0000000..a399601
--- /dev/null
+++ b/modules/wavewatch/w3init222.ftn
@@ -0,0 +1,22 @@
+!/ ------------------------------------------------------------------- /
+!
+! Initialisation of Wavewatch III (version 2.22) when used with Gerris
+! (-*-F90-*-)
+!
+!/ ------------------------------------------------------------------- /
+MODULE GFSW3INIT
+  USE W3IOGRMD
+  USE W3TESTMD, ONLY : NAPROC, IAPROC, NAPOUT, NAPERR
+  IMPLICIT NONE
+  PUBLIC
+CONTAINS
+  SUBROUTINE GFSW3_INIT ( )
+    IMPLICIT NONE
+    NAPROC = 1
+    IAPROC = 1
+    NAPOUT = 1
+    NAPERR = 1
+    CALL W3IOGR ( 'READ', 30 )
+    RETURN
+  END SUBROUTINE GFSW3_INIT
+END MODULE GFSW3INIT
diff --git a/modules/wavewatch/w3init314.ftn b/modules/wavewatch/w3init314.ftn
new file mode 100644
index 0000000..fad9529
--- /dev/null
+++ b/modules/wavewatch/w3init314.ftn
@@ -0,0 +1,127 @@
+!/ ------------------------------------------------------------------- /
+!
+! Initialisation of Wavewatch III (version 3.14) when used with Gerris
+! Adapted from ww3_shel.ftn, S. Popinet, 2009       (-*-F90-*-)
+!
+!/ ------------------------------------------------------------------- /
+      MODULE GFSW3INIT
+      USE W3GDATMD
+      USE W3WDATMD, ONLY: TIME, W3NDAT, W3DIMW, W3SETW
+      USE W3ADATMD, ONLY: W3NAUX, W3DIMA, W3SETA
+      USE W3IDATMD
+      USE W3ODATMD, ONLY: W3NOUT, W3SETO
+      USE W3ODATMD, ONLY: NAPROC, IAPROC, NAPOUT, NAPERR,             &
+                          NOGRD, IDOUT, FNMPRE, IOSTYP
+!/
+      USE W3INITMD
+!/
+      IMPLICIT NONE
+!
+!/ ------------------------------------------------------------------- /
+!/ Local parameters
+!/
+      INTEGER             :: NDSO, NDSE, NDST,     &
+                             NDS(13), NTRACE(2),      &
+                             ODAT(30),       &
+                             MPI_COMM = -99, &
+                             IPRT(6)
+      REAL, ALLOCATABLE   :: X(:), Y(:)
+      LOGICAL             :: FLGRD(NOGRD), PRTFRM
+      CHARACTER(LEN=10),                                              &
+              ALLOCATABLE :: PNAMES(:)
+!/
+!/ ------------------------------------------------------------------- /
+!/
+      PUBLIC
+CONTAINS
+      SUBROUTINE GFSW3_INIT ( )
+      IMPLICIT NONE
+!
+!--- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+! 0.  Set up data structures
+!
+      CALL W3NMOD ( 1, 6, 6 )
+      CALL W3NDAT (    6, 6 )
+      CALL W3NAUX (    6, 6 )
+      CALL W3NOUT (    6, 6 )
+      CALL W3NINP (    6, 6 )
+!
+      CALL W3SETG ( 1, 6, 6 )
+      CALL W3SETW ( 1, 6, 6 )
+      CALL W3SETA ( 1, 6, 6 )
+      CALL W3SETO ( 1, 6, 6 )
+      CALL W3SETI ( 1, 6, 6 )
+
+! Time is not set
+      TIME(1) = -1
+!
+!/SHRD      NAPROC = 1
+!/SHRD      IAPROC = 1
+!
+!/MPI      IAPROC = IAPROC + 1
+!
+!/NCO/!     IF ( IAPROC .EQ. 1 ) CALL W3TAGB                         &
+!/NCO/!                         ('WAVEFCST',1998,0007,0050,'NP21   ')
+!
+!--- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+! 1.  IO set-up
+! 1.a For shell
+!
+      NDSO   =  20
+      NDSE   =  20
+      NDST   =  20
+!
+!/NCO/!
+!/NCO/! Redo according to NCO standard and docblock
+!/NCO/!
+!/NCO      NDSO   =  6
+!/NCO      NDSE   = NDSO
+!/NCO      NDST   = NDSO
+!
+      NAPOUT = 1
+      NAPERR = 1
+!
+! 1.b For WAVEWATCH-III (See W3INIT)
+!
+      NDS( 1) = 20
+      NDS( 2) = 20
+      NDS( 3) = 20
+      NDS( 4) = 20
+      NDS( 5) = 30
+      NDS( 6) = 30
+      NDS( 7) = 31
+      NDS( 8) = 32
+      NDS( 9) = 33
+      NDS(10) = 35
+      NDS(11) = 22
+      NDS(12) = 23
+      NDS(13) = 34
+!
+      NTRACE(1) =  NDS(3)
+      NTRACE(2) =  10
+!
+!/NCO/!
+!/NCO/! Redo according to NCO standard and docblock
+!/NCO/!
+!/NCO      NDS( 1) = 51
+!/NCO      NDS( 2) = NDSO
+!/NCO      NDS( 3) = NDSO
+!/NCO      NDS( 4) = NDSO
+!/NCO      NDS( 5) = 20
+!/NCO      NDS( 6) = 21
+!/NCO      NDS( 7) = 52
+!/NCO      NDS( 8) = 53
+!/NCO      NDS( 9) = 22
+!/NCO      NDS(10) = 71
+!/NCO      NDS(11) = 23
+!/NCO      NDS(12) = 54
+!/NCO      NDS(13) = 55
+!/NCO      NTRACE(1) = NDSO
+!
+! 5.a Wave model
+!
+      CALL W3INIT ( 1, 'ww3', NDS, NTRACE, ODAT, FLGRD, 0, X, Y,   &
+                    PNAMES, IPRT, PRTFRM, -99 )
+      RETURN
+      END SUBROUTINE GFSW3_INIT
+    END MODULE GFSW3INIT
diff --git a/modules/wavewatch/wavewatch_222.h b/modules/wavewatch/wavewatch_222.h
new file mode 100644
index 0000000..dce2d18
--- /dev/null
+++ b/modules/wavewatch/wavewatch_222.h
@@ -0,0 +1,71 @@
+/* Gerris - The GNU Flow Solver
+ * Copyright (C) 2009 National Institute of Water and Atmospheric Research
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.  
+ */
+
+#include "cfortrantypes.h"
+
+/**
+ * Initialisation of wavewatch
+ */
+extern void GFSW3INIT (void);
+
+/**
+ * imported from w3srcemd.f90:W3SRCE
+ * @SPEC: Spectrum (action) in 1-D form (NK*NTH elements): INPUT/OUTPUT
+ * @SP2D: Spectrum (action) in 2-D form (NK*NTH elements): INPUT/OUTPUT
+ * @ALPHA: Nondimensional 1-D spectrum (NK)                OUTPUT
+ * @WN1: Discrete wavenumbers (NK)                         INPUT
+ * @CG1: Discrete group velocities (NK)                    INPUT
+ * @DEPTH: Depth                                           INPUT
+ * @U10ABS: Wind speed at reference height                 INPUT
+ * @U10DIR: Wind direction at reference height             INPUT
+ * @USTAR: Friction velocity                               INPUT/OUTPUT
+ * @EMEAN: Mean energy                                     OUTPUT (maybe model dependent?)
+ * @FMEAN: Mean frequency                                  OUTPUT (maybe model dependent?)
+ * @WMEAN: Mean wavenumber                                 OUTPUT (maybe model dependent?)
+ * @AMAX: Maximum energy                                   OUTPUT
+ * @FPI: Peak-input frequency                              INPUT/OUTPUT
+ * @CD: Drag coefficient                                   OUTPUT (maybe model dependent?)
+ * @Z0: Roughness length                                   OUTPUT (maybe model dependent?)
+ * @DTDYN: Average dynamic time step                       OUTPUT
+ * @FCUT: Cut-off frequency for tail                       OUTPUT
+ * @DTG: Global time step                                  INPUT
+ * @DTMIN: Minimum (partial) time step                     INPUT
+ * @DTMAX: Maximum (partial) time step                     INPUT
+ */
+extern void W3SRCE (REAL * SPEC,
+		    REAL * SP2D,
+		    REAL * ALPHA,
+		    REAL * WN1, 
+		    REAL * CG1, 
+		    REAL * DEPTH, 
+		    REAL * U10ABS, 
+		    REAL * U10DIR, 
+		    REAL * USTAR,
+		    REAL * EMEAN,
+		    REAL * FMEAN,
+		    REAL * WMEAN,
+		    REAL * AMAX,
+		    REAL * FPI,
+		    REAL * CD,
+		    REAL * Z0,
+		    REAL * DTDYN,
+		    REAL * FCUT,
+		    REAL * DTG,
+		    REAL * DTMIN,
+		    REAL * DTMAX);
diff --git a/modules/wavewatch/wavewatch.h b/modules/wavewatch/wavewatch_314.h
similarity index 54%
rename from modules/wavewatch/wavewatch.h
rename to modules/wavewatch/wavewatch_314.h
index eac5e62..a60f136 100644
--- a/modules/wavewatch/wavewatch.h
+++ b/modules/wavewatch/wavewatch_314.h
@@ -1,9 +1,28 @@
+/* Gerris - The GNU Flow Solver
+ * Copyright (C) 2009 National Institute of Water and Atmospheric Research
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.  
+ */
+
 #include "cfortrantypes.h"
 
 /**
  * Initialisation of wavewatch
  */
-extern void __gfsw3init__gfsw3_init (void);
+extern void GFSW3INIT (void);
 
 /**
  * imported from w3srcemd.f90:W3SRCE
@@ -29,23 +48,26 @@ extern void __gfsw3init__gfsw3_init (void);
  * @FCUT: Cut-off frequency for tail                       OUTPUT
  * @DTG: Global time step                                  INPUT
  */
-extern void __w3srcemd__w3srce (INTEGER * IX, INTEGER * IY, INTEGER * IMOD,
-				REAL * SPEC,
-				REAL * ALPHA,
-				REAL * WN1, 
-				REAL * CG1, 
-				REAL * DEPTH, 
-				REAL * U10ABS, 
-				REAL * U10DIR, 
-				REAL * USTAR,
-				REAL * USTDIR,
-				REAL * EMEAN,
-				REAL * FMEAN,
-				REAL * WMEAN,
-				REAL * AMAX,
-				REAL * FPI,
-				REAL * CD,
-				REAL * Z0,
-				REAL * DTDYN,
-				REAL * FCUT,
-				REAL * DTG);
+extern void W3SRCE (INTEGER * IX, INTEGER * IY, INTEGER * IMOD,
+		    REAL * SPEC,
+		    REAL * ALPHA,
+		    REAL * WN1, 
+		    REAL * CG1, 
+		    REAL * DEPTH, 
+		    REAL * U10ABS, 
+		    REAL * U10DIR, 
+		    REAL * AS,
+		    REAL * USTAR,
+		    REAL * USTDIR,
+		    REAL * CX,
+		    REAL * CY,
+		    REAL * EMEAN,
+		    REAL * FMEAN,
+		    REAL * WMEAN,
+		    REAL * AMAX,
+		    REAL * FPI,
+		    REAL * CD,
+		    REAL * Z0,
+		    REAL * DTDYN,
+		    REAL * FCUT,
+		    REAL * DTG);

-- 
Gerris Flow Solver



More information about the debian-science-commits mailing list