Skip to content

Commit

Permalink
Merge branch 'main' into main_ifs_thermo
Browse files Browse the repository at this point in the history
  • Loading branch information
JanStreffing committed Aug 19, 2024
2 parents d169703 + 0c5e307 commit f3b4732
Show file tree
Hide file tree
Showing 27 changed files with 5,669 additions and 774 deletions.
2 changes: 1 addition & 1 deletion config/namelist.config
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ runid='fesom'
&timestep
step_per_day=32 !96 !96 !72 !72 !45 !72 !96
run_length=62 !62 !62 !62 !28
run_length_unit='y' ! y, m, d, s
run_length_unit='y' ! y, m, d, s
/

&clockinit ! the model starts at
Expand Down
2 changes: 1 addition & 1 deletion config/namelist.cvmix
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,6 @@ tidal_vert_decayscale= 500.0 ! units: m; zeta in Simmons et al. (used to com
tidal_max_coeff = 50e-4 ! units: m^2/s; largest acceptable value for diffusivity
tidal_lcl_mixfrac = 0.33 !tidal dissipation efficiency (q in Simmons et al.), i.e. fraction of energy that dissipates locally
tidal_depth_cutoff = 0.0 !depth of the shallowest column where tidal mixing is computed (positive below surface)
tidal_botforc_file = '/work/ollie/pscholz/FORCING/IDEMIX/tidal_energy_gx1v6_20090205_rgrid.nc'
tidal_botforc_file = '/albedo/work/projects/p_pool_fesom1/fesom2.0/forcing/idemix/tidal_energy_gx1v6_20090205_rgrid.nc'
/

10 changes: 10 additions & 0 deletions config/namelist.dyn
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,15 @@ wsplit_maxcfl= 1.0 ! maximum allowed CFL criteria in vertical (0.5 < w_max_c
! in older FESOM it used to be w_exp_max=1.e-3
ldiag_KE=.false. ! activates energy diagnostics
AB_order=2

use_ssh_se_subcycl = .false.
se_BTsteps = 50
se_BTtheta = 0.14 ! default: 0.14,
se_bottdrag = .true.
se_bdrag_si = .true. ! bottomdrag semi-implicite/explicite
se_visc = .true.
se_visc_gamma0 = 10
se_visc_gamma1 = 19500 !19500 (core2@32spd), 2750 (core2@72spd)
se_visc_gamma2 = 0
/

1 change: 0 additions & 1 deletion docs/getting_started/getting_started.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ Supported systems are: generic ``ubuntu``, ``albedo`` at AWI, ``levante`` at DKR

git clone https://github.com/FESOM/fesom2.git
cd fesom2
git checkout refactoring
bash -l ./configure.sh

Create file ``fesom.clock`` in the output directory with the following content (if you plan to run with COREII forcing):
Expand Down
17 changes: 14 additions & 3 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@ endif()
if(${FESOM_PLATFORM_STRATEGY} STREQUAL levante.dkrz.de )
message(STATUS "multithreading disabled for Levante") # multithreading suddenly produces an error, disable it until a fix is found. issue #413
option(DISABLE_MULTITHREADING "disable asynchronous operations" ON)
elseif(${FESOM_PLATFORM_STRATEGY} STREQUAL leo-dcgp )
message(STATUS "multithreading disabled for Leonardo") # multithreading suddenly produces an error, disable it until a fix is found. issue #413
option(DISABLE_MULTITHREADING "disable asynchronous operations" ON)
elseif(${FESOM_PLATFORM_STRATEGY} STREQUAL mn5-gpp )
message(STATUS "multithreading disabled for MN5 GPP") # multithreading suddenly produces an error, disable it until a fix is found. issue #413
option(DISABLE_MULTITHREADING "disable asynchronous operations" ON)
elseif(${FESOM_PLATFORM_STRATEGY} STREQUAL albedo )
message(STATUS "multithreading disabled for Albedo") # multithreading suddenly produces an error, disable it until a fix is found. issue #413
option(DISABLE_MULTITHREADING "disable asynchronous operations" ON)
Expand Down Expand Up @@ -125,14 +131,15 @@ if(USE_ICEPACK)
${src_home}/icepack_drivers/Icepack/columnphysics/*.F90)
list(APPEND sources_Fortran ${sources_ice_pack})
elseif(ENABLE_IFS_INTERFACE) # ICEPACK + IFS_INTERFACE NOT SUPPORTED (YET)
if(ENABLE_MULTIO)
list(APPEND sources_Fortran ${src_home}/ifs_interface/iom.F90)
endif()

list(APPEND sources_Fortran ${src_home}/ifs_interface/ifs_interface.F90
${src_home}/ifs_interface/ifs_modules.F90
${src_home}/ifs_interface/ifs_notused.F90
${src_home}/ifs_interface/mpp_io.F90)
endif()
if(ENABLE_MULTIO)
list(APPEND sources_Fortran ${src_home}/ifs_interface/iom.F90)
endif()

# generate a custom file from fesom_version_info.F90 which includes the current git SHA
set(FESOM_ORIGINAL_VERSION_FILE ${src_home}/fesom_version_info.F90)
Expand Down Expand Up @@ -224,6 +231,10 @@ if(${CMAKE_Fortran_COMPILER_ID} STREQUAL Intel )
target_compile_options(${PROJECT_NAME} PRIVATE -r8 -i4 -fp-model precise -no-prec-div -no-prec-sqrt -fimf-use-svml -ip -init=zero -no-wrap-margin -fpe0) # add -fpe0 for RAPS environment
if(${FESOM_PLATFORM_STRATEGY} STREQUAL levante.dkrz.de )
target_compile_options(${PROJECT_NAME} PRIVATE -march=core-avx2 -mtune=core-avx2)
elseif(${FESOM_PLATFORM_STRATEGY} STREQUAL leo-dcgp )
target_compile_options(${PROJECT_NAME} PRIVATE -O3 -xCORE-AVX512 -qopt-zmm-usage=high -align array64byte -ipo)
elseif(${FESOM_PLATFORM_STRATEGY} STREQUAL mn5-gpp )
target_compile_options(${PROJECT_NAME} PRIVATE -O3 -xCORE-AVX512 -qopt-zmm-usage=high -align array64byte -ipo)
elseif(${FESOM_PLATFORM_STRATEGY} STREQUAL albedo)
target_compile_options(${PROJECT_NAME} PRIVATE -march=core-avx2 -O3 -ip -fPIC -qopt-malloc-options=2 -qopt-prefetch=5 -unroll-aggressive) #NEC mpi option
elseif(${FESOM_PLATFORM_STRATEGY} STREQUAL atosecmwf )
Expand Down
65 changes: 62 additions & 3 deletions src/MOD_DYN.F90
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ MODULE MOD_DYN
! set main structure for dynamicss, contains viscosity options and parameters +
! option for momentum advection
TYPE T_DYN
!___________________________________________________________________________
!___________________________________________________________________________
! instant zonal merdional velocity & Adams-Bashfort rhs
real(kind=WP), allocatable, dimension(:,:,:) :: uv, uv_rhs, fer_uv
real(kind=WP), allocatable, dimension(:,:,:,:) :: uv_rhsAB
Expand All @@ -55,6 +55,24 @@ MODULE MOD_DYN

! sea surface height arrays
real(kind=WP), allocatable, dimension(:) :: eta_n, d_eta, ssh_rhs, ssh_rhs_old

!___arrays for split explicite ssh computation______________________________
! se_uvh...transport velocity,
real(kind=WP), allocatable, dimension(:,:,:):: se_uvh
!se_uv_rhs...vertical integral of transport velocity rhs, se_uvBT_4AB...
! barotropic transport velocities (vertically integrated), contains actual
! timestep (1:2) and previous timestep (3:4) for adams-bashfort interpolation
real(kind=WP), allocatable, dimension(:,:) :: se_uvBT_rhs, se_uvBT_4AB

! se_uvBT...barotropic trnasport velocities from barotropic time stepping
! se_uvBT_theta...velocities for dissipative time stepping of thickness equation
! UBTmean_mean... Mean BT velocity to trim 3D velocity in tracers
real(kind=WP), allocatable, dimension(:,:) :: se_uvBT, se_uvBT_theta, se_uvBT_mean, se_uvBT_12

! array that are needed for viscosity and bottomdrag stabilization of
! split-expl subcycling method
real(kind=WP), allocatable, dimension(:,:) :: se_uvBT_stab_hvisc
real(kind=WP), allocatable, dimension(:) :: se_uvBT_stab_bdrag

! LA: 2023-05-17 iceberg arrays
real(kind=WP), allocatable, dimension(:) :: eta_n_ib ! kh 18.03.21 additional array for asynchronous iceberg computations
Expand Down Expand Up @@ -99,7 +117,24 @@ MODULE MOD_DYN
logical :: use_wsplit = .false.
! maximum allowed CFL criteria in vertical (0.5 < w_max_cfl < 1.)
! in older FESOM it used to be w_exp_max=1.e-3
real(kind=WP) :: wsplit_maxcfl= 1.0
real(kind=WP) :: wsplit_maxcfl = 1.0

! switch between ssh computation, by solver or split explicite subcycling
! use_ssh_se_subcycl = .false. --> solver
! use_ssh_se_subcycl = .true. --> split explicite subcycling
logical :: use_ssh_se_subcycl = .false.

! barotropic subcycling time-steps and dissipation parameter
integer :: se_BTsteps = 50
real(kind=WP) :: se_BTtheta = 0.14_WP
logical :: se_bottdrag = .true.
logical :: se_bdrag_si = .true.
logical :: se_visc = .true.
real(kind=WP) :: se_visc_gamma0 = 10
real(kind=WP) :: se_visc_gamma1 = 2750
real(kind=WP) :: se_visc_gamma2 = 0

!___________________________________________________________________________
! energy diagnostic part: will be computed inside the model ("hard integration"):
logical :: ldiag_ke = .true.
! different contributions to velocity change. will be computed inside the code.
Expand Down Expand Up @@ -229,7 +264,8 @@ subroutine WRITE_T_DYN(dynamics, unit, iostat, iomsg)
write(unit, iostat=iostat, iomsg=iomsg) dynamics%use_freeslip
write(unit, iostat=iostat, iomsg=iomsg) dynamics%use_wsplit
write(unit, iostat=iostat, iomsg=iomsg) dynamics%wsplit_maxcfl

write(unit, iostat=iostat, iomsg=iomsg) dynamics%use_ssh_se_subcycl

!___________________________________________________________________________
call dynamics%solverinfo%WRITE_T_SOLVERINFO(unit)

Expand All @@ -249,6 +285,17 @@ subroutine WRITE_T_DYN(dynamics, unit, iostat, iomsg)
call write_bin_array(dynamics%fer_w , unit, iostat, iomsg)
call write_bin_array(dynamics%fer_uv, unit, iostat, iomsg)
end if
if (dynamics%use_ssh_se_subcycl) then
call write_bin_array(dynamics%se_uvh , unit, iostat, iomsg)
call write_bin_array(dynamics%se_uvBT_rhs , unit, iostat, iomsg)
call write_bin_array(dynamics%se_uvBT_4AB , unit, iostat, iomsg)
call write_bin_array(dynamics%se_uvBT , unit, iostat, iomsg)
call write_bin_array(dynamics%se_uvBT_theta, unit, iostat, iomsg)
call write_bin_array(dynamics%se_uvBT_mean , unit, iostat, iomsg)
call write_bin_array(dynamics%se_uvBT_12 , unit, iostat, iomsg)
call write_bin_array(dynamics%se_uvBT_stab_hvisc , unit, iostat, iomsg)
call write_bin_array(dynamics%se_uvBT_stab_bdrag , unit, iostat, iomsg)
end if


end subroutine WRITE_T_DYN
Expand All @@ -275,6 +322,7 @@ subroutine READ_T_DYN(dynamics, unit, iostat, iomsg)
read(unit, iostat=iostat, iomsg=iomsg) dynamics%use_freeslip
read(unit, iostat=iostat, iomsg=iomsg) dynamics%use_wsplit
read(unit, iostat=iostat, iomsg=iomsg) dynamics%wsplit_maxcfl
read(unit, iostat=iostat, iomsg=iomsg) dynamics%use_ssh_se_subcycl

!___________________________________________________________________________
call dynamics%solverinfo%READ_T_SOLVERINFO(unit)
Expand All @@ -295,6 +343,17 @@ subroutine READ_T_DYN(dynamics, unit, iostat, iomsg)
call read_bin_array(dynamics%fer_w , unit, iostat, iomsg)
call read_bin_array(dynamics%fer_uv , unit, iostat, iomsg)
end if
if (dynamics%use_ssh_se_subcycl) then
call read_bin_array(dynamics%se_uvh , unit, iostat, iomsg)
call read_bin_array(dynamics%se_uvBT_rhs , unit, iostat, iomsg)
call read_bin_array(dynamics%se_uvBT_4AB , unit, iostat, iomsg)
call read_bin_array(dynamics%se_uvBT , unit, iostat, iomsg)
call read_bin_array(dynamics%se_uvBT_theta, unit, iostat, iomsg)
call read_bin_array(dynamics%se_uvBT_mean , unit, iostat, iomsg)
call read_bin_array(dynamics%se_uvBT_12 , unit, iostat, iomsg)
call read_bin_array(dynamics%se_uvBT_stab_hvisc , unit, iostat, iomsg)
call read_bin_array(dynamics%se_uvBT_stab_bdrag , unit, iostat, iomsg)
end if

end subroutine READ_T_DYN

Expand Down
26 changes: 18 additions & 8 deletions src/MOD_TRACER.F90
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,24 @@ MODULE MOD_TRACER
real(kind=WP), allocatable :: del_ttf_advhoriz(:,:), del_ttf_advvert(:,:)
!_______________________________________________________________________________
! in case ldiag_DVD=.true. --> calculate discrete variance decay (DVD)
real(kind=WP), allocatable :: tr_dvd_horiz(:,:,:), tr_dvd_vert(:,:,:)
! dvd_trflx_h, dvd_trflx_v ... reconstructed horizontal tracer fluxes at mid
! edge faces for temperature and salintiy. These fluxes
! are already computed in adv_flux_hor, adv_flux_ver
! but not saved
! dvd_trold ... tracer from previouse time steps later needed to
! compute Tstar = 0.5*( T^(n+1) + T^n)
real(kind=WP), allocatable, dimension(:,:,:) :: dvd_trflx_hor, dvd_trflx_ver

!_______________________________________________________________________________
! The fct part
real(kind=WP),allocatable,dimension(:,:) :: fct_LO ! Low-order solution
real(kind=WP),allocatable,dimension(:,:) :: adv_flux_hor ! Antidif. horiz. contrib. from edges / backup for iterafive fct scheme
real(kind=WP),allocatable,dimension(:,:) :: adv_flux_ver ! Antidif. vert. fluxes from nodes / backup for iterafive fct scheme

real(kind=WP),allocatable,dimension(:,:) :: fct_ttf_max,fct_ttf_min
real(kind=WP),allocatable,dimension(:,:) :: fct_plus,fct_minus

!_______________________________________________________________________________
! MUSCL type reconstruction
integer,allocatable,dimension(:) :: nboundary_lay
integer,allocatable,dimension(:,:) :: edge_up_dn_tri
Expand All @@ -54,9 +64,9 @@ MODULE MOD_TRACER
! auxury type for reading namelist.tra
TYPE NML_TRACER_LIST_TYPE
INTEGER :: ID =-1
CHARACTER(len=4) :: adv_hor ='NONE'
CHARACTER(len=4) :: adv_ver ='NONE'
CHARACTER(len=4) :: adv_lim ='NONE'
CHARACTER(len=20) :: adv_hor ='NONE'
CHARACTER(len=20) :: adv_ver ='NONE'
CHARACTER(len=20) :: adv_lim ='NONE'
REAL(kind=WP) :: adv_ph =1.
REAL(kind=WP) :: adv_pv =1.
END TYPE NML_TRACER_LIST_TYPE
Expand Down Expand Up @@ -149,8 +159,8 @@ subroutine WRITE_T_TRACER_WORK(twork, unit)
call write_bin_array(twork%del_ttf, unit, iostat, iomsg)
call write_bin_array(twork%del_ttf_advhoriz, unit, iostat, iomsg)
call write_bin_array(twork%del_ttf_advvert, unit, iostat, iomsg)
call write_bin_array(twork%tr_dvd_horiz, unit, iostat, iomsg)
call write_bin_array(twork%tr_dvd_vert, unit, iostat, iomsg)
call write_bin_array(twork%dvd_trflx_hor, unit, iostat, iomsg)
call write_bin_array(twork%dvd_trflx_ver, unit, iostat, iomsg)
call write_bin_array(twork%fct_LO, unit, iostat, iomsg)
call write_bin_array(twork%adv_flux_hor, unit, iostat, iomsg)
call write_bin_array(twork%adv_flux_ver, unit, iostat, iomsg)
Expand All @@ -174,8 +184,8 @@ subroutine READ_T_TRACER_WORK(twork, unit)
call read_bin_array(twork%del_ttf, unit, iostat, iomsg)
call read_bin_array(twork%del_ttf_advhoriz, unit, iostat, iomsg)
call read_bin_array(twork%del_ttf_advvert, unit, iostat, iomsg)
call read_bin_array(twork%tr_dvd_horiz, unit, iostat, iomsg)
call read_bin_array(twork%tr_dvd_vert, unit, iostat, iomsg)
call read_bin_array(twork%dvd_trflx_hor, unit, iostat, iomsg)
call read_bin_array(twork%dvd_trflx_ver, unit, iostat, iomsg)
call read_bin_array(twork%fct_LO, unit, iostat, iomsg)
call read_bin_array(twork%adv_flux_hor, unit, iostat, iomsg)
call read_bin_array(twork%adv_flux_ver, unit, iostat, iomsg)
Expand Down
8 changes: 4 additions & 4 deletions src/associate_mesh_ass.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,14 @@ Z_3d_n(1:mesh%nl-1, 1:myDim_nod2D+eDim_nod2D) => mesh%Z_3d_n(:,:)
#if defined(__async_icebergs)
Z_3d_n_ib(1:mesh%nl-1, 1:myDim_nod2D+eDim_nod2D) => mesh%Z_3d_n_ib(:,:)
#endif
helem(1:mesh%nl-1, 1:myDim_elem2D) => mesh%helem(:,:)
bottom_elem_thickness(1:myDim_elem2D) => mesh%bottom_elem_thickness(:)
helem(1:mesh%nl-1, 1:myDim_elem2D+eDim_elem2D) => mesh%helem(:,:)
bottom_elem_thickness(1:myDim_elem2D+eDim_elem2D) => mesh%bottom_elem_thickness(:)
bottom_node_thickness(1:myDim_nod2D+eDim_nod2D) => mesh%bottom_node_thickness(:)
dhe(1:myDim_elem2D) => mesh%dhe(:)
hbar(1:myDim_nod2D+eDim_nod2D) => mesh%hbar(:)
hbar_old(1:myDim_nod2D+eDim_nod2D) => mesh%hbar_old(:)
!zbar_n(1:mesh%nl) => mesh%zbar_n
!Z_n(1:mesh%nl-1) => mesh%Z_n
!zbar_n(1:mesh%nl) => mesh%zbar_n
!Z_n(1:mesh%nl-1) => mesh%Z_n
zbar_n_bot(1:myDim_nod2D+eDim_nod2D) => mesh%zbar_n_bot(:)
zbar_e_bot(1:myDim_elem2D+eDim_elem2D) => mesh%zbar_e_bot(:)
zbar_n_srf(1:myDim_nod2D+eDim_nod2D) => mesh%zbar_n_srf(:)
Expand Down
12 changes: 12 additions & 0 deletions src/fesom_module.F90
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@ module fesom_main_storage_module
! this way FESOM can e.g. be used as a library with an external time loop driver
! used with IFS-FESOM
module fesom_module
#if defined __ifsinterface
use, intrinsic :: ieee_exceptions
#endif
implicit none
public fesom_init, fesom_runloop, fesom_finalize
private
Expand All @@ -110,6 +113,15 @@ subroutine fesom_init(fesom_total_nsteps)
stop
end if
#endif

!SUVI: disable overflow, underflow for entire model when used in coupled with ifs
! bad practice, use it only in case of Emergency
!#if defined __ifsinterface
! call ieee_set_halting_mode(ieee_overflow, .false.)
! call ieee_set_halting_mode(ieee_underflow, .false.)
! call ieee_set_halting_mode(ieee_invalid, .false.)
!#endif


mpi_is_initialized = .false.
f%fesom_did_mpi_init = .false.
Expand Down
Loading

0 comments on commit f3b4732

Please sign in to comment.