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

Feature/snow incr noah #568

Merged

Conversation

ClaraDraper-NOAA
Copy link
Contributor

This addresses issue #561
Addition of routines to add snow depth increments from JEDI output increment file to the sfc restarts. Includes screening to apply updates over land only and adjusting SWE to match the snow depth analysis. Format follows previous approach for soil temperature increments.
Associated changes:

  • made arguments to read_data optional so could use same routine to
    read JEDI increment field
  • changed confusing variable names for SNO (-> SWE) and SWE -> (SND)
  • Added new routines to 1) add snow depth increments, and ii) adjust SWE increments accordingly.
  • Updated the land mask already used by the soil temperature DA to include land-ice

Note: no action is taken if grid cell is a land-ice point. The current snow DA limits snow depth and SWE to be above a minimum value over land-ice, which is also done at every Noah call, so I skipped it.

Also: this won't work with a fractional grid cells, but I don't know enough about how that's handled in the model to address it. I suggest we address this next.

to the sfc restarts. Includes screening to apply updates over land only
and adjusting SWE to match the snow depth analysis. Also:
* made arguments to read_data optional so could use same routine to
  read JEDI increment field
* changed confusing variable names for SNO (-> SWE) and SWE -> (SND)
@ClaraDraper-NOAA
Copy link
Contributor Author

I don't seem to be able to add reviewers. @barlage and @jiaruidong2017 should be included.

@GeorgeGayno-NOAA
Copy link
Collaborator

@ClaraDraper-NOAA Do you have a canned case to test this option?

@ClaraDraper-NOAA
Copy link
Contributor Author

@GeorgeGayno-NOAA apologies - I knew there was something I'd forgotten to include, but couldn't figure out what it was. The test case is on hera (see readme for instructions)
/scratch2/BMC/gsienkf/Clara.Draper/DA_test_cases/snow/add_incr/

@GeorgeGayno-NOAA
Copy link
Collaborator

I see the first regression test is failing:

 ADJUST TREF FROM GSI INCREMENT
mon1,mon2,rjday,wei1,wei2=   7   8  211.000    0.532    0.468
 mlat_sst, mlon_sst :         2160        4320
  sstclm : sstclm
  sstclm : sstclm

 MAXIMUM SEARCH IS           20  GAUSSIAN POINTS.

forrtl: severe (174): SIGSEGV, segmentation fault occurred
Image              PC                Routine            Line        Source
global_cycle       000000000091779D  Unknown               Unknown  Unknown
libpthread-2.17.s  00002AC7D9E34630  Unknown               Unknown  Unknown
global_cycle       0000000000411674  adjust_nsst_             1009  cycle.f90
global_cycle       000000000040ACD5  sfcdrv_                   569  cycle.f90
global_cycle       0000000000407A8B  MAIN__                    172  cycle.f90
global_cycle       000000000040705E  Unknown               Unknown  Unknown
libc-2.17.so       00002AC7DACFF555  __libc_start_main     Unknown  Unknown
global_cycle       0000000000406F69  Unknown               Unknown  Unknown

@ClaraDraper-NOAA
Copy link
Contributor Author

Let me have a look, and fix it.

@GeorgeGayno-NOAA
Copy link
Collaborator

@GeorgeGayno-NOAA apologies - I knew there was something I'd forgotten to include, but couldn't figure out what it was. The test case is on hera (see readme for instructions)
/scratch2/BMC/gsienkf/Clara.Draper/DA_test_cases/snow/add_incr/

Great. I was able to get it to run. This should be made into a consistency/regression test?

@GeorgeGayno-NOAA
Copy link
Collaborator

I see you added a new variable - LND_SNO_FILE - to the fort.37 namelist. Don't forget to update ./ush/global_cycle.sh accordingly:

https://github.com/ClaraDraper-NOAA/UFS_UTILS/blob/feature/snow_incr_Noah/ush/global_cycle.sh#L388

@GeorgeGayno-NOAA
Copy link
Collaborator

