VM193 Input Listing


/COM,ANSYS MEDIA REL. 2024R2 (05/10/2024) REF. VERIF. MANUAL: REL. 2024R2
/VERIFY,VM193
/TITLE,VM193,EVALUATION OF SIFS FOR AN INCLINED CRACK USING THE XFEM METHOD
/COM, REFERENCE: X.Y LIU, Q.Z XIAO & B.L.KARIHALOO, XFEM FOR DIRECT
/COM, EVALUATION OF MIXED MODE SIFS IN HOMOGENEOUS AND BI
/COM, MATERIALS,
/COM, INT. J. NUMER. METH. ENGNG, 2004; 59:1103-1118
/COM,
/COM, ---------------------------------------------
/COM,  VM193A -- SOLVING FOR THETA=0 DEGREES
/COM, ---------------------------------------------

/OUT,SCRATCH

/PREP7

_GEOMGEN=0          ! SET THIS TO 1 TO GENERATE CDB FILE
_EXIT=0             ! SET THIS TO 1 TO EXIT WITHOUT SOLVING

*IF,_GEOMGEN,EQ,1,THEN

ALPHA=0				!--- ANGLE
PI=ACOS(-1)

ET,1,PLANE182

!CONTINUUM MATERIAL BEHAVIOR
MP, EX,   1, 100
MP, NUXY,  1, 0.3
MP, DENS, 1, 1.0

WPSTYLE,,,,,,,,1
WPROTA,ALPHA,,
CSWPLA,11,0

!DEFINE AREA

RECTNG,-2,2,-2,2

CSYS,0
K,5,  -5,     -5
K,6,   5,     -5
K,7,   5,      5
K,8,  -5,      5   
A,5,6,7,8
AOVLAP,ALL


! SET UP THE MESHING SIZE
XNUME=79    ! NUMBER OF ELEMENTS IN X,  WHICH SHOULD BE ODD 
YNUME=79    ! NUMBER OF ELEMENTS IN Y , WHICH SHOULD BE ODD

LSEL,S,LINE,,1,3,2
LESIZE,ALL, , ,XNUME, , , , ,1
LSEL,S,LINE,,2,4,2
LESIZE,ALL, , ,YNUME, , , , ,1

AMESH,1
ESIZE,0.5
AMESH,3

! ELEMENT COMPONENT REQUIRED FOR XFENRICH COMMAND
ESEL, S, CENT, Y, -2,2
CM, TESTCMP, ELEM
ALLSEL

!
!DEFINE ENRICHMENT IDENTIFICATION
!XFENRICH, ID#, EL COMPONENT, MAT ID FOR CZM
!XFDATA,    1,   LSM,EL#,ND#, PHI, PSI(CRACK TIP INDICATOR-NOT USED)
!
! FOLLOWING DATA EXTRACTED FROM PREPROCESSOR IN ANSYS GUI
XFENRICH, ENRICH1, TESTCMP, , SING,0.9
ALLSEL
/COM           INITIAL CRACK DATA
CSYS,11
XC1 = -0.5
YC1 = 0
XC2 = 0.5
YC2 = 0
NSEL,S,LOC,X,XC1,XC2
ESLN,S,
ESEL, R, CENT, Y, -1E-3, 1E-3

CM, CENELEM, ELEM
NELEM = 100
IEL = 0
PHI = 0.0
PSI = 0.0
*DO, I, 1, NELEM, 1
 IEL = ELNEXT(IEL)
 *IF, IEL, NE, 0, THEN
  *DO, J, 1, 4, 1
    ND = NELEM(IEL,J)
    *IF, NX(ND),LT,0,THEN
    PHI = NY(ND) - YC1
    PSI = -(NX(ND) - XC1)	
    XFDATA, ENRICH1, LSM, IEL, ND, PHI, PSI
    *ELSEIF,NX(ND),GT,0,THEN
    PHI = NY(ND) - YC2
    PSI = NX(ND) - XC2
    XFDATA, ENRICH1, LSM, IEL, ND, PHI, PSI
   *ENDIF
  *ENDDO
 *ENDIF
*ENDDO 
XFLIST
ALLSEL,ALL

CSYS,0 
! CRK TIP ELEMENT
ESEL,S,ELEM,,3111
CM, CRKTIPELEM1, ELEM
ALLSEL,ALL

ESEL,S,ELEM,,3131
CM, CRKTIPELEM2, ELEM
ALLSEL,ALL

NSEL,S,LOC,X,-5
NSEL,R,LOC,Y,0
D,ALL,UX,0
D,ALL,UY,0
ALLSEL

NSEL,S,LOC,X,5
NSEL,R,LOC,Y,0
D,ALL,UY,0
ALLSEL

!B.C. - BOTTOM FACE
NSEL, S, LOC, Y, -5.0
SF, ALL, PRES, -1
ALLSEL

!B.C. - TOP FACE
NSEL, S, LOC, Y, 5.0
SF, ALL, PRES, -1
ALLSEL

