I ended up rewriting the script (sensitivityanalysis.sh) to resolve the precision errors involving floats with ACEnet clusters' Bash. It is probably better to avoid using decimals in Bash. I have adjusted the script and namelist_pisces accordingly (see the notes on the script for details).
Here is my script and it should be the final version:
# Sensitivity Analysis of PISCES model parameters
# INSTRUCTIONS
#
# The value before the exponent (E) in namelist_pisces for all PISCES parameters has to be an integer. If it involves a number after the decimal place, you have to rewrite it using E. This is to avoid floating precision errors involved in Bash.
# For Example, If a1 = 0.034E-5, rewrite it as a1 = 34.E-7. If a2 = 99.9, rewrite it as a2 = 999.E-1. etc...
#
#END of INSTRUCTIONS
# Start of Input. Modify below #
# set of names of parameters to analyze.
set_parnam="wsbio xkmort ferat3 wsbio2 conc0 conc1 conc2 conc2m conc3 conc3m xsizedia xsizephy concnnh4 concdnh4 xksi1 xksi2 xkdoc concfebac qnfelim qdfelim caco3r pislope pislope2 excret excret2 bresp chlcnm chlcdm chlcmin fecnm fecdm grosip wchl wchld mprat mprat2 mpratm part2 grazrat2 resrat2 mzrat2 xprefc xprefp xprefz xprefpoc xthresh2zoo xthresh2dia xthresh2phy xthresh2poc xthresh2 xkgraz2 epsher2 sigma2 unass2 grazflux part grazrat resrat mzrat xpref2c xpref2p xpref2d xthreshdia xthreshphy xthreshpoc xthresh xkgraz epsher sigma1 unass xremik xremip nitrif xsirem xsiremlab xsilab xlam1 oxymin ligand kdca nca"
# set of the corresponding values to the above set (excluding exponents (E) if there are any).
set_stdval="2. 2. 10. 30. 1. 8. 1. 3. 3. 8. 1. 1. 1. 8. 2. 333. 417. 1. 7. 7. 16. 2. 2. 5. 5. 333. 33. 5. 33. 40. 40. 151. 1. 2. 1. 1. 1. 75. 7. 5. 3. 1. 3. 1. 3. 1. 1. 1. 1. 2. 20. 3. 6. 3. 2. 5. 3. 3. 1. 1. 1. 5. 1. 1. 1. 2. 20. 3. 6. 3. 25. 25. 5. 3. 25. 31. 5. 1. 6. 6. 1."
# End of Input. Do NOT modify below #
parnam=($set_parnam)
stdval=($set_stdval)
count=${#parnam[@]}
floats=1 # Number of float precision
for it in `seq 1 $count`
do
para=0
echo $para >> SA_stat.txt
grep "${parnam[$it-1]} " namelist_pisces >> SA_stat.txt
for newnum in $(seq `echo "scale=${floats};${stdval[$it-1]}/2" | bc` `echo "scales=${floats};${stdval[$it-1]}/10" | bc` `echo "scales=${floats};${stdval[$it-1]}/2+${stdval[$it-1]}" | bc`)
do
sed -i -r "s/${parnam[$it-1]}\s+=\s+[0-9]+\.*[0-9]*/${parnam[$it-1]} = ${newnum}/" namelist_pisces
./opa
para=$((${para}+1))
echo $para >> SA_stat.txt
grep "${parnam[$it-1]} " namelist_pisces >> SA_stat.txt
mv LABSEA_1m*_ptrc_T.nc ../MY_SRC/SA/${parnam[$it-1]}${para}.nc
rm LABSEA_*restart*.nc
done
echo "end of run for ${parnam[$it-1]}" >> SA_stat.txt
sed -i -r "s/${parnam[$it-1]} += +[0-9]+\.*[0-9]*/${parnam[$it-1]} = ${stdval[$it-1]}/" namelist_pisces
このスクリプトはquequeで走らせるのではなくhead nodeで走らせないと10倍の時間がかかる。1Dの場合head nodeで走らせたとしても20%ぐらいのCPUしか使用されないので
nohup sensitivityanalysis.sh > SA.out
というふうにすることに。
またいつか使うときが来るといいけど。
0 件のコメント:
コメントを投稿