"""
Script to reproduce the shell-to-solid submodeling of a pipe joint,.
The script reproduces the example that uses a shell (S4) global model
and a solid (C3D20R) submodel.
The script pause while the global and submodel jobs are submitted for
analysis. The script ends by displaying an overlay contour plot of the
global shell model and the solid submodel.
"""

from abaqus import *
import testUtils
testUtils.setBackwardCompatibility()
from abaqusConstants import *

session.Viewport(name='Shell and Solid', origin=(10, 10),
    width=150.0, height=100)
session.viewports['Shell and Solid'].makeCurrent()

# Create the model database and the global model.

Mdb()
shellGlobalModel = mdb.Model(name='shellGlobalmodel')
session.viewports['Shell and Solid'].setValues(displayedObject=None)

# Create the shell part.

import part

# Sketch the plate and use the sketch for the base feature.

s = shellGlobalModel.Sketch(name='__profile__', sheetSize=0.2)
s.rectangle(point1=(-0.05, 0.0), point2=(0.05, -0.05))
p = shellGlobalModel.Part(name='plateAndPipe',
    dimensionality=THREE_D, type=DEFORMABLE_BODY)
p.BaseShell(sketch=s)

# Sketch the pipe.

f, e = p.faces, p.edges
t = p.MakeSketchTransform(sketchPlane=f[0], sketchUpEdge=e[2],
    sketchPlaneSide=SIDE1, sketchOrientation=RIGHT)
s0 = shellGlobalModel.Sketch(name='__profile__', sheetSize=0.2,
    gridSpacing=0.005, transform=t)
g, v, d = s0.geometry, s0.vertices, s0.dimensions
p.projectReferencesOntoSketch(sketch=s0, filter=COPLANAR_EDGES)
r, r0 = s0.referenceGeometry, s0.referenceVertices
s0.ArcByCenterEnds(center=(0.0, 0.025), point1=(0.01, 0.025), point2=(-0.01,
    0.025))

# Sketch the cut and extrude the sketch to form the pipe.

f0, e0 = p.faces, p.edges
p.ShellExtrude(sketchPlane=f0[0], sketchUpEdge=e0[2], sketchPlaneSide=SIDE1,
    sketchOrientation=RIGHT, sketch=s0, depth=0.05)
f, e = p.faces, p.edges
t = p.MakeSketchTransform(sketchPlane=f[1], sketchUpEdge=e[7],
    sketchPlaneSide=SIDE1, sketchOrientation=RIGHT)
s = shellGlobalModel.Sketch(name='__profile__', sheetSize=0.2,
    gridSpacing=0.005, transform=t)
g, v, d = s.geometry, s.vertices, s.dimensions
p.projectReferencesOntoSketch(sketch=s, filter=COPLANAR_EDGES)
r, r0 = s.referenceGeometry, s.referenceVertices
s.CircleByCenterPerimeter(center=(0.0, 0.0256732144869284), point1=(0.01,
    0.0256732144869284))
f0, e0 = p.faces, p.edges
p.CutExtrude(sketchPlane=f0[1], sketchUpEdge=e0[7], sketchPlaneSide=SIDE1,
    sketchOrientation=RIGHT, sketch=s)

# Create the material and the two sections (plate and pipe).
# Assign the material to each section.

import material
import section

shellGlobalModel.Material('Aluminum')
shellGlobalModel.materials['Aluminum'].Elastic(table=((
    69000000000.0, 0.3), ))
shellGlobalModel.HomogeneousShellSection(name='Plate',
    preIntegrate=OFF, material='Aluminum', thickness=0.001,
    poissonDefinition=DEFAULT, temperature=GRADIENT, integrationRule=SIMPSON,
    numIntPts=5)
shellGlobalModel.HomogeneousShellSection(name='Pipe', preIntegrate=OFF,
    material='Aluminum', thickness=0.00075, poissonDefinition=DEFAULT,
    temperature=GRADIENT, integrationRule=SIMPSON, numIntPts=5)
