ansys / pymapdl

Pythonic interface to MAPDL

Home Page:https://mapdl.docs.pyansys.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Mesh.grid seems to result in losing the gRPC connection to MAPDL aaS when a non-trivial number of mixed uP elements are present.

mikerife opened this issue Β· comments

πŸ€“ Before submitting the issue

πŸ” Description of the bug

After a solution with mixed uP elements present and after reading the last set of results mapdl.mesh.grid seems to result in a lost connection to the MAPDL aaS instance.

πŸ•΅οΈ Steps To Reproduce

from ansys.mapdl.core import launch_mapdl
import matplotlib.pyplot as plt
import pyvista as pv
import math
mapdl = launch_mapdl(port=50056, additional_switches='-smp')
mapdl.clear()

mapdl.units('mpa')
# material
C1 = 0.293
C2 = 0.177
NU1 = 0.49967
D1 = (1-2*NU1)/(C1+C2)

mapdl.prep7()

# 3D 8NODE STRUCTURAL SOLID mixed uP formulation
mapdl.et(1, "SOLID185")
mapdl.keyopt(1, 6, 1)

# mooney-rivlin material model
mapdl.tb("HYPER", 1, 1, 2, "MOONEY")
mapdl.tbdata(1, C1, C2, D1)

mapdl.block(0, 1, 0, 1, 0, 1)

mapdl.esize("", 10)
mapdl.smrtsize("off")
mapdl.type(1)
mapdl.vmesh("ALL")

mapdl.nsel("S", "LOC", "X", 0)
mapdl.d("ALL", "UX")
mapdl.nsel("S", "LOC", "Z", 0)
mapdl.d('all', 'uz', 0)
mapdl.nsel("S", "LOC", "Y", 0)
mapdl.d('ALL', "UY", 0)
mapdl.nsel("ALL")

mapdl.shpp('off')
mapdl.finish()

mapdl.slashsolu()

mapdl.antype("STATIC")
mapdl.nlgeom("ON")
mapdl.time(1)
mapdl.autots('off')
mapdl.nsubst(10)

# apply displacement
mapdl.nsel('s', 'loc', 'y', 1)
mapdl.d('all', "UY", -.1)
mapdl.allsel()
# write results to result file at every sub step
mapdl.outres("", 1)

mapdl.solve()
mapdl.finish()

mapdl.post1()
mapdl.set('last')
mesh1 = mapdl.mesh.grid

# am gathering undeformed and deformed mesh for PyVista plotting so next commands would be
# mapdl.upcoord(1)
# mesh1 = mapdl.mesh.grid
# mapdl.upcoord(-1)

πŸ’» Which Operating System are you using?

Windows

🐍 Which Python version are you using?

3.10

πŸ“ PyMAPDL Report

Show the Report!

# PASTE HERE THE OUTPUT OF `python -c "from ansys.mapdl import core as pymapdl; print(pymapdl.Report())"` here

πŸ“ Installed packages

Show the installed packages!

# PASTE HERE THE OUTPUT OF `python -m pip freeze` here

πŸ“ Logger output file

Show the logger output file.

# PASTE HERE THE CONTENT OF THE LOGGER OUTPUT FILE.

Interestingly, I'm getting segmentation fault:

(.venv_macos) pymapdl git:(main) $ python ./tmp/main.py
[1]    4460 segmentation fault  python ./tmp/main.py

All because of the last uncommented line:

mesh1 = mapdl.mesh.grid

I do not understand why having complex material models would make retrieving the meshing to fail... retrieving the meshing only depends on the type of element, solid186 in this case, which is fairly tested.

@germa89 the element formulation has an 'internal' node with DOF of pressure. If you change the esize to 1 and retry, the mesh.grid will work. Staring at this I am not sure why it does not work at first (1000 elements) but also not sure why it works with 1 element.