Skip to content

Commit f67f87d

Browse files
committed
Merge branch 'ufs/dev' into NRL_combo_2025_08_29_top
2 parents 6f707a5 + 2c4dbd1 commit f67f87d

File tree

3 files changed

+187
-1
lines changed

3 files changed

+187
-1
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ target_link_libraries(ccpp_physics PUBLIC w3emc::w3emc_d
199199
NetCDF::NetCDF_Fortran
200200
)
201201
#add FMS for FV3 only
202-
if(FV3)
202+
if(FV3 OR MPAS)
203203
target_link_libraries(ccpp_physics PUBLIC fms)
204204
endif()
205205

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
!>\file GFS_rad_time_vary.mpas.F90
2+
!! Contains code related to GFS radiation suite setup (radiation part of time_vary_step)
3+
module GFS_rad_time_vary
4+
implicit none
5+
6+
private
7+
8+
public GFS_rad_time_vary_timestep_init
9+
10+
contains
11+
12+
!> This module contains code related to GFS radiation setup.
13+
14+
!> \section arg_table_GFS_rad_time_vary_timestep_init Argument Table
15+
!! \htmlinclude GFS_rad_time_vary_timestep_init.html
16+
!!
17+
subroutine GFS_rad_time_vary_timestep_init (lrseeds, rseeds, lslwr, lsswr, isubc_lw, &
18+
isubc_sw, icsdsw, icsdlw, sec, kdt, ipsd0, ipsdlim, errmsg, errflg)
19+
use mersenne_twister, only: random_setseed, random_index, random_stat
20+
use machine, only: kind_phys
21+
use radcons, only: con_100
22+
implicit none
23+
24+
! Interface variables
25+
logical, intent(in) :: lrseeds
26+
integer, intent(in), optional :: rseeds(:,:)
27+
integer, intent(in) :: isubc_lw, isubc_sw, kdt
28+
integer, intent(in) :: ipsd0, ipsdlim
29+
logical, intent(in) :: lslwr, lsswr
30+
integer, intent(inout), optional :: icsdsw(:), icsdlw(:)
31+
real(kind_phys), intent(in) :: sec
32+
character(len=*), intent(out) :: errmsg
33+
integer, intent(out) :: errflg
34+
35+
! Local variables
36+
type (random_stat) :: stat
37+
integer :: ix, j, i, ipseed, ixx
38+
integer, allocatable, dimension(:) :: numrdm
39+
40+
! Initialize CCPP error handling variables
41+
errmsg = ''
42+
errflg = 0
43+
44+
if (lsswr .or. lslwr) then
45+
!--- set up random seed index in a reproducible way for entire cubed-sphere face (lat-lon grid)
46+
if ((isubc_lw==2) .or. (isubc_sw==2)) then
47+
!NRL If random seeds supplied by NEPTUNE
48+
if(lrseeds) then
49+
do ix=1,size(icsdsw)
50+
icsdsw(ix) = rseeds(ix,1)
51+
icsdlw(ix) = rseeds(ix,2)
52+
enddo
53+
else
54+
allocate(numrdm(size(icsdlw)*2))
55+
ipseed = mod(nint(con_100*sqrt(sec)), ipsdlim) + 1 + ipsd0
56+
call random_setseed (ipseed, stat)
57+
call random_index (ipsdlim, numrdm, stat)
58+
59+
ixx = 1
60+
do ix=1,size(icsdsw)*2,2
61+
icsdsw(ixx) = numrdm(ix)
62+
icsdlw(ixx) = numrdm(ix+1)
63+
ixx = ixx + 1
64+
enddo
65+
deallocate(numrdm)
66+
end if ! lrseeds
67+
endif ! isubc_lw and isubc_sw
68+
endif ! lsswr or lslwr
69+
70+
end subroutine GFS_rad_time_vary_timestep_init
71+
72+
end module GFS_rad_time_vary
Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
[ccpp-table-properties]
2+
name = GFS_rad_time_vary
3+
type = scheme
4+
relative_path = ../../
5+
dependencies = hooks/machine.F,Radiation/mersenne_twister.f,Radiation/RRTMG/radcons.f90
6+
7+
########################################################################
8+
[ccpp-arg-table]
9+
name = GFS_rad_time_vary_timestep_init
10+
type = scheme
11+
[lrseeds]
12+
standard_name = do_host_provided_random_seeds
13+
long_name = flag to use host-provided random seeds
14+
units = flag
15+
dimensions = ()
16+
type = logical
17+
intent = in
18+
[rseeds]
19+
standard_name = random_number_seeds_from_host
20+
long_name = random number seeds from host
21+
units = none
22+
dimensions = (horizontal_dimension, number_of_host_provided_random_number_streams)
23+
type = integer
24+
intent = in
25+
optional = True
26+
[lslwr]
27+
standard_name = flag_for_calling_longwave_radiation
28+
long_name = logical flags for lw radiation calls
29+
units = flag
30+
dimensions = ()
31+
type = logical
32+
intent = in
33+
[lsswr]
34+
standard_name = flag_for_calling_shortwave_radiation
35+
long_name = logical flags for sw radiation calls
36+
units = flag
37+
dimensions = ()
38+
type = logical
39+
intent = in
40+
[isubc_lw]
41+
standard_name = flag_for_lw_clouds_sub_grid_approximation
42+
long_name = flag for lw clouds sub-grid approximation
43+
units = flag
44+
dimensions = ()
45+
type = integer
46+
intent = in
47+
[isubc_sw]
48+
standard_name = flag_for_sw_clouds_grid_approximation
49+
long_name = flag for sw clouds sub-grid approximation
50+
units = flag
51+
dimensions = ()
52+
type = integer
53+
intent = in
54+
[icsdsw]
55+
standard_name = random_number_seed_for_mcica_shortwave
56+
long_name = random seeds for sub-column cloud generators sw
57+
units = none
58+
dimensions = (horizontal_dimension)
59+
type = integer
60+
intent = inout
61+
optional = True
62+
[icsdlw]
63+
standard_name = random_number_seed_for_mcica_longwave
64+
long_name = random seeds for sub-column cloud generators lw
65+
units = none
66+
dimensions = (horizontal_dimension)
67+
type = integer
68+
intent = inout
69+
optional = True
70+
[sec]
71+
standard_name = forecast_time_in_seconds
72+
long_name = seconds elapsed since model initialization
73+
units = s
74+
dimensions = ()
75+
type = real
76+
kind = kind_phys
77+
intent = in
78+
[kdt]
79+
standard_name = index_of_timestep
80+
long_name = current forecast iteration
81+
units = index
82+
dimensions = ()
83+
type = integer
84+
intent = in
85+
[ipsd0]
86+
standard_name = initial_seed_for_mcica
87+
long_name = initial permutaion seed for mcica radiation
88+
units = 1
89+
dimensions = ()
90+
type = integer
91+
intent = in
92+
[ipsdlim]
93+
standard_name = limit_for_initial_seed_for_mcica
94+
long_name = limit for initial permutaion seed for mcica radiation
95+
units = 1
96+
dimensions = ()
97+
type = integer
98+
intent = in
99+
[errmsg]
100+
standard_name = ccpp_error_message
101+
long_name = error message for error handling in CCPP
102+
units = none
103+
dimensions = ()
104+
type = character
105+
kind = len=*
106+
intent = out
107+
[errflg]
108+
standard_name = ccpp_error_code
109+
long_name = error code for error handling in CCPP
110+
units = 1
111+
dimensions = ()
112+
type = integer
113+
intent = out
114+

0 commit comments

Comments
 (0)