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

Add ocean wetting-and-drying ramp feature #5590

Merged

Conversation

cbegeman
Copy link
Contributor

@cbegeman cbegeman commented Apr 6, 2023

This PR enhances the existing wetting-and-drying algorithm using an approach from O'Dea et al. 2020 (doi:10.1016/j.ocemod.2020.101708). Instead of zeroing out normalVelocity and normalVelocity tendencies in cells where the projected layerThickness drops below the user-defined minimum, this method ramps down the normalVelocity and its tendencies between a range of layerThicknesses.

Wetting-and-drying is currently only used in standalone ocean runs.

[BFB]

@xylar xylar requested review from sbrus89 and xylar April 7, 2023 00:30
@xylar xylar added mpas-ocean BFB PR leaves answers BFB labels Apr 7, 2023
@xylar xylar removed their request for review April 7, 2023 00:32
@sbrus89
Copy link
Contributor

sbrus89 commented Apr 10, 2023

@cbegeman, while testing this in debug mode on compy, I ran into an out-of-bounds error for the dam-break case. The error was from line 677:

if (config_disable_tr_all_tend) then
num_tracers = size(activeTracersNew, dim=2)
do iTracer = 1, num_tracers
!$omp parallel
!$omp do schedule(runtime)
do iCell = 1, nCells
activeTracersNew(iTracer, :, iCell) = activeTracersCur(iTracer, :, iCell)
end do
!$omp end do
!$omp end parallel
end do
end if

I think num_tracers should be calculated as num_tracers = size(activeTracersNew, dim=1).

@cbegeman
Copy link
Contributor Author

@sbrus89 Thanks for catching that! Totally a typo. That bug was introduced with #5519 and is now fixed by fc4375d

@sbrus89
Copy link
Contributor

sbrus89 commented Apr 10, 2023

Thanks for fixing that @cbegeman! Also, testing in debug I see an error in the single layer drying slope case:

forrtl: error (72): floating overflow
Image              PC                Routine            Line        Source    
libpnetcdf.so.4    00002B8A5B1C3B1C  for__signal_handl     Unknown  Unknown
libpthread-2.17.s  00002B8A5D1715D0  Unknown               Unknown  Unknown
ocean_model        000000000367CBBC  mpas_io_mp_mpas_i        2496  mpas_io.F
ocean_model        00000000036A6657  mpas_io_mp_mpas_i        3052  mpas_io.F
ocean_model        000000000378571A  mpas_io_streams_m        4097  mpas_io_streams.F
ocean_model        00000000038188BC  mpas_stream_manag        3382  mpas_stream_manager.F
ocean_model        0000000003813BE7  mpas_stream_manag        2819  mpas_stream_manager.F
ocean_model        0000000001A14D6A  ocn_forward_mode_         750  mpas_ocn_forward_mode.F
ocean_model        00000000019D5E30  ocn_core_mp_ocn_c         111  mpas_ocn_core.F
ocean_model        00000000004179B5  mpas_subdriver_mp         358  mpas_subdriver.F
ocean_model        00000000004126D4  MAIN__                     20  mpas.F
ocean_model        0000000000412612  Unknown               Unknown  Unknown
libc-2.17.so       00002B8A5DA923D5  __libc_start_main     Unknown  Unknown
ocean_model        0000000000412529  Unknown               Unknown  Unknown

I'm having a little more trouble tracking the source of this one down. Similar to the last issue, I don't think this has anything to do with this PR.

@cbegeman
Copy link
Contributor Author

cbegeman commented Apr 10, 2023

@sbrus89 I can look into that as well. I haven't run these tests on compy recently. Do you know if that error is emerging when config_disable_tr_all_tend is true, false or both?

@sbrus89
Copy link
Contributor

sbrus89 commented Apr 18, 2023

The above error was for config_disable_tr_all_tend=.true. for config_disable_tr_all_tend=.false. I get

forrtl: severe (408): fort: (2): Subscript #1 of the array TRACERCUR has value 2 which is greater than the upper bound of 1

