* Seismogram Synthesis Package of the Extended Reflectivity Method *
              Distribution version 1.4 (Oct 26, 2025)

        Copyright 1984,2025  K. Koketsu.  All rights reserved.            
                                                                        
        Before using this package, please read the following.      
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^       
------------------------------------------------------------------------
<Notes>

+ When you publish results produced by this, you have to refer to:

     Kohketsu. K., 1985. The extended reflectivity method for synthetic
	near-field seismograms, J. Phys. Earth, Vol.33, 121-131.

+ You are forbidden to use this for profit.

+ The author does not accept any responsibility for troubles resulting  
  from the use of this software.

+ You may distribute this to any person without modification.           
  If you would like to distribute this with modifications               
  (including partial revisions and file deletions), you have to         
  contact the author.

             author: Kazuki Koketsu                                     
                     Earthquake Research Institute                       
                     University of Tokyo                                
                     Yayoi 1-1-1, Bunkyo-ku, Tokyo 113-0032, Japan
------------------------------------------------------------------------
<files>

 README  : this file
 rz.f    : program for a point source    (double precision)
 rw.f    : program for a rectangle fault (double precision)
 machine.f90: this is necessary for rz.f and rw.f
 pplot.f : to plot obtained seismograms by using a calcomp-like library   
 rzdemo1 : sample input No.1 to `rz.f' [Fig.1/B of Kohketsu (1985)]
 rzdemo2 : sample input No.2 to `rz.f' [Fig.2/B of Kohketsu (1985)]
 rwdemo  : sample input to `rw.f'      [Fig.4/2 of Kohketsu (1985)]
 ppdemo1.in: pplot input for rzdemo1 
 ppdemo2.in: pplot input for rzdemo2
 ppdemow.in: pplot input for rwdemo 
------------------------------------------------------------------------
<installation>

1. Create an empty directory and unzip the package there.
2. gfortran -o rz rz.f machine.f90
   gfortran -o rw rw.f machine.f90
3. rz < rzdemo1 , pplot < ppdemo1.in and gv fort.8 (if you can compile pplot.f)
4. rz < rzdemo2 , pplot < ppdemo2.in and gv fort.8 (if you can compile pplot.f)
5. rw < rwdemo  , pplot < ppdemow.in and gv fort.8 (if you can compile pplot.f)
------------------------------------------------------------------------
<input parameters for `rz.f'>
 
You must specify all the parameters, but blanks can be accepted for
meaningless ones such as fault plane angles of an explosive source. 
 
Line 1       READ(5,'(5I5)') NS,IOPT,ITYP,ISRC,ICMP
NS      No. of the interface where a source exists.  The source should
	be on an interface.  If you want to burry a source in a layer,
	you can introduce a dummy interface separating layers with the
	same physical constants.
	The free surface is the interface No.0, and subsurface interfaces
	are numbered downward.
IOPT    differential/integral operation for a resultant seismogram.
                1:integral, 2:as is, 3:differential
ITYP    source type.  0:explosion, 1:double couple
ISRC    type of source time function.
        -1      Gavor's wavelet (see SEIS83.tar.Z)
        0       Herrmann's wavelet (see Herrmann 1979)
        1       ramp function with instrumental response
ICMP    components of output waveforms.
        0       three components
        1       north-south (radial if ITYP=0)
        2       east-west (tangential if ITYP=0)
        3       vertical
 
Line 2       READ(5,'(7G10.3)') AST,ADP,ASD
AST     strike angle from the north (degree, clockwise)
ADP     dip angle from the horizon (degree)
ASD     slip angle from the fault strike (degree, counterclockwise)
* See Kind (1979) and Harkrider (1976).
 
Line 3       DO 9 I=1,3; READ(5,'(7G10.3)') TC(I),HC(I),VC(I); 9 CONTINUE
TC()    natural periods of seismometer (NS, EW, V)
HC()    dumping constants of seismometer (NS, EW, V)
VC()    magnification factors of seismometer (NS, EW, V)
 
Line 4       READ(5,'(7G10.3)') SMOM
SMOM    seismic moment (dyne.cm)
 
Line 5       READ(5,'(7G10.3)') FU,FWIL,FWIR,FO
FU      lower limit of cosine-tapered frequency window (Hz)
FWIL    left corner of cosine-tapered frequency window (Hz)
FWIR    right corner of cosine-tapered frequency window (Hz)
FO      upper limit of cosine-tapered frequency window (Hz)
 
