!*************************************************************************************!
! TITLE: CFVR0805 - Combination module test with LINK 8 elements
! SUBTITLE: Example to check the combinations utility with LINK 8 elements
!
! DESCRIPTION: This example checks the functionality of the combinations module
! DESCRIPTION: with LINK 8 elements.
! DESCRIPTION:
! DESCRIPTION:
! DESCRIPTION: The model is a simple two beam 60º V shaped model. Each beam has different real constants
! DESCRIPTION: and material properties, which do not represent a physical problem.
! DESCRIPTION:
! DESCRIPTION: The load cases are:
! DESCRIPTION:
! DESCRIPTION: - Load Step 2, Sub Step 2: Horizontal load of 15 N (left direction) on the center node (10).
! DESCRIPTION:
! DESCRIPTION: - Load Step 5, Sub Step 5: Vertical load of 10 N (downwards) on the center node (10).
! DESCRIPTION:
! DESCRIPTION: - Load Step 10, Sub Step 10: Horizontal load of 25 N (right direction) on the center node (10).
! DESCRIPTION:
! DESCRIPTION: No Civil materials or beam properties have been used in this example,
! DESCRIPTION: only ANSYS results will be checked.
! DESCRIPTION:
! DESCRIPTION:
! DESCRIPTION: The targets for the combinations are:
! DESCRIPTION:
! DESCRIPTION: - Target 2: FX in BEAMS (ABS value)
! DESCRIPTION:
! DESCRIPTION: - Target 5: S DIR in BEAMS (Maximum value)
! DESCRIPTION:
! DESCRIPTION: - Target 10: EPEL DIR in BEAMS (Minimum value)
! DESCRIPTION:
! DESCRIPTION:
! DESCRIPTION: The combination rule defined is:
! DESCRIPTION:
! DESCRIPTION: - Combination rule 18: SELEC CFV - [(2.0 or 3.0)*H1, (1.0 or 2.0)*H2]
! DESCRIPTION:
!
! ELEMENT TYPE: Link8
! MODULES:
! UNITS: SI
! KEYWORD1: Beam
! KEYWORD2: Combinations
!*************************************************************************************!
  FINISH
  ~CFCLEAR,,1 
 AnsLic='ansys'

  NomFile='CFVR0805'
  /TITLE, %NomFile%, Combination module test with LINK8
! ---------------------------------------------------------------------------------
! Model definition and solve
! ---------------------------------------------------------------------------------
!
!  Load scheme:
!
!                          0.5 m     0.5 m
!                       |---------|---------|
!
!               -   N15 o                   o N20
!               |        \                 /
!               |         \   R100        / R200
!               |          \  M100       /  M200
!               |           \ E100      /   E200
!             1.0 m          \         /
!               |             \       /
!               |              \     /
!               |               \   /
!               |   (LS2 SB2)    \ /
!               -     H=15  <---- 0----> H=25 (LS10 SB10)
!                             N10 |
!                                 |
!                                 v V=10 (LS5 SB5)
!
!
!
! ---------------------------------------------------------------------------------
/PREP7
! Materials
  MP,EX,100,1E6
  MP,NUXY,100,0.2
  MP,EX,200,2E6
  MP,NUXY,200,0.2
! Sections
  A=2
  R,100,A
  R,200,A/4
! Element types
  ET,5,Link8
! Nodes
  N, 10, 0.0, 0
  N, 15,-0.5, 1
  N, 20, 0.5, 1
! Elements
  MAT,100 $ REAL,100 $ TYPE, 5 $ EN,100, 15, 10
  MAT,200 $ REAL,200 $ TYPE, 5 $ EN,200, 10, 20
! Boundary conditions
  D,15,ALL
  D,20,ALL
! Plot
  EPLOT
! Initial hypothesis solve
  /SOLU
  SOLCONTROL,OFF
  AUTOTS,OFF
  ! Hypothesis 0: LS1 Ignored
    TIME, 2
    OUTRES,ALL,NONE
    SOLVE
  ! Hypothesis 1: LS2 SB2
    TIME,5
    NSUBST,2
    OUTRES,ALL,ALL
    F,10,FX,-15
    EPLOT
    /IMAGE,SAVE,%NomFile%,BMP
    SOLVE
    FDELE,ALL,ALL
  ! Hypothesis 0: LS3 and LS4 Ignoreds
    TIME, 6
    OUTRES,ALL,NONE
    SOLVE
    TIME, 7
    OUTRES,ALL,NONE
    SOLVE
  ! Hypothesis 2: LS5 SB5
    TIME,10
    NSUBST,5
    OUTRES,ALL,ALL
    F,10,FY,-10
    SOLVE
    FDELE,ALL,ALL
  ! Hypothesis 0: LS6, LS7, LS8 and LS9 Ignoreds
    TIME, 11
    OUTRES,ALL,NONE
    SOLVE
    TIME, 12
    OUTRES,ALL,NONE
    SOLVE
    TIME, 13
    OUTRES,ALL,NONE
    SOLVE
    TIME, 14
    OUTRES,ALL,NONE
    SOLVE
  ! Hypothesis 3: LS10 SB10
    TIME,30
    NSUBST,10
    OUTRES,ALL,ALL
    F,10,FX,25
    SOLVE
    FDELE,ALL,ALL