WPSTYLE,,,,,,,,1
WPROTA,ALPHA+180,,
CSWPLA,12,0
WPROTA,-(ALPHA+180),,

CSYS,0
FINISH


CDWRITE,DB,VM193A,CDB

*IF,_EXIT,EQ,1,THEN
*ENDIF

*ELSE

/PREP7 
CDREAD,DB,VM193A,CDB
*ENDIF
FINISH

/SOLUTION
ANTYPE,0
TIME, 1.0
NSUBST,4
OUTRES,ALL, ALL

!CINT CALCULATIONS
CINT, NEW, 1
CINT, CXFE, CRKTIPELEM1
CINT, TYPE, SIFS
CINT, NCON, 8
CINT, NORM, 12, 2

CINT, NEW, 2
CINT, CXFE, CRKTIPELEM2
CINT, TYPE, SIFS
CINT, NCON, 8
CINT, NORM, 11, 2

SOLVE
FINISH

/POST1
SET,LAST,LAST
/COM CRACK_TIP_1
/COM >>> MODE 1 STRESS INTENSITY FACTOR
PRCINT,1,,K1
/COM
/COM >>> MODE 2 STRESS INTENSITY FACTOR
PRCINT,1,,K2
/COM

/COM CRACK_TIP_2
/COM >>> MODE 1 STRESS INTENSITY FACTOR
PRCINT,2,,K1
/COM
/COM >>> MODE 2 STRESS INTENSITY FACTOR
PRCINT,2,,K2
/COM
*GET,MAXNODE,CINT,1,NNOD

*GET,NODEID_LEFT,CINT,1,NODE,1

*GET,A1,CINT,1,CTIP,NODEID_LEFT,,2,,K1
*GET,A2,CINT,1,CTIP,NODEID_LEFT,,3,,K1
*GET,A3,CINT,1,CTIP,NODEID_LEFT,,4,,K1
*GET,A4,CINT,1,CTIP,NODEID_LEFT,,5,,K1
*GET,A5,CINT,1,CTIP,NODEID_LEFT,,6,,K1

*GET,B1,CINT,1,CTIP,NODEID_LEFT,,2,,K2
*GET,B2,CINT,1,CTIP,NODEID_LEFT,,3,,K2
*GET,B3,CINT,1,CTIP,NODEID_LEFT,,4,,K2
*GET,B4,CINT,1,CTIP,NODEID_LEFT,,5,,K2
*GET,B5,CINT,1,CTIP,NODEID_LEFT,,6,,K2

*GET,MAXNODE,CINT,2,NNOD

*GET,NODEID_RIGHT,CINT,2,NODE,1

*GET,C1,CINT,2,CTIP,NODEID_RIGHT,,2,,K1
*GET,C2,CINT,2,CTIP,NODEID_RIGHT,,3,,K1
*GET,C3,CINT,2,CTIP,NODEID_RIGHT,,4,,K1
*GET,C4,CINT,2,CTIP,NODEID_RIGHT,,5,,K1
*GET,C5,CINT,2,CTIP,NODEID_RIGHT,,6,,K1

*GET,D1,CINT,2,CTIP,NODEID_RIGHT,,2,,K2
*GET,D2,CINT,2,CTIP,NODEID_RIGHT,,3,,K2
*GET,D3,CINT,2,CTIP,NODEID_RIGHT,,4,,K2
*GET,D4,CINT,2,CTIP,NODEID_RIGHT,,5,,K2
*GET,D5,CINT,2,CTIP,NODEID_RIGHT,,6,,K2


K1_REF = 1.253
K2_REF = 0
K1_LEFT =(ABS(A1)+ABS(A2)+ABS(A3)+ABS(A4)+ABS(A5))/5
K2_LEFT =(ABS(B1)+ABS(B2)+ABS(B3)+ABS(B4)+ABS(B5))/5
K1_RIGHT =(ABS(C1)+ABS(C2)+ABS(C3)+ABS(C4)+ABS(C5))/5
K2_RIGHT =(ABS(D1)+ABS(D2)+ABS(D3)+ABS(D4)+ABS(D5))/5
PARSAV,ALL,CASE1,PARM
FINISH
/CLEAR,NOSTART


/OUT,SCRATCH
/COM, ---------------------------------------------
/COM,  VM193B -- SOLVING FOR THETA= 30 DEGREES
/COM, ---------------------------------------------


/PREP7

_GEOMGEN=0          ! SET THIS TO 1 TO GENERATE CDB FILE
_EXIT=0             ! SET THIS TO 1 TO EXIT WITHOUT SOLVING

*IF,_GEOMGEN,EQ,1,THEN

ALPHA=30				!--- ANGLE
PI=ACOS(-1)

ET,1,PLANE182

!CONTINUUM MATERIAL BEHAVIOR
MP, EX,   1, 100
MP, NUXY,  1, 0.3
MP, DENS, 1, 1.0

