Skip to content

Commit

Permalink
load required functions for state/om/specl explicitly into HYDR and S…
Browse files Browse the repository at this point in the history
…EDTRN
  • Loading branch information
Burgholzer authored and Burgholzer committed May 7, 2024
1 parent 8e61c34 commit 28ab858
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 17 deletions.
15 changes: 4 additions & 11 deletions HSP2/HYDR.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,14 @@
from numpy import zeros, any, full, nan, array, int64, arange
from pandas import DataFrame
from math import sqrt, log10
from numba import njit
from numba import njit, types
from numba.typed import List
from HSP2.utilities import initm, make_numba_dict

# the following imports added by rb to handle dynamic code and special actions
from HSP2.state import *
from HSP2.SPECL import specl
from HSP2.om import *
from HSP2.om_model_object import *
from HSP2.om_sim_timer import *
from HSP2.om_special_action import *
#from HSP2.om_equation import *
from HSP2.om_model_linkage import *
#from HSP2.om_data_matrix import *
#from HSP2.om_model_broadcast import *
from HSP2.state import hydr_get_ix, hydr_init_ix
from HSP2.om import pre_step_model, step_model
from numba.typed import Dict


ERRMSGS =('HYDR: SOLVE equations are indeterminate', #ERRMSG0
Expand Down
16 changes: 11 additions & 5 deletions HSP2/SEDTRN.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,16 @@
License: LGPL2
'''

from numpy import array, zeros, where, int64, arange
from numpy import array, zeros, where, int64, asarray
from math import log10, exp
from numba import njit
from numba import njit, types
from HSP2.ADCALC import advect
from HSP2.utilities import make_numba_dict

# the following imports added to handle special actions
from HSP2.om import *
from HSP2.om_model_linkage import *
from HSP2.state import sedtrn_get_ix, sedtrn_init_ix
from HSP2.om import pre_step_model, step_model, model_domain_dependencies
from numba.typed import Dict

ERRMSGS =('SEDTRN: Warning -- bed storage of sediment size fraction sand is empty', #ERRMSG0
'SEDTRN: Warning -- bed storage of sediment size fraction silt is empty', #ERRMSG1
Expand Down Expand Up @@ -96,7 +97,7 @@ def sedtrn(io_manager, siminfo, uci, ts, state):
# Aggregate the list of all SEDTRN end point dependencies
ep_list = ['RSED4', 'RSED5', 'RSED6']
model_exec_list = model_domain_dependencies(state, state_info['domain'], ep_list)
model_exec_list = np.asarray(model_exec_list, dtype="i8") # format for use in numba
model_exec_list = asarray(model_exec_list, dtype="i8") # format for use in numba
#######################################################################################

############################################################################
Expand Down Expand Up @@ -339,6 +340,11 @@ def _sedtrn_(ui, ts, state_info, state_paths, state_ix, dict_ix, ts_ix, op_token
state_ix[rsed4_ix] = sand_wt_rsed4
state_ix[rsed5_ix] = silt_wt_rsed5
state_ix[rsed6_ix] = clay_wt_rsed6
if (state_info['state_step_om'] == 'enabled'):
pre_step_model(model_exec_list, op_tokens, state_ix, dict_ix, ts_ix, loop)

# (todo) Insert code hook for dynamic python modification of state

if (state_info['state_step_om'] == 'enabled'):
step_model(model_exec_list, op_tokens, state_ix, dict_ix, ts_ix, loop) # traditional 'ACTIONS' done in here
# Do write-backs for editable STATE variables
Expand Down
3 changes: 2 additions & 1 deletion HSP2/om_model_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@
All runtime exec is done by child classes.
"""
from HSP2.state import set_state, get_state_ix
from numba.typed import Dict
from HSP2.om import get_exec_order, is_float_digit
from pandas import Series, DataFrame, concat, HDFStore, set_option, to_numeric
from pandas import Timestamp, Timedelta, read_hdf, read_csv
from numpy import pad, asarray, zeros, int32
from numba import njit
from numba import njit, types

class ModelObject:
state_ix = {} # Shared Dict with the numerical state of each object
Expand Down

0 comments on commit 28ab858

Please sign in to comment.