Skip to content

Commit

Permalink
Merge pull request #240 from zhongwangwei/master
Browse files Browse the repository at this point in the history
cama, canopy interception, forcing,Glacier code adjustment and optimization
  • Loading branch information
CoLM-SYSU authored Jan 29, 2024
2 parents 10cb238 + 81668dd commit ee5892a
Show file tree
Hide file tree
Showing 45 changed files with 11,027 additions and 11,117 deletions.
108 changes: 54 additions & 54 deletions CaMa/src/ICI/MAIN_cmf_ici.F90
Original file line number Diff line number Diff line change
Expand Up @@ -5,79 +5,79 @@ PROGRAM MAIN_cmf_ici
! (C) M. Hatono & D.Yamazaki (Tohoku-U / U-Tokyo) Sep 2019
!
! Licensed under the Apache License, Version 2.0 (the "License");
! You may not use this file except in compliance with the License.
! You may not USE this file except in compliance with the License.
! You may obtain a copy of the License at: http://www.apache.org/licenses/LICENSE-2.0
!
! Unless required by applicable law or agreed to in writing, software distributed under the License is
! distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
! See the License for the specific language governing permissions and limitations under the License.
!==========================================================
USE PARKIND1, ONLY: JPRB, JPRM, JPIM
USE YOS_CMF_INPUT, ONLY: NXIN, NYIN, DT, DTIN
USE YOS_CMF_TIME, ONLY: NSTEPS
!
USE CMF_DRV_CONTROL_MOD, ONLY: CMF_DRV_INPUT, CMF_DRV_INIT, CMF_DRV_END
USE CMF_DRV_ADVANCE_MOD, ONLY: CMF_DRV_ADVANCE
!USE CMF_CTRL_FORCING_MOD, ONLY: CMF_FORCING_GET, CMF_FORCING_PUT
!
USE CMF_CTRL_ICI_MOD, ONLY: CMF_ICI_INPUT, CMF_ICI_INIT, CMF_ICI_END
USE CMF_CTRL_ICI_MOD, ONLY: CMF_ICI_FORCING_GET,CMF_ICI_OUTPUT
USE palmtime, ONLY: palm_TimeStart, palm_TimeEnd
!$ USE OMP_LIB
IMPLICIT NONE
! Local variables
INTEGER(KIND=JPIM) :: ISTEP ! total time step
INTEGER(KIND=JPIM) :: ISTEPADV ! time step to be advanced within DRV_ADVANCE
REAL(KIND=JPRB),ALLOCATABLE :: ZBUFF(:,:,:) ! Buffer to store forcing runoff
USE PARKIND1, only: JPRB, JPRM, JPIM
USE YOS_CMF_INPUT, only: NXIN, NYIN, DT, DTIN
USE YOS_CMF_TIME, only: NSTEPS
!
USE CMF_DRV_CONTROL_MOD, only: CMF_DRV_INPUT, CMF_DRV_INIT, CMF_DRV_END
USE CMF_DRV_ADVANCE_MOD, only: CMF_DRV_ADVANCE
!USE CMF_CTRL_FORCING_MOD, only: CMF_FORCING_GET, CMF_FORCING_PUT
!
USE CMF_CTRL_ICI_MOD, only: CMF_ICI_INPUT, CMF_ICI_INIT, CMF_ICI_END
USE CMF_CTRL_ICI_MOD, only: CMF_ICI_FORCING_GET,CMF_ICI_OUTPUT
USE palmtime, only: palm_TimeStart, palm_TimeEnd
!$ USE OMP_LIB
IMPLICIT NONE
! Local variables
integer(KIND=JPIM) :: ISTEP ! total time step
integer(KIND=JPIM) :: ISTEPADV ! time step to be advanced within DRV_ADVANCE
real(KIND=JPRB),ALLOCATABLE :: ZBUFF(:,:,:) ! Buffer to store forcing runoff
!================================================

!*** 1a. Namelist handling
CALL CMF_ICI_INPUT
CALL CMF_DRV_INPUT
!*** 1a. Namelist handling
CALL CMF_ICI_INPUT
CALL CMF_DRV_INPUT

!*** 1b. INITIALIZATION
CALL CMF_DRV_INIT
CALL CMF_ICI_INIT
!*** 1b. INITIALIZATION
CALL CMF_DRV_INIT
CALL CMF_ICI_INIT

!*** 1c. allocate data buffer for input forcing
ALLOCATE(ZBUFF(NXIN,NYIN,2))
!*** 1c. allocate data buffer for input forcing
allocate(ZBUFF(NXIN,NYIN,2))

!================================================
!*** 2. MAIN TEMPORAL LOOP / TIME-STEP (NSTEPS calculated by DRV_INIT)
!================================================
!*** 2. MAIN TEMPORAL LOOP / TIME-STEP (NSTEPS calculated by DRV_INIT)

