DEBUT(LANG='FR')

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

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

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

model = AFFE_MODELE(AFFE=(_F(GROUP_MA=('syutoutop', 'syutoumidel', 'syutoulow', 'cable'),
                             MODELISATION=('POU_D_EM', ),
                             PHENOMENE='MECANIQUE'),
                          _F(GROUP_MA=('bane', ),
                             MODELISATION=('DIS_TR', ),
                             PHENOMENE='MECANIQUE')),
                    MAILLAGE=meshbeem)

fiber = DEFI_GEOM_FIBRE(SECTION=(_F(COOR_AXE_POUTRE=(0.0, 0.0),
                                    GROUP_FIBRE='fibermesh_s',
                                    GROUP_MA_SECT=('syutoudanmen', ),
                                    MAILLAGE_SECT=meshface),
                                 _F(COOR_AXE_POUTRE=(0.0, 0.0),
                                    GROUP_FIBRE='fibermesh_c',
                                    GROUP_MA_SECT=('cabledanmen', ),
                                    MAILLAGE_SECT=meshdisk)))

elemprop = AFFE_CARA_ELEM(DISCRET=(_F(CARA='K_TR_D_L',
                                      GROUP_MA=('bane', ),
                                      REPERE='GLOBAL',
                                      VALE=(100000.0, 100000.0, 100000.0, 1.0, 1.0, 1.0)),
                                   _F(CARA='M_TR_D_L',
                                      GROUP_MA=('bane', ),
                                      REPERE='GLOBAL',
                                      VALE=(0.0, 0.0, 0.0, 0.0))),
                          GEOM_FIBRE=fiber,
                          MODELE=model,
                          MULTIFIBRE=(_F(GROUP_FIBRE=('fibermesh_s', ),
                                         GROUP_MA=('syutoutop', 'syutoumidel', 'syutoulow'),
                                         PREC_AIRE=1.6,
                                         PREC_INERTIE=5.0),
                                      _F(GROUP_FIBRE=('fibermesh_c', ),
                                         GROUP_MA=('cable', ),
                                         PREC_AIRE=1.6,
                                         PREC_INERTIE=5.0)),
                          POUTRE=(_F(CARA=('HY', 'HZ'),
                                     GROUP_MA=('syutoutop', 'syutoumidel', 'syutoulow'),
                                     SECTION='RECTANGLE',
                                     VALE=(3000.0, 1500.0)),
                                  _F(CARA=('R', ),
                                     GROUP_MA=('cable', ),
                                     SECTION='CERCLE',
                                     VALE=(100.0, ))))

steel = DEFI_MATERIAU(ELAS=_F(ALPHA=1.2e-05,
                              E=206000.0,
                              NU=0.3,
                              RHO=7.8e-09))

cable = DEFI_MATERIAU(ELAS=_F(ALPHA=1.26e-05,
                              E=195000.0,
                              NU=0.3,
                              RHO=7.85e-09))

listr = DEFI_LIST_REEL(DEBUT=0.0,
                       INTERVALLE=_F(JUSQU_A=1.0,
                                     PAS=0.1))

times = DEFI_LIST_INST(DEFI_LIST=_F(LIST_INST=listr),
                       METHODE='MANUEL')

func = DEFI_FONCTION(NOM_PARA='INST',
                     NOM_RESU='TEMP',
                     VALE=(0.0, 0.0, 1.0, -150.0))

load = AFFE_CHAR_MECA(DDL_IMPO=(_F(GROUP_NO=('syutou_kotei', ),
                                   LIAISON='ENCASTRE'),
                                _F(DX=0.0,
                                   DY=0.0,
                                   DZ=0.0,
                                   GROUP_NO=('cable_kotei', ))),
                      MODELE=model)

#comment: load0 = AFFE_CHAR_MECA()

unnamed = CREA_CHAMP(AFFE=_F(GROUP_MA=('cable', ),
                             NOM_CMP=('TEMP', ),
                             VALE_F=(func, )),
                     MODELE=model,
                     OPERATION='AFFE',
                     TYPE_CHAM='NOEU_TEMP_F')

reslin = CREA_RESU(AFFE=_F(CARA_ELEM=elemprop,
                           CHAM_GD=unnamed,
                           LIST_INST=listr,
                           MODELE=model),
                   NOM_CHAM='TEMP',
                   OPERATION='AFFE',
                   TYPE_RESU='EVOL_VARC')

behav_s = DEFI_COMPOR(GEOM_FIBRE=fiber,
                      MATER_SECT=steel,
                      MULTIFIBRE=_F(GROUP_FIBRE=('fibermesh_s', ),
                                    MATER=steel,
                                    RELATION='ELAS'))

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

fieldmat = AFFE_MATERIAU(AFFE=(_F(GROUP_MA=('syutoutop', 'syutoumidel', 'syutoulow'),
                                  MATER=(steel, )),
                               _F(GROUP_MA=('cable', ),
                                  MATER=(cable, ))),
                         AFFE_COMPOR=(_F(COMPOR=behav_s,
                                         GROUP_MA=('syutoutop', 'syutoumidel', 'syutoulow')),
                                      _F(COMPOR=behav_c,
                                         GROUP_MA=('cable', ))),
                         AFFE_VARC=_F(EVOL=reslin,
                                      GROUP_MA=('cable', ),
                                      NOM_CHAM='TEMP',
                                      NOM_VARC='TEMP',
                                      VALE_REF=0.0),
                         MODELE=model)

ASSEMBLAGE(CARA_ELEM=elemprop,
           CHAM_MATER=fieldmat,
           CHARGE=(load, ),
           MATR_ASSE=(_F(MATRICE=CO('mass'),
                         OPTION='MASS_MECA'),
                      _F(MATRICE=CO('stifness'),
                         MODE_FOURIER=0,
                         OPTION='RIGI_MECA')),
           MODELE=model,
           NUME_DDL=CO('nddl'))

resnonl = STAT_NON_LINE(CARA_ELEM=elemprop,
                        CHAM_MATER=fieldmat,
                        COMPORTEMENT=(_F(GROUP_MA=('syutoutop', 'syutoumidel', 'syutoulow'),
                                         RELATION='MULTIFIBRE'),
                                      _F(GROUP_MA=('cable', ),
                                         RELATION='MULTIFIBRE')),
                        EXCIT=_F(CHARGE=load),
                        INCREMENT=_F(LIST_INST=times),
                        MODELE=model)

unnamed0 = CALC_CHAMP(CARA_ELEM=elemprop,
                      CHAM_MATER=fieldmat,
                      CONTRAINTE=('EFGE_ELNO', ),
                      MODELE=model,
                      RESULTAT=resnonl)

IMPR_RESU(FORMAT='MED',
          RESU=(_F(CARA_ELEM=elemprop,
                   MAILLAGE=meshbeem,
                   NOM_CHAM=('DEPL', ),
                   RESULTAT=resnonl),
                _F(CARA_ELEM=elemprop,
                   MAILLAGE=meshbeem,
                   NOM_CHAM=('EFGE_ELNO', ),
                   RESULTAT=unnamed0)),
          UNITE=80)

FIN()
