Exemple #1
0
 def __init__(self, config, modelName="Model-1"):
     # Model name - used both as model's name, job's name and input file name
     self.modelName = str(modelName)
     # Create new model database if not default
     if modelName != "Model-1":
         mdb.Model(self.modelName)
         # If model is other than default parts and materials must be imported again
         from ImpactTestGUI import importMaterials, importParts
         importMaterials(self.modelName)
         importParts(self.modelName)
         del mdb.models['Model-1']
     # Type of projectile - describing subdirectory name
     self.projectileType = str(config['projectile']['type'])
     # Projectile's velocity in [m/s]
     self.projectileVelocity = config['projectile']['velocity']
     # Target obliquity in [deg] - 0 means normal to projectile's direction
     self.targetObliquity = config['armor']['obliquity']
     # Target semi-minor axis in [m]
     self.targetRadius = config['armor']['radius']
     # Target center semi-minor axis in [m]
     self.targetInnerRadius = config['armor']['innerRadius']
     # List of target layers - describing layers thickness in [m] and material
     self.targetLayers = config['armor']['layers']
     # Average mesh element size in [m] used to seed parts
     self.meshElementSize = config['meshElementSize']
     # Failure coefficient to adjust material properties easily
     self.failureCoefficient = config['failureCoefficient']
     # Auxilliary list to store layer names, thicknesses and spacings in [m]
     self.assemblyOrder = []
     # Auxillary list of projectile component names
     self.projectileComponents = []
Exemple #2
0
def createModel(num):
	modelName = 'Model-'+ str(num) 
	# Abaqus command to create a new model database.
	mdb.Model(name=modelName, modelType=aq.STANDARD_EXPLICIT)
	# Create reference variable for the model object.
	modelObject = mdb.models[modelName] 
	return modelObject, modelName
def restartModel(model):
    from abaqus import mdb
    from abaqusConstants import PERCENTAGE
    modelName = model.name
    resModel = mdb.Model(name=modelName+'-Restart', objectToCopy=model)
    resModel.setValues(restartJob=modelName+'-Restart')
    restartJob = mdb.Job(name=modelName+'-Restart', model=modelName+'-Restart', 
        type=RESTART, memory=60, memoryUnits=PERCENTAGE, getMemoryFromAnalysis=True)
    restartJob.submit()
    restartJob.waitForCompletion()
Exemple #4
0
job_name = 'Sim_' + model_name
job_description = ''

# geometry
length = 4.5
width = 3.5
center = (1.75, 1.75)

# inner shape
r_0 = 1.
c_1 = 2.98642006e-01
c_2 = 1.37136137e-01

# create model

model = mdb.Model(name=model_name)

if 'Model-1' in mdb.models.keys():
    del mdb.models['Model-1']

# define objects

rve = BertoldiRVE(length,
                  width,
                  center,
                  r_0,
                  c_1,
                  c_2,
                  n_points=100,
                  name='BERTOLDI_RVE')
