DEBUT(LANG='FR')

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

model = AFFE_MODELE(AFFE=(_F(GROUP_MA=('beam', ),
                             MODELISATION=('POU_D_E', ),
                             PHENOMENE='MECANIQUE'),
                          _F(GROUP_MA=('pinbane', ),
                             MODELISATION=('DIS_TR', ),
                             PHENOMENE='MECANIQUE')),
                    MAILLAGE=mesh)

elemprop = AFFE_CARA_ELEM(DISCRET=(_F(CARA='K_TR_D_L',
                                      GROUP_MA=('pinbane', ),
                                      REPERE='GLOBAL',
                                      VALE=(100000.0, 100000.0, 100000.0, 1.0, 1.0, 1.0)),
                                   _F(CARA='M_TR_D_L',
                                      GROUP_MA=('pinbane', ),
                                      REPERE='GLOBAL',
                                      VALE=(0.0, 0.0, 0.0, 0.0))),
                          MODELE=model,
                          POUTRE=_F(CARA=('H', ),
                                    GROUP_MA=('beam', ),
                                    SECTION='RECTANGLE',
                                    VALE=(10.0, )))

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

fieldmat = AFFE_MATERIAU(AFFE=_F(GROUP_MA=('beam', ),
                                 MATER=(mater, )),
                         MAILLAGE=mesh,
                         MODELE=model)

force = DEFI_FONCTION(NOM_PARA='INST',
                      VALE=(0.0, 0.0, 50.0, 1.0, 100.0, 1.0))

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

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

tensi = DEFI_FONCTION(NOM_PARA='INST',
                      VALE=(0.0, 0.0, 50.0, 1.0, 70.0, 1.0, 70.1, 0.0, 100.0, 0.0))

(force1 and ten1 apply CALC_CHAMP )

force1 = DEFI_FONCTION(NOM_PARA='INST',
                       VALE=(0.0, 0.0, 50.0, 1.0, 100.0, 1.0))

ten1 = DEFI_FONCTION(NOM_PARA='INST',
                     VALE=(0.0, 0.0, 50.0, 1.0, 70.0, 1.0, 70.1, 0.0, 100.0, 0.0))

load = AFFE_CHAR_MECA(DDL_IMPO=_F(GROUP_NO=('kotei', ),
                                  LIAISON='ENCASTRE'),
                      MODELE=model)

load0 = AFFE_CHAR_MECA(FORCE_NODALE=_F(FY=-100.0,
                                       GROUP_NO=('saika', )),
                       MODELE=model)

tension = AFFE_CHAR_MECA(FORCE_NODALE=_F(FY=50.0,
                                         GROUP_NO=('tension', )),
                         MODELE=model)

(kotei,saika and tensi1 apply CALC_CHAMP)

kotei = AFFE_CHAR_MECA(DDL_IMPO=_F(GROUP_NO=('kotei', ),
                                   LIAISON='ENCASTRE'),
                       MODELE=model)

saika = AFFE_CHAR_MECA(FORCE_NODALE=_F(FY=-100.0,
                                       GROUP_NO=('saika', )),
                       MODELE=model)

tensi1 = AFFE_CHAR_MECA(FORCE_NODALE=_F(FY=50.0,
                                        GROUP_NO=('tension', )),
                        MODELE=model)

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

resharm2 = DYNA_VIBRA(BASE_CALCUL='PHYS',
                      CARA_ELEM=elemprop,
                      CHAM_MATER=fieldmat,
                      EXCIT=(_F(CHARGE=load),
                             _F(CHARGE=load0,
                                FONC_MULT=force),
                             _F(CHARGE=tension,
                                FONC_MULT=tensi)),
                      INCREMENT=_F(LIST_INST=listr),
                      MATR_MASS=mass,
                      MATR_RIGI=rigi,
                      MODELE=model,
                      SCHEMA_TEMPS=_F(BETA=0.25,
                                      SCHEMA='NEWMARK'),
                      TYPE_CALCUL='TRAN')

resharm2 = CALC_CHAMP(reuse=resharm2,
                      CARA_ELEM=elemprop,
                      CHAM_MATER=fieldmat,
                      EXCIT=(_F(CHARGE=saika,
                                FONC_MULT=force1),
                             _F(CHARGE=kotei)),
                      FORCE=('REAC_NODA', 'FORC_NODA'),
                      LIST_INST=listr,
                      MODELE=model,
                      RESULTAT=resharm2)

IMPR_RESU(FORMAT='MED',
          RESU=(_F(CARA_ELEM=elemprop,
                   IMPR_NOM_VARI='OUI',
                   MAILLAGE=mesh,
                   NOM_CHAM=('DEPL', ),
                   RESULTAT=resharm2),
                _F(CARA_ELEM=elemprop,
                   NOM_CHAM=('FORC_NODA', 'REAC_NODA'),
                   RESULTAT=resharm2)),
          UNITE=3)

FIN()
