Main wrapper for the radiation model. Reads the coefficient file and calls the low-level routine.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(trm_type), | intent(inout) | :: | me | |||
real(kind=wp), | intent(in) | :: | e | |||
real(kind=wp), | intent(in) | :: | l | |||
real(kind=wp), | intent(in) | :: | bb0 | |||
integer, | intent(in) | :: | imname |
which model to load (index in |
||
real(kind=wp), | intent(out) | :: | flux |
subroutine aep8(me, e, l, bb0, imname, flux) class(trm_type), intent(inout) :: me real(wp), intent(in) :: e real(wp), intent(in) :: l real(wp), intent(in) :: bb0 integer, intent(in) :: imname !! which model to load (index in `mname` array) real(wp), intent(out) :: flux real(wp) :: ee(1), f(1) !! temp variables integer :: i, ierr, iuaeap, nmap character(len=:), allocatable :: name logical :: load_file name = me%get_data_file_dir()//trim(mname(Imname)) ! the file to load ! JW : do we need to reset some or all of these ? me%fistep = 0.0_wp me%f1 = 1.001_wp me%f2 = 1.002_wp ! check to see if this file has already been loaded ! [the class can store one file at a time] load_file = .true. if (allocated(me%file_loaded)) then if (name == me%file_loaded) load_file = .false. end if if (load_file) then open (newunit=iuaeap, file=name, status='OLD', iostat=ierr, form='FORMATTED') if (ierr /= 0) then error stop 'error reading '//trim(name) end if read (iuaeap, '(1X,12I6)') me%ihead nmap = me%ihead(8) allocate (me%map(nmap)) read (iuaeap, '(1X,12I6)') (me%map(i), i=1, nmap) close (iuaeap) me%file_loaded = trim(name) end if ee(1) = e call me%trara1(me%ihead, me%map, L, Bb0, ee, f, 1) flux = f(1) if (Flux > 0.0_wp) Flux = 10.0_wp**Flux end subroutine aep8