!ISTEPADV=INT(DTIN/DT,JPIM)
!DO ISTEP=1,NSTEPS,ISTEPADV
!ISTEPADV=INT(DTIN/DT,JPIM)
!DO ISTEP=1,NSTEPS,ISTEPADV

CALL palm_TimeStart( 'Main' )
CALL palm_TimeStart( 'Main' )

ISTEPADV=1
DO ISTEP=1,NSTEPS,1
ISTEPADV=1
DO ISTEP=1,NSTEPS,1

!* 2a Get forcing from ICI
CALL palm_TimeStart( 'CAMA_forcing' )
CALL CMF_ICI_FORCING_GET
CALL palm_TimeEnd ( 'CAMA_forcing' )
!* 2a Get forcing from ICI
CALL palm_TimeStart( 'CAMA_forcing' )
CALL CMF_ICI_FORCING_GET
CALL palm_TimeEnd ( 'CAMA_forcing' )

!* 2b Advance CaMa-Flood model for ISTEPADV
CALL palm_TimeStart( 'CAMA_driver' )
CALL CMF_DRV_ADVANCE(ISTEPADV)
CALL palm_TimeEnd ( 'CAMA_driver' )

!* 2c Output data with ICI
CALL palm_TimeStart( 'CAMA_output' )
CALL CMF_ICI_OUTPUT
CALL palm_TimeEnd ( 'CAMA_output' )
!* 2b Advance CaMa-Flood model for ISTEPADV
CALL palm_TimeStart( 'CAMA_driver' )
CALL CMF_DRV_ADVANCE(ISTEPADV)
CALL palm_TimeEnd ( 'CAMA_driver' )
!* 2c Output data with ICI
CALL palm_TimeStart( 'CAMA_output' )
CALL CMF_ICI_OUTPUT
CALL palm_TimeEnd ( 'CAMA_output' )

ENDDO
CALL palm_TimeEnd ( 'Main' )
!================================================
ENDDO
CALL palm_TimeEnd ( 'Main' )
!================================================

!*** 3a. Finalize
DEALLOCATE(ZBUFF)
CALL CMF_DRV_END
CALL CMF_ICI_END
!*** 3a. Finalize
deallocate(ZBUFF)
CALL CMF_DRV_END
CALL CMF_ICI_END

!================================================
!================================================

END PROGRAM MAIN_cmf_ici
!####################################################################
155 changes: 72 additions & 83 deletions CaMa/src/ICI/cmf_calc_lakein_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -12,95 +12,84 @@ MODULE CMF_CALC_LAKEIN_MOD
! distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
! See the License for the specific language governing permissions and limitations under the License.
!==========================================================
USE PARKIND1, ONLY: JPIM, JPRM, JPRB
USE PARKIND1, only: JPIM, JPRM, JPRB
CONTAINS
!####################################################################
! -- CMF_CALC_LAKEIN
! -- CMF_LAKEIN_AVE
! -- CMF_LAKEIN_AVERAGE
! -- CMF_RESET_LAKEIN
!####################################################################
SUBROUTINE CMF_CALC_LAKEIN
USE YOS_CMF_INPUT, ONLY: DT
USE YOS_CMF_MAP, ONLY: NSEQALL, D2GRAREA
USE YOS_CMF_PROG, ONLY: P2RIVSTO, P2FLDSTO
USE YOS_CMF_DIAG, ONLY: D2STORGE
USE YOS_CMF_ICI, ONLY: D2LAKEFRC, D2RUNIN
IMPLICIT NONE
!*** Local
INTEGER(KIND=JPIM) :: ISEQ
REAL(KIND=JPRB) :: DRIVRIN, DFLDRIN
!*** Lake Parameter
REAL(KIND=JPRB) :: RINDMP
!================================================
RINDMP = 1.D0

DO ISEQ=1, NSEQALL
DRIVRIN = P2RIVSTO(ISEQ,1) * D2LAKEFRC(ISEQ,1) / (RINDMP * 8.64D4) * DT !! m3
DFLDRIN = P2FLDSTO(ISEQ,1) * D2LAKEFRC(ISEQ,1) / (RINDMP * 8.64D4) * DT !! m3
P2RIVSTO(ISEQ,1) = P2RIVSTO(ISEQ,1) - DRIVRIN
P2FLDSTO(ISEQ,1) = P2FLDSTO(ISEQ,1) - DFLDRIN
D2RUNIN(ISEQ,1) = (DRIVRIN + DFLDRIN) / DT / D2GRAREA(ISEQ,1) * 1.D3 !! kg/m2/s

D2STORGE(ISEQ,1)=P2RIVSTO(ISEQ,1)+P2FLDSTO(ISEQ,1)
ENDDO

END SUBROUTINE CMF_CALC_LAKEIN
!####################################################################