Exemple #5
0
def create_model_SPLA(mod_name,
                      thetadeg,
                      H,
                      R,
                      thickness,
                      PL,
                      E,
                      nu,
                      axial_load=None,
                      axial_displ=None,
                      damping=1.e-8,
                      meshsize=None,
                      bc_side='12',
                      numCpus=None,
                      linear_buckling=False,
                      fil_name=None,
                      mode_xi=None,
                      mode_num=None):
    """Create a model of a simply supported unstiffened panel for the SPLA

    Parameters
    ----------
    mod_name : str
        Model name.
    thetadeg : float
        Panel circumferential angle.
    H : float
        Panel height.
    R : float
        Panel radius.
    thickness : float
        Panel thickness.
    PL : float
        Perturbation load magnitude.
    E : float
        Young modulus
    nu : float
        Poisson's ratio.
    axial_load : float or None
        Resultant of the applied axial load. If ``None`` activates displacement
        controlled axial compression.
    axial_displ : float or None
        Axial displacement.
    damping : float, optional
        The artificial damping factor.
    meshsize : int or None, optional
        The mesh size using metric units. When ``None`` is used it is estimated
        based on the panel dimensions.
    bc_side : str, optional
        The degrees-of-freedom to be constrained at the side edges.
    numCpus : int or None, optional
        The number of CPUs for the corresponding job that will be created in
        Abaqus.
    linear_buckling : bool, optional
        Flag indicating if this model should be a linear buckling model.
    fil_name : str or None, optional
        The .fil file with the imperfection pattern.
    mode_xi : float or None, optional
        The imperfection amplitude.
    mode_num : int or None, optional
        The linear buckling mode to be applied as imperfection.

    """
    from abaqusConstants import *
    from abaqus import mdb

    PL = float(abs(PL))
    if axial_load is not None:
        axial_load = float(abs(axial_load))
        load_controlled = True
    else:
        if axial_displ is None:
            axial_displ = 0.005 * H
        else:
            axial_displ = float(abs(axial_displ))
        load_controlled = False

    thetarad = radians(thetadeg)
    xref = R * cos(thetarad / 2.)
    yref = R * sin(thetarad / 2.)

    if meshsize is None:
        meshsize = R * 2 * pi / 420.

    mod = mdb.Model(name=mod_name, modelType=STANDARD_EXPLICIT)
    ra = mod.rootAssembly
    s = mod.ConstrainedSketch(name='__profile__', sheetSize=2 * H)
    g, v, d, c = s.geometry, s.vertices, s.dimensions, s.constraints
    s.setPrimaryObject(option=STANDALONE)
    s.ArcByCenterEnds(center=(0.0, 0.0),
                      point1=(xref, yref),
                      point2=(xref, -yref),
                      direction=CLOCKWISE)
    part = mod.Part(name='Part-1',
                    dimensionality=THREE_D,
                    type=DEFORMABLE_BODY)
    datums = part.datums
    part.BaseShellExtrude(sketch=s, depth=H)
    hplane = part.DatumPlaneByPrincipalPlane(principalPlane=XYPLANE,
                                             offset=H / 2.)
    part.PartitionFaceByDatumPlane(datumPlane=datums[hplane.id],
                                   faces=part.faces)
    vplane = part.DatumPlaneByPrincipalPlane(principalPlane=XZPLANE,
                                             offset=0.0)
    part.PartitionFaceByDatumPlane(datumPlane=datums[vplane.id],
                                   faces=part.faces)

    s.unsetPrimaryObject()
    del mod.sketches['__profile__']
    part.seedPart(size=meshsize, deviationFactor=0.1, minSizeFactor=0.1)
    part.generateMesh()
    ra.Instance(name='Part-1-1', part=part, dependent=ON)
    ra.regenerate()
    inst = ra.instances['Part-1-1']

    csys_cyl = ra.DatumCsysByThreePoints(name='csys_cyl',
                                         coordSysType=CYLINDRICAL,
                                         origin=(0.0, 0.0, 0.0),
                                         point1=(1.0, 0.0, 0.0),
                                         point2=(0.0, 1.0, 0.0))
    csys_cyl = ra.datums[csys_cyl.id]

    vertices = inst.vertices
    reference_point = vertices.findAt(((R, 0, H), ))
    ra.Set(vertices=reference_point, name='set_RP')
    es = inst.edges
    top_edges = es.getByBoundingBox(0, -2 * R, 0.99 * H, 2 * R, 2 * R,
                                    1.01 * H)
    set_top_edges = ra.Set(edges=top_edges, name='top_edges')

    if not linear_buckling:
        mod.StaticStep(name='constant_loads',
                       previous='Initial',
                       maxNumInc=100,
                       stabilizationMethod=NONE,
                       continueDampingFactors=False,
                       adaptiveDampingRatio=None,
                       initialInc=1.0,
                       maxInc=1.0,
                       nlgeom=ON)
        mod.StaticStep(name='variable_loads',
                       previous='constant_loads',
                       maxNumInc=10000,
                       stabilizationMagnitude=1e-08,
                       stabilizationMethod=DAMPING_FACTOR,
                       continueDampingFactors=False,
                       adaptiveDampingRatio=None,
                       initialInc=0.01,
                       maxInc=0.01)

        if PL > 0:
            perturbation_point = vertices.findAt(((R, 0, H / 2.), ))
            region = ra.Set(vertices=perturbation_point,
                            name='perturbation_point')
            mod.ConcentratedForce(name='perturbation_load',
                                  createStepName='constant_loads',
                                  region=region,
                                  cf1=-PL,
                                  distributionType=UNIFORM,
                                  field='',
                                  localCsys=csys_cyl)

        mod.HistoryOutputRequest(name='history_RP',
                                 createStepName='constant_loads',
                                 variables=('U3', 'RF3'),
                                 region=ra.sets['set_RP'],
                                 sectionPoints=DEFAULT,
                                 rebar=EXCLUDE)

        if load_controlled:
            load_top = axial_load / (R * thetarad)
            region = ra.Surface(side1Edges=top_edges, name='Surf-1')
            mod.ShellEdgeLoad(name='load_top',
                              createStepName='variable_loads',
                              region=region,
                              magnitude=load_top,
                              distributionType=UNIFORM,
                              field='',
                              localCsys=csys_cyl)
        else:
            mod.DisplacementBC(name='axial_displacement',
                               createStepName='variable_loads',
                               region=set_top_edges,
                               u1=UNSET,
                               u2=UNSET,
                               u3=-axial_displ,
                               ur1=UNSET,
                               ur2=UNSET,
                               ur3=UNSET,
                               amplitude=UNSET,
                               fixed=OFF,
                               distributionType=UNIFORM,
                               fieldName='',
                               localCsys=csys_cyl)

        if all([fil_name, mode_xi, mode_num]):
            if fil_name.endswith('.fil'):
                fil_name = fil_name[:-4]
            text = '*IMPERFECTION, STEP=1, FILE={0}'.format(fil_name)
            text += '\n{0:d}, {1:f}'.format(int(mode_num), float(mode_xi))
            text += '\n**'
            pattern = '*Step'
            abaqus_functions.edit_keywords(mod=mod,
                                           text=text,
                                           before_pattern=pattern)

    else:
        mod.BuckleStep(name='linear_buckling',
                       previous='Initial',
                       numEigen=50,
                       eigensolver=LANCZOS,
                       minEigen=0.0,
                       blockSize=DEFAULT,
                       maxBlocks=DEFAULT)
        region = ra.Surface(side1Edges=top_edges, name='Surf-1')
        mod.ShellEdgeLoad(name='load_top',
                          createStepName='linear_buckling',
                          region=region,
                          magnitude=1.,
                          distributionType=UNIFORM,
                          field='',
                          localCsys=csys_cyl)
        text = ''
        text += '\n**'
        text += '\n*NODE FILE'
        text += '\nU,'
        text += '\n*MODAL FILE'
        abaqus_functions.edit_keywords(mod=mod, text=text, before_pattern=None)

    mod.Material(name='Aluminum')
    mod.materials['Aluminum'].Elastic(table=((E, nu), ))
    mod.HomogeneousShellSection(name='Shell_property',
                                preIntegrate=OFF,
                                material='Aluminum',
                                thicknessType=UNIFORM,
                                thickness=thickness,
                                thicknessField='',
                                idealization=NO_IDEALIZATION,
                                poissonDefinition=DEFAULT,
                                thicknessModulus=None,
                                temperature=GRADIENT,
                                useDensity=OFF,
                                integrationRule=SIMPSON,
                                numIntPts=5)
    region = part.Set(faces=part.faces, name='part_faces')
    part.SectionAssignment(region=region,
                           sectionName='Shell_property',
                           offset=0.0,
                           offsetType=MIDDLE_SURFACE,
                           offsetField='',
                           thicknessAssignment=FROM_SECTION)
    ra.regenerate()

    mod.DisplacementBC(name='bc_top',
                       createStepName='Initial',
                       region=set_top_edges,
                       u1=SET,
                       u2=SET,
                       u3=UNSET,
                       ur1=UNSET,
                       ur2=UNSET,
                       ur3=UNSET,
                       amplitude=UNSET,
                       distributionType=UNIFORM,
                       fieldName='',
                       localCsys=csys_cyl)

    bottom_edges = es.getByBoundingBox(0, -2 * R, -0.01 * H, 2 * R, 2 * R,
                                       0.01 * H)
    set_bottom_edges = ra.Set(edges=bottom_edges, name='bottom_edges')
    mod.DisplacementBC(name='bc_bottom',
                       createStepName='Initial',
                       region=set_bottom_edges,
                       u1=SET,
                       u2=SET,
                       u3=SET,
                       ur1=UNSET,
                       ur2=UNSET,
                       ur3=UNSET,
                       amplitude=UNSET,
                       distributionType=UNIFORM,
                       fieldName='',
                       localCsys=csys_cyl)
    sidee = (es.getByBoundingBox(0, -1.01 * yref, -0.01 * H, R, -0.99 * yref,
                                 1.01 * H) +
             es.getByBoundingBox(0, 0.99 * yref, -0.01 * H, R, 1.01 * yref,
                                 1.01 * H))
    set_side_edges = ra.Set(edges=sidee, name='side_edges')

    u1, u2, u3, ur1, ur2, ur3 = get_bc(bc_side)
    mod.DisplacementBC(name='bc_side',
                       createStepName='Initial',
                       region=set_side_edges,
                       u1=u1,
                       u2=u2,
                       u3=u3,
                       ur1=ur1,
                       ur2=ur2,
                       ur3=ur3,
                       amplitude=UNSET,
                       distributionType=UNIFORM,
                       fieldName='',
                       localCsys=csys_cyl)

    if numCpus is None:
        numCpus = cpu_count()
    job = mdb.Job(name=mod_name,
                  model=mod_name,
                  description='',
                  type=ANALYSIS,
                  atTime=None,
                  waitMinutes=0,
                  waitHours=0,
                  queue=None,
                  memory=90,
                  memoryUnits=PERCENTAGE,
                  getMemoryFromAnalysis=True,
                  explicitPrecision=SINGLE,
                  nodalOutputPrecision=SINGLE,
                  echoPrint=OFF,
                  modelPrint=OFF,
                  contactPrint=OFF,
                  historyPrint=OFF,
                  userSubroutine='',
                  scratch='',
                  resultsFormat=ODB,
                  multiprocessingMode=DEFAULT,
                  numCpus=numCpus,
                  numDomains=numCpus,
                  numGPUs=500)
