Skip to content

Commit 43ee21f

Browse files
committed
Update Celeris and TaichiEvent
1 parent 375aa4f commit 43ee21f

3 files changed

Lines changed: 31 additions & 23 deletions

File tree

modules/createEVENT/Celeris/Celeris.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -399,23 +399,24 @@ def main():
399399
for event in evt['Events']:
400400
# Redesign the input structure in backend CelerisAi later.
401401
# For now assume waveFile, bathymetryFile, configFile, etc. are in the same directory.
402-
caseDirectory = event['configFilePath'] # noqa: N816
402+
# caseDirectory = event['configFilePath'] # noqa: N816
403+
caseDirectory = '.'
403404
configDirectory = event['configFilePath'] # noqa: N816
404405
configFilename = event['configFile'] # noqa: N816
405406
bathymetryDirectory = event['bathymetryFilePath'] # noqa: N816
406407
bathymetryFilename = event['bathymetryFile'] # noqa: N816
407408
waveDirectory = event['waveFilePath'] # noqa: N816
408409
waveFilename = event['waveFile'] # noqa: N816
409410

410-
configFilename = os.path.join( # noqa: PTH118
411-
configDirectory, configFilename
412-
) # noqa: N816, PTH118
413-
bathymetryFilename = os.path.join( # noqa: PTH118
414-
bathymetryDirectory, bathymetryFilename
415-
) # noqa: N816, PTH118
416-
waveFilename = os.path.join( # noqa: PTH118
417-
waveDirectory, waveFilename
418-
) # noqa: N816, PTH118
411+
# configFilename = os.path.join( # noqa: PTH118
412+
# configDirectory, configFilename
413+
# ) # noqa: N816, PTH118
414+
# bathymetryFilename = os.path.join( # noqa: PTH118
415+
# bathymetryDirectory, bathymetryFilename
416+
# ) # noqa: N816, PTH118
417+
# waveFilename = os.path.join( # noqa: PTH118
418+
# waveDirectory, waveFilename
419+
# ) # noqa: N816, PTH118
419420

420421
# Check if the config file exists
421422
if not os.path.exists(configFilename): # noqa: PTH110

modules/createEVENT/Celeris/celeris/runner.py

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -532,15 +532,20 @@ def Evolve_1D_Display(self):
532532
while window.running:
533533
self.eta_paint()
534534
if use_ggui:
535-
canvas.circles(self.eta1D,radius=0.005,color = (0., 150/255., 255./255))
536-
canvas.lines(self.bottom1D,width=0.01,indices=self.indexbottom1D,color = (128/255., 0.0, 0.))
535+
try:
536+
canvas.circles(self.eta1D,radius=0.005,color = (0., 150/255., 255./255))
537+
canvas.lines(self.bottom1D,width=0.01,indices=self.indexbottom1D,color = (128/255., 0.0, 0.))
538+
except Exception as e:
539+
print(f"Error in GGUI circles / lines rendering: {e}")
537540
else:
538-
for ii in range(self.solver.nx):
539-
window.circle(pos=[self.eta1D[ii][0], self.eta1D[ii][1]], radius=1, color=0x00FFFF)
540-
if ii >= self.solver.nx - 1:
541-
continue
542-
window.line(self.bottom1D[ii], self.bottom1D[ii+1], radius=1, color = 0x39FF14)
543-
541+
try:
542+
for ii in range(self.solver.nx):
543+
window.circle(pos=[self.eta1D[ii][0], self.eta1D[ii][1]], radius=1, color=0x00FFFF)
544+
if ii >= self.solver.nx - 1:
545+
continue
546+
window.line(self.bottom1D[ii], self.bottom1D[ii+1], radius=1, color = 0x39FF14)
547+
except Exception as e:
548+
print(f"Error in legacy GUI circle / line rendering: {e}")
544549
self.Evolve_Steps(i)
545550

546551
if i==1 or (i%100)==0:
@@ -685,10 +690,12 @@ def Evolve_Display( # noqa: C901, N802, D102
685690
) # using the Taichi tensors to render the image
686691
self.Evolve_Steps(i)
687692

688-
window.line(self.solver.force_sensor_begin_scaled, self.solver.force_sensor_end_scaled, radius=1, color=0x39FF14)
689-
for k in range(self.solver.num_wave_gauges):
690-
window.circle(pos=[self.solver.wave_gauge_scaled[int(k),int(0)], self.solver.wave_gauge_scaled[int(k),int(1)]], radius=2, color=0xFF5733)
691-
693+
try:
694+
window.line(self.solver.force_sensor_begin_scaled, self.solver.force_sensor_end_scaled, radius=1, color=0x39FF14)
695+
for k in range(self.solver.num_wave_gauges):
696+
window.circle(pos=[self.solver.wave_gauge_scaled[int(k),int(0)], self.solver.wave_gauge_scaled[int(k),int(1)]], radius=2, color=0xFF5733)
697+
except Exception as e: # noqa: BLE001
698+
print(f'Error in rendering sensors or wave gauges using line / circle: {e}') # noqa:
692699

693700
if i == self.buffer_step:
694701
start_time = (

modules/createEVENT/TaichiEvent/TaichiEvent.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def __init__(self, recorderID=-1): # noqa: N803
5858
continue
5959
# Assume there is no header in the file
6060
# Assume recorder IDs are sequential, starting from 1
61-
if (j + 1) == recorderID:
61+
if (j) == recorderID:
6262
# Strip away leading / trailing white-space,
6363
# Delimit by regex to capture " ", \s, " ", tabs, etc.
6464
# Each value should be a number, rep. the force on recorder j at a time-step i

0 commit comments

Comments
 (0)