affectMat = code_aster.MaterialField(monMaillage) affectMat.addMaterialsOnMesh(acier) affectMat.buildWithoutExternalVariable() imposedDof1 = code_aster.DisplacementReal() imposedDof1.setValue(code_aster.PhysicalQuantityComponent.Dx, 0.0) imposedDof1.setValue(code_aster.PhysicalQuantityComponent.Dy, 0.0) imposedDof1.setValue(code_aster.PhysicalQuantityComponent.Dz, 0.0) CharMeca1 = code_aster.ImposedDisplacementReal(monModel) CharMeca1.setValue(imposedDof1, "Bas") CharMeca1.build() test.assertEqual(CharMeca1.getType(), "CHAR_MECA") imposedPres1 = code_aster.PressureReal() imposedPres1.setValue(code_aster.PhysicalQuantityComponent.Pres, 1000.) CharMeca2 = code_aster.DistributedPressureReal(monModel) CharMeca2.setValue(imposedPres1, "Haut") CharMeca2.build() test.assertEqual(CharMeca2.getType(), "CHAR_MECA") monSolver = code_aster.MumpsSolver(code_aster.Renumbering.Metis) mecaStatique = code_aster.LinearStaticAnalysis(monModel, affectMat) mecaStatique.addMechanicalLoad(CharMeca1) mecaStatique.addMechanicalLoad(CharMeca2) mecaStatique.setLinearSolver(monSolver) temps = [0., 0.5, 1.] timeList = code_aster.TimeStepManager() timeList.setTimeList(temps)
affe_mat.addMaterialsOnMesh(acier) affe_mat.buildWithoutExternalVariable() imposed_dof_1 = code_aster.DisplacementReal() imposed_dof_1.setValue(code_aster.PhysicalQuantityComponent.Dx, 0.0) imposed_dof_1.setValue(code_aster.PhysicalQuantityComponent.Dy, 0.0) imposed_dof_1.setValue(code_aster.PhysicalQuantityComponent.Dz, 0.0) char_meca_1 = code_aster.ImposedDisplacementReal(model) char_meca_1.setValue(imposed_dof_1, "Bas") char_meca_1.build() imposed_pres_1 = code_aster.PressureReal() imposed_pres_1.setValue(code_aster.PhysicalQuantityComponent.Pres, 1000.) char_meca_2 = code_aster.DistributedPressureReal(model) char_meca_2.setValue(imposed_pres_1, "Haut") char_meca_2.build() study = code_aster.StudyDescription(model, affe_mat) study.addMechanicalLoad(char_meca_1) study.addMechanicalLoad(char_meca_2) problem = code_aster.DiscreteProblem(study) matr_elem_k = problem.computeMechanicalStiffnessMatrix() solver = code_aster.MumpsSolver(code_aster.Renumbering.Metis) nume_ddl_k = code_aster.DOFNumbering() nume_ddl_k.setElementaryMatrix(matr_elem_k) nume_ddl_k.computeNumbering()
MAYA=code_aster.Mesh() MAYA.readMedFile('xxModalMechanics001a.med') test.assertEqual(MAYA.getType(), "MAILLAGE_SDASTER") CHMAT=AFFE_MATERIAU(MAILLAGE = MAYA, AFFE = _F(TOUT = 'OUI', MATER = MAT,),) POVOL=AFFE_MODELE(MAILLAGE = MAYA, AFFE=_F(TOUT = 'OUI', MODELISATION = '3D', PHENOMENE = 'MECANIQUE',),) imposedPres1 = code_aster.PressureReal() imposedPres1.setValue( code_aster.PhysicalQuantityComponent.Pres, 500000. ) PRESSION = code_aster.DistributedPressureReal(POVOL) PRESSION.setValue( imposedPres1, "PRESSION" ) PRESSION.build() test.assertEqual(PRESSION.getType(), "CHAR_MECA") imposedDof1 = code_aster.DisplacementReal() imposedDof1.setValue( code_aster.PhysicalQuantityComponent.Dy, 0.0 ) CharMeca1 = code_aster.ImposedDisplacementReal(POVOL) CharMeca1.setValue( imposedDof1, "COND1" ) CharMeca1.build() test.assertEqual(CharMeca1.getType(), "CHAR_MECA") imposedDof2 = code_aster.DisplacementReal() imposedDof2.setValue( code_aster.PhysicalQuantityComponent.Dz, 0.0 ) CharMeca2 = code_aster.ImposedDisplacementReal(POVOL) CharMeca2.setValue( imposedDof1, "CONDZG" )