WPSTYLE,,,,,,,,1
WPROTA,ALPHA,,
CSWPLA,11,0

!DEFINE AREA

RECTNG,-2,2,-2,2

CSYS,0
K,5,  -5,     -5
K,6,   5,     -5
K,7,   5,      5
K,8,  -5,      5   
A,5,6,7,8
AOVLAP,ALL

! SET UP THE MESHING SIZE
XNUME=79   ! NUMBER OF ELEMENTS IN X,  WHICH SHOULD BE ODD 
YNUME=79    ! NUMBER OF ELEMENTS IN Y , WHICH SHOULD BE ODD
LSEL,S,LINE,,1,3,2
LESIZE,ALL, , ,XNUME, , , , ,1
LSEL,S,LINE,,2,4,2
LESIZE,ALL, , ,YNUME, , , , ,1

AMESH,1
ESIZE,0.5
AMESH,3

! ELEMENT COMPONENT REQUIRED FOR XFENRICH COMMAND
ESEL, S, CENT, Y, -2,2
CM, TESTCMP, ELEM
ALLSEL

!
!DEFINE ENRICHMENT IDENTIFICATION
!XFENRICH, ID#, EL COMPONENT, MAT ID FOR CZM
!XFDATA,    1,   LSM,EL#,ND#, PHI, PSI(CRACK TIP INDICATOR-NOT USED)
!
! FOLLOWING DATA EXTRACTED FROM PREPROCESSOR IN ANSYS GUI
XFENRICH, ENRICH1, TESTCMP, , SING,0.9
ALLSEL
/COM           INITIAL CRACK DATA
CSYS,11
XC1 = -0.5
YC1 = 0
XC2 = 0.5
YC2 = 0
NSEL,S,LOC,X,XC1,XC2
ESLN,S,
ESEL, R, CENT, Y, -1E-3, 1E-3

CM, CENELEM, ELEM
NELEM = 100
IEL = 0
PHI = 0.0
PSI = 0.0
*DO, I, 1, NELEM, 1
 IEL = ELNEXT(IEL)
 *IF, IEL, NE, 0, THEN
  *DO, J, 1, 4, 1
    ND = NELEM(IEL,J)
    *IF, NX(ND),LT,0,THEN
    PHI = NY(ND) - YC1
    PSI = -(NX(ND) - XC1)	
    XFDATA, ENRICH1, LSM, IEL, ND, PHI, PSI
    *ELSEIF,NX(ND),GT,0,THEN
    PHI = NY(ND) - YC2
    PSI = NX(ND) - XC2
    XFDATA, ENRICH1, LSM, IEL, ND, PHI, PSI
   *ENDIF
  *ENDDO
 *ENDIF
*ENDDO 
XFLIST
ALLSEL,ALL

CSYS,0 
! CRK TIP ELEMENT
ESEL,S,ELEM,,3111
CM, CRKTIPELEM1, ELEM
ALLSEL,ALL

ESEL,S,ELEM,,3131
CM, CRKTIPELEM2, ELEM
ALLSEL,ALL

NSEL,S,LOC,X,-5
NSEL,R,LOC,Y,0
D,ALL,UX,0
D,ALL,UY,0
ALLSEL

NSEL,S,LOC,X,5
NSEL,R,LOC,Y,0
D,ALL,UY,0
ALLSEL

!B.C. - BOTTOM FACE
NSEL, S, LOC, Y, -5.0
SF, ALL, PRES, -1
ALLSEL

!B.C. - TOP FACE
NSEL, S, LOC, Y, 5.0
SF, ALL, PRES, -1
ALLSEL

WPSTYLE,,,,,,,,1
WPROTA,ALPHA+180,,
CSWPLA,12,0
WPROTA,-(ALPHA+180),,

CSYS,0
FINISH

CDWRITE,DB,VM193B,CDB

*IF,_EXIT,EQ,1,THEN
*ENDIF

*ELSE

/PREP7 
   CDREAD,DB,VM193B,CDB
*ENDIF
FINISH

/SOLUTION
ANTYPE,0
TIME, 1.0
NSUBST,4
OUTRES,ALL, ALL

!CINT CALCULATIONS
CINT, NEW, 1
CINT, CXFE, CRKTIPELEM1
CINT, TYPE, SIFS
CINT, NCON, 8
CINT, NORM, 12, 2

CINT, NEW, 2
CINT, CXFE, CRKTIPELEM2
CINT, TYPE, SIFS
CINT, NCON, 8
CINT, NORM, 11, 2

SOLVE
FINISH

/POST1
SET,LAST,LAST

/COM CRACK_TIP_1
/COM >>> MODE 1 STRESS INTENSITY FACTOR
PRCINT,1,,K1
/COM
/COM >>> MODE 2 STRESS INTENSITY FACTOR
PRCINT,1,,K2
/COM
/COM CRACK_TIP_2
/COM >>> MODE 1 STRESS INTENSITY FACTOR
PRCINT,2,,K1
/COM
/COM >>> MODE 2 STRESS INTENSITY FACTOR
PRCINT,2,,K2
/COM

