Back to home page

darwin3

 
 

    


File indexing completed on 2024-12-17 18:33:59 UTC

view on githubraw file Latest commit 2c93eb88 on 2022-12-31 01:34:19 UTC
8fbfd1f382 Oliv*0001 #include "DARWIN_OPTIONS.h"
                0002 #include "EXF_OPTIONS.h"
                0003 
                0004 C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
                0005 CBOP
                0006 C     !ROUTINE: DARWIN_INIT_FIXED
                0007 
                0008 C     !INTERFACE:
                0009       SUBROUTINE DARWIN_INIT_FIXED( myThid )
                0010 
                0011 C     !DESCRIPTION:
                0012 C     Initialize wavebands and read in absorption/scattering spectra
                0013 
                0014 C     !USES:
                0015       IMPLICIT NONE
                0016 #include "SIZE.h"
                0017 #include "EEPARAMS.h"
                0018 #include "PARAMS.h"
                0019 #include "GRID.h"
                0020 #ifdef ALLOW_RADTRANS
                0021 #include "RADTRANS_SIZE.h"
                0022 #include "RADTRANS_PARAMS.h"
                0023 #endif
                0024 #ifdef ALLOW_DARWIN
                0025 #include "PTRACERS_SIZE.h"
                0026 #include "PTRACERS_PARAMS.h"
                0027 #include "DARWIN_SIZE.h"
                0028 #include "DARWIN_RADTRANS.h"
                0029 #include "DARWIN_PARAMS.h"
                0030 #include "DARWIN_TRAITS.h"
                0031 #endif
                0032 
                0033 C     !INPUT PARAMETERS:
                0034       INTEGER myThid
                0035 CEOP
                0036 
                0037 #ifdef ALLOW_DARWIN
                0038 
                0039 C     !LOCAL VARIABLES:
                0040       CHARACTER*(MAX_LEN_MBUF) msgBuf
                0041       integer iUnit, oUnit1, oUnit2, k, jp
                0042       integer idummy
                0043 #ifdef ALLOW_RADTRANS
                0044       character*80 title
                0045       integer ios, i, l, ilambda
f61b1017e2 Oliv*0046       _RL lambdain, ain, apsin, bin, bbin, ain_mgC
8fbfd1f382 Oliv*0047 #endif
                0048 
                0049       CALL DARWIN_EXF_INIT_FIXED(myThid)
                0050 
                0051 #ifdef ALLOW_DIAGNOSTICS
                0052       IF ( useDiagnostics ) THEN
                0053         CALL DARWIN_DIAGNOSTICS_INIT( myThid )
                0054       ENDIF
                0055 #endif
                0056 
                0057       _BEGIN_MASTER(myThid)
                0058 
                0059       IF (darwin_linFSConserve) PTRACERS_calcSurfCor = .TRUE.
                0060 
                0061 #ifdef DARWIN_IRON_SED_SOURCE_VARIABLE
                0062       kMinFeSed = 2
                0063 #else
                0064       kMinFeSed = 1
                0065 #endif
                0066       kMaxFeSed = 0
                0067       DO k=1,Nr
                0068         IF (RF(k) .GT. -depthFeSed) kMaxFeSed = k
                0069       ENDDO
                0070 
2c93eb88ef Oliv*0071 #ifdef DARWIN_ALLOW_HYDROTHERMAL_VENTS
                0072       kMinFeVent = Nr + 1
                0073       DO k=Nr,1,-1
                0074         IF (RC(k) .LE. -depthFeVent) kMinFeVent = k
                0075       ENDDO
                0076 #endif
                0077 
