From cee7c01eb2fcc805a1fea6f58d35b7e308acc43b Mon Sep 17 00:00:00 2001
From: Stefan Hagemann <stefan.hagemann@hereon.de>
Date: Mon, 20 Jan 2025 10:52:19 +0100
Subject: [PATCH] Minor changes to convert_inflow.com

---
 log_changes.txt            | 12 ++++++++----
 scr/hd_run_settings.ksh    | 21 +++++++++++----------
 util/convert_discharge.f90 |  2 +-
 util/convert_inflow.com    |  3 +++
 4 files changed, 23 insertions(+), 15 deletions(-)

diff --git a/log_changes.txt b/log_changes.txt
index 69604a1..eb17c07 100644
--- a/log_changes.txt
+++ b/log_changes.txt
@@ -78,6 +78,7 @@ x 55037 as 55036,  but irf_vel=0, using forcing from JSBACH run 25288, 1979-2009
 55044 as 55037   but using 0.5 degree version (Reference Vs. 1.9): 1979-2009
 x 55045 as 55044   but using HD parameter file Vs. 1.10, incl. Overland flow k * 2, Baseflow k * 4 
                     same factors for consisteny and showing impact of resolution. 
+                   used as forcing for ICON-Coast
 55046 as 55041,  but with Vs. 03 correction of ARF_K - mainstream: hdpara_vs4d_v03_euro5min.nc, 1999-2009
 55047 as 55041,  but with Vs. 04 correction of ARF_K - mainstream: hdpara_vs4d_v04_euro5min.nc, 1999-2009
 x 55048 as 55037,  but using MPI-HM (55010) forcing: 1979-2009
@@ -93,6 +94,7 @@ o 55050 as 55037,  but using JSBACH3-PF run 25410 as input, 1979-2009
                  with the last commit and run 62008
 55055 as 55041,  but using code of Oct. commit also used for 55054
 o 55056 as 55048   but using MPI-HM (55011) forcing driven by GWSP3, 1901-2014 , Nov. 2018 
+                 --> Fabian
 55057 as 55056   but using ERA5 forcing
 55058 as 55056   but using MPI-HM (55012, without lakes) forcing driven by ERA5, 1979-2018 
 55059 as 55056   but using MPI-HM (55013, with lakes) forcing driven by ERA5, 1979-2018 
@@ -142,6 +144,7 @@ x 55086 as 55073   but with repeated HydroPy run (55026)  --> Provided to KSD
 55103 as 55102   but using EOBS20 forcing (55042)
 55104 as 55102   but with HydroPy + Frozen soil changes (55043)
 55105 as 55104   but using EOBS20 forcing (55044)
+***** all above are saved *****
 
 HD Model version 5.0
 55111             European simulation using HydroPy 1.0 with ERA5 forcing (55051), 1979-2018
@@ -207,7 +210,7 @@ Levante           1 year of discharge simulation: MPI and OpenMPI are binary ide
 
 57020 as 55201  G but global. Restart: Running year 1940: 10
 55204 as 55192    Test simulation: 1979
-
+55207 as 57020  G but using hdpara_vs5_2b.nc, Restart from 57020, Start: 1970
 
 HydroPy-based derived from CCLM/ICON-CLM
 55184 as 55183    but using HydroPy-CCLM-euro5min run 57007 with restart from 55183: 2020-2021
@@ -270,7 +273,7 @@ cdo info -sellonlatbox,10.86,10.88,53.2,53.26 7055049_meanflow_1999.nc | more
 62009 as 62007   Input from Ronnys OpenFred F17 run: CCLM at 0.0625 degree 2002-2007, restart from 62008
 62016 as 62008   but using HD 0.5 degree, 1979-2013
 62017 as 62009   but using Ha's CCLM data for 2014-2016
-62018 as 62008   Input from CoastDat III, 0.11°, using 62008 restart file, 1979-2016
+62018 as 62008 x Input from CoastDat III, 0.11°, using 62008 restart file, 1979-2016
 62019 as 62017   but using Ha's CCLM_sn for Set/Oct 2013, using 62008 restart file of 1.1.2013
 62020 as 62019   but using Ha's CCLM0
 62021 as 62019   but using Ha's CCLM1
@@ -280,11 +283,11 @@ cdo info -sellonlatbox,10.86,10.88,53.2,53.26 7055049_meanflow_1999.nc | more
 62025 as 62019   but using Ha's CCLM5
 62026            HD version 5b using Burkhardts CCLM 0.44 degree run over Europe, 1999-2009
 62027 as 62026   but using Burkhardts ICON-CLM run interplated to 0.44 degree over Europe, 1999-2009
-62028 as 62018   but using HD version 5.0: 1979-2016. Note that a 1979 test simulation yielded
+62028 as 62018 x but using HD version 5.0: 1979-2016. Note that a 1979 test simulation yielded
                  binary identical results for srv- and nc-input formats. 
 HD Vs. 5.1
 62029 as 62028   but using HD version 5.1: 1979-2018
-62030            HD Model Vs. 5.1 using REA6 forcing (1995-2018)
+62030          x HD Model Vs. 5.1 using REA6 forcing (1995-2018)
 62031 as 62030   but using ICON2.6.4 standalone run inuk009 on NuKLEUS domain 
 62032 as 62031   but using Ha's CCML 6.0 exp. 002
 
