Open
Description
🤓 Before submitting the issue
- I have visited the Troubleshooting section.
- I have searched among the existing issues.
- I am using a Python virtual environment.
- I am using the latest version of PyMAPDL and its dependencies (fully updated virtual environment). You can update them using
pip install --upgrade --upgrade-strategy eager ansys-mapdl-core
in your activated virtual environment.
🔍 Description of the bug
A model has multiple parts and a sub-set of elements select. The JT,SUM is then retrieved with PyMAPDL post processing. After the set of elements selected has changed. If you run the (sorry it's kind of long) example the 4th print will have a different number of selected elements. Also the set of elements is those of material 3, and not material 4.
🕵️ Steps To Reproduce
from ansys.mapdl.core import launch_mapdl
import matplotlib.pyplot as plt
import pyvista as pv
import numpy as np
mapdl = launch_mapdl(loglevel="WARNING", print_com=True, port=50056)
# parameters
# meshing
SMT = 10
# COIL
TCUR = 5000 # INPUT CURRENT amp-turns
AREA = (18*96.6)*.001**2 # AREA
CURDEN = TCUR/AREA # CURRENT DENSITY
# material
# steel BH
H_1 = [355, 405, 470, 555, 673, 836, 1065, 1220, 1420, 1720, 2130, 2670,
3480, 4500, 5950, 7650, 10100, 13000, 15900, 21100, 26300, 32900, 42700,
61700, 84300, 110000, 135000, 200000, 400000, 800000]
B_1 = [.7, .8, .9, 1., 1.1, 1.2, 1.3, 1.35, 1.4, 1.45, 1.5, 1.55, 1.6, 1.65,
1.70, 1.75, 1.8, 1.85, 1.9, 1.95, 2., 2.05, 2.1, 2.15, 2.2, 2.25, 2.3,
2.41, 2.69, 3.22]
mapdl.prep7()
# use 10 node tetrahedral shape element to mesh
mapdl.et(1, "MESH200", 9)
# material models
# air
mapdl.mp("MURX", 1, 1)
# steel center pole
mapdl.tb("BH", 2, "", len(B_1))
for pt in range(len(B_1)):
mapdl.tbpt("defi", H_1[pt], B_1[pt])
plt.plot(H_1, B_1, label='BH Material 2 & 3')
plt.xlabel("H")
plt.ylabel("B")
plt.legend()
plt.show()
# steel yoke copied from center pole
mapdl.tbcopy("BH", 2, 3)
# arm
mapdl.mp("MURX", 4, 1)
mapdl.mp("RSVX", 4, 1E-7)
# Create PATH NODES FOR POSTPROCESSING
mapdl.n(1, 0, 0, 75/1000)
mapdl.n(2, 63.5/1000, 0, 75/1000)
# solid model
# pole
mapdl.block(0, 63.5, 0, 25/2, 0, 25)
mapdl.block(38.5, 63.5, 0, 25/2, 25, 125)
mapdl.block(13.5, 63.5, 0, 25/2, 125, 150)
mapdl.vglue("ALL")
# armature
mapdl.block(0, 12.5, 0, 5, 26.5, 125)
# air
mapdl.block(0, 13, 0, 5.5, 26, 125+.5)
mapdl.vovlap(1, 2)
mapdl.numcmp("VOLU")
# yoke
mapdl.block(39/2, 75/2, 0, 14.5, 25+1.7, 125-1.7)
mapdl.block(0, 14.5, 39/2, 75/2, 25+1.7, 125-1.7)
# create coordinate systems
mapdl.local(11, 1, 14.5, 14.5, 25+1.7)
mapdl.local(12, 1, .0145, .0145, .001*(25+1.7))
mapdl.csys(11)
mapdl.wpcsys(11)
mapdl.cyl4("", "", 5, 0, 23, 90, (125-1.7)-(25+1.7))
mapdl.vglue(6, 8)
mapdl.numcmp("VOLU")
mapdl.csys(0)
mapdl.wpcsys(0)
mapdl.cyl4("", "", 0, 0, 100, 90, 175)
mapdl.vovlap("ALL")
mapdl.numcmp("ALL")
# set volume attributes
# armature
mapdl.vsel("S", "VOLU", "", 1)
mapdl.vatt(3, 1, 1)
# pole
mapdl.vsel("S", "VOLU", "", 3, 5)
mapdl.vatt(2, 1, 1)
# coil +y side
mapdl.vsel("S", "VOLU", "", 6)
mapdl.vatt(4, 2, 1)
# coil -x side
mapdl.vsel("S", "VOLU", "", 7)
mapdl.vatt(4, 4, 1)
# coil +y theta
mapdl.vsel("S", "VOLU", "", 8)
mapdl.vatt(4, 3, 1)
mapdl.allsel("ALL")
# use smart sizing and free mesh all volumes
mapdl.smrtsize(SMT)
mapdl.mshkey(0)
mapdl.vmesh("ALL")
# define component for pole force extraction
mapdl.esel("S", "MAT", "", 3)
mapdl.cm("ARM", "ELEM")
mapdl.allsel("ALL")
# scale to meters
mapdl.vlscale("ALL", "", "", .001, .001, .001, "", 0, 1)
mapdl.csys(0)
mapdl.allsel("ALL")
# CREATE CURRENT DENSITY LOADING IN THE COIL
# change element type to 10 node tetrahedral with volt dof
mapdl.et(1, "SOLID232")
# create voltage grounding and coupling on coil
mapdl.esel("S", "MAT", "", 4)
mapdl.nsle()
mapdl.nsel("R", "LOC", "X", 0)
mapdl.d("ALL", "VOLT", 0)
mapdl.nsle()
mapdl.nsel("R", "LOC", "Y", 0)
mapdl.cp(1, "VOLT", "ALL")
# retrieve lowest number node for current application
node_load = mapdl.queries.ndnext(0)
mapdl.f(node_load, "AMPS", TCUR)
mapdl.nsle()
mapdl.finish()
# perform a static solution on just the coil elements
mapdl.slashsolu()
mapdl.antype('static')
mapdl.time(1)
mapdl.solve()
mapdl.finish()
mapdl.post1()
mapdl.set(1)
print(1, len(mapdl.mesh.elem))
grid = mapdl.mesh.grid
print(2, len(mapdl.mesh.elem))
centers = np.array(grid.cell_centers().points)
print(3, len(mapdl.mesh.elem))
JT_Sum = mapdl.post_processing.element_values('JT', 'SUM')
print(4, len(mapdl.mesh.elem))
💻 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!
# 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.
Metadata
Metadata
Assignees
Labels
No labels