Skip to content

Commit

Permalink
Merge branch 'main' into refactoring_addDVDsergeyandknut
Browse files Browse the repository at this point in the history
  • Loading branch information
JanStreffing authored Jan 23, 2025
2 parents fbeca3a + 53e92d1 commit c4491e2
Show file tree
Hide file tree
Showing 41 changed files with 1,622 additions and 614 deletions.
79 changes: 79 additions & 0 deletions config/namelist.config.toy_dbgyre
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
! This is the namelist file for model general configuration

&modelname
runid='fesom'
/

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

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

&paths
MeshPath=''
ResultPath='../results_tmp/'
/

&restart_log
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
which_ALE='linfs' ! 'linfs','zlevel', 'zstar'
use_partial_cell=.false.
/

&geometry
cartesian=.false.
fplane=.false.
cyclic_length=90 ![degree]
rotated_grid=.false. !option only valid for coupled model case now
force_rotation=.false.
alphaEuler=0 ![degree] Euler angles, convention:
betaEuler=0 ![degree] first around z, then around new x,
gammaEuler=0 ![degree] then around new z.
/

&calendar
include_fleapyear=.false.
/

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

&machine
n_levels=1
n_part=24
/

&icebergs
use_icesheet_coupling=.false.
ib_num=1
use_icebergs=.false.
steps_per_ib_step=8
ib_async_mode=0
/

25 changes: 25 additions & 0 deletions config/namelist.dyn.toy_dbgyre
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
&dynamics_visc
visc_gamma0 = 0.005 ! [m/s], backgroung viscosity= gamma0*len, it should be as small a s possible (keep it < 0.01 m/s).
visc_gamma1 = 0.3 ! [nodim], for computation of the flow aware viscosity
visc_gamma2 = 0.20 ! [s/m], is only used in easy backscatter option
visc_easybsreturn= 0.0

opt_visc = 5
check_opt_visc=.false. ! check if optvisc=5 is valid based on ratio resol/rossbyR
! 5=Kinematic (easy) Backscatter
! 6=Biharmonic flow aware (viscosity depends on velocity Laplacian)
! 7=Biharmonic flow aware (viscosity depends on velocity differences)
! 8=Dynamic Backscatter

use_ivertvisc= .true.
/

&dynamics_general
momadv_opt = 2 ! option for momentum advection in moment only =2
use_freeslip = .false. ! Switch on free slip
use_wsplit = .false. ! Switch for implicite/explicte splitting of vert. velocity
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
/
4 changes: 3 additions & 1 deletion config/namelist.io
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ ldiag_dMOC =.false.
ldiag_DVD =.false.
ldiag_forc =.false.
ldiag_extflds =.false.
ldiag_destinE =.false. ! enables computation of heatcontent. (hc300m, hc700m, hc) in io_list
ldiag_trflx =.false.
ldiag_uvw_sqr =.false.
ldiag_trgrd_xyz =.false.
Expand Down Expand Up @@ -56,4 +57,5 @@ io_list = 'sst ',1, 'm', 4,
'bolus_w ',1, 'y', 4,
'fw ',1, 'm', 4,
'fh ',1, 'm', 4,
/
'otracers ',1, 'y', 4,
/
28 changes: 28 additions & 0 deletions config/namelist.oce.toy_dbgyre
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
! The namelist file for the finite-volume ocean model

&oce_dyn
state_equation=0 ! 1 - full equation of state, 0 - linear equation of state
C_d=0.001 ! Bottom drag, nondimensional, use C_d=0.001 for double gyre setup based on Bagaeva et al.(2024)
A_ver= 1.e-4 ! Vertical viscosity, m^2/s
scale_area=5.8e9 ! Visc. and diffus. are for an element with scale_area
SPP=.false. ! Salt Plume Parameterization
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 = -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 =.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 =.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
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)
/

57 changes: 57 additions & 0 deletions config/namelist.tra.toy_dbgyre
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
&tracer_listsize
num_tracers=100 !number of tracers to allocate. shallbe large or equal to the number of streams in &nml_list
/

&tracer_list
nml_tracer_list =
1 , 'MFCT', 'QR4C', 'FCT ', 1., 1.,
2 , 'MFCT', 'QR4C', 'FCT ', 1., 1.,
!101, 'UPW1', 'UPW1', 'NON ', 0., 0.
/

&tracer_init3d ! initial conditions for tracers
n_ic3d = 2 ! number of tracers to initialize
idlist = 2, 1 ! 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
/

