DEBUT(LANG='FR')

mesh0 = LIRE_MAILLAGE(FORMAT='MED',
                      UNITE=4)

mesh1 = LIRE_MAILLAGE(FORMAT='MED',
                      UNITE=2)

mesh2 = LIRE_MAILLAGE(FORMAT='MED',
                      UNITE=20)

model = AFFE_MODELE(AFFE=(_F(GROUP_MA=('beam', ),
                             MODELISATION=('POU_D_EM', ),
                             PHENOMENE='MECANIQUE'),
                          _F(GROUP_MA=('cable', ),
                             MODELISATION=('POU_D_EM', ),
                             PHENOMENE='MECANIQUE'),
                          _F(GROUP_MA=('hinge', ),
                             MODELISATION=('DIS_TR', ),
                             PHENOMENE='MECANIQUE')),
                    MAILLAGE=mesh0)

fiber = DEFI_GEOM_FIBRE(SECTION=(_F(COOR_AXE_POUTRE=(0.0, 0.0),
                                    GROUP_FIBRE='kesec',
                                    GROUP_MA_SECT=('ketadanmen', ),
                                    MAILLAGE_SECT=mesh1),
                                 _F(COOR_AXE_POUTRE=(0.0, 0.0),
                                    GROUP_FIBRE='cabsec',
                                    GROUP_MA_SECT=('cabledanmen', ),
                                    MAILLAGE_SECT=mesh2)))

elemprop = AFFE_CARA_ELEM(DISCRET=_F(CARA='K_TR_D_L',
                                     GROUP_MA=('hinge', ),
                                     REPERE='GLOBAL',
                                     VALE=(100000.0, 100000.0, 100000.0, 0.0, 0.0, 0.0)),
                          GEOM_FIBRE=fiber,
                          MODELE=model,
                          MULTIFIBRE=(_F(GROUP_FIBRE=('kesec', ),
                                         GROUP_MA=('beam', ),
                                         PREC_AIRE=1.0,
                                         PREC_INERTIE=16.0),
                                      _F(GROUP_FIBRE=('cabsec', ),
                                         GROUP_MA=('cable', ),
                                         PREC_AIRE=1.0,
                                         PREC_INERTIE=1.0)),
                          POUTRE=(_F(CARA=('EPY', 'EPZ', 'HY', 'HZ'),
                                     GROUP_MA=('beam', ),
                                     SECTION='RECTANGLE',
                                     VALE=(2.0, 2.0, 10.0, 50.0)),
                                  _F(CARA=('R', ),
                                     GROUP_MA=('cable', ),
                                     SECTION='CERCLE',
                                     VALE=(8.0, ))))

beam1 = DEFI_MATERIAU(ELAS=_F(E=200000.0,
                              NU=0.3,
                              RHO=7.9e-06))

cable = DEFI_MATERIAU(ELAS=_F(E=195000.0,
                              NU=0.3,
                              RHO=7.9e-06))

load = AFFE_CHAR_MECA(DDL_IMPO=(_F(DRX=0.0,
                                   DRY=0.0,
                                   DRZ=0.0,
                                   DX=0.0,
                                   DY=0.0,
                                   DZ=0.0,
                                   GROUP_NO=('kotei', )),
                                _F(DX=0.0,
                                   DY=0.0,
                                   DZ=0.0,
                                   GROUP_NO=('pin', ))),
                      MODELE=model)

load0 = AFFE_CHAR_MECA(FORCE_POUTRE=_F(FY=-0.0183456,
                                       GROUP_MA=('beam', )),
                       MODELE=model)

#comment: liaison = AFFE_CHAR_MECA(LIAISON_SOLIDE=_F(GROUP_MA=('hinge', )),
#comment:                          MODELE=model)

beambeha = DEFI_COMPOR(GEOM_FIBRE=fiber,
                       MATER_SECT=beam1,
                       MULTIFIBRE=_F(GROUP_FIBRE=('kesec', ),
                                     MATER=beam1,
                                     RELATION='ELAS'))

cabbehav = DEFI_COMPOR(GEOM_FIBRE=fiber,
                       MATER_SECT=cable,
                       MULTIFIBRE=_F(GROUP_FIBRE=('cabsec', ),
                                     MATER=cable,
                                     RELATION='ELAS'))

fieldmat = AFFE_MATERIAU(AFFE=(_F(GROUP_MA=('beam', ),
                                  MATER=(beam1, )),
                               _F(GROUP_MA=('cable', ),
                                  MATER=(cable, ))),
                         AFFE_COMPOR=(_F(COMPOR=beambeha,
                                         GROUP_MA=('beam', )),
                                      _F(COMPOR=cabbehav,
                                         GROUP_MA=('cable', ))),
                         MAILLAGE=mesh0,
                         MODELE=model)

reslin = MECA_STATIQUE(CARA_ELEM=elemprop,
                       CHAM_MATER=fieldmat,
                       EXCIT=(_F(CHARGE=load),
                              _F(CHARGE=load0)),
                       MODELE=model,
                       SOLVEUR=_F(METHODE='MUMPS',
                                  NPREC=10))

IMPR_RESU(FORMAT='MED',
          RESU=_F(CARA_ELEM=elemprop,
                  MAILLAGE=mesh0,
                  NOM_CHAM=('DEPL', ),
                  RESULTAT=reslin),
          UNITE=80)

FIN()