8fbfd1f382 Oliv*0078 
                0079 #ifdef ALLOW_RADTRANS
                0080 
                0081 C read water absorption data
                0082       DO l = 1, nlam
                0083         aw(l) = -1.0 _d 0
                0084         bw(l) = -1.0 _d 0
                0085       ENDDO
                0086       IF (darwin_waterAbsorbFile .NE. ' '  ) THEN
                0087         CALL MDSFINDUNIT( iUnit, myThid )
                0088         OPEN(iUnit,FILE=darwin_waterabsorbFile,
                0089      &       STATUS='old',FORM='formatted')
                0090 C       skip header
                0091         DO i = 1,6
                0092          READ(iUnit,'(A50)')title
                0093         ENDDO
                0094         ios = 0
                0095         DO WHILE (ios .EQ. 0)
                0096          READ(iUnit,'(I5,F15.4,F10.4)',IOSTAT=ios) ilambda,ain,bin
                0097          IF (ios .EQ. 0) THEN
                0098           lambdain = ilambda
                0099           DO l = 1,nlam
                0100            IF (lambdain .GE. RT_wbEdges(l) .AND.
                0101      &         lambdain .LE. RT_wbEdges(l+1)) THEN
                0102             aw(l) = ain
                0103             bw(l) = bin
                0104            ENDIF
                0105           ENDDO
                0106          ENDIF
                0107         ENDDO
                0108         CLOSE(iUnit)
                0109       ELSE
                0110         WRITE(msgBuf,'(A)')
                0111      &   'DARWIN_INIT_FIXED: need to specify water absorption file'
                0112         CALL PRINT_ERROR( msgBuf, myThid )
                0113         STOP 'ABNORMAL END: S/R DARWIN_INIT_FIXED'
                0114       ENDIF
                0115 C     check that all wavebands have been read
                0116       DO l = 1, nlam
                0117         IF (aw(l) .LT. 0.0) THEN
                0118           WRITE(msgBuf,'(2A)') 'DARWIN_INIT_FIXED: ',
                0119      &     "could not read water absorption data for band "
                0120           CALL PRINT_ERROR( msgBuf, myThid )
                0121           WRITE(msgBuf,'(A,I3,2F8.3)') 'DARWIN_INIT_FIXED: ',
                0122      &     l,RT_wbEdges(l),RT_wbEdges(l+1)
                0123           CALL PRINT_ERROR( msgBuf, myThid )
                0124           STOP 'ABNORMAL END: S/R DARWIN_INIT_FIXED'
                0125         ENDIF
                0126       ENDDO
                0127 C     write summary
                0128       WRITE(msgBuf,'(A)') 'DARWIN_INIT_FIXED: water spectra:'
                0129       CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
                0130      &                    SQUEEZE_RIGHT, 1 )
                0131       WRITE(msgBuf,'(A,A)') 'DARWIN_INIT_FIXED: ',
                0132      &     ' lam aw             bw'
                0133       CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
                0134      &                    SQUEEZE_RIGHT, 1 )
                0135       DO l = 1,nlam
                0136         WRITE(msgBuf,'(A,F4.0,F15.4,F10.4)') 'DARWIN_INIT_FIXED: ',
                0137      &     RT_wbRefWLs(l), aw(l), bw(l)
                0138         CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
                0139      &                      SQUEEZE_RIGHT, 1 )
                0140       ENDDO
                0141       WRITE(msgBuf,'(A)') 'DARWIN_INIT_FIXED:'
                0142       CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
                0143      &                    SQUEEZE_RIGHT, 1 )
                0144 
                0145 
                0146 C read phyto absorption data
                0147 C   phyto input data files must have a column for absorption by PS pigs
                0148 C   easiest way to 'turn off' PS for growth is to put same values in both abs columns
                0149       DO i = 1, nopt
                0150        DO l = 1, nlam
                0151         aphy_chl_type   (i,l) = -1.0 _d 0
                0152         aphy_chl_ps_type(i,l) = -1.0 _d 0
f61b1017e2 Oliv*0153         aphy_mgC_type   (i,l) = -1.0 _d 0
8fbfd1f382 Oliv*0154         bphy_mgC_type   (i,l) = -1.0 _d 0
                0155         bbphy_mgC_type  (i,l) = -1.0 _d 0
                0156        ENDDO
                0157       ENDDO
                0158       IF (darwin_phytoAbsorbFile .NE. ' '  ) THEN
                0159         CALL MDSFINDUNIT( iUnit, myThid )
                0160         OPEN(iUnit,FILE=darwin_phytoAbsorbFile,
                0161      &       STATUS='old',FORM='formatted')
                0162 C       skip global header
                0163         DO i = 1,6
                0164          READ(iUnit,'(A50)')title
                0165         ENDDO
                0166 C       phytoplanktontype header
                0167         READ(iUnit,'(A50)')title
                0168         DO i = 1,nopt
                0169          ios = 0
                0170          IF (darwin_allomSpectra) THEN