&tracer_init2d ! initial conditions for 2D tracers (sea ice)
n_ic2d = 3 ! number of tracers to initialize
idlist = 1, 2, 3 ! their IDs (0 is a_ice, 1 is m_ice, 3 m_snow). The reading order is defined here!
filelist = 'a_ice.nc', 'm_ice.nc', 'm_snow.nc' ! list of files in ClimateDataPath to read (one file per tracer), same order as idlist
varlist = 'a_ice', 'm_ice', 'm_snow' ! variables to read from specified files
ini_ice_from_file=.false.
/

&tracer_general
! bharmonic diffusion for tracers. We recommend to use this option in very high resolution runs (Redi is generally off there).
smooth_bh_tra =.false. ! use biharmonic diffusion (filter implementation) for tracers
gamma0_tra = 0.0005 ! gammaX_tra are analogous to those in the dynamical part
gamma1_tra = 0.0125
gamma2_tra = 0.
i_vert_diff =.true.
/

&tracer_phys
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=1.929e-06 ! 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.
/
7 changes: 6 additions & 1 deletion config/namelist.transit
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
! The namelist file for transient tracers

&transit_param
l_r14c = .false.
l_r39ar = .false.
l_f11 = .false.
l_f12 = .false.
l_sf6 = .false.
anthro_transit=.false.
paleo_transit=.false.
length_transit=1 ! 166 for anthro_transit=.true.
ti_start_transit=1 ! 1 for D14C, 80 for CFC-12
ifile_transit='/work/ollie/mbutzin/fesom2/input/trace_gases/Table_CO2_isoC_CFC12_SF6.txt'
ifile_transit='/work/ab0246/a270108/fesom2_recom_config/input-for-awiesm/Table_CO2_isoC_CFCs1112_SF6.txt'
r14c_a = 1.0000 ! atm. 14C/C ratio, global mean
r39ar_a = 1.0000 ! atm. 39Ar/Ar ratio, global mean
xarg_a = 9.34e-3 ! atm. Argon concn. (mole fraction), global mean
Expand Down
3 changes: 0 additions & 3 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,8 @@
extensions = [
"sphinx.ext.mathjax",
"sphinxcontrib.bibtex",
"sphinxfortran.fortran_domain",
"sphinxfortran.fortran_autodoc",
]
bibtex_bibfiles = ["mybib_fesom2.bib"]
fortran_src = ["../src/"]

numfig = True
# Add any paths that contain templates here, relative to this directory.
Expand Down
14 changes: 8 additions & 6 deletions docs/getting_started/getting_started.rst
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,12 @@ Change to the `fesom2` folder and execute:
::

cd fesom2
git checkout refactoring

As a good practice, if one wants to make modifications to the source code or any of the files, it is advisable to create a branch from refactoring:
As a good practice, if one wants to make modifications to the source code or any of the files, it is advisable to create a branch from main:

::

git checkout -b <my branch> refactoring
git checkout -b <my branch> main

After confirming that the right FESOM2 branch is being used, compile the model with:

Expand Down Expand Up @@ -460,20 +459,23 @@ The best way to run the model locally is to use Docker container. You obviously

- Get the image::
docker pull koldunovn/fesom2_test:refactoring2
docker pull ghcr.io/fesom/fesom2_docker:fesom2_test_refactoring-master
# if you use Mac Silicon (M1 M2 etc) use:
docker pull --platform linux/amd64 ghcr.io/fesom/fesom2_docker:fesom2_test_refactoring-master

