Skip to content
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

Feature/pnorris/#422 #443 rrtmg lw sw combo generator #492

Merged
Merged
Show file tree
Hide file tree
Changes from 95 commits
Commits
Show all changes
97 commits
Select commit Hold shift + click to select a range
367d46f
pmn: first compiled draft of subcol gen generalization and LW cleanup…
dr0cloud May 9, 2021
057b181
pmn: bug fix LW, cosmetic SW
dr0cloud May 10, 2021
8ad2c9c
pmn: bug fix and tidy; now seems to work
dr0cloud May 11, 2021
29cf296
Merge branch 'develop' into feature/pnorris/#422-abstract-cloud-gener…
dr0cloud May 11, 2021
82dcdf8
pmn: minor
dr0cloud May 12, 2021
ec80c14
pmn: SW subcol gen one icld only
dr0cloud May 12, 2021
47dff3d
pmn: various style and speed imporovements
dr0cloud May 14, 2021
38fb117
pmn: reordering for speedup
dr0cloud May 18, 2021
10f321f
pmn: minor changes for speed, readability
dr0cloud May 20, 2021
4d75c9e
pmn: cleanup, esp of laytrop
dr0cloud May 21, 2021
1ff8083
pmn: no gpoint intermediate accumulators, faster, cleaner, idrv -> dudTs
dr0cloud May 24, 2021
2237a68
pmn: compile time choice of OLRbands now from irradGC, plus minor spe…
dr0cloud May 25, 2021
4aea221
pmn: 1. improved and faster rtrnmc logic. 2. generalized OLRB/TBRB in…
dr0cloud May 29, 2021
ce78a2f
pmn: minor speed and safety improvements to cldgen cldprmc
dr0cloud Jun 9, 2021
0f58f50
pmn: cwpmin decision in cldgen, explicit binary clouds, and improved …
dr0cloud Jun 10, 2021
a0ef9cd
pmn: beginning of tidyup and speedup ... cosmetics
dr0cloud Jun 30, 2021
b181808
pmn: bugfix
dr0cloud Jun 30, 2021
ccd8dfb
pmn:cosmetics plus NRLSSI2 refactor
dr0cloud Jul 14, 2021
46e85d3
pmn: interim zero-diff
dr0cloud Jul 21, 2021
6b18f86
pmn: interim zero-diff mcica_sw tidy-up
dr0cloud Jul 22, 2021
ccbba22
pmn: interim 0-diff mcica_sw rework
dr0cloud Jul 22, 2021
4835a64
pmn: interim 0-diff of mcica_sw
dr0cloud Jul 23, 2021
c73fbea
pmn: remove GPU stuff and majot tidy of taumol ... verified zero-diff
dr0cloud Jul 30, 2021
63ca8f4
pmn: full LIN2 macro usage in taumol
dr0cloud Jul 30, 2021
d9be0b7
pmn: begin reordering paritioned vars albedos and general
dr0cloud Aug 2, 2021
020933e
pmn: aerosol opt props reorder
dr0cloud Aug 2, 2021
2ceb297
pmn: wkl and coldry reorder
dr0cloud Aug 3, 2021
76e3cb4
pmn: zm cld cilwp reil reorder
dr0cloud Aug 3, 2021
e224244
pmn: reorder cldfmcl and cilwpmcl and nlay not nlay plus one
dr0cloud Aug 3, 2021
b67426e
pmn: improved mcica ordering but maintain zero-diff
dr0cloud Aug 3, 2021
de9119b
pmn: improved cldprmc
dr0cloud Aug 4, 2021
cdc86b6
pmn: setcoef in prog jp jt jt1 resized
dr0cloud Aug 4, 2021
aece29b
pmn: colh2o etc and self for fac reorder
dr0cloud Aug 5, 2021
74955a0
pmn: zgco zomco start
dr0cloud Aug 5, 2021
2442bf5
pmn: ztdn local
dr0cloud Aug 6, 2021
f5f0c8c
pmn: ztdn reorder
dr0cloud Aug 6, 2021
bc05be8
pmn: vrtqdr bug fix (but was zero harm anyway ie zero-diff
dr0cloud Aug 6, 2021
4217f82
pmn: zdbt local and nlay only not nlay plus one
dr0cloud Aug 6, 2021
b9f5267
pmn: prup prupd local and zgco zomco no longer double use and reduced…
dr0cloud Aug 7, 2021
7285f77
pmn: make prdnd local and reorder - zero diff
dr0cloud Aug 8, 2021
a426933
pmn: zfd zfu zref ztra local to spc
dr0cloud Aug 10, 2021
6bfe9ff
pmn: ztauo ztaur ztaug ztdbt ssi zsflxzen
dr0cloud Aug 10, 2021
2521eae
pmn: reord zgco, zomco, ztauo, etc.
dr0cloud Aug 10, 2021
1c8660e
pmn: reord zdbt, ztdbt
dr0cloud Aug 10, 2021
1ee1829
pmn: reord zfu zfd zref ztra
dr0cloud Aug 10, 2021
1801919
pmn: reorder ssi sfluxzen taur taug
dr0cloud Aug 10, 2021
6c810e3
pmn: spc output reord size
dr0cloud Aug 11, 2021
1036f5e
pmn: spc etc
dr0cloud Aug 11, 2021
4a01618
pmn: spc small eqn change zero-diff
dr0cloud Aug 11, 2021
2070263
pmn: spc etc and zer-diff bug fix
dr0cloud Aug 11, 2021
39fc25f
pmn: start of cldymc and g as pow2 f not f times f
dr0cloud Aug 12, 2021
62a35ff
pmn: faster add of cld op props
dr0cloud Aug 12, 2021
36cbc02
pmn: continued cldymc speedup
dr0cloud Aug 12, 2021
d7f0a76
pmn: reftra with inout
dr0cloud Aug 12, 2021
dba5686
pmn: tidy up spc and begin drafty 2 of taumol
dr0cloud Aug 13, 2021
4b4aeed
pmn: taumol comments, loop sepn, and exit
dr0cloud Aug 15, 2021
0964d08
pmn: minor, tau17 exit
dr0cloud Aug 16, 2021
892a8e2
pmn: taumol19-21
dr0cloud Aug 17, 2021
2b5e79b
pmn: taumol22-24
dr0cloud Aug 18, 2021
73a6ab1
pmn: taumol25-29
dr0cloud Aug 18, 2021
fe6c292
pmn: taumol ssi simplify
dr0cloud Aug 18, 2021
b4951bb
pmn: taumol: out to inout
dr0cloud Aug 19, 2021
c3c544f
pmn: abbreviated wkl
dr0cloud Aug 19, 2021
4b5ae3d
pmn: wkl eliminated
dr0cloud Aug 20, 2021
09e4186
pmn: spc spectral sum reorder
dr0cloud Aug 20, 2021
6a4134b
pmn: od_lo back with comments
dr0cloud Aug 23, 2021
f689b04
pmn: remove heating rates, etc.
dr0cloud Aug 23, 2021
6bf08fa
pmn: non-zdiff KISS RNG same as LW but not yet seed
dr0cloud Aug 25, 2021
f02bed2
pmn: remove unnecessary McICA cloud props default init
dr0cloud Aug 26, 2021
60f2e08
pmn: no default McICA optical props
dr0cloud Aug 26, 2021
6920ac4
pmn: better setting of no-aerosol defaults
dr0cloud Aug 26, 2021
2dc9bf8
pmn: continuous gice rectification vis epsg and cldymc uses cldmin in…
dr0cloud Aug 26, 2021
ed10af0
pmn: reorder mcica non-zero-diff
dr0cloud Aug 31, 2021
6bdf2ed
pmn: cwp_tiny now input arg, remove uncessary init in mcica, etc. zer…
dr0cloud Aug 31, 2021
6b846da
pmn: join different ncol loops
dr0cloud Aug 31, 2021
9c3d218
pmn: clength, subcol join, etc.
dr0cloud Sep 1, 2021
3c60723
pmn: single seeding per subcol and ncol nsubcol loops for presence an…
dr0cloud Sep 1, 2021
40af600
pmn: now using local cloud_subcol_gen
dr0cloud Sep 1, 2021
572b934
pmn: streamlined cloud_subvcol_gen zero-diff
dr0cloud Sep 1, 2021
1f670bd
pmn: better comments and seed uses full positive i4
dr0cloud Sep 3, 2021
ebff5ca
pmn: generalize max seed to maximo+1
dr0cloud Sep 3, 2021
2eff42e
pmn: minor
dr0cloud Sep 3, 2021
a2aab1c
Merge branch 'feature/pnorris/#422-abstract-cloud-generator' into fea…
dr0cloud Sep 9, 2021
8f1cda3
Merge branch 'feature/pnorris/#443-tidy-and-speedup-RRTMG-SW' into fe…
dr0cloud Sep 9, 2021
64d350c
pmn: subcol_gen for LW and SW identical but separate
dr0cloud Sep 13, 2021
c1b01c9
pmn: combined subcol_gen and condensate_inhomo under radiationShared …
dr0cloud Sep 14, 2021
275d736
pmn: minor changes Cmakelist
dr0cloud Sep 14, 2021
3bdc0c7
pmn: minor, explanatory comment only
dr0cloud Sep 14, 2021
23cd659
added a comment saying that trial change of pseed from Pa to daPa did…
dr0cloud Nov 17, 2021
c9ce8d6
pmn: minor comment improvement
dr0cloud Nov 17, 2021
a147f9b
pmn: random tidy up while reviewing RRTMGP RNG
dr0cloud Nov 21, 2021
79215f0
pmn: add different seed_orders for RRTMG LW and SW PRNG generation
dr0cloud Nov 22, 2021
06139ab
pmn: add code to read correlation length params from resource
dr0cloud Nov 24, 2021
662b842
pmn: Move initialize_inhomogeneity to Radiation GC MAPL Initialize
dr0cloud Nov 24, 2021
3c5a0c0
Merge branch 'develop' into feature/pnorris/#422-#443-RRTMG-LW-SW-com…
mathomp4 Nov 29, 2021
9ac68fb
Add missing parentheses that matter to GNU
mathomp4 Nov 29, 2021
6ac17ae
Merge branch 'develop' into feature/pnorris/#422-#443-RRTMG-LW-SW-com…
sdrabenh Dec 17, 2021
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
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,12 @@ end subroutine SetServices

subroutine Initialize ( GC, IMPORT, EXPORT, CLOCK, RC )

! !USES:
use cloud_condensate_inhomogeneity, only: initialize_inhomogeneity
use cloud_subcol_gen, only : initialize_cloud_subcol_gen, &
def_aam1, def_aam2, def_aam30, def_aam4, &
def_ram1, def_ram2, def_ram30, def_ram4

! !ARGUMENTS:

type(ESMF_GridComp), intent(inout) :: GC ! Gridded component
Expand All @@ -484,52 +490,75 @@ subroutine Initialize ( GC, IMPORT, EXPORT, CLOCK, RC )

! Local derived type aliases

type (MAPL_MetaComp), pointer :: MAPL
type (ESMF_State), pointer :: GIM(:)

type (ESMF_Config) :: CF
type (MAPL_MetaComp), pointer :: MAPL
! type (ESMF_State), pointer :: GIM(:)
! type (ESMF_Config) :: CF

!=============================================================================
! Correlation length parameters from resource file

! Begin...
real :: aam1, aam2, aam30, aam4
real :: ram1, ram2, ram30, ram4

!=============================================================================

! Get the target components name and set-up traceback handle.
! -----------------------------------------------------------

Iam = "Initialize"
call ESMF_GridCompGet( GC, NAME=COMP_NAME, CONFIG=CF, RC=STATUS )
VERIFY_(STATUS)
call ESMF_GridCompGet (GC, NAME=COMP_NAME, __RC__) ! CONFIG=CF, __RC__)
Iam = trim(COMP_NAME) // trim(Iam)

