Skip to content

Commit 6b354e6

Browse files
committed
Add SSISimulation subtype support with validation for building and soil types
1 parent 693d663 commit 6b354e6

1 file changed

Lines changed: 37 additions & 1 deletion

File tree

modules/performSIMULATION/openSees/OpenSeesSimulation.py

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,14 +106,50 @@ def main(args): # noqa: D103
106106
with open(samName, 'w') as samFile:
107107
json.dump(samData, samFile)
108108

109+
110+
if subtype == "SSISimulation":
111+
# "building_type": "custom_3d_building"
112+
if samData.get("building_type", "") not in ["custom_3d_building"]:
113+
print(f"Error: building_type '{samData.get('building_type', '')}' is not supported for SSISimulation subtype.")
114+
print("Only 'custom_3d_building' is supported.")
115+
exit(1)
116+
if samData.get("soil_type", "") not in ["soil_foundation_type_1"]:
117+
print(f"Error: foundation_type '{samData.get('foundation_type', '')}' is not supported for SSISimulation subtype.")
118+
print("Only 'foundation_type_1' is supported.")
119+
exit(1)
120+
121+
if samData.get("building_type", "") == "custom_3d_building" and samData.get("soil_type", "") == "soil_foundation_type_1":
122+
main_script = samData["structure_info"].get("model_file", None)
123+
main_script = os.path.basename(main_script)
124+
ext = "." + main_script.rsplit('.')[-1]
125+
main_script = main_script[:-len(ext)] # remove the extension
126+
main_script_new = main_script + "_example.tcl"
127+
if main_script is None:
128+
print("Error: model_file not found in structure_info of SAM file.")
129+
exit(1)
130+
from femora.components.simcenter.eeuq.soil_foundation_type_one import soil_foundation_type_one
131+
num_cores = soil_foundation_type_one(model_filename=main_script_new,
132+
info_file=samName)
133+
num_cores = int(num_cores)
134+
samData["coresPerModel"] = num_cores
135+
samData["mainScript"] = main_script_new
136+
137+
138+
with open(samName, 'w') as samFile:
139+
json.dump(samData, samFile)
140+
141+
142+
143+
144+
109145
preprocessorCommand = f'"{scriptDir}/OpenSeesPreprocessor" {aimName} {samName} {evtName} {edpName} {simName} example.tcl > workflow.err 2>&1' # noqa: N806
110146
exit_code = subprocess.Popen(preprocessorCommand, shell=True).wait() # noqa: S602
111147
# exit_code = subprocess.run(preprocessorCommand, shell=True).returncode # Maybe better for compatibility - jb
112148
# if not exit_code==0:
113149
# exit(exit_code)
114150

115151
# Run OpenSees
116-
if subtype == "FemoraInput":
152+
if subtype == "FemoraInput" or subtype == "SSISimulation":
117153
coresPerModel = samData.get("coresPerModel", 1)
118154
# Run OpenSees in parallel using mpirun
119155
if runtype == "runningLocal":

0 commit comments

Comments
 (0)