Image              PC                Routine            Line        Source    
libpnetcdf.so.4    00002B53DB25D6B2  for_emit_diagnost     Unknown  Unknown
ocean_model        0000000002EAF9E6  ocn_tracer_advect         700  mpas_ocn_tracer_advection_mono.F
libiomp5.so        00002B53DD840713  __kmp_invoke_micr     Unknown  Unknown
libiomp5.so        00002B53DD7CF6A3  __kmp_fork_call       Unknown  Unknown
libiomp5.so        00002B53DD79663D  __kmpc_fork_call      Unknown  Unknown
ocean_model        0000000002E85F69  ocn_tracer_advect         691  mpas_ocn_tracer_advection_mono.F
ocean_model        000000000267C43F  ocn_tracer_advect         102  mpas_ocn_tracer_advection.F
ocean_model        0000000002691DD0  ocn_tendency_mp_o        1097  mpas_ocn_tendency.F
ocean_model        00000000027D5F2E  ocn_time_integrat        1075  mpas_ocn_time_integration_rk4.F
ocean_model        00000000027BDEF1  ocn_time_integrat         523  mpas_ocn_time_integration_rk4.F
ocean_model        0000000001AB65DD  ocn_time_integrat         131  mpas_ocn_time_integration.F
ocean_model        0000000001A1493C  ocn_forward_mode_         728  mpas_ocn_forward_mode.F
ocean_model        00000000019D5E30  ocn_core_mp_ocn_c         111  mpas_ocn_core.F
ocean_model        00000000004179B5  mpas_subdriver_mp         358  mpas_subdriver.F
ocean_model        00000000004126D4  MAIN__                     20  mpas.F
ocean_model        0000000000412612  Unknown               Unknown  Unknown
libc-2.17.so       00002B53DDB303D5  __libc_start_main     Unknown  Unknown
ocean_model        0000000000412529  Unknown               Unknown  Unknown

@cbegeman
Copy link
Contributor Author

@sbrus89 Thanks for looking into this.

I will plan to debug the config_disable_tr_all_tend=.true. case

There seems to be an assumption in ocn_tracer_advection_mono_tend that nVertLevels > 1 that leads to the above error, so I don't think we'll want to run with config_disable_tr_all_tend=.false. for these single layer test cases.

@cbegeman
Copy link
Contributor Author

cbegeman commented Apr 25, 2023

@sbrus89 I finally made the time to figure this out and it comes down to the fact that the RK4 changes I made in #5519 allow activeTracers to be supported (but disabled) but not debugTracers. To prevent this from happening in the future I will:

@cbegeman cbegeman force-pushed the ocn/add-wetting-drying-ramp-feature branch from feab656 to 73b90f7 Compare April 26, 2023 03:15
@cbegeman
Copy link
Contributor Author

@sbrus89 Ready for your re-review with MPAS-Dev/compass#619

@sbrus89
Copy link
Contributor

sbrus89 commented Apr 26, 2023

@cbegeman - thanks I'll test it out.

Copy link
Contributor

@sbrus89 sbrus89 left a comment

Choose a reason for hiding this comment

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

@cbegeman, this passes the drying slope and dam break cases with debug flags on compy. Thanks for putting this feature in!

@cbegeman
Copy link
Contributor Author

@sbrus89 Thanks for your review and testing!

jonbob added a commit that referenced this pull request May 3, 2023
… (PR #5590)

Add ocean wetting-and-drying ramp feature

This PR enhances the existing wetting-and-drying algorithm using an
approach from O'Dea et al. 2020. Instead of zeroing out normalVelocity
and normalVelocity tendencies in cells where the projected
layerThickness drops below the user-defined minimum, this method ramps
down the normalVelocity and its tendencies between a range of
layerThicknesses.

Wetting-and-drying is currently only used in standalone ocean runs.

[BFB]
@jonbob
Copy link
Contributor

jonbob commented May 3, 2023

passes:

  • SMS_D_Ld3.T62_oQU120.CMPASO-IAF.chrysalis_intel
  • SMS_D_Ld1.ne30pg2_EC30to60E2r2.WCYCL1850.chrysalis_intel.allactive-wcprod
  • ERS.ne11_oQU240.WCYCL1850NS.chrysalis_intel

merged to next

@jonbob jonbob merged commit c9a0d20 into E3SM-Project:master May 5, 2023
@jonbob
Copy link
Contributor

jonbob commented May 5, 2023

merged to master

@cbegeman
Copy link
Contributor Author

cbegeman commented May 8, 2023

@jonbob Thank you for your testing! Happy to have this merged!

cbegeman added a commit to MPAS-Dev/compass that referenced this pull request Jun 1, 2023
Add ocean wetting-and-drying ramp tests

This PR is for testing the wetting-and-drying ramp feature introduced in E3SM-Project/E3SM#5590
gcapodag added a commit to gcapodag/E3SM that referenced this pull request Jun 20, 2023
Integrated latest wetting and drying changes
from  E3SM-Project#5590
Added/modified code to make it usable for LTS
as well and not just RK4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BFB PR leaves answers BFB mpas-ocean
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants