5.7. psi.material

5.7.1. Material

class psi.material.Material(name)

Methods

__init__(name)

Create a material object.

Parameters

name (str) – Unique name for material instance.

Example

Create a material and define its density.

>>> mat1 = Material("A53A")
>>> mat1.rho = 0.365

Warning

The user is responsible for entering all required material data such as sh, alp, rho, nu and ymod.

Note

A quicker and safer way to define a material is to use the method Material.from_file and to change the properties as needed.

Example

To input the material hot allowable enter a list of tuples consisting of the temperature and corresponding value:

>>> mat1.sh.table = [(t1, v1), (t2, v2), ..., (tn, vn)]

Note

Temperature related data need not be input in ascending order (i.e. t1 < t2 < tn), however it is good practice to do so for clarity.

classmethod from_file(name, material, code, fname=None, default_units='english')

Create a material from a csv data file.

Parameters
  • name (str) – Unique name for pipe object.

  • material (str) – Name of material in database.

  • code (str) – The piping code the material data comes from, ‘B31.1’ for example.

  • fname (str) –

    Pull path to the csv data file used to do the lookup.

    Note

    The default path is set to the variable psi.MATERIAL_DATA_FILE.

  • default_units (str) –

    The units used for the data. Must be one of the units defined in the psi.UNITS_DIRECTORY path.

    Note

    The values are converted to base units upon loading. Conversion to and from base to user units occurs on the fly.

Example

Create a A53A material instance and activate it.

>>> mat1 = Material.from_file("A53A", "A53A", "B31.1")
apply(elements=None)

Assign a material instance to a piping element.

activate()

Activate the material instance.

Note

All elements created after this method call will automatically be assigned the material activated.

Attributes

parent

Returns the MaterialContainer instance.

sh

Return the material hot allowable.

Note

This can mean Sh or Sm, etc, depending on the code used. It is up to the user to interpret the results accordingly.

Example

To input the hot allowable for a material:

>>> mat1.sh.table = [(t1, sh1), (t2, sh2), ..., (tn, shn)]
ymod

Return the material young’s modulus.

Example

To input the thermal expansion coefficient:

>>> mat1.ymod.table = [(t1, ymod1), (t2, ymod2), ..., (tn, ymodn)]
alp

Return the material thermal expansion coefficient.

Example

To input the thermal expansion coefficient:

>>> mat1.alp.table = [(t1, alp1), (t2, alp2), ..., (tn, alpn)]
rho

Returns the material density.

Example

To input the material density.

>>> mat1.rho.value = 0.365

Note

The density of a material is not temperature dependant at the moment, therefore the value at room temperature should be used. In general the density of steels do not change drastically due to thermal effects.

nu

Returs the material poisson’s ratio.

Example

To input the material poisson’s ratio.

>>> mat1.nu.value = 0.3

Note

Similar to the density the poisson’s ratio for steels is not strongly dependent on the temperature. Therefore a default value of 0.3 should be used.

5.7.2. MaterialContainer

class psi.material.MaterialContainer

Methods

apply(inst, elements=None)

Apply a material to elements.

Parameters
  • inst (Material) – An instance of a material.

  • elements (List of Elements) –

    A list of elements.

    Note

    If elements is None, the active set of elements is used.

Example

Create a material and assign it to all active elements.

>>> mat1 = Material.from_file("A53A", "A53A", "B31.1")
>>> mat1.apply(p1)