f = p.faces
faces = f[1:2]
region =(faces, )
p.SectionAssignment(region=region, sectionName='Plate')

faces = f[0:1]
region =(faces, )
p.SectionAssignment(region=region, sectionName='Pipe')

# Create the assembly with one instance of the part.

import assembly

a = shellGlobalModel.rootAssembly
a.DatumCsysByDefault(CARTESIAN)
a.Instance(name='plateAndPipe-1', part=p, dependent=OFF)
e1 = a.instances['plateAndPipe-1'].edges

# Create a reference point.

a.ReferencePoint(point=a.instances['plateAndPipe-1'].InterestingPoint(
    edge=e1[0], rule=CENTER))
session.viewports['Shell and Solid'].setValues(displayedObject=a)

# Create a Static step.

import step

shellGlobalModel.StaticStep(name='loadStep', previous='Initial',
    description='Total load of 10.0 N in the 1-direction')
session.viewports['Shell and Solid'].assemblyDisplay.setValues(step='loadStep')

# Create a rigid body constraint between the edge of the pipe
# and the reference point.

import interaction

e1 = a.instances['plateAndPipe-1'].edges
edges1 = e1[0:1]
region4=(edges1, )
r1 = a.referencePoints
refPoints1=(r1[4], )
region1=(refPoints1, )
shellGlobalModel.RigidBody(name='rigidBody', refPointRegion=region1,
    tieRegion=region4)

# Load the reference point and create the boundary conditions.

import load

shellGlobalModel.ConcentratedForce(name='X-axis load',
    createStepName='loadStep', region=region1, cf1=10.0)
e1 = a.instances['plateAndPipe-1'].edges
edges1 = e1[5:8]
region =(edges1, )
shellGlobalModel.EncastreBC(name='encastre', createStepName='loadStep',
    region=region)
edges1 = e1[1:2]+e1[3:5]+e1[8:9]
region =(edges1, )
shellGlobalModel.YsymmBC(name='symmetry', createStepName='loadStep',
    region=region)

# Mesh the part instance. Partitions help reproduce the mesh in the
# example problem.

import mesh

f1 = a.instances['plateAndPipe-1'].faces
faces =(f1[1], )
e1 = a.instances['plateAndPipe-1'].edges
v01 = a.instances['plateAndPipe-1'].vertices
a.PartitionFaceByShortestPath(point2=v01[6], faces=faces,
    point1=a.instances['plateAndPipe-1'].InterestingPoint(edge=e1[2],
    rule=CENTER))
f1 = a.instances['plateAndPipe-1'].faces
faces =(f1[2], )
e1 = a.instances['plateAndPipe-1'].edges
v01 = a.instances['plateAndPipe-1'].vertices
a.PartitionFaceByShortestPath(point2=v01[8], faces=faces,
    point1=a.instances['plateAndPipe-1'].InterestingPoint(edge=e1[3],
    rule=CENTER))

# Seed the edges. The seeds reproduce the mesh density in the
# example problem.

e11 = a.instances['plateAndPipe-1'].edges
edges =(e11[4], e11[12])
a.seedEdgeByNumber(edges=edges, number=6)
e21 = a.instances['plateAndPipe-1'].edges
edges =(e21[5], e21[11], e21[8], e21[10])
a.seedEdgeByNumber(edges=edges, number=8)
e11 = a.instances['plateAndPipe-1'].edges
edges =(e11[6], e11[9])
a.seedEdgeByNumber(edges=edges, number=6)
e21 = a.instances['plateAndPipe-1'].edges
edges =(e21[3], )
a.seedEdgeByNumber(edges=edges, number=12)
e11 = a.instances['plateAndPipe-1'].edges
edges =(e11[7], )
a.seedEdgeByNumber(edges=edges, number=24)
e21 = a.instances['plateAndPipe-1'].edges
edges =(e21[1], )
a.seedEdgeByNumber(edges=edges, number=12)

