Skip to content

Commit 3b71644

Browse files
committed
Modified jbsim Python codes to use jbsim 3.0.0 and set flag when using complete GFs.
1 parent 3c1d862 commit 3b71644

File tree

2 files changed

+24
-8
lines changed

2 files changed

+24
-8
lines changed

bbp/comps/jbsim.py

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"""
33
BSD 3-Clause License
44
5-
Copyright (c) 2023, University of Southern California
5+
Copyright (c) 2024, University of Southern California
66
All rights reserved.
77
88
Redistribution and use in source and binary forms, with or without
@@ -78,9 +78,18 @@ def run(self):
7878
a_statfile = os.path.join(install.A_IN_DATA_DIR,
7979
str(sim_id),
8080
self.r_stations)
81-
a_srffile = os.path.join(install.A_IN_DATA_DIR,
82-
str(sim_id),
83-
self.r_srffile)
81+
a_rupture_file = os.path.join(install.A_IN_DATA_DIR,
82+
str(sim_id),
83+
self.r_srffile)
84+
# RWG 20241025: jbsim-v3.0.0 is backward compatible with jbsim-v2.0.0
85+
# it can use rupture files in both SRF and MRF formats
86+
if os.path.splitext(a_rupture_file)[-1].lower() == ".srf":
87+
rupmod_type = "SRF"
88+
elif os.path.splitext(a_rupture_file)[-1].lower() == ".mrf":
89+
rupmod_type = "MRF"
90+
else:
91+
print("[ERROR]: Unknown rupture format in file %s" % (a_rupture_file))
92+
sys.exit(-1)
8493

8594
# Set directories, and make sure they exist
8695
a_indir = os.path.join(install.A_IN_DATA_DIR, str(sim_id))
@@ -106,9 +115,11 @@ def run(self):
106115
#
107116
progstring = ("%s latloncoords=1 slon=%f slat=%f " %
108117
(os.path.join(install.A_GP_BIN_DIR,
109-
"jbsim-v2.0.0"), slon, slat) +
118+
"jbsim-v3.0.0"), slon, slat) +
110119
"tshift_timedomain=1 use_closest_gf=1 " +
111-
"rupmodtype=SRF rupmodfile=%s " % a_srffile +
120+
"cgf_flag=%d " % (config.GF_CGFFLAG) +
121+
"rupmodtype=%s " % (rupmod_type) +
122+
"rupmodfile=%s " % (a_rupture_file) +
112123
"moment=-1 outdir=%s stat=%s " % (a_veldir, site) +
113124
"min_taper_range=0.0 max_taper_range=0.0 " +
114125
"gftype=fk gflocs=%s gftimes=%s gf_swap_bytes=%d " %

bbp/comps/jbsim_cfg.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
#!/usr/bin/env python
1+
#!/usr/bin/env python3
22
"""
33
BSD 3-Clause License
44
5-
Copyright (c) 2021, University of Southern California
5+
Copyright (c) 2024, University of Southern California
66
All rights reserved.
77
88
Redistribution and use in source and binary forms, with or without
@@ -93,6 +93,11 @@ def __init__(self, vmodel_name):
9393
self.NTOUT = int(vmodel_params['NTOUT'])
9494
else:
9595
self.NTOUT = 4096
96+
# RWG 20241025: Added parameter GF_CGFFLAG
97+
if 'GF_CGFFLAG' in vmodel_params:
98+
self.GF_CGFFLAG = int(vmodel_params['GF_CGFFLAG'])
99+
else:
100+
self.GF_CGFFLAG = 0
96101

97102
# Now, configure other paramteres
98103
self.GF_SWAP_BYTES = 0

0 commit comments

Comments
 (0)