Как мне правильно назначить шв в этом файле Python для Abaqus?Python

Программы на Python
Ответить Пред. темаСлед. тема
Anonymous
 Как мне правильно назначить шв в этом файле Python для Abaqus?

Сообщение Anonymous »

Итак, я пытаюсь построить модель металлического роблера-лайерсприна в Абакусе. Я пытаюсь написать для него файл Python, потому что я хочу сделать три вариации LayerSpring. И где мне нужно назначить шв. /> Мой фактический код выглядит так в данный момент: < /p>
# Step 1: Import statements for this program
# ---------------------------------------------------------------------------------------------------------
from abaqus import *
from abaqusConstants import*
from caeModules import*
import os
import numpy as np
from math import*
DIR0 = os.path.abspath('')
TOL = 1e-6

# Step 2: Parameters used for the geometry, material, load and mesh of the rubber metal spring (N/mm/s-System is used)
# ---------------------------------------------------------------------------------------------------------
t1 = 5 # Layer thickness of the lower and upper metal layer [mm]
t2 = 10 # Layer thickness of the rubber [mm]
L = 70 # Length of the "wings" of the metal rubber spring [mm]
winkel = [120, 140, 160] # Angles of the rubber metal spring versions [Degree]
e1 = 210000 # E-Modulus of the metal layers [MPa]
e2 = 5.5 # E-Modulus of the rubber [MPa]
v1 = 0.3 # Poisson's ratio of the metal layers []
v2 = 0.49 # Poisson's ratio of the rubber []
c = 1 # Length of the crack [mm]
C10 = 0.7083 # Coefficient for "MR" Material
C01 = 0.1417 # Coefficient for "MR" Material
D = 0.03565 # Coefficient for "MR" Material
mesh_size = 1.7 # Size of the mesh
xKraft = [10, 20, 30, 40, 50] # The x-Part of the force that is used to test the spring
yKraft = [10, 20, 30, 40, 50] # The y-Part of the force that is used to test the spring
crack_pos = 'bottom' # Use phrases "top" or "bottom" for the area of the crack
job_name = 'Crack' # This is the name of the odb file

# Model functions
# ---------------------------------------------------------------------------------------------------------
def make_geometry(model, geomPar, crack_pos, mesh_size):
t1, t2, L, w, c = geomPar
a = w * (pi / 180)

# Generate unique names for parts and sketches
part_name = 'spring_{}deg'.format(w)
profile_name = 'profile_{}deg'.format(w)

# Important Points for geometry
M0, M1, M2, M3 = (0.0, 0.0), (0, t1/cos(pi/2 - a/2)), (0, (t1+t2)/cos(pi/2 - a/2)), (0, (2*t1+t2)/cos(pi/2 - a/2))
R0, R1, R2, R3 = (L*cos(pi/2 - a/2), L*sin(pi/2 - a/2)), (L*cos(pi/2 - a/2)-t1*sin(pi/2 - a/2), L*sin(pi/2 - a/2)+t1*cos(pi/2 - a/2)), (L*cos(pi/2 - a/2)-t1*sin(pi/2 - a/2)-t2*sin(pi/2 - a/2), L*sin(pi/2 - a/2)+t1*cos(pi/2 - a/2)+t2*cos(pi/2 - a/2)), (L*cos(pi/2 - a/2)-2*t1*sin(pi/2 - a/2)-t2*sin(pi/2 - a/2), L*sin(pi/2 - a/2)+2*t1*cos(pi/2 - a/2)+t2*cos(pi/2 - a/2))
L0, L1, L2, L3 = (-L*cos(pi/2 - a/2), L*sin(pi/2 - a/2)), (-L*cos(pi/2 - a/2)+t1*sin(pi/2 - a/2), L*sin(pi/2 - a/2)+t1*cos(pi/2 - a/2)), (-L*cos(pi/2 - a/2)+t1*sin(pi/2 - a/2)+t2*sin(pi/2 - a/2), L*sin(pi/2 - a/2)+t1*cos(pi/2 - a/2)+t2*cos(pi/2 - a/2)), (-L*cos(pi/2 - a/2)+2*t1*sin(pi/2 - a/2)+t2*sin(pi/2 - a/2), L*sin(pi/2 - a/2)+2*t1*cos(pi/2 - a/2)+t2*cos(pi/2 - a/2))
if crack_pos == 'bottom':
C1 = (R1[0]-c*cos(pi/2 - a/2), R1[1]-c*sin(pi/2 - a/2))
else:
C2 = (R2[0]-c*cos(pi/2 - a/2), R2[1]-c*sin(pi/2 - a/2))

