Skip to content

Commit f8a1f55

Browse files
authored
Merge pull request #392 from JustinBonus/master
Celeris updates for Windows and easier random variables
2 parents 154905c + 2554ca7 commit f8a1f55

File tree

4 files changed

+43
-25
lines changed

4 files changed

+43
-25
lines changed

modules/createEVENT/Celeris/Celeris.py

Lines changed: 35 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,9 @@ def writeEVENT(forces, eventFilePath='EVENT.json', floorsCount=1): # noqa: N802
223223
addFloorForceToEvent(
224224
patternsArray, timeSeriesArray, floorForces, 'X', it + 1
225225
)
226+
addFloorForceToEvent(
227+
patternsArray, timeSeriesArray, floorForces, 'Y', it + 1
228+
)
226229

227230
# subtype = "StochasticWindModel-KwonKareem2006"
228231
eventClassification = 'Hydro' # noqa: N806
@@ -239,8 +242,8 @@ def writeEVENT(forces, eventFilePath='EVENT.json', floorsCount=1): # noqa: N802
239242
'timeSeries': timeSeriesArray,
240243
'pressure': pressure,
241244
'numSteps': len(forces[0].X),
242-
'dT': 0.01,
243-
'dt': 0.01,
245+
'dT': 1.0,
246+
'dt': 1.0,
244247
'units': {'force': 'Newton', 'length': 'Meter', 'time': 'Sec'},
245248
}
246249

@@ -351,24 +354,24 @@ def main():
351354
floorsCount = GetFloorsCount(arguments.filenameAIM) # noqa: N816
352355
filenameEVENT = arguments.filenameEVENT # noqa: N816
353356

354-
result = subprocess.run( # noqa: S603
355-
[ # noqa: S607
356-
'python3',
357-
scriptName,
358-
'-d',
359-
caseDirectory,
360-
'-f',
361-
configFilename,
362-
'-b',
363-
bathymetryFilename,
364-
'-w',
365-
waveFilename,
366-
# f'{os.path.realpath(os.path.dirname(__file__))}'
367-
# + '/taichi_script.py',
368-
],
369-
stdout=subprocess.PIPE,
370-
check=False,
371-
)
357+
# result = subprocess.run( # noqa: S603
358+
# [ # noqa: S607
359+
# sys.executable,
360+
# scriptName,
361+
# '-d',
362+
# caseDirectory,
363+
# '-f',
364+
# configFilename,
365+
# '-b',
366+
# bathymetryFilename,
367+
# '-w',
368+
# waveFilename,
369+
# # f'{os.path.realpath(os.path.dirname(__file__))}'
370+
# # + '/taichi_script.py',
371+
# ],
372+
# stdout=subprocess.PIPE,
373+
# check=False,
374+
# )
372375

373376
forces = []
374377
for i in range(floorsCount):
@@ -379,15 +382,25 @@ def main():
379382

380383
else:
381384
print('No RVs requested') # noqa: T201
385+
386+
# filenameAIM = arguments.filenameAIM # noqa: N816
387+
# Read in Events[0]["config"]
388+
configObj = evt['Events'][0]['config'] # noqa: N806
389+
# Write configObj to config_rv.json
390+
configRVFilename = 'config_rv.json' # noqa: N816
391+
with open(caseDirectory + '/' + configRVFilename, 'w', encoding='utf-8') as file:
392+
json.dump(configObj, file)
393+
file.close
394+
382395
filenameEVENT = arguments.filenameEVENT # noqa: N816
383396
result = subprocess.run( # noqa: S603
384397
[ # noqa: S607
385-
'python3',
398+
sys.executable,
386399
scriptName,
387400
'-d',
388401
caseDirectory,
389402
'-f',
390-
configFilename,
403+
configRVFilename,
391404
'-b',
392405
bathymetryFilename,
393406
'-w',

modules/createEVENT/Celeris/celeris/runner.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,12 @@ def Evolve_Display( # noqa: C901, N802, D102
490490
use_ggui = None
491491
window = None
492492
canvas = None
493+
import platform
494+
os_name = platform.system()
493495
try:
496+
if 'Windows' in os_name:
497+
# Throw exception to force legacy GUI
498+
raise Exception('Windows detected, reverting GGUI to legacy GUI for reliability.')
494499
window = ti.ui.Window('CelerisAi', (self.solver.nx, self.solver.ny)) # noqa: F405
495500
canvas = window.get_canvas()
496501
use_ggui = True

modules/createEVENT/TaichiEvent/TaichiEvent.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ def main(): # noqa: D103
291291

292292
result = subprocess.run( # noqa: S603
293293
[ # noqa: S607
294-
'ti',
294+
sys.executable,
295295
scriptName,
296296
# f'{os.path.realpath(os.path.dirname(__file__))}' # noqa: ISC003, PTH120
297297
# + '/taichi_script.py',
@@ -312,7 +312,7 @@ def main(): # noqa: D103
312312
filenameEVENT = arguments.filenameEVENT # noqa: N816
313313
result = subprocess.run( # noqa: S603
314314
[ # noqa: S607
315-
'ti',
315+
sys.executable,
316316
scriptName,
317317
# f'{os.path.realpath(os.path.dirname(__file__))}' # noqa: ISC003, PTH120
318318
# + '/taichi_script.py',

modules/performUQ/common/createStandardUQ_Input.cpp

100755100644
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -487,4 +487,4 @@ int main(int argc, char **argv) {
487487

488488
size_t flags = 0;
489489
return json_dump_file(rootINPUT, outputFile, flags);
490-
}
490+
}

0 commit comments

Comments
 (0)