-
Notifications
You must be signed in to change notification settings - Fork 146
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
miscellaneous changes from NRL #798
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,7 +15,8 @@ module GFS_rad_time_vary | |
!> \section arg_table_GFS_rad_time_vary_timestep_init Argument Table | ||
!! \htmlinclude GFS_rad_time_vary_timestep_init.html | ||
!! | ||
subroutine GFS_rad_time_vary_timestep_init ( & | ||
subroutine GFS_rad_time_vary_timestep_init (nthrds, blksz, lrseeds, & | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. All changes in this file seem specific to NRL to me. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think these changes make the random number generator _not specific to FV3. The random number generation has always been grid specific and this generalizes it. |
||
rseeds, & | ||
lslwr, lsswr, isubc_lw, isubc_sw, icsdsw, icsdlw, cnx, cny, isc, jsc, & | ||
imap, jmap, sec, kdt, imp_physics, imp_physics_zhao_carr, ps_2delt, & | ||
ps_1delt, t_2delt, t_1delt, qv_2delt, qv_1delt, t, qv, ps, errmsg, errflg) | ||
|
@@ -28,6 +29,10 @@ subroutine GFS_rad_time_vary_timestep_init ( | |
implicit none | ||
|
||
! Interface variables | ||
integer, intent(in) :: nthrds | ||
integer, intent(in) :: blksz(:) | ||
logical, intent(in) :: lrseeds | ||
integer, intent(in) :: rseeds(:,:) | ||
integer, intent(in) :: isubc_lw, isubc_sw, cnx, cny, isc, jsc, kdt | ||
integer, intent(in) :: imp_physics, imp_physics_zhao_carr | ||
logical, intent(in) :: lslwr, lsswr | ||
|
@@ -46,7 +51,7 @@ subroutine GFS_rad_time_vary_timestep_init ( | |
|
||
! Local variables | ||
type (random_stat) :: stat | ||
integer :: ix, j, i, nblks, ipseed | ||
integer :: ii, ix, nb, j, i, nblks, ipseed | ||
integer :: numrdm(cnx*cny*2) | ||
|
||
! Initialize CCPP error handling variables | ||
|
@@ -55,24 +60,50 @@ subroutine GFS_rad_time_vary_timestep_init ( | |
|
||
if (lsswr .or. lslwr) then | ||
|
||
!--- call to GFS_radupdate_timestep_init is now in GFS_rrtmg_setup_timestep_init | ||
nblks = size(blksz) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This update and those below that allow the seeds to be supplied by the host model appear to be NRL/NEPTUNE-specific. These for NEPTUNE, but are there any issues for other codes? (I'm not sure how to determine that other than asking other groups to review.) |
||
|
||
!--- call to GFS_radupdate_run is now in GFS_rrtmg_setup_run | ||
|
||
!$OMP parallel num_threads(nthrds) default(none) & | ||
!$OMP private (nb,ix,ii, i,j) & | ||
!$OMP shared (lrseeds,isubc_lw,isubc_sw,ipsdlim,ipsd0,ipseed) & | ||
!$OMP shared (cnx,cny,sec,numrdm,stat,nblks,isc,jsc) & | ||
!$OMP shared (blksz,icsdsw,icsdlw,jmap,imap) | ||
|
||
!--- set up random seed index in a reproducible way for entire cubed-sphere face (lat-lon grid) | ||
if ((isubc_lw==2) .or. (isubc_sw==2)) then | ||
ipseed = mod(nint(con_100*sqrt(sec)), ipsdlim) + 1 + ipsd0 | ||
call random_setseed (ipseed, stat) | ||
call random_index (ipsdlim, numrdm, stat) | ||
|
||
do ix=1,size(jmap) | ||
j = jmap(ix) | ||
i = imap(ix) | ||
!--- for testing purposes, replace numrdm with '100' | ||
icsdsw(ix) = numrdm(i+isc-1 + (j+jsc-2)*cnx) | ||
icsdlw(ix) = numrdm(i+isc-1 + (j+jsc-2)*cnx + cnx*cny) | ||
enddo | ||
|
||
!NRL If random seeds supplied by NEPTUNE | ||
if(lrseeds) then | ||
ii = 1 | ||
do nb=1,nblks | ||
do ix=1,blksz(nb) | ||
icsdsw(ix) = rseeds(ix,1) | ||
icsdlw(ix) = rseeds(ix,2) | ||
end do | ||
enddo | ||
else | ||
!$OMP single | ||
ipseed = mod(nint(con_100*sqrt(sec)), ipsdlim) + 1 + ipsd0 | ||
call random_setseed (ipseed, stat) | ||
call random_index (ipsdlim, numrdm, stat) | ||
!$OMP end single | ||
|
||
!$OMP do schedule (dynamic,1) | ||
do nb=1,nblks | ||
do ix=1,blksz(nb) | ||
j = jmap(ix) | ||
i = imap(ix) | ||
!--- for testing purposes, replace numrdm with '100' | ||
icsdsw(ix) = numrdm(i+isc-1 + (j+jsc-2)*cnx) | ||
icsdlw(ix) = numrdm(i+isc-1 + (j+jsc-2)*cnx + cnx*cny) | ||
enddo | ||
enddo | ||
!$OMP end do | ||
end if | ||
endif ! isubc_lw and isubc_sw | ||
|
||
!$OMP end parallel | ||
|
||
if (imp_physics == imp_physics_zhao_carr) then | ||
if (kdt == 1) then | ||
t_2delt = t | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,34 @@ | |
[ccpp-arg-table] | ||
name = GFS_rad_time_vary_timestep_init | ||
type = scheme | ||
[nthrds] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. All changes in this file correspond to NRL-specific changes in the corresponding Fortran. |
||
standard_name = omp_threads | ||
long_name = number of OpenMP threads available for physics schemes | ||
units = count | ||
dimensions = () | ||
type = integer | ||
intent = in | ||
[blksz] | ||
standard_name = ccpp_block_sizes | ||
long_name = for explicit data blocking: block sizes of all blocks | ||
units = count | ||
dimensions = (ccpp_block_count) | ||
type = integer | ||
intent = in | ||
[lrseeds] | ||
standard_name = flag_for_model_specific_random_seeds | ||
long_name = flag for model specific random seeds | ||
units = flag | ||
dimensions = () | ||
type = logical | ||
intent = in | ||
[rseeds] | ||
standard_name = model_specific_random_seeds | ||
long_name = model specific random seeds | ||
units = none | ||
dimensions = (horizontal_dimension,number_of_random_streams) | ||
type = integer | ||
intent = in | ||
[lslwr] | ||
standard_name = flag_for_calling_longwave_radiation | ||
long_name = logical flags for lw radiation calls | ||
|
@@ -207,4 +235,3 @@ | |
dimensions = () | ||
type = integer | ||
intent = out | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,7 +16,7 @@ end subroutine GFS_rrtmg_pre_init | |
!! | ||
! Attention - the output arguments lm, im, lmk, lmp must not be set | ||
! in the CCPP version - they are defined in the interstitial_create routine | ||
subroutine GFS_rrtmg_pre_run (im, levs, lm, lmk, lmp, n_var_lndp, & | ||
subroutine GFS_rrtmg_pre_run (im, levs, lm, lmk, lmp, lextop, ltp, n_var_lndp, & | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are the changes in this file related to a bugfix or are they specific to NRL? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think these may be NRL/NEPTUNE-specific. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think they are bug fixes when using lextop=.true. @matusmartini can comment more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I remember those, yes. It would be really good to get the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, we use this capabilty with success for several suites and maintain it so it does not break our warm restart tests. I added a capability to have lextop as a namelist control flag so it can be turned on/off. |
||
imfdeepcnv, imfdeepcnv_gf, me, ncnd, ntrac, num_p3d, npdf3d, ncnvcld3d,& | ||
ntqv, ntcw,ntiw, ntlnc, ntinc, ntrw, ntsw, ntgl, ntwa, ntoz, & | ||
ntclamt, nleffr, nieffr, nseffr, lndp_type, kdt, imp_physics, & | ||
|
@@ -37,11 +37,10 @@ subroutine GFS_rrtmg_pre_run (im, levs, lm, lmk, lmp, n_var_lndp, & | |
clouds9, cldsa, cldfra, faersw1, faersw2, faersw3, faerlw1, faerlw2, & | ||
faerlw3, alpha, errmsg, errflg) | ||
|
||
use machine, only: kind_phys | ||
use machine, only: kind_phys, r8=>kind_dbl_prec | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can the definition of r8. Not used in this routine. Was probably added during debugging and forgot to remove. |
||
|
||
use physparam | ||
|
||
use radcons, only: itsfc,ltp, lextop, qmin, & | ||
use radcons, only: itsfc, qmin, & | ||
qme5, qme6, epsq, prsmin | ||
use funcphys, only: fpvs | ||
|
||
|
@@ -79,7 +78,7 @@ subroutine GFS_rrtmg_pre_run (im, levs, lm, lmk, lmp, n_var_lndp, & | |
|
||
implicit none | ||
|
||
integer, intent(in) :: im, levs, lm, lmk, lmp, n_var_lndp, & | ||
integer, intent(in) :: im, levs, lm, lmk, lmp, ltp, n_var_lndp, & | ||
imfdeepcnv, & | ||
imfdeepcnv_gf, me, ncnd, ntrac, & | ||
num_p3d, npdf3d, ncnvcld3d, ntqv, & | ||
|
@@ -98,7 +97,7 @@ subroutine GFS_rrtmg_pre_run (im, levs, lm, lmk, lmp, n_var_lndp, & | |
|
||
character(len=3), dimension(:), intent(in) :: lndp_var_list | ||
|
||
logical, intent(in) :: lsswr, lslwr, ltaerosol, lgfdlmprad, & | ||
logical, intent(in) :: lextop, lsswr, lslwr, ltaerosol, lgfdlmprad, & | ||
uni_cld, effr_in, do_mynnedmf, & | ||
lmfshal, lmfdeep2, pert_clds | ||
|
||
|
@@ -295,6 +294,8 @@ subroutine GFS_rrtmg_pre_run (im, levs, lm, lmk, lmp, n_var_lndp, & | |
plyr(i,k1) = prsl(i,k2) * 0.01 ! pa to mb (hpa) | ||
tlyr(i,k1) = tgrs(i,k2) | ||
prslk1(i,k1) = prslk(i,k2) | ||
rho(i,k1) = prsl(i,k2)/(con_rd*tlyr(i,k1)) | ||
orho(i,k1) = 1.0/rho(i,k1) | ||
|
||
!> - Compute relative humidity. | ||
es = min( prsl(i,k2), fpvs( tgrs(i,k2) ) ) ! fpvs and prsl in pa | ||
|
@@ -351,6 +352,8 @@ subroutine GFS_rrtmg_pre_run (im, levs, lm, lmk, lmp, n_var_lndp, & | |
plyr(i,lyb) = 0.5 * plvl(i,lla) | ||
tlyr(i,lyb) = tlyr(i,lya) | ||
prslk1(i,lyb) = (plyr(i,lyb)*0.001) ** rocp ! plyr in hPa | ||
rho(i,lyb) = plyr(i,lyb) *100.0/(con_rd*tlyr(i,lyb)) | ||
orho(i,lyb) = 1.0/rho(i,lyb) | ||
rhly(i,lyb) = rhly(i,lya) | ||
qstl(i,lyb) = qstl(i,lya) | ||
enddo | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,8 +11,6 @@ module GFS_rrtmg_setup | |
& iswcliq, & | ||
& kind_phys | ||
|
||
use radcons, only: ltp, lextop | ||
|
||
implicit none | ||
|
||
public GFS_rrtmg_setup_init, GFS_rrtmg_setup_timestep_init, GFS_rrtmg_setup_finalize | ||
|
@@ -46,7 +44,7 @@ subroutine GFS_rrtmg_setup_init ( & | |
si, levr, ictm, isol, ico2, iaer, ntcw, & | ||
num_p3d, npdf3d, ntoz, iovr, isubc_sw, isubc_lw, & | ||
icliq_sw, crick_proof, ccnorm, & | ||
imp_physics, & | ||
imp_physics, ltp, & | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are the changes in this file related to a bugfix or are they specific to NRL? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am checking with our developers. They appear to be NRL-specific, but I'll let you know. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These are related to using lextop=.true. |
||
norad_precip, idate, iflip, & | ||
do_RRTMGP, me, errmsg, errflg) | ||
! ================= subprogram documentation block ================ ! | ||
|
@@ -164,6 +162,7 @@ subroutine GFS_rrtmg_setup_init ( & | |
logical, intent(in) :: crick_proof | ||
logical, intent(in) :: ccnorm | ||
integer, intent(in) :: imp_physics | ||
integer, intent(in) :: ltp | ||
logical, intent(in) :: norad_precip | ||
integer, intent(in) :: idate(:) | ||
integer, intent(in) :: iflip | ||
|
@@ -241,7 +240,7 @@ subroutine GFS_rrtmg_setup_init ( & | |
|
||
call radinit & | ||
! --- inputs: | ||
& ( si, levr, imp_physics, me ) | ||
& ( si, levr, imp_physics, ltp, me ) | ||
! --- outputs: | ||
! ( none ) | ||
|
||
|
@@ -322,7 +321,7 @@ end subroutine GFS_rrtmg_setup_finalize | |
! Private functions | ||
|
||
|
||
subroutine radinit( si, NLAY, imp_physics, me ) | ||
subroutine radinit( si, NLAY, imp_physics, ltp, me ) | ||
!................................... | ||
|
||
! --- inputs: | ||
|
@@ -435,7 +434,7 @@ subroutine radinit( si, NLAY, imp_physics, me ) | |
implicit none | ||
|
||
! --- inputs: | ||
integer, intent(in) :: NLAY, me, imp_physics | ||
integer, intent(in) :: NLAY, me, imp_physics, ltp | ||
|
||
real (kind=kind_phys), intent(in) :: si(:) | ||
|
||
|
@@ -465,7 +464,7 @@ subroutine radinit( si, NLAY, imp_physics, me ) | |
print *,' IVFLIP=',ivflip,' IOVR=',iovrRad, & | ||
& ' ISUBCSW=',isubcsw,' ISUBCLW=',isubclw | ||
print *,' LCRICK=',lcrick,' LCNORM=',lcnorm,' LNOPREC=',lnoprec | ||
print *,' LTP =',ltp,', add extra top layer =',lextop | ||
print *,' LTP =',ltp,', add extra top layer =', ltp == 1 | ||
|
||
if ( ictmflg==0 .or. ictmflg==-2 ) then | ||
print *,' Data usage is limited by initial condition!' | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
specific to NRL (all current changes in CMakeLists.txt)