Skip to content

Commit c3f3dca

Browse files
Add MERRA-2 dynamic lapse rate double-sided cutoff
This commit adds the application of a double-sided cutoff to pre-generated hourly MERRA-2 lapse rate maps. This optional functionality will replace any lapse rate value that falls above (below) the maximum (minimum) cutoff threshold with the cutoff threshold value. The function is invoked by an optional config entry to apply the double-sided cutoff. If this config entry is not present, the cutoffs will not be applied. The commit also includes optional config entries to specify the minimum and maximum cutoff thresholds in units of K/m. If the config entry for the maximum (minimum) threshold is not present, the default is set to +0.01 (-0.01) K/m. Kristen Whitney and David Mocko worked together to modify the code with this functionality. Kristen Whitney performed code testing. For now, this code should remain in the eis-freshwater2 branch, and should not be merged into the main branch yet. Credit where credit is due: @dmocko helped with the corresponding code modifications and adjustments. Resolves: NASA-LIS#1653
1 parent ec695ed commit c3f3dca

File tree

4 files changed

+97
-7
lines changed

4 files changed

+97
-7
lines changed

lis/configs/lis.config.adoc

+40-6
Original file line numberDiff line numberDiff line change
@@ -5738,14 +5738,48 @@ Acceptable values are:
57385738
`MERRA2 dynamic lapse rate data directory:` specifies the
57395739
directory of the pre-computed MERRA-2 lapse rate dataset.
57405740
5741+
`MERRA2 apply double-sided dynamic lapse rate cutoff:` specifies whether
5742+
to apply a double-sided cutoff to the dynamic lapse rate values. This is
5743+
an optional config entry; if not present, the default is 0. If set to 1,
5744+
values above (below) the maximum (minimum) cutoff are replaced with the
5745+
maximum (minimum) cutoff value. Maximum and minimum cutoff values can
5746+
optionally be set using the MERRA2 maximum and minimum lapse rate cutoff
5747+
aguments, or otherwise are assumed the default cutoff values, as described
5748+
below.
5749+
5750+
|====
5751+
|Value | Description
5752+
5753+
|0 | Do not apply MERRA-2 double-sided dynamic lapse rate cutoff.
5754+
|1 | Apply MERRA-2 double-sided dynamic lapse rate cutoff.
5755+
|====
5756+
5757+
`MERRA2 maximum lapse rate cutoff (K/m):` specifies the maximum value
5758+
for the MERRA2 double-sided dynamic lapse rate cutoff range, in units
5759+
of Kelvin per meter (K/m). This is an optional config entry; if
5760+
not present, the default is set to 0.01 K/m. This is only applied if
5761+
MERRA2 apply double-sided dynamic lapse rate cutoff is turned on
5762+
(i.e., set to a value of 1).
5763+
5764+
`MERRA2 minimum lapse rate cutoff (K/m):` specifies the minimum value
5765+
for the MERRA2 double-sided dynamic lapse rate cutoff range, in units
5766+
of Kelvin per meter (K/m). This is an optional config entry; if
5767+
not present, the default is set to -0.1 K/m. This is only applied if
5768+
MERRA2 apply double-sided dynamic lapse rate cutoff is turned on
5769+
(i.e., set to a value of 1).
5770+
57415771
.Example _lis.config_ entry
5772+
57425773
....
5743-
MERRA2 forcing directory: ./MERRA2
5744-
MERRA2 use lowest model level forcing: 1
5745-
MERRA2 use 2m wind fields: 0
5746-
MERRA2 use corrected total precipitation: 1
5747-
MERRA2 apply dynamic lapse rates: 0
5748-
MERRA2 dynamic lapse rate data directory: ./MERRA2_lapse_rates
5774+
MERRA2 forcing directory: ./MERRA2
5775+
MERRA2 use lowest model level forcing: 1
5776+
MERRA2 use 2m wind fields: 0
5777+
MERRA2 use corrected total precipitation: 1
5778+
MERRA2 apply dynamic lapse rates: 1
5779+
MERRA2 dynamic lapse rate data directory: ./MERRA2_lapse_rates
5780+
MERRA2 apply double-sided dynamic lapse rate cutoff: 1
5781+
MERRA2 maximum lapse rate cutoff (K/m): 0.009
5782+
MERRA2 minimum lapse rate cutoff (K/m): -0.009
57495783
....
57505784
57515785
[[sssec_forcings_GEOS-IT,GEOS-IT]]

lis/metforcing/merra2/get_merra2.F90

+15
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
! 08 Dec 2015: James Geiger, update timing logic
1919
! 13 Sep 2024: Sujay Kumar, Initial code for using dynamic lapse rate
2020
! 31 Oct 2024: David Mocko, Final code for using dynamic lapse rate
21+
! 18 Dec 2024: Kristen Whitney, code for using double-sided dynamic lapse rate cutoff
2122
!
2223
! !INTERFACE:
2324
subroutine get_merra2(n, findex)
@@ -463,6 +464,13 @@ subroutine get_merra2(n, findex)
463464
gid = LIS_domain(n)%gindex(c,r)
464465
LIS_forc(n,findex)%lapseRate(gid) = &
465466
merra2_struc(n)%lapserate2(gid,LIS_rc%hr+1)
467+
if(merra2_struc(n)%applydynlapseratecutoff.eq.1) then
468+
if(LIS_forc(n,findex)%lapseRate(gid).gt.merra2_struc(n)%dynlapseratemaxcutoff) then
469+
LIS_forc(n,findex)%lapseRate(gid) = merra2_struc(n)%dynlapseratemaxcutoff
470+
elseif(LIS_forc(n,findex)%lapseRate(gid).lt.merra2_struc(n)%dynlapseratemincutoff) then
471+
LIS_forc(n,findex)%lapseRate(gid) = merra2_struc(n)%dynlapseratemincutoff
472+
endif
473+
endif
466474
endif
467475
enddo
468476
enddo
@@ -473,6 +481,13 @@ subroutine get_merra2(n, findex)
473481
gid = LIS_domain(n)%gindex(c,r)
474482
LIS_forc(n,findex)%lapseRate(gid) = &
475483
merra2_struc(n)%lapserate1(gid,LIS_rc%hr+1)
484+
if(merra2_struc(n)%applydynlapseratecutoff.eq.1) then
485+
if(LIS_forc(n,findex)%lapseRate(gid).gt.merra2_struc(n)%dynlapseratemaxcutoff) then
486+
LIS_forc(n,findex)%lapseRate(gid) = merra2_struc(n)%dynlapseratemaxcutoff
487+
elseif(LIS_forc(n,findex)%lapseRate(gid).lt.merra2_struc(n)%dynlapseratemincutoff) then
488+
LIS_forc(n,findex)%lapseRate(gid) = merra2_struc(n)%dynlapseratemincutoff
489+
endif
490+
endif
476491
endif
477492
enddo
478493
enddo

