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

Stability function correction for momentum in mos subroutine of SLUCM. #2038

Merged
merged 1 commit into from
Aug 21, 2024

Conversation

joshi994
Copy link
Contributor

@joshi994 joshi994 commented Apr 17, 2024

TYPE: Bug fix

KEYWORDS: Stability function, Urban canopy model, surface energy balance, Green roof temperature.

SOURCE: Parag Joshi (Brookhaven National Laboratory), Katia Lamer (Brookhaven National Laboratory)

DESCRIPTION OF CHANGES:
Problem: The earlier equations has a typo where X (= (1-16\zeta)^1/4) is mentioned instead of X0. In addition, following the formulation of surface energy balance of OSU1DPBL scheme by Ek and Mahrt 1991, it appears that when the following definition is used $\sigma * \theta_s^4 = \sigma T_0^4 (1 + 4((\theta_s - T_0)/T_0)))$ is used, the temperature in the calculations of net flux at the surface should use T_0 (temperature at first atmospheric level). However, in the module TGRP (temperature of the green roof surface at previous time step is used)is used instead of T_0 (please refer to the attached screenshots of the formulation).

Also I am not sure why the term (\theta_0 - T_0) is neglected in the definition of YY (Line/command 1145 WRFv-4.5.2) whereas the equation for the $\theta_s$ in attached screenshot shows the term. Due to insignficant impact?

Solution:
Following the formulation, the temperature variable has been updated according. Moreover, the mos subroutine is also corrected by replacing X by X0 where X0 is =X*z0/(z+z0) (as per the WRF/phys/module_sf_urban.F).

LIST OF MODIFIED FILES:
M phys/module_sf_urban.F

TESTS CONDUCTED:

  1. No tests are conducted. A test case could be run to compare the impact of changes in the TGR and stability parameter value as well as CD, US, and ALPHA.
  2. The Jenkins tests are all passing.

For more details, refer to the pages # 47-50 of the document link in the release note.

RELEASE NOTE: Fixes for the calculations for PSIM in the mos subroutine and the temperature used in surface energy balance for the green roof. The later follows the OSU1DPBL document located at:
[https://ftp.emc.ncep.noaa.gov/mmb/gcp/ldas/nceplsm/OSU1DPBL/OSU1DPBL-userguide.pdf]

Screenshot 2024-04-17 at 2 20 50 PM Screenshot 2024-04-17 at 2 38 26 PM ]

The calculations for PSIM in the mos subroutine of module-sf_urban.F has been corrected. The earlier equations has a typo where X (= (1-16\zeta)^1/4) is mentioned instead of X0.
@weiwangncar
Copy link
Collaborator

The regression test results:

Test Type              | Expected  | Received |  Failed
= = = = = = = = = = = = = = = = = = = = = = = =  = = = =
Number of Tests        : 23           24
Number of Builds       : 60           57
Number of Simulations  : 158           150        0
Number of Comparisons  : 95           86        0

Failed Simulations are: 
None
Which comparisons are not bit-for-bit: 
None