This addresses issue #561
Addition of routines to add snow depth increments from JEDI output increment file to the sfc restarts. Includes screening to apply updates over land only and adjusting SWE to match the snow depth analysis. Format follows previous approach for soil temperature increments.
Associated changes:

  • made arguments to read_data optional so could use same routine to
    read JEDI increment field
  • changed confusing variable names for SNO (-> SWE) and SWE -> (SND)
  • Added new routines to 1) add snow depth increments, and ii) adjust SWE increments accordingly.
  • Updated the land mask already used by the soil temperature DA to include land-ice

Note: no action is taken if grid cell is a land-ice point. The current snow DA limits snow depth and SWE to be above a minimum value over land-ice, which is also done at every Noah call, so I skipped it.

Also: this won't work with a fractional grid cells, but I don't know enough about how that's handled in the model to address it. I suggest we address this next.

There is an issue open to convert global_cycle for fractional grids: #549

@ClaraDraper-NOAA
Copy link
Contributor Author

@GeorgeGayno-NOAA apologies - I knew there was something I'd forgotten to include, but couldn't figure out what it was. The test case is on hera (see readme for instructions)
/scratch2/BMC/gsienkf/Clara.Draper/DA_test_cases/snow/add_incr/

Great. I was able to get it to run. This should be made into a consistency/regression test?

I think this should be a regression test. Or I could create a single RT with both the soil and snow updates? (this doesn't currently make sense scientifically, but would exercise both bits of code in a single test).

@ClaraDraper-NOAA
Copy link
Contributor Author

I see you added a new variable - LND_SNO_FILE - to the fort.37 namelist. Don't forget to update ./ush/global_cycle.sh accordingly:

https://github.com/ClaraDraper-NOAA/UFS_UTILS/blob/feature/snow_incr_Noah/ush/global_cycle.sh#L388

Will do.

@GeorgeGayno-NOAA
Copy link
Collaborator

@GeorgeGayno-NOAA apologies - I knew there was something I'd forgotten to include, but couldn't figure out what it was. The test case is on hera (see readme for instructions)
/scratch2/BMC/gsienkf/Clara.Draper/DA_test_cases/snow/add_incr/

Great. I was able to get it to run. This should be made into a consistency/regression test?

I think this should be a regression test. Or I could create a single RT with both the soil and snow updates? (this doesn't currently make sense scientifically, but would exercise both bits of code in a single test).

Let's try separate tests - global_cycle runs quickly. I can help with machines you don't have access to.

@GeorgeGayno-NOAA
Copy link
Collaborator

Although not specific to this PR, I see several doxygen warnings for ./lsm_routines.fd/noah.fd/sflx_snippet.f90. I am able to fix them by removing these comment lines:

--- a/sorc/lsm_routines.fd/noah.fd/sflx_snippet.f90
+++ b/sorc/lsm_routines.fd/noah.fd/sflx_snippet.f90
@@ -25,13 +25,7 @@
 !! @param[in] bexp B exponent
 !! @param[in] psis Saturated matric potential
 !! @param[out]  liqwat Output liquid soil moisture
-      subroutine frh2o                                                  &
-!  ---  inputs:
-     &     ( tkelv, smc, sh2o, smcmax, bexp, psis,                      &
-!  ---  outputs:
-     &       liqwat                                                     &
-     &     )
-
+      subroutine frh2o ( tkelv, smc, sh2o, smcmax, bexp, psis,liqwat)
 ! ===================================================================== !

@ClaraDraper-NOAA
Copy link
Contributor Author

This addresses issue #561
Addition of routines to add snow depth increments from JEDI output increment file to the sfc restarts. Includes screening to apply updates over land only and adjusting SWE to match the snow depth analysis. Format follows previous approach for soil temperature increments.
Associated changes:

  • made arguments to read_data optional so could use same routine to
    read JEDI increment field
  • changed confusing variable names for SNO (-> SWE) and SWE -> (SND)
  • Added new routines to 1) add snow depth increments, and ii) adjust SWE increments accordingly.
  • Updated the land mask already used by the soil temperature DA to include land-ice

Note: no action is taken if grid cell is a land-ice point. The current snow DA limits snow depth and SWE to be above a minimum value over land-ice, which is also done at every Noah call, so I skipped it.
Also: this won't work with a fractional grid cells, but I don't know enough about how that's handled in the model to address it. I suggest we address this next.