# Points in the middle of the faces
M00 = (0, (t1/cos(90*(pi/180)-(a/2)))/2, 0)
M11 = (0, t1/cos(90*(pi/180)-(a/2))+(t2/cos(90*(pi/180)-(a/2)))/2, 0)
M22 = (0, (t1+t2)/cos(90*(pi/180)-(a/2))+(t1/cos(90*(pi/180)-(a/2)))/2, 0)

# Points in the middle of the edges
M0R0, M0L0 = ((L*cos(pi/2-a/2))/2, (L*sin(pi/2-a/2))/2), ((-L*cos(pi/2-a/2))/2, (L*sin(pi/2-a/2))/2)

# Draw the sketch
s = model.ConstrainedSketch(name=profile_name, sheetSize=200.0)
s.Line(point1=M0, point2=R0)
s.Line(point1=R0, point2=R1)
s.Line(point1=R1, point2=R2)
s.Line(point1=R2, point2=R3)
s.Line(point1=R3, point2=M3)
s.Line(point1=M3, point2=L3)
s.Line(point1=L3, point2=L2)
s.Line(point1=L2, point2=L1)
s.Line(point1=L1, point2=L0)
s.Line(point1=L0, point2=M0)

# Create the part
p = model.Part(name=part_name, dimensionality=TWO_D_PLANAR, type=DEFORMABLE_BODY)
p.BaseShell(sketch=s)

# Create Sets, Surfaces and Reference Points
p.Set(name='all', faces=p.faces[:])

# Use existing points to define 'top' and 'bottom' edges
top_edges = p.edges.findAt(((M3[0], M3[1], 0),), ((R3[0], R3[1], 0),))
bottom_edges = p.edges.findAt(((M0R0[0], M0R0[1], 0),), ((M0L0[0], M0L0[1], 0),))

p.Set(name='top', edges=top_edges)
p.Set(name='bottom', edges=bottom_edges)

# Add reference point
rp = p.ReferencePoint(point=(0, 2 * t1 + t2 + 20, 0))
p.Set(name='RP', referencePoints=(p.referencePoints[rp.id],))

# Create the partition for the layers
partition_profile = model.ConstrainedSketch(name='partition_{}'.format(w), sheetSize=264.1, gridSpacing=6.6)
partition_profile.setPrimaryObject(option=SUPERIMPOSE)
p.projectReferencesOntoSketch(sketch=partition_profile, filter=COPLANAR_EDGES)

if crack_pos == 'bottom':
partition_profile.Line(point1=M2, point2=R2)
partition_profile.Line(point1=M1, point2=C1)
partition_profile.Line(point1=C1, point2=R1)
else:
partition_profile.Line(point1=M1, point2=R1)
partition_profile.Line(point1=M2, point2=C2)
partition_profile.Line(point1=C2, point2=R2)

partition_profile.Line(point1=L1, point2=M1)
partition_profile.Line(point1=L2, point2=M2)

p.PartitionFaceBySketch(faces=p.faces, sketch=partition_profile)
partition_profile.unsetPrimaryObject()
del model.sketches['partition_{}'.format(w)]

# Create the partition left and right
# left_right_partition_profile = model.ConstrainedSketch(name='partition_left_right_{}'.format(w), sheetSize=264.1, gridSpacing=6.6)
# left_right_partition_profile.setPrimaryObject(option=SUPERIMPOSE)
# p.projectReferencesOntoSketch(sketch=left_right_partition_profile, filter=COPLANAR_EDGES)
#
# left_right_partition_profile.Line(point1=M0, point2=M3)
#
# p.PartitionFaceBySketch(faces=p.faces, sketch=left_right_partition_profile)
# left_right_partition_profile.unsetPrimaryObject()
# del model.sketches['partition_left_right_{}'.format(w)]

p.Set(name='rubber', faces=p.faces.findAt((M11,)))
p.Set(name='metal', faces=p.faces.findAt((M00,), (M22,)))

if crack_pos == 'bottom':
crack_edge = p.edges.findAt(((C1[0] + (c/2) * cos(pi/2 - a/2), C1[1] + (c/2) * sin(pi/2 - a/2), 0),))
else:
crack_edge = p.edges.findAt(((C2[0] + (c/2) * cos(pi/2 - a/2), C2[1] + (c/2) * sin(pi/2 - a/2), 0),))

# Create the 'Crack' Set for edge assignment
p.Set(name='Crack', edges=crack_edge)

# Create the mesh
p.seedPart(size=mesh_size)
p.generateMesh()

return p

def make_sections(model, p, matPar):
e1, v1, C10, C01, D = matPar
# Create Material, create and assign sketchOptions
# Step 1: Assign Material Properties to the different layers/sets
# ---------------------------------------------------------------------------------------------------------
ste = model.Material(name='Steel')
ste.Elastic(table=((e1, v1),))

