FEA R1: Static analysis of a 2D frame structure

! Created by: Gergely Gyebroszki, 2018.02.08.

Initial setup

! White canvas
/RGB/RGB, Kywrd, PRED, PGRN, PBLU, N1, N2, NINC, NCNTR Specifies the RGB color values for indices and contours.,INDEX,100,100,100,0
/RGB/RGB, Kywrd, PRED, PGRN, PBLU, N1, N2, NINC, NCNTR Specifies the RGB color values for indices and contours.,INDEX,0,0,0,15

SETUP: element types, materials, sections

! Preferences / Structural
KEYWKEYW, Keyword, KEY Sets a keyword used by the GUI for context filtering (GUI).,PR_STRUC,1
! Enter Preprocessor phase
/PREP7/PREP7 Enters the model creation preprocessor.
! Element type, add: Beam 188
ETET, ITYPE, Ename, KOP1, KOP2, KOP3, KOP4, KOP5, KOP6, INOPR Defines a local element type from the element library.,1,BEAM188
! Displacement field interpolation 0 - linear, 2 - quadratic, 3 - cubic
KEYOPTKEYOPT, ITYPE, KNUM, VALUE Sets element key options.,1,3,0
! Beam sections (hollow rectangle)
SECTYPESECTYPE, SECID, Type, Subtype, Name, REFINEKEY Associates section type information with a section ID number.,1,BEAM,HREC,SEC1! HREC: Hollow rectangle, SEC1: optional user-defined name
SECOFFSETSECOFFSET, Location, OFFSET1, OFFSET2, CG-Y, CG-Z, SH-Y, SH-Z Defines the section offset for cross sections.,CENT
SECDATASECDATA, VAL1, VAL2, VAL3, VAL4, VAL5, VAL6, VAL7, VAL8, VAL9, VAL10, VAL11, VAL12 Describes the geometry of a section.,50,30,3,3,3,3
SECTYPESECTYPE, SECID, Type, Subtype, Name, REFINEKEY Associates section type information with a section ID number.,2,BEAM,HREC,SEC2
SECOFFSETSECOFFSET, Location, OFFSET1, OFFSET2, CG-Y, CG-Z, SH-Y, SH-Z Defines the section offset for cross sections.,CENT
SECDATASECDATA, VAL1, VAL2, VAL3, VAL4, VAL5, VAL6, VAL7, VAL8, VAL9, VAL10, VAL11, VAL12 Describes the geometry of a section.,30,30,3,3,3,3
! Material properties
MPTEMPMPTEMP, SLOC, T1, T2, T3, T4, T5, T6 Defines a temperature table for material properties.,1,0
MPDATAMPDATA, Lab, MAT, SLOC, C1, C2, C3, C4, C5, C6 Defines property data to be associated with the temperature table.,EX,1,,2E5
MPDATAMPDATA, Lab, MAT, SLOC, C1, C2, C3, C4, C5, C6 Defines property data to be associated with the temperature table.,PRXY,1,,0.3
MPDATAMPDATA, Lab, MAT, SLOC, C1, C2, C3, C4, C5, C6 Defines property data to be associated with the temperature table.,DENS,1,,7.8E-9

MODELLING

