Back to home page

darwin3

 
 

    


File indexing completed on 2024-12-17 18:38:02 UTC

view on githubraw file Latest commit 0222db53 on 2024-01-18 18:39:39 UTC
b55e95f1ff Oliv*0001 #include "RADTRANS_OPTIONS.h"
                0002 #include "EXF_OPTIONS.h"
                0003 
                0004 CBOP
                0005 C !ROUTINE: RADTRANS_READPARMS
                0006 
                0007 C !INTERFACE: ==========================================================
                0008       SUBROUTINE RADTRANS_READPARMS( myThid )
                0009 
                0010 C !DESCRIPTION:
                0011 C     Initialize radtrans parameters, read in data.radtrans
                0012 
                0013 C !USES: ===============================================================
                0014       IMPLICIT NONE
                0015 #include "EEPARAMS.h"
                0016 #include "SIZE.h"
                0017 #include "PARAMS.h"
                0018 #ifdef ALLOW_EXCH2
                0019 #include "W2_EXCH2_SIZE.h"
                0020 #include "W2_EXCH2_TOPOLOGY.h"
                0021 #endif
                0022 #ifdef ALLOW_GCHEM
                0023 #include "GCHEM.h"
                0024 #endif
                0025 #ifdef ALLOW_EXF
                0026 #include "EXF_PARAM.h"
d9e107d180 Oliv*0027 #include "EXF_INTERP_SIZE.h"
                0028 #include "EXF_INTERP_PARAM.h"
b55e95f1ff Oliv*0029 #endif
                0030 #include "RADTRANS_SIZE.h"
                0031 #include "RADTRANS_PARAMS.h"
d9e107d180 Oliv*0032 #include "RADTRANS_EXF_PARAMS.h"
b55e95f1ff Oliv*0033 
                0034 C !INPUT PARAMETERS: ===================================================
                0035 C  myThid               :: thread number
                0036       INTEGER myThid
                0037 
                0038 C !OUTPUT PARAMETERS: ==================================================
                0039 C  none
                0040 CEOP
                0041 
                0042 #ifdef ALLOW_RADTRANS
                0043 
                0044 C !LOCAL VARIABLES: ====================================================
                0045 C  iUnit   :: unit number for I/O
                0046 C  msgBuf  :: message buffer
a720384a8b Oliv*0047       integer iUnit, oUnit, l, errCount
b55e95f1ff Oliv*0048       CHARACTER*(MAX_LEN_MBUF) msgBuf
                0049 
                0050       NAMELIST/RADTRANS_FORCING_PARAMS/
                0051 C
                0052      &    RT_Edfile,
                0053      &    RT_Esfile,
                0054      &    RT_E_mask,
                0055      &    RT_E_period,
a720384a8b Oliv*0056      &    RT_E_RepCycle,
b55e95f1ff Oliv*0057      &    RT_E_startTime,
                0058      &    RT_E_startdate1,
                0059      &    RT_E_startdate2,
                0060      &    RT_Ed_const,
                0061      &    RT_Ed_exfremo_intercept,
                0062      &    RT_Ed_exfremo_slope,
                0063      &    RT_inscal_Ed,
                0064      &    RT_Es_const,
                0065      &    RT_Es_exfremo_intercept,
                0066      &    RT_Es_exfremo_slope,
                0067      &    RT_inscal_Es,
                0068 C
                0069      &    RT_icefile,
                0070      &    RT_iceperiod,
a720384a8b Oliv*0071      &    RT_iceRepCycle,
b55e95f1ff Oliv*0072      &    RT_iceStartTime,
                0073      &    RT_icestartdate1,
                0074      &    RT_icestartdate2,
                0075      &    RT_iceconst,
                0076      &    RT_ice_exfremo_intercept,
                0077      &    RT_ice_exfremo_slope,
                0078      &    RT_icemask,
                0079      &    RT_inscal_ice
                0080 
                0081 #ifdef USE_EXF_INTERPOLATION
                0082       NAMELIST/RADTRANS_INTERP_PARAMS/
                0083 C
                0084      &    RT_E_lon0,
                0085      &    RT_E_lat0,
                0086      &    RT_E_nlon,
                0087      &    RT_E_nlat,
                0088      &    RT_E_lon_inc,
                0089      &    RT_E_interpMethod,
                0090      &    RT_E_lat_inc,
                0091 C
                0092      &    RT_ice_lon0,
                0093      &    RT_ice_lat0,
                0094      &    RT_ice_nlon,
                0095      &    RT_ice_nlat,
                0096      &    RT_ice_lon_inc,
                0097      &    RT_ice_interpMethod,
                0098      &    RT_ice_lat_inc
                0099 #endif
                0100 
                0101       NAMELIST/RADTRANS_PARAMS/
                0102      &    RT_refract_water,
                0103      &    RT_rmud_max,
                0104      &    RT_wbEdges,
                0105      &    RT_wbRefWLs,
                0106      &    RT_kmax,