Line 6       READ(5,'(7G10.3)') ALIM,BLIM,DK
ALIM    upper limit of phase velocity window (km/s)
BLIM    lower limit of phase velocity window (km/s)
DK      step size of wavenumber integration (1/km)
 
Line 7       READ(5,'(5I5)') INDEX
INDEX   power of 2 for the sampling number along the time axis
 
Line 8       READ(5,'(7G10.3)') WI
WI      imaginary part of angular frequency (1/s)
 
Line 9       READ(5,'(7G10.3)') VRED,TI,TL
VRED    reduction velocity of travel time (km/s)
TI      reduced travel time of the initial point of waveforms (s)
TL      reduced travel time of the last point of waveforms (s)
 
Line 10      READ(5,'(7G10.3)') DT,TS,GAM,FNU
DT      time step (s)
TS      parameter of the source time function
	(this means a rise time if ISRC=1)
GAM     parameter of the source time function (meaningful if ISRC=-1)
FNU     parameter of the source time function (meaningful if ISRC=-1)
 
Line 11      READ(5,'(7G10.3)') THN(I),VP(I),VS(I),RHO(I),QP(I),QS(I)
THN()   layer thickness (km, THN=0 means the lowermost halfspace.)
VP()    P-wave velocity (km/s)
VS()    S-wave velocity (km/s)
RHO()   density (g/cm**3)
QP()    Q-value for P waves
QS()    Q-value for S waves
 
Line 12      READ(5,'(7G10.3)') R(J),AZ(J)
R()     epicentral distances of stations
	(km, up to 14 stations, ended by a negative value)
AZ()    azimuths of stations from the north (degree, clockwise)
------------------------------------------------------------------------
<input parameters for `rw.f'>
 
You must specify all the parameters.

Line 1       READ(5,'(F5.0,3I5)') DEP,IOPT,ILTR,ISRC
DEP     depth of the upper fault boundary
	(km, this need not to be located on an interface.)
IOPT    same as for rz.f
ILTR    rupture type  1:uni-lateral$B!$(B2:bi-lateral
ISRC    type of source time function.
        0       Herrmann's wavelet (see Herrmann 1979)
        1       ramp function with instrumental response
 
Line 2       READ(5,'(7G10.3)') RR,ATH,AST
RR      epicentral distance of station from the initial break point
	on the upper fault boundary (km, only one)
ATH,AST same as for rz.f
	(the fault strike should be along the upper boundary.)
 
Line 3
READ(5,'(7G10.3)') DISL,ADP,ASD
DISP    average dislocation (cm)
ADP,ASD same as for rz.f
 
Line 4       DO 12 I=1,3; 12 READ(5,510) TC(I),HC(I),VC(I)
same as for rz.f
 
Line 5       READ(5,'(7G10.3)') SL,SW,VL
SL      horizontal length of a fault
SW      fault length in the direction perpendicular to SL
VL      rupture velocity
 
Line 6       READ(5,'(5I5)') NL,NW
NL      number of subfaults along the SL direction
NW      number of subfaults along the SW direction
 
Line 7       READ(5,'(7G10.3)') FU,FO
FU      lower limit of frequency window (Hz)
FO      upper limit of frequency window (Hz)
	(no taper is applied.)
 
Line 8       READ(5,'(7G10.3)') ALIM,BLIM,DK
Line 9       READ(5,'(5I5)') INDEX
Line 10      READ(5,'(7G10.3)') WI
Line 11      READ(5,'(7G10.3)') VRED,TI,TL
Line 12      READ(5,'(7G10.3)') DT,TS
Line 13      READ(5,'(7G10.3)') THN(I),VP(I),VS(I),RHO(I),QP(I),QS(I)
same as for rz.f

------------------------------------------------------------------------
<hints>

+ All the floating variables are declared to have double precision,
  so that the -r8 option for compilation is not necessary now.

+ Computational overflows may happen, when a seismic wave of high
  frequency passes through a thick, slow layer.  If so and you cannot
  change the frequency and phase velocity ranges, please divide the
  layer into several having the same physical parameters.
 
+ Waveforms are sensitive to frequency window (FU - FO), phase velocity
  window (ALIM - BLIM), step size of FFT (1/(DT*2**INDEX)) and step size
  of wavenumber integration (DK).
  FU - FO and ALIM - BLIM should be wide enough to cover a seismogram
  spectrum.  Unless the FFT step is fine enough (INDEX is large enough),
  or DK is small enough, aliasing or ripples may happen.  However, too
  wide ranges lead to a long computation time.  Since their optimum
  values depend on medium and source parameters, and there is no way
  to find out them, please determine them by referring to the sample
  inputs.

+ WI avoids surface wave poles along the wavenumber integration path,
  and can depress aliasing, but too large WI may cause other numerical
  noises.  Please refer to the sample inputs again.

+ For checking whether resultant waveforms include numerical noises,
  please slightly modify the parameters, recalculate waveforms and
  compare them with the previous ones.

+ You can specify only one station for `rw.f'.  That always produce
  three components of seismogram.

