0
-
Source:beampattern.f90
0
-
Graph:beampattern.gcno
0
-
Data:beampattern.gcda
1
-
!! Source beam pattern loading and processing
4
-
!! Source beam pattern handling including loading, interpolation, and angular weighting
13
-
INTEGER, PARAMETER :: SBPFile = 50
14
-
INTEGER :: NSBPPts ! Number of source beam-pattern points
15
-
REAL (KIND=8), ALLOCATABLE :: SrcBmPat( :, : )
16
-
CHARACTER (LEN=1) :: SBPFlag ! '*' or 'O' to indicate a directional or omni pattern
20
14*
SUBROUTINE ReadPat( FileRoot, PRTFile )
21
-
!! Reads a source beam pattern file (`.sbp`) based on `FileRoot``.
22
-
!! Reports status messages to the print/log file connected to `PRTFile``.
27
-
CHARACTER (LEN=80), INTENT( IN ) :: FileRoot
28
-
!! Source beampattern filename *without* `.sbp` extension
29
-
INTEGER, INTENT( IN ) :: PRTFile
30
-
!! I/O Unit for print file
33
-
INTEGER :: I, IAllocStat, IOStat
35
14
IF ( SBPFlag == '*' ) THEN
36
#####
WRITE( PRTFile, * )
37
#####
WRITE( PRTFile, * ) '______________________________'
38
#####
WRITE( PRTFile, * ) 'Using source beam pattern file'
40
#####
OPEN( UNIT = SBPFile, FILE = TRIM( FileRoot ) // '.sbp', STATUS = 'OLD', IOSTAT = IOStat, ACTION = 'READ' )
41
#####
IF ( IOstat /= 0 ) THEN
42
#####
WRITE( PRTFile, * ) 'SBPFile = ', TRIM( FileRoot ) // '.sbp'
43
#####
CALL ERROUT( 'BELLHOP-ReadPat', 'Unable to open source beampattern file' )
46
#####
READ( SBPFile, * ) NSBPPts
47
#####
WRITE( PRTFile, * ) 'Number of source beam pattern points', NSBPPts
49
#####
ALLOCATE( SrcBmPat( NSBPPts, 2 ), Stat = IAllocStat )
50
#####
IF ( IAllocStat /= 0 ) &
51
#####
CALL ERROUT( 'BELLHOP-ReadPat', 'Insufficient memory for source beam pattern data: reduce # SBP points' )
53
#####
WRITE( PRTFile, * )
54
#####
WRITE( PRTFile, * ) ' Angle (degrees) Power (dB)'
56
#####
DO I = 1, NSBPPts
57
#####
READ( SBPFile, * ) SrcBmPat( I, : )
58
#####
WRITE( PRTFile, FMT = "( 2G11.3 )" ) SrcBmPat( I, : )
61
-
ELSE ! no pattern given, use omni source pattern
63
14*
ALLOCATE( SrcBmPat( 2, 2 ), Stat = IAllocStat )
64
14*
IF ( IAllocStat /= 0 ) CALL ERROUT( 'BELLHOP-ReadPat', 'Insufficient memory' )
65
42*
SrcBmPat( 1, : ) = [ -180.0, 0.0 ]
66
42*
SrcBmPat( 2, : ) = [ 180.0, 0.0 ]
69
14*
IF ( .NOT. monotonic( SrcBmPat( :, 1 ) , NSBPPts ) ) &
70
#####
CALL ERROUT( 'beampattern : ReadPat', 'Source beam-pattern angles are not monotonic' )
72
42*
SrcBmPat( :, 2 ) = 10 ** ( SrcBmPat( :, 2 ) / 20 ) ! convert dB to linear scale
74
14
END SUBROUTINE ReadPat
76
-
END MODULE beampattern