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 10728 for branches/UKMO/AMM15_v3_6_STABLE_package_collate/NEMOGCM/NEMO/OPA_SRC/ASM/asminc.F90 – NEMO

Ignore:
Timestamp:
2019-02-28T13:10:20+01:00 (5 years ago)
Author:
dford
Message:

Changes for assimilation of biogeochemical variables. See https://code.metoffice.gov.uk/trac/utils/ticket/174.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/UKMO/AMM15_v3_6_STABLE_package_collate/NEMOGCM/NEMO/OPA_SRC/ASM/asminc.F90

    r9537 r10728  
    5252   USE bdy_oce, ONLY: bdytmask   
    5353#endif   
     54   USE asmbgc           ! Biogeochemistry assimilation 
    5455 
    5556   IMPLICIT NONE 
     
    6263   PUBLIC   ssh_asm_inc    !: Apply the SSH increment 
    6364   PUBLIC   seaice_asm_inc !: Apply the seaice increment 
     65   PUBLIC   bgc_asm_inc    !: Apply the biogeochemistry increments 
    6466 
    6567#if defined key_asminc 
     
    7678   LOGICAL, PUBLIC :: ln_sshinc = .FALSE.      !: No sea surface height assimilation increment 
    7779   LOGICAL, PUBLIC :: ln_seaiceinc             !: No sea ice concentration increment 
     80   LOGICAL, PUBLIC :: lk_bgcinc = .FALSE.      !: No biogeochemistry increments 
    7881   LOGICAL, PUBLIC :: ln_salfix = .FALSE.      !: Apply minimum salinity check 
    7982   LOGICAL, PUBLIC :: ln_temnofreeze = .FALSE. !: Don't allow the temperature to drop below freezing 
     
    161164                               !               so only apply surft increments. 
    162165      !! 
    163       NAMELIST/nam_asminc/ ln_bkgwri, ln_avgbkg,                           & 
     166      NAMELIST/nam_asminc/ ln_bkgwri, ln_avgbkg, ln_balwri,                & 
    164167         &                 ln_trainc, ln_dyninc, ln_sshinc,                & 
     168         &                 ln_phytobal, ln_slchltotinc, ln_slchldiainc,    & 
     169         &                 ln_slchlnaninc, ln_slchlpicinc, ln_slchldininc, & 
     170         &                 ln_slchlnoninc, ln_schltotinc, ln_slphytotinc,  & 
     171         &                 ln_slphydiainc, ln_slphynoninc, ln_spco2inc,    & 
     172         &                 ln_sfco2inc, ln_plchltotinc, ln_pchltotinc,     & 
     173         &                 ln_pno3inc, ln_psi4inc, ln_pdicinc, ln_palkinc, & 
     174         &                 ln_pphinc, ln_po2inc, ln_ppo4inc,               & 
    165175         &                 ln_asmdin, ln_asmiau,                           & 
    166176         &                 nitbkg, nitdin, nitiaustr, nitiaufin, niaufn,   & 
    167          &                 ln_salfix, salfixmin, nn_divdmp, nitavgbkg, mld_choice 
     177         &                 ln_salfix, salfixmin, nn_divdmp, nitavgbkg,     & 
     178         &                 mld_choice, mld_choice_bgc, rn_maxchlinc 
    168179      !!---------------------------------------------------------------------- 
    169180 
     
    205216         WRITE(numout,*) 'asm_inc_init : Assimilation increment initialization :' 
    206217         WRITE(numout,*) '~~~~~~~~~~~~' 
    207          WRITE(numout,*) '   Namelist namasm : set assimilation increment parameters' 
     218         WRITE(numout,*) '   Namelist nam_asminc : set assimilation increment parameters' 
    208219         WRITE(numout,*) '      Logical switch for writing out background state          ln_bkgwri = ', ln_bkgwri 
    209220         WRITE(numout,*) '      Logical switch for writing mean background state         ln_avgbkg = ', ln_avgbkg 
     221         WRITE(numout,*) '      Logical switch for writing out balancing increments      ln_balwri = ', ln_balwri 
    210222         WRITE(numout,*) '      Logical switch for applying tracer increments            ln_trainc = ', ln_trainc 
    211223         WRITE(numout,*) '      Logical switch for applying velocity increments          ln_dyninc = ', ln_dyninc 
     
    213225         WRITE(numout,*) '      Logical switch for Direct Initialization (DI)            ln_asmdin = ', ln_asmdin 
    214226         WRITE(numout,*) '      Logical switch for applying sea ice increments        ln_seaiceinc = ', ln_seaiceinc 
     227         WRITE(numout,*) '      Logical switch for phytoplankton balancing             ln_phytobal = ', ln_phytobal 
     228         WRITE(numout,*) '      Logical switch for applying slchltot increments     ln_slchltotinc = ', ln_slchltotinc 
     229         WRITE(numout,*) '      Logical switch for applying slchldia increments     ln_slchldiainc = ', ln_slchldiainc 
     230         WRITE(numout,*) '      Logical switch for applying slchlnon increments     ln_slchlnoninc = ', ln_slchlnoninc 
     231         WRITE(numout,*) '      Logical switch for applying slchlnan increments     ln_slchlnaninc = ', ln_slchlnaninc 
     232         WRITE(numout,*) '      Logical switch for applying slchlpic increments     ln_slchlpicinc = ', ln_slchlpicinc 
     233         WRITE(numout,*) '      Logical switch for applying slchldin increments     ln_slchldininc = ', ln_slchldininc 
     234         WRITE(numout,*) '      Logical switch for applying schltot increments       ln_schltotinc = ', ln_schltotinc 
     235         WRITE(numout,*) '      Logical switch for applying slphytot increments     ln_slphytotinc = ', ln_slphytotinc 
     236         WRITE(numout,*) '      Logical switch for applying slphydia increments     ln_slphydiainc = ', ln_slphydiainc 
     237         WRITE(numout,*) '      Logical switch for applying slphynon increments     ln_slphynoninc = ', ln_slphynoninc 
     238         WRITE(numout,*) '      Logical switch for applying spco2 increments           ln_spco2inc = ', ln_spco2inc 
     239         WRITE(numout,*) '      Logical switch for applying sfco2 increments           ln_sfco2inc = ', ln_sfco2inc 
     240         WRITE(numout,*) '      Logical switch for applying plchltot increments     ln_plchltotinc = ', ln_plchltotinc 
     241         WRITE(numout,*) '      Logical switch for applying pchltot increments       ln_pchltotinc = ', ln_pchltotinc 
     242         WRITE(numout,*) '      Logical switch for applying pno3 increments             ln_pno3inc = ', ln_pno3inc 
     243         WRITE(numout,*) '      Logical switch for applying psi4 increments             ln_psi4inc = ', ln_psi4inc 
     244         WRITE(numout,*) '      Logical switch for applying ppo4 increments             ln_ppo4inc = ', ln_ppo4inc 
     245         WRITE(numout,*) '      Logical switch for applying pdic increments             ln_pdicinc = ', ln_pdicinc 
     246         WRITE(numout,*) '      Logical switch for applying palk increments             ln_palkinc = ', ln_palkinc 
     247         WRITE(numout,*) '      Logical switch for applying pph increments               ln_pphinc = ', ln_pphinc 
     248         WRITE(numout,*) '      Logical switch for applying po2 increments               ln_po2inc = ', ln_po2inc 
    215249         WRITE(numout,*) '      Logical switch for Incremental Analysis Updating (IAU)   ln_asmiau = ', ln_asmiau 
    216250         WRITE(numout,*) '      Timestep of background in [0,nitend-nit000-1]            nitbkg    = ', nitbkg 
     
    223257         WRITE(numout,*) '      Minimum salinity after applying the increments           salfixmin = ', salfixmin 
    224258         WRITE(numout,*) '      Choice of MLD for physics assimilation                  mld_choice = ', mld_choice 
     259         WRITE(numout,*) '      Choice of MLD for BGC assimilation                  mld_choice_bgc = ', mld_choice_bgc 
     260         WRITE(numout,*) '      Maximum absolute chlorophyll increment (<=0 = off)    rn_maxchlinc = ', rn_maxchlinc 
    225261      ENDIF 
    226262 
     
    263299         WRITE(numout,*) '       iitavgbkg_date = ', iitavgbkg_date 
    264300      ENDIF 
     301      IF ( ln_slchltotinc .OR. ln_slchldiainc .OR. ln_slchlnoninc .OR. & 
     302         & ln_slchlnaninc .OR. ln_slchlpicinc .OR. ln_slchldininc .OR. & 
     303         & ln_schltotinc  .OR. ln_slphytotinc .OR. ln_slphydiainc .OR. & 
     304         & ln_slphynoninc .OR. ln_spco2inc    .OR. ln_sfco2inc    .OR. & 
     305         & ln_plchltotinc .OR. ln_pchltotinc  .OR. ln_pno3inc     .OR. & 
     306         & ln_psi4inc     .OR. ln_pdicinc     .OR. ln_palkinc     .OR. & 
     307         & ln_pphinc      .OR. ln_po2inc      .OR. ln_ppo4inc ) THEN 
     308         lk_bgcinc = .TRUE. 
     309      ENDIF 
    265310 
    266311      IF ( nacc /= 0 ) & 
     
    274319 
    275320      IF (      ( ( .NOT. ln_asmdin ).AND.( .NOT. ln_asmiau ) ) & 
    276            .AND.( ( ln_trainc ).OR.( ln_dyninc ).OR.( ln_sshinc ) .OR. ( ln_seaiceinc) )) & 
    277          & CALL ctl_stop( ' One or more of ln_trainc, ln_dyninc, ln_sshinc and ln_seaiceinc is set to .true.', & 
     321         & .AND.( ( ln_trainc ).OR.( ln_dyninc ).OR.( ln_sshinc ).OR.( ln_seaiceinc ).OR. & 
     322         &        ( lk_bgcinc ) )) & 
     323         & CALL ctl_stop( ' One or more of ln_trainc, ln_dyninc, ln_sshinc, ln_seaiceinc,', & 
     324         &                ' ln_(bgc-variable)inc is set to .true.', & 
    278325         &                ' but ln_asmdin and ln_asmiau are both set to .false. :', & 
    279326         &                ' Inconsistent options') 
     
    284331 
    285332      IF ( ( .NOT. ln_trainc ).AND.( .NOT. ln_dyninc ).AND.( .NOT. ln_sshinc ).AND.( .NOT. ln_seaiceinc ) & 
    286          &                     )  & 
    287          & CALL ctl_warn( ' ln_trainc, ln_dyninc, ln_sshinc and ln_seaiceinc are set to .false. :', & 
     333         & .AND.( .NOT. lk_bgcinc ) )  & 
     334         & CALL ctl_warn( ' ln_trainc, ln_dyninc, ln_sshinc, ln_seaiceinc,', & 
     335         &                ' ln_(bgc-variable)inc are set to .false. :', & 
    288336         &                ' The assimilation increments are not applied') 
    289337 
     
    310358         &                ' Assim bkg averaging period is outside', & 
    311359         &                ' the cycle interval') 
     360       
     361      IF ( lk_bgcinc ) CALL asm_bgc_check_options 
    312362 
    313363      IF ( nstop > 0 ) RETURN       ! if there are any errors then go no further 
     
    412462      ssh_iau(:,:)    = 0.0 
    413463#endif 
    414       IF ( ( ln_trainc ).OR.( ln_dyninc ).OR.( ln_sshinc ).OR.( ln_seaiceinc ) ) THEN 
     464      IF ( ( ln_trainc ).OR.( ln_dyninc ).OR.( ln_sshinc ).OR.( ln_seaiceinc ) & 
     465         &  .OR.( lk_bgcinc ) ) THEN 
    415466 
    416467         !-------------------------------------------------------------------- 
     
    545596         ENDIF 
    546597 
     598         IF ( lk_bgcinc ) THEN 
     599            CALL asm_bgc_init_incs( inum ) 
     600         ENDIF 
     601 
    547602         CALL iom_close( inum ) 
    548603  
     
    655710         CALL iom_close( inum ) 
    656711 
     712      ENDIF 
     713          
     714      IF ( lk_bgcinc ) THEN 
     715         CALL asm_bgc_init_bkg 
    657716      ENDIF 
    658717      ! 
     
    12761335 
    12771336   END SUBROUTINE seaice_asm_inc 
     1337 
     1338 
     1339   SUBROUTINE bgc_asm_inc( kt ) 
     1340      !!---------------------------------------------------------------------- 
     1341      !!                    ***  ROUTINE bgc_asm_inc  *** 
     1342      !!           
     1343      !! ** Purpose : Apply the biogeochemistry assimilation increments 
     1344      !! 
     1345      !! ** Method  : Call relevant routines in asmbgc 
     1346      !! 
     1347      !! ** Action  : Call relevant routines in asmbgc 
     1348      !! 
     1349      !!---------------------------------------------------------------------- 
     1350      !! 
     1351      INTEGER, INTENT(in   ) :: kt        ! Current time step 
     1352      ! 
     1353      INTEGER                :: icycper   ! Dimension of wgtiau 
     1354      !! 
     1355      !!---------------------------------------------------------------------- 
     1356       
     1357      icycper = SIZE( wgtiau ) 
     1358       
     1359      ! Ocean colour variables first 
     1360      IF ( ln_slchltotinc .OR. ln_slchldiainc .OR. ln_slchlnoninc .OR. & 
     1361         & ln_slchlnaninc .OR. ln_slchlpicinc .OR. ln_slchldininc .OR. & 
     1362         & ln_schltotinc  .OR. ln_slphytotinc .OR. ln_slphydiainc .OR. & 
     1363         & ln_slphynoninc ) THEN 
     1364         CALL phyto2d_asm_inc( kt, ln_asmdin, ln_asmiau, icycper, wgtiau ) 
     1365      ENDIF 
     1366       
     1367      ! Surface pCO2/fCO2 next 
     1368      IF ( ln_sfco2inc .OR. ln_spco2inc ) THEN 
     1369         CALL pco2_asm_inc( kt, ln_asmdin, ln_asmiau, icycper, wgtiau, & 
     1370            &               ln_trainc, t_bkginc, s_bkginc ) 
     1371      ENDIF 
     1372       
     1373      ! Profile pH next 
     1374      IF ( ln_pphinc ) THEN 
     1375         CALL ph_asm_inc( kt, ln_asmdin, ln_asmiau, icycper, wgtiau, & 
     1376            &             ln_trainc, t_bkginc, s_bkginc ) 
     1377      ENDIF 
     1378       
     1379      ! Then chlorophyll profiles 
     1380      IF ( ln_plchltotinc .OR. ln_pchltotinc ) THEN 
     1381         CALL phyto3d_asm_inc( kt, ln_asmdin, ln_asmiau, icycper, wgtiau ) 
     1382      ENDIF 
     1383       
     1384      ! Remaining bgc profile variables 
     1385      IF ( ln_pno3inc .OR. ln_psi4inc .OR. ln_pdicinc .OR. & 
     1386         & ln_palkinc .OR. ln_po2inc  .OR. ln_ppo4inc ) THEN 
     1387         CALL bgc3d_asm_inc( kt, ln_asmdin, ln_asmiau, icycper, wgtiau ) 
     1388      ENDIF 
     1389 
     1390   END SUBROUTINE bgc_asm_inc 
    12781391    
    12791392   !!====================================================================== 
Note: See TracChangeset for help on using the changeset viewer.