!**************************************************************************************************************!
! TITLE: CFVR5231 - Prestressing tendon definition from lines, without a support beam.
! SUBTITLE: Solid model tendon analysis using free tendon capability ~GENTEN command.
!
! DESCRIPTION: A prestressed solid beam  with rectangular section which dimensions are 0.4x0.3m and 8m of 
! DESCRIPTION: length, a table of total additional losses is applied. This test checks that final applied   
! DESCRIPTION: cable tension is equal to initial tension minus total losses at each point.
! DESCRIPTION:
! DESCRIPTION: The final array must give null results for all its components. 
! DESCRIPTION:
!
! ELEMENT TYPE: SOLID45
! MODULES: PRSC
! UNITS: User
! KEYWORD1: Free Tendon
! KEYWORD2: Prestressed Concrete
!
!*************************************************************************************!
FINISH
~CFCLEAR,,1
~CFACTIV,PRSC,Y
NomFile='CFVR5231'
/TITLE, %NomFile%, Solid Model with Free Tendons (~GENTEN TABLE LOSSES)

! -------------------------------------------------------------------------------------
! Initial data
! -------------------------------------------------------------------------------------
~UNITS,,LENG,M  
~UNITS,,TIME,S  
~UNITS,,FORC,KN 
~UNITS,,PRES,,0 ,uuP
~UNITS,,MASS,,0 ,uuM
/VIEW,1,-1  

! Parameters
a = 0.40		! width section (m)
b = 0.30    	! height section (m)
L = 8.00    	! Length beam (m)
IniTen= 340 	! Initial tension (KN)
ESiz= 0.5		! Element Size

/PREP7

! Materials
~CFMP,1,LIB,CONCRETE,EC2,C25/30 
~CFMP,2,LIB,REINF,EC2,S500    
~CFMP,3,LIB,PREST,EHE,Y1860S7   
~CFMP,3,Prest   ,MU      ,,0
~CFMP,3,Prest   ,K       ,,0
~CFMP,3,Prest   ,A       ,,0

! Elements
ET,1,SOLID45 

! GEOMETRY AND MESHING
BLOCK,-a/2,a/2,-b/2,b/2,0,L		
MSHAPE,0,3D 
MSHKEY,1
ESIZE,ESiz,0,
VMESH,ALL

! Boundary conditions
NSEL,S,LOC,Z,0
NSEL,R,LOC,Y,0
D,ALL,UY  

NSEL,S,LOC,Z,L
D,ALL,ALL

! KP & Lines for tendon definition
KSEL,NONE
NUMSTR,KP,1001
K,,  0.00,      0.00,     0.000
K,,  0.00,-0.448E-01,     1.00 
K,,  0.00,-0.762E-01,     2.00 
K,,  0.00,-0.870E-01,     3.00 
K,,  0.00,-0.793E-01,     4.00 
K,,  0.00,-0.561E-01,     5.00 
K,,  0.00,-0.174E-01,     6.00 
K,,  0.00, 0.367E-01,     7.00 
K,,  0.00, 0.870E-01,     8.00 
 
NumKP=9
LSEL,NONE
*DO,JJ,1001,999+NumKP
	L,JJ,JJ+1
*ENDDO	

! Additional losses table: Real length, measured from KPINI=1001
table_loss=
*DIM,table_loss,TABLE,NumKP
table_loss(1,0)=  0.100,   1.00,   2.00,   3.00,   4.00,   5.00,   6.00,   7.00,   8.00
table_loss(1,1)=  120.0,  115.0,  110.0,  105.0,  103.0,  109.0,  113.0,  117.0, 124.0

FINISH
/SOLU

~GENTEN,  1,  IniTen, 1001, 1 , 3, 1, 2,table_loss, 2

TENSIONINI=
*DIM,TENSIONINI,ARRAY,25  ! Initial tension matrix
TENSIONCOMP=
*DIM,TENSIONCOMP,ARRAY,25  ! Comparison final tension matrix
TENSIONDIFF=
*DIM,TENSIONDIFF,ARRAY,25  ! Final tension difference matrix
*VFILL,TENSIONINI(1),RAMP, IniTen,0
*VOPER,TENSIONCOMP(1) ,TENSIONINI(1) ,SUB, ADD_LOSSES_1(1)
*VOPER,TENSIONDIFF(1) ,TENSIONCABLE_1(1) ,SUB, TENSIONCOMP(1)

!--------------------------------------------------------------------------------------
! DATA CHECK
!--------------------------------------------------------------------------------------
! Data comparison number
  NComp    = 25
  NComp_ch = 0

! Marix 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
!--------------------------------------------------------------------------------------
  *DO,JJ,1,25
	LABEL( JJ)= ' T%JJ%'
  *ENDDO

! Correct data, obtained data
!--------------------------------------------------------------------------------------
  *DO,JJ,1,25
	VALUE( JJ,1)= TENSIONCOMP(JJ)
	VALUE( JJ,2)= TENSIONCABLE_1(JJ)
  *ENDDO    

! Warning and error tolerances
  *DO,II,1,25
    TOLER(II,1)  = 1E-02
    TOLER(II,2)  = 1E-02
  *ENDDO 

!--------------------------------------------------------------------------------------
! Result comparison
!--------------------------------------------------------------------------------------
  COMPARA.MAC


