#!/bin/bash

# ICON
#
# ------------------------------------------
# Copyright (C) 2004-2026, DWD, MPI-M, DKRZ, KIT, ETH, MeteoSwiss
# Contact information: icon-model.org
# See AUTHORS.TXT for a list of authors
# See LICENSES/ for license information
# SPDX-License-Identifier: BSD-3-Clause
# ------------------------------------------

#==============================================================================
# Creates the ICON run scripts
# Leonidas Linardakis, MPI-M, 2011-25-1
#==============================================================================
set +x
base_folder=$(pwd)
. $base_folder/run/set-up.info
input_folder=run
use_shell=${use_shell:="/bin/ksh"}
make_runscript="$use_shell ./config/make_target_runscript"

[[ -f run_parameters ]] && . run_parameters

#==============================================================================
create_runscript()
{

$make_runscript                  \
  in_folder=$input_folder        \
  in_script=exp.${exp_name}      \
  in_script=exec.iconrun         \
  out_script=exp.${exp_name}.run \
  EXPNAME=${exp_name}            \
  queue=develop
#   nproma=$nproma                 \
#   no_of_nodes=$no_of_nodes       \
#   mpi_procs_pernode=$mpi_procs_pernode  \
#   openmp_threads=$openmp_threads \
#   memory_model=$memory_model     \
#   cpu_time=$cpu_time

if [[ _$run == "_true" ]] ; then
  cd run
  $use_submit exp.${exp_name}.run
  cd -
fi

}
#==============================================================================

#==============================================================================
# Define run parameters
echo "-----------------------------------------------------------"
exp_name=$1

queue=${queue:-develop}
run=${run:-false}

create_runscript
echo "-----------------------------------------------------------"
#==============================================================================
