Scripting spparks¶
Simple Example¶
Evaluate temperature effects
Grain growth rate
Grain size distributions
#!/bin/bash STEPS="1 2 3 4 5 6 7 8 9 10 11 12" # Temperature is too high for modeling grain growth # Result with T=1.0 shows a significant number of 'single-site' grains T=""1.0000"" # Range of validity for the potts model T=""0.050" "0.250" "0.500"" T=""1.0000"" let N=1024 let Q=N*N PREFIX=grain_growth NP=4 SPPARKS=spk_flame.gnu dump(){ dir=$1 in_file=$2 out_file=$3 for s in $STEPS; do in=$dir/$in_file if [ -f $in ]; then out=$dir/$out_file.$s com="../dump_clusters.py -i ${in} -o ${out} -s ${s}" python $com else echo Uh oh! FILE "'${in}'" NOT FOUND. exit 1 fi done } run_cases(){ echo cases: $T for kT in $T; do dir=N.$N.kT=$kT echo running case: $dir # delete existing run dir if [ -d $dir ]; then rm -rf $dir fi # make new run directory mkdir $dir inp=$PREFIX.in cp $inp $dir/ cd $dir # run spparks exe="mpiexec -np ${NP} ${SPPARKS}" com="-var N ${N} -var Q ${Q} -var kT ${kT}" echo RUNNING: $exe $com \< $inp 2>&1 run.log # send stdout and stderr to 'run.log' ${exe} ${com} < ${inp} >> run.log 2>&1 # run script which computes and write clusters dump_file=$PREFIX.dump cluster_file=$PREFIX.grains dump ./ $dump_file $cluster_file ## run script converting output files to vti spk2vti $dump_file; # write 'clusters' cd .. done } run_cases