Exemple #6
0
def lin_buckle(name,
               job_name,
               n_longerons,
               bottom_diameter,
               top_diameter,
               pitch,
               young_modulus,
               shear_modulus,
               cross_section_props,
               twist_angle=0.,
               transition_length_ratio=1.,
               n_storeys=1,
               power=1.,
               include_name='include_mesh',
               **kwargs):

    # create model
    model = mdb.Model(name=name)
    backwardCompatibility.setValues(reportDeprecated=False)
    if 'Model-1' in mdb.models.keys():
        del mdb.models['Model-1']

    # meshing
    cone_slope = (bottom_diameter - top_diameter) / bottom_diameter
    _meshing(model,
             n_longerons,
             bottom_diameter,
             pitch,
             cross_section_props,
             young_modulus,
             shear_modulus,
             cone_slope,
             include_name=include_name)

    # create linear buckling inp
    with open('{}.inp'.format(job_name), 'w') as File:
        File.write('** Include file with mesh of structure:\n')
        File.write('*INCLUDE, INPUT={}.inp\n'.format(include_name))
        File.write('** \n')
        File.write('** STEP: Step-1\n')
        File.write('** \n')
        File.write('*Step, name=Step-1\n')
        File.write('*Buckle, eigensolver=lanczos\n')
        File.write('20, 0., , , \n')
        File.write('** \n')
        File.write('** BOUNDARY CONDITIONS\n')
        File.write('** \n')
        File.write('** Name: BC_Zminus Type: Displacement/Rotation\n')
        File.write('*Boundary\n')
        File.write('RP_ZmYmXm, 1, 6\n')
        File.write('** \n')
        File.write('** LOADS\n')
        File.write('** \n')
        File.write('** Name: Applied_Moment   Type: Moment\n')
        File.write('*Cload\n')
        File.write('RP_ZpYmXm, 3, -1.00\n')
        File.write('** \n')
        File.write('*Node File\n')
        File.write('U \n')
        File.write('** \n')
        File.write('*EL PRINT,FREQUENCY=1\n')
        File.write('*NODE PRINT,FREQUENCY=1\n')
        File.write('*MODAL FILE\n')
        File.write('*OUTPUT,FIELD,VAR=PRESELECT\n')
        File.write('*OUTPUT,HISTORY,FREQUENCY=1\n')
        File.write('*MODAL OUTPUT\n')
        File.write('*End Step\n')