# Assign S4 elements to the mesh.

elemType1 = mesh.ElemType(elemCode=S4, elemLibrary=STANDARD)
elemType2 = mesh.ElemType(elemCode=S3, elemLibrary=STANDARD)
f1 = a.instances['plateAndPipe-1'].faces
faces1 = f1[0:4]
regions =(faces1, )
a.setElementType(regions=regions, elemTypes=(elemType1, elemType2))
f11 = a.instances['plateAndPipe-1'].faces

# Generate a structured mesh.

regions =(f11[0], f11[1], f11[2], f11[3])
a.setMeshControls(regions=regions, technique=STRUCTURED)
partInstances =(a.instances['plateAndPipe-1'], )
a.generateMesh(regions=partInstances)
session.viewports['Shell and Solid'].setValues(displayedObject=a)
session.viewports['Shell and Solid'].view.fitView()
session.viewports['Shell and Solid'].assemblyDisplay.setValues(mesh=ON,
    loads=ON, bcs=ON, predefinedFields=OFF)
session.viewports['Shell and Solid'].assemblyDisplay.meshOptions.setValues(
    meshTechnique=ON)
session.viewports['Shell and Solid'].plotAnnotation(mdb.Text(name='Text: 1', offset=(20., 15.),
    text='Global shell model with encastre and Y-axis'))
session.viewports['Shell and Solid'].plotAnnotation(mdb.Text(name='Text: 2', offset=(20., 10.),
    text='symmetry boundary conditions and X-axis load.'))


import job

# Create an analysis job.

mdb.Job(name='shellS4Globalmodel', model='shellGlobalmodel', type=ANALYSIS,
    explicitPrecision=SINGLE,
    description='Analysis of global model (S4).',
    userSubroutine='', numCpus=1, scratch='', echoPrint=OFF,
    modelPrint=OFF, contactPrint=OFF, historyPrint=OFF)

# Submit job and wait for it to complete.

mdb.jobs['shellS4Globalmodel'].submit()
mdb.jobs['shellS4Globalmodel'].waitForCompletion()

# Create a new model that is a copy of the global model.

solidSubModel = mdb.Model('solidSubModel', shellGlobalModel)

# Sketch the submodel plate and extrude .005 in the positive direction.

s = solidSubModel.Sketch(name='__profile__', sheetSize=0.2)
g, v, d = s.geometry, s.vertices, s.dimensions
s.ArcByCenterEnds(center=(0.0, 0.0), point1=(0.01, 0.0), point2=(-0.005, 0.0))
s.Line(point1=(-0.01, 0.0), point2=(-0.025, 0.0))
s.Line(point1=(0.01, 0.0), point2=(0.025, 0.0))
s.ArcByCenterEnds(center=(0.0, 0.0), point1=(0.025, 0.0), point2=(-0.025, 0.0))
p = solidSubModel.Part(name='plateAndPipe',
    dimensionality=THREE_D, type=DEFORMABLE_BODY)
p = solidSubModel.parts['plateAndPipe']
p.BaseSolidExtrude(sketch=s, depth=0.0005)

# Sketch the other half of the plate and extrude 0.005 in
# the negative direction.

del solidSubModel.sketches['__profile__']
f, e = p.faces, p.edges
t = p.MakeSketchTransform(sketchPlane=f.findAt(coordinates=(
    -0.0148864194209636, -0.000862730150341737, 0.0)), sketchUpEdge=e.findAt(
    coordinates=(-0.00707106781186547, -0.00707106781186548, 0.0005)),
    sketchPlaneSide=SIDE1, sketchOrientation=RIGHT, origin=(
    -3.04441055791377e-18, -0.0118229386296836, 0.0))
s = solidSubModel.Sketch(name='__profile__', sheetSize=0.2,
    gridSpacing=0.005, transform=t)
