Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
228 changes: 164 additions & 64 deletions physics/GFS_rrtmg_pre.F90

Large diffs are not rendered by default.

27 changes: 18 additions & 9 deletions physics/GFS_rrtmg_pre.meta
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,15 @@
type = GFS_radtend_type
intent = inout
optional = F
[dx]
standard_name = cell_size
long_name = relative dx for the grid cell
units = m
dimensions = (horizontal_dimension)
type = real
kind = kind_phys
intent = in
optional = F
[f_ice]
standard_name = fraction_of_ice_water_cloud
long_name = fraction of ice water cloud
Expand Down Expand Up @@ -427,7 +436,7 @@
standard_name = total_cloud_fraction
long_name = layer total cloud fraction
units = frac
dimensions = (horizontal_dimension,vertical_dimension)
dimensions = (horizontal_dimension,adjusted_vertical_layer_dimension_for_radiation)
type = real
kind = kind_phys
intent = out
Expand All @@ -436,7 +445,7 @@
standard_name = cloud_liquid_water_path
long_name = layer cloud liquid water path
units = g m-2
dimensions = (horizontal_dimension,vertical_dimension)
dimensions = (horizontal_dimension,adjusted_vertical_layer_dimension_for_radiation)
type = real
kind = kind_phys
intent = out
Expand All @@ -445,7 +454,7 @@
standard_name = mean_effective_radius_for_liquid_cloud
long_name = mean effective radius for liquid cloud
units = micron
dimensions = (horizontal_dimension,vertical_dimension)
dimensions = (horizontal_dimension,adjusted_vertical_layer_dimension_for_radiation)
type = real
kind = kind_phys
intent = out
Expand All @@ -454,7 +463,7 @@
standard_name = cloud_ice_water_path
long_name = layer cloud ice water path
units = g m-2
dimensions = (horizontal_dimension,vertical_dimension)
dimensions = (horizontal_dimension,adjusted_vertical_layer_dimension_for_radiation)
type = real
kind = kind_phys
intent = out
Expand All @@ -463,7 +472,7 @@
standard_name = mean_effective_radius_for_ice_cloud
long_name = mean effective radius for ice cloud
units = micron
dimensions = (horizontal_dimension,vertical_dimension)
dimensions = (horizontal_dimension,adjusted_vertical_layer_dimension_for_radiation)
type = real
kind = kind_phys
intent = out
Expand All @@ -472,7 +481,7 @@
standard_name = cloud_rain_water_path
long_name = cloud rain water path
units = g m-2
dimensions = (horizontal_dimension,vertical_dimension)
dimensions = (horizontal_dimension,adjusted_vertical_layer_dimension_for_radiation)
type = real
kind = kind_phys
intent = out
Expand All @@ -481,7 +490,7 @@
standard_name = mean_effective_radius_for_rain_drop
long_name = mean effective radius for rain drop
units = micron
dimensions = (horizontal_dimension,vertical_dimension)
dimensions = (horizontal_dimension,adjusted_vertical_layer_dimension_for_radiation)
type = real
kind = kind_phys
intent = out
Expand All @@ -490,7 +499,7 @@
standard_name = cloud_snow_water_path
long_name = cloud snow water path
units = g m-2
dimensions = (horizontal_dimension,vertical_dimension)
dimensions = (horizontal_dimension,adjusted_vertical_layer_dimension_for_radiation)
type = real
kind = kind_phys
intent = out
Expand All @@ -499,7 +508,7 @@
standard_name = mean_effective_radius_for_snow_flake
long_name = mean effective radius for snow flake
units = micron
dimensions = (horizontal_dimension,vertical_dimension)
dimensions = (horizontal_dimension,adjusted_vertical_layer_dimension_for_radiation)
type = real
kind = kind_phys
intent = out
Expand Down
3 changes: 2 additions & 1 deletion physics/GFS_rrtmg_setup.F90
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ subroutine GFS_rrtmg_setup_init ( &
! =1: max/ran overlapping clouds !
! =2: maximum overlap clouds (mcica only) !
! =3: decorrelation-length overlap (mcica only) !
! =4: exponential overlap clouds
! isubc_sw/isubc_lw: sub-column cloud approx control flag (sw/lw rad) !
! =0: with out sub-column cloud approximation !
! =1: mcica sub-col approx. prescribed random seed !
Expand Down Expand Up @@ -303,7 +304,7 @@ subroutine GFS_rrtmg_setup_init ( &

call radinit &
! --- inputs:
& ( si, levr, imp_physics, me )
& ( si, levr, imp_physics, me )
! --- outputs:
! ( none )

Expand Down
16 changes: 8 additions & 8 deletions physics/GFS_rrtmg_setup.meta
Original file line number Diff line number Diff line change
Expand Up @@ -107,32 +107,32 @@
intent = in
optional = F
[iovr_sw]
standard_name = flag_for_max_random_overlap_clouds_for_shortwave_radiation
long_name = sw: max-random overlap clouds
standard_name = flag_for_cloud_overlapping_method_for_shortwave_radiation
long_name = control flag for cloud overlapping method for SW
units = flag
dimensions = ()
type = integer
intent = in
optional = F
[iovr_lw]
standard_name = flag_for_max_random_overlap_clouds_for_longwave_radiation
long_name = lw: max-random overlap clouds
standard_name = flag_for_cloud_overlapping_method_for_longwave_radiation
long_name = control flag for cloud overlapping method for LW
units = flag
dimensions = ()
type = integer
intent = in
optional = F
[isubc_sw]
standard_name = flag_for_sw_clouds_without_sub_grid_approximation
long_name = flag for sw clouds without sub-grid approximation
standard_name = flag_for_sw_clouds_grid_approximation
long_name = flag for sw clouds sub-grid approximation
units = flag
dimensions = ()
type = integer
intent = in
optional = F
[isubc_lw]
standard_name = flag_for_lw_clouds_without_sub_grid_approximation
long_name = flag for lw clouds without sub-grid approximation
standard_name = flag_for_lw_clouds_sub_grid_approximation
long_name = flag for lw clouds sub-grid approximation
units = flag
dimensions = ()
type = integer
Expand Down
109 changes: 109 additions & 0 deletions physics/HWRF_mcica_random_numbers.F90
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
module mcica_random_numbers

! Generic module to wrap random number generators.
! The module defines a type that identifies the particular stream of random
! numbers, and has procedures for initializing it and getting real numbers
! in the range 0 to 1.
! This version uses the Mersenne Twister to generate random numbers on [0, 1].
!
use MersenneTwister, only: randomNumberSequence, & ! The random number engine.
new_RandomNumberSequence, getRandomReal
!! mji
!! use time_manager_mod, only: time_type, get_date

!mz use parkind, only : im => kind_im, rb => kind_rb
use machine, only: im => kind_io4, rb => kind_phys

implicit none
private

type randomNumberStream
type(randomNumberSequence) :: theNumbers
end type randomNumberStream

interface getRandomNumbers
module procedure getRandomNumber_Scalar, getRandomNumber_1D, getRandomNumber_2D
end interface getRandomNumbers

interface initializeRandomNumberStream
module procedure initializeRandomNumberStream_S, initializeRandomNumberStream_V
end interface initializeRandomNumberStream

public :: randomNumberStream, &
initializeRandomNumberStream, getRandomNumbers
!! mji
!! initializeRandomNumberStream, getRandomNumbers, &
!! constructSeed
contains
! ---------------------------------------------------------
! Initialization
! ---------------------------------------------------------
function initializeRandomNumberStream_S(seed) result(new)
integer(kind=im), intent( in) :: seed
type(randomNumberStream) :: new

new%theNumbers = new_RandomNumberSequence(seed)

end function initializeRandomNumberStream_S
! ---------------------------------------------------------
function initializeRandomNumberStream_V(seed) result(new)
integer(kind=im), dimension(:), intent( in) :: seed
type(randomNumberStream) :: new

new%theNumbers = new_RandomNumberSequence(seed)

end function initializeRandomNumberStream_V

! ---------------------------------------------------------
! Procedures for drawing random numbers
! ---------------------------------------------------------
subroutine getRandomNumber_Scalar(stream, number)
type(randomNumberStream), intent(inout) :: stream
real(kind=rb), intent( out) :: number

number = getRandomReal(stream%theNumbers)
end subroutine getRandomNumber_Scalar
! ---------------------------------------------------------
subroutine getRandomNumber_1D(stream, numbers)
type(randomNumberStream), intent(inout) :: stream
real(kind=rb), dimension(:), intent( out) :: numbers

! Local variables
integer(kind=im) :: i

do i = 1, size(numbers)
numbers(i) = getRandomReal(stream%theNumbers)
end do
end subroutine getRandomNumber_1D
! ---------------------------------------------------------
subroutine getRandomNumber_2D(stream, numbers)
type(randomNumberStream), intent(inout) :: stream
real(kind=rb), dimension(:, :), intent( out) :: numbers

! Local variables
integer(kind=im) :: i

do i = 1, size(numbers, 2)
call getRandomNumber_1D(stream, numbers(:, i))
end do
end subroutine getRandomNumber_2D

! mji
! ! ---------------------------------------------------------
! ! Constructing a unique seed from grid cell index and model date/time
! ! Once we have the GFDL stuff we'll add the year, month, day, hour, minute
! ! ---------------------------------------------------------
! function constructSeed(i, j, time) result(seed)
! integer(kind=im), intent( in) :: i, j
! type(time_type), intent( in) :: time
! integer(kind=im), dimension(8) :: seed
!
! ! Local variables
! integer(kind=im) :: year, month, day, hour, minute, second
!
!
! call get_date(time, year, month, day, hour, minute, second)
! seed = (/ i, j, year, month, day, hour, minute, second /)
! end function constructSeed

end module mcica_random_numbers
Loading