Skip to main content

Material import

from treble_tsdk.tsdk import TSDK
from treble_tsdk import tsdk_namespace as treble
from treble_tsdk import display_data as dd

tsdk = TSDK()

The following types can be imported:

  • Full octave absorption
  • Third octave absorption
  • Surface impedance
  • Reflection coefficient
  • Coming soon: Material builder

Absorption coefficients import

Here we will show an example of importing absorption properties given random incidence absorption coefficients for full octave bands. Absorption coefficients are converted to surface impedance.

absorption_coefficients = [0.2, 0.45, 0.3, 0.65, 0.8, 0.82, 0.84, 0.88]

# First we define a material definition which is used to perform material fitting
material_definition = treble.MaterialDefinition(
name="Full octave absorption material",
description="Imported material",
category=treble.MaterialCategory.curtains,
default_scattering=0.4,
material_type=treble.MaterialRequestType.full_octave_absorption,
coefficients=absorption_coefficients,
)

# Material fitting outputs fitted material information, nothing is saved in this step
fitted_material = tsdk.material_library.perform_material_fitting(material_definition)
# We can plot the material information for verification
fitted_material.plot()
# Now we can create a material which can then be used when creating simulations
created_material = tsdk.material_library.create(fitted_material)
dd.as_tree(created_material)

Surface impedance

Here we will show an example of importing material given third octave complex surface impedance.

coefficients = [
(342.4274-3147.8j),
(358.6007-2515.4j),
(344.2741-1956.7j),
(341.8532-1553.4j),
(358.8722-1239.6j),
(347.5786-947.6j),
(351.247-739.8j),
(359.7332-567.9j),
(360.8415-424.4j),
(373.8132-300.6j),
(401.4228-195.3j),
(441.0573-117j),
(509.9243-62.2j),
(574.991-83.3j),
(580.3443-146.5j),
(506.0581-180.6j),
(426.3545-140.3j),
(444.5958-62.7j),
(465.5363-75.3j),
(449.401-75.3j),
(436.9184-64.2j),
(428.9319-53.4j),
(424.0636-42.5j),
(420.8714-33.7j)
]

# First we define a material definition which is used to perform material fitting
material_definition = treble.MaterialDefinition(
name="Surface impedance",
description="Imported material",
category=treble.MaterialCategory.curtains,
default_scattering=0.4,
material_type=treble.MaterialRequestType.surface_impedance,
coefficients=coefficients,
specific_impedance=False
)

# Material fitting outputs fitted material information, nothing is saved in this step
fitted_material = tsdk.material_library.perform_material_fitting(material_definition)
# Plot the material information
fitted_material.plot()
# Now we can create a material which can then be used when creating simulations
created_material = tsdk.material_library.create(fitted_material)
dd.as_tree(created_material)

Reflection coefficients

Here we will show an example of importing material given third octave complex reflection coefficients.

coefficients = [
(0.9405-0.248j),
(0.908-0.3j),
(0.858-0.367j),
(0.7911-0.43j),
(0.7012-0.48j),
(0.5747-0.53j),
(0.4423-0.54j),
(0.3062-0.51j),
(0.1797-0.45j),
(0.0842-0.35j),
(0.0412-0.23j),
(0.0509-0.13j),
(0.1093-0.06j),
(0.1701-0.07j),
(0.1864-0.12j),
(0.1349-0.17j),
(0.0429-0.16j),
(0.0422-0.07j),
(0.0669-0.08j),
(0.0497-0.083j),
(0.0339-0.073j),
(0.0231-0.062j),
(0.016-0.05j),
(0.0113-0.04j),
]

material_definition = treble.MaterialDefinition(
name="Surface impedance",
description="Imported material",
category=treble.MaterialCategory.curtains,
default_scattering=0.4,
material_type=treble.MaterialRequestType.reflection_coefficient,
coefficients=coefficients,
specific_impedance=False
)

fitted_material = tsdk.material_library.perform_material_fitting(material_definition)
# Plot the fitted material
fitted_material.plot()
# Create the material in the database
created_material = tsdk.material_library.create(fitted_material)
dd.as_tree(created_material)

Material builder

Here we will show an example of creating a porous material using the material builder. Material builder is used to build materials from back to front, with a rigid backing layer as starting point, a porous absorber layer and an optional air cavity layer.

Currently we offer air gaps and porous materials (rockwool or glasswool).

Important: Either flow_resistivity (in [Pa s / m2]) or density (in kg / m3) and wool_type (rock_wool or glass_wool) need to be provided

Material with rigid bakcing, air cavity and porous absorber layers

# First we create a PorousMaterialBuilderDefinition
material_definition = treble.PorousMaterialBuilderDefinition(
name="Material builder",
description="",
category=treble.MaterialCategory.other,
porous_layer_thickness=50,
air_cavity_layer_thickness=200, # Optional, set to None or 0 to skip air cavity layer
flow_resistivity=10000, # Flow resistivity in [Pa s / m2] (optional)
)

# Perform material fitting
fitted_material = tsdk.material_library.perform_material_fitting(material_definition)

# Plot the material information
fitted_material.plot()
# Then we can create any (or all) of the materials in the database
created_material = tsdk.material_library.create(fitted_material)
dd.as_tree(created_material)