DEBUT(LANG='FR')

zentai = LIRE_MAILLAGE(FORMAT='MED',
                       UNITE=3)

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

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

fiber = DEFI_GEOM_FIBRE(SECTION=(_F(ANGLE=-90.0,
                                    COOR_AXE_POUTRE=(0.0, 0.0),
                                    GROUP_FIBRE='dansec',
                                    GROUP_MA_SECT=('ketadanmen', ),
                                    MAILLAGE_SECT=danmen),
                                 _F(COOR_AXE_POUTRE=(0.0, 1000.0),
                                    GROUP_FIBRE='cabsec',
                                    GROUP_MA_SECT=('cabledanmen', ),
                                    MAILLAGE_SECT=mesh)))

model = AFFE_MODELE(AFFE=(_F(GROUP_MA=('keta', ),
                             MODELISATION=('POU_D_EM', ),
                             PHENOMENE='MECANIQUE'),
                          _F(GROUP_MA=('cable', ),
                             MODELISATION=('POU_D_EM', ),
                             PHENOMENE='MECANIQUE')),
                    MAILLAGE=zentai)

elemprop = AFFE_CARA_ELEM(GEOM_FIBRE=fiber,
                          MODELE=model,
                          MULTIFIBRE=(_F(GROUP_FIBRE=('dansec', ),
                                         GROUP_MA=('keta', ),
                                         PREC_AIRE=0.1,
                                         PREC_INERTIE=20.0),
                                      _F(GROUP_FIBRE=('cabsec', ),
                                         GROUP_MA=('cable', ),
                                         PREC_AIRE=0.02,
                                         PREC_INERTIE=250000.0)),
                          POUTRE=(_F(CARA=('EPY', 'EPZ', 'HY', 'HZ'),
                                     GROUP_MA=('keta', ),
                                     SECTION='RECTANGLE',
                                     VALE=(2.0, 2.0, 10.0, 50.0)),
                                  _F(CARA=('R', ),
                                     GROUP_MA=('cable', ),
                                     SECTION='CERCLE',
                                     VALE=(4.0, ))))

keta = DEFI_MATERIAU(ELAS=_F(E=200000.0,
                             NU=0.3,
                             RHO=7.9e-09))

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

kotei = AFFE_CHAR_MECA(DDL_IMPO=(_F(GROUP_NO=('kotei', ),
                                    LIAISON='ENCASTRE'),
                                 _F(DX=0.0,
                                    DY=0.0,
                                    DZ=0.0,
                                    GROUP_NO=('pin2', ))),
                       MODELE=model)

deadload = AFFE_CHAR_MECA(FORCE_POUTRE=_F(FY=-0.0183456,
                                          GROUP_MA=('keta', )),
                          MODELE=model)

liaison = AFFE_CHAR_MECA(LIAISON_GROUP=_F(COEF_IMPO=0.0,
                                          COEF_MULT_1=(1.0, 1.0, 1.0),
                                          COEF_MULT_2=(-1.0, -1.0, -1.0),
                                          DDL_1=('DX', 'DY', 'DZ'),
                                          DDL_2=('DX', 'DY', 'DZ'),
                                          GROUP_NO_1=('pinbeam', ),
                                          GROUP_NO_2=('pincable', ),
                                          SANS_GROUP_NO=('pinbeam', 'pincable')),
                         MODELE=model)

#comment: unnamed = CREA_CHAMP(AFFE=_F(GROUP_NO=('pin2', 'pin1', 'pin1p'),
#comment:                              NOM_CMP=('TEMP', ),
#comment:                              VALE=(-100.0, )),
#comment:                      MODELE=model,
#comment:                      OPERATION='AFFE',
#comment:                      TYPE_CHAM='NOEU_TEMP_R')

behav = DEFI_COMPOR(GEOM_FIBRE=fiber,
                    MATER_SECT=keta,
                    MULTIFIBRE=_F(GROUP_FIBRE=('dansec', ),
                                  MATER=keta))

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

fieldmat = AFFE_MATERIAU(AFFE=(_F(GROUP_MA=('keta', ),
                                  MATER=(keta, )),
                               _F(GROUP_MA=('cable', ),
                                  MATER=(cable, ))),
                         AFFE_COMPOR=(_F(COMPOR=behav,
                                         GROUP_MA=('keta', )),
                                      _F(COMPOR=cabbehav,
                                         GROUP_MA=('cabledanmen', ))),
                         MAILLAGE=zentai,
                         MODELE=model)

reslin = MECA_STATIQUE(CARA_ELEM=elemprop,
                       CHAM_MATER=fieldmat,
                       EXCIT=(_F(CHARGE=kotei),
                              _F(CHARGE=deadload),
                              _F(CHARGE=liaison)),
                       MODELE=model,
                       SOLVEUR=_F(METHODE='MUMPS',
                                  RESI_RELA=0.01))

#comment: unnamed0 = CALC_CHAMP(CARA_ELEM=elemprop,
#comment:                       CHAM_MATER=fieldmat,
#comment:                       CONTRAINTE=('SIGM_NOEU', ),
#comment:                       MODELE=model,
#comment:                       RESULTAT=reslin)

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

FIN()
