! APDL source code for solving plate with a drilled hole in tension

*CFOPEN,TIMER,txt			! opens the TIMER.txt file for timekeeping
*GET,TIME_BEFORE,active,,time,wall  	! gets current time
*VWRITE,TIME_BEFORE			! writes the time value to the file
%G					! format specifier
*CFCLOS					! closes the TIMER.txt file

! GENERATION PASS

/FILNAME,GEN1				! GEN1 filename
/PREP7					! preprocessor
/INPUT,super_material_properties,txt	! material properties of the superelement
/INPUT,super1_geo,txt			! read in geometry from super1_geo.txt file
FINISH					! end preprocessor mode
/SOLU					! enter solution mode
ANTYPE,SUBSTR				! specify substructuring analysis type
SEOPT,GEN1,1,1,0			! specification of substructure analysis options
/INPUT,super1_m,txt			! read in master nodes from super1_m.txt
SAVE					! save GEN1.DB
SOLVE					! create stiffness matrix ?and load vector? and save it as GEN1.SUB {load step 1}
FINISH					! leave solution mode

/CLEAR					! clear the database
/FILNAME,GEN2				! GEN2 filename
/PREP7					! preprocessor
/INPUT,super_material_properties,txt	! material properties of the superelement
/INPUT,super2_geo,txt			! read in geometry from super2_geo.txt
FINISH					! end preprocessor mode
/SOLU					! entersolution mode
ANTYPE,SUBSTR				! specify substructuring analysis type
SEOPT,GEN2,1,1,0			! specification of substructure analysis options
/INPUT,super2_m,txt			! read in master nodes from super2_m.txt
SAVE					! save GEN2.DB
SOLVE					! create stiffness matrix ?and load vector? and save it as GEN2.SUB
FINISH					! leave solution mode

/CLEAR					! clear the database
/FILNAME,GEN3				! GEN3 filename
/PREP7					! preprocessor
/INPUT,super_material_properties,txt	! material properties of the superelement
/INPUT,super3_geo,txt			! read in geometry from super3_geo.txt
FINISH					! end preprocessor mode
/SOLU					! entersolution mode
ANTYPE,SUBSTR				! specify substructuring analysis type
SEOPT,GEN3,1,1,0			! specification of substructure analysis options
/INPUT,super3_m,txt			! read in master nodes from super3_m.txt
SAVE					! save GEN3.DB
SOLVE					! create stiffness matrix ?and load vector? and save it as GEN3.SUB
FINISH					! leave solution mode

/CLEAR					! clear the database
/FILNAME,GEN4				! GEN4 filename
/PREP7					! preprocessor
/INPUT,super_material_properties,txt	! material properties of the superelement
/INPUT,super4_geo,txt			! read in geometry from super4_geo.txt
FINISH					! end preprocessor mode
/SOLU					! entersolution mode
ANTYPE,SUBSTR				! specify substructuring analysis type
SEOPT,GEN4,1,1,0			! specification of substructure analysis options
/INPUT,super4_m,txt			! read in master nodes from super4_m.txt
SAVE					! save GEN4.DB
SOLVE					! create stiffness matrix ?and load vector? and save it as GEN4.SUB
FINISH					! leave solution mode

! USE PASS

/CLEAR					! clear the database
/FILNAME,USE				! USE filename
/PREP7					! enter preprocessor
ET,2,MATRIX50				! superelement type

TYPE,2					! point MATRIX50 as the element type for reading in the superelement
SE,GEN1					! defines a superelement from GEN1.SUB

TYPE,2					! point MATRIX50 as the element type for reading in the superelement
SE,GEN2					! defines a superelement form GEN2.SUB

TYPE,2					! point MATRIX50 as the element type for reading in the superelement
SE,GEN3					! defines a superelement form GEN3.SUB

TYPE,2					! point MATRIX50 as the element type for reading in the superelement
SE,GEN4					! defines a superelement form GEN4.SUB

EPLOT					! plots the element for checkup

SAVE					! save USE.DB
FINISH					! leave preprocessor mode

/SOLU					! enter solution mode
ANTYPE,STATIC				! specify substructuring analysis type

/INPUT,super1_m,txt			! read in master nodes from super1_m.txt
/INPUT,super2_m,txt			! read in master nodes from super2_m.txt
/INPUT,super3_m,txt			! read in master nodes from super3_m.txt
/INPUT,super4_m,txt			! read in master nodes from super4_m.txt
/INPUT,super1_df,txt			! read in supports and forces from super1_df.txt
/INPUT,super2_df,txt			! read in supports and forces from super2_df.txt
/INPUT,super3_df,txt			! read in supports and forces from super3_df.txt
/INPUT,super4_df,txt			! read in supports and forces from super4_df.txt

SOLVE					! calculate master dofs, saved in USE.DSUB

SAVE					! save USE.DB before solution
FINISH					! leave solution mode

! EXPANSION PASS

! superelement 1
/CLEAR					! clear the database
/FILNAME,GEN1				! set Jobname to GEN1
RESUME					! resume the GEN1 database
/SOLU					! enter solution mode
EXPASS,ON				! specify expansion pass of the analysis
SEEXP,GEN1,USE				! specify options for the substructure expansion pass
EXPSOL,1,1,,YES				! specify the solution to be expanded
SOLVE					! full superelement solution written to GEN1.RST
SAVE
FINISH					! leave solution mode

! superelement 2
/CLEAR					! clear the database
/FILNAME,GEN2				! set Jobname to GEN2
RESUME					! resume the GEN2 database
/SOLU					! enter solution mode
EXPASS,ON				! specify expansion pass of the analysis
SEEXP,GEN2,USE				! specify options for the substructure expansion pass
EXPSOL,1,1,,YES				! specify the solution to be expanded
SOLVE					! full superelement solution written to GEN2.RST
SAVE
FINISH					! leave solution mode

! superelement 3
/CLEAR					! clear the database
/FILNAME,GEN3				! set Jobname to GEN3
RESUME					! resume the GEN3 database
/SOLU					! enter solution mode
EXPASS,ON				! specify expansion pass of the analysis
SEEXP,GEN3,USE				! specify options for the substructure expansion pass
EXPSOL,1,1,,YES				! specify the solution to be expanded
SOLVE					! full superelement solution written to GEN3.RST
SAVE
FINISH					! leave solution mode

! superelement 4
/CLEAR					! clear the database
/FILNAME,GEN4				! set Jobname to GEN4
RESUME					! resume the GEN2 database
/SOLU					! enter solution mode
EXPASS,ON				! specify expansion pass of the analysis
SEEXP,GEN4,USE				! specify options for the substructure expansion pass
EXPSOL,1,1,,YES				! specify the solution to be expanded
SOLVE					! full superelement solution written to GEN4.RST
SAVE
FINISH					! leave solution mode

! the end

*CFOPEN,TIMER,txt,,APPEND		! opens the TIMER.txt for timekeeping
*GET,TIME_AFTER,active,,time,wall  	! gets current time
*VWRITE,TIME_AFTER			! writes the time to the file
%G					! format specifier
*CFCLOS					! closes the TIMER.txt file