g, v, d = s.geometry, s.vertices, s.dimensions
p.projectReferencesOntoSketch(sketch=s, filter=COPLANAR_EDGES)
r, r0 = s.referenceGeometry, s.referenceVertices
s.sketchOptions.setValues(gridOrigin=(0.0, -0.0118229386296836))
s.ArcByCenterEnds(center=(0.0, -0.0118229386296836), point1=(-0.01,
    -0.0118229386296836), point2=(0.01, -0.0118229386296836))
s.ArcByCenterEnds(center=(0.0, -0.0118229386296836), point1=(-0.025,
    -0.0118229386296836), point2=(0.025, -0.0118229386296836))
s.Line(point1=(-0.025, -0.0118229386296836), point2=(-0.01,
    -0.0118229386296836))
s.Line(point1=(0.01, -0.0118229386296836), point2=(0.025, -0.0118229386296836))
s.constraintReferences(vertex1=r0.findAt((0.025, -0.0118229386296836), 1))
f, e = p.faces, p.edges
p.SolidExtrude(sketchPlane=f.findAt(coordinates=(-0.0148864194209636,
    -0.000862730150341737, 0.0)), sketchUpEdge=e.findAt(coordinates=(
    -0.00707106781186547, -0.00707106781186548, 0.0005)),
    sketchPlaneSide=SIDE1, sketchOrientation=RIGHT, sketch=s, depth=0.0005,
    flipExtrudeDirection=OFF)
del solidSubModel.sketches['__profile__']

# Sketch the pipe.

f, e = p.faces, p.edges
t = p.MakeSketchTransform(sketchPlane=f.findAt(coordinates=(
    -0.0148864194209636, -0.000862730150341736, -0.0005)),
    sketchUpEdge=e.findAt(coordinates=(0.00707106781186548,
    -0.00707106781186547, -0.0005)), sketchPlaneSide=SIDE1,
    sketchOrientation=RIGHT, origin=(4.98036677850066e-18,
    -0.0118229386296836, -0.0005))
s = solidSubModel.Sketch(name='__profile__', sheetSize=0.2,
    gridSpacing=0.005, transform=t)
g, v, d = s.geometry, s.vertices, s.dimensions
p.projectReferencesOntoSketch(sketch=s, filter=COPLANAR_EDGES)
r, r0 = s.referenceGeometry, s.referenceVertices
s.sketchOptions.setValues(gridOrigin=(0.0, -0.0118229386296836))
s.CircleByCenterPerimeter(center=(0.0, -0.0118229386296836), point1=(0.01,
    -0.0118229386296836))
s.CircleByCenterPerimeter(center=(0.0, -0.0118229386296836), point1=(0.015,
    -0.0118229386296836))
s.RadialDimension(curve=g[2], textPoint=(-0.00203350861556828,
    0.0292599427613648))
s.RadialDimension(curve=g[4], textPoint=(-0.0465447753667831,
    0.0116361904057893))
s.changeDimension(dimension=d[5], value=0.009625)
s.changeDimension(dimension=d[6], value=0.010375)
s.constraintReferences(vertex1=r0.findAt((0.0, -0.0118229386296836), 1))
f, e = p.faces, p.edges
p.SolidExtrude(sketchPlane=f.findAt(coordinates=(-0.0148864194209636,
    -0.000862730150341736, -0.0005)), sketchUpEdge=e.findAt(coordinates=(
    0.00707106781186548, -0.00707106781186547, -0.0005)),
    sketchPlaneSide=SIDE1, sketchOrientation=RIGHT, sketch=s, depth=0.01,
    flipExtrudeDirection=ON)

# Cut away the extra pipe material.