There is an issue open to convert global_cycle for fractional grids: #549

OK. I suspect that the way I've created the mask in calculate_landinc_mask will need to be revised.

@ClaraDraper-NOAA
Copy link
Contributor Author

@GeorgeGayno-NOAA I fixed the bug (that took a bit of searching!), and updated the global_cycle_driver scripts with the new namelist variable. The global_cycle regression tests now pass. I'm creating an rg test on hera now. I have an orion account now, so I can do that one too.

/scratch2/BMC/gsienkf/Clara.Draper/tmp/reg-tests/global-cycle/global_cycle
@ClaraDraper-NOAA
Copy link
Contributor Author

@GeorgeGayno-NOAA I've done the regression_tests for orion and hera. The files you'll need are on here here:

/scratch2/BMC/gsienkf/Clara.Draper/tmp/reg-tests/global-cycle/global_cycle

I just ran the tests on orion using the baseline for the new test from hera, and they passed.

Note the test makes no science sense, but it should be enough to exercise the code. I used increment files generated during winter (so that the increment would be non-zero) and applied them to the pre-existing background files in boreal summer. If you want something more scientifically sound, we can replace the background for that test with ones for the same day as the increments.

I think everything else is ready to go?

@GeorgeGayno-NOAA
Copy link
Collaborator

@GeorgeGayno-NOAA I've done the regression_tests for orion and hera. The files you'll need are on here here:

/scratch2/BMC/gsienkf/Clara.Draper/tmp/reg-tests/global-cycle/global_cycle

I just ran the tests on orion using the baseline for the new test from hera, and they passed.

Note the test makes no science sense, but it should be enough to exercise the code. I used increment files generated during winter (so that the increment would be non-zero) and applied them to the pre-existing background files in boreal summer. If you want something more scientifically sound, we can replace the background for that test with ones for the same day as the increments.

I think everything else is ready to go?

I was able to run your tests on Hera. If you prefer to use winter background files, I have no problem with keeping multiple directories of input data. We already do that for other regression tests.

@GeorgeGayno-NOAA
Copy link
Collaborator

@ClaraDraper-NOAA I will check in some minor script updates to your branch.

@GeorgeGayno-NOAA
Copy link
Collaborator

@ClaraDraper-NOAA I just merged the latest updates from develop to your branch. I see the consistency test driver scripts need to be updated for Orion, Jet, and WCOSS. I can do WCOSS.

@ClaraDraper-NOAA
Copy link
Contributor Author

Thanks @GeorgeGayno-NOAA. I'll do orion and jet later today.

@GeorgeGayno-NOAA
Copy link
Collaborator

Thanks @GeorgeGayno-NOAA. I'll do orion and jet later today.

I have Jet done. Will check in next. Orion is down today.

@GeorgeGayno-NOAA
Copy link
Collaborator

@ClaraDraper-NOAA Other than a few minor prolog updates, I have no further comments. I did not look closely at the science behind your updates. I will let @barlage and @jiaruidong2017 check that.

@ClaraDraper-NOAA
Copy link
Contributor Author

Thanks @GeorgeGayno-NOAA. I just pushed the changes to the prologue.

Copy link

@jiaruidong2017 jiaruidong2017 left a comment

Choose a reason for hiding this comment

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

It's good to me for this PR by adding the snow increments with a proposed basic method. It may require some detailed considerations after the snow increments are available in the future analysis.

@GeorgeGayno-NOAA
Copy link
Collaborator

Thanks @jiaruidong2017

@ClaraDraper-NOAA I will merge the latest updates from 'develop' to your branch. Then merge.

Copy link
Collaborator

@barlage barlage left a comment

Choose a reason for hiding this comment

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

A few minor comments.

! to the changes made. Need to store bacground, apply the increments, then make
! secondart adjustments. When updating more than one state, be careful about the
! orfer if increments and secondary adjustments.
LANDINC_MASK_FG = LANDINC_MASK

Copy link
Collaborator

Choose a reason for hiding this comment

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

