source: NEMO/branches/2019/fix_sn_cfctl_ticket2328/src/TOP/PISCES/P4Z/p4zmort.F90

Last change on this file was 11872, checked in by acc, 12 months ago

Branch 2019/fix_sn_cfctl_ticket2328. See #2328. Replacement of ln_ctl and activation of full functionality with
sn_cfctl structure. These changes rename structure components l_mppout and l_mpptop as l_prtctl and l_prttrc
and introduce l_glochk to activate former ln_ctl code in stpctl.F90 to perform global location of min and max
checks. Also added is l_allon which can be used to activate all output (much like the former ln_ctl). If l_allon
is .false. then l_config decides whether or not the suboptions are used.

   sn_cfctl%l_glochk = .FALSE.    ! Range sanity checks are local (F) or global (T). Set T for debugging only
   sn_cfctl%l_allon  = .FALSE.    ! IF T activate all options. If F deactivate all unless l_config is T
   sn_cfctl%l_config = .TRUE.     ! IF .true. then control which reports are written with the remaining options

Note, these changes pass SETTE tests but all references to ln_ctl need to be removed from the sette scripts.

  • Property svn:keywords set to Id
File size: 11.6 KB
Line 
1MODULE p4zmort
2   !!======================================================================
3   !!                         ***  MODULE p4zmort  ***
4   !! TOP :   PISCES Compute the mortality terms for phytoplankton
5   !!======================================================================
6   !! History :   1.0  !  2002     (O. Aumont)  Original code
7   !!             2.0  !  2007-12  (C. Ethe, G. Madec)  F90
8   !!----------------------------------------------------------------------
9   !!   p4z_mort       : Compute the mortality terms for phytoplankton
10   !!   p4z_mort_init  : Initialize the mortality params for phytoplankton
11   !!----------------------------------------------------------------------
12   USE oce_trc         ! shared variables between ocean and passive tracers
13   USE trc             ! passive tracers common variables
14   USE sms_pisces      ! PISCES Source Minus Sink variables
15   USE p4zprod         ! Primary productivity
16   USE p4zlim          ! Phytoplankton limitation terms
17   USE prtctl_trc      ! print control for debugging
18
19   IMPLICIT NONE
20   PRIVATE
21
22   PUBLIC   p4z_mort   
23   PUBLIC   p4z_mort_init   
24
25   REAL(wp), PUBLIC ::   wchl     !:
26   REAL(wp), PUBLIC ::   wchld    !:
27   REAL(wp), PUBLIC ::   wchldm   !:
28   REAL(wp), PUBLIC ::   mprat    !:
29   REAL(wp), PUBLIC ::   mprat2   !:
30
31   !!----------------------------------------------------------------------
32   !! NEMO/TOP 4.0 , NEMO Consortium (2018)
33   !! $Id$
34   !! Software governed by the CeCILL license (see ./LICENSE)
35   !!----------------------------------------------------------------------
36CONTAINS
37
38   SUBROUTINE p4z_mort( kt )
39      !!---------------------------------------------------------------------
40      !!                     ***  ROUTINE p4z_mort  ***
41      !!
42      !! ** Purpose :   Calls the different subroutine to initialize and compute
43      !!                the different phytoplankton mortality terms
44      !!
45      !! ** Method  : - ???
46      !!---------------------------------------------------------------------
47      INTEGER, INTENT(in) ::   kt ! ocean time step
48      !!---------------------------------------------------------------------
49      !
50      CALL p4z_nano            ! nanophytoplankton
51      !
52      CALL p4z_diat            ! diatoms
53      !
54   END SUBROUTINE p4z_mort
55
56
57   SUBROUTINE p4z_nano
58      !!---------------------------------------------------------------------
59      !!                     ***  ROUTINE p4z_nano  ***
60      !!
61      !! ** Purpose :   Compute the mortality terms for nanophytoplankton
62      !!
63      !! ** Method  : - ???
64      !!---------------------------------------------------------------------
65      INTEGER  ::   ji, jj, jk
66      REAL(wp) ::   zsizerat, zcompaph
67      REAL(wp) ::   zfactfe, zfactch, zprcaca, zfracal
68      REAL(wp) ::   ztortp , zrespp , zmortp 
69      CHARACTER (len=25) ::   charout
70      !!---------------------------------------------------------------------
71      !
72      IF( ln_timing )   CALL timing_start('p4z_nano')
73      !
74      prodcal(:,:,:) = 0._wp   ! calcite production variable set to zero
75      DO jk = 1, jpkm1
76         DO jj = 1, jpj
77            DO ji = 1, jpi
78               zcompaph = MAX( ( trb(ji,jj,jk,jpphy) - 1e-8 ), 0.e0 )
79               !     When highly limited by macronutrients, very small cells
80               !     dominate the community. As a consequence, aggregation
81               !     due to turbulence is negligible. Mortality is also set
82               !     to 0
83               zsizerat = MIN(1., MAX( 0., (quotan(ji,jj,jk) - 0.2) / 0.3) ) * trb(ji,jj,jk,jpphy)
84               !     Squared mortality of Phyto similar to a sedimentation term during
85               !     blooms (Doney et al. 1996)
86               zrespp = wchl * 1.e6 * xstep * xdiss(ji,jj,jk) * zcompaph * zsizerat 
87
88               !     Phytoplankton mortality. This mortality loss is slightly
89               !     increased when nutrients are limiting phytoplankton growth
90               !     as observed for instance in case of iron limitation.
91               ztortp = mprat * xstep * zcompaph / ( xkmort + trb(ji,jj,jk,jpphy) ) * zsizerat
92
93               zmortp = zrespp + ztortp
94
95               !   Update the arrays TRA which contains the biological sources and sinks
96
97               zfactfe = trb(ji,jj,jk,jpnfe)/(trb(ji,jj,jk,jpphy)+rtrn)
98               zfactch = trb(ji,jj,jk,jpnch)/(trb(ji,jj,jk,jpphy)+rtrn)
99               tra(ji,jj,jk,jpphy) = tra(ji,jj,jk,jpphy) - zmortp
100               tra(ji,jj,jk,jpnch) = tra(ji,jj,jk,jpnch) - zmortp * zfactch
101               tra(ji,jj,jk,jpnfe) = tra(ji,jj,jk,jpnfe) - zmortp * zfactfe
102               zprcaca = xfracal(ji,jj,jk) * zmortp
103               !
104               prodcal(ji,jj,jk) = prodcal(ji,jj,jk) + zprcaca  ! prodcal=prodcal(nanophy)+prodcal(microzoo)+prodcal(mesozoo)
105               !
106               zfracal = 0.5 * xfracal(ji,jj,jk)
107               tra(ji,jj,jk,jpdic) = tra(ji,jj,jk,jpdic) - zprcaca
108               tra(ji,jj,jk,jptal) = tra(ji,jj,jk,jptal) - 2. * zprcaca
109               tra(ji,jj,jk,jpcal) = tra(ji,jj,jk,jpcal) + zprcaca
110               tra(ji,jj,jk,jpgoc) = tra(ji,jj,jk,jpgoc) + zfracal * zmortp
111               tra(ji,jj,jk,jppoc) = tra(ji,jj,jk,jppoc) + ( 1. - zfracal ) * zmortp
112               prodpoc(ji,jj,jk) = prodpoc(ji,jj,jk) + ( 1. - zfracal ) * zmortp
113               prodgoc(ji,jj,jk) = prodgoc(ji,jj,jk) + zfracal * zmortp
114               tra(ji,jj,jk,jpsfe) = tra(ji,jj,jk,jpsfe) + ( 1. - zfracal ) * zmortp * zfactfe
115               tra(ji,jj,jk,jpbfe) = tra(ji,jj,jk,jpbfe) + zfracal * zmortp * zfactfe
116            END DO
117         END DO
118      END DO
119      !
120       IF(sn_cfctl%l_prttrc)   THEN  ! print mean trends (used for debugging)
121         WRITE(charout, FMT="('nano')")
122         CALL prt_ctl_trc_info(charout)
123         CALL prt_ctl_trc(tab4d=tra, mask=tmask, clinfo=ctrcnm)
124       ENDIF
125      !
126      IF( ln_timing )   CALL timing_stop('p4z_nano')
127      !
128   END SUBROUTINE p4z_nano
129
130
131   SUBROUTINE p4z_diat
132      !!---------------------------------------------------------------------
133      !!                     ***  ROUTINE p4z_diat  ***
134      !!
135      !! ** Purpose :   Compute the mortality terms for diatoms
136      !!
137      !! ** Method  : - ???
138      !!---------------------------------------------------------------------
139      INTEGER  ::   ji, jj, jk
140      REAL(wp) ::   zfactfe,zfactsi,zfactch, zcompadi
141      REAL(wp) ::   zrespp2, ztortp2, zmortp2
142      REAL(wp) ::   zlim2, zlim1
143      CHARACTER (len=25) ::   charout
144      !!---------------------------------------------------------------------
145      !
146      IF( ln_timing )   CALL timing_start('p4z_diat')
147      !
148      !    Aggregation term for diatoms is increased in case of nutrient
149      !    stress as observed in reality. The stressed cells become more
150      !    sticky and coagulate to sink quickly out of the euphotic zone
151      !     ------------------------------------------------------------
152
153      DO jk = 1, jpkm1
154         DO jj = 1, jpj
155            DO ji = 1, jpi
156
157               zcompadi = MAX( ( trb(ji,jj,jk,jpdia) - 1e-9), 0. )
158
159               !    Aggregation term for diatoms is increased in case of nutrient
160               !    stress as observed in reality. The stressed cells become more
161               !    sticky and coagulate to sink quickly out of the euphotic zone
162               !     ------------------------------------------------------------
163               !  Phytoplankton respiration
164               !     ------------------------
165               zlim2   = xlimdia(ji,jj,jk) * xlimdia(ji,jj,jk)
166               zlim1   = 0.25 * ( 1. - zlim2 ) / ( 0.25 + zlim2 ) 
167               zrespp2 = 1.e6 * xstep * (  wchld + wchldm * zlim1 ) * xdiss(ji,jj,jk) * zcompadi * trb(ji,jj,jk,jpdia)
168
169               !     Phytoplankton mortality.
170               !     ------------------------
171               ztortp2 = mprat2 * xstep * trb(ji,jj,jk,jpdia)  / ( xkmort + trb(ji,jj,jk,jpdia) ) * zcompadi 
172
173               zmortp2 = zrespp2 + ztortp2
174
175               !   Update the arrays tra which contains the biological sources and sinks
176               !   ---------------------------------------------------------------------
177               zfactch = trb(ji,jj,jk,jpdch) / ( trb(ji,jj,jk,jpdia) + rtrn )
178               zfactfe = trb(ji,jj,jk,jpdfe) / ( trb(ji,jj,jk,jpdia) + rtrn )
179               zfactsi = trb(ji,jj,jk,jpdsi) / ( trb(ji,jj,jk,jpdia) + rtrn )
180               tra(ji,jj,jk,jpdia) = tra(ji,jj,jk,jpdia) - zmortp2 
181               tra(ji,jj,jk,jpdch) = tra(ji,jj,jk,jpdch) - zmortp2 * zfactch
182               tra(ji,jj,jk,jpdfe) = tra(ji,jj,jk,jpdfe) - zmortp2 * zfactfe
183               tra(ji,jj,jk,jpdsi) = tra(ji,jj,jk,jpdsi) - zmortp2 * zfactsi
184               tra(ji,jj,jk,jpgsi) = tra(ji,jj,jk,jpgsi) + zmortp2 * zfactsi
185               tra(ji,jj,jk,jpgoc) = tra(ji,jj,jk,jpgoc) + zrespp2 + 0.5 * ztortp2
186               tra(ji,jj,jk,jppoc) = tra(ji,jj,jk,jppoc) + 0.5 * ztortp2
187               prodpoc(ji,jj,jk) = prodpoc(ji,jj,jk) + 0.5 * ztortp2
188               prodgoc(ji,jj,jk) = prodgoc(ji,jj,jk) + zrespp2 + 0.5 * ztortp2
189               tra(ji,jj,jk,jpsfe) = tra(ji,jj,jk,jpsfe) + 0.5 * ztortp2 * zfactfe
190               tra(ji,jj,jk,jpbfe) = tra(ji,jj,jk,jpbfe) + ( zrespp2 + 0.5 * ztortp2 ) * zfactfe
191            END DO
192         END DO
193      END DO
194      !
195      IF(sn_cfctl%l_prttrc) THEN      ! print mean trends (used for debugging)
196         WRITE(charout, FMT="('diat')")
197         CALL prt_ctl_trc_info(charout)
198         CALL prt_ctl_trc(tab4d=tra, mask=tmask, clinfo=ctrcnm)
199      ENDIF
200      !
201      IF( ln_timing )   CALL timing_stop('p4z_diat')
202      !
203   END SUBROUTINE p4z_diat
204
205
206   SUBROUTINE p4z_mort_init
207      !!----------------------------------------------------------------------
208      !!                  ***  ROUTINE p4z_mort_init  ***
209      !!
210      !! ** Purpose :   Initialization of phytoplankton parameters
211      !!
212      !! ** Method  :   Read the nampismort namelist and check the parameters
213      !!              called at the first timestep
214      !!
215      !! ** input   :   Namelist nampismort
216      !!
217      !!----------------------------------------------------------------------
218      INTEGER ::   ios   ! Local integer
219      !
220      NAMELIST/namp4zmort/ wchl, wchld, wchldm, mprat, mprat2
221      !!----------------------------------------------------------------------
222      !
223      IF(lwp) THEN
224         WRITE(numout,*) 
225         WRITE(numout,*) 'p4z_mort_init : Initialization of phytoplankton mortality parameters'
226         WRITE(numout,*) '~~~~~~~~~~~~~'
227      ENDIF
228      !
229      REWIND( numnatp_ref )              ! Namelist nampismort in reference namelist : Pisces phytoplankton
230      READ  ( numnatp_ref, namp4zmort, IOSTAT = ios, ERR = 901)
231901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namp4zmort in reference namelist' )
232      REWIND( numnatp_cfg )              ! Namelist nampismort in configuration namelist : Pisces phytoplankton
233      READ  ( numnatp_cfg, namp4zmort, IOSTAT = ios, ERR = 902 )
234902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namp4zmort in configuration namelist' )
235      IF(lwm) WRITE( numonp, namp4zmort )
236      !
237      IF(lwp) THEN                         ! control print
238         WRITE(numout,*) '   Namelist : namp4zmort'
239         WRITE(numout,*) '      quadratic mortality of phytoplankton        wchl   =', wchl
240         WRITE(numout,*) '      maximum quadratic mortality of diatoms      wchld  =', wchld
241         WRITE(numout,*) '      maximum quadratic mortality of diatoms      wchldm =', wchldm
242         WRITE(numout,*) '      phytoplankton mortality rate                mprat  =', mprat
243         WRITE(numout,*) '      Diatoms mortality rate                      mprat2 =', mprat2
244      ENDIF
245      !
246   END SUBROUTINE p4z_mort_init
247
248   !!======================================================================
249END MODULE p4zmort
Note: See TracBrowser for help on using the repository browser.