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 15602 – NEMO

Changeset 15602


Ignore:
Timestamp:
2021-12-16T10:11:36+01:00 (2 years ago)
Author:
jenniewaters
Message:

Code changes to get pcbias working.

Location:
NEMO/branches/UKMO/NEMO_4.0.4_FOAM_pcbias
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • NEMO/branches/UKMO/NEMO_4.0.4_FOAM_pcbias/cfgs/SHARED/namelist_ref

    r14075 r15602  
    13791379   cn_storst_out = "restart_sto" !  suffix of stochastic parameter restart file (output) 
    13801380/ 
     1381!----------------------------------------------------------------------- 
     1382&nambias   ! Bias pressure correctiom 
     1383!----------------------------------------------------------------------- 
     1384   ln_bias        = .false. 
     1385   ln_bias_asm    = .false. 
     1386   ln_bias_rlx    = .false. 
     1387   ln_bias_ofl    = .false. 
     1388   ln_bias_ts_app = .false. 
     1389   ln_bias_pc_app = .false.         
     1390   fb_t_asm       = 0.0 
     1391   fb_t_rlx       = 0.0 
     1392   fb_t_ofl       = 1.0 
     1393   fb_p_asm       = 1.0 
     1394   fb_p_rlx       = 1.0 
     1395   fb_p_ofl       = 0.0 
     1396   eft_rlx        = 365.0 
     1397   eft_asm        = 365.0 
     1398   t_rlx_upd      = 0.1 
     1399   t_asm_upd      = 0.1 
     1400   nn_lat_ramp    = 0           
     1401   bias_time_unit_asm = 86400.0 
     1402   bias_time_unit_rlx = 1.0 
     1403   bias_time_unit_ofl = 1.0  
     1404   cn_bias_tot    = "bias_tot.nc"  
     1405   cn_bias_asm    = "bias_asm.nc" 
     1406   cn_dir         = './'   
     1407   ln_bsyncro     = .FALSE.  
     1408   fctamp         = 1. 
     1409   rn_maxlat_bias = 23.0       
     1410   rn_minlat_bias = 10.0 
     1411   nn_bias_itwrt  = 15 
     1412   ln_itdecay     = .FALSE. 
     1413   ln_incpc       = .FALSE. 
     1414/ 
  • NEMO/branches/UKMO/NEMO_4.0.4_FOAM_pcbias/src/OCE/ASM/bias.F90

    r15359 r15602  
    3131   !!                 fb_p_asm * (t/s)bias_asm_p 
    3232   !!    (t/s)bias is applied directely to correct T and S 
    33    !!    (t/s)bias_p is used to compute rhd_pc and gru/v_pc 
     33   !!    (t/s)bias_p is used to compute rhd_pc 
    3434   !! 
    3535   !!  Note: the above is an adhoc /simple way of making the partition 
     
    7676   USE oce, ONLY: & 
    7777      & tsb, tsn, tsa, & 
    78       & rhop,  & 
    79       & gtsu, gtsv    
     78      & rhop  
    8079   USE tradmp 
    8180   USE dtatsd, ONLY: & 
     
    326325            &      tbias_i(jpi,jpj,jpk), & 
    327326            &      sbias_i(jpi,jpj,jpk), & 
    328             &      rhd_pc(jpi,jpj,jpk) , & 
    329             &      gru_pc(jpi,jpj)     , & 
    330             &      grv_pc(jpi,jpj)       ) 
     327            &      rhd_pc(jpi,jpj,jpk)   ) 
    331328 
    332329         ALLOCATE( fbcoef(jpi,jpj), fbcoef_stscale(jpi,jpj) ) 
     
    391388         tbias_i(:,:,:) = 0.0_wp 
    392389         sbias_i(:,:,:) = 0.0_wp 
    393          gru_pc(:,:)    = 0.0_wp 
    394          grv_pc(:,:)    = 0.0_wp 
     390    rhd_pc(:,:,:)  = 0.0_wp 
    395391          
    396392         IF ( ln_bias_rlx ) THEN 
     
    896892      !!                   ***  ROUTINE dyn_bias  *** 
    897893      !! 
    898       !! ** Purpose :   Computes rhd_pc, gru/v_pc bias corrected 
     894      !! ** Purpose :   Computes rhd_pc bias corrected 
    899895      !!                for hydrostatic pressure gradient 
    900896      !!                depending on time step (semi-implicit/centered) 
     
    914910      !! 
    915911      !! ** Action  : - rhd_pc ready. rhop will be overwriten later 
    916       !!              - if ln_zps, bottom density gradients gru/v_pc ready. 
    917912      !!---------------------------------------------------------------------- 
    918913      !! 
     
    926921      ! gtu,gsu,gtv,gsv rhop will be overwritten later in step. 
    927922      !  
    928       tsw(:,:,:,jp_tem) = tsb(:,:,:,jp_tem) - tbias_p(:,:,:) 
    929       tsw(:,:,:,jp_sal) = tsb(:,:,:,jp_sal) - sbias_p(:,:,:) 
     923      tsw(:,:,:,jp_tem) = tsn(:,:,:,jp_tem) - tbias_p(:,:,:) 
     924      tsw(:,:,:,jp_sal) = tsn(:,:,:,jp_sal) - sbias_p(:,:,:) 
    930925      IF ( ln_incpc ) THEN 
    931          tsw(:,:,:,jp_tem) = tsb(:,:,:,jp_tem) - tbias_p(:,:,:) - tbias_i(:,:,:) 
    932          tsw(:,:,:,jp_sal) = tsb(:,:,:,jp_sal) - sbias_p(:,:,:) - sbias_i(:,:,:) 
     926         tsw(:,:,:,jp_tem) = tsn(:,:,:,jp_tem) - tbias_p(:,:,:) - tbias_i(:,:,:) 
     927         tsw(:,:,:,jp_sal) = tsn(:,:,:,jp_sal) - sbias_p(:,:,:) - sbias_i(:,:,:) 
    933928         IF ( ln_incpc_only ) THEN 
    934929            IF(lwp) WRITE(numout,*) 'ln_incpc_only =', ln_incpc_only, 'tsw updated with IPC only' 
    935             tsw(:,:,:,jp_tem) = tsb(:,:,:,jp_tem) - tbias_i(:,:,:) 
    936             tsw(:,:,:,jp_sal) = tsb(:,:,:,jp_sal) - sbias_i(:,:,:) 
     930            tsw(:,:,:,jp_tem) = tsn(:,:,:,jp_tem) - tbias_i(:,:,:) 
     931            tsw(:,:,:,jp_sal) = tsn(:,:,:,jp_sal) - sbias_i(:,:,:) 
    937932         ENDIF 
    938933      ENDIF 
     
    941936      IF(lwp) WRITE(numout,*) 'dyn_bias( kt ) calculating rhd_pc, kt =', kt 
    942937      CALL eos( tsw, rhd_pc, rhop, gdept_n(:,:,:) ) 
    943        
    944       CALL lbc_lnk( 'bias', rhd_pc, 'T', 1. ) 
    945  
    946  
    947       ! Partial steps: now horizontal gradient of t,s,rd  
    948       ! at the bottom ocean level 
    949  
    950       IF( ln_zps    )  THEN 
    951          CALL zps_hde( kt, jpts, tsw, gtsu, gtsv,  & 
    952             &          rhd_pc, gru_pc , grv_pc  ) 
    953       ENDIF 
     938 
    954939 
    955940   END SUBROUTINE dyn_bias 
  • NEMO/branches/UKMO/NEMO_4.0.4_FOAM_pcbias/src/OCE/ASM/biaspar.F90

    r15359 r15602  
    3434 
    3535 
    36    REAL(wp), PUBLIC, DIMENSION(:,:), ALLOCATABLE :: & 
    37       & gru_pc, &      !: Press corrtd bottom pressure gradient (x-dir) 
    38       & grv_pc         !: Press corrtd bottom pressure gradient (y-dir) 
    39  
    40  
    41  
    4236END MODULE biaspar 
  • NEMO/branches/UKMO/NEMO_4.0.4_FOAM_pcbias/src/OCE/DYN/dynhpg.F90

    r14075 r15602  
    4646   USE timing          ! Timing 
    4747   USE iom 
     48   USE biaspar         ! bias correction variables 
    4849 
    4950   IMPLICIT NONE 
     
    9293      !!---------------------------------------------------------------------- 
    9394      INTEGER, INTENT(in) ::   kt   ! ocean time-step index 
    94       REAL(wp), ALLOCATABLE, DIMENSION(:,:,:) ::   ztrdu, ztrdv 
     95      INTEGER                                   ::   ji, jj, jk                 ! dummy loop indices 
     96      INTEGER                                   ::   iku, ikv                   ! k indices for bottom level at u and v points 
     97      INTEGER                                   ::   numf 
     98      REAL(wp), POINTER, DIMENSION(:,:,:)       ::   ztrdu, ztrdv 
     99      REAL(wp), ALLOCATABLE, DIMENSION(:,:,:)   ::   z_rhd_st, z_rhd_diff       ! tmp density storage for pressure corr 
     100      REAL(wp), ALLOCATABLE, DIMENSION(:,:,:)   ::   z_ua, z_va                 ! tmp store for ua and va including hpg but not pressure correction  
     101      REAL(wp), ALLOCATABLE, DIMENSION(:,:,:)   ::   z_ua_bpc, z_va_bpc         ! ua calculated with bias pressure correction   
     102      REAL(wp), ALLOCATABLE, DIMENSION(:,:)     ::   z_ua_bpc_bot, z_va_bpc_bot ! bias pc fields calculated at the ocean bottom 
    95103      !!---------------------------------------------------------------------- 
    96104      ! 
     
    102110         ztrdv(:,:,:) = va(:,:,:) 
    103111      ENDIF 
     112      ! 
     113      IF ( ln_bias .AND. ln_bias_pc_app ) THEN 
     114 
     115         ! allocate space for tempory variables for the bias pressure correction (bpc) 
     116         ALLOCATE( z_rhd_st(jpi,jpj,jpk), & 
     117            &      z_ua(jpi,jpj,jpk),     & 
     118            &      z_va(jpi,jpj,jpk),     &   
     119            &      z_ua_bpc(jpi,jpj,jpk), & 
     120            &      z_va_bpc(jpi,jpj,jpk), &  
     121            &      z_ua_bpc_bot(jpi,jpj), & 
     122            &      z_va_bpc_bot(jpi,jpj), &  
     123       &      z_rhd_diff(jpi,jpj,jpk)& 
     124            &    ) 
     125 
     126         ! save the original acceleration trends  
     127         ! (z_ua_bpc, z_va_bpc are used as temporary storage) 
     128         z_ua_bpc(:,:,:)     = ua(:,:,:) 
     129         z_va_bpc(:,:,:)     = va(:,:,:) 
     130          
     131      END IF 
    104132      ! 
    105133      SELECT CASE ( nhpg )      ! Hydrostatic pressure gradient computation 
     
    112140      END SELECT 
    113141      ! 
     142      IF ( ln_bias .AND. ln_bias_pc_app ) THEN 
     143 
     144         ! The aim here is to calculate the contribution of the bpc to the acceleration terms. 
     145         ! This is done so that the effect of the bpc on the hpg at the bottom can be removed. 
     146         ! In order to do that: 
     147         !    1. The hpg calculation is done again, but with the contributions of the bpc included. 
     148         !    2. The difference between the acceleration terms (w and w/o bpc) is then calculated. 
     149         !    3. The effect of the bpc on the bottom hpg is then removed. 
     150         !    4. The total change to the acceleration terms is then calculated. 
     151          
     152         ! The original density field (without the bpc) is stored.           
     153         z_rhd_st(:,:,:) = rhd(:,:,:) 
     154 
     155         ! Set the density used in the hpc calculations to the value including the effect of the bpc. 
     156         rhd(:,:,:)      = rhd_pc(:,:,:)  
     157             
     158         ! save the acceleration trends including hpg field but calculated without the bpc fields 
     159         z_ua(:,:,:)     = ua(:,:,:) 
     160         z_va(:,:,:)     = va(:,:,:) 
     161 
     162         ! reset the acceleration trends to their original values 
     163         ua(:,:,:)       = z_ua_bpc(:,:,:)     
     164         va(:,:,:)       = z_va_bpc(:,:,:)   
     165 
     166         ! re-calculate the horizontal pressure gradients with the bpc fields  
     167         SELECT CASE ( nhpg )      ! Hydrostatic pressure gradient computation 
     168         CASE (  np_zco )   ;   CALL hpg_zco    ( kt )      ! z-coordinate 
     169         CASE (  np_zps )   ;   CALL hpg_zps    ( kt )      ! z-coordinate plus partial steps (interpolation) 
     170         CASE (  np_sco )   ;   CALL hpg_sco    ( kt )      ! s-coordinate (standard jacobian formulation) 
     171         CASE (  np_djc )   ;   CALL hpg_djc    ( kt )      ! s-coordinate (Density Jacobian with Cubic polynomial) 
     172         CASE (  np_prj )   ;   CALL hpg_prj    ( kt )      ! s-coordinate (Pressure Jacobian scheme) 
     173         CASE (  np_isf )   ;   CALL hpg_isf    ( kt )      ! s-coordinate similar to sco modify for ice shelf 
     174         END SELECT 
     175 
     176         ! calculate the bpc contribution to ua and va 
     177         z_ua_bpc(:,:,:) = ua(:,:,:) - z_ua(:,:,:) 
     178         z_va_bpc(:,:,:) = va(:,:,:) - z_va(:,:,:) 
     179 
     180         ! calculate the bpc contribution to ua and va at the bottom  
     181         DO jj = 2, jpjm1 
     182            DO ji = 2, jpim1 
     183               iku = mbku(ji,jj) 
     184               ikv = mbkv(ji,jj)  
     185               z_ua_bpc_bot(ji,jj) = z_ua_bpc(ji,jj,iku) 
     186               z_va_bpc_bot(ji,jj) = z_va_bpc(ji,jj,ikv) 
     187            END DO  ! ji 
     188         END DO ! jj 
     189 
     190         ! subtract off the bottom values of bpc contribution to ua and va  
     191         DO jk = 1, jpk - 1 
     192            z_ua_bpc(:,:,jk) = z_ua_bpc(:,:,jk) - z_ua_bpc_bot(:,:) 
     193            z_va_bpc(:,:,jk) = z_va_bpc(:,:,jk) - z_va_bpc_bot(:,:) 
     194         END DO  
     195 
     196         ! calculate ua using the original hpg (z_ua) and the bias hpg  
     197         ! with the bottom pressure gradients subtracted off  
     198         ua(:,:,:) = z_ua(:,:,:) + z_ua_bpc(:,:,:) 
     199         va(:,:,:) = z_va(:,:,:) + z_va_bpc(:,:,:) 
     200 
     201         ! restore original density field 
     202         rhd(:,:,:) = z_rhd_st(:,:,:)      
     203 
     204         ! deallocate tempory variables 
     205         DEALLOCATE( z_rhd_st, z_ua, z_va, z_ua_bpc,   & 
     206            &        z_va_bpc, z_ua_bpc_bot,           & 
     207            &        z_va_bpc_bot, z_rhd_diff          & 
     208            &                                          ) 
     209        
     210      ENDIF  ! ln_bias .AND. ln_bias_pc_app 
     211 
     212 
    114213      IF( l_trddyn ) THEN      ! save the hydrostatic pressure gradient trends for momentum trend diagnostics 
    115214         ztrdu(:,:,:) = ua(:,:,:) - ztrdu(:,:,:) 
  • NEMO/branches/UKMO/NEMO_4.0.4_FOAM_pcbias/src/OCE/step.F90

    r15359 r15602  
    179179                         CALL dyn_ldf       ( kstp )  ! lateral mixing 
    180180      IF( ln_zdfosm  )   CALL dyn_osm       ( kstp )  ! OSMOSIS non-local velocity fluxes 
     181      IF( ln_bias    )   CALL tra_bias      ( kstp )  ! tracer bias 
     182      IF( ln_bias    )   CALL dyn_bias      ( kstp ) 
    181183                         CALL dyn_hpg       ( kstp )  ! horizontal gradient of Hydrostatic pressure 
    182184                         CALL dyn_spg       ( kstp )  ! surface pressure gradient 
     
    232234      IF( ln_trabbl  )   CALL tra_bbl       ( kstp )  ! advective (and/or diffusive) bottom boundary layer scheme 
    233235      IF( ln_tradmp  )   CALL tra_dmp       ( kstp )  ! internal damping trends 
    234       IF( ln_bias    )   CALL tra_bias      ( kstp )  ! tracer bias 
    235236      IF( ln_bdy     )   CALL bdy_tra_dmp   ( kstp )  ! bdy damping trends 
    236237#if defined key_agrif 
     
    265266!!jc2: dynnxt must be the latest call. e3t_b are indeed updated in that routine 
    266267                         CALL tra_nxt       ( kstp )  ! finalize (bcs) tracer fields at next time step and swap 
    267       IF( ln_bias    )   CALL dyn_bias      ( kstp ) 
    268268                         CALL dyn_nxt       ( kstp )  ! finalize (bcs) velocities at next time step and swap (always called after tra_nxt) 
    269269                         CALL ssh_swp       ( kstp )  ! swap of sea surface height 
Note: See TracChangeset for help on using the changeset viewer.