trcini_cfc.F90 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. MODULE trcini_cfc
  2. !!======================================================================
  3. !! *** MODULE trcini_cfc ***
  4. !! TOP : initialisation of the CFC tracers
  5. !!======================================================================
  6. !! History : 2.0 ! 2007-12 (C. Ethe, G. Madec)
  7. !!----------------------------------------------------------------------
  8. #if defined key_cfc
  9. !!----------------------------------------------------------------------
  10. !! 'key_cfc' CFC tracers
  11. !!----------------------------------------------------------------------
  12. !! trc_ini_cfc : CFC model initialisation
  13. !!----------------------------------------------------------------------
  14. USE oce_trc ! Ocean variables
  15. USE par_trc ! TOP parameters
  16. USE trc ! TOP variables
  17. USE trcsms_cfc ! CFC sms trends
  18. IMPLICIT NONE
  19. PRIVATE
  20. PUBLIC trc_ini_cfc ! called by trcini.F90 module
  21. INTEGER :: inum ! unit number
  22. REAL(wp) :: ylats = -10. ! 10 degrees south
  23. REAL(wp) :: ylatn = 10. ! 10 degrees north
  24. !!----------------------------------------------------------------------
  25. !! NEMO/TOP 3.3 , NEMO Consortium (2010)
  26. !! $Id: trcini_cfc.F90 3294 2012-01-28 16:44:18Z rblod $
  27. !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)
  28. !!----------------------------------------------------------------------
  29. CONTAINS
  30. SUBROUTINE trc_ini_cfc
  31. !!----------------------------------------------------------------------
  32. !! *** trc_ini_cfc ***
  33. !!
  34. !! ** Purpose : initialization for cfc model
  35. !!
  36. !! ** Method : - Read the namcfc namelist and check the parameter values
  37. !!----------------------------------------------------------------------
  38. INTEGER :: ji, jj, jn, jl, jm, js, io, ierr
  39. INTEGER :: iskip = 6 ! number of 1st descriptor lines
  40. REAL(wp) :: zyy, zyd
  41. CHARACTER(len = 20) :: cltra
  42. !!----------------------------------------------------------------------
  43. IF(lwp) WRITE(numout,*)
  44. IF(lwp) WRITE(numout,*) ' trc_ini_cfc: initialisation of CFC chemical model'
  45. IF(lwp) WRITE(numout,*) ' ~~~~~~~~~~~'
  46. !
  47. IF(lwp) WRITE(numout,*) 'Read annual atmospheric concentrations from formatted file : ' // TRIM(clnamecfc)
  48. CALL ctl_opn( inum, clnamecfc, 'OLD', 'FORMATTED', 'SEQUENTIAL', -1, numout, .FALSE. )
  49. REWIND(inum)
  50. ! compute the number of year in the file
  51. ! file starts in 1931 do jn represent the year in the century
  52. jn = 31
  53. DO
  54. READ(inum,'(1x)',END=100)
  55. jn = jn + 1
  56. END DO
  57. 100 jpyear = jn - 1 - iskip
  58. IF ( lwp) WRITE(numout,*) ' ---> ', jpyear ,' years read'
  59. ! ! Allocate CFC arrays
  60. ALLOCATE( p_cfc(jpyear,jphem,3), STAT=ierr )
  61. IF( ierr > 0 ) THEN
  62. CALL ctl_stop( 'trc_ini_cfc: unable to allocate p_cfc array' ) ; RETURN
  63. ENDIF
  64. IF( trc_sms_cfc_alloc() /= 0 ) CALL ctl_stop( 'STOP', 'trc_ini_cfc: unable to allocate CFC arrays' )
  65. ! Initialization of boundaries conditions
  66. ! ---------------------------------------
  67. xphem (:,:) = 0._wp
  68. p_cfc(:,:,:) = 0._wp
  69. ! Initialization of qint in case of no restart
  70. !----------------------------------------------
  71. qtr_cfc(:,:,:) = 0._wp
  72. IF( .NOT. ln_rsttr ) THEN
  73. IF(lwp) THEN
  74. WRITE(numout,*)
  75. WRITE(numout,*) 'Initialisation of qint ; No restart : qint equal zero '
  76. ENDIF
  77. qint_cfc(:,:,:) = 0._wp
  78. DO jl = 1, jp_cfc
  79. jn = jp_cfc0 + jl - 1
  80. trn(:,:,:,jn) = 0._wp
  81. END DO
  82. ENDIF
  83. REWIND(inum)
  84. DO jm = 1, iskip ! Skip over 1st six descriptor lines
  85. READ(inum,'(1x)')
  86. END DO
  87. ! file starts in 1931 do jn represent the year in the century.jhh
  88. ! Read file till the end
  89. jn = 31
  90. DO
  91. READ(inum,*, IOSTAT=io) zyy, p_cfc(jn,1:2,1), p_cfc(jn,1:2,2), p_cfc(jn,1:2,3)
  92. IF( io < 0 ) exit
  93. jn = jn + 1
  94. END DO
  95. IF(lwp) THEN ! Control print
  96. WRITE(numout,*)
  97. WRITE(numout,*) ' Year c11NH c11SH c12NH c12SH SF6NH SF6SH'
  98. DO jn = 30, jpyear
  99. WRITE(numout, '( 1I4, 6F10.4)') jn, p_cfc(jn,1:2,1), p_cfc(jn,1:2,2), p_cfc(jn,1:2,3)
  100. END DO
  101. ENDIF
  102. ! Interpolation factor of atmospheric partial pressure
  103. ! Linear interpolation between 2 hemispheric function of latitud between ylats and ylatn
  104. !---------------------------------------------------------------------------------------
  105. zyd = ylatn - ylats
  106. DO jj = 1 , jpj
  107. DO ji = 1 , jpi
  108. IF( gphit(ji,jj) >= ylatn ) THEN ; xphem(ji,jj) = 1.e0
  109. ELSEIF( gphit(ji,jj) <= ylats ) THEN ; xphem(ji,jj) = 0.e0
  110. ELSE ; xphem(ji,jj) = ( gphit(ji,jj) - ylats) / zyd
  111. ENDIF
  112. END DO
  113. END DO
  114. !
  115. IF(lwp) WRITE(numout,*) 'Initialization of CFC tracers done'
  116. IF(lwp) WRITE(numout,*) ' '
  117. !
  118. END SUBROUTINE trc_ini_cfc
  119. #else
  120. !!----------------------------------------------------------------------
  121. !! Dummy module No CFC tracers
  122. !!----------------------------------------------------------------------
  123. CONTAINS
  124. SUBROUTINE trc_ini_cfc ! Empty routine
  125. END SUBROUTINE trc_ini_cfc
  126. #endif
  127. !!======================================================================
  128. END MODULE trcini_cfc