*GET,MAXNODE,CINT,1,NNOD

*GET,NODEID_LEFT,CINT,1,NODE,1

*GET,A1,CINT,1,CTIP,NODEID_LEFT,,2,,K1
*GET,A2,CINT,1,CTIP,NODEID_LEFT,,3,,K1
*GET,A3,CINT,1,CTIP,NODEID_LEFT,,4,,K1
*GET,A4,CINT,1,CTIP,NODEID_LEFT,,5,,K1
*GET,A5,CINT,1,CTIP,NODEID_LEFT,,6,,K1

*GET,B1,CINT,1,CTIP,NODEID_LEFT,,2,,K2
*GET,B2,CINT,1,CTIP,NODEID_LEFT,,3,,K2
*GET,B3,CINT,1,CTIP,NODEID_LEFT,,4,,K2
*GET,B4,CINT,1,CTIP,NODEID_LEFT,,5,,K2
*GET,B5,CINT,1,CTIP,NODEID_LEFT,,6,,K2

*GET,MAXNODE,CINT,2,NNOD

*GET,NODEID_RIGHT,CINT,2,NODE,1

*GET,C1,CINT,2,CTIP,NODEID_RIGHT,,2,,K1
*GET,C2,CINT,2,CTIP,NODEID_RIGHT,,3,,K1
*GET,C3,CINT,2,CTIP,NODEID_RIGHT,,4,,K1
*GET,C4,CINT,2,CTIP,NODEID_RIGHT,,5,,K1
*GET,C5,CINT,2,CTIP,NODEID_RIGHT,,6,,K1

*GET,D1,CINT,2,CTIP,NODEID_RIGHT,,2,,K2
*GET,D2,CINT,2,CTIP,NODEID_RIGHT,,3,,K2
*GET,D3,CINT,2,CTIP,NODEID_RIGHT,,4,,K2
*GET,D4,CINT,2,CTIP,NODEID_RIGHT,,5,,K2
*GET,D5,CINT,2,CTIP,NODEID_RIGHT,,6,,K2


K1_REF = 0.940
K2_REF = 0.543
K1_LEFT =(ABS(A1)+ABS(A2)+ABS(A3)+ABS(A4)+ABS(A5))/5
K2_LEFT =(ABS(B1)+ABS(B2)+ABS(B3)+ABS(B4)+ABS(B5))/5
K1_RIGHT =(ABS(C1)+ABS(C2)+ABS(C3)+ABS(C4)+ABS(C5))/5
K2_RIGHT =(ABS(D1)+ABS(D2)+ABS(D3)+ABS(D4)+ABS(D5))/5
PARSAV,ALL,CASE2,PARM
FINISH
/CLEAR,NOSTART

/OUT,SCRATCH
/COM, ---------------------------------------------
/COM,  VM193C -- SOLVING FOR THETA= 45 DEGREES
/COM, ---------------------------------------------

/PREP7

_GEOMGEN=0          ! SET THIS TO 1 TO GENERATE CDB FILE
_EXIT=0             ! SET THIS TO 1 TO EXIT WITHOUT SOLVING

*IF,_GEOMGEN,EQ,1,THEN

ALPHA=45				!--- ANGLE
PI=ACOS(-1)

ET,1,PLANE182

!CONTINUUM MATERIAL BEHAVIOR
MP, EX,   1, 100
MP, NUXY,  1, 0.3
MP, DENS, 1, 1.0

WPSTYLE,,,,,,,,1
WPROTA,ALPHA,,
CSWPLA,11,0

!DEFINE AREA

RECTNG,-2,2,-2,2

CSYS,0
K,5,  -5,     -5
K,6,   5,     -5
K,7,   5,      5
K,8,  -5,      5   
A,5,6,7,8
AOVLAP,ALL

! SET UP THE MESHING SIZE
XNUME=79   ! NUMBER OF ELEMENTS IN X,  WHICH SHOULD BE ODD 
YNUME=79    ! NUMBER OF ELEMENTS IN Y , WHICH SHOULD BE ODD
LSEL,S,LINE,,1,3,2
LESIZE,ALL, , ,XNUME, , , , ,1
LSEL,S,LINE,,2,4,2
LESIZE,ALL, , ,YNUME, , , , ,1

AMESH,1
ESIZE,0.5
AMESH,3

! ELEMENT COMPONENT REQUIRED FOR XFENRICH COMMAND
ESEL, S, CENT, Y, -2,2
CM, TESTCMP, ELEM
ALLSEL

