!--
!----------------------------------------------------------------------
!     Copyright (c) 2009--2016 Shin-ichi Takehiro. All rights reserved.
!----------------------------------------------------------------------
!è¡¨é¡Œ  wa_module_svpack
!
!   spml/wa_module_svpack ãƒ¢ã‚¸ãƒ¥ãƒ¼ãƒ«ã¯çƒé¢ä¸Šã§ã® 2 æ¬¡å…ƒæµä½“é‹å‹•ã‚’
!   çƒé¢èª¿å’Œå‡½æ•°ã‚’ç”¨ã„ãŸã‚¹ãƒšã‚¯ãƒˆãƒ«æ³•ã«ã‚ˆã£ã¦æ•°å€¤è¨ˆç®—ã™ã‚‹ãŸã‚ã®
!   Fortran90 é–¢æ•°ã‚’æä¾›ã™ã‚‹.
!
!   çƒé¢ä¸Šã® 1 å±¤ãƒ¢ãƒ‡ãƒ«ç”¨ w_module_svpack ãƒ¢ã‚¸ãƒ¥ãƒ¼ãƒ«ã‚’å¤šå±¤ãƒ¢ãƒ‡ãƒ«ç”¨ã«
!   æ‹¡å¼µã—ãŸã‚‚ã®ã§ã‚ã‚Š, åŒæ™‚ã«è¤‡æ•°å€‹ã®ã‚¹ãƒšã‚¯ãƒˆãƒ«ãƒ‡ãƒ¼ã‚¿, æ ¼åç‚¹ãƒ‡ãƒ¼ã‚¿ã«
!   å¯¾ã™ã‚‹å¤‰æ›ãŒè¡Œãˆã‚‹.
!
!   wa_module_svpack ã¯å®Ÿéš›ã«ã¯åŸºæœ¬å¤‰æ›, å¾®åˆ†è¨ˆç®—, ç©åˆ†ãƒ»å¹³å‡è¨ˆç®—,
!   ã‚¹ãƒšã‚¯ãƒˆãƒ«è§£æžã‚’ãã‚Œãžã‚Œæ‹…ã£ã¦ã„ã‚‹ä¸‹éƒ¨ãƒ¢ã‚¸ãƒ¥ãƒ¼ãƒ« wa_base_module_sjpac,
!   wa_deriv_module_svpack, wa_integral_module_svpack,
!   wa_spectrum_module_svpack ãŠã‚ˆã³ 1 å±¤ç”¨ã®ãƒ¢ã‚¸ãƒ¥ãƒ¼ãƒ« w_module ã‹ã‚‰ãªã£ã¦ã„ã‚‹.
!
!   å†…éƒ¨ã§ ISPACK2 ã® SVPACK ã® Fortran77 ã‚µãƒ–ãƒ«ãƒ¼ãƒãƒ³ã‚’å‘¼ã‚“ã§ã„ã‚‹.
!   ã‚¹ãƒšã‚¯ãƒˆãƒ«ãƒ‡ãƒ¼ã‚¿ãŠã‚ˆã³æ ¼åç‚¹ãƒ‡ãƒ¼ã‚¿ã®æ ¼ç´æ–¹æ³•ã‚„å¤‰æ›ã®è©³ã—ã„è¨ˆç®—æ³•ã«
!   ã¤ã„ã¦ã¯ ISPACK2/SVPACK ã®ãƒžãƒ‹ãƒ¥ã‚¢ãƒ«ã‚’å‚ç…§ã•ã‚ŒãŸã„.
!
!   é–¢æ•°, ã‚µãƒ–ãƒ«ãƒ¼ãƒãƒ³ã®åå‰ã¨æ©Ÿèƒ½ã¯ wa_module ã®ã‚‚ã®ã¨åŒã˜ã§ã‚ã‚‹.
!   ã—ãŸãŒã£ã¦ use æ–‡ã‚’ wa_module ã‹ã‚‰ wa_module_svpack ã«
!   å¤‰æ›´ã™ã‚‹ã ã‘ã§ SVPACK ã®æ©Ÿèƒ½ãŒä½¿ãˆã‚‹ã‚ˆã†ã«ãªã‚‹.
!
!   ãŸã ã— l_nm, nm_l ã®ä½¿ã„æ–¹ã«ã¯æ³¨æ„ã•ã‚ŒãŸã„. wa_module ã® l_nm, nm_l ã¯
!   wa_Initial ã§åˆæœŸåŒ–ã—ãªãã¨ã‚‚ç”¨ã„ã‚‹ã“ã¨ãŒã§ãã‚‹(çµæžœãŒåˆ‡æ–æ³¢æ•°ã«ä¾ã‚‰ãªã„)ãŒ,
!   wa_module_svpack ã®ã‚‚ã®ã¯åˆæœŸåŒ–ã—ãŸã®ã¡ã«ã—ã‹ä½¿ã†ã“ã¨ãŒã§ããªã„.
!
!å±¥æ´  2009/09/06  ç«¹åºƒçœŸä¸€  wa_deriv_module ã‚ˆã‚Š SVPACK ç”¨ã«æ”¹é€
!      2009/09/20  ç«¹åºƒçœŸä¸€  ä½¿ç”¨ä¸Šã®æ³¨æ„ã‚’è¿½åŠ
!      2013/02/12  ç«¹åºƒçœŸä¸€  w_StreamPotential2Vector, w_Vector2VorDiv,
!                            wa_StreamPotential2Vector, wa_Vector2VorDiv å°Žå…¥
!      2013/02/14  ç«¹åºƒçœŸä¸€  w_VectorCosLat2VorDiv, wa_VectorCosLat2VorDiv å°Žå…¥
!      2013/02/23  ç«¹åºƒçœŸä¸€  wa_Finalize å°Žå…¥
!      2016/04/21  ç«¹åºƒçœŸä¸€  svpack ç”¨ã«æ”¹é€
!
!
!++
module wa_module_svpack
  !
  != wa_module_svpack
  !
  ! Authors:: Shin-ichi Takehiro, Youhei SASAKI
  ! Version:: $Id$
  ! Copyright&License:: See COPYRIGHT[link:../COPYRIGHT]
  !
  !== æ¦‚è¦
  !
  !   spml/wa_module_svpack ãƒ¢ã‚¸ãƒ¥ãƒ¼ãƒ«ã¯çƒé¢ä¸Šã§ã® 2 æ¬¡å…ƒæµä½“é‹å‹•ã‚’
  !   çƒé¢èª¿å’Œå‡½æ•°ã‚’ç”¨ã„ãŸã‚¹ãƒšã‚¯ãƒˆãƒ«æ³•ã«ã‚ˆã£ã¦æ•°å€¤è¨ˆç®—ã™ã‚‹ãŸã‚ã®
  !   Fortran90 é–¢æ•°ã‚’æä¾›ã™ã‚‹.
  !
  !   çƒé¢ä¸Šã® 1 å±¤ãƒ¢ãƒ‡ãƒ«ç”¨ w_module_svpack ãƒ¢ã‚¸ãƒ¥ãƒ¼ãƒ«ã‚’å¤šå±¤ãƒ¢ãƒ‡ãƒ«ç”¨ã«
  !   æ‹¡å¼µã—ãŸã‚‚ã®ã§ã‚ã‚Š, åŒæ™‚ã«è¤‡æ•°å€‹ã®ã‚¹ãƒšã‚¯ãƒˆãƒ«ãƒ‡ãƒ¼ã‚¿, æ ¼åç‚¹ãƒ‡ãƒ¼ã‚¿ã«
  !   å¯¾ã™ã‚‹å¤‰æ›ãŒè¡Œãˆã‚‹.
  !
  !   wa_module_svpack ã¯å®Ÿéš›ã«ã¯åŸºæœ¬å¤‰æ›, å¾®åˆ†è¨ˆç®—, ç©åˆ†ãƒ»å¹³å‡è¨ˆç®—,
  !   ã‚¹ãƒšã‚¯ãƒˆãƒ«è§£æžã‚’ãã‚Œãžã‚Œæ‹…ã£ã¦ã„ã‚‹ä¸‹éƒ¨ãƒ¢ã‚¸ãƒ¥ãƒ¼ãƒ« wa_base_module_sjpac,
  !   wa_deriv_module_svpack, wa_integral_module_svpack,
  !   wa_spectrum_module_svpack ãŠã‚ˆã³ 1 å±¤ç”¨ã®ãƒ¢ã‚¸ãƒ¥ãƒ¼ãƒ« w_module ã‹ã‚‰ãªã£ã¦ã„ã‚‹.
  !
  !   å†…éƒ¨ã§ ISPACK ã® SVPACK ã® Fortran77 ã‚µãƒ–ãƒ«ãƒ¼ãƒãƒ³ã‚’å‘¼ã‚“ã§ã„ã‚‹.
  !   ã‚¹ãƒšã‚¯ãƒˆãƒ«ãƒ‡ãƒ¼ã‚¿ãŠã‚ˆã³æ ¼åç‚¹ãƒ‡ãƒ¼ã‚¿ã®æ ¼ç´æ–¹æ³•ã‚„å¤‰æ›ã®è©³ã—ã„è¨ˆç®—æ³•ã«
  !   ã¤ã„ã¦ã¯ ISPACK/SVPACK ã®ãƒžãƒ‹ãƒ¥ã‚¢ãƒ«ã‚’å‚ç…§ã•ã‚ŒãŸã„.
  !
  !   é–¢æ•°, ã‚µãƒ–ãƒ«ãƒ¼ãƒãƒ³ã®åå‰ã¨æ©Ÿèƒ½ã¯ wa_module ã®ã‚‚ã®ã¨åŒã˜ã§ã‚ã‚‹.
  !   ã—ãŸãŒã£ã¦ use æ–‡ã‚’ wa_module ã‹ã‚‰ wa_module_svpack ã«
  !   å¤‰æ›´ã™ã‚‹ã ã‘ã§ SVPACK ã®æ©Ÿèƒ½ãŒä½¿ãˆã‚‹ã‚ˆã†ã«ãªã‚‹.
  !
  !   ãŸã ã— l_nm, nm_l ã®ä½¿ã„æ–¹ã«ã¯æ³¨æ„ã•ã‚ŒãŸã„. wa_module ã® l_nm, nm_l ã¯
  !   wa_Initial ã§åˆæœŸåŒ–ã—ãªãã¨ã‚‚ç”¨ã„ã‚‹ã“ã¨ãŒã§ãã‚‹(çµæžœãŒåˆ‡æ–æ³¢æ•°ã«ä¾ã‚‰ãªã„)ãŒ,
  !   wa_module_svpack ã®ã‚‚ã®ã¯åˆæœŸåŒ–ã—ãŸã®ã¡ã«ã—ã‹ä½¿ã†ã“ã¨ãŒã§ããªã„.
  !
  !=== å‘½åæ³•
  !
  ! * é–¢æ•°åã®å…ˆé  (wa_, nma_, na_, xya_, xa_, ya_, w_, xy_, x_, y_, a_) ã¯,
  !   è¿”ã™å€¤ã®å½¢ã‚’ç¤ºã—ã¦ã„ã‚‹.
  !   wa_  :: æ°´å¹³ã‚¹ãƒšã‚¯ãƒˆãƒ«ãƒ‡ãƒ¼ã‚¿ã®ä¸¦ã‚“ã  2 æ¬¡å…ƒé…åˆ—(ã‚¹ãƒšã‚¯ãƒˆãƒ«ãƒ‡ãƒ¼ã‚¿ã®
  !           ä¸¦ã³ã¯ SNPACK/ISPACK ã«å¾“ã£ãŸã‚‚ã®)
  !   nma_ :: ã‚¹ãƒšã‚¯ãƒˆãƒ«ãƒ‡ãƒ¼ã‚¿ã®ä¸¦ã‚“ã  3 æ¬¡å…ƒé…åˆ— (ã‚¹ãƒšã‚¯ãƒˆãƒ«ãƒ‡ãƒ¼ã‚¿ã®ä¸¦ã³ã¯
  !           å…¨æ³¢æ•° n, å¸¯çŠ¶æ³¢æ•° m ã§æŒ‡å®šã•ã‚Œã‚‹ 2 æ¬¡å…ƒé…åˆ—)
  !   na_  :: ã‚¹ãƒšã‚¯ãƒˆãƒ«ãƒ‡ãƒ¼ã‚¿ã®ä¸¦ã‚“ã  2 æ¬¡å…ƒé…åˆ— (ã‚¹ãƒšã‚¯ãƒˆãƒ«ãƒ‡ãƒ¼ã‚¿ã®ä¸¦ã³ã¯
  !           å…¨æ³¢æ•° n ã§æŒ‡å®šã•ã‚Œã‚‹ 1 æ¬¡å…ƒé…åˆ—)
  !   xya_ :: 2 æ¬¡å…ƒæ ¼åç‚¹ãƒ‡ãƒ¼ã‚¿ã®ä¸¦ã‚“ã  3 æ¬¡å…ƒé…åˆ—
  !   xa_  :: çµŒåº¦æ–¹å‘ 1 æ¬¡å…ƒæ ¼åç‚¹ãƒ‡ãƒ¼ã‚¿ã®ä¸¦ã‚“ã  2 æ¬¡å…ƒé…åˆ—
  !   ya_  :: ç·¯åº¦æ–¹å‘ 1 æ¬¡å…ƒæ ¼åç‚¹ãƒ‡ãƒ¼ã‚¿ã®ä¸¦ã‚“ã  2 æ¬¡å…ƒé…åˆ—
  !
  ! * é–¢æ•°åã®é–“ã®æ–‡å—åˆ—(DLon, GradLat, GradLat, DivLon, DivLat, Lapla,
  !   LaplaInv, Jacobian)ã¯, ãã®é–¢æ•°ã®ä½œç”¨ã‚’è¡¨ã—ã¦ã„ã‚‹.
  !
  ! * é–¢æ•°åã®æœ€å¾Œ (_wa_wa, _wa, _xya, _xa, _ya, _w_w, _w, _xy, _x, _y) ã¯,
  !   å…¥åŠ›å¤‰æ•°ã®å½¢ã‚¹ãƒšã‚¯ãƒˆãƒ«ãƒ‡ãƒ¼ã‚¿ãŠã‚ˆã³æ ¼åç‚¹ãƒ‡ãƒ¼ã‚¿ã§ã‚ã‚‹ã“ã¨ã‚’ç¤ºã—ã¦ã„ã‚‹.
  !   _wa    :: ã‚¹ãƒšã‚¯ãƒˆãƒ«ãƒ‡ãƒ¼ã‚¿ã®ä¸¦ã‚“ã  2 æ¬¡å…ƒé…åˆ—
  !   _wa_wa :: 2 ã¤ã®ã‚¹ãƒšã‚¯ãƒˆãƒ«ãƒ‡ãƒ¼ã‚¿ã®ä¸¦ã‚“ã  2 æ¬¡å…ƒé…åˆ—
  !   _xya   :: 2 æ¬¡å…ƒæ ¼åç‚¹ãƒ‡ãƒ¼ã‚¿ã®ä¸¦ã‚“ã  3 æ¬¡å…ƒé…åˆ—
  !   _xa    :: çµŒåº¦æ–¹å‘ 1 æ¬¡å…ƒæ ¼åç‚¹ãƒ‡ãƒ¼ã‚¿ã®ä¸¦ã‚“ã  2 æ¬¡å…ƒé…åˆ—
  !   _ya    :: ç·¯åº¦æ–¹å‘ 1 æ¬¡å…ƒæ ¼åç‚¹ãƒ‡ãƒ¼ã‚¿ã®ä¸¦ã‚“ã  2 æ¬¡å…ƒé…åˆ—
  !
  !=== å„ãƒ‡ãƒ¼ã‚¿ã®ç¨®é¡žã®èª¬æ˜Ž
  !
  ! * xya : 2 æ¬¡å…ƒæ ¼åç‚¹ãƒ‡ãƒ¼ã‚¿ã®ä¸¦ã‚“ã  3 æ¬¡å…ƒé…åˆ—.
  !   * å¤‰æ•°ã®ç¨®é¡žã¨æ¬¡å…ƒã¯ real(8), dimension(0:im-1,1:jm,:).
  !   * im, jm ã¯ãã‚Œãžã‚ŒçµŒåº¦, ç·¯åº¦åº§æ¨™ã®æ ¼åç‚¹æ•°ã§ã‚ã‚Š, ã‚µãƒ–ãƒ«ãƒ¼ãƒãƒ³
  !     wa_Initial ã«ã¦ã‚ã‚‰ã‹ã˜ã‚è¨å®šã—ã¦ãŠã.
  !   * æ‰±ã†ç¬¬ 3 æ¬¡å…ƒã®å¤§ãã•ã®æœ€å¤§å€¤ã‚’ wa_Initial ã§è¨å®šã—ã¦ãŠã.
  !
  ! * wa : ã‚¹ãƒšã‚¯ãƒˆãƒ«ãƒ‡ãƒ¼ã‚¿ã®ä¸¦ã‚“ã  2 æ¬¡å…ƒé…åˆ—.
  !   * å¤‰æ•°ã®ç¨®é¡žã¨æ¬¡å…ƒã¯ real(8), dimension((nm+1)*(nm+1),:).
  !   * nm ã¯çƒé¢èª¿å’Œå‡½æ•°ã®æœ€å¤§å…¨æ³¢æ•°ã§ã‚ã‚Š, ã‚µãƒ–ãƒ«ãƒ¼ãƒãƒ³ wa_Initial ã«ã¦
  !     ã‚ã‚‰ã‹ã˜ã‚è¨å®šã—ã¦ãŠã.
  !   * ã‚¹ãƒšã‚¯ãƒˆãƒ«ãƒ‡ãƒ¼ã‚¿ã®æ ¼ç´ã®ã•ã‚Œæ–¹ã¯é–¢æ•°
  !     l_nm, nm_l ã«ã‚ˆã£ã¦èª¿ã¹ã‚‹ã“ã¨ãŒã§ãã‚‹.
  !   * æ‰±ã†ç¬¬ 3 æ¬¡å…ƒã®å¤§ãã•ã®æœ€å¤§å€¤ã‚’ wa_Initial ã§è¨å®šã—ã¦ãŠã.
  !
  ! * xa, ya : çµŒåº¦, ç·¯åº¦æ–¹å‘ 1 æ¬¡å…ƒæ ¼åç‚¹ãƒ‡ãƒ¼ã‚¿.
  !   * å¤‰æ•°ã®ç¨®é¡žã¨æ¬¡å…ƒã¯ãã‚Œãžã‚Œ real(8), dimension(0:im-1,:)
  !     ãŠã‚ˆã³ real(8), dimension(1:jm,:).
  !
  ! * nma : ã‚¹ãƒšã‚¯ãƒˆãƒ«ãƒ‡ãƒ¼ã‚¿ã®ä¸¦ã‚“ã  3 æ¬¡å…ƒé…åˆ—.
  !   * å¤‰æ•°ã®ç¨®é¡žã¨æ¬¡å…ƒã¯ real(8), dimension(0:nm,-nm:nm,:).
  !   * ç¬¬ 1 æ¬¡å…ƒãŒæ°´å¹³å…¨æ³¢æ•°, ç¬¬ 2 æ¬¡å…ƒãŒå¸¯çŠ¶æ³¢æ•°ã‚’è¡¨ã™.
  !   * nm ã¯çƒé¢èª¿å’Œå‡½æ•°ã®æœ€å¤§å…¨æ³¢æ•°ã§ã‚ã‚Š,
  !     ã‚µãƒ–ãƒ«ãƒ¼ãƒãƒ³ wa_Initial ã«ã¦ã‚ã‚‰ã‹ã˜ã‚è¨å®šã—ã¦ãŠã.
  !
  ! * na : ã‚¹ãƒšã‚¯ãƒˆãƒ«ãƒ‡ãƒ¼ã‚¿ã®ä¸¦ã‚“ã  2 æ¬¡å…ƒé…åˆ—.
  !   * å¤‰æ•°ã®ç¨®é¡žã¨æ¬¡å…ƒã¯ real(8), dimension(0:nm,:).
  !   *  ç¬¬ 1 æ¬¡å…ƒãŒæ°´å¹³å…¨æ³¢æ•°ã‚’è¡¨ã™.nm ã¯çƒé¢èª¿å’Œå‡½æ•°ã®æœ€å¤§å…¨æ³¢æ•°ã§ã‚ã‚Š,
  !      ã‚µãƒ–ãƒ«ãƒ¼ãƒãƒ³ wa_Initial ã«ã¦ã‚ã‚‰ã‹ã˜ã‚è¨å®šã—ã¦ãŠã.
  !
  ! * wa_ ã§å§‹ã¾ã‚‹é–¢æ•°ãŒè¿”ã™å€¤ã¯ã‚¹ãƒšã‚¯ãƒˆãƒ«ãƒ‡ãƒ¼ã‚¿ã®ä¸¦ã‚“ã  2 æ¬¡å…ƒé…åˆ—ã«åŒã˜.
  !
  ! * nma_ ã§å§‹ã¾ã‚‹é–¢æ•°ãŒè¿”ã™å€¤ã¯ã‚¹ãƒšã‚¯ãƒˆãƒ«ãƒ‡ãƒ¼ã‚¿ã®ä¸¦ã‚“ã  3 æ¬¡å…ƒé…åˆ—ã«åŒã˜.
  !
  ! * na_ ã§å§‹ã¾ã‚‹é–¢æ•°ãŒè¿”ã™å€¤ã¯ã‚¹ãƒšã‚¯ãƒˆãƒ«ãƒ‡ãƒ¼ã‚¿ã®ä¸¦ã‚“ã  2 æ¬¡å…ƒé…åˆ—ã«åŒã˜.
  !
  ! * xya_ ã§å§‹ã¾ã‚‹é–¢æ•°ãŒè¿”ã™å€¤ã¯ 2 æ¬¡å…ƒæ ¼åç‚¹ãƒ‡ãƒ¼ã‚¿ã®ä¸¦ã‚“ã  3 æ¬¡å…ƒé…åˆ—ã«
  !   åŒã˜.
  !
  ! * xa_, ya_ ã§å§‹ã¾ã‚‹é–¢æ•°ãŒè¿”ã™å€¤ã¯ 1 æ¬¡å…ƒæ ¼åç‚¹ãƒ‡ãƒ¼ã‚¿ã®ä¸¦ã‚“ã  2 æ¬¡å…ƒ
  !   é…åˆ—ã«åŒã˜.
  !
  ! * ã‚¹ãƒšã‚¯ãƒˆãƒ«ãƒ‡ãƒ¼ã‚¿ã«å¯¾ã™ã‚‹å¾®åˆ†ç‰ã®ä½œç”¨ã¨ã¯, å¯¾å¿œã™ã‚‹æ ¼åç‚¹ãƒ‡ãƒ¼ã‚¿ã«
  !   å¾®åˆ†ãªã©ã‚’ä½œç”¨ã•ã›ãŸãƒ‡ãƒ¼ã‚¿ã‚’ã‚¹ãƒšã‚¯ãƒˆãƒ«å¤‰æ›ã—ãŸã‚‚ã®ã“ã¨ã§ã‚ã‚‹.
  !
  !
  !== å¤‰æ•°ãƒ»æ‰‹ç¶šãç¾¤ã®è¦ç´„
  !
  !==== åˆæœŸåŒ–
  !
  ! wa_Initial :: ã‚¹ãƒšã‚¯ãƒˆãƒ«å¤‰æ›ã®æ ¼åç‚¹æ•°, æ³¢æ•°, é ˜åŸŸã®å¤§ãã•,
  !            :: ãŠã‚ˆã³åŒæ™‚ã«è¨ˆç®—ã™ã‚‹ãƒ‡ãƒ¼ã‚¿ã®å€‹æ•°ã®æœ€å¤§å€¤è¨å®š
  !
  !==== çµ‚äº†å‡¦ç†
  !
  ! wa_Finalize :: ãƒ¢ã‚¸ãƒ¥ãƒ¼ãƒ«ã®çµ‚äº†å‡¦ç†(å‰²ã‚Šä»˜ã‘é…åˆ—ã®è§£æ”¾)ã‚’ãŠã“ãªã†.
  !
  !==== åº§æ¨™å¤‰æ•°
  !
  ! x_Lon, y_Lat     ::  æ ¼åç‚¹åº§æ¨™(ç·¯åº¦, çµŒåº¦åº§æ¨™)ã‚’æ ¼ç´ã—ãŸ 1 æ¬¡å…ƒé…åˆ—
  ! x_Lon_Weight, y_Lat_Weight ::  é‡ã¿åº§æ¨™ã‚’æ ¼ç´ã—ãŸ 1 æ¬¡å…ƒé…åˆ—
  ! xy_Lon, xy_Lat   :: æ ¼åç‚¹ãƒ‡ãƒ¼ã‚¿ã®çµŒåº¦ãƒ»ç·¯åº¦åº§æ¨™(X,Y)
  !                     (æ ¼åç‚¹ãƒ‡ãƒ¼ã‚¿åž‹ 2 æ¬¡å…ƒé…åˆ—)
  !
  !==== åŸºæœ¬å¤‰æ›
  !
  ! xya_wa, xy_w :: ã‚¹ãƒšã‚¯ãƒˆãƒ«ãƒ‡ãƒ¼ã‚¿ã‹ã‚‰æ ¼åãƒ‡ãƒ¼ã‚¿ã¸ã®å¤‰æ›(å¤šå±¤, 1 å±¤ç”¨)
  ! wa_xya, w_xy :: æ ¼åãƒ‡ãƒ¼ã‚¿ã‹ã‚‰ã‚¹ãƒšã‚¯ãƒˆãƒ«ãƒ‡ãƒ¼ã‚¿ã¸ã®å¤‰æ›(å¤šå±¤, 1 å±¤ç”¨)
  ! l_nm, nm_l :: ã‚¹ãƒšã‚¯ãƒˆãƒ«ãƒ‡ãƒ¼ã‚¿ã®æ ¼ç´ä½ç½®ã¨å…¨æ³¢æ•°ãƒ»å¸¯çŠ¶æ³¢æ•°ã®å¤‰æ›
  ! w_StreamPotential2Vector :: æµç·šãƒãƒ†ãƒ³ã‚·ãƒ£ãƒ«ã‹ã‚‰é€Ÿåº¦å ´è¨ˆç®—
  ! w_Vector2VorDiv   :: é€Ÿåº¦å ´ã‹ã‚‰æ¸¦åº¦ç™ºæ•£ã‚’è¨ˆç®—
  ! w_VectorCosLat2VorDiv   :: é€Ÿåº¦å ´ã‹ã‚‰æ¸¦åº¦ç™ºæ•£ã‚’è¨ˆç®—
  ! wa_StreamPotential2Vector :: æµç·šãƒãƒ†ãƒ³ã‚·ãƒ£ãƒ«ã‹ã‚‰é€Ÿåº¦å ´è¨ˆç®—
  ! wa_Vector2VorDiv   :: é€Ÿåº¦å ´ã‹ã‚‰æ¸¦åº¦ç™ºæ•£ã‚’è¨ˆç®—
  ! wa_VectorCosLat2VorDiv   :: é€Ÿåº¦å ´ã‹ã‚‰æ¸¦åº¦ç™ºæ•£ã‚’è¨ˆç®—
  !
  !==== å¾®åˆ†
  !
  ! wa_Lapla_wa, w_Lapla_w        :: ã‚¹ãƒšã‚¯ãƒˆãƒ«ãƒ‡ãƒ¼ã‚¿ã«ãƒ©ãƒ—ãƒ©ã‚·ã‚¢ãƒ³ã‚’
  !                                  ä½œç”¨ã•ã›ã‚‹(å¤šå±¤, 1 å±¤ç”¨)
  ! rn                            :: ã‚¹ãƒšã‚¯ãƒˆãƒ«ãƒ‡ãƒ¼ã‚¿ã®ãƒ©ãƒ—ãƒ©ã‚·ã‚¢ãƒ³ã‚’
  !                                  è¨ˆç®—ã™ã‚‹ãŸã‚ã®ä¿‚æ•°
  ! irm                           :: çµŒåº¦å¾®åˆ†æ¼”ç®—ç”¨é…åˆ—(æœªå®šç¾©)
  ! wa_LaplaInv_wa, w_LaplaInv_w  :: ã‚¹ãƒšã‚¯ãƒˆãƒ«ãƒ‡ãƒ¼ã‚¿ã«ãƒ©ãƒ—ãƒ©ã‚·ã‚¢ãƒ³ã®é€†å¤‰æ›ã‚’
  !                                  ä½œç”¨ã•ã›ã‚‹(å¤šå±¤, 1 å±¤ç”¨)
  ! wa_DLon_wa, w_DLon_w          :: ã‚¹ãƒšã‚¯ãƒˆãƒ«ãƒ‡ãƒ¼ã‚¿ã«
  !                                  çµŒåº¦å¾®åˆ†âˆ‚/âˆ‚Î»ã‚’ä½œç”¨ã•ã›ã‚‹(å¤šå±¤, 1 å±¤ç”¨)
  ! xya_GradLon_wa, xy_GradLon_w  :: ã‚¹ãƒšã‚¯ãƒˆãƒ«ãƒ‡ãƒ¼ã‚¿ã«
  !                                  å‹¾é…åž‹çµŒåº¦å¾®åˆ† 1/cosÏ†ãƒ»âˆ‚/âˆ‚Î» ã‚’
  !                                  ä½œç”¨ã•ã›ã‚‹(å¤šå±¤, 1 å±¤ç”¨)
  ! xya_GradLat_wa, xy_GradLat_w  :: ã‚¹ãƒšã‚¯ãƒˆãƒ«ãƒ‡ãƒ¼ã‚¿ã«
  !                                  å‹¾é…åž‹ç·¯åº¦å¾®åˆ† âˆ‚/âˆ‚Ï† ã‚’
  !                                  ä½œç”¨ã•ã›ã‚‹(å¤šå±¤, 1 å±¤ç”¨)
  ! wa_DivLon_xya, w_DivLon_xy    :: æ ¼åãƒ‡ãƒ¼ã‚¿ã«
  !                                  ç™ºæ•£åž‹çµŒåº¦å¾®åˆ† 1/cosÏ†ãƒ»âˆ‚/âˆ‚Î»ã‚’
  !                                  ä½œç”¨ã•ã›ã‚‹(å¤šå±¤, 1 å±¤ç”¨)
  ! wa_DivLat_xya, w_DivLat_xy    :: æ ¼åãƒ‡ãƒ¼ã‚¿ã«
  !                                  ç™ºæ•£åž‹ç·¯åº¦å¾®åˆ† 1/cosÏ†ãƒ»âˆ‚(g cosÏ†)/âˆ‚Ï†ã‚’
  !                                  ä½œç”¨ã•ã›ã‚‹ (å¤šå±¤, 1 å±¤ç”¨)
  ! wa_Div_xya_xya, w_Div_xy_xy   :: ãƒ™ã‚¯ãƒˆãƒ«æˆåˆ†ã§ã‚ã‚‹ 2 ã¤ã®æ ¼åãƒ‡ãƒ¼ã‚¿ã«
  !                                  ç™ºæ•£ã‚’ä½œç”¨ã•ã›ã‚‹(å¤šå±¤, 1 å±¤ç”¨)
  ! wa_Jacobian_wa_wa,w_Jacobian_w_w :: 2ã¤ã®ã‚¹ãƒšã‚¯ãƒˆãƒ«ãƒ‡ãƒ¼ã‚¿ã‹ã‚‰ãƒ¤ã‚³ãƒ“ã‚¢ãƒ³ã‚’
  !                                     è¨ˆç®—ã™ã‚‹(å¤šå±¤, 1 å±¤ç”¨)
  !
  !==== å¾®åˆ†(Î»,Î¼=sinÏ† åº§æ¨™)
  !
  ! xya_GradLambda_wa, xy_GradLambda_w  :: ã‚¹ãƒšã‚¯ãƒˆãƒ«ãƒ‡ãƒ¼ã‚¿ã«
  !                                        å‹¾é…åž‹çµŒåº¦å¾®åˆ†âˆ‚/âˆ‚Î»ã‚’ä½œç”¨ã•ã›ã‚‹
  !                                        (å¤šå±¤, 1 å±¤ç”¨)
  ! xya_GradMu_wa, xy_GradMu_w          :: ã‚¹ãƒšã‚¯ãƒˆãƒ«ãƒ‡ãƒ¼ã‚¿ã«
  !                                        å‹¾é…åž‹ç·¯åº¦å¾®åˆ†(1-Î¼^2)âˆ‚/âˆ‚Î¼
  !                                        ã‚’ä½œç”¨ã•ã›ã‚‹
  !                                        (å¤šå±¤, 1 å±¤ç”¨)
  ! wa_DivLambda_xya,w_DivLambda_xy     :: æ ¼åãƒ‡ãƒ¼ã‚¿ã«ç™ºæ•£åž‹çµŒåº¦å¾®åˆ†
  !                                        1 /(1-Î¼^2)ãƒ»âˆ‚/âˆ‚Î»ã‚’ä½œç”¨ã•ã›ã‚‹
  !                                        (å¤šå±¤, 1 å±¤ç”¨)
  !
  ! wa_DivMu_xya,w_DivMu_xy             :: æ ¼åãƒ‡ãƒ¼ã‚¿ã«ç™ºæ•£åž‹ç·¯åº¦å¾®åˆ†
  !                                        âˆ‚/âˆ‚Î¼ã‚’ä½œç”¨ã•ã›ã‚‹(å¤šå±¤, 1 å±¤ç”¨)
  !
  !==== è£œé–“è¨ˆç®—
  !
  ! a_Interpolate_wa, Interpolate_w :: ã‚¹ãƒšã‚¯ãƒˆãƒ«ãƒ‡ãƒ¼ã‚¿ã‹ã‚‰
  !                                    ä»»æ„ã®ç‚¹ã®é–¢æ•°å€¤ã‚’è¨ˆç®—ã™ã‚‹.
  !
  !==== ç©åˆ†ãƒ»å¹³å‡
  !
  ! a_IntLonLat_xya, a_AvrLonLat_xya :: 2 æ¬¡å…ƒæ ¼åç‚¹ãƒ‡ãƒ¼ã‚¿ã®
  !                                     å…¨é ˜åŸŸç©åˆ†ãŠã‚ˆã³å¹³å‡(å¤šå±¤ç”¨)
  ! IntLonLat_xy, AvrLonLat_xy       :: 2 æ¬¡å…ƒæ ¼åç‚¹ãƒ‡ãƒ¼ã‚¿ã®
  !                                     å…¨é ˜åŸŸç©åˆ†ãŠã‚ˆã³å¹³å‡(1 å±¤ç”¨)
  ! ya_IntLon_xya, ya_AvrLon_xya     :: 2 æ¬¡å…ƒæ ¼åç‚¹ãƒ‡ãƒ¼ã‚¿ã®
  !                                     çµŒåº¦æ–¹å‘ç©åˆ†ãŠã‚ˆã³å¹³å‡(å¤šå±¤ç”¨)
  ! y_IntLon_xy, y_AvrLon_xy         :: 2 æ¬¡å…ƒæ ¼åç‚¹ãƒ‡ãƒ¼ã‚¿ã®
  !                                     çµŒåº¦æ–¹å‘ç©åˆ†ãŠã‚ˆã³å¹³å‡(1 å±¤ç”¨)
  ! a_IntLon_xa, a_AvrLon_xa         :: 1 æ¬¡å…ƒ(X)æ ¼åç‚¹ãƒ‡ãƒ¼ã‚¿ã®
  !                                     çµŒåº¦æ–¹å‘ç©åˆ†ãŠã‚ˆã³å¹³å‡(å¤šå±¤ç”¨)
  ! IntLon_x, AvrLon_x               :: 1 æ¬¡å…ƒ(X)æ ¼åç‚¹ãƒ‡ãƒ¼ã‚¿ã®
  !                                     çµŒåº¦æ–¹å‘ç©åˆ†ãŠã‚ˆã³å¹³å‡(1 å±¤ç”¨)
  ! xa_IntLat_xya, x_AvrLat_xy       :: 2 æ¬¡å…ƒæ ¼åç‚¹ãƒ‡ãƒ¼ã‚¿ã®
  !                                     ç·¯åº¦æ–¹å‘ç©åˆ†ãŠã‚ˆã³å¹³å‡(å¤šå±¤ç”¨)
  ! x_IntLat_xy, x_AvrLat_xy         :: 2 æ¬¡å…ƒæ ¼åç‚¹ãƒ‡ãƒ¼ã‚¿ã®
  !                                     ç·¯åº¦æ–¹å‘ç©åˆ†ãŠã‚ˆã³å¹³å‡(1 å±¤ç”¨)
  ! a_IntLat_ya, a_AvrLat_ya         :: 1 æ¬¡å…ƒ(Y)æ ¼åç‚¹ãƒ‡ãƒ¼ã‚¿ã®
  !                                     ç·¯åº¦æ–¹å‘ç©åˆ†ãŠã‚ˆã³å¹³å‡(å¤šå±¤ç”¨)
  ! IntLat_y, AvrLat_y               :: 1 æ¬¡å…ƒ(Y)æ ¼åç‚¹ãƒ‡ãƒ¼ã‚¿ã®
  !                                     ç·¯åº¦æ–¹å‘ç©åˆ†ãŠã‚ˆã³å¹³å‡(1 å±¤ç”¨)
  !
  !==== ã‚¹ãƒšã‚¯ãƒˆãƒ«è§£æž
  !
  ! nma_EnergyFromStreamfunc_wa,nm_EnergyFromStreamfunc_w   ::
  ! æµç·šé–¢æ•°ã‹ã‚‰ã‚¨ãƒãƒ«ã‚®ãƒ¼ã‚¹ãƒšã‚¯ãƒˆãƒ«ã‚’è¨ˆç®—ã™ã‚‹
  ! (æ°´å¹³å…¨æ³¢æ•° n, å¸¯çŠ¶æ³¢æ•° m ç©ºé–“)(å¤šå±¤, 1 å±¤ç”¨)
  !
  ! na_EnergyFromStreamfunc_wa,n_EnergyFromStreamfunc_w     ::
  ! æµç·šé–¢æ•°ã‹ã‚‰ã‚¨ãƒãƒ«ã‚®ãƒ¼ã‚¹ãƒšã‚¯ãƒˆãƒ«ã‚’è¨ˆç®—ã™ã‚‹
  ! (æ°´å¹³å…¨æ³¢æ•° n ç©ºé–“) (å¤šå±¤, 1 å±¤ç”¨)
  !
  ! nma_EnstrophyFromStreamfunc_wa,nm_EnstrophyFromStreamfunc_w   ::
  ! æµç·šé–¢æ•°ã‹ã‚‰ã‚¨ãƒ³ã‚¹ãƒˆãƒãƒ•ã‚£ãƒ¼ã‚¹ãƒšã‚¯ãƒˆãƒ«ã‚’è¨ˆç®—ã™ã‚‹
  ! (æ°´å¹³å…¨æ³¢æ•° n, å¸¯çŠ¶æ³¢æ•° m ç©ºé–“)(å¤šå±¤, 1 å±¤ç”¨)
  !
  ! na_EnstrophyFromStreamfunc_wa,n_EnstrophyFromStreamfunc_w ::
  ! æµç·šé–¢æ•°ã‹ã‚‰ã‚¨ãƒ³ã‚¹ãƒˆãƒãƒ•ã‚£ãƒ¼ã‚¹ãƒšã‚¯ãƒˆãƒ«ã‚’è¨ˆç®—ã™ã‚‹(æ°´å¹³å…¨æ³¢æ•° n ç©ºé–“)
  ! (å¤šå±¤, 1 å±¤ç”¨)
  !
  ! w_spectrum_VMiss              ::  æ¬ æå€¤
  !
  !
  use dc_message, only : MessageNotify
  use w_module_svpack
  use wa_base_module_svpack
  use wa_deriv_module_svpack
  use wa_interpolate_module_svpack
  use wa_integral_module_svpack
  use wa_spectrum_module_svpack

  private

  public wa_Initial                           ! åˆæœŸåŒ–
  public wa_Finalize                          ! çµ‚äº†å‡¦ç†

  public x_Lon, y_Lat                         ! æ ¼ååº§æ¨™
  public x_Lon_Weight, y_Lat_Weight           ! æ ¼ååº§æ¨™é‡ã¿
  public xy_Lon, xy_Lat                       ! æ ¼ååº§æ¨™(im,jm)
  public xy_w, w_xy, l_nm, nm_l               ! å¤‰æ›é–¢æ•°
  public w_StreamPotential2Vector             ! æµç·šãƒãƒ†ãƒ³ã‚·ãƒ£ãƒ«ã‹ã‚‰é€Ÿåº¦å ´è¨ˆç®—
  public w_Vector2VorDiv                      ! é€Ÿåº¦å ´ã‹ã‚‰æ¸¦åº¦ç™ºæ•£ã‚’è¨ˆç®—
  public w_VectorCosLat2VorDiv                ! é€Ÿåº¦å ´ã‹ã‚‰æ¸¦åº¦ç™ºæ•£ã‚’è¨ˆç®—
  public xya_wa, wa_xya                       ! å¤‰æ›é–¢æ•°
  public wa_StreamPotential2Vector            ! æµç·šãƒãƒ†ãƒ³ã‚·ãƒ£ãƒ«ã‹ã‚‰é€Ÿåº¦å ´è¨ˆç®—
  public wa_Vector2VorDiv                     ! é€Ÿåº¦å ´ã‹ã‚‰æ¸¦åº¦ç™ºæ•£ã‚’è¨ˆç®—
  public wa_VectorCosLat2VorDiv               ! é€Ÿåº¦å ´ã‹ã‚‰æ¸¦åº¦ç™ºæ•£ã‚’è¨ˆç®—

  public rn                                   ! ãƒ©ãƒ—ãƒ©ã‚·ã‚¢ãƒ³ã®ä¿‚æ•°é…åˆ—
  public w_Lapla_w, w_LaplaInv_w              ! ãƒ©ãƒ—ãƒ©ã‚·ã‚¢ãƒ³ã¨é€†æ¼”ç®—
  public w_DLon_w                             ! çµŒåº¦å¾®åˆ†
  public xy_GradLon_w, xy_GradLat_w           ! å‹¾é…åž‹å¾®åˆ†
  public w_DivLon_xy, w_DivLat_xy             ! ç™ºæ•£åž‹å¾®åˆ†
  public w_Div_xy_xy                          ! ç™ºæ•£åž‹å¾®åˆ†
  public w_Jacobian_w_w                       ! ãƒ¤ã‚³ãƒ“ã‚¢ãƒ³
  public xy_GradLambda_w, xy_GradMu_w         ! å‹¾é…åž‹å¾®åˆ†(Î»,Î¼åº§æ¨™)
  public w_DivLambda_xy, w_DivMu_xy           ! ç™ºæ•£åž‹å¾®åˆ†(Î»,Î¼åº§æ¨™)

  public wa_Lapla_wa, wa_LaplaInv_wa          ! ãƒ©ãƒ—ãƒ©ã‚·ã‚¢ãƒ³ã¨é€†æ¼”ç®—
  public wa_DLon_wa                           ! çµŒåº¦å¾®åˆ†
  public xya_GradLon_wa, xya_GradLat_wa       ! å‹¾é…åž‹å¾®åˆ†
  public wa_DivLon_xya, wa_DivLat_xya         ! ç™ºæ•£åž‹å¾®åˆ†
  public wa_Div_xya_xya                       ! ç™ºæ•£åž‹å¾®åˆ†
  public wa_Jacobian_wa_wa                    ! ãƒ¤ã‚³ãƒ“ã‚¢ãƒ³
  public xya_GradLambda_wa, xya_GradMu_wa     ! å‹¾é…åž‹å¾®åˆ†(Î»,Î¼åº§æ¨™)
  public wa_DivLambda_xya, wa_DivMu_xya       ! ç™ºæ•£åž‹å¾®åˆ†(Î»,Î¼åº§æ¨™)

  public a_Interpolate_wa, Interpolate_w      ! è£œé–“é–¢æ•°

  public IntLonLat_xy                         ! ç·¯åº¦çµŒåº¦ç©åˆ†
  public y_IntLon_xy, IntLon_x                ! çµŒåº¦ç©åˆ†
  public x_IntLat_xy, IntLat_y                ! ç·¯åº¦ç©åˆ†
  public AvrLonLat_xy                         ! ç·¯åº¦çµŒåº¦å¹³å‡
  public y_AvrLon_xy, AvrLon_x                ! çµŒåº¦å¹³å‡
  public x_AvrLat_xy, AvrLat_y                ! ç·¯åº¦å¹³å‡

  public a_IntLonLat_xya                      ! ç·¯åº¦çµŒåº¦ç©åˆ†
  public ya_IntLon_xya, a_IntLon_xa           ! çµŒåº¦ç©åˆ†
  public xa_IntLat_xya, a_IntLat_ya           ! ç·¯åº¦ç©åˆ†
  public a_AvrLonLat_xya                      ! ç·¯åº¦çµŒåº¦å¹³å‡
  public ya_AvrLon_xya, a_AvrLon_xa           ! çµŒåº¦å¹³å‡
  public xa_AvrLat_xya, a_AvrLat_ya           ! ç·¯åº¦å¹³å‡

  public nma_EnergyFromStreamfunc_wa          ! ã‚¨ãƒãƒ«ã‚®ãƒ¼ã‚¹ãƒšã‚¯ãƒˆãƒ«
                                              ! (æ°´å¹³å…¨æ³¢æ•° n, å¸¯çŠ¶æ³¢æ•° m ç©ºé–“)
  public na_EnergyFromStreamfunc_wa           ! ã‚¨ãƒãƒ«ã‚®ãƒ¼ã‚¹ãƒšã‚¯ãƒˆãƒ«
                                              ! (æ°´å¹³å…¨æ³¢æ•° n ç©ºé–“)
  public nma_EnstrophyFromStreamfunc_wa       ! ã‚¨ãƒ³ã‚¹ãƒˆãƒãƒ•ã‚£ãƒ¼ã‚¹ãƒšã‚¯ãƒˆãƒ«
                                              ! (æ°´å¹³å…¨æ³¢æ•° n, å¸¯çŠ¶æ³¢æ•° m ç©ºé–“)
  public na_EnstrophyFromStreamfunc_wa        ! ã‚¨ãƒ³ã‚¹ãƒˆãƒãƒ•ã‚£ãƒ¼ã‚¹ãƒšã‚¯ãƒˆãƒ«
                                              !  (æ°´å¹³å…¨æ³¢æ•° n ç©ºé–“)
  public wa_spectrum_VMiss                    ! æ¬ æå€¤

  public nm_EnergyFromStreamfunc_w          ! ã‚¨ãƒãƒ«ã‚®ãƒ¼ã‚¹ãƒšã‚¯ãƒˆãƒ«
                                            ! (æ°´å¹³å…¨æ³¢æ•° n, å¸¯çŠ¶æ³¢æ•° m ç©ºé–“)
  public n_EnergyFromStreamfunc_w           ! ã‚¨ãƒãƒ«ã‚®ãƒ¼ã‚¹ãƒšã‚¯ãƒˆãƒ«
                                            ! (æ°´å¹³å…¨æ³¢æ•° n ç©ºé–“)
  public nm_EnstrophyFromStreamfunc_w       ! ã‚¨ãƒ³ã‚¹ãƒˆãƒãƒ•ã‚£ãƒ¼ã‚¹ãƒšã‚¯ãƒˆãƒ«
                                            ! (æ°´å¹³å…¨æ³¢æ•° n, å¸¯çŠ¶æ³¢æ•° m ç©ºé–“)
  public n_EnstrophyFromStreamfunc_w        ! ã‚¨ãƒ³ã‚¹ãƒˆãƒãƒ•ã‚£ãƒ¼ã‚¹ãƒšã‚¯ãƒˆãƒ«
                                            !  (æ°´å¹³å…¨æ³¢æ•° n ç©ºé–“)
  public w_spectrum_VMiss                   ! æ¬ æå€¤

