!*************************************************************************************!
! TITLE: CFVR3403 - Dupuit problem with drain
! SUBTITLE: Dupuit problem to check the saturation line obtained by CivilFEM.
!
! DESCRIPTION: A plane model is used to reproduce the Dupuit problem to check the
! DESCRIPTION: saturation line obtained by CivilFEM. The model has a drain.
! DESCRIPTION:
! DESCRIPTION: The model is made off a single material taken from CivilFEM's
! DESCRIPTION: database (soil SC type):
!
! ELEMENT TYPE: PLANE42
! MODULES: GETC
! UNITS: SI
! KEYWORD1: Geotechnics
! KEYWORD2: Seepage Analysis
!*************************************************************************************!
   FINISH
  ~CFCLEAR,,1
  ~CFACTIV,GETC,Y
  NomFile='CFVR3403'
  /TITLE, %NomFile%, Dupuit problem

! ---------------------------------------------------------------------------------
! Model definition
! ---------------------------------------------------------------------------------
! Activate Seepage Analysis
~SEEPAGE,2D

/PREP7
! Preprocessor
! --------------------------------------------------
! Materials: Soil
  ~CFMP,1,LIB,SOIL,,SC

! Keypoints
  K,1,0,0
  K,2,400,0
  K,3,400,5
  K,4,500,5
  K,5,200,200

! Lines
  L,1,2
  L,2,3
  L,3,4
 	L,1,5

! Water Table
  X1     = 200     ! X initial point
  Y1     = 200     ! Y initial point
  Z1     =   0     ! Z initial point
  X2     = 450     ! X end point
  Y2     =   5     ! Y end point
  Z2     =   0     ! Z end point
  NPOINTS= 12      ! Number of points dividing line
  Line1 =  4      ! Line over first point rest
  Line2 =  3      ! Line over second point rest
	MAT    =  1      ! Material

  ~WATTAB,X1,Y1,Z1,X2,Y2,Z2,MAT,NPOINTS,Line1,Line2,FIXED,DRAIN

! Finite element Model
  MAT   = 1
  ESIZE =  15
  L1    = 1
  L2    = 2
  L3    = 3
  L4    = 4
  ~SEEPMOD,ADD,MAT ,WT ,ESIZE,L1 ,L2 ,L3 ,L4

 ! Solution
 ! --------------------------------------------------
 ! Displacements
  /SOLU
   HEAD1 = 200
   HEAD2 = 0

  ~DLHEAD,add,4,head1
  ~DLHEAD,add,3,head2

  ~WTSOLVE
/post1
  file,file,seep
  set,last

!--------------------------------------------------------------------------------------
! DATA CHECK
!--------------------------------------------------------------------------------------
! Data comparison number

  NComp = 13
  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
  *DIM,POINTS,,13

! Labels
  LABEL(1,1)  = 'POINT 1 '
  LABEL(2,1)  = 'POINT 2 '
  LABEL(3,1)  = 'POINT 3 '
  LABEL(4,1)  = 'POINT 4 '
  LABEL(5,1)  = 'POINT 5 '
  LABEL(6,1)  = 'POINT 6 '
  LABEL(7,1)  = 'POINT 7 '
  LABEL(8,1)  = 'POINT 8 '
  LABEL(9,1)  = 'POINT 9 '
  LABEL(10,1) = 'POINT 10'
  LABEL(11,1) = 'POINT 11'
  LABEL(12,1) = 'POINT 12'
  LABEL(13,1) = 'POINT 13'

! POINTS
  POINTS  (1)  = 5
  POINTS	(2)  = 21
  POINTS	(3)  = 22
  POINTS	(4)  = 23
  POINTS	(5)  = 24
  POINTS	(6)  = 25
  POINTS	(7)  = 26
  POINTS	(8)  = 27
  POINTS	(9)  = 28
  POINTS	(10) = 29
  POINTS	(11) = 30
  POINTS	(12) = 31
  POINTS	(13) = 7

  ksel,s,kp,,5,
  ksel,a,kp,,7
  ksel,a,kp,,21,31
  nslk,s

  *do,ii,1,13
    xx=KX(POINTS(ii))
    yy=KY(POINTS(ii))
    zz=0
    NN=node(xx,yy,zz)
    ! Geometric heights
    VALUE(ii,2)=ky(POINTS(ii))
    ! Piezometric heights
    *get,VALUE(ii,1),node,nn,head
  *enddo

  ! Warning and error tolerances
  *DO,II,1,13
    TOLER(II, 1)= 1.0
    TOLER(II, 2)= 1.0
  *ENDDO

!--------------------------------------------------------------------------------------
! Results Comparison
!--------------------------------------------------------------------------------------
  COMPARA.MAC
