#!/bin/bash # # Purpose: # Calls the following shell scripts: # iter_c2r.com # make_greenfct_segs.com # prep_load_grd.com # Calls the following programs: # flex2dc (F77) # grd_interp (C) # FITPROG (F90) if (( "$#" != 2 )); then echo "Usage: run_trench_region.com [# of iterations] [parameter file]" exit fi COUNTER=0 let NITER=$1 echo $NITER PARFILE=$2 source $PARFILE wc -l ${TOPODAT}.dat > topotmp read NUMBT TOPOFNAME < topotmp rm topotmp wc -l ${GRAVDAT}.dat > gravtmp read NUMGR GRAVFNAME < gravtmp rm gravtmp wc -l $SEGLIST > tsegtmp read NUMTS SEGFNAME < tsegtmp rm tsegtmp echo "Solver: $FITPROG" echo "Test: $NUMBT $NUMGR $NUMTS" # housekeeping rm gmg* gvg* gmb* gvb* gg* gb* gvcurv* gmcurv* fz_inv* te_inv* w_inv* curv_inv* topo*.fnct grav*fnct rigid_inv* vseg*dat mseg*dat moment_inv* yld_inv* make_greenfct_segs.com $SEGLIST $WLON $SLAT $RIGINIT 0 ${TOPODAT}.dat ${GRAVDAT}.dat $BMOSCALE $VLDSCALE while [ $COUNTER -lt $NITER ]; do cp $RIGINIT rigid_prev.grd if [ "$COUNTER" > 1 ] ; then cp rigid_inv${COUNTER}_xy.grd rigid_prev.grd else cp $RIGINIT rigid_prev.grd fi rm w_inv${COUNTER}_xy.grd curv_inv${COUNTER}_xy.grd grav_inv${COUNTER}_xy.grd rigid_inv${COUNTER}_xy.grd moment_inv${COUNTER}_xy.grd yld_inv${COUNTER}_xy.grd let COUNTER=COUNTER+1 echo "Parameter Estimation Iteration - $COUNTER" ls gg_seg*_iter${COUNTER}.dat > grav${COUNTER}.fnct ls gb_seg*_iter${COUNTER}.dat > topo${COUNTER}.fnct echo "$COUNTER: Estimating values for bending moment and vertical load" $FITPROG ${TOPODAT}.dat topo${COUNTER}.fnct $TOPOWGT ${GRAVDAT}.dat grav${COUNTER}.fnct $GRAVWGT $NUMBT $NUMGR $NUMTS $SMPARM $SMPARV prep_load_grd.com $COUNTER $LOADFAC lq.dat $SEGLIST # # clean up files made by Green's functions routines # rm g*_seg*_iter${COUNTER}.dat rm gm*_seg*_iter${COUNTER}.* gv*_seg*_iter${COUNTER}.* rm grav${COUNTER}.fnct topo${COUNTER}.fnct # cp lq.dat lq_${COUNTER}.dat # insert clumsy if statement checking for lq differences if [ "$COUNTER" > 2 ]; then paste lq_prev.dat lq_${COUNTER}.dat > comp_${COUNTER}.dat awk '{print $1,$4-$2}' comp_${COUNTER}.dat > diff_${COUNTER}.dat fi cp lq_${COUNTER}.dat lq_prev.dat # cp misfit.dat misfit_${COUNTER}.dat more misfit_${COUNTER}.dat echo "$COUNTER: Solving for new curvature and deflection grids" iter_c2r.com $ITERSOL fz_inv${COUNTER}_xy.grd rigid_prev.grd $RIGLUP $MOMLUP $YLDLUP $AGEGRD $COUNTER rm rigid_prev.grd # iter_c2r.com $ITERSOL fz_inv${COUNTER}_xy.grd $RIGINIT $RIGLUP $MOMLUP $YLDLUP $AGEGRD $COUNTER make_greenfct_segs.com $SEGLIST $WLON $SLAT rigid_inv${COUNTER}_xy.grd $COUNTER ${TOPODAT}.dat ${GRAVDAT}.dat $BMOSCALE $VLDSCALE # # clean up files made by curvature-rigidity routines # done