!
!DEFINE ENRICHMENT IDENTIFICATION
!XFENRICH, ID#, EL COMPONENT, MAT ID FOR CZM
!XFDATA,    1,   LSM,EL#,ND#, PHI, PSI(CRACK TIP INDICATOR-NOT USED)
!
! FOLLOWING DATA EXTRACTED FROM PREPROCESSOR IN ANSYS GUI
XFENRICH, ENRICH1, TESTCMP, , SING,0.9
ALLSEL
/COM                    INITIAL CRACK DATA
CSYS,11
XC1 = -0.5
YC1 = 0
XC2 = 0.5
YC2 = 0
NSEL,S,LOC,X,XC1,XC2
ESLN,S,
ESEL, R, CENT, Y, -1E-3, 1E-3

CM, CENELEM, ELEM
NELEM = 100
IEL = 0
PHI = 0.0
PSI = 0.0
*DO, I, 1, NELEM, 1
 IEL = ELNEXT(IEL)
 *IF, IEL, NE, 0, THEN
  *DO, J, 1, 4, 1
    ND = NELEM(IEL,J)
    *IF, NX(ND),LT,0,THEN
    PHI = NY(ND) - YC1
    PSI = -(NX(ND) - XC1)	
    XFDATA, ENRICH1, LSM, IEL, ND, PHI, PSI
    *ELSEIF,NX(ND),GT,0,THEN
    PHI = NY(ND) - YC2
    PSI = NX(ND) - XC2
    XFDATA, ENRICH1, LSM, IEL, ND, PHI, PSI
   *ENDIF
  *ENDDO
 *ENDIF
*ENDDO 
XFLIST
ALLSEL,ALL

CSYS,0 
! CRK TIP ELEMENT
ESEL,S,ELEM,,3111
CM, CRKTIPELEM1, ELEM
ALLSEL,ALL

ESEL,S,ELEM,,3131
CM, CRKTIPELEM2, ELEM
ALLSEL,ALL

NSEL,S,LOC,X,-5
NSEL,R,LOC,Y,0
D,ALL,UX,0
D,ALL,UY,0
ALLSEL

NSEL,S,LOC,X,5
NSEL,R,LOC,Y,0
D,ALL,UY,0
ALLSEL

!B.C. - BOTTOM FACE
NSEL, S, LOC, Y, -5.0
SF, ALL, PRES, -1
ALLSEL

!B.C. - TOP FACE
NSEL, S, LOC, Y, 5.0
SF, ALL, PRES, -1
ALLSEL

WPSTYLE,,,,,,,,1
WPROTA,ALPHA+180,,
CSWPLA,12,0
WPROTA,-(ALPHA+180),,

CSYS,0
FINISH

CDWRITE,DB,VM193C,CDB

*IF,_EXIT,EQ,1,THEN
*ENDIF

*ELSE

/PREP7 
   CDREAD,DB,VM193C,CDB
*ENDIF
FINISH

/SOLUTION
ANTYPE,0
TIME, 1.0
NSUBST,4
OUTRES,ALL, ALL

!CINT CALCULATIONS
CINT, NEW, 1
CINT, CXFE, CRKTIPELEM1
CINT, TYPE, SIFS
CINT, NCON, 8
CINT, NORM, 12, 2

CINT, NEW, 2
CINT, CXFE, CRKTIPELEM2
CINT, TYPE, SIFS
CINT, NCON, 8
CINT, NORM, 11, 2
SOLVE
FINISH

/POST1
SET,LAST,LAST
/COM CRACK_TIP_1
/COM >>> MODE 1 STRESS INTENSITY FACTOR
PRCINT,1,,K1
/COM
/COM >>> MODE 2 STRESS INTENSITY FACTOR
PRCINT,1,,K2
/COM
/COM CRACK_TIP_2
/COM >>> MODE 1 STRESS INTENSITY FACTOR
PRCINT,2,,K1
/COM
/COM >>> MODE 2 STRESS INTENSITY FACTOR
PRCINT,2,,K2
/COM
*GET,MAXNODE,CINT,1,NNOD

*GET,NODEID_LEFT,CINT,1,NODE,1

*GET,A1,CINT,1,CTIP,NODEID_LEFT,,2,,K1
*GET,A2,CINT,1,CTIP,NODEID_LEFT,,3,,K1
*GET,A3,CINT,1,CTIP,NODEID_LEFT,,4,,K1
*GET,A4,CINT,1,CTIP,NODEID_LEFT,,5,,K1
*GET,A5,CINT,1,CTIP,NODEID_LEFT,,6,,K1

*GET,B1,CINT,1,CTIP,NODEID_LEFT,,2,,K2
*GET,B2,CINT,1,CTIP,NODEID_LEFT,,3,,K2
*GET,B3,CINT,1,CTIP,NODEID_LEFT,,4,,K2
*GET,B4,CINT,1,CTIP,NODEID_LEFT,,5,,K2
*GET,B5,CINT,1,CTIP,NODEID_LEFT,,6,,K2

*GET,MAXNODE,CINT,2,NNOD

*GET,NODEID_RIGHT,CINT,2,NODE,1

