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.
asmlogchlbal_hadocc.F90 in branches/UKMO/dev_r5518_GO6_package_asm_surf_bgc/NEMOGCM/NEMO/OPA_SRC/ASM – NEMO

source: branches/UKMO/dev_r5518_GO6_package_asm_surf_bgc/NEMOGCM/NEMO/OPA_SRC/ASM/asmlogchlbal_hadocc.F90 @ 8428

Last change on this file since 8428 was 8428, checked in by dford, 7 years ago

Add logchl assimilation, with nitrogen balancing for HadOCC.

File size: 14.8 KB
Line 
1MODULE asmlogchlbal_hadocc
2   !!======================================================================
3   !!                       ***  MODULE asmlogchlbal_hadocc  ***
4   !! Calculate increments to HadOCC based on surface logchl increments
5   !!
6   !! IMPORTANT NOTE: This calls the bioanalysis routine of Hemmings et al.
7   !! For licensing reasons this is kept in its own internal Met Office
8   !! branch (dev/frdf/vn3.6_nitrogen_balancing) rather than in the Paris
9   !! repository, and must be merged in when building.
10   !!
11   !!======================================================================
12   !! History :  3.6  ! 2017-08  (D. Ford)     Adapted from bioanal.F90
13   !!----------------------------------------------------------------------
14#if defined key_asminc && defined key_hadocc
15   !!----------------------------------------------------------------------
16   !! 'key_asminc'          : assimilation increment interface
17   !! 'key_hadocc'          : HadOCC model
18   !!----------------------------------------------------------------------
19   !! asm_logchl_bal_hadocc : routine to calculate increments to HadOCC
20   !!----------------------------------------------------------------------
21   USE par_kind,      ONLY: wp             ! kind parameters
22   USE par_oce,       ONLY: jpi, jpj, jpk  ! domain array sizes
23   USE dom_oce,       ONLY: gdepw_n        ! domain information
24   USE zdfmxl                              ! mixed layer depth
25   USE iom                                 ! i/o
26   USE trc,           ONLY: trn, trb,    & ! HadOCC variables
27      &                     HADOCC_CHL,  &
28      &                     pgrow_avg,   &
29      &                     ploss_avg,   &
30      &                     phyt_avg,    &
31      &                     mld_max
32   USE par_hadocc                          ! HadOCC parameters
33   USE had_bgc_stnd,  ONLY: kmt            ! HadOCC parameters
34   USE had_bgc_const                       ! HadOCC parameters
35   USE par_trc,       ONLY: jptra          ! Tracer parameters
36   USE bioanalysis                         ! Nitrogen balancing
37
38   IMPLICIT NONE
39   PRIVATE                   
40
41   PUBLIC asm_logchl_bal_hadocc
42
43   ! Default values for biological assimilation parameters
44   ! Should match Hemmings et al. (2008)
45   REAL(wp), PARAMETER :: balnutext  =  0.6    !: Default nutrient balancing factor
46   REAL(wp), PARAMETER :: balnutmin  =  0.1    !: Fraction of phytoplankton loss to nutrient
47   REAL(wp), PARAMETER :: r          =  1      !: Reliability of model specific growth rate
48   REAL(wp), PARAMETER :: beta_g     =  0.05   !: Low rate bias correction for growth rate estimator
49   REAL(wp), PARAMETER :: beta_l     =  0.05   !: Low rate bias correction for primary loss rate estimator
50   REAL(wp), PARAMETER :: beta_m     =  0.05   !: Low rate bias correction for secondary loss rate estimator
51   REAL(wp), PARAMETER :: a_g        =  0.2    !: Error s.d. for log10 of growth rate estimator
52   REAL(wp), PARAMETER :: a_l        =  0.4    !: Error s.d. for log10 of primary loss rate estimator
53   REAL(wp), PARAMETER :: a_m        =  0.7    !: Error s.d. for log10 of secondary loss rate estimator
54   REAL(wp), PARAMETER :: zfracb0    =  0.7    !: Base zooplankton fraction of loss to Z & D
55   REAL(wp), PARAMETER :: zfracb1    =  0      !: Phytoplankton sensitivity of zooplankton fraction
56   REAL(wp), PARAMETER :: qrfmax     =  1.1    !: Maximum nutrient limitation reduction factor
57   REAL(wp), PARAMETER :: qafmax     =  1.1    !: Maximum nutrient limitation amplification factor
58   REAL(wp), PARAMETER :: zrfmax     =  2      !: Maximum zooplankton reduction factor
59   REAL(wp), PARAMETER :: zafmax     =  2      !: Maximum zooplankton amplification factor
60   REAL(wp), PARAMETER :: prfmax     =  10     !: Maximum phytoplankton reduction factor (secondary)
61   REAL(wp), PARAMETER :: incphymin  =  0.0001 !: Minimum size of non-zero phytoplankton increment
62   REAL(wp), PARAMETER :: integnstep =  20     !: Number of steps for p.d.f. integral evaluation
63   REAL(wp), PARAMETER :: pthreshold =  0.01   !: Fractional threshold level for setting p.d.f.
64   !
65   LOGICAL,  PARAMETER :: diag_active           = .TRUE.  !: Depth-independent diagnostics
66   LOGICAL,  PARAMETER :: diag_fulldepth_active = .TRUE.  !: Full-depth diagnostics
67   LOGICAL,  PARAMETER :: gl_active             = .TRUE.  !: Growth/loss-based balancing
68   LOGICAL,  PARAMETER :: nbal_active           = .TRUE.  !: Nitrogen balancing
69   LOGICAL,  PARAMETER :: subsurf_active        = .TRUE.  !: Increments below MLD
70   LOGICAL,  PARAMETER :: deepneg_active        = .FALSE. !: Negative primary increments below MLD
71   LOGICAL,  PARAMETER :: deeppos_active        = .FALSE. !: Positive primary increments below MLD
72   LOGICAL,  PARAMETER :: nutprof_active        = .TRUE.  !: Secondary increments
73
74CONTAINS
75
76   SUBROUTINE asm_logchl_bal_hadocc( logchl_bkginc, aincper, mld_choice_bgc, &
77      &                              k_maxchlinc, ld_logchlbal, logchl_balinc )
78      !!---------------------------------------------------------------------------
79      !!                    ***  ROUTINE asm_logchl_bal_hadocc  ***
80      !!
81      !! ** Purpose :   calculate increments to HadOCC from logchl increments
82      !!
83      !! ** Method  :   convert logchl increments to chl increments
84      !!                call nitrogen balancing scheme
85      !!
86      !! ** Action  :   populate logchl_balinc
87      !!
88      !! References :   Hemmings et al., 2008, J. Mar. Res.
89      !!                Ford et al., 2012, Ocean Sci.
90      !!---------------------------------------------------------------------------
91      !!
92      REAL(wp), INTENT(in   ), DIMENSION(jpi,jpj)           :: logchl_bkginc  ! logchl increments
93      REAL(wp), INTENT(in   )                               :: aincper        ! Assimilation period
94      INTEGER,  INTENT(in   )                               :: mld_choice_bgc ! MLD criterion
95      REAL(wp), INTENT(in   )                               :: k_maxchlinc    ! Max chl increment
96      LOGICAL,  INTENT(in   )                               :: ld_logchlbal   ! Balancing y/n
97      REAL(wp), INTENT(  out), DIMENSION(jpi,jpj,jpk,jptra) :: logchl_balinc  ! Balancing increments
98      !!
99      INTEGER                                               :: ji, jj, jk     ! Loop counters
100      INTEGER                                               :: jkmax          ! Loop index
101      INTEGER,                 DIMENSION(6)                 :: i_tracer       ! Tracer indices
102      REAL(wp),                DIMENSION(jpi,jpj)           :: chl_inc        ! Chlorophyll increments
103      REAL(wp),                DIMENSION(jpi,jpj)           :: zmld           ! Mixed layer depth
104      REAL(wp),                DIMENSION(16)                :: modparm        ! Model parameters
105      REAL(wp),                DIMENSION(20)                :: assimparm      ! Assimilation parameters
106      REAL(wp),                DIMENSION(jpi,jpj,jpk,6)     :: bstate         ! Background state
107      REAL(wp),                DIMENSION(jpi,jpj,jpk,6)     :: outincs        ! Balancing increments
108      REAL(wp),                DIMENSION(jpi,jpj,22)        :: diag           ! Depth-indep diagnostics
109      REAL(wp),                DIMENSION(jpi,jpj,jpk,22)    :: diag_fulldepth ! Full-depth diagnostics
110      !!---------------------------------------------------------------------------
111
112      ! Convert log10(chlorophyll) increment back to a chlorophyll increment
113      ! In order to transform logchl incs to chl incs, need to account for model
114      ! background, cannot simply do 10^logchl_bkginc. Need to:
115      ! 1) Add logchl inc to log10(background) to get log10(analysis)
116      ! 2) Take 10^log10(analysis) to get analysis
117      ! 3) Subtract background from analysis to get chl incs
118      ! If k_maxchlinc > 0 then cap total absolute chlorophyll increment at that value
119      DO jj = 1, jpj
120         DO ji = 1, jpi
121            IF ( HADOCC_CHL(ji,jj,1) > 0.0 ) THEN
122               chl_inc(ji,jj) = 10**( LOG10( HADOCC_CHL(ji,jj,1) ) + logchl_bkginc(ji,jj) ) - HADOCC_CHL(ji,jj,1)
123               IF ( k_maxchlinc > 0.0 ) THEN
124                  chl_inc(ji,jj) = MAX( -1.0 * k_maxchlinc, MIN( chl_inc(ji,jj), k_maxchlinc ) )
125               ENDIF
126            ELSE
127               chl_inc(ji,jj) = 0.0
128            ENDIF
129         END DO
130      END DO
131     
132      ! Select mixed layer
133      SELECT CASE( mld_choice_bgc )
134      CASE ( 1 )                   ! Turbocline/mixing depth [W points]
135         zmld(:,:) = hmld(:,:)
136      CASE ( 2 )                   ! Density criterion (0.01 kg/m^3 change from 10m) [W points]
137         zmld(:,:) = hmlp(:,:)
138      CASE ( 3 )                   ! Kara MLD [Interpolated]
139#if defined key_karaml
140         IF ( ln_kara ) THEN
141            zmld(:,:) = hmld_kara(:,:)
142         ELSE
143            CALL ctl_stop( ' Kara mixed layer requested for LogChl assimilation,', &
144               &           ' but ln_kara=.false.' )
145         ENDIF
146#else
147         CALL ctl_stop( ' Kara mixed layer requested for LogChl assimilation,', &
148            &           ' but is not defined' )
149#endif
150      CASE ( 4 )                   ! Temperature criterion (0.2 K change from surface) [T points]
151         !zmld(:,:) = hmld_tref(:,:)
152         CALL ctl_stop( ' hmld_tref mixed layer requested for LogChl assimilation,', &
153            &           ' but is not available in this version' )
154      CASE ( 5 )                   ! Density criterion (0.01 kg/m^3 change from 10m) [T points]
155         zmld(:,:) = hmlpt(:,:)
156      END SELECT
157     
158      IF ( ld_logchlbal ) THEN   ! Nitrogen balancing
159
160         ! Set up model parameters to be passed into Hemmings balancing routine
161         modparm(1)  = grow_sat
162         modparm(2)  = psmax
163         modparm(3)  = par
164         modparm(4)  = alpha
165         modparm(5)  = resp_rate
166         modparm(6)  = pmort_rate
167         modparm(7)  = phyto_min
168         modparm(8)  = z_mort_1
169         modparm(9)  = z_mort_2
170         modparm(10) = c2n_p
171         modparm(11) = c2n_z
172         modparm(12) = c2n_d
173         modparm(13) = graze_threshold
174         modparm(14) = holling_coef
175         modparm(15) = graze_sat
176         modparm(16) = graze_max
177
178         ! Set up assimilation parameters to be passed into balancing routine
179         ! Not sure what assimparm(1) is meant to be, but it doesn't get used
180         assimparm(2)  = balnutext
181         assimparm(3)  = balnutmin
182         assimparm(4)  = r
183         assimparm(5)  = beta_g
184         assimparm(6)  = beta_l
185         assimparm(7)  = beta_m
186         assimparm(8)  = a_g
187         assimparm(9)  = a_l
188         assimparm(10) = a_m
189         assimparm(11) = zfracb0
190         assimparm(12) = zfracb1
191         assimparm(13) = qrfmax
192         assimparm(14) = qafmax
193         assimparm(15) = zrfmax
194         assimparm(16) = zafmax
195         assimparm(17) = prfmax
196         assimparm(18) = incphymin
197         assimparm(19) = integnstep
198         assimparm(20) = pthreshold
199
200         ! Set up external tracer indices array bstate
201         i_tracer(1) = 1   ! nutrient
202         i_tracer(2) = 2   ! phytoplankton
203         i_tracer(3) = 3   ! zooplankton
204         i_tracer(4) = 4   ! detritus
205         i_tracer(5) = 5   ! DIC
206         i_tracer(6) = 6   ! Alkalinity
207
208         ! Set background state
209         bstate(:,:,:,i_tracer(1)) = trb(:,:,:,jp_had_nut)
210         bstate(:,:,:,i_tracer(2)) = trb(:,:,:,jp_had_phy)
211         bstate(:,:,:,i_tracer(3)) = trb(:,:,:,jp_had_zoo)
212         bstate(:,:,:,i_tracer(4)) = trb(:,:,:,jp_had_pdn)
213         bstate(:,:,:,i_tracer(5)) = trb(:,:,:,jp_had_dic)
214         bstate(:,:,:,i_tracer(6)) = trb(:,:,:,jp_had_alk)
215
216         ! Call nitrogen balancing routine
217         CALL bio_analysis( jpi, jpj, jpk, ZDZ(:,:,:), i_tracer, modparm,          &
218            &               n2be_p, n2be_z, n2be_d, assimparm,                     &
219            &               INT(aincper), 1, kmt(:,:), tmask(:,:,:),               &
220            &               zmld(:,:), mld_max(:,:), chl_inc(:,:), cchl_p(:,:,1),  &
221            &               nbal_active, phyt_avg(:,:),                            &
222            &               gl_active, pgrow_avg(:,:), ploss_avg(:,:),             &
223            &               subsurf_active, deepneg_active,                        &
224            &               deeppos_active, nutprof_active,                        &
225            &               bstate, outincs,                                       &
226            &               diag_active, diag,                                     &
227            &               diag_fulldepth_active, diag_fulldepth )
228
229         ! Save balancing increments
230         logchl_balinc(:,:,:,jp_had_nut) = outincs(:,:,:,i_tracer(1))
231         logchl_balinc(:,:,:,jp_had_phy) = outincs(:,:,:,i_tracer(2))
232         logchl_balinc(:,:,:,jp_had_zoo) = outincs(:,:,:,i_tracer(3))
233         logchl_balinc(:,:,:,jp_had_pdn) = outincs(:,:,:,i_tracer(4))
234         logchl_balinc(:,:,:,jp_had_dic) = outincs(:,:,:,i_tracer(5))
235         logchl_balinc(:,:,:,jp_had_alk) = outincs(:,:,:,i_tracer(6))
236     
237      ELSE   ! No nitrogen balancing
238     
239         ! Initialise phytoplankton increment to zero
240         logchl_balinc(:,:,:,jp_had_phy) = 0.0
241         
242         ! Convert surface chlorophyll increment to phytoplankton nitrogen
243         logchl_balinc(:,:,1,jp_had_phy) = ( cchl_p(:,:,1) / (mw_carbon * c2n_p) ) * chl_inc(:,:)
244         
245         ! Propagate through mixed layer
246         DO jj = 1, jpj
247            DO ji = 1, jpi
248               !
249               jkmax = jpk-1
250               DO jk = jpk-1, 1, -1
251                  IF ( ( zmld(ji,jj) >  gdepw_n(ji,jj,jk)   ) .AND. &
252                     & ( zmld(ji,jj) <= gdepw_n(ji,jj,jk+1) ) ) THEN
253                     zmld(ji,jj) = gdepw_n(ji,jj,jk+1)
254                     jkmax = jk
255                  ENDIF
256               END DO
257               !
258               DO jk = 2, jkmax
259                  logchl_balinc(ji,jj,jk,jp_had_phy) = logchl_balinc(ji,jj,1,jp_had_phy)
260               END DO
261               !
262            END DO
263         END DO
264
265         ! Set other balancing increments to zero
266         logchl_balinc(:,:,:,jp_had_nut) = 0.0
267         logchl_balinc(:,:,:,jp_had_zoo) = 0.0
268         logchl_balinc(:,:,:,jp_had_pdn) = 0.0
269         logchl_balinc(:,:,:,jp_had_dic) = 0.0
270         logchl_balinc(:,:,:,jp_had_alk) = 0.0
271     
272      ENDIF
273
274   END SUBROUTINE asm_logchl_bal_hadocc
275
276#else
277   !!----------------------------------------------------------------------
278   !!   Default option : Empty routine
279   !!----------------------------------------------------------------------
280CONTAINS
281   SUBROUTINE asm_logchl_bal_hadocc( logchl_bkginc, aincper, mld_choice_bgc, &
282      &                              k_maxchlinc, logchl_balinc )
283      REAL    :: logchl_bkginc(:,:)
284      REAL    :: aincper
285      INTEGER :: mld_choice_bgc
286      REAL    :: k_maxchlinc
287      REAL(   :: logchl_balinc(:,:,:,:)
288      WRITE(*,*) 'asm_logchl_bal_hadocc: You should not have seen this print! error?'
289   END SUBROUTINE asm_logchl_bal_hadocc
290#endif
291
292   !!======================================================================
293END MODULE asmlogchlbal_hadocc
Note: See TracBrowser for help on using the repository browser.