Skip to content

[Bug]: simulation.clear_cache() crashes if simulation contains line DEVC devices #104

@wk9874

Description

@wk9874

What happened?

I've loaded a set of results using fdsreader.Simulation(), and then after parsing some data from it, I use simulation.clear_cache() to reduce memory usage. However for examples which contain a line DEVC device, eg

&DEVC XB=1.5,1.5,0,0,0,2.9, QUANTITY='VISIBILITY', ID='visibility_line', POINTS=100, STATISTICS_START=0., STATISTICS_END=5. /

clear_cache() crashes with this error:

    def clear_cache(self):
        """Remove all data from the internal cache that has been loaded so far to free memory.
        """
        for element in self._elements:
>           element.clear_cache()
E           AttributeError: 'list' object has no attribute 'clear_cache'

When inspecting the simulation object, it looks like this is because the line DEVC device has been loaded a list of Device() objects:

print(sim.devices._elements[6])
[
    Device(id='visibility_line', xyz=(1.5, 0.001, 0.001), quantity=Quantity('VISIBILITY')), 
    Device(id='visibility_line', xyz=(1.5, 0.001, 0.02929), quantity=Quantity('VISIBILITY')),
    ...
]

Steps to reproduce

  • Run an FDS case which includes a line DEVC device definition, eg the one mentioned above
  • Load the simulation with simulation = Simulation(results_dir)
  • Try to clear the cache with simulation.clear_cache()

FDS version used

6.9.1

fdsreader version used

1.11.7

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions