Source code for ansys.dyna.core.pre.dynamaterial

"""
Material API
=============

Module for creating a material.
"""

from enum import Enum
import logging

from .dynabase import *  # noqa : F403


[docs] class Air: """Defines an air material. Parameters ---------- name : string Material name. mass_density : float, optional Mass density. The default is ``0.00128``. pressure_cutoff : float, optional pressure cutoff. The default is ``1e-09``. initial_internal_energy : float, optional Initial internal energy per unit reference volume. The default is ``2.5331e-06``. initial_relative_volume : float, optional Initial relative volume. The default is ``1.0``. equation_coefficient : list, optional Six polynomial equation coefficient. The default is ``[0, 0, 0, 0, 0.4, 0.4, 0])``. Returns ------- bool ``True`` when successful, ``False`` when failed. """ def __init__( self, mass_density=1.280e-03, pressure_cutoff=-1.0e-9, initial_internal_energy=2.5331e-6, initial_relative_volume=1.0, equation_coefficient=[0, 0, 0, 0, 0.4, 0.4, 0], ):
[docs] self.mass_density = mass_density
[docs] self.pressure_cutoff = pressure_cutoff
[docs] self.initial_internal_energy = initial_internal_energy
[docs] self.initial_relative_volume = initial_relative_volume
[docs] self.equation_coefficient = equation_coefficient
[docs] def create(self, stub): """Create an air material.""" ret = stub.CreateEOSLinearPolynomial( EOSLinearPolynomialRequest( ci=self.equation_coefficient, e0=self.initial_internal_energy, v0=self.initial_relative_volume, ) ) self.eos_id = ret.eosid ret = stub.CreateMatNull(MatNullRequest(ro=self.mass_density, pc=self.pressure_cutoff)) self.material_id = ret.mid self.name = "air" logging.info(f"Material {self.name} Created...")
[docs] class Liner: """Defines a liner material. Parameters ---------- mass_density : float, optional Mass density. The default is ``8.96``. shear_modulus : float, optional youngs_modulus : float, optional poissons_ratio : float optional constants : list, optional melt_temperature : int, optional room_temperature : int, optional strain_rate : float, optional specific_heat : float, optional tensile_failure_stress : float, optional spall_type, int, optional iteration_option ; int, optional failure_parameters : list, optional equation_constants, list, optional volume_correction_coefficient : float, optional initial_internal_energy : float, optional Initial internal energy per unit reference volume. The default is ``0``. Returns ------- bool ``True`` when successful, ``False`` when failed. """ def __init__( self, mass_density=8.96, shear_modulus=0.46, youngs_modulus=0, poissons_ratio=0.34, constants=[90e-5, 292e-5, 0.31, 0.025, 1.09], melt_temperature=1356, room_temperature=293, strain_rate=1e-6, specific_heat=383.0e-8, tensile_failure_stress=-1.2e-2, spall_type=2, iteration_option=0, failure_parameters=[0.54, 4.89, 3.03, 0.014, 1.12], equation_constants=[0.394, 1.489, 0, 0, 2.02], volume_correction_coefficient=0.47, initial_internal_energy=0, ):
[docs] self.mass_density = mass_density
[docs] self.shear_modulus = shear_modulus
[docs] self.youngs_modulus = youngs_modulus
[docs] self.poissons_ratio = poissons_ratio
[docs] self.constants = constants
[docs] self.melt_temperature = melt_temperature
[docs] self.room_temperature = room_temperature
[docs] self.strain_rate = strain_rate
[docs] self.specific_heat = specific_heat
[docs] self.tensile_failure_stress = tensile_failure_stress
[docs] self.spall_type = spall_type
[docs] self.iteration_option = iteration_option
[docs] self.failure_parameters = failure_parameters
[docs] self.equation_constants = equation_constants
[docs] self.volume_correction_coefficient = volume_correction_coefficient
[docs] self.initial_internal_energy = initial_internal_energy
[docs] def create(self, stub): """Create a liner material.""" ret = stub.CreateMatJohnsonCook( MatJohnsonCookRequest( ro=self.mass_density, g=self.shear_modulus, e=self.youngs_modulus, pr=self.poissons_ratio, constants=self.constants, tm=self.melt_temperature, tr=self.room_temperature, eps0=self.strain_rate, cp=self.specific_heat, pc=self.tensile_failure_stress, spall=self.spall_type, it=self.iteration_option, failure=self.failure_parameters, ) ) self.material_id = ret.mid ret = stub.CreateEOSGruneisen( EOSGruneisenRequest( constants=self.equation_constants, a=self.volume_correction_coefficient, e0=self.initial_internal_energy, ) ) self.eos_id = ret.eosid self.name = "liner" logging.info(f"Material {self.name} Created...")
[docs] class HighExplosive: """Defines a high-explosive material. Parameters ---------- mass_density : float, optional Mass density. The default is ``8.96``. detonation_velocity : float, optional chapman_jouget_pressure : float, optional jwl_equation_parameters : list, optional Returns ------- bool ``True`` when successful, ``False`` when failed. """ def __init__( self, mass_density=1.835, detonation_velocity=0.88, chapman_jouget_pressure=0.37, jwl_equation_parameters=[8.261, 0.1724, 4.55, 1.32, 0.38, 0.102, 1.0], ):
[docs] self.mass_density = mass_density
[docs] self.detonation_velocity = detonation_velocity
[docs] self.chapman_jouget_pressure = chapman_jouget_pressure
[docs] self.jwl_equation_parameters = jwl_equation_parameters
[docs] def create(self, stub): """Create a high-explosive material.""" ret = stub.CreateMatHighExplosiveBurn( MatHighExplosiveBurnRequest( ro=self.mass_density, d=self.detonation_velocity, pcj=self.chapman_jouget_pressure, ) ) self.material_id = ret.mid ret = stub.CreateEOSJWL(EOSJWLRequest(jwl_equation=self.jwl_equation_parameters)) self.eos_id = ret.eosid self.name = "HE" logging.info(f"Material {self.name} Created...")
[docs] class Vacuum: """Defines a vacuum material. Parameters ---------- estimated_material_density : float Estimated material density. The default is ``1e-09``. Returns ------- bool ``True`` when successful, ``False`` when failed. """ def __init__(self, estimated_material_density=1e-9):
[docs] self.estimated_material_density = estimated_material_density
[docs] def create(self, stub): """Create a null material.""" ret = stub.CreateMatVacuum(MatVacuumRequest(rho=self.estimated_material_density)) self.material_id = ret.mid self.eos_id = 0 self.name = "vacuum" logging.info(f"Material {self.name} Created...")
[docs] class MatNull: """Defines a null material. Young's modulus and Poisson's ratio are used to set the contact stiffness. Parameters ---------- mass_density : float, optional Mass density. The default is ``0``. pressure_cutoff : """ def __init__(self, mass_density=0, pressure_cutoff=0):
[docs] self.ro = mass_density
[docs] self.pc = pressure_cutoff
[docs] def create(self, stub): """Create a null material.""" ret = stub.CreateMatNull(MatNullRequest(ro=self.ro, pc=self.pc)) self.material_id = ret.mid self.name = "NULL" logging.info(f"Material {self.name} Created...")
[docs] class EMEOSTabulated1: """Defines electrical conductivity or permeability. Parameters ---------- curve : Curve """ def __init__(self, curve=None):
[docs] self.curve = curve
[docs] def create(self, stub): """Create an EM EOS tabulated1.""" lcid = self.curve.create(stub) ret = stub.CreateEMEOSTabulated1( EMEOSTabulated1Request( lcid=lcid, ) ) self.id = ret.id self.name = "tabulated1" logging.info(f"EOS {self.name} Created...") return self.id
[docs] class EMMATTYPE(Enum):
[docs] AIR_OR_VACUUM = 0
[docs] INSULATOR = 1
[docs] CONDUCTOR = 2
[docs] class MatAdditional: """Defines additional properties for a material.""" def __init__(self):
[docs] self.em = False
[docs] self.em_mat_type = 0
[docs] self.em_eos = None
[docs] self.thermal_isotropic = False
[docs] def set_electromagnetic_property(self, material_type=EMMATTYPE.CONDUCTOR, initial_conductivity=0, eos=None): """Define the electromagnetic material type and properties for a material whose permeability equals the free space permeability. Parameters ---------- material_type : initial_conductivity : eos : """ self.em = True self.em_material_type = material_type.value self.em_initial_conductivity = initial_conductivity self.em_eos = eos
[docs] def set_em_permeability_equal(self, material_type=EMMATTYPE.CONDUCTOR, initial_conductivity=0, eos=None): """Define the electromagnetic material type and properties for a material whose permeability equals the free space permeability. Parameters ---------- material_type : initial_conductivity : eos : """ self.em_mat_type = 1 self.em_material_type = material_type.value self.em_initial_conductivity = initial_conductivity self.em_eos = eos
[docs] def set_em_permeability_different( self, material_type=EMMATTYPE.CONDUCTOR, initial_conductivity=0, eos=None, murel=0 ): """Define the electromagnetic material type and properties for a material whose permeability equals the free space permeability. Parameters ---------- material_type : initial_conductivity : eos : murel : """ self.em_mat_type = 2 self.em_material_type = material_type.value self.em_initial_conductivity = initial_conductivity self.em_eos = eos self.murel = murel
[docs] def set_em_conducting_shells_3d(self, material_type=EMMATTYPE.CONDUCTOR, initial_conductivity=0): """Define the electromagnetic material type and properties for a material whose permeability equals the free space permeability. Parameters ---------- material_type : initial_conductivity : """ self.em_mat_type = 4 self.em_material_type = material_type.value self.em_initial_conductivity = initial_conductivity
[docs] def set_em_resistive_heating_2d(self, material_type=EMMATTYPE.CONDUCTOR, initial_conductivity=0): """Define the electromagnetic material type and properties for a material whose permeability equals the free space permeability. Parameters ---------- material_type : initial_conductivity : """ self.em_mat_type = 4 self.em_material_type = material_type.value self.em_initial_conductivity = initial_conductivity
[docs] def set_em_randles_batmac( self, positive_current_collector_conductivity=0, negative_current_collector_conductivity=0 ): """Define two conductivities per EM node for special applications (Randles Batmac). Parameters ---------- positive_current_collector_conductivity : float conductivities of the positive current collector materials negative_current_collector_conductivity : float conductivities of the negative current collector materials """ self.em_mat_type = 6 self.em_material_type = 5 self.sigp = positive_current_collector_conductivity self.sign = negative_current_collector_conductivity
[docs] def set_thermal_isotropic( self, density=0, generation_rate=0, generation_rate_multiplier=0, specific_heat=0, conductivity=0 ): """Define isotropic thermal properties. Parameters ---------- density : generation_rate : generation_rate_multiplier : specific_heat : conductivity : """ self.thermal_isotropic = True self.tro = density self.tgrlc = generation_rate self.tgmult = generation_rate_multiplier self.hc = specific_heat self.tc = conductivity
[docs] def create(self, stub, matid): """Define additional properties for a material. Parameters ---------- matid : Material ID. """ if self.em_mat_type: if self.em_eos is not None: eosid = self.em_eos.create(stub) else: eosid = 0 if self.em_mat_type == 1: stub.CreateEMMat001( EMMat001Request( mid=matid, mtype=self.em_material_type, sigma=self.em_initial_conductivity, eosid=eosid ) ) elif self.em_mat_type == 2: stub.CreateEMMat002( EMMat002Request( mid=matid, mtype=self.em_material_type, sigma=self.em_initial_conductivity, eosid=eosid, murel=self.murel, ) ) elif self.em_mat_type == 4: stub.CreateEMMat004( EMMat004Request(mid=matid, mtype=self.em_material_type, sigma=self.em_initial_conductivity) ) elif self.em_mat_type == 6: stub.CreateEMMat006( EMMat006Request(mid=matid, mtype=self.em_material_type, sigp=self.sigp, sign=self.sign) ) if self.em: if self.em_eos is not None: eosid = self.em_eos.create(stub) else: eosid = 0 stub.CreateMatEM( MatEMRequest(mid=matid, mtype=self.em_material_type, sigma=self.em_initial_conductivity, eosid=eosid) ) logging.info(f"Material EM Created...") if self.thermal_isotropic: stub.CreateMatThermalIsotropic( MatThermalIsotropicRequest( mid=matid, tro=self.tro, tgrlc=self.tgrlc, tgmult=self.tgmult, hc=self.hc, tc=self.tc, ) ) logging.info(f"Material thermal isotropic Created...")
# MAT_001
[docs] class MatElastic(MatAdditional): """Defines an isotropic hypoelastic material.""" def __init__(self, mass_density=0, young_modulus=0, poisson_ratio=0.3): MatAdditional.__init__(self)
[docs] self.ro = mass_density
[docs] self.e = young_modulus
[docs] self.pr = poisson_ratio
[docs] def create(self, stub): """Create an elastic material.""" ret = stub.CreateMatElastic(MatElasticRequest(ro=self.ro, e=self.e, pr=self.pr)) self.material_id = ret.mid self.name = "Elastic" MatAdditional.create(self, stub, self.material_id) logging.info(f"Material {self.name} Created...")
# MAT_003
[docs] class MatPlasticKinematic: """Define material of modelling isotropic and kinematic hardening plasticity.""" def __init__( self, mass_density=0, young_modulus=0, poisson_ratio=0.3, yield_stress=0, tangent_modulus=0, hardening=0 ):
[docs] self.ro = mass_density
[docs] self.e = young_modulus
[docs] self.pr = poisson_ratio
[docs] self.sigy = yield_stress
[docs] self.etan = tangent_modulus
[docs] self.beta = hardening
[docs] def create(self, stub): """Create plastic kinematic material.""" ret = stub.CreateMatPlasticKinematic( MatPlasticKinematicRequest(ro=self.ro, e=self.e, pr=self.pr, sigy=self.sigy, etan=self.etan, beta=self.beta) ) self.material_id = ret.mid self.name = "Plastic Kinematic" logging.info(f"Material {self.name} Created...")
# MAT_004
[docs] class MatElasticPlasticThermal(MatAdditional): """Defines temperature-dependent material coefficients.""" def __init__( self, mass_density=0, temperatures=None, young_modulus=None, poisson_ratio=None, thermal_expansion=None, yield_stress=None, ): MatAdditional.__init__(self)
[docs] self.ro = mass_density
[docs] self.ti = temperatures
[docs] self.ei = young_modulus
[docs] self.pri = poisson_ratio
[docs] self.alphai = thermal_expansion
[docs] self.sigyi = yield_stress
[docs] def create(self, stub): """Create elastic plastic thermal material.""" ret = stub.CreateMatElasticPlasticThermal( MatElasticPlasticThermalRequest( ro=self.ro, ti=self.ti, ei=self.ei, pri=self.pri, alphai=self.alphai, sigyi=self.sigyi, ) ) self.material_id = ret.mid self.name = "ElasticPlasticThermal" MatAdditional.create(self, stub, self.material_id) logging.info(f"Material {self.name} Created...")
# MAT_020
[docs] class MatRigid(MatAdditional): """Defines a rigid material. Parts made from a rigid material are considered to belong to a rigid body.""" def __init__( self, mass_density=0, young_modulus=0, poisson_ratio=0.3, center_of_mass_constraint=0, translational_constraint=0, rotational_constraint=0, ): MatAdditional.__init__(self)
[docs] self.ro = mass_density
[docs] self.e = young_modulus
[docs] self.pr = poisson_ratio
[docs] self.cmo = center_of_mass_constraint
[docs] self.con1 = translational_constraint
[docs] self.con2 = rotational_constraint
[docs] def create(self, stub): """Create rigid material.""" ret = stub.CreateMatRigid( MatRigidRequest( ro=self.ro, e=self.e, pr=self.pr, cmo=self.cmo, con1=self.con1, con2=self.con2, ) ) self.material_id = ret.mid self.name = "RIGID" MatAdditional.create(self, stub, self.material_id) logging.info(f"Material {self.name} Created...")
# MAT_030
[docs] class MatShapeMemory: """Describe the superelastic response present in shape-memory alloys, the peculiar material ability to undergo large deformations with a full recovery in loading-unloading cycles.""" def __init__( self, mass_density=0, young_modulus=0, poisson_ratio=0.3, effective_stress=None, forward_phase_transformation_start=None, forward_phase_transformation_final=None, reverse_phase_transformation_start=None, reverse_phase_transformation_final=None, recoverable_strain=0, ):
[docs] self.ro = mass_density
[docs] self.e = young_modulus
[docs] self.pr = poisson_ratio
[docs] self.lcss = effective_stress
[docs] self.params = [forward_phase_transformation_start]
self.params.append(forward_phase_transformation_final) self.params.append(reverse_phase_transformation_start) self.params.append(reverse_phase_transformation_final) self.params.append(recoverable_strain)
[docs] def create(self, stub): """Create shape memory material.""" ret = stub.CreateMatShapeMemory( MatShapeMemoryRequest( ro=self.ro, e=self.e, pr=self.pr, lcss=self.lcss, params=self.params, ) ) self.material_id = ret.mid self.name = "SHAPE_MEMORY" logging.info(f"Material {self.name} Created...")
# MAT_063
[docs] class MatCrushableFoam(MatAdditional): """Define material of modelling crushable foam.""" def __init__( self, mass_density=0, young_modulus=0, poisson_ratio=0.3, yield_stress_curve=None, tensile_stress_cutoff=0 ): MatAdditional.__init__(self)
[docs] self.ro = mass_density
[docs] self.e = young_modulus
[docs] self.pr = poisson_ratio
[docs] self.lcid = yield_stress_curve
[docs] self.tsl = tensile_stress_cutoff
[docs] def create(self, stub): """Create crushable foam material.""" if self.lcid is not None: cid = self.lcid.create(stub) else: cid = 0 ret = stub.CreateMatCrushableFoam( MatCrushableFoamRequest(ro=self.ro, e=self.e, pr=self.pr, lcid=cid, tsl=self.tsl) ) self.material_id = ret.mid self.name = "Crushable Foam" MatAdditional.create(self, stub, self.material_id) logging.info(f"Material {self.name} Created...")
# MAT_077_O
[docs] class MatOgdenRubber: """Provides the Ogden rubber model.""" def __init__( self, mass_density=0, poisson_ratio=0.3, limit_stress=0, shear_modulus=None, exponent=None, ):
[docs] self.ro = mass_density
[docs] self.pr = poisson_ratio
[docs] self.sigf = limit_stress
[docs] self.mu = shear_modulus
[docs] self.alpha = exponent
[docs] def create(self, stub): """Create ogden rubber material.""" ret = stub.CreateMatOgdenRubber( MatOgdenRubberRequest( ro=self.ro, pr=self.pr, n=0, nv=0, g=0, sigf=limit_stress, tbhys=0, mu=self.mu, alpha=self.alpha, ) ) self.material_id = ret.mid self.name = "OGDEN_RUBBER" logging.info(f"Material {self.name} Created...")
# MAT_T01
[docs] class MatThermalIsotropic: """Defines isotropic thermal properties.""" def __init__(self, density=0, generation_rate=0, generation_rate_multiplier=0, specific_heat=0, conductivity=0):
[docs] self.tro = density
[docs] self.tgrlc = generation_rate
[docs] self.tgmult = generation_rate_multiplier
[docs] self.hc = specific_heat
[docs] self.tc = conductivity
[docs] def create(self, stub): """Create isotropic thermal material.""" ret = stub.CreateMatThermalIsotropic( MatThermalIsotropicRequest( tro=self.tro, tgrlc=self.tgrlc, tgmult=self.tgmult, hc=self.hc, tc=self.tc, ) ) self.material_id = ret.mid self.name = "Isotropic thermal" logging.info(f"Material {self.name} Created...")
# MAT_T02
[docs] class MatThermalOrthotropic: """Defines orthotropic thermal properties.""" def __init__(self, specific_heat=0, conductivity_x=0, conductivity_y=0, conductivity_z=0):
[docs] self.hc = specific_heat
[docs] self.k1 = conductivity_x
[docs] self.k2 = conductivity_y
[docs] self.k3 = conductivity_z
[docs] def create(self, stub): """Create orthotropic thermal material.""" ret = stub.CreateMatThermalOrthotropic( MatThermalOrthotropicRequest( hc=self.hc, k1=self.k1, k2=self.k2, k3=self.k3, ) ) self.material_id = ret.mid self.name = "Orthotropic thermal" logging.info(f"Material {self.name} Created...")
# MAT_220
[docs] class MatRigidDiscrete: """Defines a rigid material for shells or solids. Parameters ---------- mass_density : young_modulus : poisson_ratio : """ def __init__(self, mass_density=0, young_modulus=0, poisson_ratio=0.3):
[docs] self.ro = mass_density
[docs] self.e = young_modulus
[docs] self.pr = poisson_ratio
[docs] def create(self, stub): """Create a rigid material.""" ret = stub.CreateMatRigidDiscrete(MatRigidDiscreteRequest(ro=self.ro, e=self.e, pr=self.pr)) self.material_id = ret.mid self.name = "RIGID Discrete" logging.info(f"Material {self.name} Created...")
# MAT_024
[docs] class MatPiecewiseLinearPlasticity: """Defines an elasto-plastic material with an arbitrary stress. The arbitrary stress is defined as a function of strain curve that can also have an arbitrary strain rate dependency. Parameters ---------- mass_density : young_modulus : poisson_ratio : yield_stress : tangent_modulus : """ def __init__( self, mass_density=0, young_modulus=0, poisson_ratio=0.3, yield_stress=0, tangent_modulus=0, ):
[docs] self.ro = mass_density
[docs] self.e = young_modulus
[docs] self.pr = poisson_ratio
[docs] self.sigy = yield_stress
[docs] self.etan = tangent_modulus
[docs] def create(self, stub): """Create a piecewise linear plasticity material.""" ret = stub.CreateMatPiecewiseLinearPlasticity( MatPiecewiseLinearPlasticityRequest(ro=self.ro, e=self.e, pr=self.pr, sigy=self.sigy, etan=self.etan) ) self.material_id = ret.mid self.name = "Piecewise Linear Plasticity" logging.info(f"Material {self.name} Created...")
# MAT_123
[docs] class MatModifiedPiecewiseLinearPlasticity: """Defines an elasto-plastic material supporting an arbitrary stress. The arbitrary stress is defined as a function of strain curve and arbitrary strain rate dependency. Parameters ---------- mass_density : young_modulus : poisson_ratio : yield_stress : tangent_modulus : plastic_strain_to_failure : integration_points_number : """ def __init__( self, mass_density=0, young_modulus=0, poisson_ratio=0, yield_stress=0, tangent_modulus=0, plastic_strain_to_failure=0, integration_points_number=0, ):
[docs] self.ro = mass_density
[docs] self.e = young_modulus
[docs] self.pr = poisson_ratio
[docs] self.sigy = yield_stress
[docs] self.etan = tangent_modulus
[docs] self.fail = plastic_strain_to_failure
[docs] self.numint = integration_points_number
[docs] def create(self, stub): """Create a modified piecewise linear plasticity.""" ret = stub.CreateMatModifiedPiecewiseLinearPlasticity( MatModifiedPiecewiseLinearPlasticityRequest( ro=self.ro, e=self.e, pr=self.pr, sigy=self.sigy, etan=self.etan, fail=self.fail, numint=self.numint, ) ) self.material_id = ret.mid self.name = "Modified Piecewise Linear Plasticity" logging.info(f"Material {self.name} Created...")
# MAT_100
[docs] class MatSpotweld: """Defines a spotweld material. Parameters ---------- mass_density : young_modulus : poisson_ratio : yield_stress : plastic_hardening_modulus : axial_force_resultant_at_failure : force_resultant_nrs_at_failure : force_resultant_nrt_at_failure : """ def __init__( self, mass_density=0, young_modulus=0, poisson_ratio=0, yield_stress=0, plastic_hardening_modulus=0, axial_force_resultant_at_failure=0, force_resultant_nrs_at_failure=0, force_resultant_nrt_at_failure=0, ):
[docs] self.ro = mass_density
[docs] self.e = young_modulus
[docs] self.pr = poisson_ratio
[docs] self.sigy = yield_stress
[docs] self.eh = plastic_hardening_modulus
[docs] self.nrr = axial_force_resultant_at_failure
[docs] self.nrs = force_resultant_nrs_at_failure
[docs] self.nrt = force_resultant_nrt_at_failure
[docs] def create(self, stub): """Create a spotweld material.""" ret = stub.CreateMatSpotweld( MatSpotweldRequest( ro=self.ro, e=self.e, pr=self.pr, sigy=self.sigy, eh=self.eh, nrr=self.nrr, nrs=self.nrs, nrt=self.nrt, ) ) self.material_id = ret.mid self.name = "Spotweld" logging.info(f"Material {self.name} Created...")
# MAT_034
[docs] class MatFabric: """Define an airbag material. Parameters ---------- mass_density : float, optional Mass density. The default is ``0``. young_modulus_longitudinal_direction : float, optional Young's modulus-longitudinal direction. The default is ``0``. young_modulus_transverse_direction : float, optional Young's modulus-transverse direction. The default is ``0``. minor_poisson_ratio : float, optional Minor Poisson's ratio ba direction. The default is ``0.35``. major_poisson_ratio : float, optional Major Poisson's ratio ab direction. The default is ``0.35``. shear_modulus : float, optional Shear modulus in the ab direction. The default is ``0``. """ def __init__( self, mass_density=0, young_modulus_longitudinal_direction=0, young_modulus_transverse_direction=0, minor_poisson_ratio=0.35, major_poisson_ratio=0.35, shear_modulus=0, ):
[docs] self.ro = mass_density
[docs] self.ea = young_modulus_longitudinal_direction
[docs] self.eb = young_modulus_transverse_direction
[docs] self.prba = minor_poisson_ratio
[docs] self.prab = major_poisson_ratio
[docs] self.gab = shear_modulus
[docs] def create(self, stub): """Create an airbag material.""" ret = stub.CreateMatFabric( MatFabricRequest( ro=self.ro, ea=self.ea, eb=self.eb, prba=self.prba, prab=self.prab, gab=self.gab, ) ) self.material_id = ret.mid logging.info("Material Fabric Created...")
# MAT_S04
[docs] class MatSpringNonlinearElastic: """Provides a nonlinear elastic translational and rotational spring with an arbitrary force. The arbitrary force is defined as a function of displacement. The moment is defined as a function of rotation. Parameters ---------- curve : Curve Load curve describing force as a function of displacement or moment as a function of rotation relationship. """ def __init__(self, curve):
[docs] self.curve = curve
[docs] def create(self, stub): """Create material spring nonlinear elastic.""" lcid = self.curve.create(stub) ret = stub.CreateMatSpringNonlinearElastic(MatSpringNonlinearElasticRequest(lcid=lcid)) self.material_id = ret.mid logging.info("Material Spring Nonlinear Elastic Created...")
# MAT_S02
[docs] class MatDamperViscous: """Provides a linear translational or rotational damper located between two nodes. Parameters ---------- damping_constant : """ def __init__(self, damping_constant=0):
[docs] self.dc = damping_constant
[docs] def create(self, stub): """Create a material damper viscous.""" ret = stub.CreateMatDamperViscous(MatDamperViscousRequest(dc=self.dc)) self.material_id = ret.mid logging.info("Material damper viscous Created...")
# MAT_S05
[docs] class MatDamperNonlinearViscous: """Provides a viscous translational damper with an arbitrary force. The arbitrary force is defined as a function of velocity dependency or a rotational damper with an arbitrary moment as a function of rotational velocity dependency. Parameters ---------- curve : Curve Load curve defining force as a function of rate-of-displacement relationship or a moment as a function of rate-of-rotation relationship. """ def __init__(self, curve):
[docs] self.curve = curve
[docs] def create(self, stub): """Create a material damper nonlinear viscous.""" lcdr = self.curve.create(stub) ret = stub.CreateMatDamperNonlinearViscous(MatDamperNonlinearViscousRequest(lcdr=lcdr)) self.material_id = ret.mid logging.info("Material damper viscous Created...")
# MAT_SPH_02
[docs] class MatSPHIncompressibleFluid: """Defines an ISPH (incompressible smooth particle hyrodynamics) fluid material. Parameters ---------- mass_density : float, optional Mass density. The default is ``0``. dynamic_viscosity : tension_coefficient1 : tension_coefficient2 : """ def __init__(self, mass_density=0, dynamic_viscosity=0, tension_coefficient1=0, tension_coefficient2=0):
[docs] self.ro = mass_density
[docs] self.mu = dynamic_viscosity
[docs] self.gamma1 = tension_coefficient1
[docs] self.gamma2 = tension_coefficient2
[docs] def create(self, stub): """Create an ISPH fluid material.""" ret = stub.CreateMatSPHIncompressibleFluid( MatSPHIncompressibleFluidRequest(ro=self.ro, mu=self.mu, gamma1=self.gamma1, gamma2=self.gamma2) ) self.material_id = ret.mid self.name = "SPH incompressible fluid" logging.info(f"Material {self.name} Created...")
# MAT_SPH_03
[docs] class MatSPHIncompressibleStructure: """Defines an ISPH structure material. Parameters ---------- mass_density : float, optional Mass density. The default is ``0``. adhension_coefficient : roughness_coefficient : adhesion_scaling_coefficient : """ def __init__( self, mass_density=0, adhesion_coefficient=0, roughness_coefficient=0, adhesion_scaling_coefficient=0, ):
[docs] self.ro = mass_density
[docs] self.beta = adhesion_coefficient
[docs] self.rough = roughness_coefficient
[docs] self.adh = adhesion_scaling_coefficient
[docs] def create(self, stub): """Create an ISPH structure material.""" ret = stub.CreateMatSPHIncompressibleStructure( MatSPHIncompressibleStructureRequest(ro=self.ro, beta=self.beta, rough=self.rough, adh=self.adh) ) self.material_id = ret.mid self.name = "SPH incompressible structure" logging.info(f"Material {self.name} Created...")