!*************************************************************************************!
! TITLE: CFVR5204 - Support beam consecutive SOLVE
! SUBTITLE:
!
! DESCRIPTION: A prestressed beam is subjected to several load states.
! DESCRIPTION: The model is a fixed-pinned beam of 15 m length.
! DESCRIPTION:
! DESCRIPTION: The beam is made of C16/20 concrete.
! DESCRIPTION:
! DESCRIPTION: The cross section is a rectangular concrete one, 1 x 0.5, which has top and bottom
! DESCRIPTION: reinforcement of S400 steel, with 40 mm for geometrical cover and 28 mm of diameter.
! DESCRIPTION:
! DESCRIPTION: The load states are:
! DESCRIPTION:
! DESCRIPTION: - Load state 1: Self weight
! DESCRIPTION:
! DESCRIPTION: - Load state 2: Prestressing forces
! DESCRIPTION:
! DESCRIPTION: - Load state 3: Self weight and Prestressing forces
! DESCRIPTION:
! DESCRIPTION: - Load state 4: Self weight + Modified Prestressing
! DESCRIPTION:
! DESCRIPTION: - Load state 5: Self weight + Modified Prestressing and tendon removed
! DESCRIPTION:
! DESCRIPTION: The aim of the example is to solve with the support beam several times.
!
! ELEMENT TYPE: BEAM44
! MODULES: PRSC
! UNITS: SI
! KEYWORD1: Beam
! KEYWORD2: Tendon
! KEYWORD3: Cross Section
! KEYWORD4: Prestressed Concrete
!
!*************************************************************************************!
   FINISH
   ~CFCLEAR,,1
   NomFile='CFVR5204'
   /TITLE,%NomFile% ,Support beam consecutive SOLVE

! -------------------------------------------------------------------------------------
! Initial data
! -------------------------------------------------------------------------------------
! CivilFEM SETUP
  ~UNITS,SI
  ~CFACTIV,PRSC,Y

! Preprocessor
  /PREP7

! Material Definition
  ~CFMP,1,LIB,CONCRETE,EC2,C16/20
  ~CFMP,2,LIB,REINF,CEB,S400
  ~CFMP,3,LIB,PREST,ASTMA416,Gr250

! Element Type Definition
  ET,1,Beam44

! Cross-section definition
  ~CSECDMS,1,REC,1,1 ,0.5,0 ,0 ,0 ,0 ,0 ,0 ,1 ,2
! Beam & Shell property
  ~BMSHPRO,1,BEAM,1,1,,,44,1,1,,Beam 1

! Model
  k,1
  k,2,15
  l,1,2
  dk,1,ux,0,,,uy,uz,rotx
  dk,2,uy,0,,,uz
  h_elems = 4
  medcut = h_elems+1
  endcut   = h_elems*2+1
  lesize,all,,,h_elems*2
  lmesh,all

! Support beam
  ~SBBMDEF
  ~PCEPDEF,1,       1,     0,0
  ~PCEPDEF,2,  medcut,-0.400,0
  ~PCEPDEF,3,  endcut,     0,0
  ~PCPPDEF,1,       1,     0,0
  ~PCPPDEF,3,  endcut,     0,0

  Papp = 862207
  area = 0.001
  c_diameter = 0.15

  ~PCTNDEF,1,3,area,c_diameter,Papp ,Papp  ,0
  ~PCTNMDF,1,EADD,1.
  ~PCTNMDF,1,EADD,2.
  ~PCTNMDF,1,EADD,3.
  ~PCTNMDF,1,PADD,1.
  ~PCTNMDF,1,PADD,3.
  ~PCTNMDF,1,METHOD,1
  ~PCTNMDF,1,EPAROUT,1,0
  ~PCTNMDF,1,EPARIN,2,0
  ~PCLOSS,10000000,0,0,0.8,

/SOLU
 ACEL,,9.81
 SOLVE ! LS 1: Self weight

 ACEL,
 ~PCPL ! Prestressing forces
 SOLVE ! LS 2: Prestress actions

 ~PCDEL ! Prestressing forces delete
 ACEL,,9.81
 ~PCPL ! Prestressing forces
 SOLVE ! LS 3: SW + Prestressing forces


 ~PCDEL ! Prestressing forces delete
 ~PCTNMDF,1,P0MAX,7000
 ~PCPL ! Modified Prestressing forces
 SOLVE ! LS 4: SW + Modified Prestressing forces

 ~PCTNMDF,1,ACTIVE,0
 SOLVE ! LS 5: SW + Modified Prestressing and deactivated tendon

!-----------------------------------------------------------------
! DATA CHECK
!-----------------------------------------------------------------
! Data comparison number
  NComp = 21
  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

! Correct values
  VALUE( 1,1) = 0
  VALUE( 2,1) = 2
  VALUE( 3,1) = 1
  VALUE( 4,1) = 0.391E8
  VALUE( 5,1) = 0.104E9
  VALUE( 6,1) = 0
  VALUE( 7,1) = 1
  VALUE( 8,1) = 0.391E8
  VALUE( 9,1) = 0.104E9
  VALUE(10,1) = 0
  VALUE(11,1) = 1
  VALUE(12,1) = 0.318E6
  VALUE(13,1) = 0.783E8
  VALUE(14,1) = 0
  VALUE(15,1) = 1
  VALUE(16,1) = 0.0
  VALUE(17,1) = 0.0
  VALUE(18,1) = 0
  VALUE(19,1) = 4
  VALUE(20,1) = 2
  VALUE(21,1) =-0.106666

