# pycbg.preprocessing.Materials

class `pycbg.preprocessing.``Materials`

  Create materials for particle sets.

  `materials`

    Each element is a dictionnary containing a material’s parameters. The index of a material is his id.

    Type

      list of dict

  `psets_ids`

    The element i of this list is the id of the particle set made of the material defined in `materials[i]`.

    Type

      list of ints

  Notes

  Due to (probably) a bug in CB-Geo, materials should be created in the same order than the corresponding particle sets (so particle sets and materials have the same id).

  Examples

  Creating two materials for two particle sets :

      >>> mesh = Mesh((1.,1.,1.), (1,1,1))
      >>> particles = Particles(mesh, 2)
      >>> entity_sets = EntitySets(mesh, particles)
      >>> lower_particles = entity_sets.create_set(lambda x,y,z: x<.5, typ="particle")
      >>> upper_particles = entity_sets.create_set(lambda x,y,z: x>=.5, typ="particle")
      >>> materials = Materials()
      >>> materials.create_MohrCoulomb3D(pset_id=lower_particles, density=750,
      ...                                                         youngs_modulus=5.26e7,
      ...                                                         poisson_ratio=.3,
      ...                                                         friction=36.,
      ...                                                         dilation=0.,
      ...                                                         cohesion=1.,
      ...                                                         tension_cutoff=1.,
      ...                                                         softening=False)
      >>> materials.create_Newtonian3D(pset_id=upper_particles, density=1.225,
      ...                                                       bulk_modulus=1.42e5,
      ...                                                       dynamic_viscosity=1.81e3)
      >>> materials.pset_ids
      [0, 1]

  `__init__`()

    Initialize self. See help(type(self)) for accurate signature.

  Methods

  `__init__` | Initialize self.
  `create_LinearElastic3D` | Create LinearElastic3D material.
  `create_MohrCoulomb3D` | Create MohrCoulomb3D material, as specified by CB-Geo documentation.
  `create_Newtonian3D` | Create Newtonian3D material, as specified by CB-Geo documentation.

  `create_LinearElastic3D`(pset_id=0, density=1000.0, youngs_modulus=50000000.0, poisson_ratio=0.3)

    Create LinearElastic3D material.

    Parameters

      - pset_id (int) – Particle set id that will be made off this material

      - density (float, optional) – Density of the material (\(kg/m^3\)). Default is 1.225 \(kg/m^3\).

      - young_modulus (float, optional) – Young’s modulus of the material (\(Pa\)). Default is 50 \(GPa\).

      - poisson_ratio (float, otpional) – Poisson’s ratio of the material. Default is 0.3 .

  `create_MohrCoulomb3D`(pset_id=0, density=1000.0, youngs_modulus=50000000.0, poisson_ratio=0.3, friction=36.0, dilation=0.0, cohesion=0.0, tension_cutoff=0.0, softening=False, peak_pdstrain=0.0, residual_pdstrain=0.0, residual_friction=13.0, residual_dilation=0.0, residual_cohesion=0.0)

    Create MohrCoulomb3D material, as specified by CB-Geo documentation.

    Parameters

      - pset_id (int) – Particle set id that will be made off this material

      - density (float, optional) – Density of the material (\(kg/m^3\)). Default is 1.225 \(kg/m^3\).

      - young_modulus (float, optional) – Young’s modulus of the material (\(Pa\)). Default is 50 \(GPa\).

      - poisson_ratio (float, otpional) – Poisson’s ratio of the material. Default is 0.3 .

      - friction (float, optional) – Friction angle of the material (\(^\circ\)). Default is 36 \(^\circ\).

      - dilation (float, optional) – Dilation angle of the material (\(^\circ\)). Default is 0 \(^\circ\).

      - cohesion (float, optional) – Cohesion in the material (\(Pa\)). Default is 0 \(Pa\).

      - tension_cutoff (float, optional) – Tension strength of the material (\(Pa\)). Default is 0 \(Pa\).

      - softening (bool, optional) – Enable softening option. If True, one has to set peak_pdstrain, residual_pdstrain, residual_friction, residual_dilation and residual_cohesion. Default is False.

      - peak_pdstrain (float, optional) – Start point of strain softening. Default is 0.

      - residual_pdstrain (float, optional) – End point of strain softening. Default is 0.

      - residual_friction (float, optional) – Residual friction angle (\(^\circ\)). Default is 13 \(^\circ\).

      - residual_dilation (float, optional) – Residual dilation angle (\(^\circ\)). Default is 0 \(^\circ\).

      - residual_cohesion (float, optional) – Residual cohesion (\(Pa\)). Default is 0 \(Pa\).

  `create_Newtonian3D`(pset_id=0, density=1.225, bulk_modulus=142000.0, dynamic_viscosity=1.81e-05)

    Create Newtonian3D material, as specified by CB-Geo documentation.

    Parameters

      - pset_id (int) – Particle set id that will be made off this material

      - density (float, optional) – Density of the material (\(kg/m^3\)). Default is 1.225 \(kg/m^3\).

      - bulk_modulus (float, optional) – Bulk modulus of the material (\(Pa\)). Default is 142 \(kPa\).

      - dynamic_viscosity (float, otpional) – Dynamic viscosity of the material (\(Pa.s\)). Default is 18.1 \(\mu Pa.s\)

    Notes

    Defaults correspond to air’s properties.