Skip to content

Commit

Permalink
Merge pull request #8 from ecmwf-ifs/naan-ifs-source-sync
Browse files Browse the repository at this point in the history
ifs-source sync
  • Loading branch information
wdeconinck authored Jan 25, 2024
2 parents 64f95e5 + 552a536 commit fcadfe8
Show file tree
Hide file tree
Showing 145 changed files with 4,227 additions and 5,453 deletions.
2 changes: 2 additions & 0 deletions .github/tools/install-mpi.sh
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ case "$os" in
openmpi)
brew ls --versions openmpi || brew install openmpi
echo "localhost slots=72" >> $(brew --prefix)/etc/openmpi-default-hostfile
echo "localhost slots=72" >> $(brew --prefix)/etc/prte-default-hostfile

# workaround for open-mpi/omp#7516
echo "setting the mca gds to hash..."
echo "gds = hash" >> $(brew --prefix)/etc/pmix-mca-params.conf
Expand Down
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
cmake_minimum_required( VERSION 3.24 FATAL_ERROR )
find_package( ecbuild 3.4 REQUIRED HINTS ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/../ecbuild )

set(PARENT_PROJECT_NAME "${PROJECT_NAME}")
if( NOT ECWAM_PROJECT_NAME )
set( ECWAM_PROJECT_NAME ecwam )
endif()
Expand Down Expand Up @@ -54,6 +55,10 @@ ecbuild_add_option( FEATURE ECWAM_LAUNCH
DEFAULT ON
DESCRIPTION "Use share/ecwam/scripts/ecwam-launch script to run ecwam tests" )

ecbuild_add_option( FEATURE ECFLOW
DESCRIPTION "ecflow meter updates"
REQUIRED_PACKAGES "ecflow_light")

if( HAVE_ECWAM_LAUNCH )
# Overwrite meaning of mpiexec
set( ECWAM_LAUNCH ${CMAKE_CURRENT_SOURCE_DIR}/share/ecwam/scripts/ecwam-launch )
Expand Down
4 changes: 2 additions & 2 deletions cmake/ecwam_fetchcontent_field_api.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ set(clone_field_api TRUE)
if(field_api_FOUND)
cmake_path(RELATIVE_PATH field_api_DIR BASE_DIRECTORY ${CMAKE_BINARY_DIR} OUTPUT_VARIABLE path_var)
cmake_path(GET path_var PARENT_PATH parent_path)
string(FIND ${parent_path} "../" result_var)
string(FIND ${parent_path} "_deps" result_var)

# If field_api is found but was not cloned by ecWAM, clone_field_api is set to FALSE
string(COMPARE EQUAL ${result_var} "-1" clone_field_api)
string(COMPARE NOTEQUAL ${result_var} "-1" clone_field_api)
endif()

