ross.Material
ross.Material#
- class ross.Material(name, rho, E=None, G_s=None, Poisson=None, color='#525252', **kwargs)#
Material used on shaft and disks.
Class used to create a material and define its properties. Density and at least 2 arguments from E, G_s and Poisson should be provided.
You can run rs.Material.available_materials() to get a list of materials already provided.
- Parameters
- namestr
Material name.
- rhofloat, pint.Quantity
Density (kg/m**3).
- Efloat, pint.Quantity, optional
Young’s modulus (N/m**2).
- G_sfloat, pint.Quantity, optional
Shear modulus (N/m**2).
- Poissonfloat, optional
Poisson ratio (dimensionless).
- colorstr, optional
Color that will be used on plots.
Examples
>>> from ross.units import Q_ >>> AISI4140 = Material(name="AISI4140", rho=7850, E=203.2e9, G_s=80e9) >>> Steel = Material(name="Steel", rho=Q_(7.81, 'g/cm**3'), E=211e9, G_s=81.2e9) >>> AISI4140.Poisson 0.27 >>> Steel.rho 7809.999999999999
Methods
- __init__(name, rho, E=None, G_s=None, Poisson=None, color='#525252', **kwargs)#
- static available_materials()#
Return a list of all saved material’s name.
- Returns
- available_materialslist
A list containing all saved material’s names.
Examples
>>> import ross as rs >>> steel = rs.Material.load_material('Steel') >>> steel.name = 'test_material' >>> steel.save_material() >>> steel.remove_material('test_material')
- static dump_data(data)#
Save material properties.
This is an auxiliary function to save the materials properties in the save method.
- Parameters
- datadict
Dictionary containing all data needed to instantiate the Object.
- static get_data()#
Load material properties.
This is an auxiliary function to load all saved materials properties in the load_material method.
- Returns
- datadict
Containing all data needed to instantiate a Material Object.
- static load_material(name)#
Load a material that is available in the data file.
- Returns
- ross.Material
An object with the material properties.
- Raises
- KeyError
Error raised if argument name does not match any material name in the file.
Examples
>>> import ross as rs >>> steel = rs.Material.load_material('Steel')
- static remove_material(name)#
Delete a saved ross.Material.
- Parameters
- namestring
Name of Material Object to be deleted.
Examples
>>> import ross as rs >>> steel = rs.Material.load_material('Steel') >>> steel.name = 'test_material' >>> steel.save_material() >>> steel.remove_material('test_material')
- save_material()#
Save the material in the available_materials list.