del solidSubModel.sketches['__profile__']
p = solidSubModel.parts['plateAndPipe']
f, e = p.faces, p.edges
t = p.MakeSketchTransform(sketchPlane=f.findAt(coordinates=(
    0.00989783884192712, 0.00172546030068347, 0.0095)), sketchUpEdge=e.findAt(
    coordinates=(6.19596808213406e-18, 0.009625, 0.0095)),
    sketchPlaneSide=SIDE1, sketchOrientation=RIGHT, origin=(
    -2.49366499671666e-18, 1.73472347597681e-18, 0.0095))
s0 = solidSubModel.Sketch(name='__profile__', sheetSize=0.2,
    gridSpacing=0.005, transform=t)
g, v, d = s0.geometry, s0.vertices, s0.dimensions
p = solidSubModel.parts['plateAndPipe']
p.projectReferencesOntoSketch(sketch=s0, filter=COPLANAR_EDGES)
r, r0 = s0.referenceGeometry, s0.referenceVertices
s0.rectangle(point1=(-0.04, 0.03), point2=(0.04, 0.0))
p = solidSubModel.parts['plateAndPipe']
f, e = p.faces, p.edges
p.CutExtrude(sketchPlane=f.findAt(coordinates=(0.00989783884192712,
    0.00172546030068347, 0.0095)), sketchUpEdge=e.findAt(coordinates=(
    6.19596808213406e-18, 0.009625, 0.0095)), sketchPlaneSide=SIDE1,
    sketchOrientation=RIGHT, sketch=s0, flipExtrudeDirection=OFF)
e = p.edges

# Fillet the pipe plate intersection.

p.Round(radius=0.001, edgeList=(e.findAt(coordinates=(0.00733623285481043,
    -0.00733623285481043, 0.0005)), ))

del solidSubModel.sketches['__profile__']

# Delete spurious vertices that interfere with the mesh.

v = p.vertices
p.RemoveRedundantEntities(vertexList=(v.findAt(coordinates=(0.025, 0.0, 0.0)),
    v.findAt(coordinates=(-0.025, 0.0, 0.0))))
p.RemoveRedundantEntities(vertexList=(v.findAt(coordinates=(-0.010375, 0.0,
    -0.0005)), v.findAt(coordinates=(0.010375, 0.0, -0.0005))))

# Create a solid section and assign it to the part.

solidSubModel.HomogeneousSolidSection(name='solidSection',
    material='Aluminum', thickness=1.0)
c = p.cells
cells = c[0:1]
region =(cells, )
p.SectionAssignment(region=region, sectionName='solidSection')

# Create an instance of the solid part.

a = solidSubModel.rootAssembly
a.Instance(name='plateAndPipe-1', part=p, dependent=OFF)
del mdb.annotations['Text: 1']
del mdb.annotations['Text: 2']
session.viewports['Shell and Solid'].setValues(displayedObject=a)

# Delete the rigid body tie constraint.

del solidSubModel.constraints['rigidBody']

# Delete the X-axis load and the encastre BC.

del solidSubModel.loads['X-axis load']
del solidSubModel.boundaryConditions['encastre']

# Add a Y-axis symmetry boundary condition.

a = solidSubModel.rootAssembly
f1 = a.instances['plateAndPipe-1'].faces
faces1 = f1.findAt(((-0.0153333333333333, 0.0, -0.000166666666666667), ), ((
    0.0204583333333333, 0.0, 0.000166666666666667), ))
region =(faces1, )
solidSubModel.YsymmBC(name='symmetry', createStepName='loadStep',
    region=region)

# Create the submodel BC and set the model attributes to
# read from the global model output database.

f1 = a.instances['plateAndPipe-1'].faces
faces1 = f1.findAt(((0.00976567869267743, -0.000830377769703921, 0.0095), ),
    ((0.0249053522830935, -0.00217334480812599, 0.000166666666666667), ))
region =(faces1, )
solidSubModel.SubmodelBC(name='submodelPlateBC',
    createStepName='loadStep', region=region, globalStep='1',
    globalIncrement=0, dof=(1,2,3,4,5,6), globalDrivingRegion='',
    shellThickness=0.001, absoluteExteriorTolerance=0.0, exteriorTolerance=0.1)
