#!/bin/ksh +x
#***************************#
#                           #
#     Reinforcement_Get     #
#                           #
#***************************#
#
if [ "${1}" = "-h" ]
then
  echo " "
  echo " Gets Some Important Parameters for Mixed Waves Energy Reinforcement"
  echo " "
  echo "   Usage:"
  echo " "
  echo "   ./Reinforcement_Get cs [Mmax]"
  echo " "
  echo " Default:"
  echo " cs = br ; Mmax = 126"
  echo " "
  echo " cs : br for Barotropic Mode"
  echo " Mmax : Rhomb+1 (even), Rhomb is the zonal wave truncation (Rhomb odd number)"
  echo "        is the total number of zonal waves plus the zonal mean (+1)"
  echo " "
  echo " Obs:"
  echo "    Barotropic Mixed Waves 3 and 1 are the Best for Suitable Graphic"
  echo "    Mixed Rossby-Gravity: mx : l=Mmax+17, isi=2, ln=0"
  echo "    Wave Numbers for Reinforcement: s1=3 and s2=1"
  echo "    Note that s=k-1 ; s=0,1,2,... ; k=1,2,3,..."
  echo " "
  exit
fi
#
cs=${1}
if [ "${cs}" != "br" ]
then
  cs= "br" ]
fi
#
if [ -z "${2}" ]
then
  Mmax=126
else
  Mmax=${2}
fi
#
dircfg='../../../Config/'
. ${dircfg}Config_Dir
. ${dircfg}Reference_Case
#
typeset -Z3 hh
# Barotropic Mode
hh=001
typeset -Z3 kmx
kmx=${Kmax}
typeset -Z4 mmx1
let mmx1=${Mmax}-1
Trunc=RB${mmx1}L${kmx}
ext=${Trunc}_${csvm}_h${hh}
hgf=Hough_Functions.${ext}
out=../../output/Reinforcement_Get_${ext}.out
#
rm -f ${out}
rm -f ./nml/Reinforcement_Get.nml
#
set -x
#
cat << eot > ./nml/Reinforcement_Get.nml
 &HoughFnml
  Mmax=${Mmax}
  DirInp='${dirhgfcfg} ',
  Hough_Functions='${hgf}'
 /
eot
#
# Running
time ../../bin/Reinforcement_Get.bin > ${out}
#
rm -f ./nml/Reinforcement_Get.nml
#
