-
Notifications
You must be signed in to change notification settings - Fork 344
Convert the BareGroundFluxesMod dewpoint calculation into a function #3706
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
Open
olyson
wants to merge
1
commit into
ESCOMP:b4b-dev
Choose a base branch
from
olyson:dewpointfunction
base: b4b-dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+36
−17
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -148,15 +148,6 @@ subroutine BareGroundFluxes(bounds, num_noexposedvegp, filter_noexposedvegp, & | |
| real(r8) :: forc_e ! vapor pressure at forcing height [Pa] | ||
| real(r8) :: forc_qs ! saturated specific humidity at forcing height [kg/kg] | ||
| real(r8) :: forc_esat ! saturated vapor pressure at forcing height [Pa] | ||
| ! Coefficients from Alduchov and Eskridge (1996) as used by Lawrence (2005) for Magnus dewpoint | ||
| ! equation over liquid | ||
| real(r8), parameter :: A1_liq = 17.625_r8 ! [-] | ||
| real(r8), parameter :: B1_liq = 243.04_r8 ! [degC] | ||
| real(r8), parameter :: C1_liq = 610.94_r8 ! [Pa] | ||
| ! Coefficients from Alduchov and Eskridge (1996) for Magnus dewpoint equation over ice | ||
| real(r8), parameter :: A1_ice = 22.587_r8 ! [-] | ||
| real(r8), parameter :: B1_ice = 273.86_r8 ! [degC] | ||
| real(r8), parameter :: C1_ice = 611.21_r8 ! [Pa] | ||
| !------------------------------------------------------------------------------ | ||
|
|
||
| associate( & | ||
|
|
@@ -425,14 +416,8 @@ subroutine BareGroundFluxes(bounds, num_noexposedvegp, filter_noexposedvegp, & | |
| ! corresponding to 1% relative humidity | ||
| forc_e = max( (forc_q(c)*forc_pbot(c)) / (forc_q(c)+0.622_r8), 0.01_r8*forc_esat) | ||
|
|
||
| ! Magnus expression for dew point | ||
| ! Equation (7) from Lawrence (2005) | ||
| if (t_grnd(c) < tfrz) then ! ice coefficients | ||
| forc_dewpoint = B1_ice*log(forc_e/C1_ice) / (A1_ice - log(forc_e/C1_ice)) | ||
| else ! liquid water coefficients | ||
| forc_dewpoint = B1_liq*log(forc_e/C1_liq) / (A1_liq - log(forc_e/C1_liq)) | ||
| end if | ||
| forc_dewpoint = forc_dewpoint + tfrz | ||
| ! Calculate dewpoint at forcing height | ||
| forc_dewpoint = dewpoint(forc_e,t_grnd(c)) | ||
|
|
||
| !changed by K.Sakaguchi. Soilbeta is used for evaporation | ||
| if (dqh(p) > 0._r8) then !dew (beta is not applied, just like rsoil used to be) | ||
|
|
@@ -559,4 +544,38 @@ subroutine BareGroundFluxes(bounds, num_noexposedvegp, filter_noexposedvegp, & | |
|
|
||
| end subroutine BareGroundFluxes | ||
|
|
||
| !------------------------------------------------------------------------------ | ||
| real(r8) function dewpoint(e,t) | ||
| ! | ||
| ! DESCRIPTION: | ||
| ! Calculates dewpoint (degK) from input vapor pressure | ||
| ! Uses Equation 7 from Lawrence 2005, https://doi.org/10.1175/BAMS-86-2-225 | ||
|
|
||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we also need to update our documentation to reflect this?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I will open an issue for the documentation. I'll also open an issue to document #3643 |
||
| use clm_varcon, only : tfrz | ||
|
|
||
| ! ARGUMENTS | ||
| real(r8), intent(in) :: e ! vapor pressure [Pa] | ||
| real(r8), intent(in) :: t ! temperature (K) | ||
| ! Coefficients from Alduchov and Eskridge (1996) as used by Lawrence (2005) for Magnus dewpoint | ||
| ! equation over liquid | ||
| real(r8), parameter :: A1_liq = 17.625_r8 ! [-] | ||
| real(r8), parameter :: B1_liq = 243.04_r8 ! [degC] | ||
| real(r8), parameter :: C1_liq = 610.94_r8 ! [Pa] | ||
| ! Coefficients from Alduchov and Eskridge (1996) for Magnus dewpoint equation over ice | ||
| real(r8), parameter :: A1_ice = 22.587_r8 ! [-] | ||
| real(r8), parameter :: B1_ice = 273.86_r8 ! [degC] | ||
| real(r8), parameter :: C1_ice = 611.21_r8 ! [Pa] | ||
|
|
||
| ! Magnus expression for dew point | ||
| ! Equation (7) from Lawrence (2005) | ||
| if (t < tfrz) then ! ice coefficients | ||
| dewpoint = B1_ice*log(e/C1_ice) / (A1_ice - log(e/C1_ice)) | ||
| else ! liquid water coefficients | ||
| dewpoint = B1_liq*log(e/C1_liq) / (A1_liq - log(e/C1_liq)) | ||
| end if | ||
| dewpoint = dewpoint + tfrz | ||
|
|
||
| end function dewpoint | ||
| !------------------------------------------------------------------------------ | ||
|
|
||
| end module BareGroundFluxesMod | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Way to go @olyson, this seems to be a b4b refactor that cleans up the code by creating a function for dew and frost over bare ground. Assuming this is really b4b can we just merge the PR to b4b_dev?