solidSubModel.setValues(globalJob='shellS4Globalmodel.odb', shellToSolid=ON)

# Sketch three partitions at the fillet.

a = solidSubModel.rootAssembly
f = a.instances['plateAndPipe-1'].faces
e = a.instances['plateAndPipe-1'].edges
t = a.MakeSketchTransform(sketchPlane=f.findAt(coordinates=(
    -0.0153333333333333, 0.0, -0.000166666666666667)),
    sketchUpEdge=e.findAt(coordinates=(-0.009625, 1.73472347597681e-18,
    0.002)), sketchPlaneSide=SIDE1, origin=(-0.0150385006492927, 0.0,
    0.0015177189072674))
s = solidSubModel.Sketch(name='__profile__',
    sheetSize=0.113578166916005, transform=t)
g, v, d = s.geometry, s.vertices, s.dimensions
a = solidSubModel.rootAssembly
a.projectReferencesOntoSketch(sketch=s, filter=COPLANAR_EDGES)
r, r0 = s.referenceGeometry, s.referenceVertices
s.sketchOptions.setValues(gridOrigin=(0.0054135006492927, 0.0020177189072674))
s.Line(point1=(0.0036635006492927, 0.0010177189072674), point2=(
    0.0036635006492927, 0.0020177189072674))
s.Line(point1=(0.0046635006492927, 1.77189072674e-05), point2=(
    0.0054135006492927, 1.77189072674e-05))
s.Line(point1=(0.0054135006492927, 0.0020177189072674), point2=(
    0.0036635006492927, 1.77189072673999e-05))
s.constraintReferences(vertex1=r0.findAt((0.0046635006492927,
    1.77189072674e-05), 1))
a = solidSubModel.rootAssembly
f = a.instances['plateAndPipe-1'].faces
faces =(f.findAt(coordinates=(-0.0153333333333333, 0.0,
    -0.000166666666666667)), )
e = a.instances['plateAndPipe-1'].edges

# Use the sketch to partition the face.

a.PartitionFaceBySketch(sketchUpEdge=e.findAt(coordinates=(-0.009625,
    1.73472347597681e-18, 0.002)), faces=faces, sketch=s)
del solidSubModel.sketches['__profile__']

# Sweep the partitions around the pipe plate intersection.

c = a.instances['plateAndPipe-1'].cells
cells =(c.findAt(coordinates=(-0.0112958920711911, 0.0,
    0.000176189798322111)), )
e = a.instances['plateAndPipe-1'].edges
edges =(e.findAt(coordinates=(-0.011375, 0.0, 0.00025)), )
a.PartitionCellBySweepEdge(sweepPath=e.findAt(coordinates=(
    -0.00680590276892052, -0.00680590276892052, -0.0005)), cells=cells,
    edges=edges)
a = solidSubModel.rootAssembly
c = a.instances['plateAndPipe-1'].cells
cells =(c.findAt(coordinates=(-0.0112958920711911, 0.0,
    0.000176189798322111)), )
e = a.instances['plateAndPipe-1'].edges
edges =(e.findAt(coordinates=(-0.0101875, 0.0, 0.0015)), )
a.PartitionCellBySweepEdge(sweepPath=e.findAt(coordinates=(
    -0.00680590276892052, -0.00680590276892052, -0.0005)), cells=cells,
    edges=edges)
a = solidSubModel.rootAssembly
c = a.instances['plateAndPipe-1'].cells
cells =(c.findAt(coordinates=(-0.0112958920711911, 0.0,
    0.000176189798322111)), )
e = a.instances['plateAndPipe-1'].edges
edges =(e.findAt(coordinates=(-0.00989787384803286, 0.0,
    -0.000188144173676719)), )
a.PartitionCellBySweepEdge(sweepPath=e.findAt(coordinates=(
    -0.00680590276892052, -0.00680590276892052, -0.0005)), cells=cells,
    edges=edges)

