Skip to content

Commit

Permalink
Merge pull request #235 from zhangsp8/master
Browse files Browse the repository at this point in the history
Modifications to lateral flow related & Functionality of storing vector in one file
  • Loading branch information
CoLM-SYSU authored Jan 22, 2024
2 parents cb0ce6e + fed1f0e commit 6be881a
Show file tree
Hide file tree
Showing 32 changed files with 2,398 additions and 1,120 deletions.
18 changes: 8 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -141,12 +141,12 @@ OBJS_BASIC = \
MOD_SoilParametersReadin.o \
MOD_HtopReadin.o \
MOD_UrbanReadin.o \
MOD_BGC_CNSummary.o \
MOD_BGC_CNSummary.o \
MOD_IniTimeVariable.o \
MOD_UrbanIniTimeVariable.o \
MOD_Hydro_HillslopeNetwork.o \
MOD_Hydro_RiverLakeNetwork.o \
MOD_Hydro_RiverDepth.o \
MOD_ElementNeighbour.o \
MOD_Catch_HillslopeNetwork.o \
MOD_Catch_RiverLakeNetwork.o \
MOD_Initialize.o


Expand Down Expand Up @@ -215,13 +215,11 @@ OBJS_CAMA_T = $(addprefix .bld/,${OBJECTS_CAMA})
endif

OBJS_MAIN = \
MOD_ElementNeighbour.o \
MOD_Hydro_BasinNeighbour.o \
MOD_Hydro_HillslopeFlow.o \
MOD_Hydro_SubsurfaceFlow.o \
MOD_Hydro_RiverLakeFlow.o \
MOD_Catch_HillslopeFlow.o \
MOD_Catch_SubsurfaceFlow.o \
MOD_Catch_RiverLakeFlow.o \
MOD_Hydro_Hist.o \
MOD_Hydro_LateralFlow.o \
MOD_Catch_LateralFlow.o \
MOD_BGC_CNCStateUpdate1.o \
MOD_BGC_CNCStateUpdate2.o \
MOD_BGC_CNCStateUpdate3.o \
Expand Down
8 changes: 5 additions & 3 deletions include/define.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,17 @@
#undef Campbell_SOIL_MODEL
#define vanGenuchten_Mualem_SOIL_MODEL
! 5.2 If defined, lateral flow is modeled.
#define LATERAL_FLOW
#define CatchLateralFlow
! Conflicts :
#ifndef CATCHMENT
#undef LATERAL_FLOW
#undef CatchLateralFlow
#endif

! 6. If defined, CaMa-Flood model will be used.
#undef CaMa_Flood

! 7. If defined, BGC model is used.
#undef BGC
#define BGC

! Conflicts : only used when LULC_IGBP_PFT is defined.
#ifndef LULC_IGBP_PFT
Expand All @@ -62,3 +62,5 @@

! 9. If defined, data assimilation is used.
#undef DataAssimilation

#define VectorInOneFile
6 changes: 6 additions & 0 deletions main/BGC/MOD_BGC_Vars_TimeInvariants.F90
Original file line number Diff line number Diff line change
Expand Up @@ -342,9 +342,15 @@ SUBROUTINE WRITE_BGCTimeInvariants (file_restart)
! call ncio_write_vector (file_restart, 'peatf_lf ', 'patch', landpatch, peatf_lf , compress)
call ncio_write_vector (file_restart, 'rice2pdt ', 'patch', landpatch, rice2pdt , compress)

#ifdef USEMPI
CALL mpi_barrier (p_comm_glb, p_err)
#endif

if (p_is_master) then

#ifndef VectorInOneFile
call ncio_create_file (file_restart)
#endif
call ncio_define_dimension(file_restart, 'ndecomp_transitions',ndecomp_transitions)
call ncio_define_dimension(file_restart, 'ndecomp_pools' ,ndecomp_pools)
call ncio_define_dimension(file_restart, 'nlitter_fire' ,2 )
Expand Down
12 changes: 6 additions & 6 deletions main/CoLM.F90
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ PROGRAM CoLM
USE MOD_SingleSrfdata
#endif

#if (defined LATERAL_FLOW)
USE MOD_Hydro_LateralFlow
#if (defined CatchLateralFlow)
USE MOD_Catch_LateralFlow
#endif