@@ -315,6 +318,7 @@ HD Vs. 5.1
 62058     EUR-11 ICON-CLM COPAT2 run C2I200/C2I200c with ERA5 forcing, 1979-1984/2002-2008
 62059     ICON-CLM standalone run 2008-2018, Nukleus grid
 62060     GCOAST-AHOI 2.0 coupled simulation: 2010-2018 using ICON-CLM from 62059
+62061     ICON-CLM UDAG evaluation run 1950-2023, Nukleus grid
 
 
 Australia
diff --git a/scr/hd_run_settings.ksh b/scr/hd_run_settings.ksh
index 1c35642..6666e89 100644
--- a/scr/hd_run_settings.ksh
+++ b/scr/hd_run_settings.ksh
@@ -13,13 +13,13 @@
 #
 # ***** HD and forcing Experiment nos. and HD settings ********************************
 #
-EXPINP=62061                       # Exp. no. of forcing - used for CCLM, HydroPy, Remo
+EXPINP=57020                       # Exp. no. of forcing - used for CCLM, HydroPy, Remo
                                    #   ERA5 (55053/54) & JSBACH forcing (25288,25410)
-EXP=70${EXPINP}
-##EXP=7055204
+##EXP=70${EXPINP}
+EXP=7055207
 
 typeset -Z4 YYYY
-YYYY=1950        # First year of simulation
+YYYY=1970        # First year of simulation
 #
 # *** Restart or Cold Start
 if [ -e ${HDMAIN}/log/${EXP}.year ] ; then
@@ -31,11 +31,11 @@ else
   INEU=1
   cstart='Cold-Start'
 fi
-YEND=1950       # Last year of simulation
+YEND=1970       # Last year of simulation
 
-IFORCE=3        # Forcing: 1 = HydroPy, 2 = JSBACH-PF, 3 = CCLM, 4 = REMO, 5=WRF, 6=ICON
+IFORCE=1        # Forcing: 1 = HydroPy, 2 = JSBACH-PF, 3 = CCLM, 4 = REMO, 5=WRF, 6=ICON
                 # Note that JSBACH forcing must be shifted by cdo remapnn,grid_0_5.txt
-HDRES=2         # HD Resolution: 0=0.5 Grad, 1=5 Min, 2= Euro 5 Min with 0.5° or 5 Min. input
+HDRES=1         # HD Resolution: 0=0.5 Grad, 1=5 Min, 2= Euro 5 Min with 0.5° or 5 Min. input
                 # 3 = Australia, 4=SEA=South East Asia
 FORCE_RES=99    # Forcing data resolution (original, without cdo), 99= any non-HD, (for IFORCE=1)
 CFORM=nc        # Format of forcing files: 'srv' = Service Format (Default), 'nc' = NetCDCF
@@ -113,13 +113,14 @@ case ${HDRES} in
 
          ulimit -s 102400
 
-         DNPARA="5min/hdpara_vs5_1.nc"
+##         DNPARA="5min/hdpara_vs5_1.nc"
+         DNPARA="5min/hdpara_vs5_2b_5min.nc"
          HDSTART="5min/hdstart_5min.nc"
          nhd_diag=7   # Log output for Elbe river on 5 Min.
 #
 #        *** Examples if restart files from previous runs are used for initialization.
-         if (( $YYYY > 1979 )) ; then 
-            HDSTART="hdstart/7055116/7055116_hdrestart_${YYYY}01.nc" 
+         if (( $YYYY > 1940 )) ; then 
+            HDSTART="hdstart/7057020/7057020_hdrestart_${YYYY}01.nc" 
             IZIP_START=1
          elif (( $YYYY == 1940 )) ; then 
            HDSTART="5min/7057020_hdrestart_194001.nc"
diff --git a/util/convert_discharge.f90 b/util/convert_discharge.f90
index 6476522..d634650 100644
--- a/util/convert_discharge.f90
+++ b/util/convert_discharge.f90
@@ -621,7 +621,7 @@
         map_char%dist_max_prime=60000.     ! 60 km for primary mask
         map_char%dist_max=200000.          ! 200 km for secondary mask (default if 1 mask)
       ENDIF
-      WRITE(*,*) "Ocean model ", icocean, " Inflow resolution: ", res_src   !  , ' =?', 0.5/6. 
+      WRITE(*,*) "Ocean model ", iocean, " Inflow resolution: ", res_src   !  , ' =?', 0.5/6. 
       WRITE(*,*) "Maximum distances: Primary = ", map_char%dist_max_prime 
       WRITE(*,*) "                 Secondary = ", map_char%dist_max 
       WRITE(*,*) "                  Boundary = ", map_char%deg_max_bound 
diff --git a/util/convert_inflow.com b/util/convert_inflow.com
index 32bffde..e404381 100755
--- a/util/convert_inflow.com
+++ b/util/convert_inflow.com
@@ -572,6 +572,9 @@ while [ $YEAR -le $YEND ] ; do
   if [ "$dn_src_mouth" != "" ]; then
     ncatted -O -h -a Source_mask,global,o,c,"River mouth mask on source grid: $dn_src_mouth" $DNOUTFLOW
   fi  
+  if [ $IMODE -eq 4 ]; then
+    ncatted -O -h -a Primary_mask,global,o,c,"Preset primary mouth mask on ocean grid: $DN_OMOUTH_PRESET" $DNOUTFLOW
+  fi  
   YEAR=`expr $YEAR + 1`
 done
 #
-- 
GitLab