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

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

Implement initial version of surface chlorophyll assimilation for MEDUSA.

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