def lin_buckle(model_name, job_name, n_longerons, bottom_diameter,
               young_modulus, shear_modulus, ratio_top_diameter, ratio_pitch,
               ratio_d):

    # variables from ratios
    d = ratio_d * bottom_diameter
    pitch = ratio_pitch * bottom_diameter
    top_diameter = bottom_diameter * (1. - ratio_top_diameter)

    # variables with defaults
    n_storeys = 1
    twist_angle = 0.
    transition_length_ratio = 1.

    # compute variables
    mast_radius = bottom_diameter / 2.
    mast_height = n_storeys * pitch
    cone_slope = (bottom_diameter - top_diameter) / bottom_diameter

    # create abaqus model
    model = mdb.Model(name=model_name)
    backwardCompatibility.setValues(reportDeprecated=False)
    if 'Model-1' in mdb.models.keys():
        del mdb.models['Model-1']

    # create joints
    joints = np.zeros((n_storeys + 1, n_longerons, 3))
    for i_storey in range(0, n_storeys + 1, 1):
        zcoord = mast_height / n_storeys * i_storey
        aux1 = 2.0 * np.pi / n_longerons
        aux2 = twist_angle * min(
            zcoord / mast_height / transition_length_ratio, 1.0)
        for i_vertex in range(0, n_longerons):
            aux3 = aux1 * i_vertex + aux2
            xcoord = mast_radius * np.cos(aux3)
            ycoord = mast_radius * np.sin(aux3)
            joints[i_storey, i_vertex, :] = (
                xcoord *
                (1.0 - min(zcoord, transition_length_ratio * mast_height) /
                 mast_height * cone_slope), ycoord *
                (1.0 - min(zcoord, transition_length_ratio * mast_height) /
                 mast_height * cone_slope), zcoord)

    # create geometry longerons
    longerons_name = 'LONGERONS'
    part_longerons = model.Part(longerons_name,
                                dimensionality=THREE_D,
                                type=DEFORMABLE_BODY)
    longeron_points = []
    for i_vertex in range(0, n_longerons):
        # get required points
        longeron_points.append([
            joints[i_storey, i_vertex, :]
            for i_storey in range(0, n_storeys + 1)
        ])
        # create wires
        part_longerons.WirePolyLine(points=longeron_points[-1],
                                    mergeType=IMPRINT,
                                    meshable=ON)

    # create surface
    surface_name = 'ANALYTICAL_SURF'
    s = model.ConstrainedSketch(name='SURFACE_SKETCH',
                                sheetSize=mast_radius * 3.0)
    s.Line(point1=(0.0, -mast_radius * 1.1), point2=(0.0, mast_radius * 1.1))
    part_surf = model.Part(name=surface_name,
                           dimensionality=THREE_D,
                           type=ANALYTIC_RIGID_SURFACE)
    part_surf.AnalyticRigidSurfExtrude(sketch=s, depth=mast_radius * 2.2)

    # create required sets and surfaces
    # surface
    part_surf.Surface(side1Faces=part_surf.faces, name=surface_name)

    # longeron
    edges = part_longerons.edges
    vertices = part_longerons.vertices

    # individual sets
    all_edges = []
    for i_vertex, long_pts in enumerate(longeron_points):
        # get vertices and edges
        selected_vertices = [vertices.findAt((pt, )) for pt in long_pts]
        all_edges.append(EdgeArray([edges.findAt(pt) for pt in long_pts]))
        # individual sets
        long_name = 'LONGERON-{}'.format(i_vertex)
        part_longerons.Set(edges=all_edges[-1], name=long_name)
        # joints
        for i_storey, vertex in enumerate(selected_vertices):
            joint_name = 'JOINT-{}-{}'.format(i_storey, i_vertex)
            part_longerons.Set(vertices=vertex, name=joint_name)

    name = 'ALL_LONGERONS'
    part_longerons.Set(edges=all_edges, name=name)
    name = 'ALL_LONGERONS_SURF'
    part_longerons.Surface(circumEdges=all_edges, name=name)

    # joint sets
    selected_vertices = []
    for i_storey in range(0, n_storeys + 1):
        selected_vertices.append([])
        for i_vertex in range(0, n_longerons):
            name = 'JOINT-{}-{}'.format(i_storey, i_vertex)
            selected_vertices[-1].append(part_longerons.sets[name].vertices)

    name = 'BOTTOM_JOINTS'
    part_longerons.Set(name=name, vertices=selected_vertices[0])
    name = 'TOP_JOINTS'
    part_longerons.Set(name=name, vertices=selected_vertices[-1])
    name = 'ALL_JOINTS'
    all_vertices = list(itertools.chain(*selected_vertices))
    part_longerons.Set(name=name, vertices=all_vertices)

    # create beam section
    # create section material
    material_name = 'LONGERON_MATERIAL'
    nu = young_modulus / (2 * shear_modulus) - 1
    abaqusMaterial = model.Material(name=material_name)
    abaqusMaterial.Elastic(type=ISOTROPIC, table=((young_modulus, nu), ))
    # create profile
    profile_name = 'LONGERONS_PROFILE'
    r = d / 2.
    model.CircularProfile(name=profile_name, r=r)
    # create profile
    section_name = 'LONGERONS_SECTION'
    model.BeamSection(consistentMassMatrix=False,
                      integration=DURING_ANALYSIS,
                      material=material_name,
                      name=section_name,
                      poissonRatio=0.31,
                      profile=profile_name,
                      temperatureVar=LINEAR)
    # section assignment
    part_longerons.SectionAssignment(
        offset=0.0,
        offsetField='',
        offsetType=MIDDLE_SURFACE,
        region=part_longerons.sets['ALL_LONGERONS'],
        sectionName=section_name,
        thicknessAssignment=FROM_SECTION)
    # section orientation
    for i_vertex, pts in enumerate(longeron_points):
        dir_vec_n1 = np.array(pts[0]) - (0., 0., 0.)
        longeron_name = 'LONGERON-{}'.format(i_vertex)
        region = part_longerons.sets[longeron_name]
        part_longerons.assignBeamSectionOrientation(region=region,
                                                    method=N1_COSINES,
                                                    n1=dir_vec_n1)

    # generate mesh
    # seed part
    mesh_size = min(mast_radius, pitch) / 300.
    mesh_deviation_factor = .04
    mesh_min_size_factor = .001
    element_code = B31
    part_longerons.seedPart(size=mesh_size,
                            deviationFactor=mesh_deviation_factor,
                            minSizeFactor=mesh_min_size_factor,
                            constraint=FINER)
    # assign element type
    elem_type_longerons = mesh.ElemType(elemCode=element_code)
    part_longerons.setElementType(regions=(part_longerons.edges, ),
                                  elemTypes=(elem_type_longerons, ))
    # generate mesh
    part_longerons.generateMesh()

    # create instances
    modelAssembly = model.rootAssembly
    part_surf = model.parts[surface_name]
    modelAssembly.Instance(name=longerons_name,
                           part=part_longerons,
                           dependent=ON)
    modelAssembly.Instance(name=surface_name, part=part_surf, dependent=ON)
    # rotate surface
    modelAssembly.rotate(instanceList=(surface_name, ),
                         axisPoint=(0., 0., 0.),
                         axisDirection=(0., 1., 0.),
                         angle=90.)

    # create reference points for boundary conditions
    ref_point_positions = ['BOTTOM', 'TOP']
    for i, position in enumerate(ref_point_positions):
        sign = 1 if i else -1
        rp = modelAssembly.ReferencePoint(point=(0., 0., i * mast_height +
                                                 sign * 1.1 * mast_radius))
        modelAssembly.Set(
            referencePoints=(modelAssembly.referencePoints[rp.id], ),
            name='Z{}_REF_POINT'.format(position))

    # add constraints for loading
    instance_longerons = modelAssembly.instances[longerons_name]
    instance_surf = modelAssembly.instances[surface_name]
    ref_points = [
        modelAssembly.sets['Z{}_REF_POINT'.format(position)]
        for position in ref_point_positions
    ]

    # bottom point and analytic surface
    surf = instance_surf.surfaces[surface_name]
    model.RigidBody('CONSTRAINT-RIGID_BODY-BOTTOM',
                    refPointRegion=ref_points[0],
                    surfaceRegion=surf)

    # create local datums
    datums = []
    for i_vertex in range(0, n_longerons):
        origin = joints[0, i_vertex, :]
        point2 = joints[0, i_vertex - 1, :]
        name = 'LOCAL_DATUM_{}'.format(i_vertex)
        datums.append(
            part_longerons.DatumCsysByThreePoints(origin=origin,
                                                  point2=point2,
                                                  name=name,
                                                  coordSysType=CARTESIAN,
                                                  point1=(0.0, 0.0, 0.0)))

    # create coupling constraints
    for i_vertex in range(n_longerons):
        datum = instance_longerons.datums[datums[i_vertex].id]
        for i, i_storey in enumerate([0, n_storeys]):
            joint_name = 'JOINT-{}-{}'.format(i_storey, i_vertex)
            slave_region = instance_longerons.sets[joint_name]
            master_region = ref_points[i]
            constraint_name = 'CONSTRAINT-%s-%i-%i' % ('Z{}_REF_POINT'.format(
                ref_point_positions[i]), i_storey, i_vertex)
            model.Coupling(name=constraint_name,
                           controlPoint=master_region,
                           surface=slave_region,
                           influenceRadius=WHOLE_SURFACE,
                           couplingType=KINEMATIC,
                           localCsys=datum,
                           u1=ON,
                           u2=ON,
                           u3=ON,
                           ur1=OFF,
                           ur2=ON,
                           ur3=ON)

    # from now on, there's differences between linear buckle and riks

    # create step
    step_name = 'BUCKLE_STEP'
    model.BuckleStep(step_name, numEigen=20, previous='Initial', minEigen=0.)

    # set bcs (displacement)
    region_name = 'Z{}_REF_POINT'.format(ref_point_positions[0])
    loaded_region = modelAssembly.sets[region_name]
    model.DisplacementBC('BC_FIX',
                         createStepName=step_name,
                         region=loaded_region,
                         u1=0.,
                         u2=0.,
                         u3=0.,
                         ur1=0.,
                         ur2=0.,
                         ur3=0.,
                         buckleCase=BUCKLING_MODES)

    # set bcs (load)
    applied_load = -1.
    region_name = 'Z{}_REF_POINT'.format(ref_point_positions[-1])
    loaded_region = modelAssembly.sets[region_name]
    model.ConcentratedForce('APPLIED_FORCE',
                            createStepName=step_name,
                            region=loaded_region,
                            cf3=applied_load)

    # create provisory inp
    modelJob = mdb.Job(model=model_name, name=job_name)
    modelJob.writeInput(consistencyChecking=OFF)

    # ask for node file
    with open('{}.inp'.format(job_name), 'r') as file:
        lines = file.readlines()

    line_cmp = '** {}\n'.format('OUTPUT REQUESTS')
    for i, line in reversed(list(enumerate(lines))):
        if line == line_cmp:
            break

    insert_line = i + 2
    for line in reversed(['*NODE FILE, frequency=1', 'U']):
        lines.insert(insert_line, '{}\n'.format(line))

    with open('{}.inp'.format(job_name), 'w') as file:
        file.writelines(lines)