! Labels
  LABEL( 1) ='N_TND'
  LABEL( 2) ='N_PTS'
  LABEL( 3) ='N_TND'
  LABEL( 4) ='LOSS1'
  LABEL( 5) ='LOSS2'
  LABEL( 6) ='LOSS3'
  LABEL( 7) ='N_TND'
  LABEL( 8) ='LOSS1'
  LABEL( 9) ='LOSS2'
  LABEL(10) ='LOSS3'
  LABEL(11) ='N_TND'
  LABEL(12) ='LOSS1'
  LABEL(13) ='LOSS2'
  LABEL(14) ='LOSS3'
  LABEL(15) ='N_TND'
  LABEL(16) ='LOSS1'
  LABEL(17) ='LOSS2'
  LABEL(18) ='LOSS3'
  LABEL(19) ='NODE'
  LABEL(20) ='N_PNT'
  LABEL(21) ='SLOPE'

! Warning and error tolerances
  TOLER( 1, 1)= 1E-6       $   TOLER( 1, 2)= 1E-6
  TOLER( 2, 1)= 1E-6       $   TOLER( 2, 2)= 1E-6
  TOLER( 3, 1)= 1E-6       $   TOLER( 3, 2)= 1E-6
  TOLER( 4, 1)= 5E5        $   TOLER( 4, 2)= 5E5
  TOLER( 5, 1)= 5E6        $   TOLER( 5, 2)= 5E6
  TOLER( 6, 1)= 1E-5       $   TOLER( 6, 2)= 1E-5
  TOLER( 7, 1)= 1E-6       $   TOLER( 7, 2)= 1E-6
  TOLER( 8, 1)= 5E5        $   TOLER( 8, 2)= 5E5
  TOLER( 9, 1)= 5E6        $   TOLER( 9, 2)= 5E6
  TOLER(10, 1)= 1E-5       $   TOLER(10, 2)= 1E-5
  TOLER(11, 1)= 1E-6       $   TOLER(11, 2)= 1E-6
  TOLER(12, 1)= 5E3        $   TOLER(12, 2)= 5E3
  TOLER(13, 1)= 5E5        $   TOLER(13, 2)= 5E5
  TOLER(14, 1)= 1E-5       $   TOLER(14, 2)= 1E-5
  TOLER(14, 1)= 1E-6       $   TOLER(14, 2)= 1E-6
  TOLER(16, 1)= 5E0        $   TOLER(16, 2)= 5E0
  TOLER(17, 1)= 5E0        $   TOLER(17, 2)= 5E0
  TOLER(18, 1)= 1E-5       $   TOLER(18, 2)= 1E-5
  TOLER(19, 1)= 1E-5       $   TOLER(19, 2)= 1E-5
  TOLER(20, 1)= 1E-5       $   TOLER(20, 2)= 1E-5
  TOLER(21, 1)= 1E-5       $   TOLER(21, 2)= 1E-5

/POST1
~CFSET,,1
~CFGET,VALUE( 1,2),PRSCONC,,TENDON,COUNT

~CFSET,,2
~CFGET,VALUE( 2,2),PRSCONC,,TENDON,PNPTS,,1
~CFGET,VALUE( 3,2),PRSCONC,,TENDON,COUNT
~CFGET,VALUE( 4,2),PRSCONC,,TENDON,LOSS,,1,3,1
~CFGET,VALUE( 5,2),PRSCONC,,TENDON,LOSS,,1,4,2
~CFGET,VALUE( 6,2),PRSCONC,,TENDON,LOSS,,1,5,3

~CFSET,,3
~CFGET,VALUE( 7,2),PRSCONC,,TENDON,COUNT
~CFGET,VALUE( 8,2),PRSCONC,,TENDON,LOSS,,1,3,1
~CFGET,VALUE( 9,2),PRSCONC,,TENDON,LOSS,,1,4,2
~CFGET,VALUE(10,2),PRSCONC,,TENDON,LOSS,,1,5,3

~CFSET,,4
~CFGET,VALUE(11,2),PRSCONC,,TENDON,COUNT
~CFGET,VALUE(12,2),PRSCONC,,TENDON,LOSS,,1,3,1
~CFGET,VALUE(13,2),PRSCONC,,TENDON,LOSS,,1,4,2
~CFGET,VALUE(14,2),PRSCONC,,TENDON,LOSS,,1,5,3

~CFSET,,5
~CFGET,VALUE(15,2),PRSCONC,,TENDON,COUNT
~CFGET,VALUE(16,2),PRSCONC,,TENDON,LOSS,,1,3,1
~CFGET,VALUE(17,2),PRSCONC,,TENDON,LOSS,,1,4,2
~CFGET,VALUE(18,2),PRSCONC,,TENDON,LOSS,,1,5,3
~CFGET,VALUE(19,2),PRSCONC,,NODE,CUT, ,5
~CFGET,VALUE(20,2),PRSCONC,,PPOINT,COUNT
~CFGET,VALUE(21,2),PRSCONC,,EPOINT,SLOPE, ,1

~PLTEND ! Check Tendon Editor Window

!--------------------------------------------------------------------------------------
! Results comparison
!--------------------------------------------------------------------------------------
  COMPARA.MAC
