!*************************************************************************************!
! TITLE: CFVR3401 - Dupuit problem
! 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.
! 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='CFVR3401'
  /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,0,10
  K,3,10,0
  K,4,10,3
  K,5,10,10

! Lines
  L,1,2
  L,3,4
  L,4,5
  L,1,3

! Water Table
  X1     =  0      ! X initial point
  Y1     = 10      ! Y initial point
  Z1     =  0      ! Z initial point
  X2     = 10      ! X end point
  Y2     =  4      ! Y end point
  Z2     =  0      ! Z end point
  NPOINTS= 12      ! Number of points dividing line
  Line1  =  1      ! 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,EXIT

! Finite element Model
  MAT   = 1
  ESIZE =  0.8
  L1    = 1
  L2    = 2
  L3    = 3
  L4    = 4
  ~SEEPMOD,ADD,MAT ,WT ,ESIZE,L1 ,L2 ,L3 ,L4

 ! Solution
 ! --------------------------------------------------
 ! Displacements
  /SOLU
  ~DLSEEP,ADD,4
  ~DLHEAD,ADD,2,4
  ~DLHEAD,ADD,3,4
  ~DLHEAD,ADD,1,10

  ~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

! 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'

ksel,s,kp,,6,18
nslk,s
*do,ik,6,18
  ksel,s,kp,,ik
  nslk,s
  ii = ik-5
  ! Geometric heights
  VALUE(ii,2)=ky(ik)
  ! Piezometric heights
  *get,VALUE(ii,1),node,ndnext(0),head
*enddo

! Warning and error tolerances
  *DO,II,1,13
    TOLER(II, 1)= 0.2
    TOLER(II, 2)= 0.2
  *ENDDO

!--------------------------------------------------------------------------------------
! Results Comparison
!--------------------------------------------------------------------------------------
  COMPARA.MAC
