diff --git a/bbp/comps/jbsim.py b/bbp/comps/jbsim.py index 6733b42..74878e5 100755 --- a/bbp/comps/jbsim.py +++ b/bbp/comps/jbsim.py @@ -2,7 +2,7 @@ """ BSD 3-Clause License -Copyright (c) 2023, University of Southern California +Copyright (c) 2024, University of Southern California All rights reserved. Redistribution and use in source and binary forms, with or without @@ -78,9 +78,18 @@ def run(self): a_statfile = os.path.join(install.A_IN_DATA_DIR, str(sim_id), self.r_stations) - a_srffile = os.path.join(install.A_IN_DATA_DIR, - str(sim_id), - self.r_srffile) + a_rupture_file = os.path.join(install.A_IN_DATA_DIR, + str(sim_id), + self.r_srffile) + # RWG 20241025: jbsim-v3.0.0 is backward compatible with jbsim-v2.0.0 + # it can use rupture files in both SRF and MRF formats + if os.path.splitext(a_rupture_file)[-1].lower() == ".srf": + rupmod_type = "SRF" + elif os.path.splitext(a_rupture_file)[-1].lower() == ".mrf": + rupmod_type = "MRF" + else: + print("[ERROR]: Unknown rupture format in file %s" % (a_rupture_file)) + sys.exit(-1) # Set directories, and make sure they exist a_indir = os.path.join(install.A_IN_DATA_DIR, str(sim_id)) @@ -106,9 +115,11 @@ def run(self): # progstring = ("%s latloncoords=1 slon=%f slat=%f " % (os.path.join(install.A_GP_BIN_DIR, - "jbsim-v2.0.0"), slon, slat) + + "jbsim-v3.0.0"), slon, slat) + "tshift_timedomain=1 use_closest_gf=1 " + - "rupmodtype=SRF rupmodfile=%s " % a_srffile + + "cgf_flag=%d " % (config.GF_CGFFLAG) + + "rupmodtype=%s " % (rupmod_type) + + "rupmodfile=%s " % (a_rupture_file) + "moment=-1 outdir=%s stat=%s " % (a_veldir, site) + "min_taper_range=0.0 max_taper_range=0.0 " + "gftype=fk gflocs=%s gftimes=%s gf_swap_bytes=%d " % diff --git a/bbp/comps/jbsim_cfg.py b/bbp/comps/jbsim_cfg.py index f3f116c..736a689 100755 --- a/bbp/comps/jbsim_cfg.py +++ b/bbp/comps/jbsim_cfg.py @@ -1,8 +1,8 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 """ BSD 3-Clause License -Copyright (c) 2021, University of Southern California +Copyright (c) 2024, University of Southern California All rights reserved. Redistribution and use in source and binary forms, with or without @@ -93,6 +93,11 @@ def __init__(self, vmodel_name): self.NTOUT = int(vmodel_params['NTOUT']) else: self.NTOUT = 4096 + # RWG 20241025: Added parameter GF_CGFFLAG + if 'GF_CGFFLAG' in vmodel_params: + self.GF_CGFFLAG = int(vmodel_params['GF_CGFFLAG']) + else: + self.GF_CGFFLAG = 0 # Now, configure other paramteres self.GF_SWAP_BYTES = 0