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 @ 8440

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

Add more variables to assimilation background, so it includes all required elements of the background state.

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