From 6387dc4b78d92517018a9bf0e4c7bfa2762ed3b1 Mon Sep 17 00:00:00 2001 From: Hong-Yi Li Date: Mon, 26 Aug 2024 18:37:51 -0700 Subject: [PATCH 1/2] Fixing a bug causing model crash by avoiding negative channel storage --- .../src/riverroute/MOSART_physics_mod.F90 | 20 ++++--------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/components/mosart/src/riverroute/MOSART_physics_mod.F90 b/components/mosart/src/riverroute/MOSART_physics_mod.F90 index cad978577cda..132aff634cc2 100644 --- a/components/mosart/src/riverroute/MOSART_physics_mod.F90 +++ b/components/mosart/src/riverroute/MOSART_physics_mod.F90 @@ -681,7 +681,9 @@ subroutine Euler ! subcycling within MOSART ends ! check for negative channel storage - if (negchan < -1.e-10) then + if (negchan < -1.e-10 .and. negchan >= -1.e-8) then + write(iulog,*) 'Warning: Small negative channel storage found! ',negchan + elseif(negchan < -1.e-8) then write(iulog,*) 'Error: Negative channel storage found! ',negchan call shr_sys_abort('mosart: negative channel storage') endif @@ -876,11 +878,7 @@ subroutine Routing_KW(iunit, nt, theDeltaT) TRunoff%erout(iunit,nt) = -TRunoff%vr(iunit,nt) * TRunoff%mr(iunit,nt) if(-TRunoff%erout(iunit,nt) > TINYVALUE .and. TRunoff%wr(iunit,nt) + & (TRunoff%erlateral(iunit,nt) + TRunoff%erin(iunit,nt) + TRunoff%erout(iunit,nt)) * theDeltaT < TINYVALUE) then - if (sediflag) then - TRunoff%erout(iunit,nt) = -(TRunoff%erlateral(iunit,nt) + TRunoff%erin(iunit,nt) + TRunoff%wr(iunit,nt)*MaxStorageDepleted/ theDeltaT) - else - TRunoff%erout(iunit,nt) = -(TRunoff%erlateral(iunit,nt) + TRunoff%erin(iunit,nt) + TRunoff%wr(iunit,nt)/ theDeltaT) - end if + TRunoff%erout(iunit,nt) = -(TRunoff%erlateral(iunit,nt) + TRunoff%erin(iunit,nt) + TRunoff%wr(iunit,nt)*MaxStorageDepleted/ theDeltaT) if(TRunoff%mr(iunit,nt) > 0._r8) then TRunoff%vr(iunit,nt) = -TRunoff%erout(iunit,nt) / TRunoff%mr(iunit,nt) end if @@ -918,16 +916,6 @@ subroutine Routing_KW(iunit, nt, theDeltaT) TRunoff%dwr(iunit,nt) = TRunoff%erlateral(iunit,nt) + TRunoff%erin(iunit,nt) + TRunoff%erout(iunit,nt) + temp_gwl - !if(TRunoff%wr(iunit,nt) < TINYVALUE .and. abs(TRunoff%erout(iunit,nt))> TINYVALUE) then - ! write(unit=1111,fmt="(i10, 4(e20.11))") iunit, TRunoff%wr(iunit,nt), TRunoff%erout(iunit,nt), TRunoff%erlateral(iunit,nt) + TRunoff%erin(iunit,nt), TRunoff%dwr(iunit,nt) - ! write(unit=1112,fmt="(2(i10), 4(e20.11))") iunit, TUnit%mask(iunit), TRunoff%vr(iunit,nt), TUnit%rlen(iunit), TUnit%rwidth(iunit), TUnit%areaTotal2(iunit)/TUnit%rwidth(iunit)/TUnit%rlen(iunit) - !end if - -! if(iunit==490 .and. nt==1) then -! write(unit=1111,fmt="(3(e20.11), 5(f12.4))") TUnit%areaTotal2(iunit),TUnit%areaTotal(iunit),TUnit%area(iunit),TUnit%rdepth(iunit), TUnit%rwidth(iunit), TUnit%rslp(iunit), TUnit%nr(iunit), TUnit%nt(iunit) -! write(unit=1112,fmt="(6(e20.11))") TRunoff%wr(iunit,nt), TRunoff%dwr(iunit,nt), TRunoff%erlateral(iunit,nt), TRunoff%erin(iunit,nt), TRunoff%erout(iunit,nt), temp_gwl -! end if - ! check for stability ! if(TRunoff%vr(iunit,nt) < -TINYVALUE .or. TRunoff%vr(iunit,nt) > 30) then ! write(iulog,*) "Numerical error inRouting_KW, ", iunit,nt,TRunoff%vr(iunit,nt) From b87fd0b56893b0af13f6629e94572ecaafa5fdac Mon Sep 17 00:00:00 2001 From: Donghui Xu Date: Thu, 7 Nov 2024 14:33:06 -0800 Subject: [PATCH 2/2] change the coupling period of MOSART to be half hour in land river two-way coupling to avoid time step mismatch --- .../testdefs/testmods_dirs/elm/lnd_rof_2way/shell_commands | 2 ++ .../testdefs/testmods_dirs/elm/lnd_rof_2way/user_nl_mosart | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 components/elm/cime_config/testdefs/testmods_dirs/elm/lnd_rof_2way/shell_commands diff --git a/components/elm/cime_config/testdefs/testmods_dirs/elm/lnd_rof_2way/shell_commands b/components/elm/cime_config/testdefs/testmods_dirs/elm/lnd_rof_2way/shell_commands new file mode 100644 index 000000000000..6eeec0102e5f --- /dev/null +++ b/components/elm/cime_config/testdefs/testmods_dirs/elm/lnd_rof_2way/shell_commands @@ -0,0 +1,2 @@ +./xmlchange LND_NCPL=48 +./xmlchange ROF_NCPL=48 \ No newline at end of file diff --git a/components/elm/cime_config/testdefs/testmods_dirs/elm/lnd_rof_2way/user_nl_mosart b/components/elm/cime_config/testdefs/testmods_dirs/elm/lnd_rof_2way/user_nl_mosart index c7a09f76ae42..fe460362de68 100644 --- a/components/elm/cime_config/testdefs/testmods_dirs/elm/lnd_rof_2way/user_nl_mosart +++ b/components/elm/cime_config/testdefs/testmods_dirs/elm/lnd_rof_2way/user_nl_mosart @@ -1 +1,2 @@ -inundflag = .true. \ No newline at end of file +inundflag = .true. +delt_mosart = 1800 \ No newline at end of file