CABLE-LSM / CABLE-Trac-archive

Archive CABLE Trac contents as issues
Other
0 stars 0 forks source link

Bug fixes to groundwater scheme #213

Open penguian opened 5 years ago

penguian commented 5 years ago

keyword_groundwater_maygit type_defect | by mgk576


There are three bug fixes for the GW scheme:

  1. In the subroutine soil_snow_gw in cable_gw_hydro.F90,:

There is a bug which means the model keeps losing water, the fix is:

do k=1,ms do i=1,mp ssnow%wbliq(i,k) = ssnow%wb(i,k) - ssnow%wbice(i,k)

Should be:

do k=1,ms do i=1,mp ssnow%wbliq(i,k) = ssnow%wb(i,k) - den_rat*ssnow%wbice(i,k)

where den_rat = real(C%density_ice/C%density_liq,r_2).

  1. In mass_balance in cable_checks.F90:

There is a bug so the mass balance does not add up correctly:

REAL(r_2), DIMENSION(:,:,:),POINTER, SAVE :: bwb ! volumetric soil moisture

IF(ktau==1) THEN ALLOCATE( bwb(mp,ms,2) ) ! initial vlaue of soil moisture bwb(:,:,1)=ssnow%wb bwb(:,:,2)=ssnow%wb delwb(:) = 0. ELSE ! Calculate change in soil moisture b/w timesteps: IF(MOD(REAL(ktau),2.0)==1.0) THEN ! if odd timestep bwb(:,:,1)=ssnow%wb DO k=1,mp ! current smoist - prev tstep smoist delwb(k) = SUM((bwb(k,:,1) &

Should become:

REAL(r_2), DIMENSION(:,:,:),POINTER, SAVE :: bwb ! volumetric soil moisture REAL(r_2), DIMENSION(:,:),POINTER, SAVE :: bwb_gw ! volumetric gw soil moisture, New addition

IF(ktau==1) THEN ALLOCATE( bwb(mp,ms,2) ) ALLOCATE( bwb_gw(mp,2) ) ! New addition ! initial vlaue of soil moisture bwb(:,:,1)=ssnow%wb bwb(:,:,2)=ssnow%wb bwb_gw(:,1)=ssnow%GWwb ! New addition bwb_gw(:,2)=ssnow%GWwb ! New addition delwb(:) = 0. ELSE

IF ( cable_user%GW_MODEL) THEN ! New block addition

  ! Calculate change in soil moisture b/w timesteps:
  IF(MOD(REAL(ktau),2.0)==1.0) THEN         ! if odd timestep
     bwb(:,:,1)=ssnow%wb
     DO k=1,mp           ! current smoist - prev tstep smoist
        delwb(k) = ( SUM( (bwb(k,:,1) - bwb(k,:,2))*soil%zse ) +         &
                     (bwb_gw(k,1) - bwb_gw(k,2))*soil%GWdz(k) ) *1000.0
     END DO
  ELSE IF(MOD(REAL(ktau),2.0)==0.0) THEN    ! if even timestep
     bwb(:,:,2)=ssnow%wb
     DO k=1,mp           !  current smoist - prev tstep smoist
        delwb(k) = ( SUM( (bwb(k,:,2) - bwb(k,:,1))*soil%zse ) +         &
                     (bwb_gw(k,2) -bwb_gw(k,1))*soil%GWdz(k) ) *1000.0
     END DO
  END IF

ELSE

  ! Calculate change in soil moisture b/w timesteps:
  IF(MOD(REAL(ktau),2.0)==1.0) THEN         ! if odd timestep
     bwb(:,:,1)=ssnow%wb
     DO k=1,mp           ! current smoist - prev tstep smoist
        delwb(k) = SUM((bwb(k,:,1)                                         &
                       - (bwb(k,:,2)))*soil%zse)*1000.0
     END DO
  ELSE IF(MOD(REAL(ktau),2.0)==0.0) THEN    ! if even timestep
     bwb(:,:,2)=ssnow%wb
     DO k=1,mp           !  current smoist - prev tstep smoist
        delwb(k) = SUM((bwb(k,:,2)                                         &
                       - (bwb(k,:,1)))*soil%zse)*1000.0
     END DO
  END IF

END IF END IF

  1. Removing the qrecharge

There is a bug so the mass balance does not add up correctly:

bal%wbal = REAL(met%precip - canopy%delwc - ssnow%snowd+ssnow%osnowd &

Should become ...

IF ( cable_user%GW_MODEL) THEN bal%wbal = REAL(met%precip - canopy%delwc - ssnow%snowd+ssnow%osnowd - & ssnow%runoff-(canopy%fevw+canopy%fevc + & canopy%fes/ssnow%cls)dels/air%rlam - delwb) ELSE bal%wbal = REAL(met%precip - canopy%delwc - ssnow%snowd+ssnow%osnowd - & ssnow%runoff-(canopy%fevw+canopy%fevc + & canopy%fes/ssnow%cls)dels/air%rlam - delwb - & ssnow%qrecharge) END IF

Please note, there is an SLI block here and we think the groundwater thing needs to go in there as well.

There are also fixes to the grid info file but we will make a seperate ticket.


Issue migrated from trac:213 at 2023-11-27 11:28:08 +1100

penguian commented 2 years ago

@jxs599@nci.org.au commented


Asked Martin if he has a branch with all these changes

penguian commented 1 year ago

@ccc561@nci.org.au changed keywords from groundwater to groundwater maygit