Exemple #8
0
        (90,   0.125,    "T300-7901", 	1,	1.0),
        (0,   0.125,    "T300-7901", 	1,	1.0),
        (90,   0.125,    "T300-7901", 	1,	1.0),
        (0,   0.125,    "T300-7901", 	1,	1.0),
        (90,   0.125,    "T300-7901", 	1,	1.0),
        (0,   0.125,    "T300-7901", 	1,	1.0),
        (90,   0.125,    "T300-7901", 	1,	1.0),
        ]

    resinName='UMAT-Matrix'#'Epoxy7901'
    hresin=0.02
    
    delta=5 #张开位移
    
    modelName='DCB90A-Z-N%d-Kc183-U10'%(Npermm)
    model1=mdb.Model(name=modelName)
    model1.setValues(description='Longitude: %s\n Width: %s \n Plies: angle\t thickness \t material \t seedsize In height \n %s'%(repr(ls),repr(ws),repr(plies)))
    # 材料
    Materials(model1)
    UMATMaterial(model1)
    mat1=model1.Material(name='Cohesive-T300-7901')
    mat1.Elastic(type=TRACTION, table=((1e5, 1e5, 1e5), ))
    mat1.QuadsDamageInitiation(table=((25, 50.0, 50.0), ))
    #m1.quadsDamageInitiation.DamageEvolution(type=DISPLACEMENT, table=((0.01, ), ))
    mat1.quadsDamageInitiation.DamageEvolution(type=ENERGY, mixedModeBehavior=BK, power=2.0,table=((0.34, 1.0, 1.0), ))

    #j=modelDCBResin(model1,ls,a0,crack_a,ws,plies,resinName,hresin=hresin,delta=delta,rPlastic=rPlastic)
    j=modelDCB_ZSYMM(model1,ls,a0,crack_a,ws,plies,resinName,hresin=hresin,delta=delta,rPlastic=rPlastic)
    
    if True:
        """