rub = model.Material(name='Rubber')
rub.Hyperelastic(materialType=ISOTROPIC, testData=OFF, type=MOONEY_RIVLIN, volumetricResponse=VOLUMETRIC_DATA,
table=((C10, C01, D),))

model.HomogeneousSolidSection(name='Steel-Plates', material='Steel', thickness=None)
p.SectionAssignment(region=p.sets['metal'], sectionName='Steel-Plates', thicknessAssignment=FROM_SECTION)

model.HomogeneousSolidSection(name='Rubber-Layer', material='Rubber', thickness=None)
p.SectionAssignment(region=p.sets['rubber'], sectionName='Rubber-Layer', thicknessAssignment=FROM_SECTION)
return

def make_assembly(model, p):
# Create the assembly
assembly = model.rootAssembly
instance_name = p.name + '-1'
assembly.Instance(name=instance_name, part=p, dependent=ON)

# Coupling constraint to link the reference point with the 'top' set
region1 = assembly.instances[instance_name].sets['RP']
region2 = assembly.instances[instance_name].sets['top']
model.Coupling(name='Coupling-TopToRP',
controlPoint=region1,
surface=region2,
influenceRadius=WHOLE_SURFACE,
couplingType=KINEMATIC,
localCoordSystem=None,
u1=ON, u2=ON, u3=ON, ur1=OFF, ur2=OFF, ur3=OFF)

# Create Seam at the Crack set
crack_region = assembly.instances[instance_name].sets['Crack']
mdb.models[instance_name].rootAssembly.engineeringFeatures.assignSeam(region=crack_region)

# Fix the bottom metal layer in place
fixed_region = assembly.instances[instance_name].sets['bottom']
model.EncastreBC(name='BC-BottomFixed', createStepName='Initial', region=fixed_region)

return assembly

# One function for the whole model (create, run, evaluate)
def spring_model(geomPar, matPar, mesh_size, crack_pos, model_name):
t1, t2, L, w, c = geomPar
e1, v1, C10, C01, D = matPar

# Sanity check for the variables
if t1 < 0:
raise ValueError('The thickness of the metal layer must be positive')
if t2 < 0:
raise ValueError('The thickness of the rubber layer must be positive')
if L < 0:
raise ValueError('The length of the spring must be positive')
if w = 180:
raise ValueError('The angle between the two wings of the spring must be between 90 and 180 degrees')
if e1 < 0:
raise ValueError('The E-Modulus of the metal layers must be positive')
if e2 < 0:
raise ValueError('The E-Modulus of the rubber layer must be positive')
if v1 = 0.5:
raise ValueError('The Poissons ratio of the metal layers must be placed between 0 and 0.5')
if v2 = 0.5:
raise ValueError('The Poissons ratio of the rubber layer must be placed between 0 and 0.5')

# Create a new model for each part
mdb.Model(name=model_name)
model = mdb.models[model_name]

# Create the parts, mesh it, and return it
p = make_geometry(model, geomPar, crack_pos, mesh_size)
# Uncomment and use make_sections if needed
make_sections(model, p, matPar)
return model

# Loop through the angles and create a model for each one
for w in winkel:
geomPar = (t1, t2, L, w, c)
matPar = (e1, v1, C10, C01, D)
model_name = 'Model_{}deg'.format(w)
model = spring_model(geomPar, matPar, mesh_size, crack_pos, model_name)


Подробнее здесь: https://stackoverflow.com/questions/796 ... for-abaqus
Реклама
Ответить Пред. темаСлед. тема

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

  • Похожие темы
    Ответы
    Просмотры
    Последнее сообщение
  • Почему имя задания abaqus не обновляется в моем скрипте Python abaqus?
    Anonymous » » в форуме Python
    0 Ответы
    38 Просмотры
    Последнее сообщение Anonymous
  • Как вывести контактное давление всех точек в наборе узлов в файле odb abaqus через python
    Anonymous » » в форуме Python
    0 Ответы
    20 Просмотры
    Последнее сообщение Anonymous
  • Создайте пакет файлов Abaqus .inp с помощью Python Multiprocess.
    Anonymous » » в форуме Python
    0 Ответы
    12 Просмотры
    Последнее сообщение Anonymous
  • Создайте пакет файлов Abaqus .inp с помощью Python Multiprocess.
    Anonymous » » в форуме Python
    0 Ответы
    9 Просмотры
    Последнее сообщение Anonymous
  • Создайте пакет файлов Abaqus .inp с помощью Python Multiprocess.
    Anonymous » » в форуме Python
    0 Ответы
    11 Просмотры
    Последнее сообщение Anonymous

Вернуться в «Python»