! Generic initialize
!-------------------

call MAPL_GenericInitialize ( GC, IMPORT, EXPORT, CLOCK, RC=STATUS )
VERIFY_(STATUS)
call MAPL_GenericInitialize (GC, IMPORT, EXPORT, CLOCK, __RC__)

! Get my MAPL object
!-------------------

call MAPL_GetObjectFromGC ( GC, MAPL, RC=STATUS )
VERIFY_(STATUS)
call MAPL_GetObjectFromGC (GC, MAPL, __RC__)

! Start Total timer after generic initialize
!-------------------------------------------

call MAPL_TimerOn(MAPL,"TOTAL")
call MAPL_TimerOn (MAPL,"TOTAL")

! Get parameters from MAPL
!-------------------------

call MAPL_Get ( MAPL, GIM=GIM, RC=STATUS )
VERIFY_(STATUS)
! call MAPL_Get (MAPL, GIM=GIM, __RC__)

! Initialize module-level cloud generator details.
! Currently these are only used by RRTMG SW and LW, so should probably
! make conditional on either RRTMG SW and LW being used. Dont bother
! for now. Also, may later use the cloud generator for RRTMGP as well.
!---------------------------------------------------------------------

! Set up RRTMG condensate inhomogeneity tables

call initialize_inhomogeneity(1)

