New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
Changeset 7572 – NEMO

Changeset 7572


Ignore:
Timestamp:
2017-01-18T13:30:55+01:00 (7 years ago)
Author:
hadjt
Message:

Committing to allow coder review to begin

Tidied Code.

Prepared DIA/diadct.F90 to produce netcdf files with IOM_put (in progress)
Prepared DIA/diaregmean.F90 to switch on PEA and kara MLD output (in progress)

Location:
branches/UKMO/CO6_shelfclimate/NEMOGCM/NEMO/OPA_SRC
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/UKMO/CO6_shelfclimate/NEMOGCM/NEMO/OPA_SRC/DIA/diaar5.F90

    r7567 r7572  
    4040   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   sn0          ! initial salinity 
    4141   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   tn0          ! initial temperature 
     42   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   sshthster_mat         ! ssh_thermosteric height 
     43   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   sshhlster_mat         ! ssh_halosteric height 
     44   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   sshsteric_mat         ! ssh_steric height 
     45   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   zbotpres_mat          ! bottom pressure 
    4246       
    4347   !! * Substitutions 
     
    5761      !!---------------------------------------------------------------------- 
    5862      ! 
    59       ALLOCATE( area(jpi,jpj), thick0(jpi,jpj) , sn0(jpi,jpj,jpk), tn0(jpi,jpj,jpk) , STAT=dia_ar5_alloc ) 
     63      ALLOCATE( area(jpi,jpj), thick0(jpi,jpj) , sn0(jpi,jpj,jpk), tn0(jpi,jpj,jpk) , & 
     64          & sshthster_mat(jpi,jpj),sshhlster_mat(jpi,jpj),sshsteric_mat(jpi,jpj), & 
     65          & zbotpres_mat(jpi,jpj),STAT=dia_ar5_alloc ) 
    6066      ! 
    6167      IF( lk_mpp             )   CALL mpp_sum ( dia_ar5_alloc ) 
     
    8692      CALL wrk_alloc( jpi , jpj , jpk        , zrhd      , zrhop    ) 
    8793      CALL wrk_alloc( jpi , jpj , jpk , jpts , ztsn                 ) 
     94       
     95      sshthster_mat(:,:) = 0._wp   
     96      sshhlster_mat(:,:) = 0._wp   
     97      sshsteric_mat(:,:) = 0._wp   
     98      zbotpres_mat(:,:)  = 0._wp   
    8899 
    89100      zarea_ssh(:,:) = area(:,:) * sshn(:,:) 
     
    122133      zssh_steric = - zarho / area_tot 
    123134      CALL iom_put( 'sshthster', zssh_steric ) 
    124       CALL iom_put( 'sshthster_mat', -zbotpres ) 
     135      sshthster_mat(:,:) =  -zbotpres(:,:) 
     136      CALL iom_put( 'sshthster_mat', sshthster_mat ) 
    125137 
    126138      !                      
     
    150162      CALL iom_put( 'sshhlster', zssh_steric ) 
    151163      !JT 
    152       CALL iom_put( 'sshhlster_mat', -zbotpres ) 
     164      sshhlster_mat(:,:) = -zbotpres(:,:) 
     165      CALL iom_put( 'sshhlster_mat', sshhlster_mat ) 
    153166      !JT 
    154167       
     
    183196      CALL iom_put( 'sshsteric', zssh_steric ) 
    184197      !JT 
    185       CALL iom_put( 'sshsteric_mat', -zbotpres ) 
     198      sshsteric_mat(:,:) = -zbotpres(:,:)  
     199      CALL iom_put( 'sshsteric_mat', sshsteric_mat ) 
    186200      !JT 
    187201       
     
    189203      zztmp = rau0 * grav * 1.e-4_wp               ! recover pressure from pressure anomaly and cover to dbar = 1.e4 Pa 
    190204      zbotpres(:,:) = zztmp * ( zbotpres(:,:) + sshn(:,:) + thick0(:,:) ) 
    191       CALL iom_put( 'botpres', zbotpres ) 
     205      zbotpres_mat(:,:) = zbotpres(:,:) 
     206      CALL iom_put( 'botpres', zbotpres_mat ) 
    192207 
    193208      !                                         ! Mean density anomalie, temperature and salinity 
  • branches/UKMO/CO6_shelfclimate/NEMOGCM/NEMO/OPA_SRC/DIA/diadct.F90

    r7567 r7572  
    3434  USE dom_oce         ! ocean space and time domain 
    3535  USE phycst          ! physical constants 
    36   USE in_out_manager  ! I/O manager 
     36  USE in_out_manager  ! I/O units 
     37  USE iom             ! I/0 library 
    3738  USE daymod          ! calendar 
    3839  USE dianam          ! build name of file 
     
    170171      
    171172      
    172      !NAMELIST/namdct/nn_dct,nn_dctwri,nn_secdebug 
    173  
    174      !IF( nn_timing == 1 )   CALL timing_start('dia_dct_init') 
    175  
    176      !read namelist 
    177      !REWIND( numnam ) 
    178      !READ  ( numnam, namdct ) 
    179173 
    180174     IF( ln_NOOS ) THEN 
     
    214208     CALL readsec 
    215209      
    216      !IF (lwp) write(numout,*) 'dct after readsec' 
    217210      
    218211 
     
    277270      
    278271      
    279      !WRITE(numout,*) "diadct ind ii: ",kt,nproc, narea, mig(1),mig(jpi),nlci 
    280      !WRITE(numout,*) "diadct ind jj: ",kt,nproc, narea, mjg(1),mig(jpj),nlcj 
    281272 
    282273      
     
    319310           CALL transport(secs(jsec),lldebug,jsec)  
    320311            
    321            !IF( lwp ) WRITE(numout,*) "diadct: call transport subroutine (kt, jsec) : ",kt,jsec 
    322312 
    323313        ENDDO 
    324         !IF( lwp ) WRITE(numout,*) "diadct: called transport subroutine (kt, nb_sec) : ",kt, nb_sec 
    325314              
    326315        IF( MOD(kt,nn_dctwri)==0 )THEN 
     
    368357     ENDIF 
    369358     IF ( MOD(kt,nn_dct_h)==0 ) THEN            ! compute transport every nn_dct_h time steps 
    370      !IF ( MOD(kt,nn_dct)==0 .or. &               ! compute transport every nn_dct time steps 
    371      !    (ln_NOOS .and. kt==nn_it000 ) )  THEN   ! also include first time step when calculating NOOS 25 hour averages 
    372359 
    373360        DO jsec=1,nb_sec 
     
    409396 
    410397              IF( lwp .and. ln_NOOS ) THEN 
    411                 !WRITE(numout,*) "diadct: call dia_dct_wri_NOOS_h (kt,nn_dctwri_h, kt/nn_dctwri_h,jsec) : ",kt,nn_dctwri_h, kt/nn_dctwri_h,jsec 
    412398                CALL dia_dct_wri_NOOS_h(kt/nn_dctwri_h,jsec,secs(jsec))   ! use NOOS specific formatting 
    413                 !WRITE(numout,*) "diadct: called dia_dct_wri_NOOS_h (kt,jsec) : ",kt,jsec 
    414399              endif 
    415400              !nullify transports values after writing 
     
    466451     !open input file 
    467452     !--------------- 
    468      !IF (lwp) THEN 
    469        !write(numout,*) 'dct low-level pre open: little endian ' 
    470        !OPEN(UNIT=107,FILE='section_ijglobal.diadct', FORM='UNFORMATTED', ACCESS='SEQUENTIAL', STATUS='OLD',convert='LITTLE_ENDIAN') 
    471         
    472        write(numout,*) 'dct low-level pre open: big endian :',nproc,narea 
    473        OPEN(UNIT=107,FILE='section_ijglobal.diadct', FORM='UNFORMATTED', ACCESS='SEQUENTIAL', STATUS='OLD',convert='BIG_ENDIAN') 
    474         
    475        !write(numout,*) 'dct low-level pre open: SWAP ' 
    476        !OPEN(UNIT=107,FILE='section_ijglobal.diadct', FORM='UNFORMATTED', ACCESS='SEQUENTIAL', STATUS='OLD',convert='SWAP') 
    477         
    478        !write(numout,*) 'dct low-level pre open: NATIVE ' 
    479        !OPEN(UNIT=107,FILE='section_ijglobal.diadct', FORM='UNFORMATTED', ACCESS='SEQUENTIAL', STATUS='OLD',convert='NATIVE') 
    480         
    481        write(numout,*) 'dct low-level opened :',nproc,narea 
    482        READ(107) isec 
    483        write(numout,*) 'dct low-level isec ', isec,nproc,narea 
    484        CLOSE(107) 
    485      !ENDIF 
    486       
     453     !write(numout,*) 'dct low-level pre open: little endian ' 
     454     !OPEN(UNIT=107,FILE='section_ijglobal.diadct', FORM='UNFORMATTED', ACCESS='SEQUENTIAL', STATUS='OLD',convert='LITTLE_ENDIAN') 
     455      
     456     write(numout,*) 'dct low-level pre open: big endian :',nproc,narea 
     457     OPEN(UNIT=107,FILE='section_ijglobal.diadct', FORM='UNFORMATTED', ACCESS='SEQUENTIAL', STATUS='OLD',convert='BIG_ENDIAN') 
     458      
     459     !write(numout,*) 'dct low-level pre open: SWAP ' 
     460     !OPEN(UNIT=107,FILE='section_ijglobal.diadct', FORM='UNFORMATTED', ACCESS='SEQUENTIAL', STATUS='OLD',convert='SWAP') 
     461      
     462     !write(numout,*) 'dct low-level pre open: NATIVE ' 
     463     !OPEN(UNIT=107,FILE='section_ijglobal.diadct', FORM='UNFORMATTED', ACCESS='SEQUENTIAL', STATUS='OLD',convert='NATIVE') 
     464      
     465     READ(107) isec 
     466     CLOSE(107) 
    487467      
    488468     CALL ctl_opn( numdct_in, 'section_ijglobal.diadct', 'OLD', 'UNFORMATTED', 'SEQUENTIAL', -1, numout, .TRUE. ) 
     
    501481        !--------------- 
    502482        secs(jsec)%name='' 
    503         !IF( lwp )  write(numout,*)  secs(jsec)%name 
    504483        secs(jsec)%llstrpond      = .FALSE. 
    505         !IF( lwp )  write(numout,*) secs(jsec)%llstrpond  
    506484        secs(jsec)%ll_ice_section = .FALSE. 
    507         !IF( lwp )  write(numout,*) secs 
    508485        secs(jsec)%ll_date_line   = .FALSE. 
    509         !IF( lwp )  write(numout,*) secs(jsec)%ll_date_line 
    510486        secs(jsec)%nb_class       = 0 
    511         !IF( lwp )  write(numout,*) secs(jsec)%nb_class 
    512487        secs(jsec)%zsigi          = 99._wp 
    513         !IF( lwp )  write(numout,*) secs(jsec)%zsigi 
    514488        secs(jsec)%zsigp          = 99._wp 
    515         !IF( lwp )  write(numout,*)  secs(jsec)%zsigp 
    516489        secs(jsec)%zsal           = 99._wp 
    517         !IF( lwp )  write(numout,*) secs(jsec)%zsal 
    518490        secs(jsec)%ztem           = 99._wp 
    519         !IF( lwp )  write(numout,*) secs(jsec)%ztem 
    520491        secs(jsec)%zlay           = 99._wp 
    521         !IF( lwp )  write(numout,*) secs(jsec)%zlay 
    522492        secs(jsec)%transport      =  0._wp 
    523         !IF( lwp )  write(numout,*) secs(jsec)%transport 
    524493        secs(jsec)%transport_h    =  0._wp 
    525         !IF( lwp )  write(numout,*) secs(jsec)%transport_h 
    526494        secs(jsec)%nb_point       = 0 
    527         !IF( lwp )  write(numout,*) secs(jsec)%nb_point  
    528495 
    529496        !read section's number / name / computing choices / classes / slopeSection / points number 
    530497        !----------------------------------------------------------------------------------------- 
    531498         
    532         !write(numout,*) 'dct isec ', isec 
    533         !write(numout,*) 'dct numdct_in ', numdct_in 
    534499        READ(numdct_in,iostat=iost) isec 
    535         !write(numout,*) 'dct iost ', iost 
    536         !IF (iost .NE. 0 ) EXIT 
    537500        IF (iost .NE. 0 ) then 
    538501          write(numout,*) 'unable to read section_ijglobal.diadct. iost = ',iost 
    539           !nb_sec = 2 
    540502          EXIT !end of file  
    541503        ENDIF 
    542504         
    543         !write(numout,*) 'dct isec', isec 
    544505         
    545506        WRITE(cltmp,'(a,i4.4,a,i4.4)')'diadct: read sections : Problem of section number: isec= ',isec,' and jsec= ',jsec 
    546         !WRITE(numout,'(a,i4.4,a,i4.4)')'diadct: read sections : Problem of section number: isec= ',isec,' and jsec= ',jsec 
    547          
    548         !write(numout,*) 'dct isec, jsec', isec,jsec 
    549507         
    550508         
    551509        IF( jsec .NE. isec )  CALL ctl_stop( cltmp ) 
    552  
    553         !IF( lwp .AND. ( jsec==nn_secdebug .OR. nn_secdebug==-1 ) )WRITE(numout,*)"isec ",isec  
    554510 
    555511        READ(numdct_in)secs(jsec)%name 
     
    599555              coordtemp(jpt)%I = i1  
    600556              coordtemp(jpt)%J = i2 
    601               !WRITE(numout,*)'diadct: coordtemp:', jpt,i1,i2 
    602557           ENDDO 
    603558           READ(numdct_in)directemp(1:iptglo) 
     
    622577              IF( iiglo==jpidta .AND. nimpp==1 ) iiglo = 2 
    623578               
    624               !WRITE(numout,*)"diadct readsec: reg/glo domain:",narea,nlci,nimpp,mig(1),nlcj,njmpp,mjg(1) 
    625  
    626       !diadct init: reg/glo domain: 3*1,  24,  22,  24,  22,  2*1 
    627579              iiloc=iiglo-jpizoom+1-nimpp+1   ! local coordinates of the point 
    628580              ijloc=ijglo-jpjzoom+1-njmpp+1   !  " 
    629               !WRITE(numout,*)"      List of limits of each processor:",jpt,nimpp,iiloc,iiglo,jpizoom+1,nimpp+1,ijloc,ijglo,jpjzoom+1,njmpp+1,nlei,nlej 
    630  
    631                 
    632               !WRITE(*,*)"diadct readsec: ii: ",narea, jpt,iiglo,mig(1),mig(jpi),nlci 
    633               !WRITE(*,*)"diadct readsec: jj: ",narea, jpt,ijglo,mjg(1),mjg(jpj),nlcj 
    634               !WRITE(*,*)"diadct readsec: log: ",narea, iiglo .GE. mig(1),iiglo .LE. mig(1)+nlci-1 ,ijglo .GE. mjg(1),ijglo .LE. mjg(1)+nlcj-1   
    635               !WRITE(*,*)"diadct readsec: log: ",narea, iiglo .GE. mig(1),iiglo .LE. mig(jpi),ijglo .GE. mjg(1),ijglo .LE. mjg(jpj) 
     581 
    636582              !verify if the point is on the local domain:(1,nlei)*(1,nlej) 
    637583              IF( iiloc .GE. 1 .AND. iiloc .LE. nlei .AND. & 
    638                   ijloc .GE. 1 .AND. ijloc .LE. nlej       )THEN 
    639               !IF( iiglo .GE. mig(1) .AND. iiglo .LE. mig(1)+nlci-1 .AND. & 
    640               !    ijglo .GE. mjg(1) .AND. ijglo .LE. mjg(1)+nlcj-1       )THEN 
    641                    
    642                    
    643               !IF( iiglo .GE. mig(1) .AND. iiglo .LE. mig(jpi) .AND. & 
    644               !    ijglo .GE. mjg(1) .AND. ijglo .LE. mjg(jpj)       )THEN 
     584              ijloc .GE. 1 .AND. ijloc .LE. nlej       )THEN 
     585 
    645586                  WRITE(*,*)"diadct readsec: assigned proc!",narea,nproc,jpt 
    646587                   
     
    709650     ENDDO !end of the loop on jsec 
    710651      
    711      !IF (lwp) write(numout,*) 'dct end of readsec loop, after exit' 
    712   
    713652     nb_sec = jsec-1   !number of section read in the file 
    714653 
    715654     CALL wrk_dealloc( nb_point_max, directemp ) 
    716       
    717      !IF (lwp) write(numout,*) 'dct after dealloc' 
    718       
    719655     ! 
    720656  END SUBROUTINE readsec 
     
    11501086              END SELECT 
    11511087 
    1152               !JT zfsdep= gdept(k%I,k%J,jk) 
    1153               !JT zfsdep= gdept_0(k%I,k%J,jk) 
    11541088              zfsdep= fsdept(k%I,k%J,jk) 
    11551089  
     
    13241258              END SELECT 
    13251259 
    1326               !JT zfsdep= gdept(k%I,k%J,jk) 
    1327               !JT zfsdep= gdept_0(k%I,k%J,jk) 
    13281260              zfsdep= fsdept(k%I,k%J,jk)  
    13291261  
     
    15411473              END SELECT 
    15421474 
    1543               !JT zfsdep= gdept(k%I,k%J,jk) 
    1544               !JT zfsdep= gdept_0(k%I,k%J,jk) 
    15451475              zfsdep= fsdept(k%I,k%J,jk) 
    15461476  
     
    16861616     INTEGER               :: jclass,ji             ! Dummy loop 
    16871617     CHARACTER(len=2)      :: classe             ! Classname  
     1618      
    16881619     REAL(wp)              :: zbnd1,zbnd2        ! Class bounds 
    16891620     REAL(wp)              :: zslope             ! section's slope coeff 
    16901621     ! 
    16911622     REAL(wp), POINTER, DIMENSION(:):: zsumclasses ! 1D workspace  
     1623     CHARACTER(len=3)      :: noos_sect_name             ! Classname  
     1624     REAL(wp), ALLOCATABLE, DIMENSION(:,:,:) ::   noos_iom_dummy 
     1625     INTEGER               :: IERR 
     1626      
    16921627     !!-------------------------------------------------------------  
    16931628      
     
    17131648     zbnd1   = 0._wp 
    17141649     zbnd2   = 0._wp 
    1715  
     1650      
     1651      
     1652      
     1653     write (noos_sect_name, "(I0.3)")  ksec 
     1654      
     1655     !ALLOCATE( noos_iom_dummy(jpi,jpj,1),  STAT= ierr ) 
     1656     !   IF( ierr /= 0 )   CALL ctl_stop( 'dia_dct_wri_NOOS: failed to allocate noos_iom_dummy array' ) 
     1657         
     1658         
     1659!      ALLOCATE( noos_iom_dummy(jpi,jpj,9),  STAT= ierr ) 
     1660!         IF( ierr /= 0 )   CALL ctl_stop( 'dia_dct_wri_NOOS: failed to allocate noos_iom_dummy array' ) 
     1661 
     1662     ALLOCATE( noos_iom_dummy(jpi,jpj,3),  STAT= ierr ) 
     1663        IF( ierr /= 0 )   CALL ctl_stop( 'dia_dct_wri_NOOS: failed to allocate noos_iom_dummy array' ) 
     1664         
     1665      
     1666 
     1667     !IF( lwp ) THEN 
     1668     ! 
     1669     !   WRITE(numout,*) "dia_dct_wri_NOOS: kt, jpi,jpj,3", kt, jpi,jpj,3 
     1670     ! 
     1671     !ENDIF 
    17161672     IF ( zslope .gt. 0._wp .and. zslope .ne. 10000._wp ) THEN 
    17171673        WRITE(numdct_NOOS,'(9e12.4E2)') -(zsumclasses( 1)+zsumclasses( 2)), -zsumclasses( 2),-zsumclasses( 1),   & 
    17181674                                        -(zsumclasses( 7)+zsumclasses( 8)), -zsumclasses( 8),-zsumclasses( 7),   & 
    17191675                                        -(zsumclasses( 9)+zsumclasses(10)), -zsumclasses(10),-zsumclasses( 9) 
     1676!           
     1677!          noos_iom_dummy(:,:,:) = 0. 
     1678!           
     1679!          noos_iom_dummy(:,:,1) = -(zsumclasses( 1)+zsumclasses( 2)) 
     1680!          noos_iom_dummy(:,:,2) = -zsumclasses( 2) 
     1681!          noos_iom_dummy(:,:,3) = -zsumclasses( 1) 
     1682!          noos_iom_dummy(:,:,4) = -(zsumclasses( 7)+zsumclasses( 8)) 
     1683!          noos_iom_dummy(:,:,5) = -zsumclasses( 8) 
     1684!          noos_iom_dummy(:,:,6) = -zsumclasses( 7) 
     1685!          noos_iom_dummy(:,:,7) = -(zsumclasses( 9)+zsumclasses( 10)) 
     1686!          noos_iom_dummy(:,:,8) = -zsumclasses( 10) 
     1687!          noos_iom_dummy(:,:,9) = -zsumclasses( 9) 
     1688!           
     1689!          CALL iom_put( "noos_" // trim(noos_sect_name),  noos_iom_dummy )   
     1690!          noos_iom_dummy(:,:,:) = 0. 
     1691!           
     1692          
     1693          
     1694          
     1695         noos_iom_dummy(:,:,:) = 0. 
     1696          
     1697         noos_iom_dummy(:,:,1) = -(zsumclasses( 1)+zsumclasses( 2)) 
     1698         noos_iom_dummy(:,:,2) = -zsumclasses( 2) 
     1699         noos_iom_dummy(:,:,3) = -zsumclasses( 1) 
     1700         !IF( lwp ) WRITE(numout,*) "dia_dct_wri_NOOS +ve : kt, trans", kt, & 
     1701         !   & noos_iom_dummy(10,10,1), noos_iom_dummy(10,10,2), noos_iom_dummy(10,10,3)          
     1702      !CALL iom_put( "noos_" // trim(noos_sect_name) // '_trans',  noos_iom_dummy ) 
     1703         noos_iom_dummy(:,:,:) = 0. 
     1704          
     1705         noos_iom_dummy(:,:,1) = -(zsumclasses( 7)+zsumclasses( 8)) 
     1706         noos_iom_dummy(:,:,2) = -zsumclasses( 8) 
     1707         noos_iom_dummy(:,:,3) = -zsumclasses( 7) 
     1708         !IF( lwp ) WRITE(numout,*) "dia_dct_wri_NOOS +ve : kt, heat", kt, & 
     1709         !   & noos_iom_dummy(10,10,1), noos_iom_dummy(10,10,2), noos_iom_dummy(10,10,3)          
     1710      !CALL iom_put( "noos_" // trim(noos_sect_name) // '_heat',  noos_iom_dummy ) 
     1711         noos_iom_dummy(:,:,:) = 0. 
     1712          
     1713         noos_iom_dummy(:,:,1) = -(zsumclasses( 9)+zsumclasses( 10)) 
     1714         noos_iom_dummy(:,:,2) = -zsumclasses( 10) 
     1715         noos_iom_dummy(:,:,3) = -zsumclasses( 9) 
     1716         !IF( lwp ) WRITE(numout,*) "dia_dct_wri_NOOS +ve : kt, salt", kt, & 
     1717         !   & noos_iom_dummy(10,10,1), noos_iom_dummy(10,10,2), noos_iom_dummy(10,10,3)          
     1718      !CALL iom_put( "noos_" // trim(noos_sect_name) // '_salt',  noos_iom_dummy ) 
     1719         noos_iom_dummy(:,:,:) = 0. 
     1720          
     1721          
     1722!           
     1723!          noos_iom_dummy(:,:,:) = 0. 
     1724!           
     1725!          noos_iom_dummy(:,:,1) = -(zsumclasses( 1)+zsumclasses( 2)) 
     1726!          CALL iom_put( "noos_" // trim(noos_sect_name) // '_trans_tot',  noos_iom_dummy ) 
     1727!          noos_iom_dummy(:,:,:) = 0. 
     1728!           
     1729!          noos_iom_dummy(:,:,1) = -zsumclasses( 2) 
     1730!          CALL iom_put( "noos_" // trim(noos_sect_name) // '_trans_pos',  noos_iom_dummy ) 
     1731!          noos_iom_dummy(:,:,:) = 0. 
     1732!           
     1733!          noos_iom_dummy(:,:,1) = -zsumclasses( 1) 
     1734!          CALL iom_put( "noos_" // trim(noos_sect_name) // '_trans_neg',  noos_iom_dummy ) 
     1735!          noos_iom_dummy(:,:,:) = 0. 
     1736!           
     1737!          noos_iom_dummy(:,:,1) = -(zsumclasses( 7)+zsumclasses( 8)) 
     1738!          CALL iom_put( "noos_" // trim(noos_sect_name) // '_heat_tot',  noos_iom_dummy ) 
     1739!          noos_iom_dummy(:,:,:) = 0. 
     1740!           
     1741!          noos_iom_dummy(:,:,1) = -zsumclasses( 8) 
     1742!          CALL iom_put( "noos_" // trim(noos_sect_name) // '_heat_pos',  noos_iom_dummy ) 
     1743!          noos_iom_dummy(:,:,:) = 0. 
     1744!           
     1745!          noos_iom_dummy(:,:,1) = -zsumclasses( 7) 
     1746!          CALL iom_put( "noos_" // trim(noos_sect_name) // '_heat_neg',  noos_iom_dummy ) 
     1747!          noos_iom_dummy(:,:,:) = 0. 
     1748!           
     1749!          noos_iom_dummy(:,:,1) = -(zsumclasses( 9)+zsumclasses( 10)) 
     1750!          CALL iom_put( "noos_" // trim(noos_sect_name) // '_salt_tot',  noos_iom_dummy ) 
     1751!          noos_iom_dummy(:,:,:) = 0. 
     1752!           
     1753!          noos_iom_dummy(:,:,1) = -zsumclasses( 10) 
     1754!          CALL iom_put( "noos_" // trim(noos_sect_name) // '_salt_pos',  noos_iom_dummy ) 
     1755!          noos_iom_dummy(:,:,:) = 0. 
     1756!           
     1757!          noos_iom_dummy(:,:,1) = -zsumclasses( 9) 
     1758!          CALL iom_put( "noos_" // trim(noos_sect_name) // '_salt_neg',  noos_iom_dummy ) 
     1759!          noos_iom_dummy(:,:,:) = 0. 
     1760!           
     1761          
     1762          
    17201763     ELSE 
    17211764        WRITE(numdct_NOOS,'(9e12.4E2)')   zsumclasses( 1)+zsumclasses( 2) ,  zsumclasses( 1), zsumclasses( 2),   & 
    17221765                                          zsumclasses( 7)+zsumclasses( 8) ,  zsumclasses( 7), zsumclasses( 8),   & 
    17231766                                          zsumclasses( 9)+zsumclasses(10) ,  zsumclasses( 9), zsumclasses(10) 
     1767                                           
     1768                                           
     1769                                           
     1770!                                            
     1771!          noos_iom_dummy(:,:,:) = 0. 
     1772!           
     1773!          noos_iom_dummy(:,:,1) = (zsumclasses( 1)+zsumclasses( 2)) 
     1774!          noos_iom_dummy(:,:,2) = zsumclasses( 1) 
     1775!          noos_iom_dummy(:,:,3) = zsumclasses( 2) 
     1776!          noos_iom_dummy(:,:,4) = (zsumclasses( 7)+zsumclasses( 8)) 
     1777!          noos_iom_dummy(:,:,5) = zsumclasses( 7) 
     1778!          noos_iom_dummy(:,:,6) = zsumclasses( 8) 
     1779!          noos_iom_dummy(:,:,7) = (zsumclasses( 9)+zsumclasses( 10)) 
     1780!          noos_iom_dummy(:,:,8) = zsumclasses( 9) 
     1781!          noos_iom_dummy(:,:,9) = zsumclasses( 10) 
     1782!           
     1783!          CALL iom_put( "noos_" // trim(noos_sect_name),  noos_iom_dummy )   
     1784          
     1785          
     1786          
     1787          
     1788         noos_iom_dummy(:,:,1) = (zsumclasses( 1)+zsumclasses( 2)) 
     1789         noos_iom_dummy(:,:,2) = zsumclasses( 1) 
     1790         noos_iom_dummy(:,:,3) = zsumclasses( 2) 
     1791         !IF( lwp ) WRITE(numout,*) "dia_dct_wri_NOOS -ve : kt, trans", kt, & 
     1792         !   & noos_iom_dummy(10,10,1), noos_iom_dummy(10,10,2), noos_iom_dummy(10,10,3) 
     1793      !CALL iom_put( "noos_" // trim(noos_sect_name) // '_trans',  noos_iom_dummy ) 
     1794         noos_iom_dummy(:,:,:) = 0. 
     1795          
     1796         noos_iom_dummy(:,:,1) = (zsumclasses( 7)+zsumclasses( 8)) 
     1797         noos_iom_dummy(:,:,2) = zsumclasses( 7) 
     1798         noos_iom_dummy(:,:,3) = zsumclasses( 8) 
     1799         !IF( lwp ) WRITE(numout,*) "dia_dct_wri_NOOS -ve : kt, heat", kt, & 
     1800         !   & noos_iom_dummy(10,10,1), noos_iom_dummy(10,10,2), noos_iom_dummy(10,10,3) 
     1801      !CALL iom_put( "noos_" // trim(noos_sect_name) // '_heat',  noos_iom_dummy )       
     1802         noos_iom_dummy(:,:,:) = 0. 
     1803          
     1804         noos_iom_dummy(:,:,1) = (zsumclasses( 9)+zsumclasses( 10)) 
     1805         noos_iom_dummy(:,:,2) = zsumclasses( 9) 
     1806         noos_iom_dummy(:,:,3) = zsumclasses( 10) 
     1807         !IF( lwp ) WRITE(numout,*) "dia_dct_wri_NOOS -ve : kt, salt", kt, & 
     1808         !   & noos_iom_dummy(10,10,1), noos_iom_dummy(10,10,2), noos_iom_dummy(10,10,3) 
     1809      !CALL iom_put( "noos_" // trim(noos_sect_name) // '_salt',  noos_iom_dummy ) 
     1810         noos_iom_dummy(:,:,:) = 0. 
     1811          
     1812!                                            
     1813!                                            
     1814!           
     1815!          noos_iom_dummy(:,:,1) = (zsumclasses( 1)+zsumclasses( 2)) 
     1816!          CALL iom_put( "noos_" // trim(noos_sect_name) // '_trans_tot',  noos_iom_dummy ) 
     1817!          noos_iom_dummy(:,:,:) = 0. 
     1818!           
     1819!          noos_iom_dummy(:,:,1) = zsumclasses( 1) 
     1820!          CALL iom_put( "noos_" // trim(noos_sect_name) // '_trans_pos',  noos_iom_dummy ) 
     1821!          noos_iom_dummy(:,:,:) = 0. 
     1822!           
     1823!          noos_iom_dummy(:,:,1) = zsumclasses( 2) 
     1824!          CALL iom_put( "noos_" // trim(noos_sect_name) // '_trans_neg',  noos_iom_dummy ) 
     1825!          noos_iom_dummy(:,:,:) = 0. 
     1826!           
     1827!          noos_iom_dummy(:,:,1) = (zsumclasses( 7)+zsumclasses( 8)) 
     1828!          CALL iom_put( "noos_" // trim(noos_sect_name) // '_heat_tot',  noos_iom_dummy ) 
     1829!          noos_iom_dummy(:,:,:) = 0. 
     1830!           
     1831!          noos_iom_dummy(:,:,1) = zsumclasses( 7) 
     1832!          CALL iom_put( "noos_" // trim(noos_sect_name) // '_heat_pos',  noos_iom_dummy ) 
     1833!          noos_iom_dummy(:,:,:) = 0. 
     1834!           
     1835!          noos_iom_dummy(:,:,1) = zsumclasses( 8) 
     1836!          CALL iom_put( "noos_" // trim(noos_sect_name) // '_heat_neg',  noos_iom_dummy ) 
     1837!          noos_iom_dummy(:,:,:) = 0. 
     1838!           
     1839!          noos_iom_dummy(:,:,1) = (zsumclasses( 9)+zsumclasses( 10)) 
     1840!          CALL iom_put( "noos_" // trim(noos_sect_name) // '_salt_tot',  noos_iom_dummy ) 
     1841!          noos_iom_dummy(:,:,:) = 0. 
     1842!           
     1843!          noos_iom_dummy(:,:,1) = zsumclasses( 9) 
     1844!          CALL iom_put( "noos_" // trim(noos_sect_name) // '_salt_pos',  noos_iom_dummy ) 
     1845!          noos_iom_dummy(:,:,:) = 0. 
     1846!           
     1847!          noos_iom_dummy(:,:,1) = zsumclasses( 10) 
     1848!          CALL iom_put( "noos_" // trim(noos_sect_name) // '_salt_neg',  noos_iom_dummy ) 
     1849!          noos_iom_dummy(:,:,:) = 0. 
     1850          
    17241851     ENDIF  
     1852      
     1853      
     1854      DEALLOCATE(noos_iom_dummy) 
    17251855 
    17261856     DO jclass=1,MAX(1,sec%nb_class-1) 
     
    17791909     ENDDO 
    17801910      
    1781      !CALL FLUSH(numdct_NOOS) 
     1911     CALL FLUSH(numdct_NOOS) 
    17821912 
    17831913     CALL wrk_dealloc(nb_type , zsumclasses )   
     
    18101940     ! 
    18111941     REAL(wp), POINTER, DIMENSION(:):: zsumclasses ! 1D workspace  
     1942     CHARACTER(len=3)      :: noos_sect_name             ! Classname  
     1943     REAL(wp), ALLOCATABLE, DIMENSION(:,:) ::   noos_iom_dummy 
     1944     INTEGER               :: IERR 
     1945      
    18121946     !!-------------------------------------------------------------  
    18131947 
     
    18191953      
    18201954     CALL wrk_alloc(nb_type , zsumclasses )  
     1955      
     1956      
     1957     write (noos_sect_name, "(I03)")  ksec 
     1958      
     1959     ALLOCATE( noos_iom_dummy(jpi,jpj),  STAT= ierr ) 
     1960        IF( ierr /= 0 )   CALL ctl_stop( 'dia_dct_wri_NOOS_h: failed to allocate noos_iom_dummy array' ) 
     1961 
     1962 
     1963 
     1964      
    18211965 
    18221966     zsumclasses(:)=0._wp 
     
    18501994 
    18511995     CALL wrk_dealloc(nb_type , zsumclasses ) 
     1996      
     1997     DEALLOCATE(noos_iom_dummy) 
     1998 
     1999 
     2000 
     2001 
    18522002 
    18532003  END SUBROUTINE dia_dct_wri_NOOS_h 
     
    20692219  REAL(wp):: zet1, zet2                                        ! weight for interpolation  
    20702220  REAL(wp):: zdep1,zdep2                                       ! differences of depth 
    2071   REAL(wp):: zmsk                                              ! mask value 
    20722221  !!---------------------------------------------------------------------- 
    20732222 
     
    20782227     zet1=e1t(ii1,ij1) 
    20792228     zet2=e1t(ii2,ij2) 
    2080      zmsk=umask(ii1,ij1,kk) 
    20812229   
    20822230 
     
    20872235     zet1=e2t(ii1,ij1) 
    20882236     zet2=e2t(ii2,ij2) 
    2089      zmsk=vmask(ii1,ij1,kk) 
    20902237 
    20912238  ENDIF 
     
    21022249   
    21032250     ! result 
    2104      !JT interp = zmsk * ( zwgt2 *  ptab(ii1,ij1,kk) + zwgt1 *  ptab(ii1,ij1,kk) ) / ( zwgt2 + zwgt1 )    
    21052251     interp = umask(ii1,ij1,kk) * ( zwgt2 *  ptab(ii1,ij1,kk) + zwgt1 *  ptab(ii1,ij1,kk) ) / ( zwgt2 + zwgt1 )    
    21062252 
     
    21282274           zbis = ptab(ii2,ij2,kk) + zwgt1 * ( ptab(ii2,ij2,kk-1) - ptab(ii2,ij2,kk) )  
    21292275           ! result 
    2130             !JT interp = zmsk * ( zet2 * ptab(ii1,ij1,kk) + zet1 * zbis )/( zet1 + zet2 ) 
    21312276            interp = umask(ii1,ij1,kk) * ( zet2 * ptab(ii1,ij1,kk) + zet1 * zbis )/( zet1 + zet2 ) 
    21322277        ELSE 
     
    21342279           zbis = ptab(ii1,ij1,kk) + zwgt2 * ( ptab(ii1,ij1,kk-1) - ptab(ii1,ij2,kk) ) 
    21352280           ! result 
    2136            !JT interp = zmsk * ( zet2 * zbis + zet1 * ptab(ii2,ij2,kk) )/( zet1 + zet2 ) 
    21372281           interp = umask(ii1,ij1,kk) * ( zet2 * zbis + zet1 * ptab(ii2,ij2,kk) )/( zet1 + zet2 ) 
    21382282        ENDIF     
    21392283 
    21402284     ELSE 
    2141         !JT interp = zmsk * (  zet2 * ptab(ii1,ij1,kk) + zet1 * ptab(ii2,ij2,kk) )/( zet1 + zet2 ) 
    21422285        interp = umask(ii1,ij1,kk) * (  zet2 * ptab(ii1,ij1,kk) + zet1 * ptab(ii2,ij2,kk) )/( zet1 + zet2 ) 
    21432286     ENDIF 
  • branches/UKMO/CO6_shelfclimate/NEMOGCM/NEMO/OPA_SRC/DIA/diaregmean.F90

    r7567 r7572  
    1414   USE diapea          ! Top,middle,bottom output 
    1515   USE zdfmxl          ! MLD 
    16  
     16   USE sbc_oce 
     17#if defined key_diaar5  
     18   USE diaar5 
     19#endif 
    1720   IMPLICIT NONE 
    1821   PRIVATE 
     
    3134   LOGICAL :: ln_diaregmean_bin  ! region mean calculation binary output 
    3235   LOGICAL :: ln_diaregmean_nc  ! region mean calculation netcdf output 
     36   LOGICAL :: ln_diaregmean_diaar5  ! region mean calculation including AR5 SLR terms 
     37   LOGICAL :: ln_diaregmean_diasbc  ! region mean calculation including Surface BC 
     38   LOGICAL :: ln_diaregmean_karamld  ! region mean calculation including kara mld terms 
     39   LOGICAL :: ln_diaregmean_pea  ! region mean calculation including pea terms 
    3340    
    3441   REAL(wp), SAVE, ALLOCATABLE,   DIMENSION(:,:,:)  ::   tmp_region_mask_real   ! tempory region_mask of reals 
     
    3845    
    3946   REAL(wp),  ALLOCATABLE,   DIMENSION(:,:,:) ::   tmp_field_mat !: temporary region_mask 
     47   REAL(wp),  ALLOCATABLE,   DIMENSION(:,:,:) ::   tmp_field_karamld_mat !: temporary region_mask 
     48   REAL(wp),  ALLOCATABLE,   DIMENSION(:,:,:) ::   tmp_field_pea_mat !: temporary region_mask 
     49   REAL(wp),  ALLOCATABLE,   DIMENSION(:,:,:) ::   tmp_field_AR5_mat !: temporary region_mask 
     50   REAL(wp),  ALLOCATABLE,   DIMENSION(:,:,:) ::   tmp_field_SBC_mat !: temporary region_mask 
    4051   INTEGER  ::   tmp_field_cnt                                   ! tmp_field_cnt integer 
     52   INTEGER  ::   num_reg_vars                                    ! number of vars in regions mean 
    4153   !!---------------------------------------------------------------------- 
    4254   !! NEMO/OPA 3.6 , NEMO Consortium (2014) 
     
    6880      INTEGER               ::   zndims   ! number of dimensions in an array (i.e. 3, ) 
    6981      ! 
    70       NAMELIST/nam_diaregmean/ ln_diaregmean,ln_diaregmean_ascii,ln_diaregmean_bin,ln_diaregmean_nc 
     82      NAMELIST/nam_diaregmean/ ln_diaregmean,ln_diaregmean_ascii,ln_diaregmean_bin,ln_diaregmean_nc,& 
     83        & ln_diaregmean_karamld, ln_diaregmean_pea,ln_diaregmean_diaar5,ln_diaregmean_diasbc 
     84       
    7185       
    7286      ! read in Namelist.  
     
    91105          WRITE(numout,*) 'Switch for regmean binary output (T) or not (F)  ln_diaregmean_bin  = ', ln_diaregmean_bin 
    92106          WRITE(numout,*) 'Switch for regmean netcdf output (T) or not (F)  ln_diaregmean_nc  = ', ln_diaregmean_nc 
     107          WRITE(numout,*) 'Switch for regmean kara mld terms (T) or not (F)  ln_diaregmean_karamld  = ', ln_diaregmean_karamld 
     108          WRITE(numout,*) 'Switch for regmean PEA terms (T) or not (F)  ln_diaregmean_pea  = ', ln_diaregmean_pea 
     109          WRITE(numout,*) 'Switch for regmean AR5 SLR terms (T) or not (F)  ln_diaregmean_diaar5  = ', ln_diaregmean_diaar5 
     110          WRITE(numout,*) 'Switch for regmean Surface forcing terms (T) or not (F)  ln_diaregmean_diasbc  = ', ln_diaregmean_diasbc 
    93111      ENDIF 
    94112       
    95       !ALLOCATE( tmp_field_mat(jpi,jpj,9),  STAT= ierr ) 
    96       !ALLOCATE( tmp_field_mat(jpi,jpj,7),  STAT= ierr ) !SS/NB/DT T/S, SSH 
    97       !ALLOCATE( tmp_field_mat(jpi,jpj,8),  STAT= ierr ) !SS/NB/DT T/S, SSH, MLD 
    98       ALLOCATE( tmp_field_mat(jpi,jpj,11),  STAT= ierr ) !SS/NB/DT T/S, SSH, MLD, PEA, PEAT, PEAS 
     113      num_reg_vars = 7 
     114       
     115      ALLOCATE( tmp_field_mat(jpi,jpj,num_reg_vars),  STAT= ierr ) !SS/NB/DT T/S, SSH, MLD, PEA, PEAT, PEAS 
    99116          IF( ierr /= 0 )   CALL ctl_stop( 'tmp_field_mat: failed to allocate tmp_region_mask_real array' ) 
    100117      tmp_field_mat(:,:,:) = 0. 
    101118      tmp_field_cnt = 0 
     119       
     120      IF(ln_diaregmean_karamld) THEN    
     121        ALLOCATE( tmp_field_karamld_mat(jpi,jpj,1),  STAT= ierr ) !SS/NB/DT T/S, SSH, MLD, PEA, PEAT, PEAS 
     122            IF( ierr /= 0 )   CALL ctl_stop( 'tmp_field_karamld_mat: failed to allocate tmp_region_mask_real array' ) 
     123        tmp_field_karamld_mat(:,:,:) = 0. 
     124      ENDIF 
     125       
     126      IF(ln_diaregmean_pea) THEN    
     127        ALLOCATE( tmp_field_pea_mat(jpi,jpj,3),  STAT= ierr ) !SS/NB/DT T/S, SSH, MLD, PEA, PEAT, PEAS 
     128            IF( ierr /= 0 )   CALL ctl_stop( 'tmp_field_pea_mat: failed to allocate tmp_region_mask_real array' ) 
     129        tmp_field_pea_mat(:,:,:) = 0. 
     130      ENDIF 
     131       
     132      IF(ln_diaregmean_diaar5) THEN    
     133        ALLOCATE( tmp_field_AR5_mat(jpi,jpj,4),  STAT= ierr ) !SS/NB/DT T/S, SSH, MLD, PEA, PEAT, PEAS 
     134            IF( ierr /= 0 )   CALL ctl_stop( 'tmp_field_AR5_mat: failed to allocate tmp_region_mask_real array' ) 
     135        tmp_field_AR5_mat(:,:,:) = 0. 
     136      ENDIF 
     137       
     138      IF(ln_diaregmean_diasbc) THEN    
     139        ALLOCATE( tmp_field_SBC_mat(jpi,jpj,7),  STAT= ierr ) !SS/NB/DT T/S, SSH, MLD, PEA, PEAT, PEAS 
     140            IF( ierr /= 0 )   CALL ctl_stop( 'tmp_field_SBC_mat: failed to allocate tmp_region_mask_real array' ) 
     141        tmp_field_SBC_mat(:,:,:) = 0. 
     142      ENDIF 
     143       
     144       
     145       
     146       
    102147       
    103148      IF (ln_diaregmean) THEN 
     
    272317          tmp_field_mat(:,:,6) = tmp_field_mat(:,:,6) + zwtmbS(:,:,3) 
    273318          tmp_field_mat(:,:,7) = tmp_field_mat(:,:,7) + sshn(:,:) 
    274           tmp_field_mat(:,:,8) = tmp_field_mat(:,:,8) + hmld_kara(:,:)!hmlp(:,:) 
    275           tmp_field_mat(:,:,9) = tmp_field_mat(:,:,9) + pea(:,:) 
    276           tmp_field_mat(:,:,10) = tmp_field_mat(:,:,10) + peat(:,:) 
    277           tmp_field_mat(:,:,11) = tmp_field_mat(:,:,11) + peas(:,:) 
    278            
    279            
    280           !tmp_field_mat(:,:,1) = tmp_field_mat(:,:,1) + zwtmbT(:,:,1) 
    281           !tmp_field_mat(:,:,2) = tmp_field_mat(:,:,2) + zwtmbT(:,:,2) 
    282           !tmp_field_mat(:,:,3) = tmp_field_mat(:,:,3) + zwtmbT(:,:,3) 
    283           !tmp_field_mat(:,:,4) = tmp_field_mat(:,:,4) + zwtmbT(:,:,4) 
    284           !tmp_field_mat(:,:,5) = tmp_field_mat(:,:,5) + zwtmbS(:,:,1) 
    285           !tmp_field_mat(:,:,6) = tmp_field_mat(:,:,6) + zwtmbS(:,:,2) 
    286           !tmp_field_mat(:,:,7) = tmp_field_mat(:,:,7) + zwtmbS(:,:,3) 
    287           !tmp_field_mat(:,:,8) = tmp_field_mat(:,:,8) + zwtmbS(:,:,4) 
    288           !tmp_field_mat(:,:,9) = tmp_field_mat(:,:,9) + sshn(:,:) 
     319           
     320          IF( ln_diaregmean_karamld  ) THEN 
     321            tmp_field_karamld_mat(:,:,1) = tmp_field_karamld_mat(:,:,1) + hmld_kara(:,:)!hmlp(:,:) 
     322          ENDIF 
     323           
     324          IF( ln_diaregmean_pea  ) THEN 
     325            tmp_field_pea_mat(:,:,1) = tmp_field_pea_mat(:,:,1) + pea(:,:) 
     326            tmp_field_pea_mat(:,:,2) = tmp_field_pea_mat(:,:,2) + peat(:,:) 
     327            tmp_field_pea_mat(:,:,3) = tmp_field_pea_mat(:,:,3) + peas(:,:) 
     328          ENDIF 
     329           
     330           
     331          IF( ln_diaregmean_diaar5  ) THEN 
     332            tmp_field_AR5_mat(:,:,1) = tmp_field_AR5_mat(:,:,1) + sshsteric_mat(:,:) 
     333            tmp_field_AR5_mat(:,:,2) = tmp_field_AR5_mat(:,:,2) + sshthster_mat(:,:) 
     334            tmp_field_AR5_mat(:,:,3) = tmp_field_AR5_mat(:,:,3) + sshhlster_mat(:,:) 
     335            tmp_field_AR5_mat(:,:,4) = tmp_field_AR5_mat(:,:,4) + zbotpres_mat(:,:) 
     336          ENDIF 
     337           
     338          IF( ln_diaregmean_diasbc  ) THEN 
     339           
     340            tmp_field_SBC_mat(:,:,1) = tmp_field_SBC_mat(:,:,1) + ((qsr  + qns)*tmask(:,:,1)) 
     341            tmp_field_SBC_mat(:,:,2) = tmp_field_SBC_mat(:,:,2) + (qsr*tmask(:,:,1)) 
     342            tmp_field_SBC_mat(:,:,3) = tmp_field_SBC_mat(:,:,3) + (qns*tmask(:,:,1)) 
     343            tmp_field_SBC_mat(:,:,4) = tmp_field_SBC_mat(:,:,4) + (emp*tmask(:,:,1)) 
     344            tmp_field_SBC_mat(:,:,5) = tmp_field_SBC_mat(:,:,5) + (wndm*tmask(:,:,1)) 
     345            tmp_field_SBC_mat(:,:,6) = tmp_field_SBC_mat(:,:,6) + (pressnow*tmask(:,:,1)) 
     346            tmp_field_SBC_mat(:,:,7) = tmp_field_SBC_mat(:,:,7) + (rnf*tmask(:,:,1)) 
     347             
     348          ENDIF 
    289349           
    290350          tmp_field_cnt = tmp_field_cnt + 1 
     
    292352          IF( MOD( kt, i_steps ) == 0  .and. kt .ne. nn_it000 ) THEN 
    293353 
    294                
    295                
    296               !CALL dia_wri_region_mean(kt, "sst" , tmp_field_mat(:,:,1)/real(tmp_field_cnt,wp))!,region_mask,nreg_mat(:,:,maskno),maskno,nreg_mat(maskno)  )    ! tmb Temperature 
    297               !!CALL dia_wri_region_mean(kt, "mdt" , tmp_field_mat(:,:,2)/real(tmp_field_cnt,wp))!,region_mask,nreg_mat(:,:,maskno),maskno,nreg_mat(maskno)  )    ! tmb Temperature 
    298               !CALL dia_wri_region_mean(kt, "nbt" , tmp_field_mat(:,:,3)/real(tmp_field_cnt,wp))!,region_mask,nreg_mat(:,:,maskno),maskno,nreg_mat(maskno)  )    ! tmb Temperature 
    299               !CALL dia_wri_region_mean(kt, "dft" , tmp_field_mat(:,:,4)/real(tmp_field_cnt,wp))!,region_mask,nreg_mat(:,:,maskno),maskno,nreg_mat(maskno)  )    ! tmb Temperature 
    300 ! 
    301 !              CALL dia_wri_region_mean(kt, "sss" , tmp_field_mat(:,:,5)/real(tmp_field_cnt,wp))!,region_mask,nreg_mat(:,:,maskno),maskno,nreg_mat(maskno)  )    ! tmb Salinity  
    302 !              !CALL dia_wri_region_mean(kt, "mds" , tmp_field_mat(:,:,6)/real(tmp_field_cnt,wp))!,region_mask,nreg_mat(:,:,maskno),maskno,nreg_mat(maskno)  )    ! tmb Salinity 
    303 !              CALL dia_wri_region_mean(kt, "nbs" , tmp_field_mat(:,:,7)/real(tmp_field_cnt,wp))!,region_mask,nreg_mat(:,:,maskno),maskno,nreg_mat(maskno)  )    ! tmb Salinity 
    304 !              CALL dia_wri_region_mean(kt, "dfs" , tmp_field_mat(:,:,8)/real(tmp_field_cnt,wp))!,region_mask,nreg_mat(:,:,maskno),maskno,nreg_mat(maskno)  )    ! tmb Salinity; 
    305 ! 
    306 !              CALL dia_wri_region_mean(kt, "ssh" , tmp_field_mat(:,:,9)/real(tmp_field_cnt,wp))!,region_mask,nreg_mat(:,:,maskno),maskno,nreg_mat(maskno)  )    ! tmb Temperature 
    307                
    308                
    309  
    310                
    311                
    312               !CALL cpu_time(start_reg_mean_sub) 
    313354               
    314355              CALL dia_wri_region_mean(kt, "sst" , tmp_field_mat(:,:,1)/real(tmp_field_cnt,wp))!,region_mask,nreg_mat(:,:,maskno),maskno,nreg_mat(maskno)  )    ! tmb Temperature 
     
    322363              CALL dia_wri_region_mean(kt, "ssh" , tmp_field_mat(:,:,7)/real(tmp_field_cnt,wp))!,region_mask,nreg_mat(:,:,maskno),maskno,nreg_mat(maskno)  )    ! tmb Temperature 
    323364               
    324               CALL dia_wri_region_mean(kt, "mldkara" , tmp_field_mat(:,:,8)/real(tmp_field_cnt,wp))!,region_mask,nreg_mat(:,:,maskno),maskno,nreg_mat(maskno)  )    ! tmb Temperature 
    325  
    326               CALL dia_wri_region_mean(kt, "pea" , tmp_field_mat(:,:,9)/real(tmp_field_cnt,wp))!,region_mask,nreg_mat(:,:,maskno),maskno,nreg_mat(maskno)  )    ! tmb Temperature 
    327               CALL dia_wri_region_mean(kt, "peat" , tmp_field_mat(:,:,10)/real(tmp_field_cnt,wp))!,region_mask,nreg_mat(:,:,maskno),maskno,nreg_mat(maskno)  )    ! tmb Temperature 
    328               CALL dia_wri_region_mean(kt, "peas" , tmp_field_mat(:,:,11)/real(tmp_field_cnt,wp))!,region_mask,nreg_mat(:,:,maskno),maskno,nreg_mat(maskno)  )    ! tmb Temperature 
    329                
    330               !CALL cpu_time(finish_reg_mean_sub)           
    331               !WRITE(numout,'("kt = ",i05,";  Reg_mean_sub Time = ",f10.3," milliseconds: ",f6.3,";  ",f6.3)') & 
    332               !  & kt,(finish_reg_mean_sub-start_reg_mean_sub)*1000.,finish_reg_mean_sub,start_reg_mean_sub 
    333                
     365              IF( ln_diaregmean_karamld  ) THEN 
     366               
     367                  CALL dia_wri_region_mean(kt, "mldkara" , tmp_field_karamld_mat(:,:,1)/real(tmp_field_cnt,wp))!,region_mask,nreg_mat(:,:,maskno),maskno,nreg_mat(maskno)  )    ! tmb Temperature 
     368                   
     369              ENDIF 
     370               
     371              IF( ln_diaregmean_pea  ) THEN 
     372               
     373                  CALL dia_wri_region_mean(kt, "pea"  , tmp_field_pea_mat(:,:,1)/real(tmp_field_cnt,wp))!,region_mask,nreg_mat(:,:,maskno),maskno,nreg_mat(maskno)  )    ! tmb Temperature 
     374                  CALL dia_wri_region_mean(kt, "peat" , tmp_field_pea_mat(:,:,2)/real(tmp_field_cnt,wp))!,region_mask,nreg_mat(:,:,maskno),maskno,nreg_mat(maskno)  )    ! tmb Temperature 
     375                  CALL dia_wri_region_mean(kt, "peas" , tmp_field_pea_mat(:,:,3)/real(tmp_field_cnt,wp))!,region_mask,nreg_mat(:,:,maskno),maskno,nreg_mat(maskno)  )    ! tmb Temperature 
     376                   
     377              ENDIF 
     378               
     379              IF( ln_diaregmean_diaar5  ) THEN 
     380               
     381                CALL dia_wri_region_mean(kt, "ssh_steric" ,      tmp_field_AR5_mat(:,:,1)/real(tmp_field_cnt,wp))!,region_mask,nreg_mat(:,:,maskno),maskno,nreg_mat(maskno)  )    ! tmb Temperature 
     382                CALL dia_wri_region_mean(kt, "ssh_thermosteric", tmp_field_AR5_mat(:,:,2)/real(tmp_field_cnt,wp))!,region_mask,nreg_mat(:,:,maskno),maskno,nreg_mat(maskno)  )    ! tmb Temperature 
     383                CALL dia_wri_region_mean(kt, "ssh_halosteric" ,  tmp_field_AR5_mat(:,:,3)/real(tmp_field_cnt,wp))!,region_mask,nreg_mat(:,:,maskno),maskno,nreg_mat(maskno)  )    ! tmb Temperature 
     384                CALL dia_wri_region_mean(kt, "bot_pres" ,        tmp_field_AR5_mat(:,:,4)/real(tmp_field_cnt,wp))!,region_mask,nreg_mat(:,:,maskno),maskno,nreg_mat(maskno)  )    ! tmb Temperature 
     385                 
     386              ENDIF 
     387               
     388              IF( ln_diaregmean_diasbc  ) THEN 
     389               
     390                CALL dia_wri_region_mean(kt, "qt"   , tmp_field_SBC_mat(:,:,1)/real(tmp_field_cnt,wp))!,region_mask,nreg_mat(:,:,maskno),maskno,nreg_mat(maskno)  )    ! tmb Temperature 
     391                CALL dia_wri_region_mean(kt, "qsr"  , tmp_field_SBC_mat(:,:,2)/real(tmp_field_cnt,wp))!,region_mask,nreg_mat(:,:,maskno),maskno,nreg_mat(maskno)  )    ! tmb Temperature 
     392                CALL dia_wri_region_mean(kt, "qns"  , tmp_field_SBC_mat(:,:,3)/real(tmp_field_cnt,wp))!,region_mask,nreg_mat(:,:,maskno),maskno,nreg_mat(maskno)  )    ! tmb Temperature 
     393                CALL dia_wri_region_mean(kt, "emp"  , tmp_field_SBC_mat(:,:,4)/real(tmp_field_cnt,wp))!,region_mask,nreg_mat(:,:,maskno),maskno,nreg_mat(maskno)  )    ! tmb Temperature 
     394                CALL dia_wri_region_mean(kt, "wspd" , tmp_field_SBC_mat(:,:,5)/real(tmp_field_cnt,wp))!,region_mask,nreg_mat(:,:,maskno),maskno,nreg_mat(maskno)  )    ! tmb Temperature 
     395                CALL dia_wri_region_mean(kt, "mslp" , tmp_field_SBC_mat(:,:,6)/real(tmp_field_cnt,wp))!,region_mask,nreg_mat(:,:,maskno),maskno,nreg_mat(maskno)  )    ! tmb Temperature 
     396                CALL dia_wri_region_mean(kt, "rnf"  , tmp_field_SBC_mat(:,:,7)/real(tmp_field_cnt,wp))!,region_mask,nreg_mat(:,:,maskno),maskno,nreg_mat(maskno)  )    ! tmb Temperature 
     397                 
     398              ENDIF 
     399               
     400               
     401              IF( ln_diaregmean_karamld ) tmp_field_karamld_mat(:,:,:) = 0. 
     402              IF( ln_diaregmean_pea     ) tmp_field_pea_mat(:,:,:) = 0. 
     403              IF( ln_diaregmean_diaar5  ) tmp_field_AR5_mat(:,:,:) = 0. 
     404              IF( ln_diaregmean_diasbc  ) tmp_field_SBC_mat(:,:,:) = 0. 
    334405              tmp_field_mat(:,:,:) = 0. 
     406               
    335407              tmp_field_cnt = 0 
    336408       
     
    353425                  ENDIF 
    354426              DEALLOCATE( region_mask, nreg_mat, tmp_field_mat) 
     427              IF( ln_diaregmean_karamld ) DEALLOCATE( tmp_field_karamld_mat) 
     428              IF( ln_diaregmean_pea     ) DEALLOCATE( tmp_field_pea_mat) 
     429              IF( ln_diaregmean_diaar5  ) DEALLOCATE( tmp_field_AR5_mat) 
     430              IF( ln_diaregmean_diasbc  ) DEALLOCATE( tmp_field_SBC_mat) 
    355431              ENDIF 
    356432          ENDIF 
     
    382458       
    383459      INTEGER, INTENT(in) ::   kt 
    384       CHARACTER (len=15) , INTENT(IN   ) ::    name 
     460      CHARACTER (len=60) , INTENT(IN   ) ::    name 
    385461      REAL(wp), DIMENSION(jpi, jpj), INTENT(IN   ) :: infield    ! Input 3d field and mask 
    386462       
     
    399475      INTEGER  ::   ierr       
    400476      REAL(wp)  :: tmpreal 
    401       CHARACTER(LEN=80) :: FormatString,nreg_string 
     477      CHARACTER(LEN=180) :: FormatString,nreg_string 
    402478      REAL(wp), ALLOCATABLE, DIMENSION(:,:,:) ::   dummy_zrmet 
    403479       
     
    408484       
    409485      !Allocate output arrays for iomput, set to zmdi, and set a region counter = 1 
    410        
    411       !ALLOCATE( zrmet_ave(jpi,jpj,n_regions_output),  STAT= ierr ) 
    412       !  IF( ierr /= 0 )   CALL ctl_stop( 'dia_wri_region_mean: failed to allocate zrmet_ave array' ) 
    413       !ALLOCATE( zrmet_tot(jpi,jpj,n_regions_output),  STAT= ierr ) 
    414       !  IF( ierr /= 0 )   CALL ctl_stop( 'dia_wri_region_mean: failed to allocate zrmet_tot array' ) 
    415       !ALLOCATE( zrmet_var(jpi,jpj,n_regions_output),  STAT= ierr ) 
    416       !  IF( ierr /= 0 )   CALL ctl_stop( 'dia_wri_region_mean: failed to allocate zrmet_var array' ) 
    417       !ALLOCATE( zrmet_cnt(jpi,jpj,n_regions_output),  STAT= ierr ) 
    418       !  IF( ierr /= 0 )   CALL ctl_stop( 'dia_wri_region_mean: failed to allocate zrmet_cnt array' ) 
    419       !ALLOCATE( zrmet_mask_id(jpi,jpj,n_regions_output),  STAT= ierr ) 
    420       !  IF( ierr /= 0 )   CALL ctl_stop( 'dia_wri_region_mean: failed to allocate zrmet_mask_id array' ) 
    421       !ALLOCATE( zrmet_reg_id(jpi,jpj,n_regions_output),  STAT= ierr ) 
    422       !  IF( ierr /= 0 )   CALL ctl_stop( 'dia_wri_region_mean: failed to allocate zrmet_reg_id array' ) 
    423        
    424        
    425486      ALLOCATE( zrmet_ave(n_regions_output),  STAT= ierr ) 
    426487        IF( ierr /= 0 )   CALL ctl_stop( 'dia_wri_region_mean: failed to allocate zrmet_ave array' ) 
     
    439500        IF( ierr /= 0 )   CALL ctl_stop( 'dia_wri_region_mean: failed to allocate zrmet_reg_id array' ) 
    440501       
    441       !zrmet_ave(:,:,:) = zmdi 
    442       !zrmet_tot(:,:,:) = zmdi 
    443       !zrmet_var(:,:,:) = zmdi 
    444       !zrmet_cnt(:,:,:) = zmdi 
    445       !zrmet_mask_id(:,:,:) = zmdi 
    446       !zrmet_reg_id(:,:,:) = zmdi 
    447        
    448502       
    449503      zrmet_ave(:) = zmdi 
     
    470524          ALLOCATE( tot_mat(nreg),      STAT= ierr ) 
    471525          IF( ierr /= 0 )   CALL ctl_stop( 'dia_wri_region_mean: failed to allocate tot_mat array' ) 
    472           !ALLOCATE( tot_mat_2(nreg),  STAT= ierr ) 
    473           !IF( ierr /= 0 )   CALL ctl_stop( 'dia_wri_region_mean: failed to allocate tot_mat_2 array' ) 
    474            
    475526          ALLOCATE( num_mat(nreg),  STAT= ierr ) 
    476527          IF( ierr /= 0 )   CALL ctl_stop( 'dia_wri_region_mean: failed to allocate num_mat array' ) 
     
    511562              END DO 
    512563          END DO 
    513           !CALL cpu_time(finish_reg_mean_loop)           
    514           !WRITE(numout,'("kt = ",i05,"; maskno = ",i02,";  Reg_mean_loop Time = ",f6.3," milliseconds.",f6.3,";, ",f6.3)') & 
    515           !      &  kt,maskno,(finish_reg_mean_loop-start_reg_mean_loop)*1000.,finish_reg_mean_loop,start_reg_mean_loop 
    516            
    517           ! sum the totals, the counts, and the squares across the processors 
    518           !CALL cpu_time(start_reg_mean_mpp) 
    519            
    520            
    521            
    522           !IF( lk_mpp ) THEN 
    523           !    DO jj = 1,nreg 
    524           !        tmpreal = tot_mat(jj) 
    525           !        CALL mpp_sum( tmpreal ) 
    526           !        tot_mat(jj) = tmpreal 
    527           !         
    528           !        tmpreal = ssq_mat(jj) 
    529           !        CALL mpp_sum( tmpreal ) 
    530           !        ssq_mat(jj) = tmpreal 
    531           !         
    532           !        tmpreal = cnt_mat(jj) 
    533           !        CALL mpp_sum( tmpreal ) 
    534           !        cnt_mat(jj) = tmpreal 
    535           !    END DO 
    536           !ENDIF 
    537            
    538            
    539            
    540           !if (lwp) WRITE(numout,*) "mpp_sum loop tot_mat",tot_mat 
    541           !CALL cpu_time(finish_reg_mean_mpp)           
    542           !WRITE(numout,'("kt = ",i05,"; maskno = ",i02,";  Reg_mean_mpp Time = ",f6.3," milliseconds.",f6.3,";, ",f6.3)') & 
    543           !      &  kt,maskno,(finish_reg_mean_loop-start_reg_mean_mpp)*1000.,finish_reg_mean_mpp,start_reg_mean_mpp 
    544            
    545           !DO jj = 1,nreg 
    546           !   tot_mat_2(jj) = tot_mat(jj) 
    547           !enddo 
    548           !CALL cpu_time( start_reg_mean_mpp_mat ) 
    549            
    550            
     564          ! sum the totals, the counts, and the squares across the processors           
    551565          CALL mpp_sum( tot_mat,nreg ) 
    552566          CALL mpp_sum( ssq_mat,nreg ) 
    553567          CALL mpp_sum( cnt_mat,nreg ) 
    554568           
    555            
    556            
    557           !CALL cpu_time(finish_reg_mean_mpp_mat)           
    558           !WRITE(numout,'("kt = ",i05,"; maskno = ",i02,";  Reg_mean_mpp_mat Time = ",f6.3," milliseconds.",f6.3,";, ",f6.3)') & 
    559           !      &  kt,maskno,(finish_reg_mean_mpp_mat-start_reg_mean_mpp_mat)*1000.,finish_reg_mean_loop,start_reg_mean_mpp_mat 
    560                  
    561            
    562           !DO jj = 1,nreg 
    563           !    WRITE(numout,*) "mpp_sum array tot_mat",jj,tot_mat(jj),ssq_mat(jj),cnt_mat(jj) 
    564           !enddo 
    565569           
    566570          !calculate the mean and variance from the total, sum of squares and the count.  
     
    608612               
    609613              DO jm = 1,nreg 
    610                   !zrmet_ave(    :,:,reg_ind_cnt) =     ave_mat(jm) 
    611                   !zrmet_tot(    :,:,reg_ind_cnt) =     tot_mat(jm) 
    612                   !zrmet_var(    :,:,reg_ind_cnt) =     var_mat(jm) 
    613                   !zrmet_cnt(    :,:,reg_ind_cnt) =     cnt_mat(jm) 
    614                   !zrmet_reg_id( :,:,reg_ind_cnt) =  reg_id_mat(jm) 
    615                   !zrmet_mask_id(:,:,reg_ind_cnt) = mask_id_mat(jm) 
    616                    
    617614                  zrmet_ave(    reg_ind_cnt) =     ave_mat(jm) 
    618615                  zrmet_tot(    reg_ind_cnt) =     tot_mat(jm) 
     
    637634       
    638635       
    639        
    640           !CALL iom_put( "reg_" // trim(name) // '_ave', zrmet_ave ) 
    641           !CALL iom_put( "reg_" // trim(name) // '_tot', zrmet_tot ) 
    642           !CALL iom_put( "reg_" // trim(name) // '_var', zrmet_var ) 
    643           !CALL iom_put( "reg_" // trim(name) // '_cnt', zrmet_cnt ) 
    644           !CALL iom_put( "reg_" // trim(name) // '_reg_id', zrmet_reg_id ) 
    645           !CALL iom_put( "reg_" // trim(name) // '_mask_id', zrmet_mask_id ) 
    646636       
    647637          DO jm = 1,n_regions_output 
  • branches/UKMO/CO6_shelfclimate/NEMOGCM/NEMO/OPA_SRC/IOM/iom.F90

    r7567 r7572  
    5757    
    5858    
    59    !JT REGION MEANS 
    60    !INTEGER , PUBLIC ::   n_regions_output = 100 
    6159    
    6260   INTEGER , PUBLIC ::   n_regions_output 
    63    !JT REGION MEANS 
    6461    
    6562   PRIVATE iom_rp0d, iom_rp1d, iom_rp2d, iom_rp3d 
     
    116113       
    117114       
    118       !JT REGION MEANS 
    119       !! read namelist to see if the region mask code is called, if so read the region mask, and count the regions.  
    120115       
    121116       
     
    133128      LOGICAL :: ln_diaregmean_bin  ! region mean calculation binary output 
    134129      LOGICAL :: ln_diaregmean_nc  ! region mean calculation netcdf output 
     130      LOGICAL :: ln_diaregmean_karamld  ! region mean calculation including kara mld terms 
     131      LOGICAL :: ln_diaregmean_pea  ! region mean calculation including pea terms 
     132      LOGICAL :: ln_diaregmean_diaar5  ! region mean calculation including AR5 SLR terms 
     133      LOGICAL :: ln_diaregmean_diasbc  ! region mean calculation including Surface BC 
    135134     
    136        
    137        
    138       NAMELIST/nam_diaregmean/ ln_diaregmean,ln_diaregmean_ascii,ln_diaregmean_bin,ln_diaregmean_nc 
     135      ! Read the number region mask to work out how many regions are needed. 
     136       
     137      NAMELIST/nam_diaregmean/ ln_diaregmean,ln_diaregmean_ascii,ln_diaregmean_bin,ln_diaregmean_nc,& 
     138        & ln_diaregmean_karamld, ln_diaregmean_pea,ln_diaregmean_diaar5,ln_diaregmean_diasbc 
     139       
    139140       
    140141      ! read in Namelist.  
     
    187188       
    188189       
    189       !JT REGION MEANS 
    190        
    191        
    192        
    193        
    194190#if ! defined key_xios2 
    195191      ALLOCATE( z_bnds(jpk,2) ) 
     
    319315      CALL iom_set_axis_attr( "region", (/ (REAL(ji,wp), ji=1,n_regions_output) /) ) 
    320316 
    321       !CALL iom_set_axis_attr( "region", (/ (REAL(ji,wp), ji=1,100) /) ) 
     317      !JT CALL iom_set_axis_attr( "noos", (/ (REAL(ji,wp), ji=1,9) /) ) 
     318      !JT CALL iom_set_axis_attr( "noos", (/ (REAL(ji,wp), ji=1,1) /) ) 
     319      !JT CALL iom_set_axis_attr( "noos", (/ (REAL(1,wp)) /) ) 
     320      CALL iom_set_axis_attr( "noos", (/ (REAL(ji,wp), ji=1,3) /) ) 
    322321 
    323322       
Note: See TracChangeset for help on using the changeset viewer.