contains
  subroutine wa_Initial(n_in,i_in,j_in,k_in,np_in)
    !
    ! ã‚¹ãƒšã‚¯ãƒˆãƒ«å¤‰æ›ã®æ ¼åç‚¹æ•°, æ³¢æ•°, æœ€å¤§ãƒ‡ãƒ¼ã‚¿æ•°(å±¤æ•°)ãŠã‚ˆã³
    ! OPENMP ä½¿ç”¨æ™‚ã®æœ€å¤§ã‚¹ãƒ¬ãƒƒãƒ‰æ•°ã‚’è¨å®šã™ã‚‹.
    !
    ! ä»–ã®é–¢æ•°ã‚’å‘¼ã¶å‰ã«, æœ€åˆã«ã“ã®ã‚µãƒ–ãƒ«ãƒ¼ãƒãƒ³ã‚’å‘¼ã‚“ã§åˆæœŸè¨å®šã‚’
    ! ã—ãªã‘ã‚Œã°ãªã‚‰ãªã„.
    !
    ! SNPACK ç”¨ wa_initial ã¨ã®äº’æ›æ€§ã®ãŸã‚ã«å¼•æ•° k_in ãŒç”¨æ„ã•ã‚Œã¦ã„ã‚‹ãŒ,
    ! ã“ã®ãƒ‘ãƒ©ãƒ¡ã‚¿ãƒ¼ã«ã‚ˆã£ã¦åŒæ™‚ã«å‡¦ç†ã§ãã‚‹å¤‰æ•°ã®æ•°(å±¤æ•°)ã‚’åˆ¶é™ã•ã‚Œã‚‹äº‹ã¯ãªã„.
    !
    ! np_in ã« 1 ã‚ˆã‚Šå¤§ããªå€¤ã‚’æŒ‡å®šã™ã‚Œã° ISPACK ã®çƒé¢èª¿å’Œå‡½æ•°å¤‰æ›
    ! OPENMP ä¸¦åˆ—è¨ˆç®—ãƒ«ãƒ¼ãƒãƒ³ãŒç”¨ã„ã‚‰ã‚Œã‚‹. ä¸¦åˆ—è¨ˆç®—ã‚’å®Ÿè¡Œã™ã‚‹ã«ã¯,
    ! å®Ÿè¡Œæ™‚ã«ç’°å¢ƒå¤‰æ•° OMP_NUM_THREADS ã‚’ np_in ä»¥ä¸‹ã®æ•°å—ã«è¨å®šã™ã‚‹ç‰ã®
    ! ã‚·ã‚¹ãƒ†ãƒ ã«å¿œã˜ãŸæº–å‚™ãŒå¿…è¦ã¨ãªã‚‹.
    !
    ! np_in ã« 1 ã‚ˆã‚Šå¤§ããªå€¤ã‚’æŒ‡å®šã—ãªã‘ã‚Œã°ä¸¦åˆ—è¨ˆç®—ãƒ«ãƒ¼ãƒãƒ³ã¯å‘¼ã°ã‚Œãªã„.
    !
    integer,intent(in) :: i_in                ! æ ¼åç‚¹æ•°(æ±è¥¿)
    integer,intent(in) :: j_in                ! æ ¼åç‚¹æ•°(å—åŒ—)
    integer,intent(in) :: n_in                ! åˆ‡æ–æ³¢æ•°
    integer,intent(in) :: k_in                ! æœ€å¤§ãƒ‡ãƒ¼ã‚¿æ•°(å±¤æ•°)
    integer,intent(in), optional :: np_in     ! OPENMP ã§ã®æœ€å¤§ã‚¹ãƒ¬ãƒƒãƒ‰æ•°

    if ( present(np_in) ) then
       call w_Initial(n_in,i_in,j_in,np_in)
    else
       call w_Initial(n_in,i_in,j_in)
    endif
    call wa_base_Initial(k_in)

    call MessageNotify('M','wa_initial', &
                       'wa_module_svpack (2016/04/21) is initialized')

  end subroutine wa_Initial

  !--------------- çµ‚äº†å‡¦ç† -----------------
  subroutine wa_Finalize
    !
    ! ãƒ¢ã‚¸ãƒ¥ãƒ¼ãƒ«ã®çµ‚äº†å‡¦ç†(å‰²ã‚Šä»˜ã‘é…åˆ—ã®è§£æ”¾)ã‚’ãŠã“ãªã†.
    !
    ! è§£åƒåº¦ã‚’å¤‰æ›´ã™ã‚‹éš›ã«ã¯ã“ã®ã‚µãƒ–ãƒ«ãƒ¼ãƒãƒ³ã‚’å‘¼ã‚“ã§çµ‚äº†å‡¦ç†ã‚’
    ! ãŠã“ãªã£ãŸã®ã¡ã«å†åº¦ wa_Initial ã§åˆæœŸè¨å®šã—ãªã‘ã‚Œã°
    ! ãªã‚‰ãªã„.
    !
    call w_Finalize
    call wa_base_Finalize

    call MessageNotify('M','wa_Finalize', &
                       'wa_module_svpack (2016/04/21) is finalized')

  end subroutine wa_Finalize

end module wa_module_svpack