Skip to content

Commit

Permalink
Merge pull request #70 from NOC-MSM/57-npd-medusa-orca1
Browse files Browse the repository at this point in the history
57 npd medusa orca1
  • Loading branch information
atb299 authored Jan 23, 2025
2 parents 6fc0909 + a66b9c3 commit d1a8259
Show file tree
Hide file tree
Showing 43 changed files with 1,317 additions and 2 deletions.
2 changes: 1 addition & 1 deletion cfgs/GLOBAL_QCO_MEDUSA/eORCA025/e025tordf.slurm
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ do
rsync -vtpo $f $dstdir
#cp -p $f $dstdir
if [ $? -eq 0 ] ; then scount=$(( $scount + 1 )) ; fi
elif [ ! -f $dstdir/$f ] ; then
elif [ -f $dstdir/$f ] ; then
## file already there check if files are the same size :
heres=`wc -c $f | cut -d' ' -f1`
theres=`wc -c $dstdir/$f | cut -d' ' -f1`
Expand Down
8 changes: 7 additions & 1 deletion cfgs/GLOBAL_QCO_MEDUSA/eORCA025/namelist_medusa_cfg
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
&nammsa_ctl
ln_msa_carbchem = .true. !! activates Carbone cycle
ln_msa_avgqsr = .true. !! biology sees daily avg light
ln_msa_ccd = .false. !! ?? - check
ln_msa_ccd = .false. !! reads ccd file to init ccd field.
ln_msa_preico2 = .false. !! atm co2 forced at pre-ind level
ln_msa_ukesm_cpl = .false. !! activate coupling in MEDUSA with UKESM.
ln_msa_omipdic = .false. !! 2 dic pre-ind and date-related
ln_msa_zmp = .false. !! switch to Tom's Oithona + 2 very fast detritus
ln_msa_noco2flux = .false. !! debug - cut sea-air co2 fluxes
ln_msa_debug = .false. !! add lots of debug print statements
ln_msa_nancheck = .false. !! checks if any nans in bio 3D fields
ln_msa_check_n_fix = .false. !! check and exceptionally fix crazy
!! values for DIC, ALK, T, and S.
!! avoids carb chem crashes
ln_msa_kill_medusa = .false. !! debug - no bio sources and sinks
ln_msa_no_detsink = .false. !! debug - poc don't sink
ln_msa_nemo_qsr = .false. !! use 3D light field attenuated
!! from NEMO if TRUE
/
&nammsa_bio
!! min and max warning values
Expand Down
1 change: 1 addition & 0 deletions cfgs/GLOBAL_QCO_MEDUSA/eORCA1/INPUT
1 change: 1 addition & 0 deletions cfgs/GLOBAL_QCO_MEDUSA/eORCA1/axis_def_nemo-medusa.xml
1 change: 1 addition & 0 deletions cfgs/GLOBAL_QCO_MEDUSA/eORCA1/axis_def_nemo.xml
1 change: 1 addition & 0 deletions cfgs/GLOBAL_QCO_MEDUSA/eORCA1/bfr_coef.nc
59 changes: 59 additions & 0 deletions cfgs/GLOBAL_QCO_MEDUSA/eORCA1/check_mem.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
#!/bin/bash

set -e

interval=1 # N of seconds between memory queries
record_per_process=0
min_memory=0


usage=$"$(basename "$0") [-h] [-t n] [-p] \n
where: \n
-h show this help text \n
-t sampling interval in seconds. Must be an integer \n
-p record memory per user process. \n
-m entries with memory below this thresold are ignored. Units in kilobites
"

while getopts m:pt:h flag
do
case "${flag}" in
t) interval=${OPTARG};;
h) echo -e $usage 1>&2
exit 1
;;
p) record_per_process=1 ;;
m) min_memory=${OPTARG}


esac
done




if [ $record_per_process == 1 ]
then
echo "Step Memory Pid Name"
else
echo " Step total used free available"
fi

i=1
while [ 1 ]
do
if [ $record_per_process == 1 ]
then
# saves memory usage per process from ps
ps -F | tail -n +2 | awk "{ if (\$6 > $min_memory) print $i,\$6,\$2,\$11 }"
else
# saves system wide memory usage
#free --kilo | grep Mem | awk "{if (\$3 > $min_memory) print $i,\$3}"
free --human | grep Mem | awk "{printf(\"%8.8d %8s %8s %8s %8s\n\",$i,\$2,\$3,\$4,\$7)}"
fi
sleep $interval

