Skip to content

Commit

Permalink
Merge branch 'refactoring' into refactoring_sigma0
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickscholz committed Mar 13, 2024
2 parents 8fba290 + 7214b57 commit c0ffcf6
Show file tree
Hide file tree
Showing 63 changed files with 7,231 additions and 645 deletions.
10 changes: 6 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ cmake_minimum_required(VERSION 3.9)

# set default build type cache entry (do so before project(...) is called, which would create this cache entry on its own)
if(NOT CMAKE_BUILD_TYPE)
message(STATUS "setting default build type: Release")
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose the type of build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel.")
message(STATUS "setting default build type: Release")
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose the type of build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel.")
endif()

project(FESOM2.0)
Expand All @@ -17,7 +17,9 @@ set(OIFS_COUPLED OFF CACHE BOOL "compile fesom coupled to OpenIFS. (Also needs F
set(CRAY OFF CACHE BOOL "compile with cray ftn")
set(USE_ICEPACK OFF CACHE BOOL "compile fesom with the Iceapck modules for sea ice column physics.")
set(OPENMP_REPRODUCIBLE OFF CACHE BOOL "serialize OpenMP loops that are critical for reproducible results")

#set(VERBOSE OFF CACHE BOOL "toggle debug output")
set(USE_MULTIO OFF CACHE BOOL "Use MULTIO for IO, either grib or binary for now. This also means path to MULTIO installation has to provided using env MULTIO_INSTALL_PATH='..' and multio configuration yamls must be present to run the model with MULTIO")
set(OASIS_WITH_YAC OFF CACHE BOOL "Useing a version of OASIS compiled with YAC instead of SCRIP for interpolation?")
set(ASYNC_ICEBERGS ON CACHE BOOL "compile fesom with or without support for asynchronous iceberg computations")
set(VERBOSE OFF CACHE BOOL "toggle debug output")
#add_subdirectory(oasis3-mct/lib/psmile)
add_subdirectory(src)
50 changes: 50 additions & 0 deletions cmake/FindMULTIO.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# FindMULTIO.cmake

include(FindPackageHandleStandardArgs)

# Use the environment variable as a hint
set(MULTIO_HINT_PATH $ENV{MULTIO_INSTALL_PATH})

# Try to find the library
find_library(MULTIO_FAPI_LIBRARY
NAMES multio-fapi # Adjust this if the library name is different
HINTS ${MULTIO_HINT_PATH}/lib
)

# Try to find the dependency library
find_library(MULTIO_API_LIBRARY
NAMES multio-api
HINTS ${MULTIO_HINT_PATH}/lib
)

# Try to find the dependency library
find_library(MULTIO_LIBRARY
NAMES multio
HINTS ${MULTIO_HINT_PATH}/lib
)

# Try to find the Fortran module path
find_path(MULTIO_MODULE_PATH
NAMES multio_api.mod # Replace <module_name> with an actual module name you expect to find
HINTS ${MULTIO_HINT_PATH}/module ${MULTIO_HINT_PATH}/multio/module
)


# Aggregate the libraries for easier linking
set(MULTIO_LIBRARIES ${MULTIO_FAPI_LIBRARY} ${MULTIO_API_LIBRARY} ${MULTIO_LIBRARY})


# Handle the results
find_package_handle_standard_args(MULTIO
REQUIRED_VARS MULTIO_LIBRARIES MULTIO_MODULE_PATH
FOUND_VAR MULTIO_FOUND
)

# If found, set the MULTIO_LIBRARIES and MULTIO_INCLUDE_DIRS variables for easy use
if(MULTIO_FOUND)
set(MULTIO_INCLUDE_DIRS ${MULTIO_MODULE_PATH})
endif()

# Mark variables as advanced
mark_as_advanced(MULTIO_LIBRARY MULTIO_MODULE_PATH)

19 changes: 19 additions & 0 deletions cmake/FindOASISYAC.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
find_path(OASIS_Fortran_INCLUDE_DIRECTORIES mod_oasis.mod HINTS ${TOPLEVEL_DIR}/../oasis/build/lib/psmile)
find_library(OASIS_Fortran_LIBRARIES psmile HINTS ${TOPLEVEL_DIR}/../oasis/build/lib/psmile)

find_path(MCT_Fortran_INCLUDE_DIRECTORIES mct_mod.mod HINTS ${TOPLEVEL_DIR}/../oasis/build/lib/psmile/mct)
find_library(MCT_Fortran_LIBRARIES mct HINTS ${TOPLEVEL_DIR}/../oasis/build/lib/psmile/mct)

find_path(MPEU_Fortran_INCLUDE_DIRECTORIES m_mpout.mod HINTS ${TOPLEVEL_DIR}/../oasis/build/lib/psmile/mct)
find_library(MPEU_Fortran_LIBRARIES mpeu HINTS ${TOPLEVEL_DIR}/../oasis/build/lib/psmile/mct)

find_path(SCRIP_Fortran_INCLUDE_DIRECTORIES remap_bicubic_reduced.mod HINTS ${TOPLEVEL_DIR}/../oasis/build/lib/psmile/scrip)
find_library(SCRIP_Fortran_LIBRARIES scrip HINTS ${TOPLEVEL_DIR}/../oasis/build/lib/psmile/scrip)

find_path(YAC_Fortran_INCLUDE_DIRECTORIES mo_yac_utils.mod HINTS ${TOPLEVEL_DIR}/../oasis/lib/yac/include)
find_library(YACUTILS_Fortran_LIBRARIES yac_utils HINTS ${TOPLEVEL_DIR}/../oasis/lib/yac/lib)
find_library(YACCORE_Fortran_LIBRARIES yac_core HINTS ${TOPLEVEL_DIR}/../oasis/lib/yac/lib)

find_path(YAXT_Fortran_INCLUDE_DIRECTORIES yaxt.mod HINTS ${TOPLEVEL_DIR}/../oasis/lib/yaxt/include)
find_library(YAXT_Fortran_LIBRARIES yaxt HINTS ${TOPLEVEL_DIR}/../oasis/lib/yaxt/lib)
find_library(YAXTC_Fortran_LIBRARIES yaxt_c HINTS ${TOPLEVEL_DIR}/../oasis/lib/yaxt/lib)
8 changes: 8 additions & 0 deletions config/namelist.config
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,11 @@ flag_debug=.false.
n_levels=2
n_part= 12, 36 ! 432 number of partitions on each hierarchy level
/

&icebergs
use_icesheet_coupling=.false.
ib_num=1
use_icebergs=.false.
steps_per_ib_step=8
ib_async_mode=0
/
42 changes: 27 additions & 15 deletions config/namelist.config.toy_soufflet
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

! This is the namelist file for model general configuration

&modelname
Expand All @@ -6,26 +7,30 @@ runid='fesom'

&timestep
step_per_day=72 !96 !96 !72 !72 !45 !72 !96
run_length= 10 !62 !62 !62 !28
run_length_unit='y' ! y, m, d, s
run_length=10 !62 !62 !62 !28
run_length_unit='d' ! y, m, d, s
/

&clockinit ! the model starts at
timenew=0.0
daynew=1
yearnew=1948
yearnew=1958
/

&paths
MeshPath='/work/ollie/sjuricke/Soufflet_20/'
ClimateDataPath='/work/ollie/dsidoren/input/hydrography/phc3.0/'
ResultPath='/home/ollie/dsidoren/test_visc/'
MeshPath='/albedo/home/pscholz/fesom2/test/meshes/soufflet/'
ClimateDataPath='/albedo/work/projects/p_fesom/FROM-OLLIE/FESOM2/hydrography/phc3.0/'
ResultPath='../result_tmp/'
/

&restart_log
restart_length=1 !only required for d,h,s cases, y, m take 1
restart_length_unit='y' !output period: y, d, h, s
logfile_outfreq=960 !in logfile info. output frequency, # steps
restart_length=1 ! --> do netcdf restart ( only required for d,h,s cases, y, m take 1)
restart_length_unit='y' !output period: y, d, h, s, off
raw_restart_length=1 ! --> do core dump restart
raw_restart_length_unit='off' ! e.g. y, d, h, s, off
bin_restart_length=1 ! --> do derived type binary restart
bin_restart_length_unit='off' ! e.g. y, d, h, s, off
logfile_outfreq=72 !in logfile info. output frequency, # steps
/

&ale_def
Expand All @@ -34,10 +39,10 @@ use_partial_cell=.false.
/

&geometry
cartesian=.false.
cartesian=.true.
fplane=.false.
cyclic_length=4.5 ![degree]
rotated_grid=.false. !option only valid for coupled model case now
rotated_grid=.false. !option only valid for coupled model case now
force_rotation=.false.
alphaEuler=50. ![degree] Euler angles, convention:
betaEuler=15. ![degree] first around z, then around new x,
Expand All @@ -49,15 +54,22 @@ include_fleapyear=.false.
/

&run_config
use_ice=.false. ! ocean+ice
use_ice=.false. ! ocean+ice
use_cavity=.false. !
use_cavity_partial_cell=.false.
use_floatice = .false.
use_sw_pene=.false.
flag_debug=.false.
flag_warn_cflz=.false.
toy_ocean=.true.
which_toy="soufflet"
flag_debug=.true.
flag_debug=.false.

/

&machine
n_levels=2
n_part= 12, 36 ! 432 number of partitions on each hierarchy level
!PS n_levels=2
!PS n_part= 70, 128 ! 432 number of partitions on each hierarchy level
n_levels=1
n_part= 128 !6096 ! 432 number of partitions on each hierarchy level
/
2 changes: 2 additions & 0 deletions config/namelist.cvmix
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ idemix_mu0 = 0.33333333 ! dissipation parameter (dimensionless)
idemix_sforcusage = 0.2
idemix_n_hor_iwe_prop_iter = 5 ! iterations for contribution from horiz. wave propagation
idemix_surforc_file = '/work/ollie/clidyn/forcing/IDEMIX/fourier_smooth_2005_cfsr_inert_rgrid.nc'
idemix_surforc_vname= 'var706'
idemix_botforc_file = '/work/ollie/clidyn/forcing/IDEMIX/tidal_energy_gx1v6_20090205_rgrid.nc'
idemix_botforc_vname= 'wave_dissipation'
/

! namelist for PP
Expand Down
1 change: 1 addition & 0 deletions config/namelist.dyn
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,6 @@ use_wsplit = .false. ! Switch for implicite/explicte splitting of vert. veloci
wsplit_maxcfl= 1.0 ! 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
ldiag_KE=.false. ! activates energy diagnostics
AB_order=2
/

10 changes: 10 additions & 0 deletions config/namelist.forcing
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,16 @@ ncar_bulk_z_shum=10.0 ! height at which humi forcing is located (CORE, JRA-do: 1
use_landice_water=.false.
landice_start_mon=5
landice_end_mon=10
fwf_path='./mesh/'

/

&age_tracer
use_age_tracer=.false.
use_age_mask=.false.
age_tracer_path='./mesh/'
age_start_year=2000

/

&nam_sbc
Expand Down
7 changes: 6 additions & 1 deletion config/namelist.io
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@ ldiag_dMOC =.false.
ldiag_DVD =.false.
ldiag_forc =.false.
ldiag_extflds =.false.
ldiag_trflx =.false.
/

&nml_general
io_listsize =100 !number of streams to allocate. shallbe large or equal to the number of streams in &nml_list
io_listsize =120 !number of streams to allocate. shallbe large or equal to the number of streams in &nml_list
vec_autorotate =.false.
/

Expand All @@ -21,6 +22,7 @@ vec_autorotate =.false.
! for 'fer_C', 'bolus_u', 'bolus_v', 'bolus_w', 'fer_K' to work Fer_GM must be .true. otherwise no output
! 'otracers' - all other tracers if applicable
! for 'dMOC' to work ldiag_dMOC must be .true. otherwise no output
! for 'utemp', 'vtemp', 'usalt', 'vsalt' output, set ldiag_trflx=.true.
&nml_list
io_list = 'sst ',1, 'm', 4,
'sss ',1, 'm', 4,
Expand Down Expand Up @@ -48,4 +50,7 @@ io_list = 'sst ',1, 'm', 4,
'bolus_u ',1, 'y', 4,
'bolus_v ',1, 'y', 4,
'bolus_w ',1, 'y', 4,
'icb ',1, 'm', 4,
'fw ',1, 'm', 4,
'fh ',1, 'm', 4,
/
72 changes: 8 additions & 64 deletions config/namelist.oce.toy_soufflet
Original file line number Diff line number Diff line change
Expand Up @@ -3,81 +3,25 @@
&oce_dyn
state_equation=0 ! 1 - full equation of state, 0 - linear equation of state
C_d=0.0025 ! Bottom drag, nondimensional
gamma0=0.00 ! [m/s], backgroung viscosity= gamma0*len, it should be as small as possible (keep it < 0.01 m/s).
gamma1=0.002 ! [nodim], for computation of the flow aware viscosity
gamma2=0.02 ! [s/m], is only used in easy backscatter option
Div_c=.5 ! the strength of the modified Leith viscosity, nondimensional, 0.3 -- 1.0
Leith_c=.5 ! the strength of the Leith viscosity
visc_option=5 ! 1=Harmonic Leith parameterization;
! 2=Laplacian+Leith+biharmonic background
! 3=Biharmonic Leith parameterization
! 4=Biharmonic flow aware
! 5=Easy Backscatter
! 6=Biharmonic flow aware (viscosity depends on velocity Laplacian)
! 7=Biharmonic flow aware (viscosity depends on velocity differences)
easy_bs_return= 1.5 ! coefficient for returned sub-gridscale energy, to be used with visc_option=5 (easy backscatter)
A_ver= 1.e-4 ! Vertical viscosity, m^2/s
scale_area=5.8e9 ! Visc. and diffus. are for an element with scale_area
mom_adv=2 ! 1=vector CV, p1 vel, 2=sca. CV, 3=vector inv.
free_slip=.false. ! Switch on free slip
i_vert_visc=.true.
w_split=.false.
w_exp_max=1.e-3
SPP=.false. ! Salt Plume Parameterization
Fer_GM=.false. ! to swith on/off GM after Ferrari et al. 2010
K_GM_max = 3000.0 ! max. GM thickness diffusivity (m2/s)
Fer_GM=.false. ! to swith on/off GM after Ferrari et al. 2010
K_GM_max = 2000.0 ! max. GM thickness diffusivity (m2/s)
K_GM_min = 2.0 ! max. GM thickness diffusivity (m2/s)
K_GM_bvref = 2 ! def of bvref in ferreira scaling 0=srf,1=bot mld,2=mean over mld,3=weighted mean over mld
K_GM_rampmax = 40.0 ! Resol >K_GM_rampmax[km] GM on
K_GM_rampmin = 30.0 ! Resol <K_GM_rampmin[km] GM off, in between linear scaled down
K_GM_rampmax = -1.0 ! Resol >K_GM_rampmax[km] GM on
K_GM_rampmin = -1.0 ! Resol <K_GM_rampmin[km] GM off, in between linear scaled down
K_GM_resscalorder = 1

scaling_Ferreira =.true. ! GM vertical scaling after Ferreira et al.(2005) (as also implemented by Qiang in FESOM 1.4)
scaling_Ferreira =.false. ! GM vertical scaling after Ferreira et al.(2005) (as also implemented by Qiang in FESOM 1.4)
scaling_Rossby =.false. ! GM is smoothly switched off according to Rossby radius (from 1. in coarse areas to 0. where resolution reaches 2 points/Rossby radius)
scaling_resolution =.true. ! GM is spatially scaled with resolution; A value of K_GM corresponds then to a resolution of 100km
scaling_FESOM14 =.true. ! special treatment of GM in the NH (as also implemented by Qiang in FESOM 1.4; it is zero within the boundary layer)
scaling_FESOM14 =.false. ! special treatment of GM in the NH (as also implemented by Qiang in FESOM 1.4; it is zero within the boundary layer)

Redi =.false.
visc_sh_limit=5.0e-3 ! for KPP, max visc due to shear instability
mix_scheme='PP' ! vertical mixing scheme: KPP, PP
mix_scheme='PP' ! vertical mixing scheme: KPP, PP
Ricr = 0.3 ! critical bulk Richardson Number
concv = 1.6 ! constant for pure convection (eqn. 23) (Large 1.5-1.6; MOM default 1.8)
/

&oce_tra
use_momix = .false. ! switch on/off !Monin-Obukhov -> TB04 mixing
momix_lat = -50.0 ! latitidinal treshhold for TB04, =90 --> global
momix_kv = 0.01 ! PP/KPP, mixing coefficient within MO length
use_instabmix = .true. ! enhance convection in case of instable stratification
instabmix_kv = 0.1
use_windmix = .false. ! enhance mixing trough wind only for PP mixing (for stability)
windmix_kv = 1.e-3
windmix_nl = 2

diff_sh_limit=5.0e-3 ! for KPP, max diff due to shear instability
Kv0_const=.false.
double_diffusion=.false. ! for KPP,dd switch
K_ver=1.0e-5
K_hor=10.
surf_relax_T=0.0
surf_relax_S=0.0 ! 50m/300days 6.43e-07! m/s 10./(180.*86400.)
balance_salt_water =.false. ! balance virtual-salt or freshwater flux or not
clim_relax=0.0 ! 1/s, geometrical information has to be supplied
ref_sss_local=.true.
ref_sss=34.
i_vert_diff=.true. ! true
tracer_adv =2 ! 1=MUSCL, 2=MUSCL+FCT
! Implemented trassers (3d restoring):
! 301 - Fram strait.
! 302 - Bering Strait
! 303 - BSO
num_tracers=2 !number of all tracers
tracer_ID =0,1 !their IDs (0 and 1 are reserved for temperature and salinity)
/

&oce_init3d ! initial conditions for tracers
n_ic3d = 2 ! number of tracers to initialize
idlist = 1, 0 ! their IDs (0 is temperature, 1 is salinity, etc.). The reading order is defined here!
filelist = 'phc3.0_winter.nc', 'phc3.0_winter.nc' ! list of files in ClimateDataPath to read (one file per tracer), same order as idlist
varlist = 'salt', 'temp' ! variables to read from specified files
t_insitu = .true. ! if T is insitu it will be converted to potential after reading it
/
1 change: 1 addition & 0 deletions config/namelist.tra
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ gamma0_tra = 0.0005 ! gammaX_tra are analogous to those in the dynamical
gamma1_tra = 0.0125
gamma2_tra = 0.
i_vert_diff =.true.
AB_order = 2
/

&tracer_phys
Expand Down
Loading

0 comments on commit c0ffcf6

Please sign in to comment.