+ `rw.f' distribute point sources on the fault plane, and sum up
  waveforms calculated by the identical method to `rz.f'.  So NL
  and NW should be large enough.

+ Waveforms by `rw.f' often include large long-period noises at their
  later parts.  You can remedy them by adjusting BLIM, DK, or WI, but
  the adjustment may break down due to a very long computation time.
  This is the reason for the sudden cut of seismograms in Figs 3 and 4
  of Kohketsu (1985).

------------------------------------------------------------------------
<outputs>

`rz.f' as well as `rw.f' write outputs on the file No.10.
 
Line 1       WRITE(10,'(2G12.5)') DT,VRED
DT,VRED same as the input parameters
 
Line 2       WRITE(10,'(5I5)') NNC
NNC     number of waveforms
 
Line 3       WRITE(10,'(6F12.7)) R(KR),T(KR)
R       epicentral distance
T       absolute time of the initial point (s, TI+R/VRED)
 
Line 4       WRITE(10,'(5I5)') NDR
NDR     number of sampling points ((TL-TI)/DT + 1)
 
Line 5       WRITE(10,'(E15.7)') AMAX
 AMAX   maximum amplitude (cm, cm/s, cm/s**2)
 
Line 6-      WRITE(10,'(6F12.7)') (AMW(I),I=1,NDR)
AMW()   waveforms normalized by AMAX
 
(The lines 3 to 6- repeat NNC times.)

------------------------------------------------------------------------
<pplot.f>

This reads the above outputs and plots waveforms.  This is written
using a CALCOMP-like library, but we may have rewrite the parts of
initialization and termination.

------------------------------------------------------------------------
<samples>
 
`rzdemo1, 2' are sample input parameters for producing Figs.1/B and
2/B in Kohketsu (1985).  `rwdemo' is for Fig.4/2.  You can see
generated waveforms by a procedure such as
	  rz < rzdemo1
	  pplot < ppdemo1.in
	  lpr fort.8 or gs fort.8
The computation with `rzdemo1' consumes 15 seconds on a Hitachi M-280H,
but that with `rwdemo' takes 15 minutes(!).  Although I can actually
make `rw.f' faster, this should lead to worse readability so that I
have not yet done it.

------------------------------------------------------------------------
Acknowledgements

Yoshiko Yamanaka found a problem in the caluculation of the Bessel
functions on SUN workstations.  Hitosi Kawakatsu found a bug in
explosion seismograms. besj0, besj1, and their related subroutines at
the Netlib are included with machine.f90 at Florida State University.

------------------------------------------------------------------------
References

Herrmann, R. B., 1979. SH-wave generation by dislocation sources,
a numerical study, Bull. Seismol. Soc. Am., Vol.69, 1-15.
 
Harkrider, D. G., 1976. Potentials and displacements from two theoretical
seismic sources, Geophys. J. R. Astron. Soc., Vol.47, 97-133.
 
Kind, R., 1979. Extensions of the reflectivity method,
J. Geophys., Vol.45, 373-380.
 
Kohketsu, K., 1985. The extended reflectivity method for synthetic
near-field seismograms, J. Phys. Earth, Vol.33, 121-131.


					Sep 10, 1988  K. Koketsu
					Jun 09, 1992  K. Koketsu
					Jul 30, 1992  K. Koketsu
					Aug 26, 1992  K. Koketsu
					May 11, 1994  K. Koketsu
					Jun 15, 1994  K. Koketsu
					Jun 29, 1999  K. Koketsu
					Oct 26, 2025  K. Koketsu
