#!/bin/ksh  -x

# VARIAVEIS 

date

cd ${Eta_run}

export tmmark=t00s
export TMMARK=t00s
export MPIPROGINF=ALL_DETAIL
export MPICOMMINF=ALL
export MPIMULTITASKMIX=ON
export SERVER_GROUPS=${npio_server_groups}
let npr=${npr}+${npio_server}+${SERVER_GROUPS}

head=fort.

rm -f ${Eta_run}/EGRD* ${Eta_run}/restrt* ${Eta_run}/fcstdone*

cp ${Eta_ucl}/cuparmdata.dat            ${Eta_run}/cuparmdata.dat
cp ${Eta_ucl}/soil_veg_namelist_ver_2.1 ${Eta_run}/soil_veg_namelist_ver_2.1
cp ${Eta_fix}/eta_micro_lookup.dat      ${Eta_run}/eta_micro_lookup.dat
cp ${Eta_ucl}/namelist_filename.txt     ${Eta_run}/namelist_filename.txt
cp ${Eta_wrk_fix}/co2.dat               ${Eta_run}/co2.dat

ln -sf ${Eta_run}/cnst.file ${Eta_run}/CNST.file
ln -sf ${Eta_run}/init.file ${Eta_run}/INIT.file
ln -sf ${Eta_run}/bndy.file ${Eta_run}/BNDY.file
ln -sf ${Eta_run}/fcstdata.meso ${Eta_run}/FCSTDATA.meso
ln -sf ${Eta_run}/co2.dat ${Eta_run}/CO2.dat
ln -sf ${Eta_run}/cuparmdata.dat ${Eta_run}/CUPARMDATA.dat
ln -sf ${Eta_run}/soil_veg_namelist_ver_2.1 ${Eta_run}/SOIL_VEG_NAMELIST_VER_2.1
ln -sf ${Eta_run}/namelist_filename.txt ${Eta_run}/NAMELIST_FILENAME.txt
ln -sf ${Eta_run}/eta_micro_lookup.dat ${Eta_run}/ETA_MICRO_LOOKUP.dat
ln -sf ${Eta_run}/slope.nml ${Eta_run}/SLOPE.nml
ln -sf ${Eta_run}/solar ${Eta_run}/SOLAR


Model_exe=${Eta_exe}/${Fctexec}

 if [ ${npr} -le 2 ] ; then   
     ${Model_exe}
  else
    mpiexec -n ${npr} ${Model_exe} > ${Eta_run}/saida_Eta.out
 fi

err=$?
if [ $err -ne 0 ] ; then
echo "FALHA NA EXECUCAO DO MODELO!!!!VERIFICAR O ARQUIVO /exe/etafcst_all"
 exit 1
fi

date
