Skip to content

Commit b95993f

Browse files
authored
Merge pull request #412 from abiyfantaye/master
abiy - updated create event file option for isolated building CFD sim…
2 parents 4ed6d45 + 219dc42 commit b95993f

File tree

1 file changed

+27
-5
lines changed

1 file changed

+27
-5
lines changed

modules/createEVENT/IsolatedBuildingCFD/IsolatedBuildingCFD.py

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,12 @@ def scale_event(filename_aim, filename_event):
350350
except (json.JSONDecodeError, IOError) as e:
351351
print(f"Error IsolatedBuilldingCFD::scale_event processing files: {e}")
352352

353-
353+
def GetFloorsCount(BIMFilePath): # noqa: N802, N803, D103
354+
with open(BIMFilePath) as BIMFile: # noqa: PTH123, N806
355+
bim = json.load(BIMFile)
356+
357+
return int(bim['GeneralInformation']['stories'])
358+
354359

355360
if __name__ == "__main__":
356361
"""
@@ -366,17 +371,34 @@ def scale_event(filename_aim, filename_event):
366371
parser.add_argument("--getRV", action="store_true", help="used to get random variable, if not multiply EVENT by gs")
367372

368373

374+
# #parsing arguments
375+
# arguments, unknowns = parser.parse_known_args()
376+
377+
# # [forcesOutputName, floors, startTime, lengthScale, velocityScale] = ReadBIM(arguments.bim)
378+
379+
# # GetOpenFOAMEvent(arguments.case, forcesOutputName, floors, startTime, lengthScale, velocityScale)
380+
381+
# if not arguments.getRV:
382+
383+
# scale_event(filename_aim = arguments.filenameAIM, filename_event = arguments.filenameEVENT)
384+
369385
#parsing arguments
370386
arguments, unknowns = parser.parse_known_args()
371387

372-
# [forcesOutputName, floors, startTime, lengthScale, velocityScale] = ReadBIM(arguments.bim)
373-
374-
# GetOpenFOAMEvent(arguments.case, forcesOutputName, floors, startTime, lengthScale, velocityScale)
388+
if arguments.getRV == True: # noqa: E712
389+
# Read the number of floors
390+
# floorsCount = GetFloorsCount(arguments.filenameAIM) # noqa: N816
391+
floorsCount = GetFloorsCount(arguments.filenameAIM) # noqa: N816
392+
forces = []
393+
for i in range(floorsCount): # noqa: B007
394+
forces.append(FloorForces()) # noqa: PERF401
395+
# write the event file
396+
writeEVENT(forces, arguments.filenameEVENT)
375397

376398
if not arguments.getRV:
377-
378399
scale_event(filename_aim = arguments.filenameAIM, filename_event = arguments.filenameEVENT)
379400

380401

381402

382403

404+

0 commit comments

Comments
 (0)