*GET,C1,CINT,2,CTIP,NODEID_RIGHT,,2,,K1
*GET,C2,CINT,2,CTIP,NODEID_RIGHT,,3,,K1
*GET,C3,CINT,2,CTIP,NODEID_RIGHT,,4,,K1
*GET,C4,CINT,2,CTIP,NODEID_RIGHT,,5,,K1
*GET,C5,CINT,2,CTIP,NODEID_RIGHT,,6,,K1

*GET,D1,CINT,2,CTIP,NODEID_RIGHT,,2,,K2
*GET,D2,CINT,2,CTIP,NODEID_RIGHT,,3,,K2
*GET,D3,CINT,2,CTIP,NODEID_RIGHT,,4,,K2
*GET,D4,CINT,2,CTIP,NODEID_RIGHT,,5,,K2
*GET,D5,CINT,2,CTIP,NODEID_RIGHT,,6,,K2

K1_REF = 0.627
K2_REF = 0.627
K1_LEFT =(ABS(A1)+ABS(A2)+ABS(A3)+ABS(A4)+ABS(A5))/5
K2_LEFT =(ABS(B1)+ABS(B2)+ABS(B3)+ABS(B4)+ABS(B5))/5
K1_RIGHT =(ABS(C1)+ABS(C2)+ABS(C3)+ABS(C4)+ABS(C5))/5
K2_RIGHT =(ABS(D1)+ABS(D2)+ABS(D3)+ABS(D4)+ABS(D5))/5
PARSAV,ALL,CASE3,PARM
FINISH
/CLEAR,NOSTART

/OUT,SCRATCH
/COM, ---------------------------------------------
/COM,  VM193D -- SOLVING FOR THETA= 60 DEGREES
/COM, ---------------------------------------------

/PREP7

_GEOMGEN=0          ! SET THIS TO 1 TO GENERATE CDB FILE
_EXIT=0             ! SET THIS TO 1 TO EXIT WITHOUT SOLVING

*IF,_GEOMGEN,EQ,1,THEN


ALPHA=60				!--- ANGLE
PI=ACOS(-1)

ET,1,PLANE182

!CONTINUUM MATERIAL BEHAVIOR
MP, EX,   1, 100
MP, NUXY,  1, 0.3
MP, DENS, 1, 1.0

WPSTYLE,,,,,,,,1
WPROTA,ALPHA,,
CSWPLA,11,0

!DEFINE AREA

RECTNG,-2,2,-2,2

CSYS,0
K,5,  -5,     -5
K,6,   5,     -5
K,7,   5,      5
K,8,  -5,      5   
A,5,6,7,8
AOVLAP,ALL

! SET UP THE MESHING SIZE
XNUME=79   ! NUMBER OF ELEMENTS IN X,  WHICH SHOULD BE ODD 
YNUME=79    ! NUMBER OF ELEMENTS IN Y , WHICH SHOULD BE ODD
LSEL,S,LINE,,1,3,2
LESIZE,ALL, , ,XNUME, , , , ,1
LSEL,S,LINE,,2,4,2
LESIZE,ALL, , ,YNUME, , , , ,1

AMESH,1
ESIZE,0.5
AMESH,3

! ELEMENT COMPONENT REQUIRED FOR XFENRICH COMMAND
ESEL, S, CENT, Y, -2,2
CM, TESTCMP, ELEM
ALLSEL

!
!DEFINE ENRICHMENT IDENTIFICATION
!XFENRICH, ID#, EL COMPONENT, MAT ID FOR CZM
!XFDATA,    1,   LSM,EL#,ND#, PHI, PSI(CRACK TIP INDICATOR-NOT USED)
!
! FOLLOWING DATA EXTRACTED FROM PREPROCESSOR IN ANSYS GUI
XFENRICH, ENRICH1, TESTCMP, , SING,0.9
ALLSEL
/COM                    INITIAL CRACK DATA
CSYS,11
XC1 = -0.5
YC1 = 0
XC2 = 0.5
YC2 = 0
NSEL,S,LOC,X,XC1,XC2
ESLN,S,
ESEL, R, CENT, Y, -1E-3, 1E-3

CM, CENELEM, ELEM
NELEM = 100
IEL = 0
PHI = 0.0
PSI = 0.0
*DO, I, 1, NELEM, 1
 IEL = ELNEXT(IEL)
 *IF, IEL, NE, 0, THEN
  *DO, J, 1, 4, 1
    ND = NELEM(IEL,J)
    *IF, NX(ND),LT,0,THEN
    PHI = NY(ND) - YC1
    PSI = -(NX(ND) - XC1)	
    XFDATA, ENRICH1, LSM, IEL, ND, PHI, PSI
    *ELSEIF,NX(ND),GT,0,THEN
    PHI = NY(ND) - YC2
    PSI = NX(ND) - XC2
    XFDATA, ENRICH1, LSM, IEL, ND, PHI, PSI
   *ENDIF
  *ENDDO
 *ENDIF
*ENDDO 
XFLIST
ALLSEL,ALL