USE MOD_Ozone, only: init_ozone_data, update_ozone_data
Expand Down Expand Up @@ -313,8 +313,8 @@ PROGRAM CoLM
ENDIF
#endif

#if (defined LATERAL_FLOW)
CALL lateral_flow_init ()
#if (defined CatchLateralFlow)
CALL lateral_flow_init (lc_year)
#endif

#ifdef DataAssimilation
Expand Down Expand Up @@ -409,7 +409,7 @@ PROGRAM CoLM
ENDIF


#if (defined LATERAL_FLOW)
#if (defined CatchLateralFlow)
CALL lateral_flow (deltim)
#endif

Expand Down Expand Up @@ -541,7 +541,7 @@ PROGRAM CoLM
CALL deallocate_1D_Forcing ()
CALL deallocate_1D_Fluxes ()

#if (defined LATERAL_FLOW)
#if (defined CatchLateralFlow)
CALL lateral_flow_final ()
#endif

Expand Down
10 changes: 5 additions & 5 deletions main/CoLMMAIN.F90
Original file line number Diff line number Diff line change
Expand Up @@ -877,7 +877,7 @@ SUBROUTINE CoLMMAIN ( &
ENDIF
#endif

#ifndef LATERAL_FLOW
#ifndef CatchLateralFlow
errorw=(endwb-totwb)-(forc_prc+forc_prl-fevpa-rnof-errw_rsub)*deltim
#else
! for lateral flow, "rsur" is considered in HYDRO/MOD_Hydro_SurfaceFlow.F90
Expand Down Expand Up @@ -1043,7 +1043,7 @@ SUBROUTINE CoLMMAIN ( &
wdsrf = 0.
wliq_soisno(1) = max(a, 1.e-8)
ENDIF
#ifndef LATERAL_FLOW
#ifndef CatchLateralFlow
IF (wdsrf > pondmx) THEN
rsur = (wdsrf - pondmx) / deltim
wdsrf = pondmx
Expand All @@ -1067,7 +1067,7 @@ SUBROUTINE CoLMMAIN ( &
endwb = wdsrf + endwb
ENDIF

#ifndef LATERAL_FLOW
#ifndef CatchLateralFlow
errorw=(endwb-totwb)-(pg_rain+pg_snow-fevpa-rnof)*deltim
#else
errorw=(endwb-totwb)-(pg_rain+pg_snow-fevpa)*deltim
Expand Down Expand Up @@ -1220,7 +1220,7 @@ SUBROUTINE CoLMMAIN ( &
wdsrf = wa + wdsrf
wa = 0
ENDIF
#ifndef LATERAL_FLOW
#ifndef CatchLateralFlow
IF (wdsrf > pondmx) THEN
rsur = (wdsrf - pondmx) / deltim
wdsrf = pondmx
Expand All @@ -1237,7 +1237,7 @@ SUBROUTINE CoLMMAIN ( &
ENDIF

errorw = (endwb-totwb) - (forc_prc+forc_prl-fevpa) * deltim
#ifndef LATERAL_FLOW
#ifndef CatchLateralFlow
errorw = errorw + rnof * deltim
#endif

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include <define.h>

#ifdef LATERAL_FLOW
MODULE MOD_Hydro_HillslopeFlow
#ifdef CatchLateralFlow
MODULE MOD_Catch_HillslopeFlow
!-------------------------------------------------------------------------------------
! DESCRIPTION:
!
Expand Down Expand Up @@ -41,8 +41,8 @@ SUBROUTINE hillslope_flow (dt)
USE MOD_Vars_1DFluxes
USE MOD_Hydro_Vars_TimeVariables
USE MOD_Hydro_Vars_1DFluxes
USE MOD_Hydro_HillslopeNetwork
USE MOD_Hydro_RiverLakeNetwork
USE MOD_Catch_HillslopeNetwork
USE MOD_Catch_RiverLakeNetwork
USE MOD_Const_Physical, only : grav

IMPLICIT NONE
Expand Down Expand Up @@ -320,5 +320,5 @@ SUBROUTINE hillslope_flow (dt)

END SUBROUTINE hillslope_flow

END MODULE MOD_Hydro_HillslopeFlow
END MODULE MOD_Catch_HillslopeFlow
#endif
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include <define.h>

#ifdef LATERAL_FLOW
MODULE MOD_Hydro_HillslopeNetwork
#ifdef CatchLateralFlow
MODULE MOD_Catch_HillslopeNetwork
!--------------------------------------------------------------------------------
! DESCRIPTION:
!
Expand Down Expand Up @@ -369,5 +369,5 @@ SUBROUTINE hillslope_network_final ()

END SUBROUTINE hillslope_network_final

END MODULE MOD_Hydro_HillslopeNetwork
END MODULE MOD_Catch_HillslopeNetwork
#endif
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include <define.h>

#ifdef LATERAL_FLOW
MODULE MOD_Hydro_LateralFlow
#ifdef CatchLateralFlow
MODULE MOD_Catch_LateralFlow
!-------------------------------------------------------------------------------------
! DESCRIPTION:
!
Expand All @@ -22,12 +22,12 @@ MODULE MOD_Hydro_LateralFlow
USE MOD_Precision
USE MOD_SPMD_Task
USE MOD_Hydro_Vars_TimeVariables
USE MOD_Hydro_RiverLakeNetwork
USE MOD_Hydro_BasinNeighbour
USE MOD_Hydro_HillslopeNetwork
USE MOD_Hydro_HillslopeFlow
USE MOD_Hydro_SubsurfaceFlow
USE MOD_Hydro_RiverLakeFlow
USE MOD_ElementNeighbour
USE MOD_Catch_RiverLakeNetwork
USE MOD_Catch_HillslopeNetwork
USE MOD_Catch_HillslopeFlow
USE MOD_Catch_SubsurfaceFlow
USE MOD_Catch_RiverLakeFlow
USE MOD_Vars_TimeVariables
USE MOD_Vars_Global, only : dz_soi
USE MOD_Const_Physical, only : denice, denh2o
Expand All @@ -44,7 +44,7 @@ MODULE MOD_Hydro_LateralFlow
CONTAINS

! ----------
SUBROUTINE lateral_flow_init ()
SUBROUTINE lateral_flow_init (lc_year)

#ifdef CoLMDEBUG
USE MOD_SPMD_Task
Expand All @@ -54,13 +54,17 @@ SUBROUTINE lateral_flow_init ()
USE MOD_Utils
#endif
IMPLICIT NONE

INTEGER, intent(in) :: lc_year ! which year of land cover data used

#ifdef CoLMDEBUG
integer :: ip ,ie, ipxl
#endif

CALL element_neighbour_init (lc_year)

CALL hillslope_network_init ()
CALL river_lake_network_init (use_calc_rivdpt = .true.)
CALL river_lake_network_init ()
CALL basin_neighbour_init ()

#ifdef CoLMDEBUG
Expand Down Expand Up @@ -274,5 +278,5 @@ SUBROUTINE lateral_flow_final ()

END SUBROUTINE lateral_flow_final

END MODULE MOD_Hydro_LateralFlow
END MODULE MOD_Catch_LateralFlow
#endif
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include <define.h>

#ifdef LATERAL_FLOW
MODULE MOD_Hydro_RiverLakeFlow
#ifdef CatchLateralFlow
MODULE MOD_Catch_RiverLakeFlow
!-------------------------------------------------------------------------------------
! DESCRIPTION:
!
Expand Down Expand Up @@ -41,8 +41,8 @@ SUBROUTINE river_lake_flow (dt)
USE MOD_LandPatch
USE MOD_Vars_TimeVariables
USE MOD_Hydro_Vars_1DFluxes
USE MOD_Hydro_HillslopeNetwork
USE MOD_Hydro_RiverLakeNetwork
USE MOD_Catch_HillslopeNetwork
USE MOD_Catch_RiverLakeNetwork
USE MOD_Const_Physical, only : grav
IMPLICIT NONE

Expand Down Expand Up @@ -480,5 +480,5 @@ SUBROUTINE river_lake_flow (dt)

END SUBROUTINE river_lake_flow

END MODULE MOD_Hydro_RiverLakeFlow
END MODULE MOD_Catch_RiverLakeFlow
#endif
Loading

0 comments on commit 6be881a

Please sign in to comment.