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

Noah-MP Miguez-Macho and Fan #1418

Open
wants to merge 34 commits into
base: master
Choose a base branch
from

Conversation

TimLahmers
Copy link

Description

This PR includes support for the Miguez-Macho and Fan Groundwater scheme (Miguez-Macho et al. 2007). This scheme allows 2-way sub-surface routing in the Noah-MP v.4.0.1 LSM in serial and parallel processor configurations. A halo size of at least 3 grid points is recommended for stable results in parallel. The Miguez-Macho and Fan scheme is not recommended for grid resolutions higher than 4-km due to assumptions for the channel exfiltration (QRF) calculation becoming unrealistic at high resolutions.

Resolves #1037

Requires PR #1407 to support ISRIC soils

Testcase

LDT: /discover/nobackup/tlahmers/SHARE/MMF_Testcases/LDT_run
LIS: /discover/nobackup/tlahmers/SHARE/MMF_Testcases/LIS_run

Timothy M. Lahmers and others added 30 commits April 29, 2021 13:32
@jvgeiger jvgeiger requested a review from dmocko September 28, 2023 18:19
@jvgeiger jvgeiger self-assigned this Oct 5, 2023
@sudarsan3010
Copy link

So, the MMF scheme in Noah-MP is now ready to use? Is it already merged with the master?
I am waiting from a very long time to use this sub-surface scheme.

@dmocko dmocko self-assigned this Jul 10, 2024
stepwtd = 0
dtbl = 0.0
dtbl = NOAHMP401_struc(n)%ts
Copy link
Contributor

Choose a reason for hiding this comment

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

I note that "dtbl" is not used anywhere else in the code (including within the "phys" sub-directory).

Copy link
Author

Choose a reason for hiding this comment

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

@dmocko This might be an artifact from earlier code changes, before I took over the MMF coding. If this doesn't appear anywhere else in the code or affect other LIS components, I am open to removing it.

NOAHMP401_struc(n)%row_min:NOAHMP401_struc(n)%row_max))
allocate(NOAHMP401_struc(n)%vege3d(NOAHMP401_struc(n)%col_min:NOAHMP401_struc(n)%col_max, &
NOAHMP401_struc(n)%row_min:NOAHMP401_struc(n)%row_max, &
20)) ! 20 is the number of surfacetype categories, hardcoded temporarily
Copy link
Contributor

Choose a reason for hiding this comment

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

This line should be changed, so 20 is not hard-coded. Please change to number of vegetation classes.

Copy link
Author

Choose a reason for hiding this comment

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

@dmocko Consistent with the change proposed below in the NoahMP401_setup.F90 module, could we change the hard-coded value to LIS_rc%nsurfacetypes? Similarly, we could use LIS_rc%nsoiltypes for the number of soils.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, I believe that this will work.


! if the total fraction from layer 1 to layer 20 is no more than 0.5, this means there is the fraction of the 21st layer is >= 0.5, set the landcover type to be 17 as HRLDAS
if(.not. sum(NOAHMP401_struc(n)%vege3d(cidx, ridx, :))>0.5) then
NOAHMP401_struc(n)%vege2d(cidx,ridx) = 17
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think "17" should be hard-coded here. Instead, please set to the water type within LIS, so it covers all vegetation classifications that might be used.

Copy link
Author

Choose a reason for hiding this comment

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

@dmocko Something similar also came up for another version of MMF (the GWS project that Wanshu and I started). Is something like this what you are looking for? a3a6114

Copy link
Contributor

Choose a reason for hiding this comment

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

Sort of. I was thinking more about "LIS_rc%waterclass", which is read in from WATERCLASS from the lis_input file.

@dmocko
Copy link
Contributor

dmocko commented Jul 10, 2024

Hi @TimLahmers and @jvgeiger

I'm finally getting around to reviewing this PR for MMF. My apologies for taking so long to finish it.
May all my jobs this week sit on the queue for an extra 12 hours as penance!

I made a few specific comments about code above, but more generally most of these changes look good to me.

I do wonder, though - What is the difference between the variables “LIS_rc%nsurfacetypes” and “LIS_rc%nvegtypes”?
In NoahMP401_setup.F90, Lines 370 and 386 go from 1 to LIS_rc%nsurfacetypes. Should this be LIS_rc%nvegtypes?

As a test, I ran in the NLDAS-2 domain using both the latest main/master branch and using the code in this PR.
For this test, I am using the TOPWATER groundwater scheme - in other words, I am NOT using the MMF scheme.
All of the variables - EXCEPT for RelSMC - produced identical output (as expected) between the two runs.
Note that these test runs both use the UMD vegetation classification, which show that results could be affected
by the hard-coding described above.

@TimLahmers - Can you please take a look at this output field?

This is RelSMC from the main branch:
relsmc_main

