# ----------------------------------------------------------
# ComPoLyX Example
# Copyright (C) 2010 by
# EVEN - Evolutionary Engineering AG
# www.even-ag.ch
# ----------------------------------------------------------

### Get reference to loaded model
model=db.models.values()[0]

### Extended material definitions with out-of-plane engineering constants and stress/strain limit values
if 'E-Glas' in model.material_data.materials.keys():
  key = 'E-Glas'
else:
  key = 'UD300_GLAS'

m  = model.material_data.materials[key]
sl = m.create_property_set("stress_limits")
sl.set({'Xt': 780.e6})
sl.set({'Xc': -480.0e6})
sl.set({'Yt':  31.0e6})
sl.set({'Yc': -100.0e6})
sl.set({'Zt':  31.0e6})
sl.set({'Zc': -100.0e6})
sl.set({'Sxy': 60.0e6})
sl.set({'Sxz': 60.0e6})
sl.set({'Syz': 10.0e6})

el = m.create_property_set("strain_limits")
el.set({'eXt':  0.0244})
el.set({'eXc': -0.015})
el.set({'eYt':  0.0038})
el.set({'eYc': -0.0125})
el.set({'eSxy': 0.015})

# Define puck ply type
pc = m.create_property_set("puck_constants")
pc.set({'s': 0.5})
pc.set({'M': 0.5})
pc.set({'interface_weakening_factor': 0.8})

# Define tsai wu coupling coefficients
tw = m.create_property_set("tsai_wu_constants")
tw.set({'XY': -0.75})
tw.set({'XZ': -0.75})
tw.set({'YZ': -0.75})

### Identify core\ignored materials and define shear strength limit values to evaluate sandwich core shear criterion
m= model.material_data.materials['Corecell_A450']
m.ply_type = 'orthotropic_homogeneous_core'
sl = m.create_property_set("stress_limits")
sl.set({'Sxz': 0.8e6})
sl.set({'Syz': 0.8e6})
sl.set({'Zt': 1.1e6})
m=model.material_data.materials['Corecell_A550']
m.ply_type = 'orthotropic_homogeneous_core'
sl = m.create_property_set("stress_limits")
sl.set({'Sxz': 1.1e6})
sl.set({'Syz': 1.1e6})
sl.set({'Zt': 1.6e6})
