Esempio n. 1
0
def AssignMaterial(Properties):

    prop_id = 1
    prop = Properties[prop_id]
    mat = KratosMaterial.LargeStrainPlaneStrain2DLaw(
        KratosMaterial.SaintVenantKirchhoffModel())
    prop.SetValue(KratosMultiphysics.CONSTITUTIVE_LAW, mat.Clone())

    prop_id = 2
    prop = Properties[prop_id]
    mat = KratosMaterial.SmallStrain3DLaw(KratosMaterial.LinearElasticModel())
    prop.SetValue(KratosMultiphysics.CONSTITUTIVE_LAW, mat.Clone())

    prop_id = 3
    prop = Properties[prop_id]
    mat = KratosMaterial.SmallStrainPlaneStress2DLaw(
        KratosMaterial.SimoJuExponentialDamageModel())
    prop.SetValue(KratosMultiphysics.CONSTITUTIVE_LAW, mat.Clone())

    prop_id = 4
    prop = Properties[prop_id]
    mat = KratosMaterial.SmallStrainPlaneStress2DLaw(
        KratosMaterial.LinearElasticModel())
    prop.SetValue(KratosMultiphysics.CONSTITUTIVE_LAW, mat.Clone())

    prop_id = 5
    prop = Properties[prop_id]
    mat = KratosMaterial.LargeStrainPlaneStrain2DLaw(
        KratosMaterial.SaintVenantKirchhoffModel())
    prop.SetValue(KratosMultiphysics.CONSTITUTIVE_LAW, mat.Clone())

    prop_id = 6
    prop = Properties[prop_id]
    mat = KratosMaterial.LargeStrain3DLaw(
        KratosMaterial.SaintVenantKirchhoffModel())
    prop.SetValue(KratosMultiphysics.CONSTITUTIVE_LAW, mat.Clone())
#allocate a geometry
#a = PointerVector()
#a.append(node1)
#geom = Geometry(a)
#geom = Geometry()
geom = Triangle2D3(node1,node2,node3)
print(geom)

N = Vector(3)
DN_DX = Matrix(3,2)

######################################## here we choose the constitutive law #########################
#construct a constitutive law
elasticity_model = KratosMaterialModels.SaintVenantKirchhoffModel()
cl  = KratosMaterialModels.LargeStrain3DLaw(elasticity_model)

#plasticity_model = KratosMaterialModels.VonMisesNeoHookeanPlasticityModel()
#cl  = KratosMaterialModels.LargeStrain3DLaw(plasticity_model)

cl.Check( properties, geom, model_part.ProcessInfo )

if(cl.WorkingSpaceDimension() != dim):
    raise Exception( "mismatch between the WorkingSpaceDimension of the Constitutive Law and the dimension of the space in which the test is performed")

##set the parameters to be employed
#note that here i am adding them all to check that this does not fail
cl_options = Flags()
cl_options.Set(ConstitutiveLaw.USE_ELEMENT_PROVIDED_STRAIN, True)
cl_options.Set(ConstitutiveLaw.COMPUTE_STRESS, True)
cl_options.Set(ConstitutiveLaw.COMPUTE_CONSTITUTIVE_TENSOR, True)