/POST1
! ---------------------------------------------------------------------------------
! Definition and solving of combinations
! ---------------------------------------------------------------------------------
! Reset combinations module
  ~CMBCLR,
! Targets definition
  ~TRGDEF, 2,BEAM,F   ,X  ,ABS
  ~TRGDEF, 5,BEAM,S   ,DIR,MAX
  ~TRGDEF,10,BEAM,EPEL,DIR,MIN
! Combinations definition
  ! Combination 18: SELEC CFV    : [(2.0 or 3.0)*H1+(1.0 or 2.0)*H2]
      ~CMBDEF ,18,SELECTVC,2,,2
      ~STSTDEF,18,1,LSTEP,5,5    ! H2: LS5  SB5
      ~STSTDEF,18,2,LSTEP,10,10  ! H3: LS10 SB10
      ~STSTCFT,18,1,3.00,2.00
      ~STSTCFT,18,2,2.00,1.00
  ! Combine
    ~COMBINE

!--------------------------------------------------------------------------------------
! DATA CHECK
!--------------------------------------------------------------------------------------
! Data comparison number
  NComp = 6
  NComp_ch = 0

! Marix dim.
  *DIM,LABEL,CHAR,Ncomp,1
  *DIM,VALUE,,Ncomp,3
  *DIM,TOLER,,Ncomp,2
! ---------------------------------------------------------------------------------
! Tests de Control
! ---------------------------------------------------------------------------------
! Test 1:
! - Hypothesis: Combination 18, Target 2 (FXabs BEAM)
! - Point    : Element 200 End J
! - Datum    : FX
! - Solution : 2*H2+2*H3 = -44.7213
!
! Test 2:
! - Hypothesis: Combination 18, Target 2 (FXabs BEAM)
! - Point    : Element 200 End J
! - Datum    : EPELDIR
! - Solution : 2*H2+2*H3 = -4.47213E-05
!
! Test 3:
! - Hypothesis: Combination 18, Target 5 (SDIRmax BEAM)
! - Point    : Element 100 End I
! - Datum    : SDIR
! - Solution : 3*H2+2*H2 = 36.3361
!
! Test 4:
! - Hypothesis: Combination 18, Target 5 (SDIRmax BEAM)
! - Point    : Element 100 End I
! - Datum    : FX
! - Solution : 3*H2+2*H2 = 72.6722
!
! Test 5:
! - Hypothesis: Combination 18, Target 10 (EPELDIRmin BEAM)
! - Point    : Element 100 End I
! - Datum    : EPELDIR
! - Solution : 2*H2+1*H3 = 1.95655E-05
!
! Test 6:
! - Hypothesis: Combination 18, Target 10 (EPELDIRmin BEAM)
! - Point    : Element 100 End I
! - Datum    : FX
! - Solution : 2*H2+1*H3 = 39.1311
! ---------------------------------------------------------------------------------
! Point to combined data
  ~CMBDAT,2
! Test 1:
  ~CFSET,,18,2
  ETABLE,FX_J,SMISC,1
  *GET,VALUE(1,2),ELEM,200,ETAB,FX_J
  VALUE(1,1)= -44.7213
! Test 2:
  ~CFSET,,18,2
  ETABLE,EP,LEPEL,1
  *GET,VALUE(2,2),ELEM,200,ETAB,EP
  VALUE(2,1)= -4.47213E-05
! Test 3:
  ~CFSET,,18,5
  ETABLE,SD,LS,1
  *GET,VALUE(3,2),ELEM,100,ETAB,SD
  VALUE(3,1)=  36.3361
! Test 4:
  ~CFSET,,18,5
  ETABLE,FX_I,SMISC,1
  *GET,VALUE(4,2),ELEM,100,ETAB,FX_I
  VALUE(4,1)= 72.6722
! Test 5:
  ~CFSET,,18,10
  ETABLE,EP,LEPEL,1
  *GET,VALUE(5,2),ELEM,100,ETAB,EP
  VALUE(5,1)= 1.95655E-05
! Test 6:
  ~CFSET,,18,10
  ETABLE,FX_I,SMISC,1
  *GET,VALUE(6,2),ELEM,100,ETAB,FX_I
  VALUE(6,1)= 39.1311

! Labels
!--------------------------------------------------------------------------------------
  LABEL( 1) ='TEST1'
  LABEL( 2) ='TEST2'
  LABEL( 3) ='TEST3'
  LABEL( 4) ='TEST4'
  LABEL( 5) ='TEST5'
  LABEL( 6) ='TEST6'

! Warning and error tolerances
  TOLER( 1, 1)= 1E-4      $   TOLER( 1, 2)= 1E-3
  TOLER( 2, 1)= 1E-9      $   TOLER( 2, 2)= 1E-8
  TOLER( 3, 1)= 1E-4      $   TOLER( 3, 2)= 1E-3
  TOLER( 4, 1)= 1E-4      $   TOLER( 4, 2)= 1E-3
  TOLER( 5, 1)= 1E-9      $   TOLER( 5, 2)= 1E-8
  TOLER( 6, 1)= 1E-4      $   TOLER( 6, 2)= 1E-3

!--------------------------------------------------------------------------------------
! Results comparison
!--------------------------------------------------------------------------------------
  COMPARA.MAC
