Coder Social home page Coder Social logo

Comments (5)

JanVogelsang avatar JanVogelsang commented on August 30, 2024 1

Strange, it should be. I am using it in the example as well which works just as expected.
But anyway, great to hear we could solve the issue!

from fdsreader.

JanVogelsang avatar JanVogelsang commented on August 30, 2024

Hello @kamaliseresht ,
Could you provide me with an example of the cases you tested this on as well as the actual code you run so I can easily identify the problem?

from fdsreader.

kamaliseresht avatar kamaliseresht commented on August 30, 2024

Hi Jan,

Here are the code and fds file:

##################################
def find_sim3D_quantity_names():
sim3D_quantityNames_quantityIndex_dict = {}
for i in range(len(sim.data_3d.quantities)):
quantity_name = sim.data_3d.quantities[i].name
sim3D_quantityNames_quantityIndex_dict[quantity_name] = i
print("sim3D_quantityNames_auantityIndex_dict:", sim3D_quantityNames_quantityIndex_dict)
return sim3D_quantityNames_quantityIndex_dict

def main(quantity_idx):

mesh = sim.meshes[1]
extent = mesh.extent
t = -1
pl_t1 = sim.data_3d[t]
quantity = pl_t1.quantities[quantity_idx]
color_data = pl_t1[mesh].data[5:6, 29:30, 10:11, quantity_idx][0][0][0]
print("color_data:",color_data)

if name == "main":
path = 'C:/Users/FESG/Desktop/test/FDS/Reading PL3D'
sim = fds.Simulation(path)
preferred_quantity = 'TEMPERATURE'
sim3D_quantityNames_quantityIndex_dict = find_sim3D_quantity_names()
quantity_idx = sim3D_quantityNames_quantityIndex_dict[preferred_quantity]
main(quantity_idx)
#######################

&HEAD CHID='vort3d_80', TITLE='2D Vortex Simulation, Mesh Size = 80' /

&TIME T_END=50.0/

&MESH ID='Mesh1', IJK=24,36,12, XB=-1.0, 5.0,-1.0,8.0,0.0,3.0/
&MESH ID='Mesh2', IJK=24,36,12, XB= 5.0,11.0,-1.0,8.0,0.0,3.0/

&REAC ID='POLYURETHANE',
FYI='NFPA Babrauskas',
FUEL='REAC_FUEL',
C=6.3,
H=7.1,
O=2.1,
N=1.0,
SOOT_YIELD=0.1/

&SURF ID='FIRE',
COLOR='RED',
HRRPUA=50.0/

