Coder Social home page Coder Social logo

Comments (11)

JanVogelsang avatar JanVogelsang commented on August 30, 2024

Good catch, there is a bug for 3D-slices.

from fdsreader.

JanVogelsang avatar JanVogelsang commented on August 30, 2024

Alright, I fixed the bug and validated the results, which are indeed correct now. Try out version 1.9.13 please and tell me if everything works for you now.

from fdsreader.

3dfirelab avatar 3dfirelab commented on August 30, 2024

from fdsreader.

JanVogelsang avatar JanVogelsang commented on August 30, 2024

Unfortunately, I won't have the capacities for that, but feel free to either create a PR for that or provide code snippets in case you combine the smoke_3d arrays manually. With some existing code at hand, it is less work to make a whole function out of that which also covers some edge cases.

Alternatively, if you could provide a minimal example for a case where you would need a smoke_3d to_global function, I might find some time to implement the to_global function and use that example for debugging. In theory, it should be very similar to the to_global implementation of 3D slices. It will even be simpler, as they always cover the whole extent of the mesh and not just parts of meshes.

from fdsreader.

JanVogelsang avatar JanVogelsang commented on August 30, 2024

@3dfirelab Alright, I actually implemented to_global for both Plot3D and Smoke3D data now. I tested it on a small test case and that worked, so feel free to upgrade to 1.10.0, test it with your cases as well and give me feedback if it works for you as well!

from fdsreader.

3dfirelab avatar 3dfirelab commented on August 30, 2024

This is working thanks

However for the same simulation as above, an acetone poolfire with 12 meshes split with

 I_UPPER=1, J_UPPER=1, K_UPPER=2

I can see the edges of the meshes in the smoke field
image

the same simulation with to_global() apply to temperature saved in a 3d slices that span over the whole domain

&SLCF XB=-0.3,0.3,-0.3,0.3,-0.05,1.15, QUANTITY='TEMPERATURE', /

yields to
image

from fdsreader.

JanVogelsang avatar JanVogelsang commented on August 30, 2024

Can you send me the python script you used for plotting, so that I can reproduce your results and debug the issue?

from fdsreader.

3dfirelab avatar 3dfirelab commented on August 30, 2024
import numpy as np 
import matplotlib.pyplot as plt
import fdsreader
from scipy.interpolate import RegularGridInterpolator, griddata
import sys
import pdb 

###########################
def load_slice(sim, id_var):
    slc = sim.slices[id_var] # to load temperature. see order of &SLCF in fds config file 
    data, grid = slc.to_global(return_coordinates=True, masked=True)  # need version 1.9.13

    times = slc.times

    return data, grid, times


###########################
def load_3dsmoke(sim, id_var):
    data = sim.smoke_3d[id_var] # to load temperature. see order of &SLCF in fds config file 
    mtx, grid = data.to_global(return_coordinates=True, masked=True)  # need version 1.9.13

    times = data.times

    return mtx, times


sim = fdsreader.Simulation('./NIST_PoolFire/') #load simulation
temp, grid, times_temp = load_slice(sim, 3)
smoke, times_smoke = load_3dsmoke(sim, 0)

#plot
ax = plt.subplot(131)
plt.imshow(temp[-1,:,30,:].T, origin='lower')
ax.set_title('temperature')
ax = plt.subplot(132)
plt.imshow(smoke[-1,:,int(smoke.shape[1]/2),:].T, origin='lower')
ax.set_title('3d smoke')
ax = plt.subplot(133)
plt.imshow(smoke[-1,:,int(smoke.shape[1]/2),:].T, origin='lower', vmax=5)
ax.set_title('3d smoke vmax=5')
plt.show()

attached in the input config file for the simulation NIST_PoolFire
input_NIST_Acetone_Prescribed_1cm.txt

from fdsreader.

JanVogelsang avatar JanVogelsang commented on August 30, 2024

Fixed in 1.10.1. Please try that out and give me feedback if you encounter any issues with that.

from fdsreader.

3dfirelab avatar 3dfirelab commented on August 30, 2024

it works thanks

only the masked=True option gave an error

File ~/anaconda3/envs/geo/lib/python3.9/site-packages/fdsreader/smoke3d/smoke3d.py:216, in Smoke3D.to_global(self, masked, fill, return_coordinates)
    214         subsmoke_data = np.concatenate((subsmoke_data, temp_data[dim][tuple(temp_data_slices)]), axis=axis + 1)
    215         if masked:
--> 216             mask = np.concatenate((mask, temp_mask[dim]), axis=axis + 1)
    218 # If the slice should be masked, we set all cells at which an obstruction is in the
    219 # simulation space to the fill value set by the user
    220 if masked:

File <__array_function__ internals>:200, in concatenate(*args, **kwargs)

ValueError: all the input array dimensions except for the concatenation axis must match exactly, but along dimension 2, the array at index 0 has size 30 and the array at index 1 has size 31

from fdsreader.

JanVogelsang avatar JanVogelsang commented on August 30, 2024

Fixed in 1.10.2

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.