CSYS,0 
! CRK TIP ELEMENT
ESEL,S,ELEM,,3111
CM, CRKTIPELEM1, ELEM
ALLSEL,ALL

ESEL,S,ELEM,,3131
CM, CRKTIPELEM2, ELEM
ALLSEL,ALL

NSEL,S,LOC,X,-5
NSEL,R,LOC,Y,0
D,ALL,UX,0
D,ALL,UY,0
ALLSEL

NSEL,S,LOC,X,5
NSEL,R,LOC,Y,0
D,ALL,UY,0
ALLSEL

!B.C. - BOTTOM FACE
NSEL, S, LOC, Y, -5.0
SF, ALL, PRES, -1
ALLSEL

!B.C. - TOP FACE
NSEL, S, LOC, Y, 5.0
SF, ALL, PRES, -1
ALLSEL

WPSTYLE,,,,,,,,1
WPROTA,ALPHA+180,,
CSWPLA,12,0
WPROTA,-(ALPHA+180),,
CSYS,0
FINISH
CDWRITE,DB,VM193D,CDB

*IF,_EXIT,EQ,1,THEN
*ENDIF

*ELSE

/PREP7 
   CDREAD,DB,VM193D,CDB
*ENDIF
FINI

/SOLU
ANTYPE,0
TIME, 1.0
NSUBST,4
OUTRES,ALL, ALL

!CINT CALCULATIONS
CINT, NEW, 1
CINT, CXFE, CRKTIPELEM1
CINT, TYPE, SIFS
CINT, NCON, 8
CINT, NORM, 12, 2

CINT, NEW, 2
CINT, CXFE, CRKTIPELEM2
CINT, TYPE, SIFS
CINT, NCON, 8
CINT, NORM, 11, 2

SOLVE
FINISH

/POST1
SET,LAST,LAST
/COM CRACK_TIP_1
/COM >>> MODE 1 STRESS INTENSITY FACTOR
PRCINT,1,,K1
/COM
/COM >>> MODE 2 STRESS INTENSITY FACTOR
PRCINT,1,,K2
/COM

/COM CRACK_TIP_2
/COM >>> MODE 1 STRESS INTENSITY FACTOR
PRCINT,2,,K1
/COM
/COM >>> MODE 2 STRESS INTENSITY FACTOR
PRCINT,2,,K2
/COM

*GET,MAXNODE,CINT,1,NNOD

*GET,NODEID_LEFT,CINT,1,NODE,1

*GET,A1,CINT,1,CTIP,NODEID_LEFT,,2,,K1
*GET,A2,CINT,1,CTIP,NODEID_LEFT,,3,,K1
*GET,A3,CINT,1,CTIP,NODEID_LEFT,,4,,K1
*GET,A4,CINT,1,CTIP,NODEID_LEFT,,5,,K1
*GET,A5,CINT,1,CTIP,NODEID_LEFT,,6,,K1

*GET,B1,CINT,1,CTIP,NODEID_LEFT,,2,,K2
*GET,B2,CINT,1,CTIP,NODEID_LEFT,,3,,K2
*GET,B3,CINT,1,CTIP,NODEID_LEFT,,4,,K2
*GET,B4,CINT,1,CTIP,NODEID_LEFT,,5,,K2
*GET,B5,CINT,1,CTIP,NODEID_LEFT,,6,,K2

*GET,MAXNODE,CINT,2,NNOD

*GET,NODEID_RIGHT,CINT,2,NODE,1

*GET,C1,CINT,2,CTIP,NODEID_RIGHT,,2,,K1
*GET,C2,CINT,2,CTIP,NODEID_RIGHT,,3,,K1
*GET,C3,CINT,2,CTIP,NODEID_RIGHT,,4,,K1
*GET,C4,CINT,2,CTIP,NODEID_RIGHT,,5,,K1
*GET,C5,CINT,2,CTIP,NODEID_RIGHT,,6,,K1

*GET,D1,CINT,2,CTIP,NODEID_RIGHT,,2,,K2
*GET,D2,CINT,2,CTIP,NODEID_RIGHT,,3,,K2
*GET,D3,CINT,2,CTIP,NODEID_RIGHT,,4,,K2
*GET,D4,CINT,2,CTIP,NODEID_RIGHT,,5,,K2
*GET,D5,CINT,2,CTIP,NODEID_RIGHT,,6,,K2

K1_REF = 0.313
K2_REF = 0.543
K1_LEFT =(ABS(A1)+ABS(A2)+ABS(A3)+ABS(A4)+ABS(A5))/5
K2_LEFT =(ABS(B1)+ABS(B2)+ABS(B3)+ABS(B4)+ABS(B5))/5
K1_RIGHT =(ABS(C1)+ABS(C2)+ABS(C3)+ABS(C4)+ABS(C5))/5
K2_RIGHT =(ABS(D1)+ABS(D2)+ABS(D3)+ABS(D4)+ABS(D5))/5
PARSAV,ALL,CASE4,PARM
FINISH
/CLEAR,NOSTART