# Seed the edges. Force the mesh to follow the seeds where needed.

a = solidSubModel.rootAssembly
e = a.instances['plateAndPipe-1'].edges
edges =(e.findAt(coordinates=(-0.0101875, 0.0, 0.0015)), e.findAt(
    coordinates=(-0.011375, 0.0, 0.00025)), e.findAt(coordinates=(-0.0100625,
    0.0, -0.0005)), e.findAt(coordinates=(-0.0098125, 1.73472347597681e-18,
    0.0095)), e.findAt(coordinates=(-0.009625, 1.73472347597681e-18,
    -3.25260651745651e-19)), e.findAt(coordinates=(-0.025, 0.0, -0.00025)))
a.seedEdgeByNumber(edges=edges, number=4, constraint=FIXED)
e = a.instances['plateAndPipe-1'].edges
edges =(e.findAt(coordinates=(0.025, 0.0, -0.00025)), e.findAt(
    coordinates=(0.0101875, 1.73472347597681e-18, 0.0095)))
a.seedEdgeByNumber(edges=edges, number=4)
e = a.instances['plateAndPipe-1'].edges
edges =(e.findAt(coordinates=(-0.0103975970856574, 1.73472347597681e-18,
    0.00128861517785197)), e.findAt(coordinates=(-0.0108616168458057,
    1.73472347597681e-18, 0.000641840494436212)))
a.seedEdgeByNumber(edges=edges, number=4)
e = a.instances['plateAndPipe-1'].edges
edges =(e.findAt(coordinates=(-0.009625, 1.73472347597681e-18, 0.0035)),
    e.findAt(coordinates=(0.009625, 1.73472347597681e-18, 0.0075)), e.findAt(
    coordinates=(-0.010375, 1.73472347597681e-18, 0.0075)), e.findAt(
    coordinates=(0.010375, 1.73472347597681e-18, 0.0035)))
a.seedEdgeByNumber(edges=edges, number=8, constraint=FIXED)
e = a.instances['plateAndPipe-1'].edges
edges =(e.findAt(coordinates=(0.01478125, 0.0, 0.0005)), e.findAt(
    coordinates=(0.02159375, 0.0, -0.0005)), e.findAt(coordinates=(
    -0.02159375, 0.0, 0.0005)), e.findAt(coordinates=(-0.01478125, 0.0,
    -0.0005)))
a.seedEdgeByNumber(edges=edges, number=11)
e = a.instances['plateAndPipe-1'].edges
edges =(e.findAt(coordinates=(0.00733623285481043, -0.00733623285481043,
    0.0015)), e.findAt(coordinates=(0.00680590276892052,
    -0.00680590276892052, 0.0015)), e.findAt(coordinates=(
    -0.00680590276892052, -0.00680590276892052, 0.0095)), e.findAt(
    coordinates=(-0.00804333963599697, -0.00804333963599698, 0.0005)),
    e.findAt(coordinates=(0.00804333963599698, -0.00804333963599698,
    -0.0005)), e.findAt(coordinates=(-0.00680590276892052,
    -0.00680590276892052, -0.0005)), e.findAt(coordinates=(
    0.00733623285481043, -0.00733623285481043, 0.0095)), e.findAt(
    coordinates=(0.0176776695296637, -0.0176776695296637, 0.0005)), e.findAt(
    coordinates=(-0.0176776695296637, -0.0176776695296637, -0.0005)))
a.seedEdgeByNumber(edges=edges, number=14)

# Set the element type to C3D20R.

elemType1 = mesh.ElemType(elemCode=C3D20R, elemLibrary=STANDARD)
elemType2 = mesh.ElemType(elemCode=C3D15, elemLibrary=STANDARD)
elemType3 = mesh.ElemType(elemCode=C3D10M, elemLibrary=STANDARD)
a = solidSubModel.rootAssembly
c = a.instances['plateAndPipe-1'].cells
cells1 = c[0:4]
regions =(cells1, )
a.setElementType(regions=regions, elemTypes=(elemType1, elemType2, elemType3))

