#!/bin/bash # makeRepSaefcalc2 vers. 0.9 local (in this folder) command script to # help user transform the outputfile into an html/pdf report. # Usage: ./makeRepSaefcalc2 saefcalc2outputfile # Programs also needed: gnuplopt, delete1arg, htmldoc # Copyright (C) 2013 Al Conle # This file is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the license, or (at # your option) any later version. # This file is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTA- # BILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public # License for more details. # You should have received a copy of the GNU General PUblic License along # with this program; if not, write to the Free Software Foundation, Inc., # 59 Temple Place -Suite 330, Boston, MA 02111-1307, USA. Try also their # web site: http://www.gnu.org/copyleft/gpl.html HTML=tempHTML$$ TMP2=/tmp/temp222.$$ #dadn=temp.dadn # Start writing the html page............................... #echo Content-type: text/html >$HTML echo >$HTML echo "" >>$HTML echo "Results for $1 : Crack Initiation Using saefcalc2 " >>$HTML echo "">>$HTML echo "" >>$HTML echo "

Results for $1 : Crack Initiation Using saefcalc2

" >>$HTML echo "Author: userNameHere
" >>$HTML echo "Affiliation: where

" >>$HTML date >>$HTML echo "

" >>$HTML grep \#version\= $1 >$TMP2 # expecting: #version= 1.9 saefcalc2.f read <$TMP2 item1 item2 item3 LEFTOVER echo "$item3 vers.= $item2
" >>$HTML echo "Preparing input data summary for html page ..." echo "

Simulation input data:
" >>$HTML grep \#matfile\= $1 | head -1 >$TMP2 read <$TMP2 item1 materialFile LEFTOVER echo "Material file= $materialFile
" >>$HTML grep ^\#multfactor\= $1 >$TMP2 read <$TMP2 item1 item2 LEFTOVER #echo "ri= $item2 mm
" >>$HTML echo "Multiplication Factor= $item2
" >>$HTML # Ok, we have a potential material file in matfile echo "

Crack Initiation Life Results for $1

" >>$HTML echo "
"                                   >>$HTML
       grep \#xcalc2 <$1  | ./delete1arg                 >>$HTML
       echo "
" >>$HTML echo "Predicted History Repetitions to Initiation:" >>$HTML echo "
"                                     >>$HTML
       grep \#xcalc3 <$1  | ./delete1arg      >>$HTML
       echo "
" >>$HTML # fetch the hysteresis loops for plotting echo "" >>$HTML echo "

Local Stress and Strain Response:

" >>$HTML grep -i \#plotloops $1 | ./delete1arg >temp5 # create the gnuplot load file echo "set term pngcairo font \"Arial,10\"" >loadgp5 echo "set grid" >>loadgp5 echo "set output \"$1ss.png\" " >>loadgp5 echo "set xlabel \"Strain\" " >>loadgp5 echo "set ylabel \"Stress, MPa\" " >>loadgp5 echo "plot \"temp5\" w lp" >>loadgp5 gnuplot "loadgp5" echo "


" >>$HTML #Fetch boxed cumulative cycle plot and damage plot data echo "" >>$HTML echo "

Cumulative Cycle Plot of History and Damage:

" >>$HTML grep -i \#plothist $1 | ./delete1arg >temp6 grep -i \#plotdam $1 | ./delete1arg >temp7 # create the gnuplot load file, re-use $TMP3 echo "set term pngcairo font \"Arial,12\"" >loadgp6 echo "set output \"$1.damage.png\" " >> loadgp6 echo "set logscale x " >> loadgp6 echo "set xlabel \"Cumulative Cycles\" " >> loadgp6 echo "set xrange [0.1:*] " >> loadgp6 echo "set ylabel \"Nominal Stress, MPa\" " >> loadgp6 echo "set y2label \"% Damage\" " >> loadgp6 echo "set y2label \"% Damage\" " >> loadgp6 echo "set y2range [0.:100.] " >> loadgp6 echo "set format y2 \"%f\" " >> loadgp6 echo "plot \"temp6\" title \"History\" w lp, \"temp7\" axes x1y2 title \"SWaT\" w lp, \"temp7\" u 1:3 axes x1y2 title \"Morrow\" w lp" >> loadgp6 gnuplot "loadgp6" echo "

" >>$HTML echo "
" >>$HTML echo "(Rectangles are Rainflow Cycle Sets: Sorted by Range: largest on Left)" >>$HTML echo "" >>$HTML echo "

Appendix 1: Rainflow Cycles

" >>$HTML echo "
"                        >>$HTML
    grep \#Inputs\= $1 | ./delete1arg   >>$HTML
    echo "
" >>$HTML echo "

Appendix 2: Stress-Strain-Init.Life file: \"$materialFile\"

" >>$HTML echo "
"                        >>$HTML
    cat $materialFile                   >>$HTML
    echo "
" >>$HTML echo "" >>$HTML rm $TMP2 echo "Deleting temporary files: loadgp5,6 temp5,6" rm loadgp5 loadgp6 rm temp5 temp6 temp7 mv $HTML $1.html echo "Done. html file is: $1.html Making pdf ..." echo "htmldoc --webpage --footer ..1 -f $1.pdf $1.html" htmldoc --webpage --footer ..1 -f $1.pdf $1.html echo "Done. In Linux you can view pdf with command: " echo " evince $1.pdf" exit