! Set RRTMG cloud subcolumn generator correlation length parameters to non-default values
! from MAPL resource parameters. Comment out to just use defaults in module cloud_subcol_gen.

call MAPL_GetResource(MAPL,aam1 ,LABEL="ADL_AM1:" ,default=def_aam1 ,__RC__)
call MAPL_GetResource(MAPL,aam2 ,LABEL="ADL_AM2:" ,default=def_aam2 ,__RC__)
call MAPL_GetResource(MAPL,aam30,LABEL="ADL_AM30:",default=def_aam30,__RC__)
call MAPL_GetResource(MAPL,aam4 ,LABEL="ADL_AM4:" ,default=def_aam4 ,__RC__)
call MAPL_GetResource(MAPL,ram1 ,LABEL="RDL_AM1:" ,default=def_ram1 ,__RC__)
call MAPL_GetResource(MAPL,ram2 ,LABEL="RDL_AM2:" ,default=def_ram2 ,__RC__)
call MAPL_GetResource(MAPL,ram30,LABEL="RDL_AM30:",default=def_ram30,__RC__)
call MAPL_GetResource(MAPL,ram4 ,LABEL="RDL_AM4:" ,default=def_ram4 ,__RC__)
call initialize_cloud_subcol_gen( &
adl_am1=aam1, adl_am2=aam2, adl_am30=aam30, adl_am4=aam4, &
rdl_am1=ram1, rdl_am2=ram2, rdl_am30=ram30, rdl_am4=ram4)

