# Shell script for invoking FDTD simulations # Michael Kelzenberg, 2010 (c) # California Institute of Technology # This script executes the .sh file generated by the prior Lumerical CAD step # then parses the output to ensure that the simulation ran to completion. #setdep @previous@ # TCL code in our tooldb file now takes care of setting the execut bit for # Lumerical's MPI shell scripts, so the following is not needed here: # chmod 755 *.sh echo "*******************************************************************************" echo "Shell script for running Lumerical FDTD simulations" echo "Michael Kelzenberg, 2010" echo "" echo "Warning! Using 'Abort' in SWB will NOT terminate MPI FDTD simulations." echo "You must manually kill each process." echo "" echo "*******************************************************************************" ./n@node|lumcad@_lumstr.sh echo "" echo "*******************************************************************************" echo "FDTD complete." echo "*******************************************************************************" echo "Last 20 lines of simulation log file:" echo "" tail -n 20 n@node|lumcad@_lumstr_p0.log echo "" echo "*******************************************************************************" if ( { grep -q "Simulation completed successfully" n@node|lumcad@_lumstr_p0.log } ) then if ( { grep -q "the autoshutoff criteria are satisfied" n@node|lumcad@_lumstr_p0.log } ) then echo "Auto-shuttoff criteria were reached. Simulation complete." echo -n "************************************************************************" echo "*******" exit 0 else echo "ERROR: The auto-shutoff criteria were not reached. Simulation is incomplete." echo "This typically means that simulation results are invalid. This node has been" echo "marked as FAILED to prevent unintentional use of these simulation results." echo "" echo "If these results are indeed correct, this error check can be disabled within " echo "the shell script for this tool." endif else echo "ERROR: The simulation does not appear to have finished successfully. " echo "Please check the log file for more information." endif echo "*******************************************************************************" exit 1