Open Telos4 opened 1 year ago
Hi @Telos4, The root of the issue is actually within https://github.com/ansys/pymapdl, where we force all elements to be linear in:
where we force all cell types to be their linear counterparts with force_linear=True
, which I think was done for plotting. The side effect of this is that when writing the output as an archive file it will be written incorrectly.
In the meantime, you can override this behavior with:
import pyvista as pv
...
# export APDL mesh to VTK
grid = mapdl.mesh.grid
# convert any linear tetrahedron to quadratic tetrahedron
grid.celltypes[grid.celltypes == pv.CellType.TETRA] = pv.CellType.QUADRATIC_TETRA
...
@germa89, I recommend we set force_linear=False
(default). This may affect plotting, so we might consider always storing the right representation as grid
and then using linear_copy during plotting.
Thank you @akaszynski !!
I will transfer this issue to PyMAPDL then.
I think we are going to attack this issue later in the year, when we start to work on the MAPDL backend.
🔍 Before submitting the issue
🐞 Description of the bug
I've encountered an issue when trying to write a CDB file containing
SOLID187
elements using theansys.mapdl.reader.archive.save_as_archive()
function. Apparently, when writing apyvista
mesh of these elements, the mid-nodes get discarded.I'm creating a tetrahedral mesh consisting of
SOLID187
elements usingpymapdl
:The elements are 10-node elements with mid-nodes in between the corner elements:
The last 10 entries of this vector are the node numbers that make up a single
SOLID187
element. When saving this mesh as CDB file from APDL using theCDWRITE
command the resulting element entries in the file also have 10 unique nodes:Next, I'm converting converting the APDL mesh to a
pyvista
/VTK
mesh (in my case I want to do some modifications / label certain parts of the mesh using python). Inpyvista
, each element still is made up of 10 unique nodes (4 nodes at the corners, 6 mid-nodes) as confirmed by the inspection of the node data:Here's a visualization:
However, if I now save the
pyvista
mesh as aCDB
file usingansys.mapdl.reader.archive.save_as_archive()
the resulting elements only contain 4 unique nodes while the rest are duplicates of other nodes (similiar to if they wereSOLID185
elements in the tedrahedral configuration):Is there a way to output a
CDB
file forSOLID187
elements with the correct nodes (including the mid-nodes)?📝 Steps to reproduce
Full code to reproduce the above results:
💻 Which operating system are you using?
Linux
📀 Which ANSYS version are you using?
2023 R1
🐍 Which Python version are you using?
3.10
📦 Installed packages