!***********************************************************************!
! TITLE: CFVR3303 - Retaining Wall 2D Geometry checking
! SUBTITLE: Retaining wall depth + anchorages length checking
!
! DESCRIPTION: This example test the geometry of the model generated with
! DESCRIPTION: the Retaining Wall tool in Geotechnial Module, comparing
! DESCRIPTION: the size of the model with the variables introduced.
! DESCRIPTION:
! DESCRIPTION: The example loads the test model which creates the following structural materials:
! DESCRIPTION:
! DESCRIPTION: - C40/50 concrete for the wall.
! DESCRIPTION:
! DESCRIPTION: - S400 steel for the reinforcement and anchorages.
! DESCRIPTION:
! DESCRIPTION: - Fe 430 steel for the anchorages shapes.
! DESCRIPTION:
! DESCRIPTION: The terrain is defined with four layers:
! DESCRIPTION:
! DESCRIPTION: - Layer 1: Sand Well Graded. 2 m thickness.
! DESCRIPTION:
! DESCRIPTION: - Layer 2: Gravel Well Graded. 8 m thickness.
! DESCRIPTION:
! DESCRIPTION: - Layer 3: Diorite. 5 m thickness.
! DESCRIPTION:
! DESCRIPTION: - Layer 4: Sand. 6 m thickness.
! DESCRIPTION:
! DESCRIPTION: The wall is 0.9 m thick.
! DESCRIPTION:
! DESCRIPTION: The construction process is defined as follows:
! DESCRIPTION:
! DESCRIPTION: - Step 1: Terrain is excavated to level 1000m.
! DESCRIPTION:
! DESCRIPTION: - Step 2: Terrain is excavated to level 999m.
! DESCRIPTION:
! DESCRIPTION: - Step 3: Terrain is excavated to level 998m. An anchorage is 
! DESCRIPTION: placed at level 998,5m.
! DESCRIPTION:
! DESCRIPTION: - Step 4: Terrain is excavated to level 997m.
! DESCRIPTION:
! DESCRIPTION: - Step 5: Terrain is excavated to level 996m.
! DESCRIPTION:
! DESCRIPTION: - Step 6: Terrain is excavated to level 995m.
! DESCRIPTION:
! DESCRIPTION: - Step 7: Terrain is excavated to level 994m.
! DESCRIPTION:
! DESCRIPTION: - Step 8: Terrain is excavated to level 993m.
! DESCRIPTION:
! DESCRIPTION: - Step 9: Terrain is excavated to level 992m.
! DESCRIPTION:
! DESCRIPTION: - Step 10: Terrain is excavated to level 991m. An anchorage is 
! DESCRIPTION: placed at level 991,5m.
! DESCRIPTION:
! DESCRIPTION: - Step 11: Terrain is excavated to level 990m.
! DESCRIPTION:
! ELEMENT TYPE: PLANE182, BEAM3, LINK8, TARGE169, CONTA171
! MODULES: GETC
! UNITS: SI
! KEYWORD1: Retaining Walls
!
!***********************************************************************!
 FINISH
 ~CFCLEAR,,1
 ~CFACTIV,GETC,Y
 NomFile='CFVR3303'
 /TITLE, %NomFile%, Retaining Wall 2D Geometry checking

!------------------------------------------------------------------------
! Initial data
!------------------------------------------------------------------------
/PREP7
~RTNWGUI,Test2D

!------------------------------------------------------------------------
! DATA CHECK
!------------------------------------------------------------------------
! Data comparison number
  Ncomp    =  3
  Ncomp_ch =  0

! Matrix dim.
  *DIM,LABEL,CHAR,Ncomp,1
  *DIM,LABEL_CH,CHAR,Ncomp_ch,1
  *DIM,VALUE,,Ncomp,3
  *DIM,VALUE_CH,CHAR,Ncomp_ch,3
  *DIM,TOLER,,Ncomp,2

! Labels
!------------------------------------------------------------------------
  LABEL(1,1) = 'ANCH'
  LABEL(2,1) = 'DEPTH'
  LABEL(3,1) = 'STRET'

! Obtained values
!------------------------------------------------------------------------
ESEL,S,TYPE,,3
*GET,NESEL3,ELEM,,COUNT
IE = 0
mlengthAnchorage = 0
*DO,I,1,NESEL3
  IE = ELNEXT(IE)
  IE1 = NELEM(IE,1)
  IE2 = NELEM(IE,2)
  mlengthAnchorage = DISTND(IE1,IE2) + mlengthAnchorage
*ENDDO
ESEL,S,TYPE,,2
*GET,NESEL2,ELEM,,COUNT
IE = 0
mretainingWallDepth = 0
*DO,I,1,NESEL2
  IE = ELNEXT(IE)
  IE1 = NELEM(IE,1)
  IE2 = NELEM(IE,2)
  mretainingWallDepth = DISTND(IE1,IE2) + mretainingWallDepth
*ENDDO
ALLSEL
*GET,maxX,NODE,0,MXLOC,X
*GET,minX,NODE,0,MNLOC,X
mstretch = maxX - minX
/IMAGE,SAVE,%NomFIle%,BMP

  VALUE(1,2) = mlengthAnchorage
  VALUE(2,2) = mretainingWallDepth
  VALUE(3,2) = mstretch

! Correct values
!------------------------------------------------------------------------
  VALUE(1,1)=10		!Length of the anchorage
  VALUE(2,1)=9.5	!Depth of the terrain
  VALUE(3,1)=18         !Stretch length

! Warning and error tolerances
  TOLER( 1, 1)= 1E-2  $ TOLER( 1, 2)= 1E-2
  TOLER( 2, 1)= 1E-2  $ TOLER( 2, 2)= 1E-2
  TOLER( 3, 1)= 1E-2  $ TOLER( 3, 2)= 1E-2

!------------------------------------------------------------------------
! Results comparison
!------------------------------------------------------------------------
  COMPARA.MAC
