From e623efcd7d8d019b8a64dc17f55e00f332d02994 Mon Sep 17 00:00:00 2001 From: Justin Bonus Date: Tue, 19 Aug 2025 19:13:00 -0700 Subject: [PATCH 1/7] stochasticWave should be 1dof, not 2dof, for now --- modules/createEVENT/stochasticWave/StochasticWave.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/modules/createEVENT/stochasticWave/StochasticWave.py b/modules/createEVENT/stochasticWave/StochasticWave.py index 89c6ea9a0..b02372541 100644 --- a/modules/createEVENT/stochasticWave/StochasticWave.py +++ b/modules/createEVENT/stochasticWave/StochasticWave.py @@ -196,9 +196,9 @@ def readRV(aimFilePath='AIM.json', eventFilePath='EVENT.json'): # noqa: D103, N addFloorForceToEvent( timeSeriesArray, patternsArray, floorForces.X, 'X', floor, deltaT ) - addFloorForceToEvent( - timeSeriesArray, patternsArray, floorForces.Y, 'Y', floor, deltaT - ) + # addFloorForceToEvent( + # timeSeriesArray, patternsArray, floorForces.Y, 'Y', floor, deltaT + # ) addFloorPressure(pressureArray, floor) eventDict['Events'].append(event_json) @@ -237,9 +237,9 @@ def writeEVENT(forces, eventFilePath, deltaT=1.0): # noqa: D103, N802, N803 addFloorForceToEvent( timeSeriesArray, patternsArray, floorForces.X, 'X', floor, deltaT ) - addFloorForceToEvent( - timeSeriesArray, patternsArray, floorForces.Y, 'Y', floor, deltaT - ) + # addFloorForceToEvent( + # timeSeriesArray, patternsArray, floorForces.Y, 'Y', floor, deltaT + # ) addFloorPressure(pressureArray, floor) with open(eventFilePath, 'w', encoding='utf-8') as f: # noqa: PTH123 From db6d0350adfc28a8fb9cf84694fbc7719397917e Mon Sep 17 00:00:00 2001 From: Justin Bonus Date: Wed, 20 Aug 2025 12:35:09 -0700 Subject: [PATCH 2/7] Update JONSWAP --- modules/createEVENT/stochasticWave/Jonswap.py | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/modules/createEVENT/stochasticWave/Jonswap.py b/modules/createEVENT/stochasticWave/Jonswap.py index 2fa3f3919..a68033edc 100644 --- a/modules/createEVENT/stochasticWave/Jonswap.py +++ b/modules/createEVENT/stochasticWave/Jonswap.py @@ -29,14 +29,14 @@ input_args = sys.argv[1:] - print( # noqa: T201 - 'Jonswap.py - Backend-script post_process_sensors.py running: ' - + str(sys.argv[0]) - ) - print( # noqa: T201 - 'post_process_sensors.py - Backend-script post_process_sensors.py received input args: ' - + str(input_args) - ) + # print( # noqa: T201 + # 'Jonswap.py - Backend-script post_process_sensors.py running: ' + # + str(sys.argv[0]) + # ) + # print( # noqa: T201 + # 'post_process_sensors.py - Backend-script post_process_sensors.py received input args: ' + # + str(input_args) + # ) inputFile = sys.argv[1] # noqa: N816 outputPath = sys.argv[2] # noqa: N816 @@ -47,7 +47,7 @@ with open(inputFile, encoding='utf-8') as BIMFile: # noqa: PTH123 bim = json.load(BIMFile) for event_id in range(1): - print('Running a sample simulation with JSON input parameters') # noqa: T201 + # print('Running a sample simulation with JSON input parameters') # noqa: T201 g = 9.80665 # gravity [m/s^2] rho = 1000.0 # water density @@ -165,7 +165,7 @@ # if (si == seeds[-1]): - print('Saving wave spectra and time series') # noqa: T201 + # print('Saving wave spectra and time series') # noqa: T201 spectra_df = pd.DataFrame() spectra_df['Frequency'] = freq From 219dc426e51ff0664cef33da25c91d6825feadde Mon Sep 17 00:00:00 2001 From: Abiy Melaku Date: Mon, 25 Aug 2025 16:35:54 -0700 Subject: [PATCH 3/7] abiy - updated create event file option for isolated building CFD simulation --- .../IsolatedBuildingCFD.py | 32 ++++++++++++++++--- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/modules/createEVENT/IsolatedBuildingCFD/IsolatedBuildingCFD.py b/modules/createEVENT/IsolatedBuildingCFD/IsolatedBuildingCFD.py index 39a43943b..0c2d99aa1 100644 --- a/modules/createEVENT/IsolatedBuildingCFD/IsolatedBuildingCFD.py +++ b/modules/createEVENT/IsolatedBuildingCFD/IsolatedBuildingCFD.py @@ -350,7 +350,12 @@ def scale_event(filename_aim, filename_event): except (json.JSONDecodeError, IOError) as e: print(f"Error IsolatedBuilldingCFD::scale_event processing files: {e}") - +def GetFloorsCount(BIMFilePath): # noqa: N802, N803, D103 + with open(BIMFilePath) as BIMFile: # noqa: PTH123, N806 + bim = json.load(BIMFile) + + return int(bim['GeneralInformation']['stories']) + if __name__ == "__main__": """ @@ -366,17 +371,34 @@ def scale_event(filename_aim, filename_event): parser.add_argument("--getRV", action="store_true", help="used to get random variable, if not multiply EVENT by gs") + # #parsing arguments + # arguments, unknowns = parser.parse_known_args() + + # # [forcesOutputName, floors, startTime, lengthScale, velocityScale] = ReadBIM(arguments.bim) + + # # GetOpenFOAMEvent(arguments.case, forcesOutputName, floors, startTime, lengthScale, velocityScale) + + # if not arguments.getRV: + + # scale_event(filename_aim = arguments.filenameAIM, filename_event = arguments.filenameEVENT) + #parsing arguments arguments, unknowns = parser.parse_known_args() - # [forcesOutputName, floors, startTime, lengthScale, velocityScale] = ReadBIM(arguments.bim) - - # GetOpenFOAMEvent(arguments.case, forcesOutputName, floors, startTime, lengthScale, velocityScale) + if arguments.getRV == True: # noqa: E712 + # Read the number of floors + # floorsCount = GetFloorsCount(arguments.filenameAIM) # noqa: N816 + floorsCount = GetFloorsCount(arguments.filenameAIM) # noqa: N816 + forces = [] + for i in range(floorsCount): # noqa: B007 + forces.append(FloorForces()) # noqa: PERF401 + # write the event file + writeEVENT(forces, arguments.filenameEVENT) if not arguments.getRV: - scale_event(filename_aim = arguments.filenameAIM, filename_event = arguments.filenameEVENT) + From 5d527142051afa65afa7709fbdf4aeee39eab462 Mon Sep 17 00:00:00 2001 From: fmckenna Date: Tue, 26 Aug 2025 16:59:54 -0700 Subject: [PATCH 4/7] fmk - changinging code so errorlevel check only on windows if runtype is set_up, was failing windows sending to TACC --- modules/Workflow/whale/main.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/Workflow/whale/main.py b/modules/Workflow/whale/main.py index 785254c56..75fa6194c 100644 --- a/modules/Workflow/whale/main.py +++ b/modules/Workflow/whale/main.py @@ -2293,7 +2293,7 @@ def preprocess_inputs( # noqa: C901 # This time, (1) we do it only for python; (2) added try statement try: - if command.startswith('python'): + if command.startswith('python') and self.run_type == 'set_up': if platform.system() == 'Windows': driver_script += 'if %errorlevel% neq 0 exit /b -1 \n' #TODO ANYONE: This variable is not defined. Check This please. (Added by Sina) else: @@ -2461,7 +2461,7 @@ def create_driver_file( # noqa: C901 # This time, (1) we do it only for python; (2) added try statement # try: - if 'python' in command_list[0].lower(): + if 'python' in command_list[0].lower() and self.run_type == 'set_up': if platform.system() == 'Windows': driver_script += 'if %errorlevel% neq 0 exit /b -1 \n' else: From 26367ed7c690d5f857e11819e5ccf133cc4060b1 Mon Sep 17 00:00:00 2001 From: fmckenna Date: Wed, 3 Sep 2025 12:17:39 -0700 Subject: [PATCH 5/7] fmk - mod to GISSpecifiedEvent to look in parent dir for workflow_input file .. why full path not passed is a mystery --- .../GISSpecifiedEvents/GISSpecifiedEvent.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/modules/performRegionalMapping/GISSpecifiedEvents/GISSpecifiedEvent.py b/modules/performRegionalMapping/GISSpecifiedEvents/GISSpecifiedEvent.py index 0acad0a3d..4ee257924 100644 --- a/modules/performRegionalMapping/GISSpecifiedEvents/GISSpecifiedEvent.py +++ b/modules/performRegionalMapping/GISSpecifiedEvents/GISSpecifiedEvent.py @@ -78,10 +78,17 @@ def create_event(asset_file: str, event_grid_file: str, workflow_input: str, do_ # open input file & get Regional Event data # + # candidate paths json_path = os.path.join(os.getcwd(), workflow_input) - with open(json_path, 'r') as f: - data = json.load(f) + if not os.path.exists(json_path): + json_path = os.path.join(os.path.dirname(os.getcwd()), workflow_input) + + if os.path.isfile(json_path): + with open(json_path, 'r') as f: + data = json.load(f) + else: + raise FileNotFoundError(f"Could not find {workflow_input} in current or parent directory") regional_event = data.get("RegionalEvent") From f7a0ebaa57cbd0f83e936879de7faa85c4d83dc0 Mon Sep 17 00:00:00 2001 From: fmckenna Date: Wed, 3 Sep 2025 12:23:38 -0700 Subject: [PATCH 6/7] fmk - removing printing of EDP to log from a number of files --- modules/performUQ/common/extractEDP.cpp | 8 ++-- .../performUQ/dakota/postprocessDakota.cpp | 2 + modules/performUQ/dakota/simCenterDprepro.cpp | 44 +++++++++++++++---- 3 files changed, 41 insertions(+), 13 deletions(-) diff --git a/modules/performUQ/common/extractEDP.cpp b/modules/performUQ/common/extractEDP.cpp index 5e7b2c2ab..d833a3360 100644 --- a/modules/performUQ/common/extractEDP.cpp +++ b/modules/performUQ/common/extractEDP.cpp @@ -40,7 +40,7 @@ int main(int argc, const char **argv) int numValues = json_array_size(sType); for (int i=0; i #include #include -#include +#include #include using std::string; -using std::vector; +using std::deque; /* ***************** params.in example ****** { DAKOTA_VARS = 2 } @@ -47,14 +47,15 @@ int main(int argc, char **argv) } // - // vectors that will contain strinmgs to search for & their replacement + // deques that will contain strinmgs to search for & their replacement // - vector original; - vector replace; - vector originalLength; - vector replacementLength; - + deque original; + deque replace; + deque originalLength; + deque replacementLength; + deque rvNames; // original string of random variable names + // // from params file, 1) read # of RV and 2) then read RV names and values // @@ -63,6 +64,8 @@ int main(int argc, char **argv) int numRVs = 0; string line; while (getline(params, line)) { + + std::istringstream buf(line); std::istream_iterator beg(buf), end; vector tokens(beg, end); // done! @@ -75,12 +78,35 @@ int main(int argc, char **argv) } else { // subsequent lines contain RV and value .. add to string vectors - string rvName = "\"RV." + tokens.at(1) + "\""; // add SimCenter delimiters begin="RV. & end=" + string rvName = tokens.at(1); // add SimCenter delimiters begin="RV. &\ end=" string rvValue = tokens.at(3); + // check if an existing rvName starts as a substring of current + bool subStringExists = false; + for (size_t i = 0; i < rvNames.size(); ++i) { + const std::string& s1 = rvName[i]; + if (rvName.find(s1) == 0) { + subStringExists = true; + break; // No need to check further if found + } + } + } + + if (subStringExists == false) { + rvNames.push_back(rvName); + rvName = "\"RV." + rvName + "\""; // add SimCenter delimiters begin="RV. &\ end=" original.push_back(rvName); replace.push_back(rvValue); originalLength.push_back(rvName.length()); replacementLength.push_back(rvValue.length()); + + } else { + rvNames.push_front(rvName); + rvName = "\"RV." + rvName + "\""; + replace.push_front(rvValue); + originalLength.push_front(rvName.length()); + replacementLength.push_front(rvValue.length()); + + } // std::cerr << rvName << " " << rvValue << "\n"; } From d15db5247f661624ef0d3973b9fcb51340bf96a7 Mon Sep 17 00:00:00 2001 From: yisangriB Date: Tue, 9 Sep 2025 19:38:20 -0500 Subject: [PATCH 7/7] sy - fixing a bug --- modules/performFEM/surrogateGP/gpPredict.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/performFEM/surrogateGP/gpPredict.py b/modules/performFEM/surrogateGP/gpPredict.py index 7eea8ebdd..e73f7df9e 100644 --- a/modules/performFEM/surrogateGP/gpPredict.py +++ b/modules/performFEM/surrogateGP/gpPredict.py @@ -10,8 +10,8 @@ from scipy.stats import lognorm, norm from sklearn.linear_model import LinearRegression -errFileName = os.path.join(os.getcwd(), 'workflow.err') # noqa: N816, PTH109, PTH118 -sys.stderr = open(errFileName, 'a') # noqa: SIM115, PTH123 +# errFileName = os.path.join(os.getcwd(), 'workflow.err') # noqa: N816, PTH109, PTH118 +# sys.stderr = open(errFileName, 'a') # noqa: SIM115, PTH123 try: moduleName = 'GPy' # noqa: N816