Skip to content

Commit 7e5f42f

Browse files
committed
read shf options block; will need to circle back and test TS functionality later
1 parent 575c66c commit 7e5f42f

File tree

2 files changed

+119
-0
lines changed

2 files changed

+119
-0
lines changed

src/Model/GroundWaterEnergy/PbstBase.f90

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,7 @@ end subroutine subpck_set_stressperiod
342342

343343
!> @brief Read the SHF-specific options from the OPTIONS block
344344
!<
345+
<<<<<<< HEAD
345346
!subroutine read_options(this)
346347
! ! -- dummy
347348
! class(PbstBaseType) :: this
@@ -406,6 +407,73 @@ end subroutine subpck_set_stressperiod
406407
! 'END OF '//trim(adjustl(this%packName))//' OPTIONS'
407408
! end if
408409
!end subroutine read_options
410+
=======
411+
subroutine read_options(this)
412+
! -- dummy
413+
class(PbstBaseType) :: this
414+
! -- local
415+
character(len=LINELENGTH) :: keyword
416+
character(len=MAXCHARLEN) :: fname
417+
logical :: isfound
418+
logical :: endOfBlock
419+
logical(LGP) :: found
420+
integer(I4B) :: ierr
421+
! -- formats
422+
character(len=*), parameter :: fmtts = &
423+
&"(4x, 'TIME-SERIES DATA WILL BE READ FROM FILE: ', a)"
424+
!
425+
! -- Get options block
426+
call this%parser%GetBlock('OPTIONS', isfound, ierr, &
427+
blockRequired=.false., supportOpenClose=.true.)
428+
!
429+
! -- Parse options block if detected
430+
if (isfound) then
431+
write (this%iout, '(1x,a)') &
432+
'PROCESSING '//trim(adjustl(this%packName))//' OPTIONS'
433+
do
434+
call this%parser%GetNextLine(endOfBlock)
435+
if (endOfBlock) then
436+
exit
437+
end if
438+
call this%parser%GetStringCaps(keyword)
439+
select case (keyword)
440+
case ('PRINT_INPUT')
441+
this%iprpak = 1
442+
write (this%iout, '(4x,a)') 'TIME-VARYING INPUT WILL BE PRINTED.'
443+
case ('TS6')
444+
!
445+
! -- Add a time series file
446+
call this%parser%GetStringCaps(keyword)
447+
if (trim(adjustl(keyword)) /= 'FILEIN') then
448+
errmsg = &
449+
'TS6 keyword must be followed by "FILEIN" then by filename.'
450+
call store_error(errmsg)
451+
call this%parser%StoreErrorUnit()
452+
call ustop()
453+
end if
454+
call this%parser%GetString(fname)
455+
write (this%iout, fmtts) trim(fname)
456+
call this%tsmanager%add_tsfile(fname, this%inunit)
457+
case default
458+
!
459+
! -- Check for child class options
460+
call this%pbst_options(keyword, found)
461+
!
462+
! -- Defer to subtype to read the option;
463+
! -- if the subtype can't handle it, report an error
464+
if (.not. found) then
465+
write (errmsg, '(a,3(1x,a),a)') &
466+
'Unknown', trim(adjustl(this%packName)), "option '", &
467+
trim(keyword), "'."
468+
call store_error(errmsg)
469+
end if
470+
end select
471+
end do
472+
write (this%iout, '(1x,a)') &
473+
'END OF '//trim(adjustl(this%packName))//' OPTIONS'
474+
end if
475+
end subroutine read_options
476+
>>>>>>> 4baf8469ab (read shf options block; will need to circle back and test TS functionality later)
409477

410478
!> @ brief Read additional options for sub-package
411479
!!

src/Model/GroundWaterEnergy/gwe-shf.f90

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@ end function shf_get_pointer_to_value
167167
!!
168168
!! This routine overrides PbstBaseType%bnd_options
169169
!<
170+
<<<<<<< HEAD
170171
!subroutine shf_options(this, option, found)
171172
! ! -- dummy
172173
! class(ShfType), intent(inout) :: this
@@ -233,6 +234,56 @@ subroutine shf_cq(this, ifno, tstrm, shflx)
233234
shflx = shf_const * this%wspd(ifno) * (this%tatm(ifno) - tstrm)
234235
end subroutine shf_cq
235236

237+
=======
238+
subroutine shf_options(this, option, found)
239+
! -- dummy
240+
class(ShfType), intent(inout) :: this
241+
character(len=*), intent(inout) :: option
242+
logical, intent(inout) :: found
243+
!
244+
found = .true.
245+
select case (option)
246+
case ('DENSITY_AIR')
247+
this%rhoa = this%parser%GetDouble()
248+
if (this%rhoa <= 0.0) then
249+
write (errmsg, '(a)') 'Specified value for the density of &
250+
&the atmosphere must be greater than 0.0.'
251+
call store_error(errmsg)
252+
call this%parser%StoreErrorUnit()
253+
else
254+
write (this%iout, '(4x,a,1pg15.6)') &
255+
"The density of the atmosphere has been set to: ", this%rhoa
256+
end if
257+
case ('HEAT_CAPACITY_AIR')
258+
this%cpa = this%parser%GetDouble()
259+
if (this%cpa <= 0.0) then
260+
write (errmsg, '(a)') 'Specified value for the heat capacity of &
261+
&the atmosphere must be greater than 0.0.'
262+
call store_error(errmsg)
263+
call this%parser%StoreErrorUnit()
264+
else
265+
write (this%iout, '(4x,a,1pg15.6)') &
266+
"The heat capacity of the atmosphere has been set to: ", this%cpa
267+
end if
268+
case ('DRAG_COEFFICIENT')
269+
this%cd = this%parser%GetDouble()
270+
if (this%cd <= 0.0) then
271+
write (errmsg, '(a)') 'Specified value for the drag coefficient &
272+
&must be greater than 0.0.'
273+
call store_error(errmsg)
274+
call this%parser%StoreErrorUnit()
275+
else
276+
write (this%iout, '(4x,a,1pg15.6)') &
277+
"The heat capacity of the atmosphere has been set to: ", this%cpa
278+
end if
279+
case default
280+
write (errmsg, '(a,a)') 'Unknown SHF option: ', trim(option)
281+
call store_error(errmsg)
282+
call this%parser%StoreErrorUnit()
283+
end select
284+
end subroutine shf_options
285+
286+
>>>>>>> 4baf8469ab (read shf options block; will need to circle back and test TS functionality later)
236287
!> @brief Deallocate package memory
237288
!!
238289
!! Deallocate TVK package scalars and arrays.

0 commit comments

Comments
 (0)