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 6583 for branches/2016/dev_r6409_SIMPLIF_2_usrdef – NEMO

Ignore:
Timestamp:
2016-05-20T11:10:37+02:00 (8 years ago)
Author:
flavoni
Message:

add module for sbc gyre in usr_def module , see ticket #1692

Location:
branches/2016/dev_r6409_SIMPLIF_2_usrdef/NEMOGCM/NEMO/OPA_SRC
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • branches/2016/dev_r6409_SIMPLIF_2_usrdef/NEMOGCM/NEMO/OPA_SRC/SBC/sbc_oce.F90

    r6140 r6583  
    3030   !!---------------------------------------------------------------------- 
    3131   !                                   !!* namsbc namelist * 
    32    LOGICAL , PUBLIC ::   ln_ana         !: analytical boundary condition flag 
    33    LOGICAL , PUBLIC ::   ln_flx         !: flux      formulation 
    34    LOGICAL , PUBLIC ::   ln_blk_clio    !: CLIO bulk formulation 
    35    LOGICAL , PUBLIC ::   ln_blk_core    !: CORE bulk formulation 
    36    LOGICAL , PUBLIC ::   ln_blk_mfs     !: MFS  bulk formulation 
     32   LOGICAL , PUBLIC ::   ln_ana         !: user defined formulation 
     33   LOGICAL , PUBLIC ::   ln_flx         !: flux         formulation 
     34   LOGICAL , PUBLIC ::   ln_blk_clio    !: CLIO bulk    formulation 
     35   LOGICAL , PUBLIC ::   ln_blk_core    !: CORE bulk    formulation 
     36   LOGICAL , PUBLIC ::   ln_blk_mfs     !: MFS  bulk    formulation 
    3737#if defined key_oasis3 
    3838   LOGICAL , PUBLIC ::   lk_oasis = .TRUE.  !: OASIS used 
     
    7272   !!           switch definition (improve readability) 
    7373   !!---------------------------------------------------------------------- 
    74    INTEGER , PUBLIC, PARAMETER ::   jp_gyre    = 0        !: GYRE analytical               formulation 
    75    INTEGER , PUBLIC, PARAMETER ::   jp_ana     = 1        !: analytical                    formulation 
     74   INTEGER , PUBLIC, PARAMETER ::   jp_ana     = 1        !: user defined                  formulation 
    7675   INTEGER , PUBLIC, PARAMETER ::   jp_flx     = 2        !: flux                          formulation 
    7776   INTEGER , PUBLIC, PARAMETER ::   jp_clio    = 3        !: CLIO bulk                     formulation 
  • branches/2016/dev_r6409_SIMPLIF_2_usrdef/NEMOGCM/NEMO/OPA_SRC/SBC/sbcmod.F90

    r6351 r6583  
    2828   USE sbcdcy         ! surface boundary condition: diurnal cycle 
    2929   USE sbcssm         ! surface boundary condition: sea-surface mean variables 
    30    USE sbcana         ! surface boundary condition: analytical formulation 
    3130   USE sbcflx         ! surface boundary condition: flux formulation 
    3231   USE sbcblk_clio    ! surface boundary condition: bulk formulation : CLIO 
     
    3837   USE sbcice_cice    ! surface boundary condition: CICE    sea-ice model 
    3938   USE sbccpl         ! surface boundary condition: coupled florulation 
     39   USE usrdef_sbc     ! user defined: surface boundary condition 
    4040   USE cpl_oasis3     ! OASIS routines for coupling 
    4141   USE sbcssr         ! surface boundary condition: sea surface restoring 
     
    120120        IF( lk_cice )   nn_ice      = 4 
    121121      ENDIF 
    122       IF( cp_cfg == 'gyre' ) THEN            ! GYRE configuration 
    123           ln_ana      = .TRUE.    
    124           nn_ice      =   0 
    125       ENDIF 
    126122      ! 
    127123      IF(lwp) THEN               ! Control print 
     
    129125         WRITE(numout,*) '           frequency update of sbc (and ice)             nn_fsbc     = ', nn_fsbc 
    130126         WRITE(numout,*) '           Type of air-sea fluxes : ' 
    131          WRITE(numout,*) '              analytical formulation                     ln_ana        = ', ln_ana 
    132          WRITE(numout,*) '              flux       formulation                     ln_flx        = ', ln_flx 
    133          WRITE(numout,*) '              CLIO bulk  formulation                     ln_blk_clio   = ', ln_blk_clio 
    134          WRITE(numout,*) '              CORE bulk  formulation                     ln_blk_core   = ', ln_blk_core 
    135          WRITE(numout,*) '              MFS  bulk  formulation                     ln_blk_mfs    = ', ln_blk_mfs 
     127         WRITE(numout,*) '              user defined formulation                   ln_ana        = ', ln_ana 
     128         WRITE(numout,*) '              flux         formulation                   ln_flx        = ', ln_flx 
     129         WRITE(numout,*) '              CLIO bulk    formulation                   ln_blk_clio   = ', ln_blk_clio 
     130         WRITE(numout,*) '              CORE bulk    formulation                   ln_blk_core   = ', ln_blk_core 
     131         WRITE(numout,*) '              MFS  bulk    formulation                   ln_blk_mfs    = ', ln_blk_mfs 
    136132         WRITE(numout,*) '           Type of coupling (Ocean/Ice/Atmosphere) : ' 
    137133         WRITE(numout,*) '              ocean-atmosphere coupled formulation       ln_cpl        = ', ln_cpl 
     
    160156         SELECT CASE ( nn_limflx )        ! LIM3 Multi-category heat flux formulation 
    161157         CASE ( -1 )   ;   WRITE(numout,*) '   LIM3: use per-category fluxes (nn_limflx = -1) ' 
    162          CASE ( 0 )   ;   WRITE(numout,*) '   LIM3: use average per-category fluxes (nn_limflx = 0) '  
    163          CASE ( 1 )   ;   WRITE(numout,*) '   LIM3: use average then redistribute per-category fluxes (nn_limflx = 1) ' 
    164          CASE ( 2 )   ;   WRITE(numout,*) '   LIM3: Redistribute a single flux over categories (nn_limflx = 2) ' 
     158         CASE (  0 )   ;   WRITE(numout,*) '   LIM3: use average per-category fluxes (nn_limflx = 0) '  
     159         CASE (  1 )   ;   WRITE(numout,*) '   LIM3: use average then redistribute per-category fluxes (nn_limflx = 1) ' 
     160         CASE (  2 )   ;   WRITE(numout,*) '   LIM3: Redistribute a single flux over categories (nn_limflx = 2) ' 
    165161         END SELECT 
    166162      ENDIF 
     
    224220      ! 
    225221      icpt = 0 
    226       IF( ln_ana          ) THEN   ;   nsbc = jp_ana     ; icpt = icpt + 1   ;   ENDIF       ! analytical           formulation 
     222      IF( ln_ana          ) THEN   ;   nsbc = jp_ana     ; icpt = icpt + 1   ;   ENDIF       ! user defined         formulation 
    227223      IF( ln_flx          ) THEN   ;   nsbc = jp_flx     ; icpt = icpt + 1   ;   ENDIF       ! flux                 formulation 
    228224      IF( ln_blk_clio     ) THEN   ;   nsbc = jp_clio    ; icpt = icpt + 1   ;   ENDIF       ! CLIO bulk            formulation 
     
    230226      IF( ln_blk_mfs      ) THEN   ;   nsbc = jp_mfs     ; icpt = icpt + 1   ;   ENDIF       ! MFS  bulk            formulation 
    231227      IF( ll_purecpl      ) THEN   ;   nsbc = jp_purecpl ; icpt = icpt + 1   ;   ENDIF       ! Pure Coupled         formulation 
    232       IF( cp_cfg == 'gyre') THEN   ;   nsbc = jp_gyre                        ;   ENDIF       ! GYRE analytical      formulation 
    233228      IF( nn_components == jp_iam_opa )   & 
    234229         &                  THEN   ;   nsbc = jp_none    ; icpt = icpt + 1   ;   ENDIF       ! opa coupling via SAS module 
     
    239234         WRITE(numout,*) 
    240235         SELECT CASE( nsbc ) 
    241          CASE( jp_gyre    )   ;   WRITE(numout,*) '   GYRE analytical formulation' 
    242          CASE( jp_ana     )   ;   WRITE(numout,*) '   analytical formulation' 
     236         CASE( jp_ana     )   ;   WRITE(numout,*) '   user defined formulation' 
    243237         CASE( jp_flx     )   ;   WRITE(numout,*) '   flux formulation' 
    244238         CASE( jp_clio    )   ;   WRITE(numout,*) '   CLIO bulk formulation' 
     
    337331      SELECT CASE( nsbc )                                ! Compute ocean surface boundary condition 
    338332      !                                                  ! (i.e. utau,vtau, qns, qsr, emp, sfx) 
    339       CASE( jp_gyre  )   ;   CALL sbc_gyre    ( kt )                    ! analytical formulation : GYRE configuration 
    340       CASE( jp_ana   )   ;   CALL sbc_ana     ( kt )                    ! analytical formulation : uniform sbc 
     333      CASE( jp_ana   )   ;   CALL usr_def_sbc ( kt )                    ! user defined formulation  
    341334      CASE( jp_flx   )   ;   CALL sbc_flx     ( kt )                    ! flux formulation 
    342335      CASE( jp_clio  )   ;   CALL sbc_blk_clio( kt )                    ! bulk formulation : CLIO for the ocean 
  • branches/2016/dev_r6409_SIMPLIF_2_usrdef/NEMOGCM/NEMO/OPA_SRC/usrdef.F90

    r6579 r6583  
    22   !!============================================================================== 
    33   !!                       ***  MODULE usrdef   *** 
    4    !! User defined module: used like example to define init, sbc, bathy, ... 
     4   !! User defined module: used like example to define domain, init, sbc, ... 
    55   !!============================================================================== 
    66   !! History :  NEMO ! 2016-03  (S. Flavoni)  
     
    1010   !!   usr_def_hgr       : initialize the horizontal mesh  
    1111   !!   usr_def_ini       : initial state  
    12    !!   usr_def_sbc       : initialize the surface bounday conditions 
    1312   !!---------------------------------------------------------------------- 
    1413   USE step_oce       ! module used in the ocean time stepping module (step.F90) 
     
    2928CONTAINS 
    3029 
    31    SUBROUTINE usr_def_hgr( nbench, jp_cfg, kff    , pff   , & ! Coriolis parameter  (if domain not on the sphere) 
    32            &               pglamt, pglamu, pglamv , pglamf, & ! gridpoints position (required) 
    33            &               pgphit, pgphiu, pgphiv , pgphif, & !          
    34            &               pe1t  , pe1u  , pe1v   , pe1f  , & ! scale factors (required) 
    35            &               pe2t  , pe2u  , pe2v   , pe2f  , & ! 
    36            &               ke1e2u_v                       )   ! u- & v-surfaces (if gridsize reduction is used in strait(s)) 
    37       !!------------------------------------------------------------------------------------------------- 
     30   SUBROUTINE usr_def_hgr( kbench, k_cfg , kff    , pff   , & ! Coriolis parameter  (if domain not on the sphere) 
     31      &                    pglamt, pglamu, pglamv , pglamf, & ! gridpoints position (required) 
     32      &                    pgphit, pgphiu, pgphiv , pgphif, & !          
     33      &                    pe1t  , pe1u  , pe1v   , pe1f  , & ! scale factors (required) 
     34      &                    pe2t  , pe2u  , pe2v   , pe2f  , & ! 
     35      &                    ke1e2u_v                       )   ! u- & v-surfaces (if gridsize reduction is used in strait(s)) 
     36      !!---------------------------------------------------------------------- 
    3837      !!                  ***  ROUTINE usr_def_hgr  *** 
    3938      !! 
     
    5251      !!              - define i- & j-scale factors at t-, u-, v- and f-points (in meters) 
    5352      !!              - define u- & v-surfaces (if gridsize reduction is used in some straits) (in m2) 
    54       !!------------------------------------------------------------------------------------------------- 
    55  
    56       !!---------------------------------------------------------------------- 
    57       INTEGER                 , INTENT(in   ) ::   nbench, jp_cfg   ! parameter of namelist for benchmark, and dimension of GYRE 
    58       INTEGER                 , INTENT(  out) ::   kff              ! =1 Coriolis parameter computed here, =0 otherwise 
    59       REAL(wp), DIMENSION(:,:), INTENT(  out) ::   pff              ! Coriolis factor at f-point                  [1/s] 
     53      !!---------------------------------------------------------------------- 
     54      INTEGER                 , INTENT(in   ) ::   kbench, k_cfg   ! parameter of namelist for benchmark, and dimension of GYRE 
     55      INTEGER                 , INTENT(  out) ::   kff             ! =1 Coriolis parameter computed here, =0 otherwise 
     56      REAL(wp), DIMENSION(:,:), INTENT(  out) ::   pff             ! Coriolis factor at f-point                  [1/s] 
    6057      REAL(wp), DIMENSION(:,:), INTENT(  out) ::   pglamt, pglamu, pglamv, pglamf !  longitude outputs        [degrees] 
    6158      REAL(wp), DIMENSION(:,:), INTENT(  out) ::   pgphit, pgphiu, pgphiv, pgphif !  latitude outputs         [degrees] 
     
    7673      IF(lwp) WRITE(numout,*) '          beta-plane with regular grid-spacing and rotated domain (GYRE configuration)' 
    7774      ! 
    78       ! angle 45deg and ze1=106.e+3 / jp_cfg forced -> zlam1 = -85deg, zphi1 = 29degN 
     75      ! angle 45deg and ze1=106.e+3 / k_cfg forced -> zlam1 = -85deg, zphi1 = 29degN 
    7976      zlam1 = -85._wp 
    8077      zphi1 =  29._wp 
    8178      ! resolution in meters 
    82       ze1 = 106000. / REAL( jp_cfg , wp ) 
     79      ze1 = 106000. / REAL( k_cfg , wp ) 
    8380      ! benchmark: forced the resolution to be about 100 km 
     81            IF( kbench /= 0 )   ze1 = 106000._wp    
     82      zsin_alpha = - SQRT( 2._wp ) * 0.5_wp 
     83      zcos_alpha =   SQRT( 2._wp ) * 0.5_wp 
     84      ze1deg = ze1 / (ra * rad) 
     85      IF( kbench /= 0 )   ze1deg = ze1deg / REAL( jp_cfg , wp )   ! benchmark: keep the lat/+lon 
     86      !                                                           ! at the right jp_cfg resolution 
     87      zlam0 = zlam1 + zcos_alpha * ze1deg * REAL( jpjglo-2 , wp ) 
     88      zphi0 = zphi1 + zsin_alpha * ze1deg * REAL( jpjglo-2 , wp ) 
     89      !    
     90      IF( nprint==1 .AND. lwp )   THEN 
     91         WRITE(numout,*) '          ze1', ze1, 'cosalpha', zcos_alpha, 'sinalpha', zsin_alpha 
     92         WRITE(numout,*) '          ze1deg', ze1deg, 'zlam0', zlam0, 'zphi0', zphi0 
     93      ENDIF 
     94      !    
     95      DO jj = 1, jpj  
     96         DO ji = 1, jpi  
     97            zim1 = REAL( ji + nimpp - 1 ) - 1.   ;   zim05 = REAL( ji + nimpp - 1 ) - 1.5  
     98            zjm1 = REAL( jj + njmpp - 1 ) - 1.   ;   zjm05 = REAL( jj + njmpp - 1 ) - 1.5  
     99            !    
     100            !glamt(i,j) longitude at T-point 
     101            !gphit(i,j) latitude at T-point   
     102            pglamt(ji,jj) = zlam0 + zim05 * ze1deg * zcos_alpha + zjm05 * ze1deg * zsin_alpha 
     103            pgphit(ji,jj) = zphi0 - zim05 * ze1deg * zsin_alpha + zjm05 * ze1deg * zcos_alpha 
     104            !    
     105            !glamu(i,j) longitude at U-point 
     106            !gphiu(i,j) latitude at U-point 
     107            pglamu(ji,jj) = zlam0 + zim1  * ze1deg * zcos_alpha + zjm05 * ze1deg * zsin_alpha 
     108            pgphiu(ji,jj) = zphi0 - zim1  * ze1deg * zsin_alpha + zjm05 * ze1deg * zcos_alpha 
     109            !    
     110            !glamv(i,j) longitude at V-point 
     111            !gphiv(i,j) latitude at V-point 
     112            pglamv(ji,jj) = zlam0 + zim05 * ze1deg * zcos_alpha + zjm1  * ze1deg * zsin_alpha 
     113            pgphiv(ji,jj) = zphi0 - zim05 * ze1deg * zsin_alpha + zjm1  * ze1deg * zcos_alpha 
     114            ! 
     115            !glamf(i,j) longitude at F-point 
     116            !gphif(i,j) latitude at F-point  
     117            pglamf(ji,jj) = zlam0 + zim1  * ze1deg * zcos_alpha + zjm1  * ze1deg * zsin_alpha 
     118            pgphif(ji,jj) = zphi0 - zim1  * ze1deg * zsin_alpha + zjm1  * ze1deg * zcos_alpha 
     119         END DO 
     120      END DO 
     121      ! 
     122      !       !== Horizontal scale factors ==! (in meters) 
     123      !                      
     124      !                             ! constant grid spacing 
     125      pe1t(:,:) =  ze1     ;      pe2t(:,:) = ze1 
     126      pe1u(:,:) =  ze1     ;      pe2u(:,:) = ze1 
     127      pe1v(:,:) =  ze1     ;      pe2v(:,:) = ze1 
     128      pe1f(:,:) =  ze1     ;      pe2f(:,:) = ze1 
     129      !                             ! NO reduction of grid size in some straits  
     130      ke1e2u_v = 0                  !    ==>> u_ & v_surfaces will be computed in dom_ghr routine 
     131      ! 
     132      ! 
     133 
     134      !                      !==  Coriolis parameter  ==! 
     135      kff = 1                                                           !  indicate not to compute ff afterward 
     136      ! 
     137      zbeta = 2. * omega * COS( rad * zphi1 ) / ra                      ! beta at latitude zphi1 
     138      !SF we overwrite zphi0 (south point in latitude) used just above to define pgphif (value of zphi0=15.5190567531966) 
     139      !SF for computation of coriolis we keep the parameter of Hazeleger, W., and S. S. Drijfhout, JPO 1998. 
     140      zphi0 = 15._wp                                                    !  latitude of the most southern grid point   
     141      zf0   = 2. * omega * SIN( rad * zphi0 )                           !  compute f0 1st point south 
     142      ! 
     143      pff(:,:) = ( zf0 + zbeta * ABS( gphif(:,:) - zphi0 ) * rad * ra ) ! f = f0 +beta* y ( y=0 at south) 
     144      ! 
     145      IF(lwp) WRITE(numout,*) '                           beta-plane used. beta = ', zbeta, ' 1/(s.m)' 
     146      ! 
     147      IF( nn_timing == 1 )  CALL timing_stop('usr_def_hgr') 
    84148      ! 
    85149   END SUBROUTINE usr_def_hgr 
     
    101165      !!              - set salinity   field 
    102166      !!---------------------------------------------------------------------- 
    103       REAL(wp), DIMENSION(jpi,jpj,jpk,jpts), INTENT(  out) ::   ptsd   ! T & S data 
     167      REAL(wp), DIMENSION(jpi,jpj,jpk,jpts), INTENT(  out) ::   pts   ! T & S data 
    104168      ! 
    105169      INTEGER :: ji, jj, jk  ! dummy loop indices 
Note: See TracChangeset for help on using the changeset viewer.