i=$((i+interval))

done
51 changes: 51 additions & 0 deletions cfgs/GLOBAL_QCO_MEDUSA/eORCA1/context_nemo.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<!--
==============================================================================================
NEMO context
==============================================================================================
-->
<context id="nemo">
<!-- $id$ -->
<variable_definition>
<!-- Year/Month/Day of time origin for NetCDF files; defaults to 1800-01-01 -->
<variable id="ref_year" type="int"> 1900 </variable>
<variable id="ref_month" type="int"> 01 </variable>
<variable id="ref_day" type="int"> 01 </variable>
<variable id="rho0" type="float" > 1026.0 </variable>
<variable id="cpocean" type="float" > 3991.86795711963 </variable>
<variable id="convSpsu" type="float" > 0.99530670233846 </variable>
<variable id="rhoic" type="float" > 917.0 </variable>
<variable id="rhosn" type="float" > 330.0 </variable>
<variable id="missval" type="float" > 1.e20 </variable>
</variable_definition>

<!-- Fields definition -->
<field_definition src="./field_def_nemo-oce.xml"/> <!-- NEMO ocean dynamics -->
<field_definition src="./field_def_nemo-ice.xml"/> <!-- NEMO ocean sea ice -->
<field_definition src="./field_def_nemo-medusa.xml"/> <!-- NEMO ocean sea ice -->


<!-- Files definition -->
<file_definition src="file_def_nemo-oce_1d_C6.xml"/> <!-- NEMO ocean dynamics -->
<file_definition src="file_def_nemo-oce_5d_C6.xml"/> <!-- NEMO ocean dynamics -->
<file_definition src="file_def_nemo-oce_1m_C6.xml"/> <!-- NEMO ocean dynamics -->
<file_definition src="file_def_nemo-oce_1y_C6.xml"/> <!-- NEMO ocean dynamics -->

<file_definition src="./file_def_nemo-ice_5d_C6.xml"/> <!-- NEMO ocean sea ice -->
<file_definition src="./file_def_nemo-ice_1m_C6.xml"/> <!-- NEMO ocean sea ice -->
<file_definition src="./file_def_nemo-ice_1y_C6.xml"/> <!-- NEMO ocean sea ice -->

<file_definition src="./file_def_nemo-medusa_5d.xml"/> <!-- MEDUSA Ocean BGC -->
<file_definition src="./file_def_nemo-medusa_1m.xml"/> <!-- MEDUSA Ocean BGC -->
<file_definition src="./file_def_nemo-medusa_1y.xml"/> <!-- MEDUSA Ocean BGC -->

<!-- Axis definition -->
<axis_definition src="./axis_def_nemo-medusa.xml"/>

<!-- Domain definition -->
<domain_definition src="./domain_def_nemo.xml"/>

<!-- Grids definition -->
<grid_definition src="./grid_def_nemo-medusa.xml"/>


</context>
1 change: 1 addition & 0 deletions cfgs/GLOBAL_QCO_MEDUSA/eORCA1/domain_def_nemo.xml
122 changes: 122 additions & 0 deletions cfgs/GLOBAL_QCO_MEDUSA/eORCA1/e025tordf.slurm
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
#!/bin/bash

# Slurm job options (job-name, job time)
#SBATCH --job-name=archit
#SBATCH --time=2:59:0
#SBATCH --ntasks=1

#SBATCH --account=n01-CLASS
#SBATCH --partition=serial
#SBATCH --qos=serial

# Define memory required for this jobs. By default, you would
# get just under 2 GB, but you can ask for up to 125 GB.
#SBATCH --mem=8G

# Set the number of threads to 1
# This prevents any threaded system libraries from automatically
# using threading.
export OMP_NUM_THREADS=1
#
srcdir=${PWD}/OUTPUT/
dstroot=$1 ## target storing directory
ecount=0


# ========================================================
## module loads
module load cray-mpich/8.1.23
module load cray-hdf5-parallel/1.12.2.1
module load cray-netcdf-hdf5parallel/4.9.0.1