f61b1017e2 Oliv*0171            READ(iUnit,'(I4,3F10.0,F20.0,F10.0)')
                0172      &       idummy,asize(i),apsize(i),bsize(i),bbsize(i),asize_mgC(i)
8fbfd1f382 Oliv*0173          ENDIF
                0174          DO WHILE (ios .EQ. 0)
f61b1017e2 Oliv*0175           READ(iUnit,'(I4,3F10.0,F20.0,F10.0)',IOSTAT=ios)
                0176      &                ilambda,ain,apsin,bin,bbin,ain_mgC
8fbfd1f382 Oliv*0177 C         next phyto type header will trigger error and move on to next i
                0178           IF (ios .EQ. 0) THEN
                0179            lambdain = ilambda
                0180            DO l = 1,nlam
                0181             IF (lambdain .GE. RT_wbEdges(l) .AND.
                0182      &          lambdain .LE. RT_wbEdges(l+1)) THEN
                0183              aphy_chl_type   (i,l) = ain
                0184              aphy_chl_ps_type(i,l) = apsin
                0185              bphy_mgC_type   (i,l) = bin
                0186              bbphy_mgC_type  (i,l) = bbin
f61b1017e2 Oliv*0187              aphy_mgC_type   (i,l) = ain_mgC
8fbfd1f382 Oliv*0188             ENDIF
                0189            ENDDO
                0190           ENDIF
                0191          ENDDO
                0192         ENDDO
                0193         CLOSE(iUnit)
                0194       ELSE
                0195         WRITE(msgBuf,'(A)')
f61b1017e2 Oliv*0196      &   'DARWIN_INIT_FIXED: need to specify plankton absorption file'
8fbfd1f382 Oliv*0197         CALL PRINT_ERROR( msgBuf, myThid )
                0198         STOP 'ABNORMAL END: S/R DARWIN_INIT_FIXED'
                0199       ENDIF
                0200 C     check that all wavebands have been read
                0201       DO i = 1, nopt
                0202        DO l = 1, nlam
                0203         IF (aphy_chl_type(i,l) .LT. 0.0) THEN
                0204           WRITE(msgBuf,'(2A)') 'DARWIN_INIT_FIXED: ',
                0205      &     "could not read phyto absorption data for type,band "
                0206           CALL PRINT_ERROR( msgBuf, myThid )
                0207           WRITE(msgBuf,'(A,2I3,2F8.3)') 'DARWIN_INIT_FIXED: ',
                0208      &     i,l,RT_wbEdges(l),RT_wbEdges(l+1)
                0209           CALL PRINT_ERROR( msgBuf, myThid )
                0210           STOP 'ABNORMAL END: S/R DARWIN_INIT_FIXED'
                0211         ENDIF
                0212        ENDDO
                0213       ENDDO
                0214 C     write summary
                0215       WRITE(msgBuf,'(A)') 'DARWIN_INIT_FIXED: phyto spectra:'
                0216       CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
                0217      &                    SQUEEZE_RIGHT, 1 )
                0218       DO i = 1,nopt
                0219         WRITE(msgBuf,'(A,I4)') 'DARWIN_INIT_FIXED: type ', i
                0220         CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
                0221      &                    SQUEEZE_RIGHT, 1 )
                0222         WRITE(msgBuf,'(A,A)') 'DARWIN_INIT_FIXED: ',
f61b1017e2 Oliv*0223      &     ' lam ap        ap_ps     bp        bbp            ap_mgC'
8fbfd1f382 Oliv*0224         CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
                0225      &                    SQUEEZE_RIGHT, 1 )
                0226         DO l = 1,nlam
f61b1017e2 Oliv*0227           WRITE(msgBuf,'(A,F4.0,3F10.4,F20.9,F10.6)')
                0228      &     'DARWIN_INIT_FIXED: ',