if( clone_field_api )
Expand Down
8 changes: 8 additions & 0 deletions share/ecwam/scripts/ecwam_run_model.sh
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,11 @@ for restart_time in $(read_config output.restart.at[:].time --format=%Y%m%d%H%M%
NAOS+="&NAOS CLSOUT=\"${restart_time}\" /"
done

# MODEL SETUP:
##############
wamnang=$(read_config directions)
wamnfre=$(read_config frequencies)

nproma=$(read_config nproma --default=24)

# read timesteps
Expand Down Expand Up @@ -196,6 +201,9 @@ ln -s ${DATA_DIR}/${forcings_file} sfcwindin

cat > wam_namelist << EOF
&NALINE
NANG = ${wamnang},
NFRE = 36,
NFRE_RED = ${wamnfre},
CLHEADER = " WAVE MODEL ",
CBPLTDT = "${begofrn}",
CEPLTDT = "${endofrn}",
Expand Down
3 changes: 0 additions & 3 deletions share/ecwam/scripts/ecwam_run_preproc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ function cleanup() {

wamresol=$(read_config grid)
wamnfre=$(read_config frequencies)
wamnang=$(read_config directions)
wambathy=$(read_config bathymetry)

assert_executable_is_available ${PREPROC} || abort 33
Expand Down Expand Up @@ -111,15 +110,13 @@ cat > procin <<EOF
NFRE_RED= ${wamnfre},
FR1= ${fr1},
IFRE1= ${ifre1},
NANG= ${wamnang},
IRGG= ${irgg},
XDELLA= ${xdella},
XDELLO= ${xdella},
AMOSOP= ${amosop},
AMONOP= ${amonop},
AMOWEP= ${amowep},
AMOEAP= ${amoeap},
DEPTHA= ${deptha},
LAQUA= ${laqua},
LLOBSTRCT= ${llobstrct},
LLUNSTR = ${llunstr},
Expand Down
8 changes: 8 additions & 0 deletions share/ecwam/scripts/ecwam_run_preset.sh
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,11 @@ begofrn=$(read_config begin --format="%Y%m%d%H%M%S")
endofrn=$(read_config end --format="%Y%m%d%H%M%S")
begoffo=$(read_config forcings.at[1].begin --format="%Y%m%d%H%M%S" --default=${endofrn} )

# MODEL SETUP:
##############
wamnang=$(read_config directions)
wamnfre=$(read_config frequencies)

forcings_file=$(read_config forcings.file)

opti=1
Expand Down Expand Up @@ -206,6 +211,9 @@ cat > PREINFO <<EOF
MARSTYPE = "an"
YCLASS = "rd"
YEXPVER = "wave"
NANG = ${wamnang}
NFRE = 36
NFRE_RED = ${wamnfre}
/
EOF

Expand Down
22 changes: 21 additions & 1 deletion src/ecwam/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,13 @@ list( APPEND ecwam_srcs
cireduce.F90
ciwabr.F90
ciwaf.F90
ctcor.F90
ctuw.F90
ctuwdrv.F90
ctuwini.F90
ctuwupdt.F90
current2wam.F90
depthprpt.F90
difdate.F90
dominant_period.F90
expand_string.F90
Expand Down Expand Up @@ -106,6 +108,7 @@ list( APPEND ecwam_srcs
initnemocpl.F90
iniwcst.F90
intpol.F90
intrpolchk.F90
intspec.F90
inwgrib.F90
iwam_get_unit.F90
Expand All @@ -126,6 +129,7 @@ list( APPEND ecwam_srcs
meansqs.F90
meansqs_gc.F90
meansqs_lf.F90
mfr.F90
mfredir.F90
mgrid.F90
micep.F90
Expand All @@ -148,7 +152,6 @@ list( APPEND ecwam_srcs
mpuserin.F90
mstart.F90
mswell.F90
mtabs.F90
mubuf.F90
mwp1.F90
mwp2.F90
Expand Down Expand Up @@ -191,9 +194,11 @@ list( APPEND ecwam_srcs
propags.F90
propags1.F90
propags2.F90
propconnect.F90
propdot.F90
readbou.F90
readfl.F90
readmdlconf.F90
readpre.F90
readsta.F90
readstress.F90
Expand Down Expand Up @@ -258,8 +263,12 @@ list( APPEND ecwam_srcs
vmin_d.F90
vplus.F90
vplus_d.F90
w_cdf.F90
w_cdfmax.F90
w_maxh.F90
w_mode_st.F90
w_pdf.F90
w_pmax.F90
wam_multio_mod.F90
wam_nproma.F90
wam_sorti.F90
Expand Down Expand Up @@ -411,6 +420,10 @@ else()
unset( ${PNAME}_OCEANMODEL_INCLUDE_DIRS )
endif()

if( HAVE_ECFLOW )
list(APPEND ECWAM_PRIVATE_DEFINITIONS WAM_HAVE_ECFLOW)
endif()

ecbuild_add_library(
TARGET ${ecwam}
SOURCES ${ecwam_srcs}
Expand All @@ -421,8 +434,10 @@ ecbuild_add_library(
${MULTIO_LIBRARIES}
${OpenMP_Fortran_LIBRARIES}
field_api_${prec}
$<${HAVE_ECFLOW}:ecflow_lightf>
PUBLIC_INCLUDES $<INSTALL_INTERFACE:include>
PRIVATE_INCLUDES ${${PNAME}_OCEANMODEL_INCLUDE_DIRS}
PRIVATE_DEFINITIONS ${ECWAM_PRIVATE_DEFINITIONS}
PUBLIC_DEFINITIONS ${ECWAM_DEFINITIONS}
)

Expand All @@ -441,8 +456,13 @@ ecwam_target_compile_definitions_FILENAME( ${ecwam} )

if( CMAKE_Fortran_COMPILER_ID MATCHES Intel )
set_source_files_properties( mubuf.F90 PROPERTIES COMPILE_OPTIONS "-fp-model;strict" )
set_source_files_properties( propconnect.F90 PROPERTIES COMPILE_OPTIONS "-fp-model;strict" )
elseif( CMAKE_Fortran_COMPILER_ID MATCHES GNU )
set_source_files_properties( mubuf.F90 PROPERTIES COMPILE_OPTIONS "-ffp-contract=off" )
elseif(CMAKE_Fortran_COMPILER_ID MATCHES "PGI|NVHPC")
set_source_files_properties(
sbottom.F90 PROPERTIES COMPILE_FLAGS " -g -O1 -Mflushz -Mno-signed-zeros -Mstack_arrays "
)
endif()

### The file grib2wgrid.F90 is sensitive to optimizations in single precision builds.
Expand Down
6 changes: 3 additions & 3 deletions src/ecwam/buildstress.F90
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ SUBROUTINE BUILDSTRESS(BLK2LOC, WVENVI, FF_NOW, NEMO2WAM, IREAD)
CALL READWGRIB(IU06, FILNM, IPARAM, CDTPRO, &
& BLK2LOC, &
& NXFFS, NXFFE, NYFFS, NYFFE, FIELDG, &
& CD, KZLEVUWAVE, LLONLYPOS, IREAD, FF_NOW)
& FF_NOW%WSWAVE , KZLEVUWAVE, LLONLYPOS, IREAD)

WRITE(IU06,*) ' '
WRITE(IU06,*) ' A DATA FILE CONTAINING WIND SPEED INFORMATION'
Expand Down Expand Up @@ -268,13 +268,13 @@ SUBROUTINE BUILDSTRESS(BLK2LOC, WVENVI, FF_NOW, NEMO2WAM, IREAD)
DO IJ = KIJS, KIJL
!! UFRIC WILL FIRST CONTAIN ITS SQUARE
!! THE NUMERICAL RELATION BETWEEN UFRIC AND WSWAVE SHOULD
!! ALWAYS BE AS IN OUTGRID
!! ALWAYS BE AS IN OUTBETA
FF_NOW%UFRIC(IJ,ICHNK) = CD(IJ, ICHNK) * MAX(FF_NOW%WSWAVE(IJ,ICHNK)**2, EPSU10**2)
FF_NOW%UFRIC(IJ,ICHNK) = MAX(FF_NOW%UFRIC(IJ,ICHNK), EPSUS)
USTAR = SQRT(FF_NOW%UFRIC(IJ,ICHNK))
CDSQRTINV = MIN(1._JWRB/SQRT(CD(IJ, ICHNK)), 50.0_JWRB)
Z0TOT = TEMPXNLEV*EXP(-XKAPPA*CDSQRTINV)
! Z0M ONLY CONTAINS CHARNOCK CONTRIBUTION (see taut_z0)
! Z0M SHOULD ONLY CONTAIN THE CHARNOCK CONTRIBUTION (see taut_z0) TO DETERMINE TAUW
FF_NOW%Z0M(IJ,ICHNK) = MAX(Z0TOT - RNUM/USTAR, ALPHAOG(IJ, ICHNK)*FF_NOW%UFRIC(IJ,ICHNK))
CHARNOCKOG = FF_NOW%Z0M(IJ,ICHNK)/FF_NOW%UFRIC(IJ,ICHNK)
CHARNOCKOG = MAX(CHARNOCKOG, ALPHAOG(IJ, ICHNK))
Expand Down
2 changes: 1 addition & 1 deletion src/ecwam/cal_second_order_spec.F90
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ SUBROUTINE CAL_SECOND_ORDER_SPEC(KIJS, KIJL, F1, WAVNUM, DEPTH, SIG)
USE PARKIND_WAVE, ONLY : JWIM, JWRB, JWRU

USE YOWFRED , ONLY : FR, DFIM, DELTH,TH,FRATIO
USE YOWPARAM, ONLY : NANG, NFRE, CLDOMAIN
USE YOWPARAM, ONLY : NANG, NFRE
USE YOWPCONS, ONLY : G, PI, ZPI
USE YOWSHAL , ONLY : NDEPTH, DEPTHA, DEPTHD
USE YOWTABL , ONLY : MR, XMR, MA, XMA, NFREH, NANGH, NMAX, &
Expand Down
46 changes: 6 additions & 40 deletions src/ecwam/check.F90
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,13 @@ SUBROUTINE CHECK (IINPC)
! ----------------------------------------------------------------------
USE PARKIND_WAVE, ONLY : JWIM, JWRB, JWRU

USE YOWPARAM , ONLY : NANG ,NFRE ,NFRE_RED , &
& NGX ,NGY ,NIBLO
USE YOWPARAM , ONLY : NANG ,NFRE ,NFRE_RED
USE YOWPCONS , ONLY : DEG
USE YOWCPBO , ONLY : IBOUNC ,NBOUNC ,IJARC
USE YOWFPBO , ONLY : IBOUNF ,NBOUNF ,IJARF
USE YOWCOUT , ONLY : NGOUT ,IJAR
USE YOWGRID , ONLY : IJS ,IJL
USE YOWMAP , ONLY : BLK2GLO ,NX ,NY , &
USE YOWMAP , ONLY : BLK2GLO ,NGX ,NGY ,NIBLO, &
& AMOWEP ,AMOSOP ,AMOEAP ,AMONOP ,XDELLO
USE YOWSHAL , ONLY : NDEPTH
USE YOWTEST , ONLY : IU06

! ----------------------------------------------------------------------
Expand Down Expand Up @@ -86,8 +83,8 @@ SUBROUTINE CHECK (IINPC)
!* 2. GENERATE LAND SEA TABLE FROM INDEX ARRAYS.
! ------------------------------------------

DO K=1,NY
DO I=1,NX
DO K=1,NGY
DO I=1,NGX
LST(I,K) = 'L'
ENDDO
ENDDO
Expand All @@ -97,32 +94,6 @@ SUBROUTINE CHECK (IINPC)
IF (BLK2GLO%IXLG(IJ) /= 0 .OR. BLK2GLO%KXLT(IJ) /= 0) LST(BLK2GLO%IXLG(IJ),BLK2GLO%KXLT(IJ)) = 'S'
ENDDO

!* 2.1 INCLUDE OUTPUT POINTS.
! ----------------------

IF (NGOUT > 0) THEN
DO IO=1,NGOUT
IJ = IJAR(IO)
IF (IJ < IJS .OR. IJ > IJL) THEN
IERR = IERR+1
WRITE (IU06,*) ' ***************************************'
WRITE (IU06,*) ' * *'
WRITE (IU06,*) ' * FATAL ERROR IN SUB. CHECK *'
WRITE (IU06,*) ' * ========================= *'
WRITE (IU06,*) ' * *'
WRITE (IU06,*) ' * GRID POINT NUMBER OF OUTPUT POINT IS*'
WRITE (IU06,*) ' * OUT OF RANGE. *'
WRITE (IU06,*) ' * OUTPUT POINT NUMBER IS IO = ', IO
WRITE (IU06,*) ' * GRID POINT NUMBER IS IJ = ', IJ
WRITE (IU06,*) ' * MIN. NUMBER IS IJS = ', IJS
WRITE (IU06,*) ' * MAX. NUMBER IS IJL = ', IJL
WRITE (IU06,*) ' * *'
WRITE (IU06,*) ' ***************************************'
IF (IERR > 20) CALL ABORT1
ENDIF
IF (BLK2GLO%IXLG(IJ) /= 0 .OR. BLK2GLO%KXLT(IJ) /= 0) LST(BLK2GLO%IXLG(IJ),BLK2GLO%KXLT(IJ)) = '+'
ENDDO
ENDIF

!* 2.2 INCLUDE COARSE GRID NEST OUTPUT POINTS.
! ---------------------------------------
Expand Down Expand Up @@ -204,16 +175,11 @@ SUBROUTINE CHECK (IINPC)
WRITE (IU06,'('' NUMBER OF FREQUENCIES NFRE_RED '', 3I10)') &
& NFRE_RED, NFRE_RED, NFRE_RED
WRITE (IU06,'('' NUMBER LONGITUDE GRID POINTS NGX '', 3I10)') &
& NGX, NX, NX
& NGX, NGX, NGX
WRITE (IU06,'('' NUMBER LATITUDE GRID POINTS NGY '', 3I10)') &
& NGY, NY, NY
& NGY, NGY, NGY
WRITE (IU06,'('' MAXIMUM BLOCK LENGTH NIBLO '', 3I10)') &
& NIBLO
WRITE (IU06,'('' NUMBER OF OUTPUT POINTS NGOUT '', 3I10)') &
& NGOUT, MAX(1,NGOUT), NGOUT

WRITE (IU06,'('' SHALLOW WATER TABLE LEN. NDEPTH '', 3I10)') &
& NDEPTH, NDEPTH, NDEPTH

WRITE (IU06,'(/,'' THE DIMENSIONS IN PRESET AND CHIEF HAVE TO '', &
& '' BE THE VALUES IN COLUMN - REQUIRED - '')')
Expand Down
Loading

0 comments on commit fcadfe8

Please sign in to comment.