# ========================================================
# Define useful functions
get_time_count () {
VARNAME=time_counter
NAMNAME=$1
VAR=$(ncdump -h ${NAMNAME} | grep "time_counter = ")
VAR=${VAR%\ *}
VAR=${VAR#*\(}
echo "$VAR"
}


cd $srcdir

## refresh copied and corrupted list
rm to_be_deleted.txt
rm corrupted_list.txt
#
echo ptrc files to proceed :
ls *ptrc*nc
#
for year in `seq 1976 1 2023`
do
dstdir=${dstroot}/${year}
#
if [ ! -d $dstdir ] ; then mkdir -p $dstdir ; fi
#
for t in 1y 1m 5d 1d
do
for g in scalar icemod grid_U grid_V grid_W grid_T diad_T ptrc_T
do
files=`ls -1 *${t}_${g}_${year}* 2>/dev/null`
#files=`ls \*${t}_${g}_${year}\* `
#echo ${t}_${g}_${year}
if [ ${#files} -lt 1 ] ; then
echo 'Nothing to transfer for '$g' at '${t}' interval in '${year}
else
scount=0
numfiles=`wc -w <<< ${files}`
echo 'Transferring '${numfiles}' for '$g' at '${t}' interval:'
for f in $files
do
time_c=$(get_time_count $f)
if [ ! -f $dstdir/$f ] && [ ${time_c} >= 1 ] ; then
## files not yet store and full --> copy them to storedir
echo rsync -vtpo $f $dstdir
rsync -vtpo $f $dstdir
#cp -p $f $dstdir
if [ $? -eq 0 ] ; then scount=$(( $scount + 1 )) ; fi
elif [ -f $dstdir/$f ] ; then
## file already there check if files are the same size :
heres=`wc -c $f | cut -d' ' -f1`
theres=`wc -c $dstdir/$f | cut -d' ' -f1`
if [ $heres -eq $theres ]
then
#echo $f -- copy size match -- can safely erase local copy
echo rm -f $f >> to_be_deleted.txt
# rm -f $f
else
## file broken -- try to complete it
echo fixing broken copy of $f with
echo rsync -vtpo --append $f $dstdir
rsync -vtpo --append $f $dstdir
fi
else
## file not stored because empty or corrupted : record them in corrupted list
echo $f >> corrupted_list.txt
fi
done
if [ $scount -ne $numfiles ] ; then echo 'Errors have occurred' ; ecount=$(( $ecount + 1 )) ; fi
fi
done
done
done
#
if [ $ecount -gt 0 ] ; then
echo 'ERRORS HAVE OCCURRED. Check log for Errors'
else
echo 'Transfers successful'
fi
# Find and delete all files of zero size in the current directory and subdirectories
cd ${dstroot}
echo 'Erasing empty copies --'
find . -type f -size 0 -print -delete
1 change: 1 addition & 0 deletions cfgs/GLOBAL_QCO_MEDUSA/eORCA1/eddy_viscosity_3D.nc
1 change: 1 addition & 0 deletions cfgs/GLOBAL_QCO_MEDUSA/eORCA1/field_def_nemo-ice.xml
1 change: 1 addition & 0 deletions cfgs/GLOBAL_QCO_MEDUSA/eORCA1/field_def_nemo-medusa.xml
1 change: 1 addition & 0 deletions cfgs/GLOBAL_QCO_MEDUSA/eORCA1/field_def_nemo-oce.xml
1 change: 1 addition & 0 deletions cfgs/GLOBAL_QCO_MEDUSA/eORCA1/file_def_nemo-ice_1m_C6.xml
1 change: 1 addition & 0 deletions cfgs/GLOBAL_QCO_MEDUSA/eORCA1/file_def_nemo-ice_1y_C6.xml
1 change: 1 addition & 0 deletions cfgs/GLOBAL_QCO_MEDUSA/eORCA1/file_def_nemo-ice_5d_C6.xml
1 change: 1 addition & 0 deletions cfgs/GLOBAL_QCO_MEDUSA/eORCA1/file_def_nemo-medusa_1m.xml
1 change: 1 addition & 0 deletions cfgs/GLOBAL_QCO_MEDUSA/eORCA1/file_def_nemo-medusa_1y.xml
1 change: 1 addition & 0 deletions cfgs/GLOBAL_QCO_MEDUSA/eORCA1/file_def_nemo-medusa_5d.xml
1 change: 1 addition & 0 deletions cfgs/GLOBAL_QCO_MEDUSA/eORCA1/file_def_nemo-oce_1d_C6.xml
1 change: 1 addition & 0 deletions cfgs/GLOBAL_QCO_MEDUSA/eORCA1/file_def_nemo-oce_1m_C6.xml
1 change: 1 addition & 0 deletions cfgs/GLOBAL_QCO_MEDUSA/eORCA1/file_def_nemo-oce_1y_C6.xml
1 change: 1 addition & 0 deletions cfgs/GLOBAL_QCO_MEDUSA/eORCA1/file_def_nemo-oce_5d_C6.xml
1 change: 1 addition & 0 deletions cfgs/GLOBAL_QCO_MEDUSA/eORCA1/grid_def_nemo-medusa.xml
1 change: 1 addition & 0 deletions cfgs/GLOBAL_QCO_MEDUSA/eORCA1/grid_def_nemo.xml
66 changes: 66 additions & 0 deletions cfgs/GLOBAL_QCO_MEDUSA/eORCA1/iodef.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<?xml version="1.0"?>
<simulation>

<!-- ============================================================================================ -->
<!-- XIOS context -->
<!-- ============================================================================================ -->

<!-- XIOS3 -->
<context id="xios" >
<variable_definition>
<variable_group id="buffer">
<variable id="min_buffer_size" type="int">4000000</variable>
<variable id="optimal_buffer_size" type="string">performance</variable>
</variable_group>

<variable_group id="parameters" >
<variable id="using_server" type="bool">true</variable>
<variable id="info_level" type="int">10</variable>
<variable id="print_file" type="bool">false</variable>
<variable id="using_server2" type="bool">false</variable>
<variable id="transport_protocol" type="string" >p2p</variable>
<variable id="using_oasis" type="bool">false</variable>
</variable_group>
</variable_definition>
<pool_definition>
<pool name="Opool" nprocs="57">
<service name="t1dwriter" nprocs="1" type="writer"/>
<service name="u1dwriter" nprocs="1" type="writer"/>
<service name="v1dwriter" nprocs="1" type="writer"/>
<service name="s1dwriter" nprocs="1" type="writer"/>
<service name="p5dwriter" nprocs="1" type="writer"/>
<service name="t5dwriter" nprocs="1" type="writer"/>
<service name="u5dwriter" nprocs="1" type="writer"/>
<service name="v5dwriter" nprocs="1" type="writer"/>
<service name="w5dwriter" nprocs="1" type="writer"/>
<service name="s5dwriter" nprocs="1" type="writer"/>
<service name="d1mwriter" nprocs="2" type="writer"/>
<service name="p1mwriter" nprocs="2" type="writer"/>
<service name="t1mwriter" nprocs="2" type="writer"/>
<service name="u1mwriter" nprocs="1" type="writer"/>
<service name="v1mwriter" nprocs="1" type="writer"/>
<service name="w1mwriter" nprocs="2" type="writer"/>
<service name="s1mwriter" nprocs="1" type="writer"/>
<service name="d1ywriter" nprocs="2" type="writer"/>
<service name="p1ywriter" nprocs="2" type="writer"/>
<service name="t1ywriter" nprocs="2" type="writer"/>
<service name="u1ywriter" nprocs="1" type="writer"/>
<service name="v1ywriter" nprocs="1" type="writer"/>
<service name="w1ywriter" nprocs="2" type="writer"/>
<service name="s1ywriter" nprocs="1" type="writer"/>
<service name="iwriter" nprocs="1" type="writer"/>
<service name="pgatherer" nprocs="8" type="gatherer"/>
<service name="tgatherer" nprocs="8" type="gatherer"/>
<service name="igatherer" nprocs="4" type="gatherer"/>
<service name="ugatherer" nprocs="4" type="gatherer"/>
</pool>
</pool_definition>
</context>

<!-- ============================================================================================ -->
<!-- NEMO CONTEXT add and suppress the components you need -->
<!-- ============================================================================================ -->

<context id="nemo" default_pool_writer="Opool" default_pool_gatherer="Opool" src="./context_nemo.xml"/> <!-- NEMO -->

</simulation>
1 change: 1 addition & 0 deletions cfgs/GLOBAL_QCO_MEDUSA/eORCA1/namelist_cfg
Loading

0 comments on commit d1a8259

Please sign in to comment.