! ----------------------------------------------------------------------
! M11 - English course download: 11_start.mac
! Follow the matching English lesson for explanations and task details.
! Commands, parameter names, file names, CSV keys, and result tokens are preserved.
! ----------------------------------------------------------------------

/CLEAR,START                        ! Complete the TODOs to define the CONTA/TARGE pair and CNCHECK.
/FILNAME,m11_start,1
/TITLE,M11 - Contact starting point
/UNITS,SI

block_x=0.04
block_z=0.04
h_lower=0.02
h_upper=0.02
initial_gap=0.0005
mesh_h=0.01
young=210E9
nu=0.30
n_substeps=10
disp_close=-0.0012
select_tol=mesh_h*1E-4

/PREP7
ET,1,SOLID185
KEYOPT,1,2,0
MP,EX,1,young                       ! ET,2,CONTA174
MP,PRXY,1,nu
R,2
REAL,2
TYPE,1
MAT,1
BLOCK,0,block_x,0,h_lower,0,block_z
BLOCK,0,block_x,h_lower+initial_gap,h_lower+initial_gap+h_upper,0,block_z

div_x=MAX(1,NINT(block_x/mesh_h))
div_y=MAX(1,NINT(h_lower/mesh_h))
div_z=MAX(1,NINT(block_z/mesh_h))
MSHAPE,0,3D
MSHKEY,1
LSEL,S,LENGTH,,block_x
LESIZE,ALL,,,div_x,,1
LSEL,S,LENGTH,,h_lower
LESIZE,ALL,,,div_y,,1
LSEL,S,LENGTH,,block_z
LESIZE,ALL,,,div_z,,1
ALLSEL,ALL
VMESH,ALL

SELTOL,select_tol                   ! ESURF: creates contact/target elements on the selected surface.
NSEL,S,LOC,Y,0
CM,bottom_nodes,NODE
NSEL,S,LOC,Y,h_lower+initial_gap+h_upper
CM,top_nodes,NODE
ALLSEL,ALL
SELTOL,
FINISH

/SOLU
ANTYPE,STATIC
NLGEOM,ON
CMSEL,S,bottom_nodes                ! CNCHECK,AUTO: reviews normals, initial gap, and pair status before SOLVE.
D,ALL,ALL,0
ALLSEL,ALL
CMSEL,S,top_nodes
D,ALL,UY,disp_close
D,ALL,UX,0
D,ALL,UZ,0
ALLSEL,ALL
AUTOTS,OFF
KBC,0
NSUBST,n_substeps
OUTRES,ALL,ALL
SOLVE
FINISH

/COM,Complete the TODOs and compare with 11_contact_pair.mac
FINISH