PARRES,NEW,CASE1,PARM
/COM,
/OUT,vm193,vrt
/COM,
/COM,------------ VM193 RESULTS COMPARISON --------------
/COM,
/COM,          |  TARGET   |   MECHANICAL APDL  |   RATIO
/COM,
/COM, -------------------------------------
/COM,  THETA = 0 DEGREES
/COM, -------------------------------------
/COM,
/COM,  STRESS INTENSITY FOR MODE 1 FRACTURE
/COM,
*VWRITE,'KI',K1_REF,K1_LEFT,K1_LEFT/K1_REF
(1X,A8,'   ',F14.3,'  ',F14.3,'   ',F15.3)
*VWRITE,'KI',K1_REF,K1_RIGHT,K1_RIGHT/K1_REF
(1X,A8,'   ',F14.3,'  ',F14.3,'   ',F15.3)
/COM,
/COM,
/COM,  STRESS INTENSITY FOR MODE 2 FRACTURE
/COM,
*VWRITE,'KII',K2_REF,K2_LEFT
(1X,A8,'   ',F14.3,'  ',F14.3)
*VWRITE,'KII',K2_REF,K2_RIGHT
(1X,A8,'   ',F14.3,'  ',F14.3)
/COM,
/NOPR
PARRES,NEW,CASE2,PARM
/GOPR
/COM, -------------------------------------
/COM,  THETA = 30 DEGREES
/COM, -------------------------------------
/COM,
/COM,
/COM,  STRESS INTENSITY FOR MODE 1 FRACTURE
/COM,
*VWRITE,'KI',K1_REF,K1_LEFT,K1_LEFT/K1_REF
(1X,A8,'   ',F14.3,'  ',F14.3,'   ',F15.3)
*VWRITE,'KI',K1_REF,K1_RIGHT,K1_RIGHT/K1_REF
(1X,A8,'   ',F14.3,'  ',F14.3,'   ',F15.3)
/COM,
/COM,
/COM,  STRESS INTENSITY FOR MODE 2 FRACTURE
/COM,
*VWRITE,'KII',K2_REF,K2_LEFT,K2_LEFT/K2_REF
(1X,A8,'   ',F14.3,'  ',F14.3,'   ',F15.3)
*VWRITE,'KII',K2_REF,K2_RIGHT,K2_RIGHT/K2_REF
(1X,A8,'   ',F14.3,'  ',F14.3,'   ',F15.3)
/COM,
/NOPR
PARRES,NEW,CASE3,PARM
/GOPR
/COM, -------------------------------------
/COM,  THETA = 45 DEGREES
/COM, -------------------------------------
/COM,
/COM,
/COM,  STRESS INTENSITY FOR MODE 1 FRACTURE
/COM,
*VWRITE,'KI',K1_REF,K1_LEFT,K1_LEFT/K1_REF
(1X,A8,'   ',F14.3,'  ',F14.3,'   ',F15.3)
*VWRITE,'KI',K1_REF,K1_RIGHT,K1_RIGHT/K1_REF
(1X,A8,'   ',F14.3,'  ',F14.3,'   ',F15.3)
/COM,
/COM,
/COM,  STRESS INTENSITY FOR MODE 2 FRACTURE
/COM,
*VWRITE,'KII',K2_REF,K2_LEFT,K2_LEFT/K2_REF
(1X,A8,'   ',F14.3,'  ',F14.3,'   ',F15.3)
*VWRITE,'KII',K2_REF,K2_RIGHT,K2_RIGHT/K2_REF
(1X,A8,'   ',F14.3,'  ',F14.3,'   ',F15.3)
/COM,
/NOPR
PARRES,NEW,CASE4,PARM
/GOPR
/COM, -------------------------------------
/COM,  THETA = 60 DEGREES
/COM, -------------------------------------
/COM,
/COM,
/COM,  STRESS INTENSITY FOR MODE 1 FRACTURE
/COM,
*VWRITE,'KI',K1_REF,K1_LEFT,K1_LEFT/K1_REF
(1X,A8,'   ',F14.3,'  ',F14.3,'   ',F15.3)
*VWRITE,'KI',K1_REF,K1_RIGHT,K1_RIGHT/K1_REF
(1X,A8,'   ',F14.3,'  ',F14.3,'   ',F15.3)
/COM,
/COM,
/COM,  STRESS INTENSITY FOR MODE 2 FRACTURE
/COM,
*VWRITE,'KII',K2_REF,K2_LEFT,K2_LEFT/K2_REF
(1X,A8,'   ',F14.3,'  ',F14.3,'   ',F15.3)
*VWRITE,'KII',K2_REF,K2_RIGHT,K2_RIGHT/K2_REF
(1X,A8,'   ',F14.3,'  ',F14.3,'   ',F15.3)
/COM,
/COM,
/COM, --------------------------------------------------------
/OUT,
*LIST,vm193,vrt
FINISH