! All done
!---------

call MAPL_TimerOff(MAPL,"TOTAL")
call MAPL_TimerOff (MAPL,"TOTAL")
RETURN_(ESMF_SUCCESS)

RETURN_(ESMF_SUCCESS)
end subroutine Initialize

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ esma_set_this ()
set (srcs
radconstants.F90
gettau.F90
cloud_condensate_inhomogeneity.F90
cloud_subcol_gen.F90
)

esma_add_library (${this}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,128 @@
module tab_xcw
module cloud_condensate_inhomogeneity

implicit none
save
use iso_fortran_env, only : error_unit

integer, parameter :: N1 = 1000
integer, parameter :: N2 = 140
real, dimension(N1,N2) :: XCW
implicit none

contains
! state is saved outside of scope
save

! all fields and methods hidden unless declared public below
private

! lookup table dimensions
integer, parameter :: n1 = 1000
integer, parameter :: n2 = 140

! inhomogeneity type and table
integer :: inhm = 0
real, allocatable :: xcw(:,:)

! initialization status
logical :: initialized = .false.

! public interface
public :: inhomogeneity_initialized ! check if initialized
public :: initialize_inhomogeneity ! get resources
public :: release_inhomogeneity ! release resources
public :: condensate_inhomogeneous ! test if inhomogeneous or not
public :: zcw_lookup ! lookup zcw if inhomogeneous

contains

logical function inhomogeneity_initialized()
inhomogeneity_initialized = initialized
end function inhomogeneity_initialized

subroutine initialize_inhomogeneity (ih)

! ih == 0: homogeneous
! ih == 1: inhomogeneous, beta distribution
! ih == 2: inhomogeneous, gamma distribution

integer, intent(in) :: ih

if (initialized) then
write(error_unit,*) 'file:', __FILE__, ', line:', __LINE__
error stop 'must release_inhomogeneity first'
end if

if (ih == 1) then
call tabulate_xcw_beta
elseif (ih == 2) then
call tabulate_xcw_gamma
elseif (ih /= 0) then
write(error_unit,*) 'file:', __FILE__, ', line:', __LINE__
write(error_unit,*) 'ih == ', ih
error stop 'unknown inhomogeneity type: ih'
endif

initialized = .true.
inhm = ih

end subroutine initialize_inhomogeneity

subroutine release_inhomogeneity
if (allocated(xcw)) deallocate(xcw)
initialized = .false.
inhm = 0
end subroutine release_inhomogeneity

function condensate_inhomogeneous result (inhomo)
logical :: inhomo
if (.not. initialized) then
write(error_unit,*) 'file:', __FILE__, ', line:', __LINE__
error stop 'must initialize_inhomogeneity first'
end if
inhomo = (inhm > 0)
end function condensate_inhomogeneous

! -----------------------------------------------------------
function zcw_lookup (cdf, sigma_qcw) result (zcw)
! -----------------------------------------------------------
! Horizontally inhomogeneous cloud condensate:
! Determine ZCW = ratio of cloud condensate mixing ratio QC
! to its mean value for all cloudy cells in this layer.
! -----------------------------------------------------------

real, intent(in) :: cdf ! condensate cumulative prob in [0,1]
real, intent(in) :: sigma_qcw ! relative std deviation
real :: zcw

integer :: ind1, ind2
real :: rind1, rind2

if (.not. condensate_inhomogeneous()) then
write(error_unit,*) 'file:', __FILE__, ', line:', __LINE__
error stop 'zcw_lookup only works if condensate_inhomogeneous()'
end if

! bilinear interpolation of ZCW tabulated in array XCW as a func of
! * cumulative condensate probability CDF
! * relative standard deviation SIGMA_QCW
! Take care that the definition of RIND2 is consistent with
! subroutines TABULATE_XCW

rind1 = cdf * (n1 - 1) + 1.
ind1 = max(1, min(int(rind1), n1-1))
rind1 = rind1 - ind1
rind2 = 40. * sigma_qcw - 3.
ind2 = max(1, min(int(rind2), n2-1))
rind2 = rind2 - ind2

zcw = (1.0-rind1) * (1.0-rind2) * xcw(ind1,ind2) &
+ (1.0-rind1) * rind2 * xcw(ind1,ind2+1) &
+ rind1 * (1.0-rind2) * xcw(ind1+1,ind2) &
+ rind1 * rind2 * xcw(ind1+1,ind2+1)

end function zcw_lookup


subroutine tabulate_xcw_beta

if (allocated(xcw)) deallocate(xcw)
allocate (xcw(n1,n2))

subroutine tabulate_xcw_beta
xcw(:, 1) = (/&
0.1000E-04, 0.7137E+00, 0.7315E+00, 0.7426E+00,&
0.7508E+00, 0.7573E+00, 0.7628E+00, 0.7676E+00,&
Expand Down Expand Up @@ -35151,9 +35264,13 @@ subroutine tabulate_xcw_beta
0.1997E+02, 0.2108E+02, 0.2238E+02, 0.2394E+02,&
0.0000E+00, 0.0000E+00, 0.0000E+00, 0.0000E+00/)

end subroutine tabulate_xcw_beta
end subroutine tabulate_xcw_beta

subroutine tabulate_xcw_gamma

if (allocated(xcw)) deallocate(xcw)
allocate (xcw(n1,n2))

subroutine tabulate_xcw_gamma
xcw(:, 1) = (/&
0.1000E-04, 0.7192E+00, 0.7364E+00, 0.7470E+00,&
0.7549E+00, 0.7612E+00, 0.7665E+00, 0.7711E+00,&
Expand Down Expand Up @@ -70295,6 +70412,6 @@ subroutine tabulate_xcw_gamma
0.2105E+02, 0.2245E+02, 0.2414E+02, 0.2624E+02,&
0.0000E+00, 0.0000E+00, 0.0000E+00, 0.0000E+00/)

end subroutine tabulate_xcw_gamma
end subroutine tabulate_xcw_gamma

end module tab_xcw
end module cloud_condensate_inhomogeneity
Loading