This is RelSMC from the code for this PR:
relsmc_mmf

This is the difference between the two fields:
relsmc_diff

There are two issues:

  1. In the run with the MMF code, there's a strip of undefined values from DC south through VA and NC.
  2. In the run with the MMF code, there are values for the urban type, while from the main code, these values are undefined. They should be undefined according to the code. The difference field shows that outside of these two areas (DC to VA to NC strip - and - urban points), the values are identical between these two runs.

xice(:,:) = 0.0 ! ice fraction is 0
xice_threshold = 0.5 ! be consistent with hrldas
isice = 100 ! this number should not be one of vegetation type id
isurban = 13 ! be consistent with hrldas
Copy link
Contributor

Choose a reason for hiding this comment

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

Hi @TimLahmers - this is another hard-coded value that should be generalized.

Can you please change the "13" to LIS_rc%urbanclass ?

Copy link
Contributor

Choose a reason for hiding this comment

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

@TimLahmers - One other question about hard-coding the ice values in lines 1029-1032.

Hard-coding these values will run the MMF groundwater for all glacier points in LIS.

However, the code itself seems to check if it is a glacier/ice point, and possibly not run these points:

    WHERE(XLAND-1.5.LT.0..AND.XICE.LT. XICE_THRESHOLD.AND.IVGTYP.NE.ISICE)
         LANDMASK=1
    ELSEWHERE
         LANDMASK=-1
    ENDWHERE

Can you please comment on why you are making MMF run for all glacier/ice points?

Copy link
Author

Choose a reason for hiding this comment

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

@dmocko I had a chance to check on this today. It looks like the lines related to glacier points are copied from HRLDAS. Is there a reason we shouldn't run MMF for glacier/ice points? If there is a scientific justification for not running this way, we could raise this at the next Noah-MP telecon.

@dmocko
Copy link
Contributor

dmocko commented Aug 14, 2024

Once @TimLahmers changes the urban type from my most recent comment, can you (Tim) please re-run your testcase?

I now get identical results from the RELSMC output, so that issue is resolved. Thanks!

Otherwise, I am satisfied with the code, and after the urban type fix and Tim re-running the testcase, we are ready
for @jvgeiger to finish his review. Jim will likely remove many commented-out lines (including the comments about hard-coded values for vegetation and soil types, as well as debugging print statements). Then he can compare to Tim's updated testcase output with the latest code.

@TimLahmers
Copy link
Author

@dmocko I just re-ran the test case, and it is in the same directory as before: /discover/nobackup/projects/ualbmap21/tlahmers/MMF_DemoCases_062023/LIS_MMF_CONUSvalid_RELSMCbug/OUTPUT.SIMGM.CONUS_RelSMC_Valid

The code change has been committed.

@dmocko
Copy link
Contributor

dmocko commented Sep 27, 2024

Many thanks for @TimLahmers for re-running the testcase a couple times over the past couple weeks to address minor
issues with the testcase (but not with the code).

The latest testcases are here:
LDT: /discover/nobackup/tlahmers/SHARE/MMF_Testcases/LDT_run
LIS: /discover/nobackup/tlahmers/SHARE/MMF_Testcases/LIS_run

Note that this PR is only for LIS, so you only need to run/use the LIS testcase.

However, just for completeness, I successfully replicated both the LIS and the LDT testcase with identical results.

Further, I re-tested other Noah-MP-4.0.1 output variables using the new code but with SIMGM groundwater, and found
that no other variables are affected (again, identical results). So I confirm that this PR will not affect non-MMF output.

Finally, I did another complete code review, and believe that this PR is ready to merge - once @jvgeiger cleans up the
code comments to his satisfaction.

@jvgeiger - Please finish up and merge this PR once you have the time. Thanks!

@dmocko
Copy link
Contributor

dmocko commented Sep 27, 2024

@jvgeiger - as long as you are cleaning up code, can you also remove the "NS" from this line before the PR is merged?

https://github.com/NASA-LIS/LISF/blob/master/lis/configs/lis.config.adoc?plain=1#L8306

Also @TimLahmers - what is the recommended number of "Halo size" that should be used? We should also specify that
halos must be turned on when using MMF option 5 (probably put it as a new sentence within lines 8293 to 8297 above).

@TimLahmers
Copy link
Author

@dmocko @jvgeiger All of the tests we performed with MMF used a halo size of 3. Analysis from the earlier development stages (right after we fixed the bugs with the gather/scatter routines with halos) showed minimal round-off errors with that configuration compared to serial runs.

@dmocko dmocko added the enhancement New feature or request label Nov 5, 2024
@dmocko dmocko requested a review from jvgeiger November 5, 2024 17:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Incorporating Miguez-Macho Fan (MMF) Groundwater parameterization scheme to the Noah MP land surface model
5 participants