lis/metforcing/merra2/merra2_forcingMod.F90

+5-1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ module merra2_forcingMod
1515
! 18 Mar 2015: James Geiger, initial code (based on merra-land)
1616
! 13 Sep 2024: Sujay Kumar, Initial code for using dynamic lapse rate
1717
! 31 Oct 2024: David Mocko, Final code for using dynamic lapse rate
18+
! 18 Dec 2024: Kristen Whitney, code for using double-sided dynamic lapse rate cutoff
1819
!
1920
! !DESCRIPTION:
2021
! This module contains variables and data structures that are used
@@ -133,7 +134,10 @@ module merra2_forcingMod
133134
integer, allocatable :: rseed(:,:)
134135
integer :: usedynlapserate
135136
character(len=LIS_CONST_PATH_LEN) :: dynlapseratedir
136-
137+
integer :: applydynlapseratecutoff
138+
real :: dynlapseratemincutoff
139+
real :: dynlapseratemaxcutoff
140+
137141
end type merra2_type_dec
138142

139143
type(merra2_type_dec), allocatable :: merra2_struc(:)

lis/metforcing/merra2/readcrd_merra2.F90

+37
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
! 18 Mar 2015: James Geiger, initial code (based on merra-land)
1717
! 13 Sep 2024: Sujay Kumar, Initial code for using dynamic lapse rate
1818
! 31 Oct 2024: David Mocko, Final code for using dynamic lapse rate
19+
! 18 Dec 2024: Kristen Whitney, code for using double-sided dynamic lapse rate cutoff
1920
!
2021
! !INTERFACE:
2122
subroutine readcrd_merra2()
@@ -86,6 +87,42 @@ subroutine readcrd_merra2()
8687
call LIS_verify(rc,&
8788
'MERRA2 dynamic lapse rate data directory: not defined')
8889
enddo
90+
91+
call ESMF_ConfigFindLabel(LIS_config,"MERRA2 apply double-sided dynamic lapse rate cutoff:",rc=rc)
92+
do n=1,LIS_rc%nnest
93+
call ESMF_ConfigGetAttribute(LIS_config,merra2_struc(n)%applydynlapseratecutoff,&
94+
default=0, rc=rc)
95+
call LIS_verify(rc,&
96+
'MERRA2 apply double-sided dynamic lapse rate cutoff: no defined')
97+
enddo
98+
99+
do n=1,LIS_rc%nnest
100+
if(merra2_struc(n)%applydynlapseratecutoff.eq.1) then
101+
call ESMF_ConfigFindLabel(LIS_config,"MERRA2 minimum lapse rate cutoff (K/m):",rc=rc)
102+
call ESMF_ConfigGetAttribute(LIS_config,merra2_struc(n)%dynlapseratemincutoff,&
103+
default=-0.01, rc=rc)
104+
call LIS_verify(rc,&
105+
'MERRA2 minimum lapse rate cutoff (K/m): not defined')
106+
call ESMF_ConfigFindLabel(LIS_config,"MERRA2 maximum lapse rate cutoff (K/m):",rc=rc)
107+
call ESMF_ConfigGetAttribute(LIS_config,merra2_struc(n)%dynlapseratemaxcutoff,&
108+
default=0.01, rc=rc)
109+
call LIS_verify(rc,&
110+
'MERRA2 maximum lapse rate cutoff (K/m): not defined')
111+
112+
! Sanity check
113+
if(merra2_struc(n)%dynlapseratemincutoff.gt.merra2_struc(n)%dynlapseratemaxcutoff) then
114+
write(LIS_logunit,*) '[ERR] MERRA2 minimum lapse rate cutoff value should be'
115+
write(LIS_logunit,*) '[ERR] less than the MERRA2 maximum lapse rate cutoff value.'
116+
write(LIS_logunit,*) '[ERR] Note the default value is -0.01 K/m for the minimum cutoff,'
117+
write(LIS_logunit,*) '[ERR] and 0.01 K/m for the maximum cutoff.'
118+
write(LIS_logunit,*) '[ERR] Please ensure if specifying just the minimum (maximum)'
119+
write(LIS_logunit,*) '[ERR] cutoff value, that it is less (greater) than the'
120+
write(LIS_logunit,*) '[ERR] maximum (minimum) default value.'
121+
write(LIS_logunit,*) '[ERR] STOPPING ....'
122+
call LIS_endrun()
123+
endif
124+
endif
125+
enddo
89126
endif
90127

91128
do n=1,LIS_rc%nnest

0 commit comments

Comments
 (0)