Skip to content

Commit

Permalink
"WIP Implemented an interface with the RTE-RRTMGP library. Only works
Browse files Browse the repository at this point in the history
for gas radiation (H2O), long wave.
  • Loading branch information
lsoucasse committed Dec 7, 2023
1 parent cc31bd2 commit 1bfce78
Show file tree
Hide file tree
Showing 8 changed files with 326 additions and 13 deletions.
12 changes: 11 additions & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,17 @@ set(target_lib dales)

# Add all Fortran90 files from this directory
# This will also add some unwated files, which we will remove again below
FILE(GLOB sourcefiles "*.f90" "RRTMG/RRTMG_LW/modules/*.f90" "RRTMG/RRTMG_LW/src/*.f90" "RRTMG/RRTMG_SW/modules/*.f90" "RRTMG/RRTMG_SW/src/*.f90")
FILE(GLOB sourcefiles "*.f90"
"RRTMG/RRTMG_LW/modules/*.f90"
"RRTMG/RRTMG_LW/src/*.f90"
"RRTMG/RRTMG_SW/modules/*.f90"
"RRTMG/RRTMG_SW/src/*.f90"
"RTE-RRTMGP/rte/*.f90"
"RTE-RRTMGP/rte/kernels/*.f90"
"RTE-RRTMGP/rrtmgp/*.f90"
"RTE-RRTMGP/rrtmgp/kernels/*.f90"
"RTE-RRTMGP/examples/mo_simple_netcdf.f90"
"RTE-RRTMGP/examples/mo_load_coefficients.f90")

# TODO: make more concise
list(REMOVE_ITEM sourcefiles ${CMAKE_CURRENT_SOURCE_DIR}/test_transposes.f90)
Expand Down
10 changes: 5 additions & 5 deletions src/modAGScross.f90
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ subroutine initAGScross
output_prefix
use modstat_nc,only : open_nc, define_nc,ncinfo,writestat_dims_nc,nctiminfo
use modsurfdata, only : lrsAgs, ksoilmax,lsplitleaf
use modraddata,only : irad_par,irad_rrtmg,iradiation
use modraddata,only : irad_par,irad_rrtmg,irad_rte_rrtmgp,iradiation
implicit none

integer :: ierr
Expand Down Expand Up @@ -92,7 +92,7 @@ subroutine initAGScross

! we set the final number of variables in the output:
final_nvar = nvar
if (iradiation == irad_par .or. iradiation == irad_rrtmg) then
if (iradiation == irad_par .or. iradiation == irad_rrtmg .or. iradiation == irad_rte_rrtmgp) then
final_nvar = final_nvar+2 !swdir,swdif
if (lsplitleaf) final_nvar = final_nvar+2 !PARdir,PARdif
endif
Expand Down Expand Up @@ -135,7 +135,7 @@ subroutine initAGScross
call ncinfo(ncnameAGS(33,:),'LE ', 'xy AGScross of LE ','W/m2 ','tt0t')
call ncinfo(ncnameAGS(34,:),'H ', 'xy AGScross of H ','W/m2 ','tt0t')
call ncinfo(ncnameAGS(35,:),'G0 ', 'xy AGScross of G0 ','W/m2 ','tt0t')
if (iradiation == irad_par .or. iradiation == irad_rrtmg) then
if (iradiation == irad_par .or. iradiation == irad_rrtmg .or. iradiation == irad_rte_rrtmgp) then
call ncinfo(ncnameAGS(36,:),'swdir ', 'xy AGScross of SW dir rad. ','W/m2 ','tt0t')
call ncinfo(ncnameAGS(37,:),'swdif ', 'xy AGScross of SW diff rad.','W/m2 ','tt0t')
if (lsplitleaf) then
Expand Down Expand Up @@ -181,7 +181,7 @@ subroutine AGShorz
indCO2, tskin, tskinm, tsoil, thlflux, qtflux, tauField, ciField, gcco2Field, &
PARField,Qnet,LE,H,G0,PARdirField,PARdifField,lsplitleaf
use modfields, only : svm, rhof, ql0
use modraddata,only : swd, swu, lwd, lwu,swdir,swdif,irad_par,iradiation,irad_rrtmg,lwc
use modraddata,only : swd, swu, lwd, lwu,swdir,swdif,irad_par,iradiation,irad_rrtmg,irad_rte_rrtmgp,lwc
implicit none


Expand Down Expand Up @@ -237,7 +237,7 @@ subroutine AGShorz
vars(:,:,33) = LE (2:i1,2:j1)
vars(:,:,34) = H (2:i1,2:j1)
vars(:,:,35) = G0 (2:i1,2:j1)
if (iradiation == irad_par .or. iradiation == irad_rrtmg) then
if (iradiation == irad_par .or. iradiation == irad_rrtmg .or. iradiation == irad_rte_rrtmgp) then
vars(:,:,36) = swdir (2:i1,2:j1,1)
vars(:,:,37) = swdif (2:i1,2:j1,1)
if (lsplitleaf) then
Expand Down
5 changes: 3 additions & 2 deletions src/modraddata.f90
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ module modraddata
integer, parameter :: irad_lsm = 3 !< 3=simple surface radiation for land surface model
integer, parameter :: irad_rrtmg = 4 !< 4=radiation using the rapid radiative transfer model
integer, parameter :: irad_user = 10 !< 10=user specified radiation
integer, parameter :: irad_rte_rrtmgp = 5 !< 5=radiation using the rapid radiative transfer model parallel

logical :: rad_ls = .true. !< prescribed radiative forcing
logical :: rad_longw = .true. !< parameterized longwave radiative forcing
Expand Down Expand Up @@ -104,8 +105,6 @@ module modraddata
qci_slice, & ! Ice content (2D slice)
o3_slice, & ! Ozon content (2D slice)
rho_slice, & ! Density (2D slice)
lwUp_slice, & ! Upwelling longwave rad (2D slice)
lwDown_slice, & ! Downwelling longwave rad (2D slice)
lwUpCS_slice, & ! Upwelling longwave rad, clear sky value (2D slice)
lwDownCS_slice, & ! Downwelling longwave rad, clear sky value (2D slice)
lwHR_slice, & ! Heating rate due to longwave rad (2D slice)
Expand All @@ -118,6 +117,8 @@ module modraddata
swDownCS_slice, & ! Downwelling shortwave rad, clear sky value(2D slice)
swHR_slice, & ! Heating rate due to shortwave rad (2D slice)
swHRCS_slice ! Heating rate due to shortwave rad,clear sky value (2D slice)
real(kind=kind_rb),allocatable,target,dimension(:,:) :: lwUp_slice, & ! Upwelling longwave rad (2D slice)
lwDown_slice ! Downwelling longwave rad (2D slice)

real(kind=kind_rb),allocatable,dimension(:) :: solarZenithAngleCos ! The zenith angle of a slice
real(kind=kind_rb),allocatable,dimension(:) :: asdir,asdif,aldir,aldif ! Albedos ...
Expand Down
3 changes: 3 additions & 0 deletions src/modradiation.f90
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ subroutine radiation
use moduser, only : rad_user
use modradfull,only : radfull
use modradrrtmg, only : radrrtmg
use modradrte_rrtmgp, only : radrte_rrtmgp
implicit none
real wtime

Expand All @@ -216,6 +217,8 @@ subroutine radiation
call radlsm
case (irad_rrtmg)
call radrrtmg
case (irad_rte_rrtmgp)
call radrte_rrtmgp
case (irad_user)
! EWB: the if statement should came first because moduser uses a radpar variable
if(rad_longw.or.rad_shortw) then
Expand Down
2 changes: 1 addition & 1 deletion src/modradrrtmg.f90
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module modradrrtmg
implicit none

private
public :: radrrtmg
public :: radrrtmg, readSounding

contains

Expand Down
Loading

0 comments on commit 1bfce78

Please sign in to comment.