seddta.F90 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279
  1. MODULE seddta
  2. !!======================================================================
  3. !! *** MODULE seddta ***
  4. !! Sediment data : read sediment input data from a file
  5. !!=====================================================================
  6. #if defined key_sed
  7. !! * Modules used
  8. USE sed
  9. USE sedarr
  10. USE iom
  11. IMPLICIT NONE
  12. PRIVATE
  13. !! * Routine accessibility
  14. PUBLIC sed_dta !
  15. !! * Module variables
  16. REAL(wp), DIMENSION(:), ALLOCATABLE :: smask ! mask for sediments points
  17. REAL(wp) :: rsecday ! number of second per a day
  18. REAL(wp) :: conv1 ! [m/day]--->[cm/s]
  19. REAL(wp) :: conv2 ! [kg/m2/month]-->[g/cm2/s] ( 1 month has 30 days )
  20. INTEGER :: numbio
  21. #if defined key_sed_off
  22. INTEGER :: numoce
  23. #endif
  24. !! $Id: seddta.F90 2355 2015-05-20 07:11:50Z ufla $
  25. CONTAINS
  26. !!---------------------------------------------------------------------------
  27. !! sed_dta : read the NetCDF data file in online version using module iom
  28. !!---------------------------------------------------------------------------
  29. SUBROUTINE sed_dta( kt )
  30. !!----------------------------------------------------------------------
  31. !! *** ROUTINE sed_dta ***
  32. !!
  33. !! ** Purpose : Reads data from a netcdf file and
  34. !! initialization of rain and pore water (k=1) components
  35. !!
  36. !!
  37. !! History :
  38. !! ! 04-10 (N. Emprin, M. Gehlen ) Original code
  39. !! ! 06-04 (C. Ethe) Re-organization ; Use of iom
  40. !!----------------------------------------------------------------------
  41. !! Arguments
  42. INTEGER, INTENT(in) :: kt ! time-step
  43. !! * Local declarations
  44. INTEGER :: ji, jj, js, jw, ikt
  45. REAL(wp), DIMENSION(:,:), ALLOCATABLE :: zdta
  46. #if ! defined key_kriest
  47. REAL(wp), DIMENSION(:) , ALLOCATABLE :: zdtap, zdtag
  48. #endif
  49. !----------------------------------------------------------------------
  50. ! Initialization of sediment variable
  51. ! Spatial dimension is merged, and unity converted if needed
  52. !-------------------------------------------------------------
  53. WRITE(numsed,*)
  54. WRITE(numsed,*) ' sed_dta : Bottom layer fields'
  55. WRITE(numsed,*) ' ~~~~~~'
  56. WRITE(numsed,*) ' Data from SMS model'
  57. WRITE(numsed,*)
  58. ! open file
  59. IF( kt == nitsed000 ) THEN
  60. WRITE(numsed,*) ' sed_dta : Sediment fields'
  61. CALL iom_open ( 'data_bio_bot' , numbio )
  62. #if defined key_sed_off
  63. CALL iom_open( 'data_oce_bot', numoce)
  64. #endif
  65. rsecday = 60.* 60. * 24.
  66. conv1 = 1.0e+2 / rsecday
  67. conv2 = 1.0e+3 / ( 1.0e+4 * rsecday * 30. )
  68. ! Compute sediment mask
  69. ALLOCATE( zdta(jpi,jpj) )
  70. DO jj = 1, jpj
  71. DO ji = 1, jpi
  72. ikt = MAX( INT( sbathy(ji,jj) ) - 1, 1 )
  73. zdta(ji,jj) = tmask(ji,jj,ikt)
  74. ENDDO
  75. ENDDO
  76. ALLOCATE( smask(jpoce) )
  77. smask(:) = 0.
  78. CALL pack_arr( jpoce, smask(1:jpoce), zdta(1:jpi,1:jpj), iarroce(1:jpoce) )
  79. ENDIF
  80. #if ! defined key_kriest
  81. ! Initialization of temporaries arrays
  82. ALLOCATE( zdtap(jpoce) ) ; zdtap(:) = 0.
  83. ALLOCATE( zdtag(jpoce) ) ; zdtag(:) = 0.
  84. #endif
  85. IF( MOD( kt - 1, nfreq ) == 0 ) THEN
  86. ! reading variables
  87. WRITE(numsed,*)
  88. WRITE(numsed,*) ' sed_dta : Bottom layer fields at time kt = ', kt
  89. ! reading variables
  90. trc_data(:,:,:) = 0.
  91. #if ! defined key_sed_off
  92. DO jj = 1,jpj
  93. DO ji = 1, jpi
  94. ikt = mbkt(ji,jj)
  95. IF ( tmask(ji,jj,ikt) == 1 ) THEN
  96. trc_data(ji,jj,1) = trn (ji,jj,ikt,jptal)
  97. trc_data(ji,jj,2) = trn (ji,jj,ikt,jpdic)
  98. trc_data(ji,jj,3) = trn (ji,jj,ikt,jpno3) / 7.6
  99. trc_data(ji,jj,4) = trn (ji,jj,ikt,jppo4) / 122.
  100. trc_data(ji,jj,5) = trn (ji,jj,ikt,jpoxy)
  101. trc_data(ji,jj,6) = trn (ji,jj,ikt,jpsil)
  102. # if ! defined key_kriest
  103. trc_data(ji,jj,7 ) = sinksil (ji,jj,ikt)
  104. trc_data(ji,jj,8 ) = sinking (ji,jj,ikt)
  105. trc_data(ji,jj,9 ) = sinking2(ji,jj,ikt)
  106. trc_data(ji,jj,10) = sinkcal (ji,jj,ikt)
  107. trc_data(ji,jj,11) = tsn (ji,jj,ikt,jp_tem)
  108. trc_data(ji,jj,12) = tsn (ji,jj,ikt,jp_sal)
  109. # else
  110. trc_data(ji,jj,7 ) = sinksil (ji,jj,ikt)
  111. trc_data(ji,jj,8 ) = sinking (ji,jj,ikt)
  112. trc_data(ji,jj,9 ) = sinkcal (ji,jj,ikt)
  113. trc_data(ji,jj,10) = tsn (ji,jj,ikt,jp_tem)
  114. trc_data(ji,jj,11) = tsn (ji,jj,ikt,jp_sal)
  115. # endif
  116. ENDIF
  117. ENDDO
  118. ENDDO
  119. #else
  120. CALL iom_get( numbio, jpdom_data, 'ALKBOT' , trc_data(:,:,1 ) )
  121. CALL iom_get( numbio, jpdom_data, 'DICBOT' , trc_data(:,:,2 ) )
  122. CALL iom_get( numbio, jpdom_data, 'NO3BOT' , trc_data(:,:,3 ) )
  123. CALL iom_get( numbio, jpdom_data, 'PO4BOT' , trc_data(:,:,4 ) )
  124. CALL iom_get( numbio, jpdom_data, 'O2BOT' , trc_data(:,:,5 ) )
  125. CALL iom_get( numbio, jpdom_data, 'SIBOT' , trc_data(:,:,6 ) )
  126. # if ! defined key_kriest
  127. CALL iom_get( numbio, jpdom_data, 'OPALFLXBOT' , trc_data(:,:,7 ) )
  128. CALL iom_get( numbio, jpdom_data, 'POCFLXBOT' , trc_data(:,:,8 ) )
  129. CALL iom_get( numbio, jpdom_data, 'GOCFLXBOT' , trc_data(:,:,9 ) )
  130. CALL iom_get( numbio, jpdom_data, 'CACO3FLXBOT', trc_data(:,:,10) )
  131. CALL iom_get( numoce, jpdom_data, 'TBOT' , trc_data(:,:,11) )
  132. CALL iom_get( numoce, jpdom_data, 'SBOT' , trc_data(:,:,12) )
  133. # else
  134. CALL iom_get( numbio, jpdom_data, 'OPALFLXBOT' , trc_data(:,:,7 ) )
  135. CALL iom_get( numbio, jpdom_data, 'POCFLXBOT' , trc_data(:,:,8 ) )
  136. CALL iom_get( numbio, jpdom_data, 'CACO3FLXBOT', trc_data(:,:,9 ) )
  137. CALL iom_get( numoce, jpdom_data, 'TBOT' , trc_data(:,:,10) )
  138. CALL iom_get( numoce, jpdom_data, 'SBOT' , trc_data(:,:,11) )
  139. # endif
  140. #endif
  141. ! Pore water initial concentration [mol/l] in k=1
  142. !-------------------------------------------------
  143. ! Alkalinity ( 1 umol = 10-6equivalent )
  144. CALL pack_arr ( jpoce, pwcp_dta(1:jpoce,jwalk), trc_data(1:jpi,1:jpj,1), iarroce(1:jpoce) )
  145. ! DIC
  146. CALL pack_arr ( jpoce, pwcp_dta(1:jpoce,jwdic), trc_data(1:jpi,1:jpj,2), iarroce(1:jpoce) )
  147. ! Nitrates (1 umol/l = 10-6 mol/l)
  148. CALL pack_arr ( jpoce, pwcp_dta(1:jpoce,jwno3), trc_data(1:jpi,1:jpj,3), iarroce(1:jpoce) )
  149. ! Phosphates (1 umol/l = 10-6 mol/l)
  150. CALL pack_arr ( jpoce, pwcp_dta(1:jpoce,jwpo4), trc_data(1:jpi,1:jpj,4), iarroce(1:jpoce) )
  151. ! Oxygen (1 umol/l = 10-6 mol/l)
  152. CALL pack_arr ( jpoce, pwcp_dta(1:jpoce,jwoxy), trc_data(1:jpi,1:jpj,5), iarroce(1:jpoce) )
  153. ! Silicic Acid [mol.l-1]
  154. CALL pack_arr ( jpoce, pwcp_dta(1:jpoce,jwsil), trc_data(1:jpi,1:jpj,6), iarroce(1:jpoce) )
  155. ! DIC13 (mol/l)obtained from dc13 and DIC (12) and PDB
  156. CALL iom_get ( numbio,jpdom_data,'DC13',zdta(:,:) )
  157. CALL pack_arr ( jpoce, pwcp_dta(1:jpoce,jwc13), zdta(1:jpi,1:jpj), iarroce(1:jpoce) )
  158. pwcp_dta(1:jpoce,jwc13) = pdb * ( pwcp_dta(1:jpoce,jwc13) * 1.0e-3 + 1.0 ) &
  159. & * pwcp_dta(1:jpoce,jwdic)
  160. ! Solid components :
  161. !-----------------------
  162. #if ! defined key_kriest
  163. ! Sinking fluxes for OPAL in mol.m-2.s-1 ; conversion in mol.cm-2.s-1
  164. CALL pack_arr ( jpoce, rainrm_dta(1:jpoce,jsopal), trc_data(1:jpi,1:jpj,7), iarroce(1:jpoce) )
  165. rainrm_dta(1:jpoce,jsopal) = rainrm_dta(1:jpoce,jsopal) * 1e-4
  166. ! Sinking fluxes for POC in mol.m-2.s-1 ; conversion in mol.cm-2.s-1
  167. CALL pack_arr ( jpoce, zdtap(1:jpoce), trc_data(1:jpi,1:jpj,8) , iarroce(1:jpoce) )
  168. CALL pack_arr ( jpoce, zdtag(1:jpoce), trc_data(1:jpi,1:jpj,9) , iarroce(1:jpoce) )
  169. rainrm_dta(1:jpoce,jspoc) = ( zdtap(1:jpoce) + zdtag(1:jpoce) ) * 1e-4
  170. ! Sinking fluxes for Calcite in mol.m-2.s-1 ; conversion in mol.cm-2.s-1
  171. CALL pack_arr ( jpoce, rainrm_dta(1:jpoce,jscal), trc_data(1:jpi,1:jpj,10), iarroce(1:jpoce) )
  172. rainrm_dta(1:jpoce,jscal) = rainrm_dta(1:jpoce,jscal) * 1e-4
  173. ! vector temperature [°C] and salinity
  174. CALL pack_arr ( jpoce, temp(1:jpoce), trc_data(1:jpi,1:jpj,11), iarroce(1:jpoce) )
  175. CALL pack_arr ( jpoce, salt(1:jpoce), trc_data(1:jpi,1:jpj,12), iarroce(1:jpoce) )
  176. #else
  177. ! Sinking fluxes for OPAL in mol.m-2.s-1 ; conversion in mol.cm-2.s-1
  178. CALL pack_arr ( jpoce, rainrm_dta(1:jpoce,jsopal), trc_data(1:jpi,1:jpj,7), iarroce(1:jpoce) )
  179. rainrm_dta(1:jpoce,jsopal) = rainrm_dta(1:jpoce,jsopal) * 1e-4
  180. ! Sinking fluxes for POC in mol.m-2.s-1 ; conversion in mol.cm-2.s-1
  181. CALL pack_arr ( jpoce, rainrm_dta(1:jpoce,jspoc), trc_data(1:jpi,1:jpj,8) , iarroce(1:jpoce) )
  182. rainrm_dta(1:jpoce,jspoc) = rainrm_dta(1:jpoce,jspoc) * 1e-4
  183. ! Sinking fluxes for Calcite in mol.m-2.s-1 ; conversion in mol.cm-2.s-1
  184. CALL pack_arr ( jpoce, rainrm_dta(1:jpoce,jscal), trc_data(1:jpi,1:jpj,9), iarroce(1:jpoce) )
  185. rainrm_dta(1:jpoce,jscal) = rainrm_dta(1:jpoce,jscal) * 1e-4
  186. ! vector temperature [°C] and salinity
  187. CALL pack_arr ( jpoce, temp(1:jpoce), trc_data(1:jpi,1:jpj,10), iarroce(1:jpoce) )
  188. CALL pack_arr ( jpoce, salt(1:jpoce), trc_data(1:jpi,1:jpj,11), iarroce(1:jpoce) )
  189. #endif
  190. ! Clay rain rate in [mol/(cm**2.s)]
  191. ! inputs data in [kg.m-2.mois-1] ---> 1e+3/(1e+4*60*24*60*60) [g.cm-2.s-1]
  192. ! divided after by molecular weight g.mol-1
  193. zdta(:,:) = 0.
  194. CALL iom_get( numbio, jpdom_data, 'CLAY', zdta(:,:) )
  195. CALL pack_arr ( jpoce, rainrm_dta(1:jpoce,jsclay) , zdta(1:jpi,1:jpj), iarroce(1:jpoce) )
  196. rainrm_dta(1:jpoce,jsclay) = rainrm_dta(1:jpoce,jsclay) * conv2 / mol_wgt(jsclay)
  197. ENDIF
  198. ! sediment pore water at 1st layer (k=1)
  199. DO jw = 1, jpwat
  200. pwcp(1:jpoce,1,jw) = pwcp_dta(1:jpoce,jw) * smask(1:jpoce)
  201. ENDDO
  202. ! rain
  203. DO js = 1, jpsol
  204. rainrm(1:jpoce,js) = rainrm_dta(1:jpoce,js) * smask(1:jpoce)
  205. ENDDO
  206. ! Calculation of raintg of each sol. comp.: rainrm in [g/(cm**2.s)]
  207. DO js = 1, jpsol
  208. rainrg(1:jpoce,js) = rainrm(1:jpoce,js) * mol_wgt(js)
  209. ENDDO
  210. ! Calculation of raintg = total massic flux rained in each cell (sum of sol. comp.)
  211. raintg(:) = 0.
  212. DO js = 1, jpsol
  213. raintg(1:jpoce) = raintg(1:jpoce) + rainrg(1:jpoce,js)
  214. ENDDO
  215. ! computation of dzdep = total thickness of solid material rained [cm] in each cell
  216. dzdep(1:jpoce) = raintg(1:jpoce) * rdtsed(2)
  217. DEALLOCATE( zdta )
  218. #if ! defined key_kriest
  219. DEALLOCATE( zdtap ) ; DEALLOCATE( zdtag )
  220. #endif
  221. IF( kt == nitsedend ) THEN
  222. CALL iom_close ( numbio )
  223. #if defined key_sed_off
  224. CALL iom_close ( numoce )
  225. #endif
  226. ENDIF
  227. END SUBROUTINE sed_dta
  228. #else
  229. !!======================================================================
  230. !! MODULE seddta : Dummy module
  231. !!======================================================================
  232. !! $Id: seddta.F90 2355 2015-05-20 07:11:50Z ufla $
  233. CONTAINS
  234. SUBROUTINE sed_dta ( kt )
  235. INTEGER, INTENT(in) :: kt
  236. WRITE(*,*) 'sed_stp: You should not have seen this print! error?', kt
  237. END SUBROUTINE sed_dta
  238. #endif
  239. END MODULE seddta