8fbfd1f382 Oliv*0229      &     RT_wbRefWLs(l), aphy_chl_type(i,l), aphy_chl_ps_type(i,l),
f61b1017e2 Oliv*0230      &     bphy_mgC_type(i,l), bbphy_mgC_type(i,l), aphy_mgC_type(i,l)
8fbfd1f382 Oliv*0231           CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
                0232      &                      SQUEEZE_RIGHT, 1 )
                0233         ENDDO
                0234         WRITE(msgBuf,'(A)') 'DARWIN_INIT_FIXED:'
                0235         CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
                0236      &                    SQUEEZE_RIGHT, 1 )
                0237       ENDDO
                0238 
                0239 
                0240 C read particle absorption data
                0241 C initialize particle absorption coefficient
                0242       DO l = 1, nlam
                0243         apart(l) = -1.0 _d 0
                0244         bpart(l) = -1.0 _d 0
                0245         bbpart(l) = -1.0 _d 0
                0246       ENDDO
                0247       IF (darwin_particleAbsorbFile .NE. ' '  ) THEN
                0248         CALL MDSFINDUNIT( iUnit, myThid )
                0249         OPEN(iUnit,FILE=darwin_particleAbsorbFile,
                0250      &       STATUS='old',FORM='formatted')
                0251 C       skip header
                0252         DO i = 1,6
                0253          READ(iUnit,'(A50)')title
                0254         ENDDO
                0255         ios = 0
                0256         DO WHILE (ios .EQ. 0)
                0257          READ(iUnit,'(I4,3F15.0)',IOSTAT=ios) ilambda,ain,bin,bbin
                0258          IF (ios .EQ. 0) THEN
                0259           lambdain = ilambda
                0260           DO l = 1,nlam
                0261            IF (lambdain .GE. RT_wbEdges(l) .AND.
                0262      &         lambdain .LE. RT_wbEdges(l+1)) THEN
                0263             apart(l) = ain
                0264             bpart(l) = bin
                0265             bbpart(l) = bbin
                0266             apart_P(l) = ain/darwin_part_size_P
                0267             bpart_P(l) = bin/darwin_part_size_P
                0268             bbpart_P(l) = bbin/darwin_part_size_P
                0269            ENDIF
                0270           ENDDO
                0271          ENDIF
                0272         ENDDO
                0273         CLOSE(iUnit)
                0274       ELSE
                0275         WRITE(msgBuf,'(A)')
