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

Changeset 10055


Ignore:
Timestamp:
2018-08-20T15:17:09+02:00 (6 years ago)
Author:
dford
Message:

Merge in branches/UKMO/dev_r5518_GO6_package_asm_3d_bgc and address conflicts.

Location:
branches/UKMO/dev_r5518_GO6_package_asm_3d_bgc_v3/NEMOGCM
Files:
16 edited
4 copied

Legend:

Unmodified
Added
Removed
  • branches/UKMO/dev_r5518_GO6_package_asm_3d_bgc_v3/NEMOGCM/CONFIG/SHARED/namelist_ref

    r8447 r10055  
    12871287&nam_asminc   !   assimilation increments                               ('key_asminc') 
    12881288!----------------------------------------------------------------------- 
    1289     ln_bkgwri = .false.    !  Logical switch for writing out background state 
    1290     ln_trainc = .false.    !  Logical switch for applying tracer increments 
    1291     ln_dyninc = .false.    !  Logical switch for applying velocity increments 
    1292     ln_sshinc = .false.    !  Logical switch for applying SSH increments 
    1293     ln_asmdin = .false.    !  Logical switch for Direct Initialization (DI) 
    1294     ln_asmiau = .false.    !  Logical switch for Incremental Analysis Updating (IAU) 
    1295     ln_seaiceinc = .false. !  Logical switch for applying sea ice increments 
     1289    ln_bkgwri      = .false. !  Logical switch for writing out background state 
     1290    ln_balwri      = .false. !  Logical switch for writing out balancing increments 
     1291    ln_trainc      = .false. !  Logical switch for applying tracer increments 
     1292    ln_dyninc      = .false. !  Logical switch for applying velocity increments 
     1293    ln_sshinc      = .false. !  Logical switch for applying SSH increments 
     1294    ln_asmdin      = .false. !  Logical switch for Direct Initialization (DI) 
     1295    ln_asmiau      = .false. !  Logical switch for Incremental Analysis Updating (IAU) 
     1296    ln_seaiceinc   = .false. !  Logical switch for applying sea ice increments 
     1297    ln_phytobal    = .false. !  Logical switch for phytoplankton multivariate balancing 
     1298    ln_slchltotinc = .false. !  Logical switch for applying slchltot increments 
     1299    ln_slchldiainc = .false. !  Logical switch for applying slchldia increments 
     1300    ln_slchlnoninc = .false. !  Logical switch for applying slchlnon increments 
     1301    ln_schltotinc  = .false. !  Logical switch for applying schltot increments 
     1302    ln_slphytotinc = .false. !  Logical switch for applying slphytot increments 
     1303    ln_slphydiainc = .false. !  Logical switch for applying slphydia increments 
     1304    ln_slphynoninc = .false. !  Logical switch for applying slphynon increments 
     1305    ln_sfco2inc    = .false. !  Logical switch for applying sfCO2 increments 
     1306    ln_spco2inc    = .false. !  Logical switch for applying spCO2 increments 
     1307    ln_plchltotinc = .false. !  Logical switch for applying plchltot increments 
     1308    ln_pchltotinc  = .false. !  Logical switch for applying pchltot increments 
     1309    ln_pno3inc     = .false. !  Logical switch for applying pno3 increments 
     1310    ln_psi4inc     = .false. !  Logical switch for applying psi4 increments 
     1311    ln_pdicinc     = .false. !  Logical switch for applying pdic increments 
     1312    ln_palkinc     = .false. !  Logical switch for applying palk increments 
     1313    ln_pphinc      = .false. !  Logical switch for applying pph increments 
     1314    ln_po2inc      = .false. !  Logical switch for applying po2 increments 
    12961315    ln_temnofreeze = .false. !  Logical to not add increments if temperature would fall below freezing 
    1297     nitbkg    = 0          !  Timestep of background in [0,nitend-nit000-1] 
    1298     nitdin    = 0          !  Timestep of background for DI in [0,nitend-nit000-1] 
    1299     nitiaustr = 1          !  Timestep of start of IAU interval in [0,nitend-nit000-1] 
    1300     nitiaufin = 15         !  Timestep of end of IAU interval in [0,nitend-nit000-1] 
    1301     niaufn    = 0          !  Type of IAU weighting function 
    1302     ln_salfix = .false.    !  Logical switch for ensuring that the sa > salfixmin 
    1303     salfixmin = -9999      !  Minimum salinity after applying the increments 
    1304     nn_divdmp = 0          !  Number of iterations of divergence damping operator 
     1316    nitbkg         = 0       !  Timestep of background in [0,nitend-nit000-1] 
     1317    nitdin         = 0       !  Timestep of background for DI in [0,nitend-nit000-1] 
     1318    nitiaustr      = 1       !  Timestep of start of IAU interval in [0,nitend-nit000-1] 
     1319    nitiaufin      = 15      !  Timestep of end of IAU interval in [0,nitend-nit000-1] 
     1320    niaufn         = 0       !  Type of IAU weighting function 
     1321    ln_salfix      = .false. !  Logical switch for ensuring that the sa > salfixmin 
     1322    salfixmin      = -9999   !  Minimum salinity after applying the increments 
     1323    nn_divdmp      = 0       !  Number of iterations of divergence damping operator 
     1324    mld_choice_bgc = 1       !  MLD criterion to use for biogeochemistry assimilation 
     1325    rn_maxchlinc   = -999.0  !  maximum absolute non-log chlorophyll increment from ocean colour assimilation 
     1326                             !  <= 0 implies no maximum applied (switch turned off) 
     1327                             !   > 0 implies maximum absolute chl increment capped at this value 
    13051328/ 
    13061329!----------------------------------------------------------------------- 
  • branches/UKMO/dev_r5518_GO6_package_asm_3d_bgc_v3/NEMOGCM/NEMO/OPA_SRC/ASM/asmbkg.F90

    r9321 r10055  
    4949#if defined key_lim3 
    5050   USE ice 
     51#endif 
     52#if defined key_top 
     53   USE asmbgc, ONLY: asm_bgc_bkg_wri 
    5154#endif 
    5255   USE timing 
     
    125128            IF(nn_timing == 2)  CALL timing_stop('iom_rstput') 
    126129            ! 
     130#if defined key_top 
     131            CALL asm_bgc_bkg_wri( kt, inum ) 
     132            ! 
     133#endif 
    127134            CALL iom_close( inum ) 
    128135         ENDIF 
  • branches/UKMO/dev_r5518_GO6_package_asm_3d_bgc_v3/NEMOGCM/NEMO/OPA_SRC/ASM/asminc.F90

    r8400 r10055  
    4444#endif 
    4545   USE sbc_oce          ! Surface boundary condition variables. 
     46   USE asmbgc           ! Biogeochemistry assimilation 
    4647 
    4748   IMPLICIT NONE 
     
    5455   PUBLIC   ssh_asm_inc    !: Apply the SSH increment 
    5556   PUBLIC   seaice_asm_inc !: Apply the seaice increment 
     57   PUBLIC   bgc_asm_inc    !: Apply the biogeochemistry increments 
    5658 
    5759#if defined key_asminc 
     
    6769   LOGICAL, PUBLIC :: ln_sshinc = .FALSE.      !: No sea surface height assimilation increment 
    6870   LOGICAL, PUBLIC :: ln_seaiceinc             !: No sea ice concentration increment 
     71   LOGICAL, PUBLIC :: lk_bgcinc = .FALSE.      !: No biogeochemistry increments 
    6972   LOGICAL, PUBLIC :: ln_salfix = .FALSE.      !: Apply minimum salinity check 
    7073   LOGICAL, PUBLIC :: ln_temnofreeze = .FALSE. !: Don't allow the temperature to drop below freezing 
     
    133136      REAL(wp), POINTER, DIMENSION(:,:) ::   hdiv   ! 2D workspace 
    134137      !! 
    135       NAMELIST/nam_asminc/ ln_bkgwri,                                      & 
     138      NAMELIST/nam_asminc/ ln_bkgwri, ln_balwri,                           & 
    136139         &                 ln_trainc, ln_dyninc, ln_sshinc,                & 
     140         &                 ln_phytobal, ln_slchltotinc, ln_slchldiainc,    & 
     141         &                 ln_slchlnoninc, ln_schltotinc, ln_slphytotinc,  & 
     142         &                 ln_slphydiainc, ln_slphynoninc, ln_spco2inc,    & 
     143         &                 ln_sfco2inc, ln_plchltotinc, ln_pchltotinc,     & 
     144         &                 ln_pno3inc, ln_psi4inc, ln_pdicinc, ln_palkinc, & 
     145         &                 ln_pphinc, ln_po2inc,                           & 
    137146         &                 ln_asmdin, ln_asmiau,                           & 
    138147         &                 nitbkg, nitdin, nitiaustr, nitiaufin, niaufn,   & 
    139148         &                 ln_salfix, salfixmin, nn_divdmp,                & 
    140          &                 ln_seaiceinc, ln_temnofreeze 
     149         &                 ln_seaiceinc, ln_temnofreeze,                   & 
     150         &                 mld_choice_bgc, rn_maxchlinc 
    141151      !!---------------------------------------------------------------------- 
    142152 
     
    161171         WRITE(numout,*) 'asm_inc_init : Assimilation increment initialization :' 
    162172         WRITE(numout,*) '~~~~~~~~~~~~' 
    163          WRITE(numout,*) '   Namelist namasm : set assimilation increment parameters' 
     173         WRITE(numout,*) '   Namelist nam_asminc : set assimilation increment parameters' 
    164174         WRITE(numout,*) '      Logical switch for writing out background state          ln_bkgwri = ', ln_bkgwri 
     175         WRITE(numout,*) '      Logical switch for writing out balancing increments      ln_balwri = ', ln_balwri 
    165176         WRITE(numout,*) '      Logical switch for applying tracer increments            ln_trainc = ', ln_trainc 
    166177         WRITE(numout,*) '      Logical switch for applying velocity increments          ln_dyninc = ', ln_dyninc 
     
    168179         WRITE(numout,*) '      Logical switch for Direct Initialization (DI)            ln_asmdin = ', ln_asmdin 
    169180         WRITE(numout,*) '      Logical switch for applying sea ice increments        ln_seaiceinc = ', ln_seaiceinc 
     181         WRITE(numout,*) '      Logical switch for phytoplankton balancing             ln_phytobal = ', ln_phytobal 
     182         WRITE(numout,*) '      Logical switch for applying slchltot increments     ln_slchltotinc = ', ln_slchltotinc 
     183         WRITE(numout,*) '      Logical switch for applying slchldia increments     ln_slchldiainc = ', ln_slchldiainc 
     184         WRITE(numout,*) '      Logical switch for applying slchlnon increments     ln_slchlnoninc = ', ln_slchlnoninc 
     185         WRITE(numout,*) '      Logical switch for applying schltot increments       ln_schltotinc = ', ln_schltotinc 
     186         WRITE(numout,*) '      Logical switch for applying slphytot increments     ln_slphytotinc = ', ln_slphytotinc 
     187         WRITE(numout,*) '      Logical switch for applying slphydia increments     ln_slphydiainc = ', ln_slphydiainc 
     188         WRITE(numout,*) '      Logical switch for applying slphynon increments     ln_slphynoninc = ', ln_slphynoninc 
     189         WRITE(numout,*) '      Logical switch for applying spco2 increments           ln_spco2inc = ', ln_spco2inc 
     190         WRITE(numout,*) '      Logical switch for applying sfco2 increments           ln_sfco2inc = ', ln_sfco2inc 
     191         WRITE(numout,*) '      Logical switch for applying plchltot increments     ln_plchltotinc = ', ln_plchltotinc 
     192         WRITE(numout,*) '      Logical switch for applying pchltot increments       ln_pchltotinc = ', ln_pchltotinc 
     193         WRITE(numout,*) '      Logical switch for applying pno3 increments             ln_pno3inc = ', ln_pno3inc 
     194         WRITE(numout,*) '      Logical switch for applying psi4 increments             ln_psi4inc = ', ln_psi4inc 
     195         WRITE(numout,*) '      Logical switch for applying pdic increments             ln_pdicinc = ', ln_pdicinc 
     196         WRITE(numout,*) '      Logical switch for applying palk increments             ln_palkinc = ', ln_palkinc 
     197         WRITE(numout,*) '      Logical switch for applying pph increments               ln_pphinc = ', ln_pphinc 
     198         WRITE(numout,*) '      Logical switch for applying po2 increments               ln_po2inc = ', ln_po2inc 
    170199         WRITE(numout,*) '      Logical switch for Incremental Analysis Updating (IAU)   ln_asmiau = ', ln_asmiau 
    171200         WRITE(numout,*) '      Timestep of background in [0,nitend-nit000-1]            nitbkg    = ', nitbkg 
     
    176205         WRITE(numout,*) '      Logical switch for ensuring that the sa > salfixmin      ln_salfix = ', ln_salfix 
    177206         WRITE(numout,*) '      Minimum salinity after applying the increments           salfixmin = ', salfixmin 
     207         WRITE(numout,*) '      Choice of MLD for BGC assimilation                  mld_choice_bgc = ', mld_choice_bgc 
     208         WRITE(numout,*) '      Maximum absolute chlorophyll increment (<=0 = off)    rn_maxchlinc = ', rn_maxchlinc 
    178209      ENDIF 
    179210 
     
    212243         WRITE(numout,*) '       iitiaufin_date = ', iitiaufin_date 
    213244      ENDIF 
     245       
     246      IF ( ln_slchltotinc .OR. ln_slchldiainc .OR. ln_slchlnoninc .OR. & 
     247         & ln_schltotinc  .OR. ln_slphytotinc .OR. ln_slphydiainc .OR. & 
     248         & ln_slphynoninc .OR. ln_spco2inc    .OR. ln_sfco2inc    .OR. & 
     249         & ln_plchltotinc .OR. ln_pchltotinc  .OR. ln_pno3inc     .OR. & 
     250         & ln_psi4inc     .OR. ln_pdicinc     .OR. ln_palkinc     .OR. & 
     251         & ln_pphinc      .OR. ln_po2inc ) THEN 
     252         lk_bgcinc = .TRUE. 
     253      ENDIF 
    214254 
    215255      IF ( nacc /= 0 ) & 
     
    223263 
    224264      IF (      ( ( .NOT. ln_asmdin ).AND.( .NOT. ln_asmiau ) ) & 
    225            .AND.( ( ln_trainc ).OR.( ln_dyninc ).OR.( ln_sshinc ) .OR. ( ln_seaiceinc) )) & 
    226          & CALL ctl_stop( ' One or more of ln_trainc, ln_dyninc, ln_sshinc and ln_seaiceinc is set to .true.', & 
     265         & .AND.( ( ln_trainc ).OR.( ln_dyninc ).OR.( ln_sshinc ).OR.( ln_seaiceinc ).OR. & 
     266         &        ( lk_bgcinc ) )) & 
     267         & CALL ctl_stop( ' One or more of ln_trainc, ln_dyninc, ln_sshinc, ln_seaiceinc,', & 
     268         &                ' ln_(bgc-variable)inc is set to .true.', & 
    227269         &                ' but ln_asmdin and ln_asmiau are both set to .false. :', & 
    228270         &                ' Inconsistent options') 
     
    233275 
    234276      IF ( ( .NOT. ln_trainc ).AND.( .NOT. ln_dyninc ).AND.( .NOT. ln_sshinc ).AND.( .NOT. ln_seaiceinc ) & 
    235          &                     )  & 
    236          & CALL ctl_warn( ' ln_trainc, ln_dyninc, ln_sshinc and ln_seaiceinc are set to .false. :', & 
     277         & .AND.( .NOT. lk_bgcinc ) )  & 
     278         & CALL ctl_warn( ' ln_trainc, ln_dyninc, ln_sshinc, ln_seaiceinc,', & 
     279         &                ' ln_(bgc-variable)inc are set to .false. :', & 
    237280         &                ' The assimilation increments are not applied') 
    238281 
     
    254297         &                ' Background time step for Direct Initialization is outside', & 
    255298         &                ' the cycle interval') 
     299       
     300      IF ( lk_bgcinc ) CALL asm_bgc_check_options 
    256301 
    257302      IF ( nstop > 0 ) RETURN       ! if there are any errors then go no further 
     
    350395      ssh_iau(:,:)    = 0.0 
    351396#endif 
    352       IF ( ( ln_trainc ).OR.( ln_dyninc ).OR.( ln_sshinc ).OR.( ln_seaiceinc ) ) THEN 
     397      IF ( ( ln_trainc ).OR.( ln_dyninc ).OR.( ln_sshinc ).OR.( ln_seaiceinc ) & 
     398         &  .OR.( lk_bgcinc ) ) THEN 
    353399 
    354400         !-------------------------------------------------------------------- 
     
    424470         ENDIF 
    425471 
     472         IF ( lk_bgcinc ) THEN 
     473            CALL asm_bgc_init_incs( inum ) 
     474         ENDIF 
     475 
    426476         CALL iom_close( inum ) 
    427477  
     
    534584         CALL iom_close( inum ) 
    535585 
     586      ENDIF 
     587          
     588      IF ( lk_bgcinc ) THEN 
     589         CALL asm_bgc_init_bkg 
    536590      ENDIF 
    537591      ! 
     
    11551209 
    11561210   END SUBROUTINE seaice_asm_inc 
     1211 
     1212 
     1213   SUBROUTINE bgc_asm_inc( kt ) 
     1214      !!---------------------------------------------------------------------- 
     1215      !!                    ***  ROUTINE bgc_asm_inc  *** 
     1216      !!           
     1217      !! ** Purpose : Apply the biogeochemistry assimilation increments 
     1218      !! 
     1219      !! ** Method  : Call relevant routines in asmbgc 
     1220      !! 
     1221      !! ** Action  : Call relevant routines in asmbgc 
     1222      !! 
     1223      !!---------------------------------------------------------------------- 
     1224      !! 
     1225      INTEGER, INTENT(in   ) :: kt        ! Current time step 
     1226      ! 
     1227      INTEGER                :: icycper   ! Dimension of wgtiau 
     1228      !! 
     1229      !!---------------------------------------------------------------------- 
     1230       
     1231      icycper = SIZE( wgtiau ) 
     1232       
     1233      ! Ocean colour variables first 
     1234      IF ( ln_slchltotinc .OR. ln_slchldiainc .OR. ln_slchlnoninc .OR. & 
     1235         & ln_schltotinc  .OR. ln_slphytotinc .OR. ln_slphydiainc .OR. & 
     1236         & ln_slphynoninc ) THEN 
     1237         CALL phyto2d_asm_inc( kt, ln_asmdin, ln_asmiau, icycper, wgtiau ) 
     1238      ENDIF 
     1239       
     1240      ! Surface pCO2/fCO2 next 
     1241      IF ( ln_sfco2inc .OR. ln_spco2inc ) THEN 
     1242         CALL pco2_asm_inc( kt, ln_asmdin, ln_asmiau, icycper, wgtiau, & 
     1243            &               ln_trainc, t_bkginc, s_bkginc ) 
     1244      ENDIF 
     1245       
     1246      ! Profile pH next 
     1247      IF ( ln_pphinc ) THEN 
     1248         CALL ph_asm_inc( kt, ln_asmdin, ln_asmiau, icycper, wgtiau, & 
     1249            &             ln_trainc, t_bkginc, s_bkginc ) 
     1250      ENDIF 
     1251       
     1252      ! Then chlorophyll profiles 
     1253      IF ( ln_plchltotinc .OR. ln_pchltotinc ) THEN 
     1254         CALL phyto3d_asm_inc( kt, ln_asmdin, ln_asmiau, icycper, wgtiau ) 
     1255      ENDIF 
     1256       
     1257      ! Remaining bgc profile variables 
     1258      IF ( ln_pno3inc .OR. ln_psi4inc .OR. ln_pdicinc .OR. & 
     1259         & ln_palkinc .OR. ln_po2inc ) THEN 
     1260         CALL bgc3d_asm_inc( kt, ln_asmdin, ln_asmiau, icycper, wgtiau ) 
     1261      ENDIF 
     1262 
     1263   END SUBROUTINE bgc_asm_inc 
    11571264    
    11581265   !!====================================================================== 
  • branches/UKMO/dev_r5518_GO6_package_asm_3d_bgc_v3/NEMOGCM/NEMO/OPA_SRC/ASM/asmpar.F90

    r6486 r10055  
    2020      & c_asmtrj = 'assim_trj',                  & !: Filename for storing the  
    2121                                                   !: reference trajectory 
    22       & c_asminc = 'assim_background_increments'  !: Filename for storing the  
     22      & c_asminc = 'assim_background_increments', & !: Filename for storing the  
    2323                                                   !: increments to the background 
    2424                                                   !: state 
     25      & c_asmbal = 'assim.balincs'                 !: Filename for storing the  
     26                                                   !: balancing increments calculated 
     27                                                   !: for biogeochemistry 
    2528 
    2629   INTEGER, PUBLIC :: nitbkg_r      !: Background time step referenced to nit000 
  • branches/UKMO/dev_r5518_GO6_package_asm_3d_bgc_v3/NEMOGCM/NEMO/OPA_SRC/ZDF/zdftmx.F90

    r7179 r10055  
    3838   LOGICAL, PUBLIC, PARAMETER ::   lk_zdftmx = .TRUE.    !: tidal mixing flag 
    3939 
    40    !                       !!* Namelist  namzdf_tmx : tidal mixing * 
    41    REAL(wp) ::  rn_htmx     ! vertical decay scale for turbulence (meters) 
    42    REAL(wp) ::  rn_n2min    ! threshold of the Brunt-Vaisala frequency (s-1) 
    43    REAL(wp) ::  rn_tfe      ! tidal dissipation efficiency (St Laurent et al. 2002) 
    44    REAL(wp) ::  rn_me       ! mixing efficiency (Osborn 1980) 
    45    LOGICAL  ::  ln_tmx_itf  ! Indonesian Through Flow (ITF): Koch-Larrouy et al. (2007) parameterization 
    46    REAL(wp) ::  rn_tfe_itf  ! ITF tidal dissipation efficiency (St Laurent et al. 2002) 
    47  
    48    REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   en_tmx     ! energy available for tidal mixing (W/m2) 
    49    REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:)  ::   mask_itf   ! mask to use over Indonesian area 
    50    REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   az_tmx     ! coefficient used to evaluate the tidal induced Kz 
     40   !                              !!* Namelist  namzdf_tmx : tidal mixing * 
     41   REAL(wp)        ::  rn_htmx     ! vertical decay scale for turbulence (meters) 
     42   REAL(wp)        ::  rn_n2min    ! threshold of the Brunt-Vaisala frequency (s-1) 
     43   REAL(wp)        ::  rn_tfe      ! tidal dissipation efficiency (St Laurent et al. 2002) 
     44   REAL(wp)        ::  rn_me       ! mixing efficiency (Osborn 1980) 
     45   LOGICAL, PUBLIC ::  ln_tmx_itf  ! Indonesian Through Flow (ITF): Koch-Larrouy et al. (2007) parameterization 
     46   REAL(wp)        ::  rn_tfe_itf  ! ITF tidal dissipation efficiency (St Laurent et al. 2002) 
     47 
     48   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:)         ::   en_tmx     ! energy available for tidal mixing (W/m2) 
     49   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:), PUBLIC ::   mask_itf   ! mask to use over Indonesian area 
     50   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:)       ::   az_tmx     ! coefficient used to evaluate the tidal induced Kz 
    5151 
    5252   !! * Substitutions 
  • branches/UKMO/dev_r5518_GO6_package_asm_3d_bgc_v3/NEMOGCM/NEMO/OPA_SRC/nemogcm.F90

    r9321 r10055  
    6161   USE asminc          ! assimilation increments      
    6262   USE asmbkg          ! writing out state trajectory 
     63   USE asmbgc          ! biogeochemical assimilation increments 
    6364   USE diaptr          ! poleward transports           (dia_ptr_init routine) 
    6465   USE diadct          ! sections transports           (dia_dct_init routine) 
     
    160161                IF( ln_dyninc ) CALL dyn_asm_inc( nit000 - 1 )    ! Dynamics 
    161162                IF( ln_sshinc ) CALL ssh_asm_inc( nit000 - 1 )    ! SSH 
     163                IF( lk_bgcinc ) CALL bgc_asm_inc( nit000 - 1 )    ! BGC 
    162164             ENDIF 
    163165          ENDIF 
     
    191193 
    192194      IF( lk_diaobs   )   CALL dia_obs_wri 
     195      ! 
     196      IF( ( lk_asminc ).AND.( ln_balwri ) ) CALL asm_bgc_bal_wri( nitend )  ! Output balancing increments 
    193197      ! 
    194198      IF( ln_icebergs )   CALL icb_end( nitend ) 
  • branches/UKMO/dev_r5518_GO6_package_asm_3d_bgc_v3/NEMOGCM/NEMO/OPA_SRC/step.F90

    r8400 r10055  
    253253      ! Passive Tracer Model 
    254254      !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 
     255      IF( lk_asminc .AND. ln_asmiau .AND. lk_bgcinc ) & 
     256         &               CALL bgc_asm_inc( kstp )     ! biogeochemistry assimilation 
    255257                         CALL trc_stp( kstp )         ! time-stepping 
    256258#endif 
  • branches/UKMO/dev_r5518_GO6_package_asm_3d_bgc_v3/NEMOGCM/NEMO/TOP_SRC/MEDUSA/air_sea.F90

    r10020 r10055  
    7777                                   zn_dms_chd, zn_dms_chn, zn_dms_din,    & 
    7878                                   zn_dms_mld, zn_dms_qsr,                & 
     79# if defined key_foam_medusa 
     80                                   f2_pco2w, f2_fco2w,                    & 
     81# endif 
    7982                                   xnln, xnld  
    8083      USE trc,               ONLY: med_diag 
     
    8790#  else 
    8891      USE trcco2_medusa,     ONLY: trc_co2_medusa 
     92#   if defined key_foam_medusa 
     93      USE mocsy_mainmod,     ONLY: p2fCO2 
     94#   endif 
    8995#  endif 
    9096      USE trcdms_medusa,     ONLY: trc_dms_medusa 
     
    327333                     iters, ' AT (', ji, ', ', jj, ', 1) AT ', kt 
    328334               endif 
     335#    if defined key_foam_medusa 
     336               !! DAF (Aug 2017): calculate fCO2 for observation operator 
     337               CALL p2fCO2( f_pco2w, ztmp, f_pp0, 0.0, 1, f_fco2w ) 
     338#    endif 
    329339            ENDIF 
    330340         ENDDO 
     
    506516                              CO2flux_conv 
    507517               !! ENDIF 
     518#   if defined key_foam_medusa 
     519               !! DAF (Aug 2017): Save pCO2 and fCO2 for observation operator 
     520               f2_pco2w(ji,jj) = f_pco2w(ji,jj) 
     521               f2_fco2w(ji,jj) = f_pco2w(ji,jj) 
     522#   endif 
    508523               IF ( lk_iomput ) THEN 
    509524                  IF( med_diag%ATM_PCO2%dgsave ) THEN 
  • branches/UKMO/dev_r5518_GO6_package_asm_3d_bgc_v3/NEMOGCM/NEMO/TOP_SRC/MEDUSA/bio_medusa_fin.F90

    r10020 r10055  
    4646                                   f3_co3, f3_h2co3, f3_hco3,           & 
    4747                                   f3_omarg, f3_omcal, f3_pH,           & 
     48# if defined key_foam_medusa 
     49                                   mld_max, pgrow_avg,                  & 
     50                                   ploss_avg, phyt_avg,                 & 
     51# endif 
    4852                                   za_sed_c, za_sed_ca, za_sed_fe,      & 
    4953                                   za_sed_n, za_sed_si,                 & 
     
    5559      USE trc,               ONLY: med_diag, nittrc000, trn  
    5660      USE trcnam_trp,        ONLY: ln_trcadv_cen2, ln_trcadv_tvd 
     61# if defined key_foam_medusa 
     62      USE zdfmxl,            ONLY: hmld 
     63# endif 
    5764  
    5865      !! time (integer timestep) 
     
    113120# endif       
    114121 
     122# if defined key_foam_medusa 
     123!!---------------------------------------------------------------------- 
     124!! Diagnostics required for ocean colour assimilation: 
     125!! Mixed layer average phytoplankton growth, loss and concentration 
     126!! Maximum mixed layer depth 
     127!!---------------------------------------------------------------------- 
     128!! 
     129      DO jj = 2,jpjm1 
     130         DO ji = 2,jpim1 
     131            IF ( hmld(ji,jj) .GT. 0.0 ) THEN 
     132               pgrow_avg(ji,jj) = pgrow_avg(ji,jj) / hmld(ji,jj) 
     133               ploss_avg(ji,jj) = ploss_avg(ji,jj) / hmld(ji,jj) 
     134               phyt_avg(ji,jj)  = phyt_avg(ji,jj)  / hmld(ji,jj) 
     135               IF ( hmld(ji,jj) .GT. mld_max(ji,jj) ) THEN 
     136                  mld_max(ji,jj) = hmld(ji,jj) 
     137               ENDIF 
     138            ENDIF 
     139         END DO 
     140      END DO 
     141# endif 
     142 
    115143#  if defined key_debug_medusa 
    116144         !! AXY (12/07/17) 
  • branches/UKMO/dev_r5518_GO6_package_asm_3d_bgc_v3/NEMOGCM/NEMO/TOP_SRC/MEDUSA/bio_medusa_init.F90

    r10020 r10055  
    3535      USE bio_medusa_mod 
    3636      USE par_oce,           ONLY: jpi, jpj, jpk 
     37# if defined key_foam_medusa 
     38      USE sms_medusa,        ONLY: jdms, pgrow_avg, ploss_avg, phyt_avg, mld_max 
     39# else 
    3740      USE sms_medusa,        ONLY: jdms 
     41# endif 
    3842      USE trc,               ONLY: ln_diatrc, med_diag, nittrc000  
    3943      USE in_out_manager,    ONLY: lwp, numout 
     
    195199      fslowsinkc(:,:) = 0.0 
    196200# endif       
     201      !! 
     202# if defined key_foam_medusa 
     203      pgrow_avg(:,:) = 0.0 
     204      ploss_avg(:,:) = 0.0 
     205      phyt_avg(:,:)  = 0.0 
     206      IF( kt == nittrc000 ) THEN 
     207         mld_max(:,:) = 0.0 
     208      ENDIF 
     209# endif 
    197210      !! 
    198211      !! allocate and initiate 2D diag 
  • branches/UKMO/dev_r5518_GO6_package_asm_3d_bgc_v3/NEMOGCM/NEMO/TOP_SRC/MEDUSA/plankton.F90

    r8441 r10055  
    3636                                   fdpn, fdpn2, fdzme, fdzme2,             & 
    3737                                   fdzmi, fdzmi2, fsdiss, fsin,            & 
     38# if defined key_foam_medusa 
     39                                   fdep1, fprn, fprd,                      & 
     40                                   fgmepd, fgmepn, fgmipn,                 & 
     41# endif 
    3842                                   zphd, zphn, zpds, zzme, zzmi 
     43# if defined key_foam_medusa 
     44      USE dom_oce,           ONLY: e3t_0, e3t_n, gdepw_0, gdepw_n, tmask 
     45      USE par_kind,          ONLY: wp 
     46# else 
    3947      USE dom_oce,           ONLY: tmask 
     48# endif 
    4049      USE par_oce,           ONLY: jpim1, jpjm1 
    4150      USE phytoplankton_mod, ONLY: phytoplankton 
    4251      USE sms_medusa,        ONLY: jmpd, jmpn, jmzme, jmzmi,               & 
     52# if defined key_foam_medusa 
     53                                   pgrow_avg, ploss_avg, phyt_avg,         & 
     54# endif 
    4355                                   xkphd, xkphn, xkzme, xkzmi,             & 
    4456                                   xmetapd, xmetapn, xmetazme, xmetazmi,   & 
    4557                                   xmpd, xmpn, xmzme, xmzmi, xsdiss 
     58# if defined key_foam_medusa 
     59      USE zdfmxl,            ONLY: hmld 
     60# endif 
    4661      USE zooplankton_mod,   ONLY: zooplankton 
     62 
     63# if defined key_foam_medusa 
     64   !!* Substitution 
     65#  include "domzgr_substitute.h90" 
     66# endif 
    4767 
    4868      !! Level 
     
    5070 
    5171      INTEGER :: ji, jj 
     72 
     73# if defined key_foam_medusa 
     74      REAL(wp) :: fq0 
     75# endif 
    5276 
    5377      !!------------------------------------------------------------------- 
     
    188212      ENDDO 
    189213 
     214# if defined key_foam_medusa 
     215      !! Mixed layer averages for ocean colour assimilation 
     216      !! 
     217      DO jj = 2,jpjm1 
     218         DO ji = 2,jpim1 
     219            IF (tmask(ji,jj,jk) == 1) THEN 
     220               if (fdep1(ji,jj).le.hmld(ji,jj)) then 
     221                  !! this level is entirely in the mixed layer 
     222                  fq0 = 1.0 
     223               elseif (fsdepw(ji,jj,jk).ge.hmld(ji,jj)) then 
     224                  !! this level is entirely below the mixed layer 
     225                  fq0 = 0.0 
     226               else 
     227                  !! this level straddles the mixed layer 
     228                  fq0 = (hmld(ji,jj) - fsdepw(ji,jj,jk)) / fse3t(ji,jj,jk) 
     229               endif 
     230               !! 
     231               pgrow_avg(ji,jj) = pgrow_avg(ji,jj) +                   & 
     232                                  (((fprn(ji,jj) * zphn(ji,jj)) +      & 
     233                                    (fprd(ji,jj) * zphd(ji,jj))  ) *   & 
     234                                   fse3t(ji,jj,jk) * fq0) 
     235               ploss_avg(ji,jj) = ploss_avg(ji,jj) +                   & 
     236                                  ((fgmepd(ji,jj) + fdpd(ji,jj) +      & 
     237                                    fdpd2(ji,jj)                +      & 
     238                                    fgmepn(ji,jj) + fdpn(ji,jj) +      & 
     239                                    fdpn2(ji,jj)  + fgmipn(ji,jj) ) *  & 
     240                                   fse3t(ji,jj,jk) * fq0) 
     241               phyt_avg(ji,jj)  = phyt_avg(ji,jj)  +                   & 
     242                                  ((zphn(ji,jj) + zphd(ji,jj)) *       & 
     243                                   fse3t(ji,jj,jk) * fq0) 
     244            ENDIF 
     245         ENDDO 
     246      ENDDO 
     247# endif 
     248 
    190249   END SUBROUTINE plankton 
    191250 
  • branches/UKMO/dev_r5518_GO6_package_asm_3d_bgc_v3/NEMOGCM/NEMO/TOP_SRC/MEDUSA/sms_medusa.F90

    r9385 r10055  
    212212   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:)   :: f2_ccd_arg  !: 2D aragonite CCD depth 
    213213!! 
     214#if defined key_foam_medusa 
     215!! 2D fields of pCO2 and fCO2 for observation operator 
     216   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:)   :: f2_pco2w    !: 2D pCO2 
     217   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:)   :: f2_fco2w    !: 2D fCO2 
     218!! 
     219#endif 
    214220!! 2D fields of organic and inorganic material sedimented on the seafloor 
    215221   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:)   :: zb_sed_n    !: 2D organic nitrogen   (before) 
     
    299305#else 
    300306   LOGICAL , PUBLIC ::   lk_pi_co2 = .FALSE. !: PI xCO2 unused 
     307# if defined key_foam_medusa 
     308   REAL(wp) ::   xobs_xco2a   !: Observed atmospheric xCO2, read in 
     309# endif 
    301310#endif 
    302311 
     
    349358   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:)   :: cmask       !: ??? 
    350359 
     360#if defined key_foam_medusa 
     361!!---------------------------------------------------------------------- 
     362!! Parameters required for ocean colour assimilation 
     363!!---------------------------------------------------------------------- 
     364!! 
     365   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) :: pgrow_avg  !: Mixed layer average phytoplankton growth 
     366   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) :: ploss_avg  !: Mixed layer average phytoplankton loss 
     367   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) :: phyt_avg   !: Mixed layer average phytoplankton 
     368   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) :: mld_max    !: Maximum mixed layer depth 
     369!! 
     370#endif 
     371 
    351372   !!---------------------------------------------------------------------- 
    352373   !! NEMO/TOP 3.3 , NEMO Consortium (2010) 
     
    361382      !!---------------------------------------------------------------------- 
    362383      USE lib_mpp , ONLY: ctl_warn 
    363       INTEGER ::   ierr(8)        ! Local variables 
     384      INTEGER ::   ierr(9)        ! Local variables 
    364385      !!---------------------------------------------------------------------- 
    365386      ierr(:) = 0 
     
    371392      !* 2D and 3D fields of carbonate system parameters 
    372393      ALLOCATE( f2_ccd_cal(jpi,jpj)  , f2_ccd_arg(jpi,jpj)  ,       & 
     394#  if defined key_foam_medusa 
     395                f2_pco2w(jpi,jpj)    , f2_fco2w(jpi,jpj)    ,       & 
     396#  endif 
    373397         &      f3_pH(jpi,jpj,jpk)   , f3_h2co3(jpi,jpj,jpk),       & 
    374398         &      f3_hco3(jpi,jpj,jpk) , f3_co3(jpi,jpj,jpk)  ,       & 
     
    419443         &      ffln(jpi,jpj,jpk)    , fflf(jpi,jpj,jpk)    ,       & 
    420444         &      ffls(jpi,jpj,jpk)    , cmask(jpi,jpj)       ,    STAT=ierr(8) )  
     445# if defined key_foam_medusa 
     446      ALLOCATE( pgrow_avg(jpi,jpj)   , ploss_avg(jpi,jpj)   ,       & 
     447         &      phyt_avg(jpi,jpj)    , mld_max(jpi,jpj)     ,    STAT=ierr(9) ) 
     448# endif 
    421449#endif 
    422450      ! 
  • branches/UKMO/dev_r5518_GO6_package_asm_3d_bgc_v3/NEMOGCM/NEMO/TOP_SRC/MEDUSA/trcbio_medusa.F90

    r10020 r10055  
    105105      USE sbc_oce,                    ONLY: lk_oasis 
    106106      USE sms_medusa,                 ONLY: hist_pco2, co2_yinit, co2_yend, & 
     107# if defined key_foam_medusa 
     108                                            xobs_xco2a, pgrow_avg,          & 
     109                                            ploss_avg, phyt_avg, mld_max,   & 
     110# endif 
    107111                                            lk_pi_co2 
    108112      USE trc,                        ONLY: ln_rsttr, nittrc000, trn 
     
    330334         !! f_xco2a(:,:) = 284.725       !! CMIP5 pre-industrial pCO2 
    331335         f_xco2a(:,:) = 284.317          !! CMIP6 pre-industrial pCO2  
     336#  if defined key_foam_medusa 
     337      ELSEIF ( xobs_xco2a > 0.0 ) THEN 
     338         IF(lwp) WRITE(numout,*) ' using observed atm pCO2 = ', xobs_xco2a 
     339         f_xco2a(:,:) = xobs_xco2a 
     340#  endif 
    332341      ELSE       
    333342         !! xCO2 from file 
     
    418427      !! now use the NEMO calendar tool : nsec_month to be sure to call  
    419428      !! at the beginning of a new month . 
     429#if defined key_foam_medusa 
     430      !! DAF: For FOAM we want to run daily 
     431      IF ( (kt == nittrc000 .AND. .NOT.ln_rsttr) .OR.                        & 
     432           (MOD(kt*rdt, 86400.0) == rdt) ) THEN 
     433#else 
    420434      IF ( (kt == nittrc000 .AND. .NOT.ln_rsttr) .OR.                        & 
    421435           ( nsec_month .LE. INT(rdt) ) )  THEN 
     436#endif 
    422437           IF ( lwp )  WRITE(numout,*)                                       &          
    423438                              ' *** 3D carb chem call *** -- kt:', kt,       & 
  • branches/UKMO/dev_r5518_GO6_package_asm_3d_bgc_v3/NEMOGCM/NEMO/TOP_SRC/MEDUSA/trcini_medusa.F90

    r9385 r10055  
    330330      !!---------------------------------------------------------------------- 
    331331      !!  
     332# if defined key_foam_medusa 
     333      IF( ( .NOT.lk_oasis ) .AND. ( .NOT.lk_pi_co2 ) .AND. ( xobs_xco2a > 0.0 ) ) THEN 
     334# else 
    332335      IF( ( .NOT.lk_oasis ) .AND. ( .NOT.lk_pi_co2 ) ) THEN 
     336# endif 
    333337         IF(lwp) WRITE(numout,*) ' trc_ini_medusa: initialisating atm CO2 record' 
    334338         CALL trc_ini_medusa_co2atm 
  • branches/UKMO/dev_r5518_GO6_package_asm_3d_bgc_v3/NEMOGCM/NEMO/TOP_SRC/MEDUSA/trcnam_medusa.F90

    r9258 r10055  
    9090#if defined key_roam 
    9191      NAMELIST/natroam/ xthetaphy,xthetazoo,xthetanit,        & 
     92# if defined key_foam_medusa 
     93      &    xobs_xco2a,                                        & 
     94# endif 
    9295      &    xthetarem,xo2min  
    9396#endif 
     
    490493         &   ' key_debug_medusa                                                       = INACTIVE' 
    491494# endif 
     495#if defined key_foam_medusa 
     496         WRITE(numout,*)     & 
     497         &   ' key_foam_medusa                                                        = ACTIVE' 
     498#else 
     499         WRITE(numout,*)     & 
     500         &   ' key_foam_medusa                                                        = INACTIVE' 
     501#endif 
    492502         WRITE(numout,*) ' ' 
    493503 
     
    10301040      xthetarem = 0. 
    10311041      xo2min    = 0. 
     1042# if defined key_foam_medusa 
     1043      xobs_xco2a = 0. 
     1044# endif 
    10321045 
    10331046      !READ(numnatm,natroam) 
     
    10491062!!       xthetarem :  oxygen consumption by carbon remineralisation 
    10501063!!       xo2min    :  oxygen minimum concentration 
     1064# if defined key_foam_medusa 
     1065!!       xobs_xco2a : observed atmospheric xCO2 
     1066# endif 
    10511067 
    10521068      IF(lwp) THEN 
     
    10661082          WRITE(numout,*)     & 
    10671083          &   ' oxygen minimum concentration                               xo2min      = ', xo2min 
     1084# if defined key_foam_medusa 
     1085          WRITE(numout,*)     & 
     1086          &   ' observed atmospheric xCO2                                  xobs_xco2a  = ', xobs_xco2a 
     1087# endif 
    10681088       ENDIF 
    10691089 
  • branches/UKMO/dev_r5518_GO6_package_asm_3d_bgc_v3/NEMOGCM/NEMO/TOP_SRC/trcrst.F90

    r9975 r10055  
    4545   USE oce,     ONLY: CO2Flux_out_cpl, DMS_out_cpl, chloro_out_cpl  !! Coupling variable 
    4646   USE trcstat 
     47#if defined key_foam_medusa 
     48   USE obs_const, ONLY: obfillflt  ! Observation operator fill value 
     49#endif 
    4750 
    4851   IMPLICIT NONE 
     
    338341         IF(lwp) WRITE(numout,*) 'Or don t start from uncomplete restart...'  
    339342      ENDIF 
     343      ! 
     344#  if defined key_foam_medusa 
     345      !! 2D fields of pCO2 and fCO2 for observation operator on first timestep 
     346      IF( iom_varid( numrtr, 'PCO2W', ldstop = .FALSE. ) > 0 ) THEN 
     347         IF(lwp) WRITE(numout,*) ' MEDUSA pCO2 present - reading in ...' 
     348         CALL iom_get( numrtr, jpdom_autoglo, 'PCO2W',  f2_pco2w(:,:)  ) 
     349         CALL iom_get( numrtr, jpdom_autoglo, 'FCO2W',  f2_fco2w(:,:)  ) 
     350      ELSE 
     351         IF(lwp) WRITE(numout,*) ' MEDUSA pCO2 absent - setting to fill ...' 
     352         f2_pco2w(:,:) = obfillflt * tmask(:,:,1) 
     353         f2_fco2w(:,:) = obfillflt * tmask(:,:,1) 
     354      ENDIF 
     355#  endif 
    340356# endif 
    341  
     357# if defined key_foam_medusa 
     358      !! Fields for ocean colour assimilation on first timestep 
     359      IF( iom_varid( numrtr, 'pgrow_avg', ldstop = .FALSE. ) > 0 ) THEN 
     360         IF(lwp) WRITE(numout,*) ' MEDUSA pgrow_avg present - reading in ...' 
     361         CALL iom_get( numrtr, jpdom_autoglo, 'pgrow_avg',  pgrow_avg(:,:)  ) 
     362         CALL iom_get( numrtr, jpdom_autoglo, 'ploss_avg',  ploss_avg(:,:)  ) 
     363         CALL iom_get( numrtr, jpdom_autoglo, 'phyt_avg',   phyt_avg(:,:)   ) 
     364         CALL iom_get( numrtr, jpdom_autoglo, 'mld_max',    mld_max(:,:)    ) 
     365      ELSE 
     366         IF(lwp) WRITE(numout,*) ' MEDUSA pgrow_avg absent - setting to zero ...' 
     367         pgrow_avg(:,:) = 0.0 
     368         ploss_avg(:,:) = 0.0 
     369         phyt_avg(:,:)  = 0.0 
     370         mld_max(:,:)   = 0.0 
     371      ENDIF 
     372# endif 
    342373 
    343374#endif 
     
    510541      call trc_rst_dia_stat( f2_ccd_arg(:,:),'CCD_ARG') 
    511542      !! 
     543#  if defined key_foam_medusa 
     544      !! Fields for observation operator on first timestep 
     545      IF(lwp) WRITE(numout,*) ' MEDUSA OBS fields - writing out ...' 
     546      CALL iom_rstput( kt, nitrst, numrtw, 'PCO2W', f2_pco2w(:,:)  ) 
     547      CALL iom_rstput( kt, nitrst, numrtw, 'FCO2W', f2_fco2w(:,:)  ) 
     548#  endif 
     549# endif 
     550# if defined key_foam_medusa 
     551      !! Fields for assimilation on first timestep 
     552      IF(lwp) WRITE(numout,*) ' MEDUSA ASM fields - writing out ...' 
     553      CALL iom_rstput( kt, nitrst, numrtw, 'pgrow_avg', pgrow_avg(:,:) ) 
     554      CALL iom_rstput( kt, nitrst, numrtw, 'ploss_avg', ploss_avg(:,:) ) 
     555      CALL iom_rstput( kt, nitrst, numrtw, 'phyt_avg',  phyt_avg(:,:)  ) 
     556      CALL iom_rstput( kt, nitrst, numrtw, 'mld_max',   mld_max(:,:)   ) 
    512557# endif 
    513558!! 
Note: See TracChangeset for help on using the changeset viewer.