! Enable keypoint and line numbering
/PNUM/PNUM, Label, KEY Controls entity numbering/coloring on plots.,KP,1
/PNUM/PNUM, Label, KEY Controls entity numbering/coloring on plots.,LINE,1
! Create keypoints
KK, NPT, X, Y, Z Defines a keypoint.,,-3000
KK, NPT, X, Y, Z Defines a keypoint.,,-3000,2000
KK, NPT, X, Y, Z Defines a keypoint.,,-3000,3500
KK, NPT, X, Y, Z Defines a keypoint.,,-2500,3000
KK, NPT, X, Y, Z Defines a keypoint.,,-1500,3000
KK, NPT, X, Y, Z Defines a keypoint.,,,3000
KK, NPT, X, Y, Z Defines a keypoint.,,,4000
KK, NPT, X, Y, Z Defines a keypoint.,,-1500,4500
KK, NPT, X, Y, Z Defines a keypoint.,,-2000,2000
! Create lines
LL, P1, P2, NDIV, SPACE, XV1, YV1, ZV1, XV2, YV2, ZV2 Defines a line between two keypoints.,1,2
LL, P1, P2, NDIV, SPACE, XV1, YV1, ZV1, XV2, YV2, ZV2 Defines a line between two keypoints.,2,3
LL, P1, P2, NDIV, SPACE, XV1, YV1, ZV1, XV2, YV2, ZV2 Defines a line between two keypoints.,3,7
LL, P1, P2, NDIV, SPACE, XV1, YV1, ZV1, XV2, YV2, ZV2 Defines a line between two keypoints.,7,6
LL, P1, P2, NDIV, SPACE, XV1, YV1, ZV1, XV2, YV2, ZV2 Defines a line between two keypoints.,6,5
LL, P1, P2, NDIV, SPACE, XV1, YV1, ZV1, XV2, YV2, ZV2 Defines a line between two keypoints.,5,4
LL, P1, P2, NDIV, SPACE, XV1, YV1, ZV1, XV2, YV2, ZV2 Defines a line between two keypoints.,4,1
! Create auxiliary lines
LL, P1, P2, NDIV, SPACE, XV1, YV1, ZV1, XV2, YV2, ZV2 Defines a line between two keypoints.,2,9
LL, P1, P2, NDIV, SPACE, XV1, YV1, ZV1, XV2, YV2, ZV2 Defines a line between two keypoints.,5,8
! Intersect lines
LINLLINL, NL1, NL2, NL3, NL4, NL5, NL6, NL7, NL8, NL9 Finds the common intersection of lines.,3,9
LINLLINL, NL1, NL2, NL3, NL4, NL5, NL6, NL7, NL8, NL9 Finds the common intersection of lines.,7,8
! Create deleted lines
LL, P1, P2, NDIV, SPACE, XV1, YV1, ZV1, XV2, YV2, ZV2 Defines a line between two keypoints.,1,8
LL, P1, P2, NDIV, SPACE, XV1, YV1, ZV1, XV2, YV2, ZV2 Defines a line between two keypoints.,8,4
LL, P1, P2, NDIV, SPACE, XV1, YV1, ZV1, XV2, YV2, ZV2 Defines a line between two keypoints.,3,10
LL, P1, P2, NDIV, SPACE, XV1, YV1, ZV1, XV2, YV2, ZV2 Defines a line between two keypoints.,10,7
! Create thin lines
LL, P1, P2, NDIV, SPACE, XV1, YV1, ZV1, XV2, YV2, ZV2 Defines a line between two keypoints.,2,8
LL, P1, P2, NDIV, SPACE, XV1, YV1, ZV1, XV2, YV2, ZV2 Defines a line between two keypoints.,3,4
LL, P1, P2, NDIV, SPACE, XV1, YV1, ZV1, XV2, YV2, ZV2 Defines a line between two keypoints.,4,10
LL, P1, P2, NDIV, SPACE, XV1, YV1, ZV1, XV2, YV2, ZV2 Defines a line between two keypoints.,5,10
LL, P1, P2, NDIV, SPACE, XV1, YV1, ZV1, XV2, YV2, ZV2 Defines a line between two keypoints.,10,6
! Select all lines with negative X coord
LSELLSEL, Type, Item, Comp, VMIN, VMAX, VINC, KSWP Selects a subset of lines.,S,LOC,X,-4000,-1
! Reflect these lines to YZ plane
LSYMMLSYMM, Ncomp, NL1, NL2, NINC, KINC, NOELEM, IMOVE Generates lines from a line pattern by symmetry reflection.,X,ALL
! Select all lines again to include the one at X=0
LSELLSEL, Type, Item, Comp, VMIN, VMAX, VINC, KSWP Selects a subset of lines.,ALL
! Merge keypoints at the same coordinates
NUMMRGNUMMRG, Label, TOLER, GTOLER, Action, Switch Merges coincident or equivalently defined items.,KP,0.01,,,LOW

MESHING

! Set uniform element size
LESIZELESIZE, NL1, SIZE, ANGSIZ, NDIV, SPACE, KFORC, LAYER1, LAYER2, KYNDIV Specifies the divisions and spacing ratio on unmeshed lines.,ALL,100
! Select thin lines
LSELLSEL, Type, Item, Comp, VMIN, VMAX, VINC, KSWP Selects a subset of lines.,S,,,4
LSELLSEL, Type, Item, Comp, VMIN, VMAX, VINC, KSWP Selects a subset of lines.,A,,,10,14
LSELLSEL, Type, Item, Comp, VMIN, VMAX, VINC, KSWP Selects a subset of lines.,A,,,23,27
! Activate cross section 2
SECNSECNUM, SECID Sets the element section attribute pointer.,2
! Mesh these lines using section 2
LMESHLMESH, NL1, NL2, NINC Generates nodes and line elements along lines.,ALL
! Invert selection on lines
LSELLSEL, Type, Item, Comp, VMIN, VMAX, VINC, KSWP Selects a subset of lines.,INVE
! Activate cross section 1
SECNSECNUM, SECID Sets the element section attribute pointer.,1
! Mesh these lines using section 1
LMESHLMESH, NL1, NL2, NINC Generates nodes and line elements along lines.,ALL
LSELLSEL, Type, Item, Comp, VMIN, VMAX, VINC, KSWP Selects a subset of lines.,ALL
! Turn on the element shape display
/ESHAPE/ESHAPE, SCALE, KEY Displays elements with shapes determined from the real constants or section definition.,1.0
EPLOTEPLOT Produces an element display.

