C makeHist.f prog to converte M.Luke's data to individual peaks. Jan9 2013
C compile: gfortran -g makeHist.f -o makeHist
C Usage: makeHist multFactor output
C multFactor is a multiplier on T1 to get stress.
C Reference: M.Luk, I.Varfolomeev, K.Lütkepohl, A.Esderts, "Fracture mechanics
C assessment of railway axles: Experimental characterization and computation,"
C Engineering Failure Analysis 17 (2010) 617–623
C Copyright (C) 2013 Al Conle
C This file is free software; you can redistribute it and/or modify
C it under the terms of the GNU General Public License as published by
C the Free Software Foundation; either version 2 of the license, or (at
C your option) any later version.
C This file is distributed in the hope that it will be useful, but
C WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTA-
C BILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
C License for more details.
C You should have received a copy of the GNU General PUblic License along
C with this program; if not, write to the Free Software Foundation, Inc.,
C 59 Temple Place -Suite 330, Boston, MA 02111-1307, USA. Try also their
C web site: http://www.gnu.org/copyleft/gpl.html
C INPUT FILE FORMAT
C Luke's data format is :
C No. Fac. Cum. T1 T2 T3
C 200 1 200 24 28.8 14.4
C 100 1.2 300 28.8 34.56 17.28
C 200 1 500 24 28.8 14.4
C 100 1.7 600 40.8 48.96 24.48
C 200 1 800 24 28.8 14.4
C 100 1.2 900 28.8 34.56 17.28
C 200 1 1100 24 28.8 14.4
C 100 1.7 1200 40.8 48.96 24.48
C 200 1 1400 24 28.8 14.4
C ...etc
C where No. is the number of cycles
C Fac. is the multiplying factor for that sub-block's Tx value
C The factors are: 1.0 1.2 1.7 2.2 and 2.8
C Cum is the cummulative sum of cycles to end of this sub-block
C Tx is test no. 1 max.; Tx*(-1.0) = min of cycle
C T1 is test 1, T2 is test 3, T3 is test3
C Tx values are in kN for applied test load.
C It is assumed that each sub-block begins with a tensile peak, although for
C a rotating bending test, the other side of the shaft starts with comp. peak.
C Note that further calculations are required to compute stresses. See the
C reference above for details.
C OUTPUT FILE FORMAT
C Pt.No. Pm Pb irep
C Pm = membrane stress mpa
C Pb = bending stress mpa
C irep = future repeat factor = 1 for now.
integer idimen/300/ ! the dimension of char vector inpone()
character*300 inp300 ! used to read in lines as chars.
character*1 inpone(300)
character*10 inpten(30)
equivalence (inpone(1), inpten(1), inp300)
character*80 argv
integer*4 iargc,nargc
write(0,100)
write(6,100)
100 format("# makeHist.f vers 1.0 starts..."/
& "# Usage e.g.: makeHist.f 10.0 outfile")
nargc = iargc()
C Note that in HP fortran the arg numbers must be changed by -1
C and that iargc probably includes the "decimate" as an arg.
if( nargc .ne. 1)then
write(0,*)" makeHist.f : usage ERROR"
write(0,*)"# Usage e.g.: makeHist 10.0 outfile"
write(6,*)" makeHist.f : usage ERROR"
write(6,*)"# Usage e.g.: makeHist 10.0 outfile"
stop
endif
C The first arg is the multiplier factor to get stress
jvect=1
call getarg(jvect,argv)
read(argv,*,err= 178)xmultFactor
write(6,*)"#multFactor= ",xmultFactor
go to 180
C Bad arguments in command line
178 write(0,*)"# ERROR: bad multiply factor argument=",argv
write(0,*)"# Usage e.g.: makeHist 10.0 outfile"
stop
180 continue ! ok, mult factor has been read in ok.
ninput=0
npeaktot=0
itag=1
xPm=0.0 ! in the case of M.Luke et al history
500 continue ! Loop here for next input line
read(5,"(a300)",end=9000)inp300
ninput=ninput+1
C Check for blank line
if(inp300.eq." ")then
C write(6,"(a1)")" "
go to 500
endif
C Check for a comment line
if(inpone(1).eq."#")go to 500
C We may have a data line, or someone screwed up and put the # later in line.
C but we are not checking for later in line.
C Assume this is a data line
read(inp300,*)nrepeat,factor,isum,Ptest1,Ptest2,Ptest3
do 600 i=1,nrepeat
xPb=Ptest1 * xmultFactor
npeaktot=npeaktot+1
write(6,610)npeaktot,xPm,xPb,itag
610 format(i8,1x,f6.1,1x,f6.1,1x,i3)
npeaktot=npeaktot+1
xPb= -xPb
write(6,610)npeaktot,xPm,xPb,itag
600 continue
800 continue ! this sub-block is done
go to 500
9000 continue ! end of history encountered
write(0,9010)isum,npeaktot
9010 format("#Done. Found tot. Cycles in History= ",i10/
& "# Generated ",i10," peak/valley points.")
stop
end