From 7f8c7c4f7c4cea0ce8750fd1f22b6f8fdcfeabcf Mon Sep 17 00:00:00 2001
From: "Takumi.Matsunobu" <Takumi.Matsunobu@physik.uni-muenchen.de>
Date: Wed, 19 Jul 2023 14:13:08 +0200
Subject: [PATCH] Tweaks for removing SIGSEGV

---
 conf/common/build.yml                               | 4 ++++
 namelists/real-from-d2-ana/icon_atmosphere.namelist | 2 +-
 templates/common/run_icon.sh                        | 5 ++++-
 templates/real-from-d2-ana/prepare_experiment.sh    | 2 +-
 templates/real-from-d2-ana/prepare_lbc_remote.sh    | 2 +-
 templates/real-from-d2-ana/prepare_namelist.py      | 4 +++-
 6 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/conf/common/build.yml b/conf/common/build.yml
index baa307e..e0a3753 100644
--- a/conf/common/build.yml
+++ b/conf/common/build.yml
@@ -31,6 +31,10 @@ icon:
   load_cmd: build_cmd
   version: master # The latest release at the moment of creating this file was 2.6.5-nwp0
 
+  launch_cmd: "srun"
+  # for LRZ
+  #launch_cmd: "-K --mpi=pmi2 --cpu-freq=HighM1 --kill-on-bad-exit=1 --cpu_bind=verbose,cores --distribution=block:block"
+
 dwdicontools:
   build_cmd: "dwd-icon-tools% %SPACK.COMPILER%"
   load_cmd: build_cmd
diff --git a/namelists/real-from-d2-ana/icon_atmosphere.namelist b/namelists/real-from-d2-ana/icon_atmosphere.namelist
index 0d9bc93..e72ebc9 100644
--- a/namelists/real-from-d2-ana/icon_atmosphere.namelist
+++ b/namelists/real-from-d2-ana/icon_atmosphere.namelist
@@ -132,7 +132,7 @@
   vmr_cfc12            = 532.e-12 
   direct_albedo_water  = 3
   albedo_whitecap      = 1
- ecrad_data_path       = "/hpc/uhome/adlozar/icon/externals/ecrad/data"
+  ecrad_data_path       = "/dss/dsskcsfs01/pn34ca/pn34ca-dss-0009/ICON/data/externals/ecrad"
   ecrad_llw_cloud_scat = .false.
   ecrad_iliquid_scat   = 0
   ecrad_iice_scat      = 0
diff --git a/templates/common/run_icon.sh b/templates/common/run_icon.sh
index a72b0c8..44741da 100644
--- a/templates/common/run_icon.sh
+++ b/templates/common/run_icon.sh
@@ -32,5 +32,8 @@ source ${WORKDIR}/eccodes_defs.env
 # Increase stack size limit
 ulimit -s unlimited
 
+# Get proper load command.
+ICON_LAUNCH_CMD="%ICON.LAUNCH_CMD%"
+
 # Run icon
-srun icon
+${ICON_LAUNCH_CMD} icon
diff --git a/templates/real-from-d2-ana/prepare_experiment.sh b/templates/real-from-d2-ana/prepare_experiment.sh
index 76ee38e..2774e08 100644
--- a/templates/real-from-d2-ana/prepare_experiment.sh
+++ b/templates/real-from-d2-ana/prepare_experiment.sh
@@ -49,4 +49,4 @@ cp "%simulation.namelist_paths.ana_map%" .
 cp "%simulation.namelist_paths.lbc_map%" .
 
 # Change permissions to read only.
-chmod 440 ./*
\ No newline at end of file
+#chmod 440 ./*
\ No newline at end of file
diff --git a/templates/real-from-d2-ana/prepare_lbc_remote.sh b/templates/real-from-d2-ana/prepare_lbc_remote.sh
index 31e473d..2da0d2c 100644
--- a/templates/real-from-d2-ana/prepare_lbc_remote.sh
+++ b/templates/real-from-d2-ana/prepare_lbc_remote.sh
@@ -118,7 +118,7 @@ if [ "${LBC_DATA_IS_LOCAL}" != "True" ]; then
   #cp "${LBC_SOURCE}" "${LBC_FILE}"
 
   # Change permissions to read only.
-  chmod 440 ${MEMBER_DIR}/latbc_*.grib
+  #chmod 440 ${MEMBER_DIR}/latbc_*.grib
 
 
 fi
\ No newline at end of file
diff --git a/templates/real-from-d2-ana/prepare_namelist.py b/templates/real-from-d2-ana/prepare_namelist.py
index bd69447..40172d0 100644
--- a/templates/real-from-d2-ana/prepare_namelist.py
+++ b/templates/real-from-d2-ana/prepare_namelist.py
@@ -90,7 +90,9 @@ atmosphere_namelist_replacements = {
                             # -> cloud_cosmo5 (mu=1/3): 0 (REF), 1, 2, 4, 8 
                             # -> cloud_nue1mue1 (mu=1): 1 (REF), 2, 4, 8 
     },
-
+    # "radiation_nml": {
+    #     "ecrad_data_path:": "",
+    # },
 }
 
 master_namelist_replacements = {
-- 
GitLab