DEBUT();

pmesh=LIRE_MAILLAGE(FORMAT='MED',);

pmodel=AFFE_MODELE(MAILLAGE=pmesh,
                   AFFE=_F(TOUT='OUI',
				           PHENOMENE='MECANIQUE',
						   MODELISATION='3D',),);

kou=DEFI_MATERIAU(ELAS=_F(E=2.06e5,
                            NU=0.3,),);

moku=DEFI_MATERIAU(ELAS=_F(E=6.921e3,
                           NU=0.3,),);


matprops=AFFE_MATERIAU(MAILLAGE=pmesh,
                       AFFE=(_F(GROUP_MA='ki',
					           MATER=moku,),
							_F(GROUP_MA='kou',   
							   MATER=kou,),),);



FLoad=AFFE_CHAR_MECA(MODELE=pmodel,
                     DDL_IMPO=(_F(GROUP_MA='saika',
					              DX=0.0,
								  ),
							   _F(GROUP_MA='aida',
                                  DX=0.0,),
                               _F(GROUP_MA='kotei',
								  DZ=0.0,
								  ),
                               _F(GROUP_MA='yoko',
							      DY=0.0,
#								  DX=0.0,
								  ),
							  ),
                      FORCE_FACE=_F(GROUP_MA='saika',
					                FZ=-9.920871132,),);
                     

result=MECA_STATIQUE(MODELE=pmodel,
                     CHAM_MATER=matprops,
					 EXCIT=_F(CHARGE=FLoad,),);

result=CALC_ELEM(reuse =result,
                 MODELE=pmodel,
				 CHAM_MATER=matprops,
				 RESULTAT=result,
				 OPTION=('SIGM_ELNO','SIEQ_ELNO','SIEF_ELGA',),
				 EXCIT=_F(CHARGE=FLoad,),);

pmesh=DEFI_GROUP(reuse =pmesh,
                 MAILLAGE=pmesh,
				 CREA_GROUP_NO=_F(GROUP_MA='saika',
				                  NOM='saika',),
				 INFO=2,);

result=CALC_NO(reuse =result,
               RESULTAT=result,
			   OPTION=('SIGM_NOEU','SIEQ_NOEU','FORC_NODA',),);

TB_nodf=POST_RELEVE_T(ACTION=(_F(OPERATION='EXTRACTION',
                                 INTITULE='displacements',
								 RESULTAT=result,
								 NOM_CHAM='DEPL',
								 TOUT_ORDRE='OUI',
								 GROUP_NO='saika',
								 RESULTANTE=('DX','DY','DZ',),
								 MOYE_NOEUD='NON',),
							  _F(OPERATION='EXTRACTION',
							     INTITULE='NodalForces',
								 RESULTAT=result,
								 NOM_CHAM='FORC_NODA',
								 PRECISION=0.000001,
								 GROUP_NO='saika',
								 RESULTANTE=('DX','DY','DZ',),),),
					  TITRE='[Reaction] Nodal Forces',);

IMPR_TABLE(TABLE=TB_nodf,
           FORMAT='TABLEAU',
		   UNITE=26,
		   SEPARATEUR=' * ',
		   TITRE='displacements at nodes on group TOP',);

IMPR_RESU(FORMAT='MED',
          UNITE=21,
		  RESU=_F(MAILLAGE=pmesh,
		          RESULTAT=result,
				  NOM_CHAM=('SIGM_NOEU','SIEQ_NOEU','SIEQ_ELNO','DEPL',),),);

Smech=CALC_MATR_ELEM(OPTION='RIGI_MECA',
                     MODELE=pmodel,
					 CHAM_MATER=matprops,
					 CHARGE=FLoad,);

Fsigma=CREA_CHAMP(TYPE_CHAM='ELGA_SIEF_R',
                  OPERATION='EXTR',
				  RESULTAT=result,
				  NOM_CHAM='SIEF_ELGA',
				  NUME_ORDRE=1,);

Sgeom=CALC_MATR_ELEM(OPTION='RIGI_GEOM',
                     MODELE=pmodel,
					 SIEF_ELGA=Fsigma,);

nddl=NUME_DDL(MATR_RIGI=Smech,);

SAmech=ASSE_MATRICE(MATR_ELEM=Smech,
                    NUME_DDL=nddl,);

SAgeom=ASSE_MATRICE(MATR_ELEM=Sgeom,
                    NUME_DDL=nddl,);

buckle=MODE_ITER_SIMULT(MATR_A=SAmech,
                        MATR_B=SAgeom,
						METHODE='SORENSEN',
						PREC_SOREN=2e-16,
						NMAX_ITER_SOREN=50,
						TYPE_RESU='MODE_FLAMB',
						CALC_FREQ=_F(OPTION='PLUS_PETITE',
						             NMAX_FREQ=10,),
						INFO=1,);

IMPR_RESU(FORMAT='MED',
          RESU=_F(MAILLAGE=pmesh,
		          RESULTAT=buckle,
				  NOM_CHAM='DEPL',),);

FIN();


