#!/bin/bash -x
#
# --------------------------------------------------
#
# Script to Create config. architecture 
#
# --------------------------------------------------
# Configuration architecture
# --------------------------------------------------
# $HOME/CONFIGS/MYCONFIG
#                       - wrf_in
#                       - ww3_in
#                       - croco_in
#                       - oasis_in
#                       - toy_in
# $WORKDIR/CONFIGS/MYCONFIG
#                       - wrf_files
#                       - ww3_files
#                       - croco_files
#                       - oasis_files
#                       - toy_files
# --------------------------------------------------
#
# Further Information:   
# http://www.croco-ocean.org
#  
# This file is part of CROCOTOOLS
#
# CROCOTOOLS is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published
# by the Free Software Foundation; either version 2 of the License,
# or (at your option) any later version.
#
# CROCOTOOLS is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
# MA  02111-1307  USA
#
# Copyright (c) 2018 S. Jullien
# swen.jullien@ifremer.fr
# --------------------------------------------------

#=========================================================================
#=======================  USER CHANGES  ==================================
#=========================================================================

# Home and Work configuration directories
# ---------------------------------------
export hconf=~/CONFIGS/BENGUELA
export wconf=$WORKDIR/CONFIGS/BENGUELA

# CROCO parent directory 
# (where croco_tools directory and croco source directory can be found)
# -----------------
export croco=~/croco

# Options for you configuration
# -----------------------------
use_croco=1
use_oasis=1
use_wrf=1
use_ww3=1
use_toy=1

#=========================================================================
#=====================  END USER CHANGES  ================================
#=========================================================================

if [ $use_croco == 1 ] ; then 
 echo 'Copy CROCO useful scripts and input files'
 echo '-----------------------------------------'
 mkdir -p $hconf/croco_in
 mkdir -p $wconf/croco_files
 cp -r $croco/croco_tools/Coupling_tools/croco_in/* $hconf/croco_in/.
 cp -f $croco/croco/OCEAN/param.h $hconf/croco_in/.
 cp -f $croco/croco/OCEAN/jobcomp $hconf/croco_in/.

fi

if [ $use_ww3 == 1 ] ; then
 echo 'Copy WW3 useful scripts and input files'
 echo '-----------------------------------------'
 mkdir -p $hconf/ww3_in
 mkdir -p $wconf/ww3_files
 cp -r $croco/croco_tools/Coupling_tools/ww3_in/* $hconf/ww3_in/.
fi

if [ $use_wrf == 1 ] ; then
 echo 'Copy WRF useful scripts and input files'
 echo '-----------------------------------------'
 mkdir -p $hconf/wrf_in
 mkdir -p $wconf/wrf_files
 cp -r $croco/croco_tools/Coupling_tools/wrf_in/* $hconf/wrf_in/.
fi
if [ $use_oasis == 1 ] ; then
 echo 'Copy OASIS useful scripts and input files'
 echo '-----------------------------------------'
 mkdir -p $hconf/oasis_in
 mkdir -p $wconf/oasis_files
 cp -r $croco/croco_tools/Coupling_tools/oasis_in/* $hconf/oasis_in/.
fi
if [ $use_toy == 1 ] ; then
 echo 'Copy TOY sources, useful scripts and input files'
 echo '------------------------------------------------'
 mkdir -p $hconf/toy_in
 mkdir -p $wconf/toy_files
 cp -r $croco/croco_tools/Coupling_tools/toy_in/* $hconf/toy_in/.
fi

echo 'Copy run scripts'
echo '----------------'

cp $croco/croco_tools/Coupling_tools/* $hconf/.

