コード例 #1
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)

error1 = code_aster.EventError()
action1 = code_aster.SubstepingOnError()
action1.setAutomatic(False)
error1.setAction(action1)
timeList.addErrorManager(error1)
#error2 = code_aster.Studies.ContactDetectionError()
#action2 = code_aster.Studies.SubstepingOnContact()
コード例 #2
0
bc_dirichlet = code_aster.MechanicalDirichletBC(monModel)
bc_dirichlet.addBCOnNodes(code_aster.PhysicalQuantityComponent.Dx, 0.0, "fix")
bc_dirichlet.addBCOnNodes(code_aster.PhysicalQuantityComponent.Dy, 0.0, "fix")
bc_dirichlet.addBCOnNodes(code_aster.PhysicalQuantityComponent.Dz, 0.0, "fix")
bc_dirichlet.build()

load = code_aster.ForceReal()
load.setValue(code_aster.PhysicalQuantityComponent.Fy, -10)

bc_load = code_aster.ForceOnFaceReal(monModel)
bc_load.setValue(load, "force")
bc_load.build()

# linear solver
mongolver = code_aster.MumpsSolver(code_aster.Renumbering.Metis)

# set up analysis
mecaStatique = code_aster.LinearStaticAnalysis(monModel, fieldmat)
mecaStatique.addDirichletBC(bc_dirichlet)
mecaStatique.addLoad(bc_load)
mecaStatique.setLinearSolver(mongolver)

# run the analysis
resu = mecaStatique.execute()

# print the results
resu.printMedFile("cantilever.rmed")

# finalize
code_aster.close()