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 4827 for branches/UKMO/dev_3841_sbc/NEMOGCM/NEMO/OPA_SRC/SBC/sbcflx.F90 – NEMO

Ignore:
Timestamp:
2014-10-31T12:45:41+01:00 (9 years ago)
Author:
charris
Message:

Some demonstration code changes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/UKMO/dev_3841_sbc/NEMOGCM/NEMO/OPA_SRC/SBC/sbcflx.F90

    r3625 r4827  
    1717   USE sbcdcy          ! surface boundary condition: diurnal cycle on qsr 
    1818   USE phycst          ! physical constants 
    19    USE fldread         ! read input fields 
     19   USE fldread2        ! read input fields 
     20   USE fld_def 
     21   USE sbcget 
    2022   USE iom             ! IOM library 
    2123   USE in_out_manager  ! I/O manager 
     
    2729 
    2830   PUBLIC sbc_flx       ! routine called by step.F90 
    29  
    30    INTEGER , PARAMETER ::   jpfld   = 5   ! maximum number of files to read  
    31    INTEGER , PARAMETER ::   jp_utau = 1   ! index of wind stress (i-component) file 
    32    INTEGER , PARAMETER ::   jp_vtau = 2   ! index of wind stress (j-component) file 
    33    INTEGER , PARAMETER ::   jp_qtot = 3   ! index of total (non solar+solar) heat file 
    34    INTEGER , PARAMETER ::   jp_qsr  = 4   ! index of solar heat file 
    35    INTEGER , PARAMETER ::   jp_emp  = 5   ! index of evaporation-precipation file 
    36    TYPE(FLD), ALLOCATABLE, DIMENSION(:) ::   sf    ! structure of input fields (file informations, fields read) 
    3731 
    3832   !! * Substitutions 
     
    7670      !! 
    7771      INTEGER  ::   ji, jj, jf            ! dummy indices 
    78       INTEGER  ::   ierror                ! return error code 
    7972      REAL(wp) ::   zfact                 ! temporary scalar 
    8073      REAL(wp) ::   zrhoa  = 1.22         ! Air density kg/m3 
     
    8275      REAL(wp) ::   ztx, zty, zmod, zcoef ! temporary variables 
    8376      !! 
    84       CHARACTER(len=100) ::  cn_dir                               ! Root directory for location of flx files 
    85       TYPE(FLD_N), DIMENSION(jpfld) ::   slf_i                    ! array of namelist information structures 
    86       TYPE(FLD_N) ::   sn_utau, sn_vtau, sn_qtot, sn_qsr, sn_emp  ! informations about the fields to be read 
    87       NAMELIST/namsbc_flx/ cn_dir, sn_utau, sn_vtau, sn_qtot, sn_qsr, sn_emp 
     77!      CHARACTER(len=100) ::  cn_dir                               ! Root directory for location of flx files 
     78!      NAMELIST/namsbc_flx/ cn_dir, sn_utau, sn_vtau, sn_qtot, sn_qsr, sn_emp 
    8879      !!--------------------------------------------------------------------- 
    8980      ! 
    9081      IF( kt == nit000 ) THEN                ! First call kt=nit000   
    91          ! set file information 
    92          cn_dir = './'        ! directory in which the model is executed 
    93          ! ... default values (NB: frequency positive => hours, negative => months) 
    94          !              !  file   ! frequency !  variable  ! time intep !  clim   ! 'yearly' or ! weights  ! rotation  ! 
    95          !              !  name   !  (hours)  !   name     !   (T/F)    !  (T/F)  !  'monthly'  ! filename ! pairs     ! 
    96          sn_utau = FLD_N(  'utau' ,    24     ,  'utau'    ,  .false.   , .false. ,   'yearly'  , ''       , ''        ) 
    97          sn_vtau = FLD_N(  'vtau' ,    24     ,  'vtau'    ,  .false.   , .false. ,   'yearly'  , ''       , ''        ) 
    98          sn_qtot = FLD_N(  'qtot' ,    24     ,  'qtot'    ,  .false.   , .false. ,   'yearly'  , ''       , ''        ) 
    99          sn_qsr  = FLD_N(  'qsr'  ,    24     ,  'qsr'     ,  .false.   , .false. ,   'yearly'  , ''       , ''        ) 
    100          sn_emp  = FLD_N(  'emp'  ,    24     ,  'emp'     ,  .false.   , .false. ,   'yearly'  , ''       , ''        ) 
    101          ! 
    102          REWIND ( numnam )                         ! read in namlist namflx 
    103          READ   ( numnam, namsbc_flx )  
    10482         ! 
    10583         !                                         ! check: do we plan to use ln_dm2dc with non-daily forcing? 
    106          IF( ln_dm2dc .AND. sn_qsr%nfreqh /= 24 )   & 
     84         IF( ln_dm2dc .AND. sf(jp_qsroce)%nfreqh /= 24 )   & 
    10785            &   CALL ctl_stop( 'sbc_blk_core: ln_dm2dc can be activated only with daily short-wave forcing' )  
    108          ! 
    109          !                                         ! store namelist information in an array 
    110          slf_i(jp_utau) = sn_utau   ;   slf_i(jp_vtau) = sn_vtau 
    111          slf_i(jp_qtot) = sn_qtot   ;   slf_i(jp_qsr ) = sn_qsr  
    112          slf_i(jp_emp ) = sn_emp 
    113          ! 
    114          ALLOCATE( sf(jpfld), STAT=ierror )        ! set sf structure 
    115          IF( ierror > 0 ) THEN    
    116             CALL ctl_stop( 'sbc_flx: unable to allocate sf structure' )   ;   RETURN   
    117          ENDIF 
    118          DO ji= 1, jpfld 
    119             ALLOCATE( sf(ji)%fnow(jpi,jpj,1) ) 
    120             IF( slf_i(ji)%ln_tint ) ALLOCATE( sf(ji)%fdta(jpi,jpj,1,2) ) 
    121          END DO 
    122          !                                         ! fill sf with slf_i and control print 
    123          CALL fld_fill( sf, slf_i, cn_dir, 'sbc_flx', 'flux formulation for ocean surface boundary condition', 'namsbc_flx' ) 
    12486         ! 
    12587         sfx(:,:) = 0.0_wp                         ! salt flux due to freezing/melting (non-zero only if ice is present; set in limsbc(_2).F90) 
     
    12789      ENDIF 
    12890 
    129       CALL fld_read( kt, nn_fsbc, sf )                            ! input fields provided at the current time-step 
    130       
    13191      IF( MOD( kt-1, nn_fsbc ) == 0 ) THEN                        ! update ocean fluxes at each SBC frequency 
    13292 
    133          IF( ln_dm2dc ) THEN   ;   qsr(:,:) = sbc_dcy( sf(jp_qsr)%fnow(:,:,1) )   ! modify now Qsr to include the diurnal cycle 
    134          ELSE                  ;   qsr(:,:) =          sf(jp_qsr)%fnow(:,:,1) 
     93         IF( ln_dm2dc ) THEN   ;   qsr(:,:) = sbc_dcy( sf(jp_qsroce)%fnow(:,:,1) )   ! modify now Qsr to include the diurnal cycle 
     94         ELSE                  ;   qsr(:,:) =          sf(jp_qsroce)%fnow(:,:,1) 
    13595         ENDIF 
    13696!CDIR COLLAPSE 
    13797         DO jj = 1, jpj                                           ! set the ocean fluxes from read fields 
    13898            DO ji = 1, jpi 
    139                utau(ji,jj) = sf(jp_utau)%fnow(ji,jj,1) 
    140                vtau(ji,jj) = sf(jp_vtau)%fnow(ji,jj,1) 
    141                qns (ji,jj) = sf(jp_qtot)%fnow(ji,jj,1) - sf(jp_qsr)%fnow(ji,jj,1) 
    142                emp (ji,jj) = sf(jp_emp )%fnow(ji,jj,1) 
     99               utau(ji,jj) = sf(jp_otx1)%fnow(ji,jj,1) 
     100               vtau(ji,jj) = sf(jp_oty1)%fnow(ji,jj,1) 
     101               qns (ji,jj) = sf(jp_qtot)%fnow(ji,jj,1) - sf(jp_qsroce)%fnow(ji,jj,1) 
     102               emp (ji,jj) = sf(jp_oemp )%fnow(ji,jj,1) 
    143103            END DO 
    144104         END DO 
     
    165125            WRITE(numout,*) '        read daily momentum, heat and freshwater fluxes OK' 
    166126            DO jf = 1, jpfld 
    167                IF( jf == jp_utau .OR. jf == jp_vtau )   zfact =     1. 
    168                IF( jf == jp_qtot .OR. jf == jp_qsr  )   zfact =     0.1 
    169                IF( jf == jp_emp                     )   zfact = 86400. 
     127               IF( jf == jp_otx1 .OR. jf == jp_oty1  )   zfact =     1. 
     128               IF( jf == jp_qtot .OR. jf == jp_qsroce )   zfact =     0.1 
     129               IF( jf == jp_oemp                       )   zfact = 86400. 
    170130               WRITE(numout,*)  
    171131               WRITE(numout,*) ' day: ', ndastp , TRIM(sf(jf)%clvar), ' * ', zfact 
Note: See TracChangeset for help on using the changeset viewer.