#!/bin/bash

for cas in 1 2 ; do

if [ $cas = 1 ] ; then
   wtsurf=0.
else
   wtsurf=0.015
fi
cp -f lmdz1d.def tmp ; sed -e 's/wtsur.*.=.*.$/wtsurf='$wtsurf'/' tmp >| lmdz1d.def

mkdir CAS$cas

for cons in 0 -1 1 2 110 101 ; do

cat <<eod>| gcm.def
iflag_ener_conserv=$cons
day_step=144
iphysiq=1
eod

./lmdz1d.e > /dev/null
ncks -v sens,flat,bils,bils_diss,bils_ec,bils_tke,bils_kinetic,bils_latent,bils_enthalp histhf.nc -O CAS$cas/cons$cons.nc

done
done


