2 module module_HLawConst
13 character(len=64) :: name
16 type(HLCnst_type), allocatable :: HLC(:)
18 public :: init_HLawConst
24 subroutine init_HLawConst( dm )
26 integer, intent(in) :: dm ! domain index
28 integer :: m, n, unitno
30 integer :: astat, istat
34 character(len=64) :: inName
35 character(len=256) :: inlin
36 character(len=256) :: emsg
38 integer, external :: get_unused_unit
41 if( dm == 1 .and. .not. allocated(HLC) ) then
42 unitno = get_unused_unit()
43 if( unitno <= 0 ) then
44 call wrf_error_fatal( 'init_HLConst: Failed to get Fortran I/O unit number' )
46 open(unit=unitno,file='HLC.TBL',status='OLD',iostat=istat)
48 write(emsg,'(''init_HLConst: Failed to open HLC.TBL; error = '',i8)') istat
49 call wrf_error_fatal( trim(emsg) )
54 read(unitno,*,iostat=istat) inlin
62 write(emsg,'(''Read '',i4,'' Henrys Law entries'')') nHLC
63 call wrf_debug( 0,trim(emsg) )
66 allocate( HLC(nHLC),stat=astat )
68 write(emsg,'(''init_HLawConst: Failed to allocate HLC; error = '',i8)') astat
69 call wrf_error_fatal( trim(emsg) )
74 read(unitno,*,iostat=istat) inName,LawType,inMw,inHeff
76 write(emsg,'(''init_HLawConst: Failed to read line '',i3,''; error = '',i8)') n,istat
77 call wrf_error_fatal( trim(emsg) )
79 if( all( inHeff == 0. ) ) then
84 HLC(m)%name = inName ; HLC(m)%mw = inMw ; HLC(m)%hcnst(:) = inHeff(:)
89 write(emsg,'(''There are '',i4,'' Henrys Law null entries'')') nNull
90 call wrf_debug( 0,trim(emsg) )
92 call wrf_debug( 0, ' ' )
93 call wrf_debug( 0, 'HLaw table ' )
95 write(emsg,'(''('',i3.3,'')'',a16,1pg15.7,3x,6g15.7)') &
96 n,trim(HLC(n)%name),HLC(n)%mw,HLC(n)%hcnst(:)
97 call wrf_debug( 0, trim(emsg) )
103 endif top_level_domain
105 end subroutine init_HLawConst
107 end module module_HLawConst