f61b1017e2 Oliv*0276      &   'DARWIN_INIT_FIXED: need to specify particle absorption file'
8fbfd1f382 Oliv*0277         CALL PRINT_ERROR( msgBuf, myThid )
                0278         STOP 'ABNORMAL END: S/R DARWIN_INIT_FIXED'
                0279       ENDIF
                0280 C     check that all wavebands have been read
                0281       DO l = 1, nlam
                0282         IF (apart(l) .LT. 0.0) THEN
                0283           WRITE(msgBuf,'(2A)') 'DARWIN_INIT_FIXED: ',
                0284      &     "could not read particle for band "
                0285           CALL PRINT_ERROR( msgBuf, myThid )
                0286           WRITE(msgBuf,'(A,I3,2F8.3)') 'DARWIN_INIT_FIXED: ',
                0287      &     l,RT_wbEdges(l),RT_wbEdges(l+1)
                0288           CALL PRINT_ERROR( msgBuf, myThid )
                0289           STOP 'ABNORMAL END: S/R DARWIN_INIT_FIXED'
                0290         ENDIF
                0291       ENDDO
                0292 C     write summary
                0293       WRITE(msgBuf,'(A)') 'DARWIN_INIT_FIXED: particulate spectra:'
                0294       CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
                0295      &                    SQUEEZE_RIGHT, 1 )
                0296       WRITE(msgBuf,'(A,A)') 'DARWIN_INIT_FIXED: ',
                0297      &     ' lam apart          bpart          bbpart'
                0298       CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
                0299      &                    SQUEEZE_RIGHT, 1 )
                0300       DO l = 1,nlam
                0301         WRITE(msgBuf,'(A,F4.0,1P3G15.6)')'DARWIN_INIT_FIXED: ',
                0302      &     RT_wbRefWLs(l), apart(l), bpart(l), bbpart(l)
                0303         CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
                0304      &                      SQUEEZE_RIGHT, 1 )
                0305       ENDDO
                0306       WRITE(msgBuf,'(A)') 'DARWIN_INIT_FIXED:'
                0307       CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
                0308      &                    SQUEEZE_RIGHT, 1 )
                0309 c
                0310       WRITE(msgBuf,'(2A)') 'DARWIN_INIT_FIXED: particulate spectra ',
                0311      &                    'in phosphorus units:'
                0312       CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
                0313      &                    SQUEEZE_RIGHT, 1 )
                0314       WRITE(msgBuf,'(A,A)') 'DARWIN_INIT_FIXED: ',
                0315      &     ' lam apart_P        bpart_P        bbpart_P'
                0316       CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
                0317      &                    SQUEEZE_RIGHT, 1 )
                0318       DO l = 1,nlam
                0319         WRITE(msgBuf,'(A,F4.0,2F15.9,F15.12)') 'DARWIN_INIT_FIXED: ',
                0320      &     RT_wbRefWLs(l), apart_P(l), bpart_P(l), bbpart_P(l)
                0321         CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
                0322      &                      SQUEEZE_RIGHT, 1 )
                0323       ENDDO
                0324       WRITE(msgBuf,'(A)') 'DARWIN_INIT_FIXED:'
                0325       CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
                0326      &                    SQUEEZE_RIGHT, 1 )
                0327 c
                0328 
                0329 
                0330       DO l = 1,nlam
                0331         exCDOM(l)=EXP(-darwin_Sdom*(RT_wbRefWLs(l)-darwin_lambda_aCDOM))
                0332       ENDDO
                0333 #ifndef DARWIN_ALLOW_CDOM
                0334 C initialize CDOM absorption coefficient
                0335       laCDOM = -1
                0336       DO l = 1,nlam
                0337         IF (darwin_lambda_aCDOM .GE. RT_wbEdges(l) .AND.
                0338      &      darwin_lambda_aCDOM .LE. RT_wbEdges(l+1)) THEN
                0339           laCDOM = l
                0340         ENDIF
                0341       ENDDO
                0342       IF (laCDOM .LE. 0) THEN
                0343         WRITE(msgBuf,'(2A)') 'DARWIN_INIT_FIXED: ',
                0344      &   "could not read find aCDOM reference waveband with frequency"
                0345         CALL PRINT_ERROR( msgBuf, myThid )
                0346         WRITE(msgBuf,'(A,F8.3)') 'DARWIN_INIT_FIXED: ',
                0347      &   darwin_lambda_aCDOM
                0348         CALL PRINT_ERROR( msgBuf, myThid )
                0349         STOP 'ABNORMAL END: S/R DARWIN_INIT_FIXED'
                0350       ELSE
                0351         WRITE(msgBuf,'(A,I3)')
                0352      &        'DARWIN_INIT_FIXED: laCDOM = ', laCDOM
                0353         CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
                0354      &                      SQUEEZE_RIGHT, 1 )
                0355       ENDIF
                0356 #endif
                0357 
                0358 #endif /* ALLOW_RADTRANS */
                0359 
                0360 C ======================================================================
                0361       CALL DARWIN_RANDOM_INIT(darwin_seed, myThid)
                0362 
                0363 #ifdef DARWIN_RANDOM_TRAITS
                0364       CALL DARWIN_GENERATE_RANDOM(myThid)
                0365 #else
                0366       CALL DARWIN_GENERATE_ALLOMETRIC(myThid)
                0367 #endif
                0368 
                0369 C ======================================================================
                0370 C read (overrides generated) and write trait namelists
                0371 
                0372       WRITE(msgBuf,'(A)') ' DARWIN_INIT_FIXED: opening data.traits'
                0373       CALL PRINT_MESSAGE(msgBuf, standardMessageUnit,
                0374      &                   SQUEEZE_RIGHT , 1)
                0375 
                0376       CALL MDSFINDUNIT( iUnit, myThid )
                0377       CALL OPEN_COPY_DATA_FILE(
                0378      I                   'data.traits', 'DARWIN_INIT_FIXED',
                0379      O                   iUnit,
                0380      I                   myThid )
                0381 
                0382       IF ( myProcId.EQ.0 .AND. myThid.EQ.1 ) THEN
                0383         CALL MDSFINDUNIT( oUnit1, mythid )
                0384         open(oUnit1,file='darwin_traits.txt',status='unknown')
                0385       ELSE
                0386         oUnit1 = -1
                0387       ENDIF
                0388 
                0389       CALL DARWIN_READ_TRAITS(iUnit, oUnit1, myThid)
                0390 
                0391       IF ( oUnit1 .GE. 0 ) THEN
                0392         close(oUnit1)
                0393       ENDIF
                0394 #ifdef SINGLE_DISK_IO
                0395       CLOSE(iUnit)
                0396 #else
                0397       CLOSE(iUnit,STATUS='DELETE')
                0398 #endif /* SINGLE_DISK_IO */
                0399 
                0400       WRITE(msgBuf,'(A)') ' ==================================='
                0401       CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
                0402      &                    SQUEEZE_RIGHT, myThid )
                0403 
                0404 C ======================================================================
                0405 C deprecation checks
                0406 
                0407 #ifndef DARWIN_ALLOW_EXUDE
                0408       DO jp = 1, nPlank
                0409        IF (ExportFracExude(jp) .NE. DARWIN_UNINIT_RL) THEN
                0410         WRITE(msgBuf,'(2A)')'ExportFracExude can only be used with ',
                0411      &     'DARWIN_ALLOW_EXUDE.'
                0412         CALL PRINT_ERROR( msgBuf, myThid )
                0413         WRITE(msgBuf,'(2A)')'Use ExportFracMort and ExportFracMort2 ',
                0414      &     'for export due to mortality.'
                0415         CALL PRINT_ERROR( msgBuf, myThid )
                0416         STOP 'ABNORMAL END: S/R DARWIN_INIT_FIXED'
                0417        ENDIF
                0418       ENDDO
                0419 #endif
                0420 
                0421 C ======================================================================
                0422 C write some traits to files
                0423 
                0424 #ifdef ALLOW_RADTRANS
                0425 
                0426       IF ( myProcId.EQ.0 ) THEN
                0427 
                0428 
                0429 C set spectra for individual plankton according to optical type
                0430 C file for aptypes assigned via coin flips
                0431       CALL MDSFINDUNIT( oUnit1, myThid )
                0432       OPEN(oUnit1,file='p-ini-char-aptype.dat',status='unknown')
                0433       CALL MDSFINDUNIT( oUnit2, myThid )
                0434       OPEN(oUnit2,file='p_ini_char_aptype_nohead.dat',status='unknown')
                0435       WRITE(oUnit1,*)'np   aptype'
                0436       DO jp = 1,nPhoto
                0437         WRITE(oUnit1,'(2I5)') jp, aptype(jp)
                0438         WRITE(oUnit2,'(2I5)') jp, aptype(jp)
                0439       ENDDO
                0440       CLOSE(oUnit1)
                0441       CLOSE(oUnit2)
                0442 
                0443 c file of total absorption spectra
                0444 c rows = pwaves, columns = jp      
                0445       open(oUnit1,file='p-ini-char-apspec.dat',status='unknown')
f61b1017e2 Oliv*0446       open(oUnit2,file='p_ini_char_apspec_nohead.dat',status='unknown')
8fbfd1f382 Oliv*0447       write(oUnit1,*)'Rows = pwaves. Columns = jp'
                0448       write(oUnit1,*)'pwaves found in pwaves-check.dat'
                0449       write(oUnit1,*)'col_1 to col_<nPhoto>'
                0450       write(oUnit1,*)'is absorption aphy_chl (m-2 mg chla-1)'
                0451       do l=1,nlam
                0452        write(oUnit1,9999)(aphy_chl(jp,l),jp=1,nPhoto)
                0453        write(oUnit2,9999)(aphy_chl(jp,l),jp=1,nPhoto)
                0454       enddo
                0455 c make sure outfile is defined above with the correct size
                0456       close(oUnit1)
                0457       close(oUnit2)
                0458 
f61b1017e2 Oliv*0459 c file of spectra for carbon-specific total absorption
                0460 c rows = pwaves, columns = jp      
                0461       open(oUnit1,file='p-ini-char-apspec-mgC.dat',status='unknown')
                0462       open(oUnit2,file='p_ini_char_apspec_mgC_nohead.dat',
                0463      &     status='unknown')
                0464       write(oUnit1,*)'Rows = pwaves. Columns = jp'
                0465       write(oUnit1,*)'pwaves found in pwaves-check.dat'
                0466       write(oUnit1,*)'col_1 to col_<nPhoto>'
                0467       write(oUnit1,*)'is absorption aphy_mgC*1e3 (m-2 mg C-1)'
                0468       do l=1,nlam
                0469        write(oUnit1,9999)(aphy_mgC(jp,l)*1e3,jp=1,nplank)
                0470        write(oUnit2,9999)(aphy_mgC(jp,l)*1e3,jp=1,nplank)
                0471       enddo
                0472 c make sure outfile is defined above with the correct size
                0473       close(oUnit1)
                0474       close(oUnit2)
                0475 