!####################################################################
SUBROUTINE CMF_LAKEIN_AVE
USE YOS_CMF_INPUT, ONLY: DT
USE YOS_CMF_MAP, ONLY: NSEQALL
USE YOS_CMF_ICI, ONLY: D2RUNIN, D2RUNIN_AVG
IMPLICIT NONE
!*** Local
INTEGER(KIND=JPIM) :: ISEQ
!================================================
DO ISEQ=1, NSEQALL
D2RUNIN_AVG(ISEQ,1)=D2RUNIN_AVG(ISEQ,1)+D2RUNIN(ISEQ,1)*DT
END DO

END SUBROUTINE CMF_LAKEIN_AVE
!####################################################################





!####################################################################
SUBROUTINE CMF_LAKEIN_AVERAGE
USE YOS_CMF_DIAG, ONLY: NADD
USE YOS_CMF_MAP, ONLY: NSEQALL
USE YOS_CMF_ICI, ONLY: D2RUNIN_AVG
IMPLICIT NONE
!*** Local
INTEGER(KIND=JPIM) :: ISEQ
!================================================
DO ISEQ=1, NSEQALL
D2RUNIN_AVG(ISEQ,1)=D2RUNIN_AVG(ISEQ,1)/DBLE(NADD)
END DO

END SUBROUTINE CMF_LAKEIN_AVERAGE
!####################################################################





!####################################################################
SUBROUTINE CMF_RESET_LAKEIN
USE YOS_CMF_ICI, ONLY: D2RUNIN_AVG
IMPLICIT NONE
!================================================
D2RUNIN_AVG(:,:)=0._JPRB

END SUBROUTINE CMF_RESET_LAKEIN
!####################################################################
SUBROUTINE CMF_CALC_LAKEIN
USE YOS_CMF_INPUT, only: DT
USE YOS_CMF_MAP, only: NSEQALL, D2GRAREA
USE YOS_CMF_PROG, only: P2RIVSTO, P2FLDSTO
USE YOS_CMF_DIAG, only: D2STORGE
USE YOS_CMF_ICI, only: D2LAKEFRC, D2RUNIN
IMPLICIT NONE
!*** Local
integer(KIND=JPIM) :: ISEQ
real(KIND=JPRB) :: DRIVRIN, DFLDRIN
!*** Lake Parameter
real(KIND=JPRB) :: RINDMP
!================================================
RINDMP = 1.D0

DO ISEQ=1, NSEQALL
DRIVRIN = P2RIVSTO(ISEQ,1) * D2LAKEFRC(ISEQ,1) / (RINDMP * 8.64D4) * DT !! m3
DFLDRIN = P2FLDSTO(ISEQ,1) * D2LAKEFRC(ISEQ,1) / (RINDMP * 8.64D4) * DT !! m3
P2RIVSTO(ISEQ,1) = P2RIVSTO(ISEQ,1) - DRIVRIN
P2FLDSTO(ISEQ,1) = P2FLDSTO(ISEQ,1) - DFLDRIN
D2RUNIN(ISEQ,1) = (DRIVRIN + DFLDRIN) / DT / D2GRAREA(ISEQ,1) * 1.D3 !! kg/m2/s

D2STORGE(ISEQ,1)=P2RIVSTO(ISEQ,1)+P2FLDSTO(ISEQ,1)
ENDDO

END SUBROUTINE CMF_CALC_LAKEIN
!####################################################################


!####################################################################
SUBROUTINE CMF_LAKEIN_AVE
USE YOS_CMF_INPUT, only: DT
USE YOS_CMF_MAP, only: NSEQALL
USE YOS_CMF_ICI, only: D2RUNIN, D2RUNIN_AVG
IMPLICIT NONE
!*** Local
integer(KIND=JPIM) :: ISEQ
!================================================
DO ISEQ=1, NSEQALL
D2RUNIN_AVG(ISEQ,1)=D2RUNIN_AVG(ISEQ,1)+D2RUNIN(ISEQ,1)*DT
ENDDO

END SUBROUTINE CMF_LAKEIN_AVE
!####################################################################


!####################################################################
SUBROUTINE CMF_LAKEIN_AVERAGE
USE YOS_CMF_DIAG, only: NADD
USE YOS_CMF_MAP, only: NSEQALL
USE YOS_CMF_ICI, only: D2RUNIN_AVG
IMPLICIT NONE
!*** Local
integer(KIND=JPIM) :: ISEQ
!================================================
DO ISEQ=1, NSEQALL
D2RUNIN_AVG(ISEQ,1)=D2RUNIN_AVG(ISEQ,1)/DBLE(NADD)
ENDDO

END SUBROUTINE CMF_LAKEIN_AVERAGE
!####################################################################

!####################################################################
SUBROUTINE CMF_RESET_LAKEIN
USE YOS_CMF_ICI, only: D2RUNIN_AVG
IMPLICIT NONE
!================================================
D2RUNIN_AVG(:,:)=0._JPRB

END SUBROUTINE CMF_RESET_LAKEIN
!####################################################################

END MODULE CMF_CALC_LAKEIN_MOD
Loading

0 comments on commit ee5892a

Please sign in to comment.