import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import fdsreader
def visualize_heat_transfer(fds_file):
fds_file = 'C:\\Users\\glime\\OneDrive\\Рабочий стол\\2\\Example.fds'
try:
data = fdsreader.read(fds_file)
temperature = data['Temperature']
x = np.linspace(0, temperature.shape[0], temperature.shape[0])
y = np.linspace(0, temperature.shape[1], temperature.shape[1])
z = np.linspace(0, temperature.shape[2], temperature.shape[2])
X, Y, Z = np.meshgrid(x, y, z)
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
sc = ax.scatter(X.flatten(), Y.flatten(), Z.flatten(), c=temperature.flatten(), cmap='hot', marker='o', alpha=0.5)
plt.colorbar(sc, label='Temperature (K)')
ax.set_xlabel('X')
ax.set_ylabel('Y')
ax.set_zlabel('Z')
plt.title('3D Visualization of Heat Transfer')
plt.show()
visualize_heat_transfer(fds_file)
данные файла fds:
plaintext
&HEAD CHID='Example', TITLE='Example' /
## Computational domain, simulation time and ambient values
&MESH IJK=60,25,25, XB= 0.0,60.0, 0.0,25.0, 0.0,25.0/
plaintext
&HEAD CHID='Example', TITLE='Example' /
## Computational domain, simulation time and ambient values
&MESH IJK=60,25,25, XB= 0.0,60.0, 0.0,25.0, 0.0,25.0/
&TIME T_END=3600, DT=5/
&MISC SOLID_PHASE_ONLY=.TRUE., BNDF_DEFAULT=.FALSE./
&DUMP DT_DEVC=10/
&RADI RADIATION=.FALSE./
## Domain boundary conditions
&VENT MB='ZMAX',SURF_ID='OPEN'/
&VENT MB='YMIN',SURF_ID='OPEN'/
&VENT MB='YMAX',SURF_ID='OPEN'/
&VENT MB='XMIN',SURF_ID='OPEN'/
&VENT MB='XMAX',SURF_ID='OPEN'/
## Geometry
&OBST XB= 59.5, 60.5, 12.0, 13.0, 12.0, 13.0, SURF_ID='HOT STEEL' / # Центр точечного источника тепла на грани XMAX
&OBST XB= 59.5, 60.5, 12.0, 12.0, 12.0, 13.0, SURF_ID='ADIABATIC' /
&OBST XB= 59.5, 60.5, 13.0, 13.0, 12.0, 13.0, SURF_ID='ADIABATIC' /
&OBST XB= 0.0, 0.1, 0.0, 25.0, 0.0, 0.0, SURF_ID='ADIABATIC' / # Левый край
&OBST XB= 0.0, 60.0, 0.0, 0.0, 0.0, 0.0, SURF_ID='ADIABATIC' / # Нижний край
&OBST XB= 0.0, 60.0, 25.0, 25.0, 0.0, 0.0, SURF_ID='ADIABATIC' / # Верхний край
## Heater surface
&SURF ID='HOT STEEL', COLOR='RED', TMP_FRONT=800/
## Material properties
&SURF ID='ADIABATIC', COLOR='BLACK', ADIABATIC=.TRUE./
&MATL ID='STEEL', SPECIFIC_HEAT=0.45, CONDUCTIVITY=45.8, DENSITY=7850.0 /
&MATL ID='COPPER', SPECIFIC_HEAT=0.385, CONDUCTIVITY=401, DENSITY=8960.0 /
&MATL ID='CONCRETE', SPECIFIC_HEAT=0.75, CONDUCTIVITY=1.6, DENSITY=2400.0 /
&TAIL