8fbfd1f382 Oliv*0476 c file for absorption spectra of PS's only
                0477 c rows = pwaves, columns = jp
                0478       open(oUnit1,file='p-ini-char-apspec-psc.dat',status='unknown')
f61b1017e2 Oliv*0479       open(oUnit2,file='p_ini_char_apspec_psc_nohead.dat',
8fbfd1f382 Oliv*0480      &     status='unknown')
                0481       write(oUnit1,*)'Rows = pwaves. Columns = jp'
                0482       write(oUnit1,*)'pwaves found in pwaves-check.dat'
                0483       write(oUnit1,*)'Is absoprtion by photosynthetic'
                0484       write(oUnit1,*)'pigments only aphy_chl_ps (m-2 mg chla-1)'
                0485       do l=1,nlam
                0486        write(oUnit1,9999)(aphy_chl_ps(jp,l),jp=1,nPhoto)
                0487        write(oUnit2,9999)(aphy_chl_ps(jp,l),jp=1,nPhoto)
                0488       enddo
                0489       close(oUnit1)
                0490       close(oUnit2)
                0491 
                0492 c file of total scattering spectra
                0493 c rows = pwaves, columns = jp
                0494       open(oUnit1,file='p-ini-char-btspec.dat',status='unknown')
                0495       open(oUnit2,file='p_ini_char_btspec_nohead.dat',status='unknown')
                0496       write(oUnit1,*)'Rows = pwaves. Columns = jp'
                0497       write(oUnit1,*)'pwaves found in pwaves-check.dat'
                0498       write(oUnit1,*)'col_1 to col_<nPlank>'
                0499       write(oUnit1,*)'is total scattering bphy_mgC (m-2 mg C-1)'
                0500       do l=1,nlam
                0501        write(oUnit1,9999)(bphy_mgC(jp,l),jp=1,nplank)
                0502        write(oUnit2,9999)(bphy_mgC(jp,l),jp=1,nplank)
                0503       enddo
                0504 c make sure outfile is defined above with the correct size
                0505       close(oUnit1)
                0506       close(oUnit2)
                0507 
                0508 c file of total scattering spectra
                0509 c rows = pwaves, columns = jp
                0510       open(oUnit1,file='p-ini-char-bbspec.dat',status='unknown')
                0511       open(oUnit2,file='p_ini_char_bbspec_nohead.dat',status='unknown')
                0512       write(oUnit1,*)'Rows = pwaves. Columns = jp'
                0513       write(oUnit1,*)'pwaves found in pwaves-check.dat'
                0514       write(oUnit1,*)'col_1 to col_<nPlank>'
                0515       write(oUnit1,*)'is backscattering bphy_mgC*1e4 (m-2 mg C-1)'
                0516       do l=1,nlam
                0517        write(oUnit1,9999)(bbphy_mgC(jp,l)*1e4,jp=1,nplank)
                0518        write(oUnit2,9999)(bbphy_mgC(jp,l)*1e4,jp=1,nplank)
                0519       enddo
                0520 c make sure outfile is defined above with the correct size
                0521       close(oUnit1)
                0522       close(oUnit2)
                0523 
                0524 9999  format(9999f10.4)
                0525 
                0526 C     IF ( myProcId.EQ.0 ) THEN
                0527       ENDIF
                0528 
                0529 #endif /* ALLOW_RADTRANS */
                0530 
                0531 C ======================================================================
                0532 
                0533       _END_MASTER(myThid)
                0534 
                0535 C Everyone else must wait for the parameters to be loaded
                0536       _BARRIER
                0537 
                0538 #endif /* ALLOW_DARWIN */
                0539 
                0540       RETURN
                0541       END