Skip to content

Commit

Permalink
Merge pull request NCAR#343 from grantfirl/cires_ugwp_namelist_fix
Browse files Browse the repository at this point in the history
CIRES UGWP namelist fix
  • Loading branch information
grantfirl authored Nov 6, 2019
2 parents 4b46d26 + 59717c5 commit 6d0a40c
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 26 deletions.
9 changes: 5 additions & 4 deletions physics/cires_ugwp.F90
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ module cires_ugwp
!!
! -----------------------------------------------------------------------
!
subroutine cires_ugwp_init (me, master, nlunit, logunit, fn_nml2, &
lonr, latr, levs, ak, bk, dtp, cdmbgwd, cgwf, &
subroutine cires_ugwp_init (me, master, nlunit, input_nml_file, logunit, &
fn_nml2, lonr, latr, levs, ak, bk, dtp, cdmbgwd, cgwf, &
pa_rf_in, tau_rf_in, con_p0, do_ugwp, errmsg, errflg)

!---- initialization of cires_ugwp
Expand All @@ -47,6 +47,7 @@ subroutine cires_ugwp_init (me, master, nlunit, logunit, fn_nml2, &
integer, intent (in) :: me
integer, intent (in) :: master
integer, intent (in) :: nlunit
character(len=*), intent (in) :: input_nml_file(:)
integer, intent (in) :: logunit
integer, intent (in) :: lonr
integer, intent (in) :: levs
Expand Down Expand Up @@ -76,8 +77,8 @@ subroutine cires_ugwp_init (me, master, nlunit, logunit, fn_nml2, &
if (is_initialized) return

if (do_ugwp .or. cdmbgwd(3) > 0.0) then
call cires_ugwp_mod_init (me, master, nlunit, logunit, fn_nml2, &
lonr, latr, levs, ak, bk, con_p0, dtp, &
call cires_ugwp_mod_init (me, master, nlunit, input_nml_file, logunit, &
fn_nml2, lonr, latr, levs, ak, bk, con_p0, dtp, &
cdmbgwd(1:2), cgwf, pa_rf_in, tau_rf_in)
else
write(errmsg,'(*(a))') "Logic error: cires_ugwp_init called but do_ugwp is false and cdmbgwd(3) <= 0"
Expand Down
9 changes: 9 additions & 0 deletions physics/cires_ugwp.meta
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,15 @@
type = integer
intent = in
optional = F
[input_nml_file]
standard_name = namelist_filename_for_internal_file_reads
long_name = character string to store full namelist contents
units = none
dimensions = (number_of_lines_of_namelist_filename_for_internal_file_reads)
type = character
kind = len=*
intent = in
optional = F
[logunit]
standard_name = iounit_log
long_name = fortran unit number for writing logfile
Expand Down
48 changes: 26 additions & 22 deletions physics/cires_ugwp_module.F90
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,10 @@ module cires_ugwp_module
! init of cires_ugwp (_init) called from GFS_driver.F90
!
! -----------------------------------------------------------------------
subroutine cires_ugwp_mod_init (me, master, nlunit, logunit, fn_nml2, &
lonr, latr, levs, ak, bk, pref, dtp, cdmvgwd, cgwf, &
subroutine cires_ugwp_mod_init (me, master, nlunit, input_nml_file, logunit, &
fn_nml, lonr, latr, levs, ak, bk, pref, dtp, cdmvgwd, cgwf, &
pa_rf_in, tau_rf_in)
!
! input_nml_file ='input.nml'=fn_nml
!

use ugwp_oro_init, only : init_oro_gws
use ugwp_conv_init, only : init_conv_gws
use ugwp_fjet_init, only : init_fjet_gws
Expand All @@ -120,31 +118,33 @@ subroutine cires_ugwp_mod_init (me, master, nlunit, logunit, fn_nml2, &
use ugwp_lsatdis_init, only : initsolv_lsatdis
implicit none

integer, intent (in) :: me
integer, intent (in) :: master
integer, intent (in) :: nlunit
integer, intent (in) :: logunit
integer, intent (in) :: lonr
integer, intent (in) :: levs
integer, intent (in) :: latr
real, intent (in) :: ak(levs+1), bk(levs+1), pref
real, intent (in) :: dtp
real, intent (in) :: cdmvgwd(2), cgwf(2) ! "scaling" controls for "old" GFS-GW schemes
real, intent (in) :: pa_rf_in, tau_rf_in

character(len=64), intent (in) :: fn_nml2
character(len=64), parameter :: fn_nml='input.nml'
integer, intent (in) :: me
integer, intent (in) :: master
integer, intent (in) :: nlunit
character (len = *), intent (in) :: input_nml_file(:)
integer, intent (in) :: logunit
character(len=64), intent (in) :: fn_nml
integer, intent (in) :: lonr
integer, intent (in) :: levs
integer, intent (in) :: latr
real, intent (in) :: ak(levs+1), bk(levs+1), pref
real, intent (in) :: dtp
real, intent (in) :: cdmvgwd(2), cgwf(2) ! "scaling" controls for "old" GFS-GW schemes
real, intent (in) :: pa_rf_in, tau_rf_in

! character, intent (in) :: input_nml_file
! integer, parameter :: logunit = 6
integer :: ios
logical :: exists
real :: dxsg
integer :: k
!

#ifdef INTERNAL_FILE_NML
read (input_nml_file, nml = cires_ugwp_nml)
#else
if (me == master) print *, trim (fn_nml), ' GW-namelist file '

inquire (file =trim (fn_nml) , exist = exists)
!

if (.not. exists) then
if (me == master) &
write (6, *) 'separate ugwp :: namelist file: ', trim (fn_nml), ' does not exist'
Expand All @@ -154,6 +154,10 @@ subroutine cires_ugwp_mod_init (me, master, nlunit, logunit, fn_nml2, &
rewind (nlunit)
read (nlunit, nml = cires_ugwp_nml)
close (nlunit)
#endif



!
ilaunch = launch_level
pa_rf = pa_rf_in
Expand Down

0 comments on commit 6d0a40c

Please sign in to comment.