I assume what is happening here is that soil updates are not done where there is snow. Is that stated anywhere? If not, it would be good to have in a comment.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@barlage I moved the comments below from near the do loop, to the comment block at the top of the add_increment_soil functions.

!! Does not make a temperature update if snow differ
!! between fg and anal (allow correction of snow to
!! address temperature error first), or if snow is present
!! (will eventually updating of snow temperature in this case)

The code also counts, and prints out the number of locations under each case.

STC_BCK = STCFCS
SMC_BCK = SMCFCS ! not used yet.
SLC_BCK = SLCFCS ! not used yet.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Any reason to not generalize this for all three soil states now?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Not necessary, just wondering if it saves any work in the future.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Doing the soil moisture will require knowledge of the soil properties (for re-gridding increments), so I'll need to add them to the increment file output by the GSI. There's a bit of work to do there, so I'm not planning to do it yet (and may even be able to old off until we're using JEDI).

write(*,'(a,i8)') ' (not updated) soil grid cells, no soil nearby on gsi grid = ',nnosoilnear
write(*,'(a,i8)') ' (not updated) soil grid cells, change in presence of snow = ', nsnowchange
write(*,'(a,i8)') ' (not updated yet) snow grid cells = ', nsnowupd
write(*,'(a,i8)') ' grid cells, without soil of snow = ', nother
write(*,'(a,i8)') ' grid cells, without soil of snow = ', nother
Copy link
Collaborator

Choose a reason for hiding this comment

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

"of" to "or"?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

should be "or". fixed.

!> Calculate soil mask for land on model grid.
!! Output is 1 - soil, 2 - snow-covered, 0 - land ice or not land.
!! @param[in] lensfc Total numberof points for the cubed-sphere tile.
!> Add soil snow depth increment to model snow depth state,
Copy link
Collaborator

Choose a reason for hiding this comment

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

remove "soil"? Also, "genative", "globall" and "screend" below.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed.

do i=1,lensfc
if (swe(i) .GT. 0.001) then
mask(i) = 2
if (smc(i) .LT. 1.0) then
Copy link
Collaborator

Choose a reason for hiding this comment

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

is this to screen water points? what happens for fractional grid? I don't know myself.

Copy link
Collaborator

Choose a reason for hiding this comment

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

A soil moisture of 1.0 indicates permanent land ice. I think @ClaraDraper-NOAA does not want to apply the updates at those points.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@barlage I'm not sure what happens for the fractional grid either. I flagged to @GeorgeGayno-NOAA that I didn't think my code would work for fractional grid cells, and I think he's planning to this update this when all of UFS_UTILS is updated?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I have an issue open to convert this program to process fractional grids - #549.

real :: dens_mean

! density = swe/snd
density = swe/snd
Copy link
Collaborator

Choose a reason for hiding this comment

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

any chance of a divide by zero here?

Choose a reason for hiding this comment

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

I think they called the "calc_density" subroutine where the snow present.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We don't use any of these values is there's no snow, but "no snow" is based on SWE, so it could be possible if we somehow wound up with 0.0 snow depth, and non-zero SWE. I replaced that code with a loop, checking on the SND value, just to make sure.

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 will hold off merging until @ClaraDraper-NOAA addresses the latest comments.

@barlage @GeorgeGayno-NOAA Just pushed responses to Mike's comments. I'll keep an eye on the automatic checks ( there's a small code change to the snow density calculation, but it passed the snow increment reg_test)

@GeorgeGayno-NOAA
Copy link
Collaborator

I will hold off merging until @ClaraDraper-NOAA addresses the latest comments.

@GeorgeGayno-NOAA
Copy link
Collaborator

GeorgeGayno-NOAA commented Sep 2, 2021

@ClaraDraper-NOAA Your latest updates to not change the regression tests. I will merge tomorrow morning.

@GeorgeGayno-NOAA GeorgeGayno-NOAA self-requested a review September 2, 2021 22:00
@GeorgeGayno-NOAA GeorgeGayno-NOAA merged commit dea8dd9 into ufs-community:develop Sep 3, 2021
@ClaraDraper-NOAA ClaraDraper-NOAA deleted the feature/snow_incr_Noah branch August 7, 2024 14:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants