FireDynamics / fdsreader

Python reader for FDS data
GNU General Public License v3.0
44 stars 18 forks source link

Cannot access BNDF data #37

Closed amarcozzi closed 3 years ago

amarcozzi commented 3 years ago

Hello, thanks for all of your work on this utility. It's been helpful for post-processing slice files thus far.

Currently, I'm working on contouring fire fronts using mass flux at the boundary as a proxy for fire location. I output boundary files throughout my FDS simulation and can view them without a problem in smokeview. However, when I create a fdsreader object with my output directory, the fdsreader object cannot find any obstructions. The ObstructionCollection object is empty when I initialize the simulation, and all of the obstruction methods return None when I try to query for the surface boundary.

In my simulation I don't define any obstructions with the &OBST keyword. Is this why there's nothing in the ObstructionCollection object? If this is the case, is there another way to access the BNDF data which exists for the surface? I've spent some time looking through the API and exploring the fdsreader object, but I don't see any way to read in the BNDF data without and obstruction.

I've included my FDS simulation file and a couple of images for reference.

Thank you, Anthony

image

image

JanVogelsang commented 3 years ago

Hello Anthony, great to hear the reader helped you with your projects already. I am sure we will be able to easily fix your issue as well. The solution to the problem is actually quite simple, at the moment I skipped the case when there is boundary data which does not belong to any boundary as most of the times this data is an unwanted byproduct which until now could always be ignored. I will find a way to include the mesh-dependent data as well.

JanVogelsang commented 3 years ago

Implemented in 77f0750

To support boundary data that does not belong to any obstruction (but to a mesh instead), I simply added boundary-data support for meshes. Now the boundary data you are interested in should be accessible from the corresponding mesh.
A short example of how it works:

import fdsreader as fds

sim = fds.Simulation("./fds_simple_circles")
mesh = sim.meshes[0]  # The first mesh
bndf = mesh.get_boundary_data("mass_flux_SPEC_1")  # Get boundary data for a specific quantity
patch = bndf.data[3]  # Orientation 3 (positive z-direction)
print(patch.data)  # Numpy array with the actual data for the so called patch, with the mesh size (xy-plane) as its dimension

The code worked with FDS 6.7.6 and FDSReader 1.2.2. @amarcozzi Please test it yourself (with the newest version of the fdsreader) and tell me if it works for you.

amarcozzi commented 3 years ago

Thank you so much for your help! This worked exactly as I hoped it would. I'll keep my eye out for other open issues that pop up in this repo - I'd be happy to help contribute.

JanVogelsang commented 3 years ago

Great to hear and thanks a lot!