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

RRTMGP in CCPP #400

Closed
wants to merge 190 commits into from
Closed
Show file tree
Hide file tree
Changes from 187 commits
Commits
Show all changes
190 commits
Select commit Hold shift + click to select a range
8240092
Ported RRTMGP development from release repo. LW is working.
dustinswales Mar 21, 2019
80e70c1
Added diffusivity angle correction to optical-depths.
dustinswales Mar 22, 2019
9414a90
Added ability to provide cloudy profile to radiation (RRTMG and RRTMGP).
dustinswales Apr 16, 2019
78ab01e
Added SW clear-sky calculation.
dustinswales Apr 16, 2019
b4510ef
Added SW clear-sky calculation.
dustinswales Apr 16, 2019
5ddf44d
SW all-sky calculation working. Microphysics needs some attention.
dustinswales Apr 18, 2019
67c2e26
Working./gmtb_scm twpice_control_RRTMGP_cloud
dustinswales Apr 24, 2019
3c861b0
LW RRTMGP cloud-optics working. Also, RRTMGP cloud sampling has been …
dustinswales Apr 29, 2019
e92cd8c
Housekeeping in LW. Remove diffusivity angle adjustment, Added RRTMG …
dustinswales Apr 30, 2019
cf6bd66
Revised LW flux calculation.
dustinswales May 1, 2019
c089f10
Same stuff as previous commit, but for SW.
dustinswales May 1, 2019
d14dba3
Fixd bug left in from last commit
dustinswales May 1, 2019
6c55b93
Fixed allocation for RRTMGP aerosol/cloudy optical property DDT. Adju…
dustinswales May 2, 2019
8bbbd5b
Cleaned up RRTGMP_pre a bit. Modified all calculations to use Pa inst…
dustinswales May 2, 2019
33e087f
Cleaned up, added detailed comments, vectorized loops.
dustinswales May 2, 2019
6557c76
Moved RRTMGP code to suite-level.
dustinswales May 7, 2019
0a40aaa
Moved to using extension/mo_rrtmgp_clr_all_sky.F90 routines to comput…
dustinswales May 7, 2019
81f256d
Add rte-rrtmgp DDTs to CCPP
dustinswales May 8, 2019
232545f
Added _type to all instances of ty_gas_optics_rrtmgp
dustinswales May 8, 2019
25b2372
Added metadata tables to DDT definitions.
dustinswales May 9, 2019
e0ca272
Added metadata tables for DDTs. In CCPP/physics, started seperating p…
dustinswales May 10, 2019
3beeb50
Changes for RRTMGP DDTs to be used in CCPP.
dustinswales May 13, 2019
f99255d
Commit for Robert to view.
dustinswales May 16, 2019
9157959
Move computation of RRTMGP cloud optics to suite level, only for LW.
dustinswales May 16, 2019
a60e1e1
RRTMGP DDTs working!
dustinswales May 21, 2019
129b829
In progress...
dustinswales May 28, 2019
1386e58
More organizational changes to RRTMGP.
dustinswales May 29, 2019
f5dc37a
Remover extra-layer from GFS_rrtmgp_pre_run().
dustinswales May 30, 2019
ef4ed60
Moved microphysics from GFS_rrtmgp_pre_run() into its own routine, cl…
dustinswales May 31, 2019
57be551
Added new GFS_rrtmgp_XX_post.F90 for both SW and LW.
dustinswales May 31, 2019
4e0cfc8
Added back option to call RRTMG cloud_optics().
dustinswales May 31, 2019
f86636b
Split up init into gas and cloud _init routines. Renamed some variabl…
dustinswales Jun 3, 2019
a4bdffe
Major reorganization. Added schemes for cloud-optics and gas optics. …
dustinswales Jun 5, 2019
6e2c8bd
Some cleaning up since last commit.
dustinswales Jun 6, 2019
893ce88
Some housekeeping.
dustinswales Jun 6, 2019
52cb3a0
Fixed potential issue in Thompson MP scheme. Cleaned up a tad.
dustinswales Jun 7, 2019
b882dff
Added gas_optics_sw_run() and gas_optics_lw_run() routines.
dustinswales Jun 10, 2019
044c880
Renamed two modules.
dustinswales Jun 11, 2019
c9a357a
Added calls to compute_bc() in LW and SW gas_optics. Small bug found …
dustinswales Jun 12, 2019
9e5405c
Fixed indexing error for output fluxes.
dustinswales Jun 13, 2019
c445658
Fixed a few bugs, some housekeeping.
dustinswales Jun 20, 2019
0a100cb
Synced w/ master/
dustinswales Jun 20, 2019
206a950
Added piece for GFDL MP. Not curretnly exercised.
dustinswales Jun 24, 2019
fa05574
Added rte-rrtmgp repository.
dustinswales Jun 26, 2019
f7915b9
Synced with NCAR repo.
dustinswales Jun 27, 2019
7f8fc0b
Correction to MPI calls.
dustinswales Jul 1, 2019
5ebe4c0
Synced w/ NCAR/ccpp-physics:master
dustinswales Jul 1, 2019
77bfcc2
Merge pull request #1 from NCAR/master
dustinswales Sep 19, 2019
fa9b30e
Merge branch 'master' into rrtmgp-dev
dustinswales Sep 19, 2019
d6946ed
Updated rrtmgp external
dustinswales Sep 19, 2019
2ead727
Update .gitignore
dustinswales Sep 19, 2019
c668a6a
Modified arg_tables. Added .meta files
dustinswales Sep 23, 2019
f5562ee
Fixed some bugs in argument tables.
dustinswales Sep 24, 2019
4b61376
Getting closer...
dustinswales Sep 24, 2019
5cb9f93
change RRTMGP scheme metadata to use instances of DDTs rather than th…
grantfirl Sep 24, 2019
e35f1b9
Merge pull request #5 from grantfirl/ticket_2050
dustinswales Sep 25, 2019
34d5fe1
Working
dustinswales Sep 26, 2019
3958a87
Changes were made to use RRTMGP for SW calculation, and RRTMG for the…
dustinswales Oct 7, 2019
4520c5d
Merge branch 'rrtmgp-dev' of https://github.com/dustinswales/ccpp-phy…
dustinswales Oct 8, 2019
9d6b208
Merge pull request #6 from NCAR/master
dustinswales Oct 9, 2019
87d19cf
Merge pull request #7 from dustinswales/master
dustinswales Oct 9, 2019
209b572
Merge pull request #8 from NCAR/gmtb/develop
dustinswales Oct 9, 2019
eba4af6
Added RRTMGP as submodule
dustinswales Oct 9, 2019
ac30064
updated .gitmodules
dustinswales Oct 9, 2019
0b79698
Switched rte-rrtmgp submodule bracnh
dustinswales Oct 9, 2019
8bb1e85
Synced w/ upstream gmtb/develop
dustinswales Oct 15, 2019
816ba3f
Fixed a bug
dustinswales Oct 16, 2019
04bdd4f
Modified calls to radiaiton routines.
dustinswales Oct 17, 2019
2f23b93
Remove deprecated code
dustinswales Oct 17, 2019
6126278
Fixed typo in MPI_BCAST() calls
dustinswales Oct 25, 2019
f35effe
Some more changes in MPI commands within initialization
dustinswales Oct 25, 2019
1f57f68
Merge branch 'gmtb/develop' of https://github.com/NCAR/ccpp-physics i…
dustinswales Oct 28, 2019
fe6c9ae
Moved RRTMGP active gases from GFS_radtend_type to GFS_control_type.
dustinswales Oct 29, 2019
b6cc944
Merge branch 'rrtmgp-dev' of https://github.com/dustinswales/ccpp-phy…
dustinswales Nov 1, 2019
78a8ed2
Made some changes. Moved fields into Interstitial type. Results still…
dustinswales Nov 4, 2019
b7aa280
Merge branch 'rrtmgp-dev' of https://github.com/dustinswales/ccpp-phy…
dustinswales Nov 5, 2019
69bf621
Merge remote branch 'grant-fork/cires_ugwp_namelist_fix' into rrtmgp-dev
dustinswales Nov 5, 2019
54e0066
Added solar constant adjustment factor to incident SW TOA flux. GP SW…
dustinswales Nov 7, 2019
50b82a5
Delta-scaling added to SW calculation.
dustinswales Nov 20, 2019
d2799f4
Merge branch 'dtc/develop' of https://github.com/NCAR/ccpp-physics in…
dustinswales Nov 20, 2019
0f796d9
Merge branch 'master' of https://github.com/NCAR/ccpp-physics into rr…
dustinswales Nov 20, 2019
2752142
Cleaned up a tad. Added some diagnostics for debuggind in SCM.
dustinswales Dec 3, 2019
c62f631
Merge branch 'rrtmgp-dev' of https://github.com/dustinswales/ccpp-phy…
dustinswales Dec 3, 2019
10191cd
Merge branch 'dtc/develop' of https://github.com/NCAR/ccpp-physics in…
dustinswales Dec 3, 2019
993508d
Merge pull request #9 from dustinswales/rrtmgp-dev
dustinswales Dec 4, 2019
71b6a37
Change to diagnostic outputs for RRTMGP.
dustinswales Dec 4, 2019
e905e96
Add loop over solar scaling
dustinswales Dec 5, 2019
e93fc1b
Some housekeeping
dustinswales Dec 5, 2019
26cc6b1
Cleaned up daytime masking in SW calculation
dustinswales Dec 6, 2019
f471f79
Added some print statements to diagnose MPI init.
dustinswales Dec 9, 2019
1bc898d
Added some print statements to diagnose MPI init.
dustinswales Dec 9, 2019
fbd398f
Added ifdef(mpi) around declaration in initialization routines.
dustinswales Dec 9, 2019
e858d73
Add mpi_barrier() calls to SW gas optics initialization routine
dustinswales Dec 9, 2019
7209345
Add mpi_barrier() calls to all initialization routines
dustinswales Dec 9, 2019
a25d714
Changed MPI_BCAST() for character arrays.
dustinswales Dec 9, 2019
0a726fd
Try using string length provided in file for broadcsting strings.
dustinswales Dec 9, 2019
229ca59
Revert to original mpi_bcast for character arrays.
dustinswales Dec 9, 2019
25974eb
Cleaned up, added some diagnostics to test MPI in UFS.
dustinswales Dec 10, 2019
782ecb0
Reverted broadcast call for scalars
dustinswales Dec 10, 2019
dcb8e46
Add print statements, check LW optical-depth on all processors.
dustinswales Dec 10, 2019
92817d2
Removed mpi calls in lw gas optics. Test reading in data on all proce…
dustinswales Dec 10, 2019
a59b898
Added some print statements
dustinswales Dec 10, 2019
6cdd545
Try calling mpi_barrier just before gas_optics%load
dustinswales Dec 10, 2019
b16c6c7
Removed MPI calls.
dustinswales Dec 11, 2019
ac6d7a5
Moved some interstitial firelds out of GFS_interstitial_type into fla…
dustinswales Dec 11, 2019
ddebe45
Alebdos (nIR and uvvis) are being averaged in rrtmg, did same in rrtm…
dustinswales Dec 11, 2019
9bd2dbb
Express layer-thinkness in meters?
dustinswales Dec 11, 2019
9a47ad3
Added aerosol and cloud-sampling schemes.
dustinswales Dec 12, 2019
def30ce
Started removing GFS DDTs from RRTMGP scheme.
dustinswales Dec 13, 2019
1943d14
Removed all instances of GFS derived data types from rrtmgp scheme le…
dustinswales Dec 13, 2019
9ec9667
Turned MPI on for rrtmgp gas-optics
dustinswales Dec 13, 2019
0ea0a12
Turned MPI on for rrtmgp gas-optics, omission from last commit.
dustinswales Dec 13, 2019
8c46c34
Some more cleanup and documenting. Added initialization routine for c…
dustinswales Dec 13, 2019
86a2482
Fixed MPI calls in lw cloud optics.
dustinswales Dec 16, 2019
4dcb001
Removed MPI for testing in UFS.
dustinswales Dec 16, 2019
122a750
Delta-scale SW before incrementing aerosol optics.
dustinswales Dec 16, 2019
8c5ead8
Revert "Removed MPI for testing in UFS."
dustinswales Dec 16, 2019
81abe37
Revert "Revert "Removed MPI for testing in UFS.""
dustinswales Dec 16, 2019
e105f48
Revert "Delta-scale SW before incrementing aerosol optics."
dustinswales Dec 16, 2019
1526e7d
Treat surface albedo exactly as in RRTMG. For SW bands 1-9, use nIR; …
dustinswales Dec 16, 2019
e30305d
Fixed error in .meta file.
dustinswales Dec 16, 2019
5b02c9e
Round cloud-fractions to avoid McICA sampling error.
dustinswales Dec 17, 2019
4d3515d
Round cloud-fractions to avoid McICA sampling error. In RRTMG as well.
dustinswales Dec 17, 2019
b2d42f3
Fix rounding error in G cloud-sampling test. Add diagnostics for clou…
dustinswales Dec 19, 2019
28bea10
Removed diagnostic cloud outputs.
dustinswales Dec 19, 2019
edcb672
Added diffusivity angle adjustment to LW.
dustinswales Dec 31, 2019
2e161eb
Moved GFS_rrtmgp_lw_pre.F90 to rrtmgp_lw_pre.F90
dustinswales Dec 31, 2019
a564c8b
Moved aggregation into conditional loop. LW only.
dustinswales Jan 2, 2020
323e6f9
Added number_of_gaussian angles to LW calculation.
dustinswales Jan 3, 2020
ec093b2
Reverted some recent changes.
dustinswales Jan 3, 2020
5542aca
Added diagnostics for LW clouds.
dustinswales Jan 6, 2020
04ad9ed
Added longitude/latitude to output stream. Needed to sort through MPI…
dustinswales Jan 6, 2020
b679203
Fixed error in previous commit.
dustinswales Jan 6, 2020
203cd4a
Needed to add MPI commands to open diagnostic output file.
dustinswales Jan 7, 2020
5812151
Added some more diagnostics.
dustinswales Jan 7, 2020
6c8ecdd
Try overwriting cloud optical depth in bands1-2.
dustinswales Jan 13, 2020
64691a6
Added by-band lw fluxes to diagnostic output. New namelist parameter …
dustinswales Jan 14, 2020
320907f
Bug fix.
dustinswales Jan 21, 2020
dd9d5ce
Removed diagnostic print statements.
dustinswales Jan 21, 2020
0992def
Some changes to MPI calls in inti() routines.
dustinswales Jan 27, 2020
6e0c346
Some changes to MPI calls in inti() routines. Again...
dustinswales Jan 27, 2020
fbb009f
Some changes to MPI calls in inti() routines. Again and again...
dustinswales Jan 27, 2020
c0aab42
Some changes to MPI calls in inti() routines. New grouping.
dustinswales Jan 27, 2020
01725b4
Omission from previous commit.
dustinswales Jan 27, 2020
28243f1
Remove bcast condition on precision.
dustinswales Jan 27, 2020
bb03ad3
Omission from previous commit.
dustinswales Jan 27, 2020
f38ef59
Some changes to MPI calls in inti() routines.
dustinswales Jan 27, 2020
f6c4e82
Modification to LW gas optics init().
dustinswales Jan 28, 2020
c5ce144
Modification to LW gas optics init(). Add mpi_barrier
dustinswales Jan 28, 2020
28269a9
Modification to LW gas optics init(). One more time.
dustinswales Jan 28, 2020
d42469b
Change data type to double-precision.
dustinswales Jan 28, 2020
e40e0f5
Added some diagnostic print statements.
dustinswales Jan 28, 2020
af24b71
Added some diagnostic print statements. Remvoe barrier commands.
dustinswales Jan 28, 2020
ab612f4
More diagnostic print statements.
dustinswales Jan 28, 2020
09b3c3b
Added print statements to Thompson init routines.
dustinswales Jan 28, 2020
3e79d02
Move allocation statements.
dustinswales Jan 30, 2020
33158c7
Added mpi barrier. communicator working, i think.
dustinswales Jan 30, 2020
be43ed8
Added a second mpi barrier.
dustinswales Jan 30, 2020
e7c6c8e
Try different broadcast call for character arrays.
dustinswales Jan 30, 2020
d351789
Move allocation statement into master processor only.
dustinswales Jan 30, 2020
3dfb4c9
Cleaned up _init routines.
dustinswales Feb 10, 2020
b67bc2d
Removed mpi calls during initialization. Reading data ona ll processo…
dustinswales Feb 10, 2020
3491dcd
Switched to rte-rrtmgp dtc/branch.
dustinswales Feb 11, 2020
c1cec11
Switched to rte-rrtmgp dtc/branch.
dustinswales Feb 11, 2020
3aa8cd4
Updated submodule
dustinswales Feb 11, 2020
30b5237
Updated submodule
dustinswales Feb 11, 2020
75c479d
Updated interface to rte-rrtmgp routines.
dustinswales Feb 11, 2020
c2eb222
Merge branch 'rrtmgp-dev2' of https://github.com/dustinswales/ccpp-ph…
dustinswales Feb 11, 2020
8d42056
Merge branch 'master' of https://github.com/NCAR/ccpp-physics into rr…
dustinswales Feb 12, 2020
6473891
Reverted some local changes.
dustinswales Feb 12, 2020
b1e111f
Reverted recent change.
dustinswales Feb 12, 2020
54a38d9
Removed cloud-fraction rounding. Was using for debugging purposes.
dustinswales Feb 12, 2020
9c682fc
Merge branch 'rrtmgp-dev2' of https://github.com/dustinswales/ccpp-ph…
dustinswales Feb 12, 2020
c984e90
Cleaned up a tad.
dustinswales Feb 14, 2020
596229b
Merge branch 'rrtmgp-dev2' of https://github.com/dustinswales/ccpp-ph…
dustinswales Feb 14, 2020
c1bf1ae
Try using 1D hprime
dustinswales Feb 18, 2020
723f740
Merge branch 'rrtmgp-dev2' of https://github.com/dustinswales/ccpp-ph…
dustinswales Feb 18, 2020
c47706b
changed variable name.
dustinswales Feb 18, 2020
c5ba6f9
Remove using gas switches.
dustinswales Feb 18, 2020
a3cd7db
Remove using gas switches.
dustinswales Feb 18, 2020
6d55230
Chnaged intent of lw_cloud_optical_props
dustinswales Feb 18, 2020
12acbb0
Merge branch 'rrtmgp-dev2' of https://github.com/dustinswales/ccpp-ph…
dustinswales Feb 18, 2020
ab6c12e
Switch back hprime to hprime(:,1)
dustinswales Feb 18, 2020
b57ebfd
Revert earleir change.
dustinswales Feb 18, 2020
1d92cfa
Reverted changes to GFS_rrtmgp_sw_pre.F90
dustinswales Feb 18, 2020
e201f08
Cleaned up rrtmgp_lw_pre.F90
dustinswales Feb 19, 2020
244d3ef
Reverted some changes.
dustinswales Feb 19, 2020
0e954b7
Removed my login credential from .gitmodules.
dustinswales Feb 19, 2020
93ae6cb
Removed deprecated files.
dustinswales Feb 19, 2020
75fdb61
Reverted some changes
dustinswales Feb 19, 2020
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
2 changes: 0 additions & 2 deletions .gitignore