CONSTRAINTS AND LOADS

! Constrain all dof of KP 1 and 9
! Select KP 1
KSELKSEL, Type, Item, Comp, VMIN, VMAX, VINC, KABS Selects a subset of keypoints or hard points.,S,,,1
! Also select KP 9
KSELKSEL, Type, Item, Comp, VMIN, VMAX, VINC, KABS Selects a subset of keypoints or hard points.,A,,,9
! Select nodes attached to these keypoints
NSLKNSLK, Type Selects those nodes associated with the selected keypoints.,S
! Constrain all DOFs
DD, Node, Lab, VALUE, VALUE2, NEND, NINC, Lab2, Lab3, Lab4, Lab5, Lab6 Defines degree-of-freedom constraints at nodes.,ALL,,,,,,ALL
! Select everything again
ALLSELALLSEL, LabT, Entity Selects all entities with a single command.,ALL
! Constrain UZ of all nodes
DD, Node, Lab, VALUE, VALUE2, NEND, NINC, Lab2, Lab3, Lab4, Lab5, Lab6 Defines degree-of-freedom constraints at nodes.,ALL,,,,,,UZ
! Select top lines on the left
LSELLSEL, Type, Item, Comp, VMIN, VMAX, VINC, KSWP Selects a subset of lines.,S,,,8,9
! Select elements attached to these lines
ESLLESLL, Type Selects those elements associated with the selected lines.,S
! Apply P1 pressure
SFBEAMSFBEAM, Elem, LKEY, Lab, VALI, VALJ, VAL2I, VAL2J, IOFFST, JOFFST, LENRAT Specifies surface loads on beam and pipe elements.,ALL,2,PRES,0.5
! Select top lines on the right
LSELLSEL, Type, Item, Comp, VMIN, VMAX, VINC, KSWP Selects a subset of lines.,S,,,21,22
! Select elements attached to these lines
ESLLESLL, Type Selects those elements associated with the selected lines.,S
! Apply P1 pressure with opposite direction because line orientation is opposite here
SFBEAMSFBEAM, Elem, LKEY, Lab, VALI, VALJ, VAL2I, VAL2J, IOFFST, JOFFST, LENRAT Specifies surface loads on beam and pipe elements.,ALL,2,PRES,-0.5
! Select side lines on the right
LSELLSEL, Type, Item, Comp, VMIN, VMAX, VINC, KSWP Selects a subset of lines.,S,,,15,16
! Select elements attached to these lines
ESLLESLL, Type Selects those elements associated with the selected lines.,S
! Apply P2 pressure
SFBEAMSFBEAM, Elem, LKEY, Lab, VALI, VALJ, VAL2I, VAL2J, IOFFST, JOFFST, LENRAT Specifies surface loads on beam and pipe elements.,ALL,2,PRES,-0.2
! Select everything again
ALLSELALLSEL, LabT, Entity Selects all entities with a single command.,ALL
! Set acceleration of reference system to -g
ACELACEL, ACEL_X, ACEL_Y, ACEL_Z Specifies the linear acceleration of the global Cartesian reference frame for the analysis.,0,9810,0

SOLUTION: Solve K.U=F

! Enter Solution Phase
/SOL/SOLU Enters the solution processor.
! Solve current load step
SOLVESOLVE, Action Starts a solution.

POSTPROCESSING

! Enter postprocessing phase
/POST1/POST1 Enters the database results postprocessor.
! Plot deformed shape with undeformed model's edges
PLDISPPLDISP, KUND Displays the displaced structure.,2
! X-directional displacement on contour plot
PLNSOLPLNSOL, Item, Comp, KUND, Fact, FileID Displays results as continuous contours.,U,X,0,1.0 ! Click here to view image
! Y-directional displacement on contour plot
PLNSOLPLNSOL, Item, Comp, KUND, Fact, FileID Displays results as continuous contours.,U,Y,0,1.0 ! Click here to view image
! Create element tables for MZ at node I and J of elements
ETABLEETABLE, Lab, Item, Comp, Option Fills a table of element values for further processing.,MZI,SMISC,3
ETABLEETABLE, Lab, Item, Comp, Option Fills a table of element values for further processing.,MZJ,SMISC,16
! Plot line element results (MZI and MZJ)
PLLSPLLS, LabI, LabJ, Fact, KUND, ViewUP Displays element table items as contoured areas along elements.,MZI,MZJ,1,0,0 ! Click here to view image