# Generate the mesh.

partInstances =(a.instances['plateAndPipe-1'], )
a.generateMesh(regions=partInstances)
session.viewports['Shell and Solid'].setValues(displayedObject=a)
session.viewports['Shell and Solid'].view.fitView()
session.viewports['Shell and Solid'].assemblyDisplay.setValues(mesh=ON,
    loads=ON, bcs=ON, predefinedFields=OFF)
session.viewports['Shell and Solid'].assemblyDisplay.meshOptions.setValues(
    meshTechnique=ON)
session.viewports['Shell and Solid'].plotAnnotation(mdb.Text(name='Text: 1', offset=(20., 15.),
    text='Solid submodel with Y-axis symmetry'))
session.viewports['Shell and Solid'].plotAnnotation(mdb.Text(name='Text: 2', offset=(20., 10.),
    text='and submodel boundary conditions.'))

# Create a job, submit it for analysis, and wait for it to complete.

mdb.Job(name='solidC3D20RSubmodel', model='solidSubModel', type=ANALYSIS,
    explicitPrecision=SINGLE, description='', userSubroutine='', numCpus=1,
    scratch='', echoPrint=OFF, modelPrint=OFF, contactPrint=OFF,
    historyPrint=OFF)

mdb.jobs['solidC3D20RSubmodel'].submit()
mdb.jobs['solidC3D20RSubmodel'].waitForCompletion()
del mdb.annotations['Text: 1']
del mdb.annotations['Text: 2']

import visualization

# Display the results of the analysis of the solid.

odb = session.openOdb('solidC3D20RSubmodel.odb')
session.viewports['Shell and Solid'].setValues(displayedObject=odb)
session.viewports['Shell and Solid'].viewportAnnotationOptions.setValues(title=OFF, legend=ON, legendBackgroundStyle=MATCH)
session.viewports['Shell and Solid'].odbDisplay.display.setValues(plotState=(CONTOURS_ON_DEF,))
session.viewports['Shell and Solid'].odbDisplay.contourOptions.setValues(
    deformationScaling=UNIFORM, uniformScaleFactor=20)
session.viewports['Shell and Solid'].odbDisplay.contourOptions.setValues(
    maxAutoCompute=OFF, maxValue=9.E+007, minAutoCompute=OFF, minValue=0)

# Create a layer with a contour plot of the solid.

session.viewports['Shell and Solid'].Layer('Layer-1')

# Display the results of the analysis of the shell.

odb = session.openOdb('shellS4Globalmodel.odb')
session.viewports['Shell and Solid'].setValues(displayedObject=odb)

session.viewports['Shell and Solid'].odbDisplay.display.setValues(plotState=(CONTOURS_ON_DEF,))
session.viewports['Shell and Solid'].odbDisplay.contourOptions.setValues(
    deformationScaling=UNIFORM, uniformScaleFactor=20)
session.viewports['Shell and Solid'].viewportAnnotationOptions.setValues(
    legend=ON,  legendBackgroundStyle=MATCH, title=OFF)
session.viewports['Shell and Solid'].odbDisplay.contourOptions.setValues(
    maxAutoCompute=OFF, maxValue=9.E+007, minAutoCompute=OFF, minValue=0)

# Create a layer with a contour plot of the shell.

session.viewports['Shell and Solid'].Layer('Layer-2', 'Layer-1')

session.viewports['Shell and Solid'].setValues(visibleLayers=('Layer-1',
    'Layer-2', ), layerOffset=0, currentLayer='Layer-2', viewManipLayers=ALL,
    displayMode=OVERLAY)
session.viewports['Shell and Solid'].view.setValues(width=70, height=45,
    cameraPosition=(22, -15, 525), cameraTarget=(22, -15, 0))

