⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 units.f90

📁 CCSM Research Tools: Community Atmosphere Model (CAM)
💻 F90
字号:
#include <misc.h>#include <params.h>module unitsimplicit nonePRIVATE   logical :: lutag(0:99) = .false.      ! list of flags marking logical units in use   public :: getunit, freeunitCONTAINS   integer function getunit (iu)!! Arguments!   integer, intent(in), optional :: iu   ! desired unit number!! Local workspace!   integer :: n                          ! loop index   if (present (iu)) then      if (iu < 0 .or. iu > 99) then         write(6,*)'GETUNIT: invalid unit number request:', iu         call endrun      else if (lutag(iu) .or. iu == 0 .or. iu == 5 .or. iu == 6) then         write(6,*)'GETUNIT: unit number ', iu, ' is already in use'         call endrun      else         getunit = iu         lutag (iu) = .true.         return      end if   else!! Choose first available unit other than 0, 5, or 6!      do n=1,99         if (n == 5 .or. n == 6) then            cycle         end if         if (.not.lutag(n)) then            getunit = n            lutag(n) = .true.            return         end if      end do   end if   write(6,*)'GETUNIT: an available unit could not be found'   call endrun   end function getunit!#######################################################################   subroutine freeunit (iu)!! Arguments!   integer, intent(in) :: iu       ! unit number to be freed   if (iu < 0 .or. iu > 99) then      write(6,*)'FREEUNIT: invalid unit number request:', iu   else if (iu == 0 .or. iu == 5 .or. iu == 6) then      write(6,*)'FREEUNIT: units 0, 5, and 6 must not be freed'      call endrun   else if (lutag(iu)) then      lutag (iu) = .false.   else      write(6,*)'FREEUNIT: unit ', iu, ' was not in use'   end if   return   end subroutine freeunitend module units

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -