Skip to content

Commit

Permalink
Merge pull request #9 from mvertens/feature/updated_workflow
Browse files Browse the repository at this point in the history
updates to use either PR1 or PR3 easily
  • Loading branch information
mvertens authored Jul 14, 2023
2 parents 5592802 + 8a4c186 commit 65942b6
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 9 deletions.
20 changes: 15 additions & 5 deletions model/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,23 @@ message("ESMF_F90COMPILEPATHS: ${ESMF_F90COMPILEPATHS}")
#-------------------------
# Determine switches
#-------------------------
list(APPEND switches "CESMCOUPLED" "NCO" "DIST" "MPI" "PR3" "UQ" "FLX0" "SEED" "ST4" "STAB0" "NL1" "BT1" "DB1" "MLIM" "FLD2" "TR0" "BS0" "RWND" "WNX1" "WNT1" "CRX1" "CRT1" "O0" "O1" "O2" "O3" "O4" "O5" "O6" "O7" "O14" "O15" "IS0" "REF0" "NOGRB")
list(APPEND switches "CESMCOUPLED" "DIST" "MPI" "FLX0" "SEED" "ST4" "STAB0" "NL1" "BT1" "DB1" "MLIM" "FLD2" "TR0" "BS0" "RWND" "WNX1" "WNT1" "CRX1" "CRT1" "O0" "O1" "O2" "O3" "O4" "O5" "O6" "O7" "O14" "O15" "IS0" "REF0" "NOGRB" "IC4" "NCO")

if (DEFINED USE_PR3)
list(APPEND switches PR3 UQ)
elseif (DEFINED USE_PR1)
list(APPEND switches PR1)
else()
message(FATAL_ERROR "either USE_PR3 or USE_PR1 must be defined")
endif()

# TODO: need to enamble IC4 with the unstructured implemention
if (DEFINED USE_UNSTRUCT)
list(APPEND switches "IC0" "PDLIB" "METIS")
list(APPEND switches "PDLIB" "METIS")
else()
list(APPEND switches "IC4" "OMPG" "OMPH")
list(APPEND switches "OMPG" "OMPH")
endif()


#-------------------------
# Include list of src files to make file more readable
# defines variables "ftn_src", "nuopc_mesh_cap_src", "pdlib_src", "scrip_src", and "scripnc_src"
Expand All @@ -75,12 +83,14 @@ endif()
# Determine switch specific files
# Include check_switches as a function for less verbosity in this CMakeLists.txt
#-------------------------
message(STATUS "switches are : ${switches}")
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/check_switches.cmake)
check_switches("${switches}" switch_files)

message(STATUS "----status of source files-----")
message(STATUS "---")
message(STATUS "list of always source files is : ${ftn_src}")
message(STATUS "list of switch files is : ${switch_files}")
message(STATUS "---")

#-------------------------
# Now check in SourceMods to see if the file should be used instead
Expand Down
10 changes: 9 additions & 1 deletion model/src/w3src4md.F90
Original file line number Diff line number Diff line change
Expand Up @@ -2225,8 +2225,16 @@ SUBROUTINE W3SDS4 (A, K, CG, USTAR, USDIR, DEPTH, DAIR, SRHS, &
END DO
!
! Computes Breaking probability
! NOTE: for PR1 found that BTH occasionally went negative - so implemented the
! following fix for this
!
PB = (MAX(SQRT(BTH)-EPSR,0.))**2
do ik = IK1,NK
if (BTH(ik) < 0.) then
PB(ik) = 0.
else
PB(ik) = (MAX(SQRT(BTH(ik))-EPSR,0.))**2
end if
end do
!
! Multiplies by 28.16 = 22.0 * 1.6² * 1/2 with
! 22.0 (Banner & al. 2000, figure 6)
Expand Down
14 changes: 11 additions & 3 deletions model/src/wav_shel_inp.F90
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ subroutine read_shel_config(mpi_comm, mds, time0_overwrite, timen_overwrite)
character(len=80) :: linein
character(len=30) :: ofile ! w3_cou only
character(len=8) :: words(7)=''
character(len=256) :: filename
logical :: flflg, flhom, tflagi, prtfrm, flgnml, flh(-7:10)
integer :: thrlev = 1
integer :: time0(2), timen(2), ttime(2)
Expand Down Expand Up @@ -258,16 +259,23 @@ subroutine read_shel_config(mpi_comm, mds, time0_overwrite, timen_overwrite)
! Read nml file if available
!--------------------

inquire(file=trim(fnmpre)//"ww3_shel.nml", exist=flgnml)
#ifndef W3_CESMCOUPLED
filename = trim(fnmpre)//"ww3_shel.nml"
#else
filename = trim(fnmpre)//"wav_in"
#endif

inquire(file=trim(filename), exist=flgnml)

if (flgnml) then
open(newunit=ndsi, file=trim(fnmpre)//"ww3_shel.nml", status='old', iostat=ierr)

open(newunit=ndsi, file=trim(filename), status='old', iostat=ierr)

!--------------------
! Read namelist
!--------------------

call w3nmlshel (mpi_comm, ndsi, trim(fnmpre)//'ww3_shel.nml', nml_domain, nml_input, &
call w3nmlshel (mpi_comm, ndsi, trim(filename), nml_domain, nml_input, &
nml_output_type, nml_output_date, nml_homog_count, nml_homog_input, ierr)

!--------------------
Expand Down

0 comments on commit 65942b6

Please sign in to comment.