-
Hello everyone, from ansys.mapdl.core import launch_mapdl
mapdl = launch_mapdl()
mapdl.clear()
mapdl.prep7()
mapdl.et(1, "BEAM188", "", "", "", "", "", 2)
mapdl.mp("EX", 1, 30e6) # Elastic modulus
mapdl.mp("NUXY", 1, 0.25) # Poisson's ratio
#define crosssection
mapdl.sectype(1, "BEAM", "CSOLID", "", 0)
mapdl.secoffset("CENT")
mapdl.secdata(0.2, "", "", 0, 0, 0, 0, 0, 0, 0, 0, 0)
#Create Geometry
mapdl.n(1, 0, 0, 0)
mapdl.n(2, 1, 0, 0)
mapdl.n(3, 2, 0, 0)
mapdl.n(4, 0, 1, -1)
mapdl.n(5, 0, 1, 1)
mapdl.n(6, 0, 1, 2)
mapdl.e(1, 2)
mapdl.e(2, 3)
mapdl.e(4, 5)
mapdl.e(5, 6)
#BCs
mapdl.d(1,'all',0)
mapdl.d(4,'all',0)
mapdl.d(6,"UY", -1.5)
mapdl.allsel()
mapdl.finish()
#Solve
mapdl.slashsolu()
mapdl.solve()
mapdl.finish()
result = mapdl.result
nnum,disp = result.nodal_displacement(0)
print(disp[:,1])
mapdl.exit() Which yields the following output: That is obviously incorrect, as the displacement at node 6 is set to be -1.5. This problem does not occur when I do the calculation in MAPDL, or when I delete the second beam. In those cases, the result is totally fine. I cannot see what goes wrong when I set the same algorithm that works in MAPDL into PyMAPDL. I am running PyMAPDL from PyCharm Community Version 2024.3. Has anyone an idea how this can be fixed? Any help is much appreciated! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Hi @bnret You should use >>> mapdl.post1()
>>> mapdl.set(1,1)
>>> nodal_displacements = mapdl.post_processing.nodal_displacement()
>>> print(nodal_displacements)
[0. 0. 0. 0. 0.73986644 1.5 ] I am not sure why the |
Beta Was this translation helpful? Give feedback.
Hi @bnret
You should use
post_processing
module:I am not sure why the
results
module does not give you the right answer. Maybe @mikerife knows something?