Changeset 2668


Ignore:
Timestamp:
Apr 21, 2022, 5:34:49 PM (3 years ago)
Author:
aslmd
Message:

Fixed floating overflow that could occur in setspi.F90

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/LMDZ.GENERIC/libf/phystd/setspi.F90

    r2283 r2668  
    158158         bpa = (b+a)/2.0D0
    159159         bma = (b-a)/2.0D0
     160         ! if (nw .eq. 25) then !LT debug
     161         !    print*, "a = ",a
     162         !    print*, "b= ",b
     163         !    print*,"bpa = ",bpa
     164         !    print*, "bma = ",bma
     165         ! endif
    160166         do nt=NTstart,NTstop
    161167            T   = dble(NT)/NTfac
    162168            ans = 0.0D0
    163 
    164169            do mm=1,12
    165170               y    = bma*x(mm)+bpa
    166                ans  = ans + w(mm)*c1/(y**5*(exp(c2/(y*T))-1.0D0))
     171               !to avoid floating overflow when T is low and optical wavelength
     172               if ((c2/(y*T)) .lt. 700.0D0) then
     173                  ans  = ans + w(mm)*c1/(y**5*(exp(c2/(y*T))-1.0D0))
     174               else
     175                  ans = ans +0.0D0
     176               endif
    167177            end do
    168 
    169178            planckir(NW,nt-NTstart+1) = ans*bma/(PI*DWNI(NW))
    170179         end do
Note: See TracChangeset for help on using the changeset viewer.