- Go to the folder with your version of fesom2 folder (NOT inside fesom2 folder, one up, the one you run ``git clone https://github.com/FESOM/fesom2.git`` in).
- Run::

docker run -it -v "$(pwd)"/fesom2:/fesom/fesom2 koldunovn/fesom2_test:refactoring2 /bin/bash
docker run -it -v "$(pwd)"/fesom2:/fesom/fesom2 ghcr.io/fesom/fesom2_docker:fesom2_test_refactoring-master /bin/bash
# if you use Mac Silicon (M1 M2 etc) use:
docker run --platform linux/amd64 -it -v "$(pwd)"/fesom2:/fesom/fesom2 ghcr.io/fesom/fesom2_docker:fesom2_test_refactoring-master /bin/bash

- This should get you inside the container. You now can edit the files in your fesom2 folder (on host system), but run compule and run the model inside the container.
- When inside the container, to compile do:

::

cd fesom2
git checkout refactoring
bash -l configure.sh ubuntu

- To prepare the run (this will do the test with pi mesh)::
Expand Down
4 changes: 2 additions & 2 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
sphinx==4.1.2
sphinxcontrib-bibtex==2.3.0
sphinx>=5.0
sphinxcontrib-bibtex>=2.5
sphinx_rtd_theme
2 changes: 2 additions & 0 deletions env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ elif [[ $LOGINHOST =~ \.bullx$ ]]; then
STRATEGY="atosecmwf"
elif [[ $LOGINHOST =~ uan[0-9][0-9] ]]; then
STRATEGY="lumi"
elif [[ $LOGINHOST =~ nesh-login[1-3] ]]; then
STRATEGY="nesh"
elif [[ -d $DIR/env/$LOGINHOST ]]; then # check if directory with LOGINHOST exists in env
STRATEGY=$LOGINHOST
else
Expand Down
62 changes: 19 additions & 43 deletions env/juwels/shell
Original file line number Diff line number Diff line change
@@ -1,44 +1,20 @@
##########
module --force purge
module use /gpfs/software/juwels/otherstages
module load Stages/2020
module load Intel/2020.2.254-GCC-9.3.0
module load ParaStationMPI/5.4.7-1
module load CMake/3.18.0
module load imkl/2020.2.254
module load netCDF-Fortran/4.5.3
module load netCDF/4.7.4
module load Perl/5.32.0
module load netCDF
#!/usr/bin/bash
# ENVIRONMENT used in new_test15_compute_20000101-20000101.run
# Use this file to source the environment in your
# preprocessing or postprocessing scripts

export LC_ALL=en_US.UTF-8
export TMPDIR=/tmp
export FC=mpifort
export F77=mpifort
export MPIFC=mpifort
export FCFLAGS=-free
export CC=mpicc
export CXX=mpic++

export NETCDF_Fortran_INCLUDE_DIRECTORIES=$EBROOTNETCDFMINFORTRAN/include
export NETCDF_Fortran_LIBRARIES=$EBROOTNETCDFMINFORTRAN/lib

#module use /gpfs/software/juwels/otherstages
#module load Stages/2019a
#module load StdEnv
## For intel MPI
##module load Intel/2019.3.199-GCC-8.3.0 IntelMPI/2018.5.288 imkl/2019.3.199
##export FC=mpiifort CC=mpiicc CXX=mpiicpc

## For ParaStation MPI
#module load Intel/2019.3.199-GCC-8.3.0 ParaStationMPI/5.4 imkl/2019.5.281
#export FC=mpifort CC=mpicc CXX=mpicxx

#module load netCDF/4.6.3
#module load netCDF-Fortran/4.4.5
#module load CMake
#export NETCDF_DIR=$EBROOTNETCDF
#export NETCDFF_DIR=$EBROOTNETCDFMINFORTRAN
#export NETCDF_Fortran_INCLUDE_DIRECTORIES=${NETCDFF_DIR}/include/
#export NETCDF_C_INCLUDE_DIRECTORIES=${NETCDF_DIR}/include/
#export NETCDF_CXX_INCLUDE_DIRECTORIES=${NETCDFCXX_DIR}/include/
module --force purge
module use $OTHERSTAGES
module --force purge
module load Stages/2023
module load GCC/11.3.0
module load OpenMPI/4.1.4
module load CMake/3.26.3
module load Python/3.10.4
module load imkl/2022.1.0
module load Perl/5.34.1
module load git
module load CDO
module unload ecCodes
module load libaec FFTW imkl cURL netCDF netCDF-Fortran
module list
15 changes: 15 additions & 0 deletions env/nesh/shell
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Inspired by environment for albedo
module load oneapi2023-env/2023.2.0

module load cmake/3.27.4
module load oneapi/2023.2.0
module load oneapi-mkl/2023.1.0
module load oneapi-mpi/2021.10.0
module load netcdf-c/4.9.2-with-oneapi-mpi-2021.10.0
module load netcdf-fortran/4.6.0-with-oneapi-mpi-2021.10.0
export FC=mpiifort CC=mpiicc CXX=mpiicpc


# haven't set any environment variables. hopefully fine by now
export I_MPI_PMI=pmi2
export I_MPI_PMI_LIBRARY=/usr/lib64/libpmi2.so
5 changes: 4 additions & 1 deletion mesh_part/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
cmake_minimum_required(VERSION 3.4)

project(fesom_ini C Fortran)
find_package(MPI REQUIRED)



# get our source files
set(src_home ${CMAKE_CURRENT_LIST_DIR}/../src)
Expand All @@ -26,5 +29,5 @@ elseif(${CMAKE_Fortran_COMPILER_ID} STREQUAL GNU )
target_compile_options(${PROJECT_NAME} PRIVATE -fallow-argument-mismatch) # gfortran v10 is strict about erroneous API calls: "Rank mismatch between actual argument at (1) and actual argument at (2) (scalar and rank-1)"
endif()
endif()
target_link_libraries(${PROJECT_NAME} ${PROJECT_NAME}_C)
target_link_libraries(${PROJECT_NAME} ${PROJECT_NAME}_C MPI::MPI_Fortran)
set_target_properties(${PROJECT_NAME} PROPERTIES LINKER_LANGUAGE Fortran)
Loading

0 comments on commit c4491e2

Please sign in to comment.