Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion build/FUSE_SRC/FUSE_DMSL/fuse_driver.f90
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ PROGRAM DISTRIBUTED_DRIVER
USE multistate, only: ncid_out ! NetCDF output file ID

USE multibands ! basin band stuctures
USE multiparam, ONLY: LPARAM, PARATT, NUMPAR ! parameter metadata structures
USE data_types, ONLY: PARATT ! data type for metadata
USE multiparam, ONLY: LPARAM, NUMPAR ! parameter metadata structures
USE multistate, only: gState ! gridded state variables
USE multistate, only: gState_3d ! gridded state variables with a time dimension
USE multiroute, ONLY: AROUTE ! model routing structures
Expand Down
44 changes: 41 additions & 3 deletions build/FUSE_SRC/FUSE_DMSL/fuse_rmse.f90
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ SUBROUTINE FUSE_RMSE(XPAR,GRID_FLAG,NCID_FORC,RMSE,OUTPUT_FLAG,IPSET,MPARAM_FLAG
USE str_2_xtry_module ! provide access to the routine str_2_xtry
USE xtry_2_str_module ! provide access to the routine xtry_2_str

! differentiable model
use data_types, only: parent ! fuse parent data type
use get_parent_module, only: get_parent ! populate the parent data structure
use implicit_solve_module, only:implicit_solve ! simple implicit solve for differnetiable ODE

! interface blocks
USE interfaceb, ONLY:ode_int,fuse_solve ! provide access to FUSE_SOLVE through ODE_INT

Expand Down Expand Up @@ -93,6 +98,10 @@ SUBROUTINE FUSE_RMSE(XPAR,GRID_FLAG,NCID_FORC,RMSE,OUTPUT_FLAG,IPSET,MPARAM_FLAG
CHARACTER(LEN=CLEN) :: CMESSAGE ! error message of downwind routine
INTEGER(I4B),PARAMETER::UNT=6 !1701 ! 6

! differentiable model
type(parent) :: fuseStruct ! parent fuse data structure


! ---------------------------------------------------------------------------------------
! allocate state vectors
ALLOCATE(STATE0(NSTATE),STATE1(NSTATE),STAT=IERR)
Expand Down Expand Up @@ -245,9 +254,38 @@ SUBROUTINE FUSE_RMSE(XPAR,GRID_FLAG,NCID_FORC,RMSE,OUTPUT_FLAG,IPSET,MPARAM_FLAG
RETURN
END SELECT

! temporally integrate the ordinary differential equations
CALL ODE_INT(FUSE_SOLVE,STATE0,STATE1,DT_SUB,DT_FULL,IERR,MESSAGE)
IF (IERR.NE.0) THEN; PRINT *, TRIM(MESSAGE); PAUSE; ENDIF
! ----- start of soil physics code ------------------------------------------------------------

! temporally integrate the ordinary differential equations
select case(diff_mode)

! original code
case(original)
CALL ODE_INT(FUSE_SOLVE,STATE0,STATE1,DT_SUB,DT_FULL,IERR,MESSAGE)
IF (IERR.NE.0) THEN; PRINT *, TRIM(MESSAGE); STOP 1; ENDIF

!print*, state1
!if(ITIM_IN > sim_beg+100) stop

! differentiable code
case(differentiable)

! populate parent fuse structure
call get_parent(fuseStruct)

! solve differentiable ODEs
call implicit_solve(fuseStruct, state0, state1, nState)
!print*, state1
!if(ITIM_IN > sim_beg+100) stop

! save fluxes
W_FLUX = fuseStruct%flux

! check options
case default; print*, "Cannot identify diff_mode"; stop 1
end select

! ----- end of soil physics code --------------------------------------------------------------

! perform overland flow routing
CALL Q_OVERLAND()
Expand Down
3 changes: 2 additions & 1 deletion build/FUSE_SRC/FUSE_ENGINE/assign_par.f90
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ SUBROUTINE ASSIGN_PAR()
USE nrtype ! variable types, etc.
USE model_defn ! model definition structure
USE model_defnames
USE multiparam, ONLY : lparam, paratt, numpar ! model parameter structures
USE data_types, ONLY : paratt ! data type for metadata
USE multiparam, ONLY : lparam, numpar ! model parameter structures
USE getpar_str_module ! access to SUBROUTINE get_par_str
IMPLICIT NONE
INTEGER(I4B) :: MPAR ! counter for number of parameters
Expand Down
10 changes: 9 additions & 1 deletion build/FUSE_SRC/FUSE_ENGINE/getnumerix.f90
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,15 @@ SUBROUTINE GETNUMERIX(err,message)
USE model_numerix,only:SOLUTION_METHOD,& ! defines numerix decisions
TEMPORAL_ERROR_CONTROL,INITIAL_NEWTON,JAC_RECOMPUTE,CHECK_OVERSHOOT,SMALL_ENDSTEP,&
ERR_TRUNC_ABS,ERR_TRUNC_REL,ERR_ITER_FUNC,ERR_ITER_DX,THRESH_FRZE,FRACSTATE_MIN,&
SAFETY,RMIN,RMAX,NITER_TOTAL,MIN_TSTEP,MAX_TSTEP
SAFETY,RMIN,RMAX,NITER_TOTAL,MIN_TSTEP,MAX_TSTEP,diff_mode
USE model_numerix,only:original,differentiable ! named variables for diff_mode
IMPLICIT NONE
! dummies
integer(I4B),intent(out) :: err
character(*),intent(out) :: message
! locals
INTEGER(I4B) :: IUNIT ! file unit
integer(i4b) :: ios ! io status flag
integer(i4b),parameter::lenPath=1024 !DK/2008/10/21: allows longer file paths
CHARACTER(LEN=lenPath) :: CFILE ! name of constraints file
LOGICAL(LGT) :: LEXIST ! .TRUE. if file exists
Expand Down Expand Up @@ -65,6 +67,12 @@ SUBROUTINE GETNUMERIX(err,message)
READ(IUNIT,*) NITER_TOTAL ! Total number of iterations used in the implicit scheme
READ(IUNIT,*) MIN_TSTEP ! Minimum time step length (minutes)
READ(IUNIT,*) MAX_TSTEP ! Maximum time step length (minutes)
! new option -- ensure backwards compatible
read(iunit,*, iostat=ios) diff_mode ! Mode for differentiable models (non-differentiable; differentiable)
if(ios/=0)then
diff_mode = original
print*, "WARNING: diff_mode is not specified; setting option to original. Continuing"
endif ! if problem reading
CLOSE(IUNIT)
MIN_TSTEP = MIN_TSTEP/(24._SP*60._SP) ! Convert from minutes to days
MAX_TSTEP = MAX_TSTEP/(24._SP*60._SP) ! Convert from minutes to days
Expand Down
3 changes: 2 additions & 1 deletion build/FUSE_SRC/FUSE_ENGINE/getpar_str.f90
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ SUBROUTINE GETPAR_STR(PARNAME,METADAT)
! Inserts parameter metadata into data structures
! ---------------------------------------------------------------------------------------
USE nrtype ! variable types, etc.
USE multiparam, ONLY : PARATT, PARMETA ! derived type for parameter metadata
USE data_types, ONLY : PARATT ! derived type for parameter metadata
USE multiparam, ONLY : PARMETA ! parameter metadata
IMPLICIT NONE
! input
CHARACTER(*), INTENT(IN) :: PARNAME ! parameter name
Expand Down
2 changes: 1 addition & 1 deletion build/FUSE_SRC/FUSE_ENGINE/getparmeta.f90
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ SUBROUTINE GETPARMETA(err,message)
! ---------------------------------------------------------------------------------------
USE nrtype ! variable types, etc.
USE fuse_fileManager,only:SETNGS_PATH,CONSTRAINTS ! defines data directory
USE multiparam, ONLY: PARATT ! parameter attribute structure
USE data_types, ONLY: PARATT ! parameter attribute structure
USE putpar_str_module ! provide access to SUBROUTINE putpar_str
USE par_insert_module ! provide access to SUBROUTINE par_insert
IMPLICIT NONE
Expand Down
42 changes: 0 additions & 42 deletions build/FUSE_SRC/FUSE_ENGINE/multi_flux.f90

This file was deleted.

53 changes: 0 additions & 53 deletions build/FUSE_SRC/FUSE_ENGINE/multistate.f90

This file was deleted.

35 changes: 0 additions & 35 deletions build/FUSE_SRC/FUSE_ENGINE/multistats.f90

This file was deleted.

3 changes: 2 additions & 1 deletion build/FUSE_SRC/FUSE_ENGINE/putpar_str.f90
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ SUBROUTINE PUTPAR_STR(METADAT,PARNAME)
! Inserts parameter metadata into data structures
! ---------------------------------------------------------------------------------------
USE nrtype ! variable types, etc.
USE multiparam, ONLY : PARATT, PARMETA ! derived type for parameter metadata
USE data_types, ONLY : PARATT ! derived type for parameter metadata
USE multiparam, ONLY : PARMETA ! parameter metadata
IMPLICIT NONE
! input
TYPE(PARATT), INTENT(IN) :: METADAT ! parameter metadata
Expand Down
2 changes: 1 addition & 1 deletion build/FUSE_SRC/FUSE_ENGINE/str_2_xtry.f90
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ SUBROUTINE STR_2_XTRY(TMPSTR,X_TRY)
USE nrtype ! Numerical Recipes data types
USE model_defn, ONLY: CSTATE,NSTATE ! model definitions
USE model_defnames
USE multistate, ONLY: STATEV ! model state structure
USE data_types, ONLY: STATEV ! model state structure
IMPLICIT NONE
! input
TYPE(STATEV), INTENT(IN) :: TMPSTR ! temporary state structure
Expand Down
Loading