0222db53b0 Oliv*0107      &    RT_useOASIMrmud,
b55e95f1ff Oliv*0108      &    RT_useMeanCosSolz,
e8b7a8749d Oliv*0109      &    RT_useNoonSolz,
0222db53b0 Oliv*0110      &    RT_sfcIrrThresh,
                0111      &    RT_oasimWgt
b55e95f1ff Oliv*0112 
                0113       NAMELIST/RADTRANS_DEPENDENT/
                0114      &    RT_wbWidths
                0115 
                0116       IF ( .NOT.useRADTRANS ) THEN
                0117 C-    pkg RADTRANS is not used
                0118         _BEGIN_MASTER(myThid)
                0119 C-    Track pkg activation status:
94b5b7340a Oliv*0120 C     print a (weak) warning if data.radtrans is found
b55e95f1ff Oliv*0121          CALL PACKAGES_UNUSED_MSG( 'useRADTRANS', ' ', ' ' )
                0122         _END_MASTER(myThid)
                0123         RETURN
                0124       ENDIF
                0125 
                0126 C Open and read the data.radtrans file
                0127 
                0128       _BEGIN_MASTER(myThid)
                0129 
                0130       DO l = 1, nlam
                0131        RT_Edfile(l) = ' '
                0132        RT_Esfile(l) = ' '
                0133        RT_inscal_Ed(l)            = 1.0 _d 0
                0134        RT_inscal_Es(l)            = 1.0 _d 0
                0135        RT_Ed_const(l)             = 0.0 _d 0
                0136        RT_Es_const(l)             = 0.0 _d 0
                0137        RT_Ed_exfremo_intercept(l) = 0.0 _d 0
                0138        RT_Es_exfremo_intercept(l) = 0.0 _d 0
                0139        RT_Ed_exfremo_slope(l)     = 0.0 _d 0
                0140        RT_Es_exfremo_slope(l)     = 0.0 _d 0
0222db53b0 Oliv*0141        RT_oasimWgt(l)             = 1.0 _d 0
b55e95f1ff Oliv*0142       ENDDO
                0143       RT_E_period     = 0.0 _d 0
a720384a8b Oliv*0144       RT_E_RepCycle   = repeatPeriod
b55e95f1ff Oliv*0145       RT_E_StartTime  = UNSET_RL
                0146       RT_E_startdate1 = 0
                0147       RT_E_startdate2 = 0
                0148       RT_E_mask = 'c'
                0149 
                0150 
                0151       RT_icefile = ' '
                0152       RT_iceperiod             = 0.0 _d 0
a720384a8b Oliv*0153       RT_iceRepCycle           = repeatPeriod
b55e95f1ff Oliv*0154       RT_iceStartTime          = UNSET_RL
                0155       RT_icestartdate1         = 0
                0156       RT_icestartdate2         = 0
                0157       RT_iceconst              = UNSET_RL
                0158       RT_ice_exfremo_intercept = 0.0 _d 0
                0159       RT_ice_exfremo_slope     = 0.0 _d 0
                0160       RT_icemask = 'c'
                0161 
                0162       RT_inscal_ice    =  1.0 _d 0
                0163 
                0164 #ifdef USE_EXF_INTERPOLATION
                0165       RT_E_lon0 = inp_lon0
                0166       RT_E_lat0 = inp_lat0
d9e107d180 Oliv*0167       RT_E_nlon = inp_gNx
                0168       RT_E_nlat = inp_gNy
b55e95f1ff Oliv*0169       RT_E_lon_inc = inp_dLon
                0170       RT_E_interpMethod  = 1
                0171 
                0172       RT_ice_lon0 = inp_lon0
                0173       RT_ice_lat0 = inp_lat0
d9e107d180 Oliv*0174       RT_ice_nlon = inp_gNx
                0175       RT_ice_nlat = inp_gNy
b55e95f1ff Oliv*0176       RT_ice_lon_inc = inp_dLon
                0177       RT_ice_interpMethod  = 1
d9e107d180 Oliv*0178 
                0179       DO l=1,MAX_LAT_INC
                0180         RT_E_lat_inc(l) = inp_dLat(l)
                0181         RT_ice_lat_inc(l) = inp_dLat(l)
                0182       ENDDO
b55e95f1ff Oliv*0183 #endif /* USE_EXF_INTERPOLATION */
                0184 
                0185 C     these are taken from Ackleson, et al. 1994 (JGR)
                0186       RT_rd = 1.5 _d 0
                0187       RT_ru = 3.0 _d 0
                0188       RT_rmus = 1.0/0.83 _d 0
                0189       RT_rmuu = 1.0/0.4 _d 0
                0190 
                0191       RT_refract_water = 1.341 _d 0        ! refractive index of seawater
                0192       RT_rmud_max = 1.5 _d 0
                0193       DO l = 1,nlam
                0194         RT_wbEdges(l) = -1 _d 0
                0195         RT_wbRefWLs(l) = -1 _d 0
                0196       ENDDO
                0197       RT_kmax = Nr
