Skip to content

Commit

Permalink
sedtrn vars centralized, and added finish_model function stub
Browse files Browse the repository at this point in the history
  • Loading branch information
Burgholzer authored and Burgholzer committed Jul 12, 2024
1 parent 1b87b17 commit 5f5b3d1
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 5 deletions.
10 changes: 7 additions & 3 deletions src/hsp2/hsp2/SEDTRN.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ def sedtrn(io_manager, siminfo, uci, ts, state):
state_paths = state['state_paths']
op_tokens = state['op_tokens']
# 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)
ep_list = sedtrn_state_vars()
model_exec_list = model_domain_dependencies(state, state_info['domain'], ep_list, True)
model_exec_list = asarray(model_exec_list, dtype="i8") # format for use in
#######################################################################################

Expand Down Expand Up @@ -1015,4 +1015,8 @@ def expand_SEDTRN_masslinks(flags, uci, dat, recs):
rec['TMEMSB2'] = dat.TMEMSB2
rec['SVOL'] = dat.SVOL
recs.append(rec)
return recs
return recs

def sedtrn_state_vars():
sedtrn_state = ["RSED4","RSED5","RSED6"]
return(sedtrn_state)
8 changes: 8 additions & 0 deletions src/hsp2/hsp2/om.py
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,14 @@ def step_model(model_exec_list, op_tokens, state_ix, dict_ix, ts_ix, step):
return


@njit
def finish_model(model_exec_list, op_tokens, state_ix, dict_ix, ts_ix):
for i in model_exec_list:
if op_tokens[i][0] == 12:
# register type data (like broadcast accumulators)
end_model_link(op_tokens[i], state_ix, ts_ix)
return


@njit
def step_one(op_tokens, ops, state_ix, dict_ix, ts_ix, step, debug = 0):
Expand Down
2 changes: 1 addition & 1 deletion src/hsp2/hsp2/state.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ def state_load_dynamics_hsp2(state, io_manager, siminfo):

def hydr_init_ix(state, domain):
# get a list of keys for all hydr state variables
hydr_state = ["DEP","IVOL","O1","O2","O3", "O4", "O5","OVOL1","OVOL2","OVOL3","PRSUPY","RO","ROVOL","SAREA","TAU","USTAR","VOL","VOLEV"]
hydr_state = hydr_state_vars()
hydr_ix = Dict.empty(key_type=types.unicode_type, value_type=types.int64)
for i in hydr_state:
#var_path = f'{domain}/{i}'
Expand Down
2 changes: 1 addition & 1 deletion tests/testcbp/HSP2results/JL1_6562_6560.simple.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"left_path": "[parent]/O2",
"right_path": "[parent]/wd_cfs",
"link_type": 5,
"comments": "The use of [parent] is useful in that it will insure that we create a variable if it doesn't exist. If the system already created O2 (it should) we would not need this. But it does not, so we do."
"comments": "The use of [parent] is necessary in that it will insure that we create a variable if it doesn't exist. If the system already created O2 (it should) we would not need this. But it does not, so we do."
}
}
}
Expand Down

0 comments on commit 5f5b3d1

Please sign in to comment.