!*************************************************************************************!
! TITLE: CFVR5205 - Combinations with prestressed concrete results.
! 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 combinations are:
! DESCRIPTION:
! DESCRIPTION: - Combination 11: Self weight + Prestressing actions
! DESCRIPTION:
! DESCRIPTION: - Combination 12: Self weight
! DESCRIPTION:
! DESCRIPTION: - Combination 13: Combination 11 + Combination 12
! DESCRIPTION:
! DESCRIPTION: - Combination 14: Combination 12 + Load state 1 (2*self weight)
! DESCRIPTION:
! DESCRIPTION: Targets: ABS(Mz)
! DESCRIPTION:
! DESCRIPTION: The aim of the example is to obtain the combinations results.
! DESCRIPTION:
! DESCRIPTION: This example is based on "Prestressed concrete,
! DESCRIPTION: a fundamental approach", 4<sup>th</sup> edition, page 16.
!
! ELEMENT TYPE: BEAM44
! MODULES: PRSC
! UNITS: SI
! KEYWORD1: Beam
! KEYWORD2: Tendon
! KEYWORD3: Cross Section
! KEYWORD4: Prestressed Concrete
!
!*************************************************************************************!
   FINISH
   ~CFCLEAR,,1
   NomFile='CFVR5205'
   /TITLE,%NomFile% ,Combinations with prestressed concrete results

! -------------------------------------------------------------------------------------
! Initial data
! -------------------------------------------------------------------------------------
! CivilFEM SETUP
  ~UNITS,SI
  ~CODESEL,,EC2-91,EC2-91
  ~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 Construction
  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 construction
  area = 0.001
  c_diameter = 0.15
  ~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

  ~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
  ~CFLSWRT              ! LS 1: Self weight

  ACEL,
  ~PCPL               ! Prestressing forces
  ~CFLSWRT              ! LS 2: Prestressing

  ~PCDEL              ! Prestressing forces delete
  ACEL,,9.81
  ~PCPL               ! Prestressing forces
  ~CFLSWRT              ! LS 3: SW + Prestressing

   LSSOLVE,1,3,1

/POST1

! Targets definition
~TRGDEF,1,CROSS,M,Z,ABS

/TITLE,Combination rule 11,Self weight +  prestressing actions
~CMBDEF ,11,ADD,2,0,2,
~STSTDEF,11,1,LSTEP,1,1,2,1,1,0,
~STSTCFT,11,0,1,

/TITLE,Combination rule 12,Self weight
~CMBDEF ,12,ADD,1,0,1,
~STSTDEF,12,1,LSTEP,1,1,
~STSTCFT,12,0,1,

/TITLE,Combination rule 13, Comb11+ Comb12 =  2*(Self weight) + prestressing actions (Nested combination)
~CMBDEF ,13,ADD,2,0,2,
  ~STSTDEF, 13   ,1    , CMB , 11   ,     ,2    ,1      ,1
  ~STSTCFT ,13,0 ,1,

/TITLE,Combination rule 14, Com12+Lsp1 2*(Self weight) (Nested combination)
~CMBDEF ,14,ADD,2,0,2,
~STSTDEF,14,1,CMB,12,,
~STSTDEF,14,2,LSTEP,1,1,
~STSTCFT,14,0,1,

~COMBINE

!--------------------------------------------------------------------------------------
! DATA CHECK
!--------------------------------------------------------------------------------------
! Data comparison number
  NComp = 9
  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
  ~CMBDAT,1
  ~CFSET,,1,1
  ~PLLSFOR,M,Z
  *GET,value1,ELEM,4,ETAB,CFETAB_J

  ~CFSET,,2,1
  ~PLLSFOR,M,Z
  *GET,value2,ELEM,4,ETAB,CFETAB_J
  VALUE( 1,1) = value1 + value2
  VALUE( 2,1) = 0.0 ! Not used
  VALUE( 3,1) = 0.0 ! Not used
  VALUE( 4,1) = value1
  VALUE( 5,1) = value1*2 + value2
  VALUE( 6,1) = 0.0 ! Not used
  VALUE( 7,1) = 0.0 ! Not used
  VALUE( 8,1) = 0.0 ! Not used
  VALUE( 9,1) = value1*2

! ---------------------------------------------------------------------------------
! Control Tests
! ---------------------------------------------------------------------------------
! Test 1:
! - Hypothesis: Combination  11, Target 1 (MZabs CROSS)
! - Point     : Element 4 Section J
! - Datum     : MZ
! - Result    : C1= H1+H2
!
! Test 2:
! - Hypothesis: Combination 12, Target 1 (MZabs CROSS)
! - Point     : Element 4 Section J
! - Datum     : MZ
! - Result    : C2= H1
!
! Test 3:
! - Hypothesis: Combination 13, Target 1 (MZabs CROSS)
! - Point     : Element 4 Section J
! - Datum     : MZ
! - Result    : C3 = 2*H1+H2
!
! Test 4:
! - Hypothesis: Combination 14, Target 1 (MZabs CROSS)
! - Point     : Element 4 Section J
! - Datum     : MZ
! - Result    : H4 = 2*H1
!

! Load combined results
! ---------------------------------------------------------------------------------
  ~CMBDAT,2
! Test 1:
  ~CFSET,,11,1
! Comparison
 ~PLLSFOR,M,Z
 *GET,VALUE(1,2),ELEM,4,ETAB,CFETAB_J
 VALUE( 2,2) = 0.0 ! Not used
 VALUE( 3,2) = 0.0 ! Not used
! Test 2:
 ~CFSET,,12,1
 ~PLLSFOR,M,Z
 *GET,VALUE(4,2),ELEM,4,ETAB,CFETAB_J

! Test 3:
 ~CFSET,,13,1
 ~PLLSFOR,M,Z
 *GET,VALUE(5,2),ELEM,4,ETAB,CFETAB_J
 VALUE( 6,2) = 0.0 ! Not used
 VALUE( 7,2) = 0.0 ! Not used
 VALUE( 8,2) = 0.0 ! Not used

! Test 4:
 ~CFSET,,14,1
 ~PLLSFOR,M,Z
 *GET,VALUE(9,2),ELEM,4,ETAB,CFETAB_J

! Labels
  LABEL( 1) ='TEST1'
  LABEL( 2) ='TEST2'
  LABEL( 3) ='TEST3'
  LABEL( 4) ='TEST4'
  LABEL( 5) ='TEST5'
  LABEL( 6) ='TEST6'
  LABEL( 7) ='TEST7'
  LABEL( 8) ='TEST8'
  LABEL( 9) ='TEST9'

! Warning and error tolerances
  TOLER( 1, 1)= 1E-5       $   TOLER( 1, 2)= 1E-4
  TOLER( 2, 1)= 1E-5       $   TOLER( 2, 2)= 1E-4
  TOLER( 3, 1)= 1E-5       $   TOLER( 3, 2)= 1E-4
  TOLER( 4, 1)= 1E-5       $   TOLER( 4, 2)= 1E-4
  TOLER( 5, 1)= 1E-5       $   TOLER( 5, 2)= 1E-4
  TOLER( 6, 1)= 1.         $   TOLER( 6, 2)= 1.
  TOLER( 7, 1)= 10.        $   TOLER( 7, 2)= 10.
  TOLER( 8, 1)= 1E-5       $   TOLER( 8, 2)= 1E-4
  TOLER( 9, 1)= 1E-5       $   TOLER( 9, 2)= 1E-4

!--------------------------------------------------------------------------------------
! Results comparison
!--------------------------------------------------------------------------------------
  COMPARA.MAC