0222db53b0 Oliv*0198       RT_useOASIMrmud = useOASIM
b55e95f1ff Oliv*0199       RT_useMeanCosSolz = .FALSE.
e8b7a8749d Oliv*0200       RT_useNoonSolz = .FALSE.
b55e95f1ff Oliv*0201       RT_sfcIrrThresh = 1 _d -4
                0202 
                0203       WRITE(msgBuf,'(A)') ' RADTRANS_READPARMS: opening data.radtrans'
                0204       CALL PRINT_MESSAGE(msgBuf, standardMessageUnit,
                0205      &                   SQUEEZE_RIGHT , 1)
                0206 
                0207       CALL OPEN_COPY_DATA_FILE(
                0208      I                   'data.radtrans', 'RADTRANS_READPARMS',
                0209      O                   iUnit,
                0210      I                   myThid )
                0211 
                0212       READ(UNIT=iUnit, NML=radtrans_forcing_params)
                0213 #ifdef USE_EXF_INTERPOLATION
                0214       READ(UNIT=iUnit, NML=radtrans_interp_params)
                0215 #endif
                0216       READ(UNIT=iUnit, NML=radtrans_params)
                0217 #ifdef SINGLE_DISK_IO
                0218       CLOSE(iUnit)
                0219 #else
                0220       CLOSE(iUnit,STATUS='DELETE')
                0221 #endif /* SINGLE_DISK_IO */
                0222 
                0223 C ======================================================================
                0224 
                0225       RT_haveIce = RT_iceFile.NE.' ' .OR. RT_iceconst.NE.UNSET_RL
                0226 
                0227 #ifdef ALLOW_SEAICE
                0228       RT_useSEAICE = .not. RT_haveIce
                0229       IF (RT_useSEAICE) THEN
                0230         WRITE(msgBuf,'(2A)') '** WARNING ** RT_READPARMS: ',
                0231      &  'RT_iceFile and RT_iceconst unset, using area from seaice pkg'
                0232         CALL PRINT_MESSAGE( msgBuf, errorMessageUnit,
                0233      &                      SQUEEZE_RIGHT, myThid )
                0234       ELSE
                0235         WRITE(msgBuf,'(2A)') '** WARNING ** RT_READPARMS: ',
                0236      &  'RT_iceFile or RT_iceconst set, not using area from seaice pkg'
                0237         CALL PRINT_MESSAGE( msgBuf, errorMessageUnit,
                0238      &                      SQUEEZE_RIGHT, myThid )
                0239       ENDIF
                0240 #endif
                0241 
                0242       IF (RT_iceconst.EQ.UNSET_RL) THEN
                0243         RT_iceconst = 0 _d 0
                0244       ENDIF
                0245 
                0246 C ======================================================================
                0247 C band widths used to convert total-waveband irradiance to per nm
                0248       RT_wbTotalWidth = 0.0
                0249       DO l=1,nlam
                0250         RT_wbWidths(l) = RT_wbEdges(l+1) -
                0251      &                  RT_wbEdges(l)
                0252         RT_wbTotalWidth = RT_wbTotalWidth + RT_wbWidths(l)
                0253       ENDDO
                0254       IF (RT_wbTotalWidth.LE.0) then
                0255         WRITE(msgBuf,'(2A)') 'RADTRANS_READPARMS: ',
                0256      &  'please provide wavebabnds in RT_wbEdges.'
                0257         CALL PRINT_ERROR( msgBuf, myThid )
                0258         STOP 'ABNORMAL END: S/R RADTRANS_READPARMS'
                0259       ENDIF
                0260       DO l = 1,nlam
                0261         IF (RT_wbRefWLs(l) .LT. 0.0) THEN
                0262           RT_wbRefWLs(l) = 0.5*(RT_wbEdges(l) +
                0263      &                          RT_wbEdges(l+1))
                0264         ENDIF
                0265       ENDDO
a720384a8b Oliv*0266 
b55e95f1ff Oliv*0267 C ----------------------------------------------------------------------
                0268       IF ( myProcId.EQ.0 .AND. myThid.EQ.1 ) THEN
                0269         CALL MDSFINDUNIT( oUnit, mythid )
                0270         OPEN(oUnit,file='radtrans_params.txt',status='unknown')
                0271         WRITE(UNIT=oUnit, NML=RADTRANS_FORCING_PARAMS)
                0272 #ifdef USE_EXF_INTERPOLATION
                0273         WRITE(UNIT=oUnit, NML=RADTRANS_INTERP_PARAMS)
                0274 #endif
                0275         WRITE(UNIT=oUnit, NML=RADTRANS_PARAMS)
                0276         WRITE(UNIT=oUnit, NML=RADTRANS_DEPENDENT)
                0277         CLOSE(oUnit)
                0278       ENDIF
                0279 
                0280       WRITE(msgBuf,'(A)') ' ==================================='
                0281       CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
                0282      &                    SQUEEZE_RIGHT, myThid )
                0283 
                0284       _END_MASTER(myThid)
                0285 
                0286 C Everyone else must wait for the parameters to be loaded
                0287       _BARRIER
                0288 
                0289 #endif /* ALLOW_RADTRANS */
                0290 
                0291       RETURN
                0292       END
                0293