&OBST XB=5.0,5.5,5.5,7.5,0.0,2.5, RGB=255,255,255, TRANSPARENCY=0.407843, SURF_ID='INERT'/ AcDb3dSolid - 14AD
&OBST XB=-0.5,0.0,7.0,7.5,0.0,2.5, RGB=91,91,91, SURF_ID='INERT'/ AcDb3dSolid - 13D9
&OBST XB=-0.5,10.5,7.5,8.0,0.0,2.5, RGB=91,91,91, SURF_ID='INERT'/ AcDb3dSolid - 13D9
&OBST XB=10.0,10.5,7.0,7.5,0.0,2.5, RGB=91,91,91, SURF_ID='INERT'/ AcDb3dSolid - 13D9
&OBST XB=-0.5,0.0,0.0,5.0,0.0,2.5, RGB=91,91,91, SURF_ID='INERT'/ AcDb3dSolid - 16F9
&OBST XB=-0.5,0.0,5.5,6.0,0.0,2.5, RGB=91,91,91, SURF_ID='INERT'/ AcDb3dSolid - 16F9
&OBST XB=-0.5,1.5,5.0,5.5,0.0,2.5, RGB=91,91,91, SURF_ID='INERT'/ AcDb3dSolid - 16F9
&OBST XB=-0.5,10.5,-0.5,0.0,0.0,2.5, RGB=91,91,91, SURF_ID='INERT'/ AcDb3dSolid - 16F9
&OBST XB=8.5,10.5,5.0,5.5,0.0,2.5, RGB=91,91,91, SURF_ID='INERT'/ AcDb3dSolid - 16F9
&OBST XB=10.0,10.5,0.0,5.0,0.0,2.5, RGB=91,91,91, SURF_ID='INERT'/ AcDb3dSolid - 16F9
&OBST XB=10.0,10.5,5.5,6.0,0.0,2.5, RGB=91,91,91, SURF_ID='INERT'/ AcDb3dSolid - 16F9
&OBST XB=2.5,7.5,5.0,5.5,0.0,2.5, RGB=91,91,91, SURF_ID='INERT'/ AcDb3dSolid - 16FE
&OBST XB=1.5,2.5,5.0,5.5,2.0,2.5, RGB=91,91,91, SURF_ID='INERT'/ AcDb3dSolid - 1445
&OBST XB=7.5,8.5,5.0,5.5,2.0,2.5, RGB=91,91,91, SURF_ID='INERT'/ AcDb3dSolid - 1452
&OBST XB=-0.5,0.0,6.0,7.0,2.0,2.5, RGB=91,91,91, SURF_ID='INERT'/ AcDb3dSolid - 1456
&OBST XB=10.0,10.5,6.0,7.0,2.0,2.5, RGB=91,91,91, SURF_ID='INERT'/ AcDb3dSolid - 1463
&OBST XB=-0.5,10.5,-0.5,8.0,2.5,2.75, RGB=91,91,91, SURF_ID='INERT'/ AcDb3dSolid - 1469

&VENT SURF_ID='FIRE', XB=9.5,10.0,6.0,6.5,0.0,0.0/ Vent
&VENT SURF_ID='OPEN', XB=11.0,11.0,-1.0,8.0,0.0,3.0/ Mesh Vent: Mesh1 [XMAX]
&VENT SURF_ID='OPEN', XB=-1.0,-1.0,-1.0,8.0,0.0,3.0/ Mesh Vent: Mesh1 [XMIN]
&VENT SURF_ID='OPEN', XB=-1.0,11.0,8.0,8.0,0.0,3.0/ Mesh Vent: Mesh1 [YMAX]
&VENT SURF_ID='OPEN', XB=-1.0,11.0,-1.0,-1.0,0.0,3.0/ Mesh Vent: Mesh1 [YMIN]
&VENT SURF_ID='OPEN', XB=-1.0,11.0,-1.0,8.0,3.0,3.0 XYZ=5.0,4.5,3.0, RADIUS=0.5/ Mesh Vent: Mesh1 [ZMAX]

&DUMP DT_PL3D=10, PLOT3D_QUANTITY(1:5)='TEMPERATURE', 'U-VELOCITY','V-VELOCITY','W-VELOCITY','HRRPUV' /

&TAIL /

#######################
Many thanks!

from fdsreader.

JanVogelsang avatar JanVogelsang commented on August 30, 2024

The reason your approach doesn't work is because of the implementation of the data_3d.quantities attribute. Under the hood is uses a set to find all quantities that were output in the simulation, which do not have to be present on every single Plot3D instance as you can specify the quantities in the "DUMP" namelist.
Your approach will also work if you use the quantities attribute of the individual Plot3D (after applying your indexing on data_3d pl_t1 = sim.data_3d[t]), as those will only contain the exact (sorted) quantities of the specific Plot3D instance.

To make life easier for you (and others with the same issue), I just added a new convenience method to get the index of the quantity:
quantity_idx = pl_t1.get_quantity_index("Temperature")

Please update your fdsreader package to version 1.3.0 (or simply the newest version) and tell me if this works for you.

from fdsreader.

kamaliseresht avatar kamaliseresht commented on August 30, 2024

I updated the library to 1.3.0 but pl_t1.get_quantity_index("Temperature") doesn't seem to be a feature yet.
However, I could resolve the issue based on your explanation.
Thank you so much!

from fdsreader.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.