@joshi994 joshi994 changed the title Stability function correction for momentum in most subroutine Stability function correction for momentum in mos subroutine of SLUCM. Apr 17, 2024
@@ -1133,7 +1133,7 @@ SUBROUTINE urban(LSOLAR, & ! L

CALL TDFCND (DF1,SMR(KZ), QUARTZ, SMCMAX )
DF1 = DF1 * EXP(-2.0 * SHDFAC)
RGR = EPSV*(RX-SIG*(TGRP**4.)/60.)
RGR = EPSV*(RX-SIG*(TA**4.)/60.)
Copy link
Contributor

@cenlinhe cenlinhe Apr 18, 2024

Choose a reason for hiding this comment

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

I think here the original code is correct. We need to use "TGRP" for the green roof surface temperature to compute the outgoing longwave radiation for the greenroof surface not the air. But this RGR does lead to the inconsistence in the "YY" calculation using "TA" a few lines below. I am not quite sure about this yet. this is the reference for this greenroof development: https://link.springer.com/article/10.1007/s10546-014-9991-6
maybe you could contact the original developer: Prof. Jiachuan Yang (HKUST): cejcyang@ust.hk

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@cenlinhe I have tried explaining my part in the attachment here. Please let me know if you need further clarification. Also, please correct me if I am terribly wrong.
TA_TGRP_Clarification.pdf

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@cenlinhe I believe that for consistency in estimating YY, TA needs to be replaced by TGRP while keeping TGRP in the calculations of RGR (as done for the roof case where TRP is used instead), since an iterative approach is implemented. This may provide better results.

Copy link
Contributor

Choose a reason for hiding this comment

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

@cenlinhe I believe that for consistency in estimating YY, TA needs to be replaced by TGRP while keeping TGRP in the calculations of RGR (as done for the roof case where TRP is used instead), since an iterative approach is implemented. This may provide better results.

I agree that TA should be replaced by TGRP in YY calculation

Copy link
Contributor

Choose a reason for hiding this comment

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

@cenlinhe I have tried explaining my part in the attachment here. Please let me know if you need further clarification. Also, please correct me if I am terribly wrong. TA_TGRP_Clarification.pdf

I agree that current code has some inconsistency in RGR, RR1, and YY calculations. From the greenroof surface energy balance perspective, I think TGRP should be used instead of TA in all these three places. Also, the term (theta0 - T0) is missing but I do not know the reason, likely because the assumption that they are the same.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think the iterative approach is required to achieve the greenroof surface energy flux balance convergence, which means this equation needs to be inside the iteration loop. Could you please do a test to compare the simulations with TGRP and replacing TGRP by TA (based on your proposed solution) to see how much difference it makes?

@cenlinhe Unfortunately, I do not have computing facilities to run a test simulation. I tried on my local computer but it didn't work well. I will keep you posted if anything changes.

Copy link

Choose a reason for hiding this comment

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

Thanks for pointing out the issue. After carefully reviewing the code and the PDF, to be in consistent with the equations, TA shall be used instead of TGRP in the calculation of RGR, RR1, and YY.

For the term (theta0 - T0), their values shall be close at the first atmospheric level, so I ignore that term during the coding process.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for pointing out the issue. After carefully reviewing the code and the PDF, to be in consistent with the equations, TA shall be used instead of TGRP in the calculation of RGR, RR1, and YY.

For the term (theta0 - T0), their values shall be close at the first atmospheric level, so I ignore that term during the coding process.

@jyang104 Thank you so much for your response and for confirming the inconsistency. Now this makes me wonder that when a similar energy balance is applied to a common roof, wall, and ground shouldn't the $\sigma*\theta_s^4$, where $\theta_s$ can represent the surface temperature of roof, wall, and ground, must use a similar approximation $\sigma*\theta_s^4 = \sigma*\theta_A^4 (1 + 4(\theta_s - T_A)/T_A$? I believe that the nonlinear nature of the resulting balance equation in $\theta_s$ is the sole reason for such an approximation. Hence directly using TRP, TWP, or TGP (even if it is from the previous time step) in the calculation of the longwave radiation part of the energy balance causes further inconsistencies. Please correct me if I am wrong. I am extremely new to WRF modeling and trying to understand the physics.

Copy link

Choose a reason for hiding this comment

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

@joshi994 You are correct. Part of the reason for the inconsistency is that the calculation of outgoing longwave in the original sf_urban (i.e, for wall and ground and roof) does not involve evapotranspiration that the equation of \sigma*\theta_s^4 is used. When I implemented the green roof, I followed the sf_noahlsm in general that the surface energy balance used the approximation formula. In this case, it will be easier to just correct the green roof part of the code, rather than fixing the ones for TRP, TWP, or TGP.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jyang104 @cenlinhe It make sense corecting the green roof part only. However, it would be nice to see the temperature of the green roof calculated using YY and ZZ1, the linear approximation $\sigma*\theta_s^4 = \sigma*\theta_A^4 (1 + 4(\theta_s - T_A)/T_A$ and using the Newton-Raphson approach right below it. I am leaving it over to the experts to decide and close the request. Thanks for the input @jyang104 and @cenlinhe for providing me the opportunity to speak with @jyang104.

@@ -1635,7 +1635,7 @@ SUBROUTINE mos(XXX,ALPHA,CD,B1,RIB,Z,Z0,UA,TA,TSF,RHO)
PSIM=ALOG((Z+Z0)/Z0) &
-ALOG((X+1.)**2.*(X**2.+1.)) &
+2.*ATAN(X) &
+ALOG((X+1.)**2.*(X0**2.+1.)) &
+ALOG((X0+1.)**2.*(X0**2.+1.)) &
Copy link
Contributor

Choose a reason for hiding this comment

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

This typo is indeed a bug.

@cenlinhe
Copy link
Contributor

I am also bringing @barlage here just in case he has any insights on this problem.

@weiwangncar weiwangncar changed the base branch from master to release-v4.6.1 August 6, 2024 08:16
@weiwangncar
Copy link
Collaborator

@cenlinhe @barlage Can you confirm this PR is correct and approve it?

@barlage
Copy link
Contributor

barlage commented Aug 6, 2024

I'll defer to @cenlinhe. I don't have any history with this.

@cenlinhe
Copy link
Contributor

cenlinhe commented Aug 6, 2024

I will review the recent discussion one more time. In the meantime, @chenghaow @xuelingbo @doan-van please take a look at this PR discussion and let me know what you think.

@chenghaow
Copy link

RGR = EPSV*(RX-SIG*(TA**4.)/60.)

I just went through this thread and agree that this is the correct equation. I also suggest adding a comment here that TA is used because of the linearization to avoid potential future confusion.

@xuelingbo
Copy link

I am also agree with this correction.

@cenlinhe
Copy link
Contributor

I approve this.

@weiwangncar
Copy link
Collaborator

@cenlinhe @chenghaow @xuelingbo Anyone wants to address Josh's comment in the PR: "Also I am not sure why the term (\theta_0 - T_0) is neglected in the definition of YY (Line/command 1145 WRFv-4.5.2) whereas the equation for the $\theta_s$ in attached screenshot shows the term. Due to insignificant impact?"

@weiwangncar weiwangncar merged commit 6198090 into wrf-model:release-v4.6.1 Aug 21, 2024
2 of 14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants