Skip to content

Commit

Permalink
Fb coupling time (#9)
Browse files Browse the repository at this point in the history
Updates to allow a coupling time step that is different from the model time step. 
* Includes new regtest (in ww3_tp2.14) for non-default oasis time step.
* ww3_tp2.14 regtest added to matrix.base.
  • Loading branch information
ukmo-juan-castillo authored Jul 30, 2020
1 parent 6c42d17 commit 5c361aa
Show file tree
Hide file tree
Showing 21 changed files with 838 additions and 113 deletions.
3 changes: 3 additions & 0 deletions model/bin/ww3_from_ftp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,15 @@ cp -r data_regtests/ww3_tp2.12/input/* regtests/ww3_tp2.12/input/
cp -r data_regtests/ww3_tp2.12/input_be/* regtests/ww3_tp2.12/input_be/
cp -r data_regtests/ww3_tp2.12/input_le/* regtests/ww3_tp2.12/input_le/
cp -r data_regtests/ww3_tp2.14/input/r-ww3.nc.OAS*CM regtests/ww3_tp2.14/input/
cp -r data_regtests/ww3_tp2.14/input/r-ww3.nc.OASACM regtests/ww3_tp2.14/input/OASACM2
if [ ! -d regtests/ww3_tp2.14/input/oasis3-mct/doc ]
then
mkdir regtests/ww3_tp2.14/input/oasis3-mct/doc
fi
cp -r data_regtests/ww3_tp2.14/input/oasis3-mct/doc/* regtests/ww3_tp2.14/input/oasis3-mct/doc/
cp -r data_regtests/ww3_tp2.14/input/toy/*.nc.OAS*CM regtests/ww3_tp2.14/input/toy/
cp -r data_regtests/ww3_tp2.14/input/toy/r-toy.nc.OASACM regtests/ww3_tp2.14/input/toy/r-toy.nc.OASACM2
cp -r data_regtests/ww3_tp2.14/input/toy/toy_coupled_field.nc.OASACM regtests/ww3_tp2.14/input/toy/toy_coupled_field.nc.OASACM2
cp -r data_regtests/ww3_tp2.14/input/toy/*.nc regtests/ww3_tp2.14/input/toy/
cp -r data_regtests/ww3_tp2.17/input/* regtests/ww3_tp2.17/input/

Expand Down
38 changes: 26 additions & 12 deletions model/ftn/ww3_shel.ftn
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
!/ 14-Sep-2018 : Remove PALM implementation ( version 6.06 )
!/ 04-Oct-2019 : Inline Output implementation ( version 6.07 )
!/ (Roberto Padilla-Hernandez)
!/ 16-Jul-2020 : Variable coupling time step ( version 7.08 )
!/
!/ Copyright 2009-2012 National Weather Service (NWS),
!/ National Oceanic and Atmospheric Administration. All rights
Expand Down Expand Up @@ -797,6 +798,17 @@
ODAT(28) = MAX ( 0 , ODAT(28) )
ODAT(33) = MAX ( 0 , ODAT(33) )
ODAT(38) = MAX ( 0 , ODAT(38) )
!
!/COU ! Test the validity of the coupling time step
!/COU IF (ODAT(33) == 0) THEN
!/COU IF ( IAPROC .EQ. NAPOUT ) THEN
!/COU WRITE(NDSO,1010) ODAT(33), INT(DTMAX)
!/COU END IF
!/COU ODAT(33) = INT(DTMAX)
!/COU ELSE IF (MOD(ODAT(33),INT(DTMAX)) .NE. 0) THEN
!/COU GOTO 2009
!/COU END IF
!
! 2.5 Output types

NPTS = 0
Expand Down Expand Up @@ -1638,14 +1650,6 @@
TTIME(1) = 0
TTIME(2) = 0
DTTST = REAL ( ODAT(5*(J-1)+3) )
!/COU ! Force coupling time step to model time step
!/COU IF ( J .EQ. 7 .AND. DTTST.NE.DTMAX ) THEN
!/COU IF ( IAPROC .EQ. NAPOUT ) THEN
!/COU WRITE (NDSO,1009) DTTST, DTMAX
!/COU END IF
!/COU ODAT(5*(J-1)+3) = INT(DTMAX)
!/COU DTTST = DTMAX
!/COU END IF
CALL TICK21 ( TTIME , DTTST )
CALL STME21 ( TTIME , DTME21 )
IF ( ( ODAT(5*(J-1)+1) .NE. ODAT(5*(J-1)+4) .OR. &
Expand Down Expand Up @@ -2411,6 +2415,10 @@
2008 CONTINUE
IF ( IAPROC .EQ. NAPERR ) WRITE (NDSE,1008) IERR
CALL EXTCDE ( 1008 )
!
!/COU 2009 CONTINUE
!/COU IF ( IAPROC .EQ. NAPERR ) WRITE (NDSE,1009) ODAT(33), NINT(DTMAX)
!/COU CALL EXTCDE ( 1009 )
!
2054 CONTINUE
IF ( IAPROC .EQ. NAPERR ) WRITE (NDSE,1054)
Expand Down Expand Up @@ -2550,10 +2558,16 @@
1008 FORMAT (/' *** WAVEWATCH III ERROR IN W3SHEL : *** '/ &
' ERROR IN OPENING OUTPUT FILE'/ &
' IOSTAT =',I5/)
1009 FORMAT (/' *** WAVEWATCH III WARNING IN W3SHEL : *** '/ &
' COUPLING AND MODEL TIME STEPS NOT CONSISTENT'/ &
' IT WILL OVERWRITE COUPLING TIME STEP'/ &
' FROM ',F4.1, ' TO ',F4.1/)
!
!/COU 1009 FORMAT (/' *** WAVEWATCH III ERROR IN W3SHEL : *** '/ &
!/COU ' COUPLING TIME STEP NOT MULTIPLE OF'/ &
!/COU ' MODEL TIME STEP: ',I6, I6/)
!
!/COU 1010 FORMAT (/' *** WAVEWATCH III WARNING IN W3SHEL : *** '/ &
!/COU ' COUPLING TIME STEP NOT DEFINED, '/ &
!/COU ' IT WILL BE OVERRIDEN TO DEFAULT VALUE'/ &
!/COU ' FROM ',I6, ' TO ',I6/)
!
1054 FORMAT (/' *** WAVEWATCH III ERROR IN W3SHEL : *** '/ &
' POINT OUTPUT ACTIVATED BUT NO POINTS DEFINED'/)
!
Expand Down
18 changes: 14 additions & 4 deletions regtests/bin/matrix.base
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
prop1D prop2D time fetch hur1mg \
multi01 multi02 multi03 multi04 multi05 \
hybd shwtr unstr pdlib smcgr mudice infgrv \
uost assim calendar multi06 multi07 multi08
uost assim calendar oasis multi06 multi07 multi08
do
eval " value=\$$par"
# echo "$par = $value"
Expand Down Expand Up @@ -85,6 +85,7 @@
echo " echo ' Multi 07 (unstr. + reg. grds) : $multi07'" >> matrix.head
echo " echo ' Multi 08 (with ice) : $multi08'" >> matrix.head
echo " echo ' Assim Update of the restart file : $assim'" >> matrix.head
echo " echo ' OASIS coupling : $oasis'" >> matrix.head
echo " echo ' Calendar type : $calendar'" >> matrix.head
echo " echo ' '" >> matrix.head
if [ -n "$filter" ]
Expand Down Expand Up @@ -2003,9 +2004,18 @@
echo "$rtst -s ST4 -w work_UPD6_U_cap -i input_UPD6_U_cap $ww3 ww3_ta1" >> matrix.body
fi

# 365_day and 360_day calendars, no switch sharing here

if [ "$calendar" = 'y' ] && [ "$shrd" = 'y' ]
#Test of atmosphere, ocean, and ice coupling using OASIS
if [ "$oasis" = 'y' ] && [ "$dist" = 'y' ]
then
echo ' ' >> matrix.body
echo "$rtst -s OASACM -w work_OASACM -C OASIS -f -p $mpi -n $np -o netcdf $ww3 ww3_tp2.14" >> matrix.body
echo "$rtst -s OASACM2 -w work_OASACM2 -C OASIS -f -p $mpi -n $np -o netcdf $ww3 ww3_tp2.14" >> matrix.body
echo "$rtst -s OASOCM -w work_OASOCM -C OASIS -f -p $mpi -n $np -o netcdf $ww3 ww3_tp2.14" >> matrix.body
echo "$rtst -s OASICM -w work_OASICM -C OASIS -f -p $mpi -n $np -o netcdf $ww3 ww3_tp2.14" >> matrix.body
fi

# 365_day and 360_day calendars, no switch sharing here
if [ "$calendar" = 'y' ]
then
echo ' ' >> matrix.body
echo "$rtst -g STD -w work_STD -o netcdf $ww3 ww3_tc1" >> matrix.body
Expand Down
10 changes: 6 additions & 4 deletions regtests/bin/matrix.comp
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@
# 3. Looping over work directories #
# --------------------------------------------------------------------------- #

cases=$(find . -maxdepth 1 -type d -name "work*")
cases=$(find . -maxdepth 1 -type d -name "work*" | grep -v work_oasis)
# skip to next tst if no work directory
echo 'run : ' $cases
if [ -z "$cases" ] ; then
Expand Down Expand Up @@ -159,7 +159,7 @@
binaryfiles=`grep . -r * | grep 'Binary file' | sed -e "s/^Binary file //" -e "s/ matches$//"`

#Generate list of files to skip
skipfiles="ww3_shel.out ww3_multi.out prf.*.mww3 finished ww3_systrk.out gmon.out time_count.txt"
skipfiles="ww3_shel.out ww3_multi.out prf.*.mww3 finished ww3_systrk.out gmon.out time_count.txt oasis_make.out oasis_clean.out toy_make.out toy_clean.out"

nf_1=`echo $files_1 | wc -w | awk '{print $1}'`
echo " found $nf_1 files in base directory" >> $home_dir/fulldiff.tmp
Expand Down Expand Up @@ -192,7 +192,7 @@
if [[ $skipfiles =~ (^|[[:space:]])"$file"($|[[:space:]]) ]]
then
filetype="skip"
elif [[ $file == log.* ]]
elif [[ $file == log.* ]] || [[ $file == "output.ww3" ]]
then
filetype="log"
elif [[ $binaryfiles =~ (^|[[:space:]])"$file"($|[[:space:]]) ]]
Expand Down Expand Up @@ -232,7 +232,9 @@
sed -n '/version/!p' | \
sed -n '/date :/!p' | \
sed -n '/time :/!p' | \
sed -n '/Elapsed/!p' > diff_tempfile
sed -n '/Elapsed/!p' | \
sed -n '/calculating for/!p' | \
sed -n '/computation loop at/!p' > diff_tempfile
else
diff $file $return_comp/$run/$file > diff_tempfile
fi
Expand Down
2 changes: 2 additions & 0 deletions regtests/bin/matrix_datarmor
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,8 @@
export infgrv='y' # Second harmonic generation tests
export uost='y' # ww3_ts4 Unresolved Obstacles Source Term (UOST)
export assim='y' # Restart spectra update
export oasis='y' # Atmosphere, ocean, and ice coupling using oasis
export calendar='y' # Calendar type

export multi01='y' # mww3_test_01 (wetting and drying)
export multi02='y' # mww3_test_02 (basic two-way nesting test))
Expand Down
2 changes: 2 additions & 0 deletions regtests/bin/matrix_ncep
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,8 @@ fi
export infgrv='y' # Second harmonic generation tests
export uost='y' # ww3_ts4 Unresolved Obstacles Source Term (UOST)
export assim='y' # Restart spectra update
export oasis='y' # Atmosphere, ocean, and ice coupling using OASIS
export calendar='y' # Calendar type

export multi01='y' # mww3_test_01 (wetting and drying)
export multi02='y' # mww3_test_02 (basic two-way nesting test))
Expand Down
8 changes: 5 additions & 3 deletions regtests/bin/matrix_ukmo_cray
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,15 @@
if [[ $comp == "CCE" ]]; then
# Load targetted versions of Cray Development Tools (bug in Fortran StreamIO
# for older versions) and netCDF/HDF5 modules:
cmplr="ukmo_cray"
echo " module load cdt/18.12" >> matrix.head
echo " module load cray-netcdf/4.6.1.3" >> matrix.head
echo " module load cray-hdf5/1.10.2.0" >> matrix.head
echo " export METIS_PATH=/home/d02/frey/WW3/ParMETIS" >> matrix.head
elif [[ $comp == "GNU" ]]; then
# ParMETIS library not currently working with Cray compiler.
# Use GNU compiler for programs that use PDLIB.
cmplr="ukmo_cray_gnu"
echo " module switch PrgEnv-cray PrgEnv-gnu/5.2.82" >> matrix.head
echo " module load cray-netcdf" >> matrix.head
echo " export METIS_PATH=/home/d02/frey/WW3/ParMETIS_GNU" >> matrix.head
Expand All @@ -81,11 +83,10 @@ fi
echo " export WWATCH3_NETCDF=NC4" >> matrix.head
echo " export NETCDF_CONFIG=\$(which nc-config)" >> matrix.head

# Compiler option. Choose appropriate compiler and set cmplOption to
# Compiler option. Set cmplOption to
# y if using for the first time or using a different compiler

cmplr=cray_xc.${comp}
export cmplOption='n'
export cmplOption='y'

export mpi='mpiexec'
export np='16'
Expand Down Expand Up @@ -122,6 +123,7 @@ fi
export infgrv='y' # Second harmonic generation tests
export uost='y' # ww3_ts4 Unresolved Obstacles Source Term (UOST)
export assim='y' # Restart spectra update
export oasis='y' # Atmosphere, ocean, and ice coupling using oasis
export calendar='y' # Calendar type

export multi01='y' # mww3_test_01 (wetting and drying)
Expand Down
2 changes: 2 additions & 0 deletions regtests/bin/matrix_zeus_HLT
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@
export infgrv='y' # Second harmonic generation tests
export uost='y' # ww3_ts4 Unresolved Obstacles Source Term (UOST)
export assim='y' # Restart spectra update
export oasis='y' # Atmosphere, ocean, and ice coupling using oasis
export calendar='y' # Calendar type

export multi01='y' # mww3_test_01 (wetting and drying)
export multi02='y' # mww3_test_02 (basic two-way nesting test))
Expand Down
14 changes: 14 additions & 0 deletions regtests/ww3_tp2.14/input/TOYNAMELIST.nam.OASACM2
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
&NAM_OASIS IL_NB_TIME_STEPS=10,
DELTA_T=360,
DATA_FILENAME='grid_toy_model.nc' /

&NAM_FCT_SEND CTYPE_FCT='FILES',
CNAME_FILE='toy_coupled_field.nc',
VALUE=10 /

&NAM_RECV_FIELDS NB_RECV_FIELDS=1,
CRCVFIELDS(1)='TOY__CHA' /

&NAM_SEND_FIELDS NB_SEND_FIELDS=2,
CSNDFIELDS(1)='TOY_U10M',
CSNDFIELDS(2)='TOY_V10M' /
2 changes: 1 addition & 1 deletion regtests/ww3_tp2.14/input/TOYNAMELIST.nam.OASICM
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@
CRCVFIELDS(1)='TOY_ICEF' /

&NAM_SEND_FIELDS NB_SEND_FIELDS=3,
CSNDFIELDS(1)='TOY__IC1,
CSNDFIELDS(1)='TOY__IC1',
CSNDFIELDS(2)='TOY__IC5',
CSNDFIELDS(3)='TOY__ICE' /
135 changes: 135 additions & 0 deletions regtests/ww3_tp2.14/input/namcouple.OASACM2
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
# This is a typical input file for OASIS3-MCT.
# Keywords used in previous versions of OASIS3
# but now obsolete are marked "Not used"
# Don't hesitate to ask precisions or make suggestions (oasishelp@cerfacs.fr).
#
# Any line beginning with # is ignored. Blank lines are not allowed.
#
#########################################################################
$NFIELDS
# The number of fields described in the second part of the namcouple.
#
3
$END
#########################################################################
$NBMODEL
# The number of models in this experiment + their names (6 characters)
#
2 toyexe wwatch
$END
###########################################################################
$RUNTIME
# The total simulated time for this run in seconds
#
3600
$END
###########################################################################
$NLOGPRT
# The first (0 to 30) and second (0 to 3) numbers refer to the ammount of
# debug and time statistic information written by OASIS3-MCT for each model
# and processor (see user manual for more details)
#
1
$END
###########################################################################
$STRINGS
#
# The above variables are the general parameters for the experiment.
# Everything below has to do with the fields being exchanged.
#
# line 1: field in ww3 model, field in target model, unused, coupling
# period, number of transformation, restart file, field status
# line 2: nb of pts for ww3 grid without halo first dim, and second dim,
# for target grid first dim, and second dim (optionals, default=0),
# ww3 grid name, target grid name, lag index
# line 3: ww3 grid periodical (P) or regional (R), and nb of overlapping
# points, target grid periodical (P) or regional (R), and number of
# overlapping points
# line 4: list of transformations performed
# line 5: parameters for each transformation
#
# See the correspondances between WW3 and OASIS fields below:
#
# |--------------------------------------------------------------|
# | received fields by ww3 from Ocean model : WW3 | OASIS |
# |--------------------------------------------------------------|
# | not defined | WW3_OWDH WW3_OWDU WW3_OWDV |
# | SSH | WW3__SSH |
# | CUR | WW3_OSSU WW3_OSSV |
# |--------------------------------------------------------------|
# | received fields by ww3 from Atmospheric model : WW3 | OASIS |
# --------------------------------------------------------------|
# | WND | WW3__U10 WW3__V10 |
# |--------------------------------------------------------------|
# | received fields by ww3 from Ice model : WW3 | OASIS |
# --------------------------------------------------------------|
# | ICE | WW3__ICE |
# | IC1 | WW3__IC1 |
# | IC5 | WW3__IC5 |
# |--------------------------------------------------------------|
# | sent fields by ww3 to Ocean model : WW3 | OASIS |
# |--------------------------------------------------------------|
# | not defined | WW3_ODRY |
# | T0M1 | WW3_T0M1 |
# | HS | WW3__OHS |
# | DIR | WW3_CDIR WW3_SDIR |
# | BHD | WW3__BHD |
# | TWO | WW3_TWOX WW3_TWOY |
# | UBR | WW3__UBR |
# | FOC | WW3__FOC |
# | TAW | WW3_TAWX WW3_TAWY |
# | LM | WW3___LM |
# | OCHA | WW3_OCHA |
# |--------------------------------------------------------------|
# | sent fields by ww3 to Atmospheric model : WW3 | OASIS |
# |--------------------------------------------------------------|
# | CUR | WW3_WSSU WW3_WSSV |
# | ACHA | WW3_ACHA |
# | HS | WW3__AHS |
# | FP | WW3___FP |
# | FWS | WW3__FWS |
# |--------------------------------------------------------------|
# | sent fields by ww3 to Ice model : WW3 | OASIS |
# |--------------------------------------------------------------|
# | TWI | WW3_TWIX WW3_TWIY |
# | IC5 | WW3_ICEF |
# |--------------------------------------------------------------|
#
#
#
# ------------------------------------------
# TOY (toyexe) ==> WW3 (wwatch)
# ------------------------------------------
#
#~~~~~~~~~~~
# Field 1 :
#~~~~~~~~~~~
TOY_U10M WW3__U10 1 360 1 r-toy.nc EXPOUT
80 80 103 119 toyt ww3t LAG=+360
R 0 R 0
SCRIPR
DISTWGT LR SCALAR LATLON 1 4
#
#~~~~~~~~~~~
# Field 2 :
#~~~~~~~~~~~
TOY_V10M WW3__V10 1 360 1 r-toy.nc EXPOUT
80 80 103 119 toyt ww3t LAG=+360
R 0 R 0
SCRIPR
DISTWGT LR SCALAR LATLON 1 4
#
# -----------------------------------------
# WW3 (wwatch) ==> TOY (toyexe)
# -----------------------------------------
#
#~~~~~~~~~~~
# Field 3 :
#~~~~~~~~~~~
WW3_ACHA TOY__CHA 1 360 1 r-ww3.nc EXPOUT
103 119 80 80 ww3t toyt LAG=+360
R 0 R 0
SCRIPR
DISTWGT LR SCALAR LATLON 1 4
#
$END
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ F90 = <comp_mpi>
F = $(F90)
f90 = $(F90)
f = $(F90)
CC = icc
CC = <wwatch3_cc>
AR = ar
ARFLAGS = -ruv
F90COMP = <optc_short>
Expand Down
Loading

0 comments on commit 5c361aa

Please sign in to comment.