Skip to content

Commit

Permalink
move dtini divisor from fortran to python to make using it easier
Browse files Browse the repository at this point in the history
  • Loading branch information
kumdonoaa committed Apr 15, 2024
1 parent 06985f8 commit a9863fd
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 15 deletions.
27 changes: 14 additions & 13 deletions src/kernel/diffusive/diffusive.f90
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ subroutine diffnw(timestep_ar_g, nts_ql_g, nts_ub_g, nts_db_g, ntss_ev_g, nts_qt
integer, dimension(nrch_g, frnw_col), intent(in) :: frnw_ar_g
integer, dimension(mxncomp_g, nrch_g), intent(in) :: size_bathy_g
double precision, dimension(paradim ), intent(in) :: para_ar_g
double precision, dimension(:) , intent(in) :: timestep_ar_g(9)
double precision, dimension(:) , intent(in) :: timestep_ar_g(10)
double precision, dimension(nts_db_g), intent(in) :: dbcd_g
double precision, dimension(mxncomp_g, nrch_g), intent(in) :: z_ar_g
double precision, dimension(mxncomp_g, nrch_g), intent(in) :: bo_ar_g
Expand Down Expand Up @@ -184,7 +184,7 @@ subroutine diffnw(timestep_ar_g, nts_ql_g, nts_ub_g, nts_db_g, ntss_ev_g, nts_qt
double precision :: x
double precision :: saveInterval, width
!double precision :: maxCourant
double precision :: dtini_given
double precision :: dtini_given, dtini_divisor
double precision :: timesDepth
double precision :: t
double precision :: tfin
Expand Down Expand Up @@ -224,17 +224,18 @@ subroutine diffnw(timestep_ar_g, nts_ql_g, nts_ub_g, nts_db_g, ntss_ev_g, nts_qt

!-----------------------------------------------------------------------------
! Time domain parameters
dtini = timestep_ar_g(1) ! initial timestep duration [sec]
t0 = timestep_ar_g(2) ! simulation start time [hr]
tfin = timestep_ar_g(3) ! simulation end time [hr]
saveInterval = timestep_ar_g(4) ! output recording interval [sec]
dt_ql = timestep_ar_g(5) ! lateral inflow data time step [sec]
dt_ub = timestep_ar_g(6) ! upstream boundary time step [sec]
dt_db = timestep_ar_g(7) ! downstream boundary time step [sec]
dt_qtrib = timestep_ar_g(8) ! tributary data time step [sec]
dt_da = timestep_ar_g(9) ! data assimilation data time step [sec]
dtini_given = dtini ! preserve user-input timestep duration
dtini_min = dtini/10.0 ! minimum increment in internal time step (user-selected value at the denominator)
dtini = timestep_ar_g(1) ! initial timestep duration [sec]
t0 = timestep_ar_g(2) ! simulation start time [hr]
tfin = timestep_ar_g(3) ! simulation end time [hr]
saveInterval = timestep_ar_g(4) ! output recording interval [sec]
dt_ql = timestep_ar_g(5) ! lateral inflow data time step [sec]
dt_ub = timestep_ar_g(6) ! upstream boundary time step [sec]
dt_db = timestep_ar_g(7) ! downstream boundary time step [sec]
dt_qtrib = timestep_ar_g(8) ! tributary data time step [sec]
dt_da = timestep_ar_g(9) ! data assimilation data time step [sec]
dtini_given = dtini ! preserve user-input timestep duration
dtini_divisor = timestep_ar_g(10) ! numeric value that divide dtini in the next line
dtini_min = dtini/dtini_divisor ! minimum increment in internal time step

!-----------------------------------------------------------------------------
! miscellaneous parameters
Expand Down
2 changes: 1 addition & 1 deletion src/kernel/diffusive/pydiffusive.f90
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ subroutine c_diffnw(timestep_ar_g, nts_ql_g, nts_ub_g, nts_db_g, ntss_ev_g, nts_
integer(c_int), dimension(mxncomp_g, nrch_g), intent(in) :: size_bathy_g
real(c_double), dimension(nts_db_g), intent(in) :: dbcd_g
real(c_double), dimension(paradim), intent(in) :: para_ar_g
real(c_double), dimension(:), intent(in) :: timestep_ar_g(9)
real(c_double), dimension(:), intent(in) :: timestep_ar_g(10)
real(c_double), dimension(mxncomp_g, nrch_g), intent(in) :: z_ar_g, bo_ar_g, traps_ar_g
real(c_double), dimension(mxncomp_g, nrch_g), intent(in) :: tw_ar_g, twcc_ar_g
real(c_double), dimension(mxncomp_g, nrch_g), intent(in) :: mann_ar_g, manncc_ar_g
Expand Down
3 changes: 2 additions & 1 deletion src/troute-routing/troute/routing/diffusive_utils_v02.py
Original file line number Diff line number Diff line change
Expand Up @@ -725,7 +725,7 @@ def diffusive_input_data_v02(
tfin_g = (dt * nsteps)/60/60

# package timestep variables into single array
timestep_ar_g = np.zeros(9)
timestep_ar_g = np.zeros(10)
timestep_ar_g[0] = dtini_g
timestep_ar_g[1] = t0_g
timestep_ar_g[2] = tfin_g
Expand All @@ -735,6 +735,7 @@ def diffusive_input_data_v02(
# timestep_ar_g[6] = dt_db_g <- defined after calling fp_coastal_boundary_input_map
timestep_ar_g[7] = dt_qtrib_g
timestep_ar_g[8] = dt_da_g
timestep_ar_g[9] = 10.0 # dtini_g/this_number = the min.sim.time interval internally executed within diffusive.f90

# CN-mod parameters
paradim = 11
Expand Down

0 comments on commit a9863fd

Please sign in to comment.