This file was deleted.

4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[submodule "physics/rte-rrtmgp"]
climbfuji marked this conversation as resolved.
Show resolved Hide resolved
path = physics/rte-rrtmgp
url = https://[email protected]/RobertPincus/rte-rrtmgp
branch = dtc/ccpp
4 changes: 3 additions & 1 deletion physics/GFS_rrtmg_pre.F90
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,8 @@ subroutine GFS_rrtmg_pre_run (Model, Grid, Sfcprop, Statein, & ! input
rhly, tvly,qstl, vvel, clw, ciw, prslk1, tem2da, &
cldcov, deltaq, cnvc, cnvw, &
effrl, effri, effrr, effrs
real (kind=kind_phys) :: clwmin, clwm, clwt, onemrh, value, tem1, tem2, tem3
real (kind=kind_phys), parameter :: xrc3 = 100.

real(kind=kind_phys), dimension(size(Grid%xlon,1),Model%levr+LTP+1) :: tem2db
! real(kind=kind_phys), dimension(size(Grid%xlon,1),Model%levr+LTP+1) :: hz
Expand Down Expand Up @@ -688,7 +690,7 @@ subroutine GFS_rrtmg_pre_run (Model, Grid, Sfcprop, Statein, & ! input
effrs(i,lyb) = effrs(i,lya)
enddo
endif
endif
endif
climbfuji marked this conversation as resolved.
Show resolved Hide resolved

if (Model%imp_physics == 99) then
ccnd(1:IM,1:LMK,1) = ccnd(1:IM,1:LMK,1) + cnvw(1:IM,1:LMK)
Expand Down
70 changes: 70 additions & 0 deletions physics/GFS_rrtmgp_gas_optics.F90
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
module GFS_rrtmgp_gas_optics
use machine, only: kind_phys
use GFS_typedefs, only: GFS_control_type,GFS_radtend_type

public GFS_rrtmgp_gas_optics_init,GFS_rrtmgp_gas_optics_run,GFS_rrtmgp_gas_optics_finalize
contains

! #########################################################################################
! SUBROUTINE GFS_rrtmgp_gas_optics_init()
! #########################################################################################
!! \section arg_table_GFS_rrtmgp_gas_optics_init
!! \htmlinclude GFS_rrtmgp_gas_optics.html
!!
subroutine GFS_rrtmgp_gas_optics_init(Model, Radtend, errmsg, errflg)
! Inputs
type(GFS_control_type), intent(in) :: &
Model ! DDT containing model control parameters
type(GFS_radtend_type), intent(inout) :: &
Radtend ! Fortran DDT containing FV3-GFS radiation tendencies
! Outputs
character(len=*), intent(out) :: &
errmsg ! Error message
integer, intent(out) :: &
errflg ! Error flag

! Local variables
character(len=1) :: tempstr
integer :: ij, count
integer,dimension(Model%ngases,2) :: gasIndices

! Initialize
errmsg = ''
errflg = 0

! Which gases are active? Provided via physics namelist.
if (len(Model%active_gases) .gt. 0) then

! Pull out gas names from list...
! First grab indices in character array corresponding to start:end of gas name.
gasIndices(1,1)=1
count=1
do ij=1,len(Model%active_gases)
tempstr=trim(Model%active_gases(ij:ij))
if (tempstr .eq. '_') then
gasIndices(count,2)=ij-1
gasIndices(count+1,1)=ij+1
count=count+1
endif
enddo
gasIndices(Model%ngases,2)=len(trim(Model%active_gases))
! Now extract the gas names
do ij=1,Model%ngases
Radtend%active_gases(ij) = Model%active_gases(gasIndices(ij,1):gasIndices(ij,2))
enddo
endif
end subroutine GFS_rrtmgp_gas_optics_init

! #########################################################################################
! SUBROUTINE GFS_rrtmgp_gas_optics_run
! #########################################################################################
subroutine GFS_rrtmgp_gas_optics_run()
end subroutine GFS_rrtmgp_gas_optics_run

! #########################################################################################
! SUBROUTINE GFS_rrtmgp_gas_optics_finalize
! #########################################################################################
subroutine GFS_rrtmgp_gas_optics_finalize()
end subroutine GFS_rrtmgp_gas_optics_finalize

end module GFS_rrtmgp_gas_optics
46 changes: 46 additions & 0 deletions physics/GFS_rrtmgp_gas_optics.meta
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
[ccpp-arg-table]
name = GFS_rrtmgp_gas_optics_init
type = scheme
[Model]
climbfuji marked this conversation as resolved.
Show resolved Hide resolved
standard_name = GFS_control_type_instance
long_name = instance of derived type GFS_control_type
units = DDT
dimensions = ()
type = GFS_control_type
intent = in
optional = F
[Radtend]
standard_name = GFS_radtend_type_instance
long_name = instance of derived type GFS_radtend_type
units = DDT
dimensions = ()
type = GFS_radtend_type
intent = inout
optional = F
[errmsg]
standard_name = ccpp_error_message
long_name = error message for error handling in CCPP
units = none
dimensions = ()
type = character
kind = len=*
intent = out
optional = F
[errflg]
standard_name = ccpp_error_flag
long_name = error flag for error handling in CCPP
units = flag
dimensions = ()
type = integer
intent = out
optional = F

########################################################################
[ccpp-arg-table]
name = GFS_rrtmgp_gas_optics_run
type = scheme

########################################################################
[ccpp-arg-table]
name = GFS_rrtmgp_gas_optics_finalize
type = scheme
235 changes: 235 additions & 0 deletions physics/GFS_rrtmgp_lw_post.F90
Original file line number Diff line number Diff line change
@@ -0,0 +1,235 @@
module GFS_rrtmgp_lw_post
use machine, only: kind_phys
use GFS_typedefs, only: GFS_coupling_type, &
GFS_control_type, &
GFS_grid_type, &
GFS_radtend_type, &
GFS_statein_type, &
GFS_diag_type
use module_radiation_aerosols, only: NSPC1
use module_radlw_parameters, only: topflw_type, sfcflw_type, proflw_type
! RRTMGP DDT's
use mo_gas_optics_rrtmgp, only: ty_gas_optics_rrtmgp
use mo_fluxes_byband, only: ty_fluxes_byband
use mo_heating_rates, only: compute_heating_rate
use rrtmgp_aux, only: check_error_msg
implicit none

public GFS_rrtmgp_lw_post_init,GFS_rrtmgp_lw_post_run,GFS_rrtmgp_lw_post_finalize

contains
! #########################################################################################
! SUBROUTINE GFS_rrtmgp_lw_post_init
! #########################################################################################
subroutine GFS_rrtmgp_lw_post_init()
end subroutine GFS_rrtmgp_lw_post_init

! #########################################################################################
! SUBROUTINE GFS_rrtmgp_lw_post_run
! #########################################################################################
!> \section arg_table_GFS_rrtmgp_lw_post_run
!! \htmlinclude GFS_rrtmgp_lw_post.html
!!
subroutine GFS_rrtmgp_lw_post_run (Model, Grid, Radtend, Coupling, Diag, Statein, im, &
p_lev, tsfa, fluxlwUP_allsky, fluxlwDOWN_allsky, fluxlwUP_clrsky, fluxlwDOWN_clrsky,&
raddt, aerodp, cldsa, mtopa, mbota, cld_frac, cldtaulw, &
flxprf_lw, hlw0, errmsg, errflg)

! Inputs
type(GFS_control_type), intent(in) :: &
Model ! Fortran DDT: FV3-GFS model control parameters
type(GFS_grid_type), intent(in) :: &
Grid ! Fortran DDT: FV3-GFS grid and interpolation related data
type(GFS_statein_type), intent(in) :: &
Statein ! Fortran DDT: FV3-GFS prognostic state data in from dycore
integer, intent(in) :: &
im ! Horizontal loop extent
real(kind_phys), dimension(size(Grid%xlon,1)), intent(in) :: &
tsfa ! Lowest model layer air temperature for radiation (K)
real(kind_phys), dimension(size(Grid%xlon,1), Model%levs+1), intent(in) :: &
p_lev ! Pressure @ model layer-interfaces (hPa)
real(kind_phys), dimension(size(Grid%xlon,1), Model%levs+1), intent(in) :: &
fluxlwUP_allsky, & ! RRTMGP longwave all-sky flux (W/m2)
fluxlwDOWN_allsky, & ! RRTMGP longwave all-sky flux (W/m2)
fluxlwUP_clrsky, & ! RRTMGP longwave clear-sky flux (W/m2)
fluxlwDOWN_clrsky ! RRTMGP longwave clear-sky flux (W/m2)
real(kind_phys), intent(in) :: &
raddt ! Radiation time step
real(kind_phys), dimension(im,NSPC1), intent(in) :: &
aerodp ! Vertical integrated optical depth for various aerosol species
real(kind_phys), dimension(im,5), intent(in) :: &
cldsa ! Fraction of clouds for low, middle, high, total and BL
integer, dimension(im,3), intent(in) ::&
mbota, & ! vertical indices for low, middle and high cloud tops
mtopa ! vertical indices for low, middle and high cloud bases
real(kind_phys), dimension(im,Model%levs), intent(in) :: &
cld_frac, & ! Total cloud fraction in each layer
cldtaulw ! approx 10.mu band layer cloud optical depth
real(kind_phys),dimension(size(Grid%xlon,1), Model%levs) :: &
hlwc ! Longwave all-sky heating-rate (K/sec)

! Outputs (mandatory)
character(len=*), intent(out) :: &
errmsg
integer, intent(out) :: &
errflg
type(GFS_coupling_type), intent(inout) :: &
Coupling ! Fortran DDT: FV3-GFS fields to/from coupling with other components
type(GFS_radtend_type), intent(inout) :: &
Radtend ! Fortran DDT: FV3-GFS radiation tendencies
type(GFS_diag_type), intent(inout) :: &
Diag ! Fortran DDT: FV3-GFS diagnotics data

! Outputs (optional)
real(kind_phys), dimension(size(Grid%xlon,1), Model%levs), optional, intent(inout) :: &
hlw0 ! Longwave clear-sky heating rate (K/sec)
type(proflw_type), dimension(size(Grid%xlon,1), Model%levs+1), optional, intent(inout) :: &
flxprf_lw ! 2D radiative fluxes, components:
! upfxc - total sky upward flux (W/m2)
! dnfxc - total sky dnward flux (W/m2)
! upfx0 - clear sky upward flux (W/m2)
! dnfx0 - clear sky dnward flux (W/m2)

! Local variables
integer :: i, j, k, iSFC, iTOA, itop, ibtc
logical :: l_clrskylw_hr, l_fluxeslw2d, top_at_1
real(kind_phys) :: tem0d, tem1, tem2

! Initialize CCPP error handling variables
errmsg = ''
errflg = 0

if (.not. Model%lslwr) return

! Are any optional outputs requested?
l_clrskylw_hr = present(hlw0)
l_fluxeslw2d = present(flxprf_lw)

! #######################################################################################
! What is vertical ordering?
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: in the future, this will become part of the metadata (the vertical ordering). But we don't have it yet, unfortunately.

! #######################################################################################
top_at_1 = (p_lev(1,1) .lt. p_lev(1, Model%levs))
if (top_at_1) then
iSFC = Model%levs+1
iTOA = 1
else
iSFC = 1
iTOA = Model%levs+1
endif

! #######################################################################################
! Compute LW heating-rates.
! #######################################################################################
if (Model%lslwr) then
! Clear-sky heating-rate (optional)
if (l_clrskylw_hr) then
call check_error_msg('GFS_rrtmgp_post',compute_heating_rate( &
fluxlwUP_clrsky, & ! IN - RRTMGP upward longwave clear-sky flux profiles (W/m2)
fluxlwDOWN_clrsky, & ! IN - RRTMGP downward longwave clear-sky flux profiles (W/m2)
p_lev, & ! IN - Pressure @ layer-interfaces (Pa)
hlw0)) ! OUT - Longwave clear-sky heating rate (K/sec)
endif
! All-sky heating-rate (mandatory)
call check_error_msg('GFS_rrtmgp_post',compute_heating_rate( &
fluxlwUP_allsky, & ! IN - RRTMGP upward longwave all-sky flux profiles (W/m2)
fluxlwDOWN_allsky, & ! IN - RRTMGP downward longwave all-sky flux profiles (W/m2)
p_lev, & ! IN - Pressure @ layer-interfaces (Pa)
hlwc)) ! OUT - Longwave all-sky heating rate (K/sec)

! Copy fluxes from RRTGMP types into model radiation types.
! Mandatory outputs
Diag%topflw(:)%upfxc = fluxlwUP_allsky(:,iTOA)
Diag%topflw(:)%upfx0 = fluxlwUP_clrsky(:,iTOA)
Radtend%sfcflw(:)%upfxc = fluxlwUP_allsky(:,iSFC)
Radtend%sfcflw(:)%upfx0 = fluxlwUP_clrsky(:,iSFC)
Radtend%sfcflw(:)%dnfxc = fluxlwDOWN_allsky(:,iSFC)
Radtend%sfcflw(:)%dnfx0 = fluxlwDOWN_clrsky(:,iSFC)

! Optional outputs
if(l_fluxeslw2d) then
flxprf_lw%upfxc = fluxlwUP_allsky
flxprf_lw%dnfxc = fluxlwDOWN_allsky
flxprf_lw%upfx0 = fluxlwUP_clrsky
flxprf_lw%dnfx0 = fluxlwDOWN_clrsky
endif
endif

! #######################################################################################
! Save LW outputs.
! #######################################################################################
if (Model%lslwr) then
! Save surface air temp for diurnal adjustment at model t-steps
Radtend%tsflw (:) = tsfa(:)

! All-sky heating rate profile
do k = 1, model%levs
Radtend%htrlw(1:im,k) = hlwc(1:im,k)
enddo
if (Model%lwhtr) then
do k = 1, model%levs
Radtend%lwhc(1:im,k) = hlw0(1:im,k)
enddo
endif

! Radiation fluxes for other physics processes
Coupling%sfcdlw(:) = Radtend%sfcflw(:)%dnfxc
endif

! #######################################################################################
! Save LW diagnostics
! - For time averaged output quantities (including total-sky and clear-sky SW and LW
! fluxes at TOA and surface; conventional 3-domain cloud amount, cloud top and base
! pressure, and cloud top temperature; aerosols AOD, etc.), store computed results in
! corresponding slots of array fluxr with appropriate time weights.
! - Collect the fluxr data for wrtsfc
! #######################################################################################
if (Model%lssav) then
if (Model%lslwr) then
do i=1,im
! LW all-sky fluxes
Diag%fluxr(i,1 ) = Diag%fluxr(i,1 ) + Model%fhlwr * fluxlwUP_allsky( i,iTOA) ! total sky top lw up
Diag%fluxr(i,19) = Diag%fluxr(i,19) + Model%fhlwr * fluxlwDOWN_allsky(i,iSFC) ! total sky sfc lw dn
Diag%fluxr(i,20) = Diag%fluxr(i,20) + Model%fhlwr * fluxlwUP_allsky( i,iSFC) ! total sky sfc lw up
! LW clear-sky fluxes
Diag%fluxr(i,28) = Diag%fluxr(i,28) + Model%fhlwr * fluxlwUP_clrsky( i,iTOA) ! clear sky top lw up
Diag%fluxr(i,30) = Diag%fluxr(i,30) + Model%fhlwr * fluxlwDOWN_clrsky(i,iSFC) ! clear sky sfc lw dn
Diag%fluxr(i,33) = Diag%fluxr(i,33) + Model%fhlwr * fluxlwUP_clrsky( i,iSFC) ! clear sky sfc lw up
enddo

do i=1,im
Diag%fluxr(i,17) = Diag%fluxr(i,17) + raddt * cldsa(i,4)
Diag%fluxr(i,18) = Diag%fluxr(i,18) + raddt * cldsa(i,5)
enddo

! Save cld frac,toplyr,botlyr and top temp, note that the order of h,m,l cloud is reversed for
! the fluxr output. save interface pressure (pa) of top/bot
do j = 1, 3
do i = 1, IM
tem0d = raddt * cldsa(i,j)
itop = mtopa(i,j)
ibtc = mbota(i,j)
Diag%fluxr(i, 8-j) = Diag%fluxr(i, 8-j) + tem0d
Diag%fluxr(i,11-j) = Diag%fluxr(i,11-j) + tem0d * Statein%prsi(i,itop)
Diag%fluxr(i,14-j) = Diag%fluxr(i,14-j) + tem0d * Statein%prsi(i,ibtc)
Diag%fluxr(i,17-j) = Diag%fluxr(i,17-j) + tem0d * Statein%tgrs(i,itop)

! Add optical depth and emissivity output
tem2 = 0.
do k=ibtc,itop
tem2 = tem2 + cldtaulw(i,k) ! approx 10. mu channel
enddo
Diag%fluxr(i,46-j) = Diag%fluxr(i,46-j) + tem0d * (1.0-exp(-tem2))
enddo
enddo
endif
endif

end subroutine GFS_rrtmgp_lw_post_run

! #########################################################################################
! SUBROUTINE GFS_rrtmgp_lw_post_finalize
! #########################################################################################
subroutine GFS_rrtmgp_lw_post_finalize ()
end subroutine GFS_rrtmgp_lw_post_finalize

end module GFS_rrtmgp_lw_post
Loading