diff --git a/chem/module_optical_averaging.F b/chem/module_optical_averaging.F index 773b7bdcaf..5b7403b77f 100644 --- a/chem/module_optical_averaging.F +++ b/chem/module_optical_averaging.F @@ -4695,6 +4695,24 @@ subroutine mieaer( & endif !ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc +! check for refr and refi outside of lookup table range to prevent unstable extrapolation 'binterp' below + if (refr < refrtabsw(1,ns)) then + refr = refrtabsw(1,ns) + write(*,*), 'Warning: refr is smaller than lookup table range and reset to minimum bound at SW band ', ns + endif + if (refr > refrtabsw(prefr,ns)) then + refr = refrtabsw(prefr,ns) + write(*,*), 'Warning: refr is larger than lookup table range and reset to maximum bound at SW band ', ns + endif + if (refi < refitabsw(1,ns)) then + refi = refitabsw(1,ns) + write(*,*), 'Warning: refi is smaller than lookup table range and reset to minimum bound at SW band ', ns + endif + if (refi > refitabsw(prefi,ns)) then + refi = refitabsw(prefi,ns) + write(*,*), 'Warning: refi is larger than lookup table range and reset to maximum bound at SW band ', ns + endif + ! interpolate coefficients linear in refractive index ! first call calcs itab,jtab,ttab,utab itab=0 @@ -4952,6 +4970,24 @@ subroutine mieaer( & endif !ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc +! check for refr and refi outside of lookup table range to prevent unstable extrapolation 'binterp' below + if (refr < refrtablw(1,ns)) then + refr = refrtablw(1,ns) + write(*,*), 'Warning: refr is smaller than lookup table range and reset to minimum bound at LW band ', ns + endif + if (refr > refrtablw(prefr,ns)) then + refr = refrtablw(prefr,ns) + write(*,*), 'Warning: refr is larger than lookup table range and reset to maximum bound at LW band ', ns + endif + if (refi < refitablw(1,ns)) then + refi = refitablw(1,ns) + write(*,*), 'Warning: refi is smaller than lookup table range and reset to minimum bound at LW band ', ns + endif + if (refi > refitablw(prefi,ns)) then + refi = refitablw(prefi,ns) + write(*,*), 'Warning: refi is larger than lookup table range and reset to maximum bound at LW band ', ns + endif + ! interpolate coefficients linear in refractive index ! first call calcs itab,jtab,ttab,utab itab=0