domcfg.F90 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. MODULE domcfg
  2. !!==============================================================================
  3. !! *** MODULE domcfg ***
  4. !! Ocean initialization : domain configuration initialization
  5. !!==============================================================================
  6. !! History : 1.0 ! 2003-09 (G. Madec) Original code
  7. !! 3.2 ! 2009-07 (R. Benshila) Suppression of rigid-lid option
  8. !!----------------------------------------------------------------------
  9. !!----------------------------------------------------------------------
  10. !! dom_cfg : initialize the domain configuration
  11. !!----------------------------------------------------------------------
  12. USE dom_oce ! ocean space and time domain
  13. USE phycst ! physical constants
  14. USE in_out_manager ! I/O manager
  15. USE lib_mpp ! distributed memory computing library
  16. USE timing ! Timing
  17. USE c1d ! 1D configuration
  18. USE domc1d ! 1D configuration: column location
  19. IMPLICIT NONE
  20. PRIVATE
  21. PUBLIC dom_cfg ! called by opa.F90
  22. !!----------------------------------------------------------------------
  23. !! NEMO/OPA 3.2 , LODYC-IPSL (2009)
  24. !! $Id: domcfg.F90 4667 2014-06-12 08:47:52Z cbricaud $
  25. !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)
  26. !!----------------------------------------------------------------------
  27. CONTAINS
  28. SUBROUTINE dom_cfg
  29. !!----------------------------------------------------------------------
  30. !! *** ROUTINE dom_cfg ***
  31. !!
  32. !! ** Purpose : set the domain configuration
  33. !!
  34. !!----------------------------------------------------------------------
  35. !
  36. IF( nn_timing == 1 ) CALL timing_start('dom_cfg')
  37. !
  38. IF(lwp) THEN ! Control print
  39. WRITE(numout,*)
  40. WRITE(numout,*) 'dom_cfg : set the ocean configuration'
  41. WRITE(numout,*) '~~~~~~~ '
  42. WRITE(numout,*) ' ocean model configuration used : cp_cfg = ', cp_cfg, ' jp_cfg = ', jp_cfg
  43. !
  44. WRITE(numout,*) ' global domain lateral boundaries'
  45. !
  46. IF( jperio == 0 ) WRITE(numout,*) ' jperio= 0, closed'
  47. IF( jperio == 1 ) WRITE(numout,*) ' jperio= 1, cyclic east-west'
  48. IF( jperio == 2 ) WRITE(numout,*) ' jperio= 2, equatorial symmetric'
  49. IF( jperio == 3 ) WRITE(numout,*) ' jperio= 3, north fold with T-point pivot'
  50. IF( jperio == 4 ) WRITE(numout,*) ' jperio= 4, cyclic east-west and north fold with T-point pivot'
  51. IF( jperio == 5 ) WRITE(numout,*) ' jperio= 5, north fold with F-point pivot'
  52. IF( jperio == 6 ) WRITE(numout,*) ' jperio= 6, cyclic east-west and north fold with F-point pivot'
  53. ENDIF
  54. !
  55. IF( jperio < 0 .OR. jperio > 6 ) CALL ctl_stop( 'jperio is out of range' )
  56. !
  57. CALL dom_glo ! global domain versus zoom and/or local domain
  58. !
  59. IF( nn_timing == 1 ) CALL timing_stop('dom_cfg')
  60. !
  61. END SUBROUTINE dom_cfg
  62. SUBROUTINE dom_glo
  63. !!----------------------------------------------------------------------
  64. !! *** ROUTINE dom_glo ***
  65. !!
  66. !! ** Purpose : initialization for global domain, zoom and local domain
  67. !!
  68. !! ** Method :
  69. !!
  70. !! ** Action : - mig , mjg :
  71. !! - mi0 , mi1 :
  72. !! - mj0, , mj1 :
  73. !!----------------------------------------------------------------------
  74. INTEGER :: ji, jj ! dummy loop argument
  75. !!----------------------------------------------------------------------
  76. ! ! recalculate jpizoom/jpjzoom given lat/lon
  77. IF( lk_c1d .AND. ln_c1d_locpt ) CALL dom_c1d( rn_lat1d, rn_lon1d )
  78. !
  79. ! ! ============== !
  80. ! ! Local domain !
  81. ! ! ============== !
  82. DO ji = 1, jpi ! local domain indices ==> data domain indices
  83. mig(ji) = ji + jpizoom - 1 + nimpp - 1
  84. END DO
  85. DO jj = 1, jpj
  86. mjg(jj) = jj + jpjzoom - 1 + njmpp - 1
  87. END DO
  88. !
  89. ! ! data domain indices ==> local domain indices
  90. ! ! (return (m.0,m.1)=(1,0) if data domain gridpoint is to the west/south of the
  91. ! !local domain, or (m.0,m.1)=(jp.+1,jp.) to the east/north of local domain.
  92. DO ji = 1, jpidta
  93. mi0(ji) = MAX( 1, MIN( ji - jpizoom + 1 - nimpp + 1, jpi+1 ) )
  94. mi1(ji) = MAX( 0, MIN( ji - jpizoom + 1 - nimpp + 1, jpi ) )
  95. END DO
  96. DO jj = 1, jpjdta
  97. mj0(jj) = MAX( 1, MIN( jj - jpjzoom + 1 - njmpp + 1, jpj+1 ) )
  98. mj1(jj) = MAX( 0, MIN( jj - jpjzoom + 1 - njmpp + 1, jpj ) )
  99. END DO
  100. IF(lwp) THEN ! control print
  101. WRITE(numout,*)
  102. WRITE(numout,*) 'dom_glo : domain: data / local '
  103. WRITE(numout,*) '~~~~~~~ '
  104. WRITE(numout,*) ' data input domain : jpidta = ', jpidta, &
  105. & ' jpjdta = ', jpjdta, ' jpkdta = ', jpkdta
  106. WRITE(numout,*) ' global or zoom domain: jpiglo = ', jpiglo, &
  107. & ' jpjglo = ', jpjglo, ' jpk = ', jpk
  108. WRITE(numout,*) ' local domain : jpi = ', jpi , &
  109. & ' jpj = ', jpj , ' jpk = ', jpk
  110. WRITE(numout,*)
  111. WRITE(numout,*) ' south-west indices jpizoom = ', jpizoom, &
  112. & ' jpjzoom = ', jpjzoom
  113. WRITE(numout,*)
  114. WRITE(numout,*) ' conversion local ==> data i-index domain'
  115. WRITE(numout,25) (mig(ji),ji = 1,jpi)
  116. WRITE(numout,*)
  117. WRITE(numout,*) ' conversion data ==> local i-index domain'
  118. WRITE(numout,*) ' starting index'
  119. WRITE(numout,25) (mi0(ji),ji = 1,jpidta)
  120. WRITE(numout,*) ' ending index'
  121. WRITE(numout,25) (mi1(ji),ji = 1,jpidta)
  122. WRITE(numout,*)
  123. WRITE(numout,*) ' conversion local ==> data j-index domain'
  124. WRITE(numout,25) (mjg(jj),jj = 1,jpj)
  125. WRITE(numout,*)
  126. WRITE(numout,*) ' conversion data ==> local j-index domain'
  127. WRITE(numout,*) ' starting index'
  128. WRITE(numout,25) (mj0(jj),jj = 1,jpjdta)
  129. WRITE(numout,*) ' ending index'
  130. WRITE(numout,25) (mj1(jj),jj = 1,jpjdta)
  131. ENDIF
  132. 25 FORMAT( 100(10x,19i4,/) )
  133. ! ! ============== !
  134. ! ! Zoom domain !
  135. ! ! ============== !
  136. ! ! zoom control
  137. IF( jpiglo + jpizoom - 1 > jpidta .OR. &
  138. jpjglo + jpjzoom - 1 > jpjdta ) &
  139. & CALL ctl_stop( ' global or zoom domain exceed the data domain ! ' )
  140. ! ! set zoom flag
  141. IF( jpiglo < jpidta .OR. jpjglo < jpjdta ) lzoom = .TRUE.
  142. ! ! set zoom type flags
  143. IF( lzoom .AND. jpizoom /= 1 ) lzoom_w = .TRUE. !
  144. IF( lzoom .AND. jpjzoom /= 1 ) lzoom_s = .TRUE.
  145. IF( lzoom .AND. jpiglo + jpizoom -1 /= jpidta ) lzoom_e = .TRUE.
  146. IF( lzoom .AND. jpjglo + jpjzoom -1 /= jpjdta ) lzoom_n = .TRUE.
  147. IF(lwp) THEN
  148. WRITE(numout,*)
  149. WRITE(numout,*) ' zoom flags : '
  150. WRITE(numout,*) ' lzoom = ', lzoom , ' (T = zoom, F = global )'
  151. WRITE(numout,*) ' lzoom_e = ', lzoom_e, ' (T = forced closed east boundary)'
  152. WRITE(numout,*) ' lzoom_w = ', lzoom_w, ' (T = forced closed west boundary)'
  153. WRITE(numout,*) ' lzoom_s = ', lzoom_s, ' (T = forced closed South boundary)'
  154. WRITE(numout,*) ' lzoom_n = ', lzoom_n, ' (T = forced closed North boundary)'
  155. ENDIF
  156. IF( ( lzoom_e .OR. lzoom_w ) .AND. ( jperio == 1 .OR. jperio == 4 .OR. jperio == 6 ) ) &
  157. & CALL ctl_stop( ' Your zoom choice is inconsistent with east-west cyclic boundary condition' )
  158. IF( lzoom_n .AND. ( 3 <= jperio .AND. jperio <= 6 ) ) &
  159. & CALL ctl_stop( ' Your zoom choice is inconsistent with North fold boundary condition' )
  160. ! ! Pre-defined arctic/antarctic zoom of ORCA configuration flag
  161. IF( cp_cfg == "orca" ) THEN
  162. SELECT CASE ( jp_cfg )
  163. CASE ( 2 ) ! ORCA_R2 configuration
  164. IF( cp_cfz == "arctic" .AND. jpiglo == 142 .AND. jpjglo == 53 .AND. &
  165. & jpizoom == 21 .AND. jpjzoom == 97 ) THEN
  166. IF(lwp) WRITE(numout,*) ' ORCA configuration: arctic zoom '
  167. ENDIF
  168. IF( cp_cfz == "antarctic" .AND. jpiglo == jpidta .AND. jpjglo == 50 .AND. &
  169. & jpizoom == 1 .AND. jpjzoom == 1 ) THEN
  170. IF(lwp) WRITE(numout,*) ' ORCA configuration: antarctic zoom '
  171. ENDIF
  172. !
  173. CASE ( 05 ) ! ORCA_R05 configuration
  174. IF( cp_cfz == "arctic" .AND. jpiglo == 562 .AND. jpjglo == 202 .AND. &
  175. & jpizoom == 81 .AND. jpjzoom == 301 ) THEN
  176. IF(lwp) WRITE(numout,*) ' ORCA configuration: arctic zoom '
  177. ENDIF
  178. IF( cp_cfz == "antarctic" .AND. jpiglo == jpidta .AND. jpjglo == 187 .AND. &
  179. & jpizoom == 1 .AND. jpjzoom == 1 ) THEN
  180. IF(lwp) WRITE(numout,*) ' ORCA configuration: antarctic zoom '
  181. ENDIF
  182. END SELECT
  183. !
  184. ENDIF
  185. !
  186. END SUBROUTINE dom_glo
  187. !!======================================================================
  188. END MODULE domcfg