WriteArrivalsASCII Subroutine

public subroutine WriteArrivalsASCII(r, Nrd, Nr, SourceType)

Writes arrival data in ASCII format

Arguments

Type IntentOptional Attributes Name
real, intent(in) :: r(Nr)
integer, intent(in) :: Nrd
integer, intent(in) :: Nr
character(len=1), intent(in) :: SourceType

Calls

proc~~writearrivalsascii~~CallsGraph proc~writearrivalsascii WriteArrivalsASCII sngl sngl proc~writearrivalsascii->sngl

Called by

proc~~writearrivalsascii~~CalledByGraph proc~writearrivalsascii WriteArrivalsASCII proc~bellhopcore~2 BellhopCore proc~bellhopcore~2->proc~writearrivalsascii program~bellhop BELLHOP program~bellhop->proc~bellhopcore~2

Source Code

  SUBROUTINE WriteArrivalsASCII( r, Nrd, Nr, SourceType )
!! Writes arrival data in ASCII format

    ! Writes the arrival data (Amplitude, delay for each eigenray)
    ! ASCII output file

    INTEGER,           INTENT( IN ) :: Nrd, Nr
    REAL,              INTENT( IN ) :: r( Nr )
    CHARACTER (LEN=1), INTENT( IN ) :: SourceType
    INTEGER           :: ir, id, iArr

    WRITE( ARRFile, * ) MAXVAL( NArr( 1 : Nrd, 1 : Nr ) )

    DO id = 1, Nrd
       DO ir = 1, Nr
          IF ( SourceType == 'X' ) THEN   ! line source
             factor =  4.0 * SQRT( pi )
          ELSE                            ! point source
             IF ( r ( ir ) == 0 ) THEN
                factor = 1e5                   ! avoid /0 at origin
             ELSE
                factor = 1. / SQRT( ABS( r( ir ) ) )  ! cyl. spreading [CF] ABS() used to eliminate NaN for -ve range values
             END IF
          END IF

          WRITE( ARRFile, * ) NArr( id, ir )
          DO iArr = 1, NArr( id, ir )
             ! You can compress the output file a lot by putting in an explicit format statement here ...
             ! However, you'll need to make sure you keep adequate precision
             WRITE( ARRFile, * ) &
                     factor * Arr( id, ir, iArr )%A,             &
             SNGL( RadDeg ) * Arr( id, ir, iArr )%Phase,         &
                        REAL( Arr( id, ir, iArr )%delay ),       &
                       AIMAG( Arr( id, ir, iArr )%delay ),       &
                              Arr( id, ir, iArr )%SrcDeclAngle,  &
                              Arr( id, ir, iArr )%RcvrDeclAngle, &
                              Arr( id, ir, iArr )%NTopBnc,       &
                              Arr( id, ir, iArr )%NBotBnc
          END DO  ! next arrival
       END DO  ! next receiver depth
    END DO  ! next receiver range

    RETURN
  END SUBROUTINE WriteArrivalsASCII