ansys / pymapdl

Pythonic interface to MAPDL
https://mapdl.docs.pyansys.com
MIT License
419 stars 118 forks source link

post_processing.plot_nodal_pressure() fails for CPT element type though data is there. #3051

Open mikerife opened 2 months ago

mikerife commented 2 months ago

🤓 Before submitting the issue

🔍 Description of the bug

PyMAPDL 0.68.1 Get a: raise KeyError(f'Data array ({name}) not present in this dataset.') When plotting nodal pressure for an model with CPT element type and pressure as a DOF activated. Have tried with 2D CPT213 and 3D CPT215. Here is example using CPT213.

🕵️ Steps To Reproduce

from ansys.mapdl.core import launch_mapdl
mapdl = launch_mapdl(loglevel="WARNING", print_com=True, port=50056)
mapdl.clear()
mapdl.units('mks')

# parameters
# loading
Pressure = 10

# geometric
H1 = -10
W1 = 1

# material properties
EXX = 5.8E5
NU = 0.0
permiability = 8.62E-3
biot = 1

mapdl.prep7()

# 2D 8 NODE COUPLED PORE-PRESSURE ELEMENT, plane strain formulation
mapdl.et(1, "CPT213")
mapdl.keyopt(1, 3, 2)
mapdl.keyopt(1, 12, 1)

# material moldel
# linear elastic
mapdl.mp("EX", 1, EXX)
mapdl.mp("NUXY", 1, NU)
# PERMEABILITY
mapdl.tb("PM", 1, "", "", "PERM")
mapdl.tbdata(1, permiability, permiability, permiability)
# BIOT COEFFICIENT
mapdl.tb("PM", 1, "", "", "BIOT")
mapdl.tbdata(1, biot)

# solid model
mapdl.rectng(0, W1, 0, H1)

# set element size and mesh
mapdl.esize(W1)
mapdl.amesh(1)

# HORIZONTAL DOFS ARE CONSTRAINED
mapdl.d("ALL", "UX")

# BOTTOM SURFACE IS CONSTRAINED IN Y DIRECTION
mapdl.nsel("S", "LOC", "Y", H1)
mapdl.d("ALL", "UY", 0)
mapdl.allsel()

# PRESSURE DOF BLOCKED ON TOP SURFACE
mapdl.nsel("S", "LOC", "Y", 0)
mapdl.d("ALL", "PRES", 0)
mapdl.allsel()

mapdl.finish()

# set up for a static unsymmetric solution at time .002 sec
mapdl.slashsolu()
mapdl.antype("STATIC")
mapdl.nropt("UNSYM")
mapdl.time(0.002)

# use 100, 1000, 10 initial, max and min substeps
mapdl.nsubst(100, 1000, 10)

# write out all results at all substeps to the result file
mapdl.outres("ALL", "ALL")

# step change load
mapdl.kbc(1)
# APPLY EXTERNAL LOAD ON TOP SURFACE
mapdl.nsel("S", "LOC", "Y", 0)
mapdl.sf("ALL", "PRES", Pressure)
mapdl.allsel()

mapdl.solve()
mapdl.finish()
mapdl.post1()
mapdl.set('last')

# this returns the pressure data
mapdl.post_processing.nodal_pressure()

# this fails to plot
apdl.post_processing.plot_nodal_pressure()

mapdl.finish()
mapdl.exit

💻 Which Operating System are you using?

Windows

🐍 Which Python version are you using?

3.10

💾 Which MAPDL version are you using?

2023 R2

📝 PyMAPDL Report

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

📝 Installed packages

Show the installed packages! ```text # PASTE HERE THE OUTPUT OF `python -m pip freeze` here ```

📝 Logger output file

Show the logger output file. ```text # PASTE HERE THE CONTENT OF THE LOGGER OUTPUT FILE. ```