2013年10月18日金曜日

test case: nns_annual



Mixing in Northern North Sea including the NPZD bio-geochemical model: http://www.gotm.net/index.php?go=software&page=testcases

More about this case: http://www.gotm.net/pages/documentation/manual/stable/html/node237.html#nns_annual

Biogeochemical Model: NPZD (4 variables)
Advection scheme for vertical motion: TVD with ULTIMATE QUICKEST
ODE scheme for source and sink dynamics: Modified Patankar-RK (2. order, conservat., posit.)

bio_npzd.nml

I am going to play around with this file.

".value" files

This type of file gives you the list of parameters or T/F statements of your choice for the run. Can be useful to keep track of your simulation settings.

sst and sss restoring (every 3 hours with 3-D model output)

temperature and salinity resotring (whole depth, every 12 hours with 3-D model output)

dt = 1 hour

Sensitivity Analysis: Select 5 parameters.

Parameter Number.  Code Name: Default Value: Line Number in "bio_npzd.nml"

  1. I_min: 25.: L39
  2. rmax: 1.: L40
  3. gmax: 0.2: L41
  4. alpha: 1.35: L43
  5. rzd: 0.02: L49

How to rewrite a specific line using sed: http://www.linuxquestions.org/questions/programming-9/bash-replace-a-line-in-text-file-631208/#post3102926

c=1 for -5%
c=2 for +5%
c=3 for -25%
c=4 for +25%


I created a simpler script than the one I created before for PISCES:

sensitivity.sh


#---------------------------------------------------------------
for it in `seq 1 5`; #Number of cases
do
for it2 in `seq 1 4`; #Number of parameters
do

testname="p${it}c${it2}.nc" #p=parameter number, c=case number

casenum=${testname:3:1}
if [ $casenum -eq 1 ]
then
 variation="0.8"
elif [ $casenum -eq 2 ]
then
 variation="0.95"
elif [ $casenum -eq 3 ]
then
 variation="1.05"
elif [ $casenum -eq 4 ]
then
 variation="1.2"
fi

parnum=${testname:1:1}
if [ $parnum -eq 1 ]
then
 sed -i "39s/.*/  I_min=       `echo "scale=5;25.*$variation"|bc`/" bio_npzd.nml
 grep "I_min=" bio_npzd.nml >> samemo.txt
elif [ $parnum -eq 2 ]
then
 sed -i "40s/.*/  rmax=        `echo "scale=5;1.*$variation"|bc`/" bio_npzd.nml
 grep "rmax=" bio_npzd.nml >> samemo.txt
elif [ $parnum -eq 3 ]
then
 sed -i "41s/.*/  gmax=        `echo "scale=5;0.2*$variation"|bc`/" bio_npzd.nml
 grep "gmax=" bio_npzd.nml >> samemo.txt
elif [ $parnum -eq 4 ]
then
 sed -i "43s/.*/  alpha=       `echo "scale=5;1.35*$variation"|bc`/" bio_npzd.nml
 grep "alpha=" bio_npzd.nml >> samemo.txt
elif [ $parnum -eq 5 ]
then
 sed -i "49s/.*/  rzd=         `echo "scale=5;0.02*$variation"|bc`/" bio_npzd.nml
 grep "rzd=" bio_npzd.nml >> samemo.txt
fi
./rungotm
mv nns_annual.nc output/$testname
cp bio_npzd_original.nml bio_npzd.nml

done
done
#------------------------------------------------------



By producing output for each run in "samemo.txt", it helped me to check if the modifications were made in "bio_npzd.nml" appropriately.

One thing I learned from making this script: the square brackets [ ] in IF statements have to be isolated (a space before and after [ or ]).

0 件のコメント:

コメントを投稿