def _apply_material_properties(self, mp, dim, small_strain=True): #define properties mp.GetProperties()[1].SetValue(KratosMultiphysics.YOUNG_MODULUS, 210e9) mp.GetProperties()[1].SetValue(KratosMultiphysics.POISSON_RATIO, 0.3) mp.GetProperties()[1].SetValue(KratosMultiphysics.THICKNESS, 1.0) g = [0, 0, 0] mp.GetProperties()[1].SetValue(KratosMultiphysics.VOLUME_ACCELERATION, g) if (dim == 2): if (small_strain == True): cl = StructuralMechanicsApplication.LinearElasticPlaneStress2DLaw( ) else: self.skipTestIfApplicationsNotAvailable( "ConstitutiveLawsApplication") cl = ConstitutiveLawsApplication.HyperElasticPlaneStrain2DLaw() else: if (small_strain == True): cl = StructuralMechanicsApplication.LinearElastic3DLaw() else: self.skipTestIfApplicationsNotAvailable( "ConstitutiveLawsApplication") cl = ConstitutiveLawsApplication.HyperElastic3DLaw() mp.GetProperties()[1].SetValue(KratosMultiphysics.CONSTITUTIVE_LAW, cl)
def _apply_orthotropic_shell_material_properties(self, mp): self.skipTestIfApplicationsNotAvailable("ConstitutiveLawsApplication") #define properties # we specify only the properties we need (others are youngs modulus etc) num_plies = 3 orthotropic_props = KratosMultiphysics.Matrix(num_plies, 16) for row in range(num_plies): for col in range(16): orthotropic_props[row, col] = 0.0 # Orthotropic mechanical moduli orthotropic_props[0, 0] = 0.005 # lamina thickness orthotropic_props[0, 2] = 2200 # density orthotropic_props[1, 0] = 0.01 # lamina thickness orthotropic_props[1, 2] = 1475 # density orthotropic_props[2, 0] = 0.015 # lamina thickness orthotropic_props[2, 2] = 520 # density mp.GetProperties()[1].SetValue( StructuralMechanicsApplication.SHELL_ORTHOTROPIC_LAYERS, orthotropic_props) cl = ConstitutiveLawsApplication.LinearElasticOrthotropic2DLaw() mp.GetProperties()[1].SetValue(KratosMultiphysics.CONSTITUTIVE_LAW, cl)
def _add_constitutive_law(self, mp, elastic_flag): if elastic_flag: cl = StructuralMechanicsApplication.TrussConstitutiveLaw() else: self.skipTestIfApplicationsNotAvailable( "ConstitutiveLawsApplication") cl = ConstitutiveLawsApplication.TrussPlasticityConstitutiveLaw() mp.GetProperties()[0].SetValue(KratosMultiphysics.CONSTITUTIVE_LAW, cl)
def _apply_material_properties(self,mp,dim): self.skipTestIfApplicationsNotAvailable("ConstitutiveLawsApplication") #define properties mp.GetProperties()[1].SetValue(KratosMultiphysics.YOUNG_MODULUS, 21000) mp.GetProperties()[1].SetValue(KratosMultiphysics.POISSON_RATIO, 0.3) mp.GetProperties()[1].SetValue(KratosMultiphysics.YIELD_STRESS, 5.5) mp.GetProperties()[1].SetValue(KratosMultiphysics.ISOTROPIC_HARDENING_MODULUS, 0.12924) mp.GetProperties()[1].SetValue(StructuralMechanicsApplication.EXPONENTIAL_SATURATION_YIELD_STRESS, 5.5) mp.GetProperties()[1].SetValue(KratosMultiphysics.HARDENING_EXPONENT, 1.0) g = [0,0,0] mp.GetProperties()[1].SetValue(KratosMultiphysics.VOLUME_ACCELERATION,g) if(dim == 2): cl = ConstitutiveLawsApplication.SmallStrainJ2PlasticityPlaneStrain2DLaw() else: cl = ConstitutiveLawsApplication.SmallStrainJ2Plasticity3DLaw() mp.GetProperties()[1].SetValue(KratosMultiphysics.CONSTITUTIVE_LAW,cl)
def _apply_material_properties(self, mp): self.skipTestIfApplicationsNotAvailable("ConstitutiveLawsApplication") #define properties orthotropic_props = Matrix(4, 16) # Orthotropic mechanical moduli orthotropic_props[0, 0] = 0.5 #lamina thickness orthotropic_props[0, 1] = 0.0 #lamina rotation (deg) orthotropic_props[0, 2] = 7850 #density orthotropic_props[0, 3] = 7500 #E1 orthotropic_props[0, 4] = 2000 #E2 orthotropic_props[0, 5] = 0.25 #nu_12 orthotropic_props[0, 6] = 1250 #G_12 orthotropic_props[0, 7] = 625 #G_13 orthotropic_props[0, 8] = 625 #G_23 # Orthotropic mechanical strengths. (T)ensile, (C)ompression, (S)hear # along 1, 2, 3 lamina directions orthotropic_props[0, 9] = 800 #T1 orthotropic_props[0, 10] = 500 #C1 orthotropic_props[0, 11] = 40 #T2 orthotropic_props[0, 12] = 300 #C2 orthotropic_props[0, 13] = 60 #S12 orthotropic_props[0, 14] = 60 #S13 orthotropic_props[0, 15] = 60 #S23 for row in range(1, 4): for col in range(16): orthotropic_props[row, col] = orthotropic_props[0, col] orthotropic_props[1, 1] = 90 orthotropic_props[2, 1] = 90 mp.GetProperties()[1].SetValue( KratosMultiphysics.StructuralMechanicsApplication. SHELL_ORTHOTROPIC_LAYERS, orthotropic_props) g = [0, 0, 0] mp.GetProperties()[1].SetValue(KratosMultiphysics.VOLUME_ACCELERATION, g) cl = ConstitutiveLawsApplication.LinearElasticOrthotropic2DLaw() mp.GetProperties()[1].SetValue(KratosMultiphysics.CONSTITUTIVE_LAW, cl)
def test_membrane_wrinkling_law(self): self.skipTestIfApplicationsNotAvailable("ConstitutiveLawsApplication") current_model = KratosMultiphysics.Model() mp = current_model.CreateModelPart("Structure") mp.SetBufferSize(2) mp.ProcessInfo[KratosMultiphysics.DOMAIN_SIZE] = 3 self._add_variables(mp) # add properties and subproperties mp.GetProperties()[1].SetValue(KratosMultiphysics.YOUNG_MODULUS, 206900000000.0) mp.GetProperties()[1].SetValue(KratosMultiphysics.POISSON_RATIO, 0.30) mp.GetProperties()[1].SetValue(KratosMultiphysics.THICKNESS, 0.0001) mp.GetProperties()[1].SetValue(KratosMultiphysics.DENSITY, 7850.0) constitutive_law = ConstitutiveLawsApplication.WrinklingLinear2DLaw() mp.GetProperties()[1].SetValue(KratosMultiphysics.CONSTITUTIVE_LAW, constitutive_law) sub_constitutive_law = StructuralMechanicsApplication.LinearElasticPlaneStress2DLaw( ) mp.GetProperties()[2].SetValue(KratosMultiphysics.CONSTITUTIVE_LAW, sub_constitutive_law) mp.GetProperties()[1].AddSubProperties(mp.GetProperties()[2]) # create nodes mp.CreateNewNode(1, 0.0000000000, 1.0000000000, 0.0000000000) mp.CreateNewNode(2, 0.0000000000, 0.0000000000, 0.0000000000) mp.CreateNewNode(3, 1.0000000000, 1.0000000000, 0.0000000000) mp.CreateNewNode(4, 1.0000000000, 0.0000000000, 0.0000000000) # add dofs self._add_dofs(mp) # create element element_name = "MembraneElement3D4N" mp.CreateNewElement(element_name, 1, [4, 3, 1, 2], mp.GetProperties()[1]) # create & apply dirichlet bcs bcs_dirichlet_all = mp.CreateSubModelPart( "BoundaryCondtionsDirichletAll") bcs_dirichlet_all.AddNodes([2, 4]) bcs_dirichlet_mv = mp.CreateSubModelPart( "BoundaryCondtionsDirichletMove") bcs_dirichlet_mv.AddNodes([1, 3]) self._apply_dirichlet_BCs(bcs_dirichlet_all) self._apply_dirichlet_BCs(bcs_dirichlet_mv, fix_type='YZ') # create & apply neumann bcs mp.CreateNewCondition("PointLoadCondition3D1N", 1, [1], mp.GetProperties()[1]) mp.CreateNewCondition("PointLoadCondition3D1N", 2, [3], mp.GetProperties()[1]) bcs_neumann = mp.CreateSubModelPart("BoundaryCondtionsNeumann") bcs_neumann.AddNodes([1, 3]) bcs_neumann.AddConditions([1, 2]) KratosMultiphysics.VariableUtils().SetScalarVar( StructuralMechanicsApplication.POINT_LOAD_X, 1000000.0, bcs_neumann.Nodes) # solve self._solve_static(mp) # check results self.assertAlmostEqual( mp.Nodes[1].GetSolutionStepValue( KratosMultiphysics.DISPLACEMENT_X), 0.58054148514004470, 4) self.assertAlmostEqual( mp.Nodes[3].GetSolutionStepValue( KratosMultiphysics.DISPLACEMENT_X), 0.15072065295319598, 4)