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_beam_material_properties(self,mp,dim): #define properties mp.GetProperties()[0].SetValue(KratosMultiphysics.YOUNG_MODULUS,210e9) mp.GetProperties()[0].SetValue(KratosMultiphysics.DENSITY,7850) mp.GetProperties()[0].SetValue(StructuralMechanicsApplication.CROSS_AREA,0.01) mp.GetProperties()[0].SetValue(KratosMultiphysics.POISSON_RATIO,0.30) mp.GetProperties()[0].SetValue(StructuralMechanicsApplication.TORSIONAL_INERTIA,0.00001) mp.GetProperties()[0].SetValue(StructuralMechanicsApplication.I22,0.00001) mp.GetProperties()[0].SetValue(StructuralMechanicsApplication.I33,0.00001) cl = StructuralMechanicsApplication.LinearElastic3DLaw() mp.GetProperties()[0].SetValue(KratosMultiphysics.CONSTITUTIVE_LAW,cl)
def _apply_material_properties(self,mp): #define properties mp.GetProperties()[0].SetValue(KratosMultiphysics.YOUNG_MODULUS,2e7) mp.GetProperties()[0].SetValue(KratosMultiphysics.DENSITY,0.01) mp.GetProperties()[0].SetValue(StructuralMechanicsApplication.CROSS_AREA,10) mp.GetProperties()[0].SetValue(StructuralMechanicsApplication.I33,1.0) #g = [0,0,0] #mp.GetProperties()[0].SetValue(KratosMultiphysics.VOLUME_ACCELERATION,g) cl = StructuralMechanicsApplication.LinearElastic3DLaw() mp.GetProperties()[0].SetValue(KratosMultiphysics.CONSTITUTIVE_LAW,cl)
def apply_material_properties(mp,dim): #define properties mp.GetProperties()[0].SetValue(KratosMultiphysics.YOUNG_MODULUS,100) mp.GetProperties()[0].SetValue(KratosMultiphysics.DENSITY,7850) mp.GetProperties()[0].SetValue(StructuralMechanicsApplication.CROSS_AREA,1) mp.GetProperties()[0].SetValue(KratosMultiphysics.POISSON_RATIO,0.30) mp.GetProperties()[0].SetValue(StructuralMechanicsApplication.TORSIONAL_INERTIA,0.1) mp.GetProperties()[0].SetValue(StructuralMechanicsApplication.I22,0.1) mp.GetProperties()[0].SetValue(StructuralMechanicsApplication.I33,0.1) g = [0,0,0] mp.GetProperties()[0].SetValue(KratosMultiphysics.VOLUME_ACCELERATION,g) cl = StructuralMechanicsApplication.LinearElastic3DLaw() mp.GetProperties()[0].SetValue(KratosMultiphysics.CONSTITUTIVE_LAW,cl)
def _apply_material_properties(self,mp,dim): #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) mp.GetProperties()[1].SetValue(KratosMultiphysics.DENSITY,1.0) g = [0,0,0] mp.GetProperties()[1].SetValue(KratosMultiphysics.VOLUME_ACCELERATION,g) if(dim == 2): cl = StructuralMechanicsApplication.LinearElasticPlaneStress2DLaw() else: cl = StructuralMechanicsApplication.LinearElastic3DLaw() mp.GetProperties()[1].SetValue(KratosMultiphysics.CONSTITUTIVE_LAW,cl)
def _apply_material_properties(self, dim): #define properties self.mp.GetProperties()[1].SetValue(KM.YOUNG_MODULUS, 210e9) self.mp.GetProperties()[1].SetValue(KM.POISSON_RATIO, 0.3) self.mp.GetProperties()[1].SetValue(KM.THICKNESS, 1.0) self.mp.GetProperties()[1].SetValue(KM.DENSITY, 1.0) g = [0, 0, 0] self.mp.GetProperties()[1].SetValue(KM.VOLUME_ACCELERATION, g) self.mp.ProcessInfo[KM.DOMAIN_SIZE] = dim if dim == 2: cl = SMA.LinearElasticPlaneStrain2DLaw() else: cl = SMA.LinearElastic3DLaw() self.mp.GetProperties()[1].SetValue(KM.CONSTITUTIVE_LAW, cl)
def _apply_material_properties(self, mp, dim): #define properties mp.GetProperties()[0].SetValue(KratosMultiphysics.YOUNG_MODULUS, 210e9) mp.GetProperties()[0].SetValue(KratosMultiphysics.DENSITY, 7850) mp.GetProperties()[0].SetValue( StructuralMechanicsApplication.CROSS_AREA, 0.01) mp.GetProperties()[0].SetValue( StructuralMechanicsApplication.TRUSS_PRESTRESS_PK2, 0) mp.GetProperties()[0].SetValue( StructuralMechanicsApplication.RAYLEIGH_ALPHA, 0) mp.GetProperties()[0].SetValue( StructuralMechanicsApplication.RAYLEIGH_BETA, 0) g = [0, 0, 0] mp.GetProperties()[0].SetValue(KratosMultiphysics.VOLUME_ACCELERATION, g) cl = StructuralMechanicsApplication.LinearElastic3DLaw() mp.GetProperties()[0].SetValue(KratosMultiphysics.CONSTITUTIVE_LAW, cl)
def _apply_material_properties(self, ModelPart, Dimension): # Define material properties ModelPart.GetProperties()[1].SetValue(KratosMultiphysics.YOUNG_MODULUS, 200.0e9) ModelPart.GetProperties()[1].SetValue(KratosMultiphysics.POISSON_RATIO, 0.4) ModelPart.GetProperties()[1].SetValue(KratosMultiphysics.DENSITY, 1.0) # Define body force g = [0, 0, 0] ModelPart.GetProperties()[1].SetValue( KratosMultiphysics.VOLUME_ACCELERATION, g) # Define constitutive law if (Dimension == 2): cons_law = StructuralMechanicsApplication.LinearElasticPlaneStrain2DLaw( ) else: cons_law = StructuralMechanicsApplication.LinearElastic3DLaw() ModelPart.GetProperties()[1].SetValue( KratosMultiphysics.CONSTITUTIVE_LAW, cons_law)
def _apply_material_properties_beam(self, mp, dim): #define properties mp.GetProperties()[0].SetValue(KratosMultiphysics.YOUNG_MODULUS, 210e9) mp.GetProperties()[0].SetValue(KratosMultiphysics.DENSITY, 7850) mp.GetProperties()[0].SetValue( StructuralMechanicsApplication.CROSS_AREA, 0.01) mp.GetProperties()[0].SetValue(KratosMultiphysics.POISSON_RATIO, 0.30) local_inertia_vector = KratosMultiphysics.Vector(3) local_inertia_vector[0] = 0.00001 local_inertia_vector[1] = 0.00001 local_inertia_vector[2] = 0.00001 mp.GetProperties()[0].SetValue( StructuralMechanicsApplication.LOCAL_INERTIA_VECTOR, local_inertia_vector) g = [0, 0, 0] mp.GetProperties()[0].SetValue(KratosMultiphysics.VOLUME_ACCELERATION, g) cl = StructuralMechanicsApplication.LinearElastic3DLaw() mp.GetProperties()[0].SetValue(KratosMultiphysics.CONSTITUTIVE_LAW, cl)
def solve_cantilever(cls, order_u, order_v_w, length): model = KM.Model() model_part = model.CreateModelPart('Model') model_part.AddNodalSolutionStepVariable(KM.DISPLACEMENT) model_part.AddNodalSolutionStepVariable(KM.REACTION) model_part.AddNodalSolutionStepVariable( StructuralMechanicsApplication.POINT_LOAD) model_part.ProcessInfo.SetValue(KM.DOMAIN_SIZE, 3) # Create property for volume elements cl = StructuralMechanicsApplication.LinearElastic3DLaw() volume_properties = model_part.GetProperties()[0] volume_properties.SetValue(KM.YOUNG_MODULUS, 210000000) volume_properties.SetValue(KM.POISSON_RATIO, 0.3) volume_properties.SetValue(KM.DENSITY, 78.5) volume_properties.SetValue(KM.CONSTITUTIVE_LAW, cl) # Create a nurbs volume volume = TestNurbsVolumeElement.create_geometry( model_part, order_u, order_v_w, length) # Create quadrature_point_geometries quadrature_point_geometries = KM.GeometriesVector() volume.CreateQuadraturePointGeometries(quadrature_point_geometries, 2) for i in range(len(quadrature_point_geometries)): model_part.CreateNewElement('UpdatedLagrangianElement3D4N', i + 1, quadrature_point_geometries[i], volume_properties) # Add dofs KM.VariableUtils().AddDof(KM.DISPLACEMENT_X, KM.REACTION_X, model_part) KM.VariableUtils().AddDof(KM.DISPLACEMENT_Y, KM.REACTION_Y, model_part) KM.VariableUtils().AddDof(KM.DISPLACEMENT_Z, KM.REACTION_Z, model_part) for node in volume: if (node.X0 == 0.0): volume[node.Id - 1].Fix(KM.DISPLACEMENT_X) volume[node.Id - 1].Fix(KM.DISPLACEMENT_Y) volume[node.Id - 1].Fix(KM.DISPLACEMENT_Z) # Apply neumann conditions prop = model_part.GetProperties()[2] force = -1000 node_id_force = [] for node in volume: if (node.X0 == length): node_id_force.append(node.Id) nodal_force = force / len(node_id_force) for i in node_id_force: model_part.CreateNewCondition('PointLoadCondition3D1N', i + 1, [i], prop) volume[i - 1].SetSolutionStepValue( StructuralMechanicsApplication.POINT_LOAD_Y, nodal_force) # Setup solver model_part.SetBufferSize(2) time_scheme = KM.ResidualBasedIncrementalUpdateStaticScheme() linear_solver = KM.SkylineLUFactorizationSolver() builder_and_solver = KM.ResidualBasedBlockBuilderAndSolver( linear_solver) builder_and_solver.SetEchoLevel(0) relative_tolerance = 1e-4 absolute_tolerance = 1e-9 conv_criteria = KM.ResidualCriteria(relative_tolerance, absolute_tolerance) conv_criteria.SetEchoLevel(0) maximum_iterations = 5 compute_reactions = False reform_dofs_at_each_iteration = False move_mesh_flag = True solver = KM.ResidualBasedNewtonRaphsonStrategy( model_part, time_scheme, conv_criteria, builder_and_solver, maximum_iterations, compute_reactions, reform_dofs_at_each_iteration, move_mesh_flag) solver.SetEchoLevel(0) model_part.CloneTimeStep(1) solver.Solve() return volume
def create_constitutive_Law(): return StructuralMechanicsApplication.LinearElastic3DLaw()