ansys / pymapdl

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

Plot of additional volumes VGEN not possible #1263

Closed herttim closed 2 years ago

herttim commented 2 years ago

Before submitting the issue

Description of the bug

I want to create a rotationally symmetric model of the rollers about the x-axis (see picture). Therefore, I´ve implemented a new local COS to transform the whole geometry. I have done this, because a rotation arround the x-axis is not directly possible. While plotting the model, PyAPDL doesn´t show the geometry anymore.

Wälzlager_Modell

Steps To Reproduce

`from ansys.mapdl.core import launch_mapdl

mapdl = launch_mapdl()

mapdl.prep7() mapdl.units("SI") # SI - International system (m, kg, s, K).

define a SOLID185 element type for ET1

mapdl.et(1, "SOLID185")

define material ET1 (nominal still in SI)

mapdl.mp("EX", 1, 210e9) # Elastic moduli in Pa (kg/(m*s**2)) mapdl.mp("DENS", 1, 7800) # Density in kg/m3 mapdl.mp("NUXY", 1, 0.3) # Poisson's Ratio

define material ET2 (nominal still in SI)

mapdl.mp("EX", 2, 210e9) # Elastic moduli in Pa (kg/(m*s**2)) mapdl.mp("DENS", 2, 7800) # Density in kg/m3 mapdl.mp("NUXY", 2, 0.3) # Poisson's Ratio #################################### anzahl_scheiben = 30

########### INNENRING ##############

di = 0.065 #Innen-Durchmesser Lagersitz bi = 0.041 #Breite Lagersitz α = 7.6 #Druckwinkel β = 9.6 #Hilfswinkel

o = 0.009238 p = 0.008282 q = 0.003962 r = 0.000671 s = 0.02539 t = 0.003391 v = 0.005083 w = 0.00079 #0.00086 b = 0.006658

mapdl.k(13, 0, 0, 0) mapdl.k(14, -0.005, 0, 0) mapdl.k(15, 0.005, 0, 0) mapdl.l(14, 15)

Grundgeometrie des Innenrings

mapdl.k(1, 0, di/2, 0) mapdl.k(2, 0, di/2+o, 0) mapdl.k(3, p, di/2+o, 0) mapdl.k(4, p+r, di/2+o-q, 0) mapdl.k(5, p+r+s, di/2+o-q+t, 0) mapdl.k(6, p+r+s-w, di/2+o-q+t+v, 0) mapdl.k(7, p+r+s+b, di/2+o-q+t+v, 0) mapdl.k(8, bi, di/2, 0)

mapdl.l(1, 2) mapdl.l(2, 3) mapdl.l(3, 4) l1_i = mapdl.l(4, 5) mapdl.l(5, 6) mapdl.l(6, 7) mapdl.l(7, 8) mapdl.l(8, 1)

a1 = mapdl.a(1, 2, 3, 4, 5, 6, 7, 8)

########### AUßENRING ###############

ba = 0.032 #Breite Lagersitz

c = 0.00732 e = 0.010942 f1 = 0.032 g = 0.00439 da = di+2*(o+c+e) #Außen-Durchmesser

mapdl.k(9, 0, di/2+o+c, 0) mapdl.k(10, 0, da/2, 0) mapdl.k(11, f1, da/2, 0) mapdl.k(12, f1, da/2-g, 0) mapdl.k(16, f1-0.000102, da/2-0.00439, 0) mapdl.k(17, f1-0.025245, da/2-0.00955, 0)

mapdl.l(9, 10) l_a_f = mapdl.l(10, 11) mapdl.l(11, 12) mapdl.l(12, 16) l1_a = mapdl.l(16, 17) mapdl.l(17, 9)

a2 = mapdl.a(9, 10, 11, 12, 16, 17)

mapdl.lesize(nl1=5, ndiv=anzahl_scheiben-1) mapdl.lesize(nl1=14, ndiv=anzahl_scheiben-1)

########### Extrudieren ############## mapdl.vrotat(a1, pax1=14, pax2=15, arc=360, nseg=16) mapdl.vrotat(a2, pax1=14, pax2=15, arc=360, nseg=16)

######### KEGELROLLE ################# f2 = 0.044114 a1 = 0.004275 a2 = 0.00788 m1 = 0.025241 h = 0.006887 a3 = 0.005862 a4 = 0.006707 a5 = 0.001135

mapdl.k(2000000, a2, f2, 0) mapdl.k(2100000, a2+m1, f2+a1, 0) mapdl.k(3000000, h, f2+a3, 0) mapdl.k(3100000, a2+m1-a5, f2+a1+a4, 0)

l1_k = mapdl.l(2000000, 3000000) l2_k = mapdl.l(3000000, 3100000) mapdl.l(3100000, 2100000) l3_k = mapdl.l(2000000, 2100000)

a3 = mapdl.a(2000000, 3000000, 3100000, 2100000)

mapdl.lesize(nl1=l2_k, ndiv=anzahl_scheiben-1) mapdl.lesize(nl1=l1_k, ndiv=anzahl_scheiben-1, space=0.2)

########### Extrudieren ############## Kegelrolle mapdl.vsel("NONE") k_rot = mapdl.vrotat(a3, pax1=2000000, pax2=2100000, arc=360, nseg=2) mapdl.vsweep("ALL")

Muster

mapdl.vsel("ALL")

mapdl.lplot(vtk=True, show_keypoint_numbering=True)

mapdl.vplot(vtk=True, show_area_numbering=True, show_line_numbering=False)

vnum = mapdl.geometry.vnum print(vnum)

mapdl.clocal(kcn=11, kcs=1, xl=0, yl=0, zl=0, thxy=90) mapdl.vtran(kcnto=11, nv1="ALL", noelem=0, imove=1)

mapdl.vsel("S", "VOLU", vmin=34, vmax=34) mapdl.vgen(itime=16, nv1="ALL", dz=360/16, imove=0)

mapdl.vsel("ALL") print(mapdl.geometry.vnum) mapdl.vplot(vtk=True)

mapdl.exit()`

Which Operating System are you using?

Windows

Which Python version are you using?

3.8

Installed packages

aiohttp==3.8.1 aiosignal==1.2.0 alabaster @ file:///home/ktietz/src/ci/alabaster_1611921544520/work anaconda-client==1.7.2 anaconda-navigator==2.0.3 anaconda-project @ file:///tmp/build/80754af9/anaconda-project_1610472525955/work ansys-api-mapdl==0.5.1 ansys-corba==0.1.1 ansys-dpf-core==0.4.0 ansys-grpc-dpf==0.4.0 ansys-mapdl-core==0.61.3 ansys-mapdl-reader==0.51.11 anyio @ file:///C:/ci/anyio_1620153418380/work/dist appdirs==1.4.4 argh==0.26.2 argon2-cffi @ file:///C:/ci/argon2-cffi_1613037959010/work asn1crypto @ file:///tmp/build/80754af9/asn1crypto_1596577642040/work astroid @ file:///C:/ci/astroid_1613501047216/work astropy @ file:///C:/ci/astropy_1617745647203/work async-generator @ file:///home/ktietz/src/ci/async_generator_1611927993394/work async-timeout==4.0.2 atomicwrites==1.4.0 attrs @ file:///tmp/build/80754af9/attrs_1604765588209/work autopep8 @ file:///tmp/build/80754af9/autopep8_1615918855173/work Babel @ file:///tmp/build/80754af9/babel_1607110387436/work backcall @ file:///home/ktietz/src/ci/backcall_1611930011877/work backports.functools-lru-cache @ file:///tmp/build/80754af9/backports.functools_lru_cache_1618170165463/work backports.shutil-get-terminal-size @ file:///tmp/build/80754af9/backports.shutil_get_terminal_size_1608222128777/work backports.tempfile @ file:///home/linux1/recipes/ci/backports.tempfile_1610991236607/work backports.weakref==1.0.post1 bcrypt @ file:///C:/ci/bcrypt_1597936263757/work beautifulsoup4 @ file:///home/linux1/recipes/ci/beautifulsoup4_1610988766420/work bitarray @ file:///C:/ci/bitarray_1618435038389/work bkcharts==0.2 black==19.10b0 bleach @ file:///tmp/build/80754af9/bleach_1612211392645/work bokeh @ file:///C:/ci/bokeh_1620784067744/work boto==2.49.0 Bottleneck==1.3.2 brotlipy==0.7.0 cachetools==5.0.0 certifi==2021.10.8 cffi @ file:///C:/ci/cffi_1613247279197/work chardet @ file:///C:/ci/chardet_1607690654534/work charset-normalizer==2.0.12 click @ file:///home/linux1/recipes/ci/click_1610990599742/work cloudpickle @ file:///tmp/build/80754af9/cloudpickle_1598884132938/work clyent==1.2.2 colorama @ file:///tmp/build/80754af9/colorama_1607707115595/work comtypes==1.1.9 conda==4.12.0 conda-build==3.21.4 conda-content-trust @ file:///tmp/build/80754af9/conda-content-trust_1617045594566/work conda-package-handling @ file:///C:/ci/conda-package-handling_1649105961774/work conda-repo-cli @ file:///tmp/build/80754af9/conda-repo-cli_1620168426516/work conda-token @ file:///tmp/build/80754af9/conda-token_1620076980546/work conda-verify==3.4.2 contextlib2==0.6.0.post1 cryptography @ file:///C:/ci/cryptography_1616769344312/work cycler==0.10.0 Cython @ file:///C:/ci/cython_1618435363327/work cytoolz==0.11.0 dask @ file:///tmp/build/80754af9/dask-core_1617390489108/work decorator @ file:///tmp/build/80754af9/decorator_1617916966915/work defusedxml @ file:///tmp/build/80754af9/defusedxml_1615228127516/work diff-match-patch @ file:///tmp/build/80754af9/diff-match-patch_1594828741838/work distributed @ file:///C:/ci/distributed_1617384289923/work docutils @ file:///C:/ci/docutils_1617481617511/work entrypoints==0.3 et-xmlfile==1.0.1 fastcache==1.1.0 filelock @ file:///home/linux1/recipes/ci/filelock_1610993975404/work flake8 @ file:///tmp/build/80754af9/flake8_1615834841867/work Flask @ file:///home/ktietz/src/ci/flask_1611932660458/work frozenlist==1.3.0 fsspec @ file:///tmp/build/80754af9/fsspec_1617959894824/work future==0.18.2 geomdl==5.3.1 gevent @ file:///C:/ci/gevent_1616773090559/work glob2 @ file:///home/linux1/recipes/ci/glob2_1610991677669/work gmpy2 @ file:///C:/ci/gmpy2_1645456279018/work google-api-core==2.7.1 google-api-python-client==2.43.0 google-auth==2.6.2 google-auth-httplib2==0.1.0 googleapis-common-protos==1.56.0 greenlet @ file:///C:/ci/greenlet_1611958565931/work grpcio==1.44.0 h5py==2.10.0 HeapDict==1.0.1 html5lib @ file:///tmp/build/80754af9/html5lib_1593446221756/work httplib2==0.20.4 idna @ file:///home/linux1/recipes/ci/idna_1610986105248/work imagecodecs @ file:///C:/ci/imagecodecs_1617996768495/work imageio @ file:///tmp/build/80754af9/imageio_1617700267927/work imagesize @ file:///home/ktietz/src/ci/imagesize_1611921604382/work importlib-metadata==4.11.3 iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work intervaltree @ file:///tmp/build/80754af9/intervaltree_1598376443606/work ipykernel @ file:///C:/ci/ipykernel_1596190155316/work/dist/ipykernel-5.3.4-py3-none-any.whl ipython @ file:///C:/ci/ipython_1617121002983/work ipython-genutils @ file:///tmp/build/80754af9/ipython_genutils_1606773439826/work ipywidgets @ file:///tmp/build/80754af9/ipywidgets_1610481889018/work isort @ file:///tmp/build/80754af9/isort_1616355431277/work itsdangerous @ file:///home/ktietz/src/ci/itsdangerous_1611932585308/work jdcal==1.4.1 jedi @ file:///C:/ci/jedi_1606914528444/work Jinja2 @ file:///tmp/build/80754af9/jinja2_1612213139570/work joblib @ file:///tmp/build/80754af9/joblib_1613502643832/work json5==0.9.5 jsonschema @ file:///tmp/build/80754af9/jsonschema_1602607155483/work jupyter==1.0.0 jupyter-client==5.3.4 jupyter-console @ file:///tmp/build/80754af9/jupyter_console_1616615302928/work jupyter-core @ file:///C:/ci/jupyter_core_1612213356021/work jupyter-packaging @ file:///tmp/build/80754af9/jupyter-packaging_1613502826984/work jupyterlab==2.3.1 jupyterlab-pygments @ file:///tmp/build/80754af9/jupyterlab_pygments_1601490720602/work jupyterlab-server @ file:///tmp/build/80754af9/jupyterlab_server_1594164409481/work jupyterlab-widgets @ file:///tmp/build/80754af9/jupyterlab_widgets_1609884341231/work keyring @ file:///C:/ci/keyring_1614616910860/work kiwisolver @ file:///C:/ci/kiwisolver_1612282606037/work lazy-object-proxy @ file:///C:/ci/lazy-object-proxy_1616529307648/work libarchive-c @ file:///tmp/build/80754af9/python-libarchive-c_1617780486945/work llvmlite==0.36.0 locket==0.2.1 lxml @ file:///C:/ci/lxml_1616443455957/work MarkupSafe==1.1.1 matplotlib @ file:///C:/ci/matplotlib-suite_1613408055530/work mccabe==0.6.1 menuinst==1.4.16 mistune==0.8.4 mkl-fft==1.3.0 mkl-random @ file:///C:/ci/mkl_random_1618854156666/work mkl-service==2.3.0 mock @ file:///tmp/build/80754af9/mock_1607622725907/work more-itertools @ file:///tmp/build/80754af9/more-itertools_1613676688952/work mpmath==1.2.1 msgpack @ file:///C:/ci/msgpack-python_1612287368835/work multidict==6.0.2 multipledispatch==0.6.0 mypy-extensions==0.4.3 navigator-updater==0.2.1 nbconvert==5.6.1 nbformat @ file:///tmp/build/80754af9/nbformat_1617383369282/work nest-asyncio @ file:///tmp/build/80754af9/nest-asyncio_1613680548246/work networkx @ file:///tmp/build/80754af9/networkx_1598376031484/work nltk @ file:///tmp/build/80754af9/nltk_1618327084230/work nose @ file:///tmp/build/80754af9/nose_1606773131901/work notebook @ file:///C:/ci/notebook_1616443715883/work numba @ file:///C:/ci/numba_1616774458845/work numexpr @ file:///C:/ci/numexpr_1618856738664/work numpy==1.22.3 numpydoc @ file:///tmp/build/80754af9/numpydoc_1605117425582/work olefile==0.46 openpyxl @ file:///tmp/build/80754af9/openpyxl_1615411699337/work packaging @ file:///tmp/build/80754af9/packaging_1611952188834/work pandas @ file:///C:/ci/pandas_1618365634936/work pandocfilters @ file:///C:/ci/pandocfilters_1605102497129/work paramiko @ file:///tmp/build/80754af9/paramiko_1598886428689/work parso==0.7.0 partd @ file:///tmp/build/80754af9/partd_1618000087440/work path @ file:///C:/ci/path_1614022440181/work pathlib2 @ file:///C:/ci/pathlib2_1607025069150/work pathspec==0.7.0 pathtools @ file:///Users/ktietz/demo/mc3/conda-bld/pathtools_1629713893697/work patsy==0.5.1 pep8==1.7.1 pexpect @ file:///tmp/build/80754af9/pexpect_1605563209008/work pickleshare @ file:///tmp/build/80754af9/pickleshare_1606932040724/work Pillow @ file:///C:/ci/pillow_1617386341487/work pkginfo==1.7.0 pluggy @ file:///C:/ci/pluggy_1615976358795/work plumbum==1.7.2 ply==3.11 progressbar2==4.0.0 prometheus-client @ file:///tmp/build/80754af9/prometheus_client_1618088486455/work prompt-toolkit @ file:///tmp/build/80754af9/prompt-toolkit_1616415428029/work protobuf==3.20.1 psutil @ file:///C:/ci/psutil_1612298324802/work ptyprocess @ file:///tmp/build/80754af9/ptyprocess_1609355006118/work/dist/ptyprocess-0.7.0-py2.py3-none-any.whl py @ file:///tmp/build/80754af9/py_1607971587848/work pyaedt==0.4.50 pyasn1==0.4.8 pyasn1-modules==0.2.8 pycodestyle @ file:///home/ktietz/src/ci_mi/pycodestyle_1612807597675/work pycosat==0.6.3 pycparser @ file:///tmp/build/80754af9/pycparser_1594388511720/work pycurl==7.43.0.6 pydocstyle @ file:///tmp/build/80754af9/pydocstyle_1616182067796/work pyerfa @ file:///C:/ci/pyerfa_1619391071834/work pyflakes @ file:///home/ktietz/src/ci_ipy2/pyflakes_1612551159640/work Pygments @ file:///tmp/build/80754af9/pygments_1615143339740/work pyiges==0.2.1 pylint @ file:///C:/ci/pylint_1617136058775/work pyls-black @ file:///tmp/build/80754af9/pyls-black_1607553132291/work pyls-spyder @ file:///tmp/build/80754af9/pyls-spyder_1613849700860/work PyNaCl @ file:///C:/ci/pynacl_1595000047588/work pyodbc===4.0.0-unsupported pyOpenSSL @ file:///tmp/build/80754af9/pyopenssl_1608057966937/work pyparsing @ file:///home/linux1/recipes/ci/pyparsing_1610983426697/work pyreadline==2.1 pyrsistent @ file:///C:/ci/pyrsistent_1600141795814/work PySocks @ file:///C:/ci/pysocks_1605287845585/work pytest==6.2.3 python-dateutil @ file:///home/ktietz/src/ci/python-dateutil_1611928101742/work python-jsonrpc-server @ file:///tmp/build/80754af9/python-jsonrpc-server_1600278539111/work python-language-server @ file:///tmp/build/80754af9/python-language-server_1607972495879/work python-utils==3.1.0 pythonnet==2.5.2 pytz @ file:///tmp/build/80754af9/pytz_1612215392582/work pyvista==0.33.3 PyWavelets @ file:///C:/ci/pywavelets_1601658407916/work pywin32==303 pywin32-ctypes==0.2.0 pywinpty==0.5.7 PyYAML==5.4.1 pyzmq==20.0.0 QDarkStyle==2.8.1 QtAwesome @ file:///tmp/build/80754af9/qtawesome_1615991616277/work qtconsole @ file:///tmp/build/80754af9/qtconsole_1616775094278/work QtPy==1.9.0 regex @ file:///C:/ci/regex_1617569893741/work requests @ file:///tmp/build/80754af9/requests_1608241421344/work rope @ file:///tmp/build/80754af9/rope_1602264064449/work rpyc==5.0.1 rsa==4.8 Rtree @ file:///C:/ci/rtree_1618421009405/work ruamel-yaml-conda @ file:///C:/ci/ruamel_yaml_1616016967756/work scikit-image==0.18.1 scikit-learn @ file:///C:/ci/scikit-learn_1614446896245/work scipy @ file:///C:/ci/scipy_1618856128765/work scooby==0.5.12 seaborn @ file:///tmp/build/80754af9/seaborn_1608578541026/work Send2Trash @ file:///tmp/build/80754af9/send2trash_1607525499227/work simplegeneric==0.8.1 singledispatch @ file:///tmp/build/80754af9/singledispatch_1614366001199/work sip==4.19.13 six @ file:///C:/ci/six_1605187374963/work sniffio @ file:///C:/ci/sniffio_1614030707456/work snowballstemmer @ file:///tmp/build/80754af9/snowballstemmer_1611258885636/work sortedcollections @ file:///tmp/build/80754af9/sortedcollections_1611172717284/work sortedcontainers @ file:///tmp/build/80754af9/sortedcontainers_1606865132123/work soupsieve @ file:///tmp/build/80754af9/soupsieve_1616183228191/work Sphinx @ file:///tmp/build/80754af9/sphinx_1620777493457/work sphinxcontrib-applehelp @ file:///home/ktietz/src/ci/sphinxcontrib-applehelp_1611920841464/work sphinxcontrib-devhelp @ file:///home/ktietz/src/ci/sphinxcontrib-devhelp_1611920923094/work sphinxcontrib-htmlhelp @ file:///home/ktietz/src/ci/sphinxcontrib-htmlhelp_1611920974801/work sphinxcontrib-jsmath @ file:///home/ktietz/src/ci/sphinxcontrib-jsmath_1611920942228/work sphinxcontrib-qthelp @ file:///home/ktietz/src/ci/sphinxcontrib-qthelp_1611921055322/work sphinxcontrib-serializinghtml @ file:///home/ktietz/src/ci/sphinxcontrib-serializinghtml_1611920755253/work sphinxcontrib-websupport @ file:///tmp/build/80754af9/sphinxcontrib-websupport_1597081412696/work spyder @ file:///C:/ci/spyder_1616776239898/work spyder-kernels @ file:///C:/ci/spyder-kernels_1614030842607/work SQLAlchemy @ file:///C:/ci/sqlalchemy_1618090063261/work statsmodels==0.12.2 sympy @ file:///C:/ci/sympy_1618255511605/work tables==3.6.1 tblib @ file:///tmp/build/80754af9/tblib_1597928476713/work terminado==0.9.4 testpath @ file:///home/ktietz/src/ci/testpath_1611930608132/work textdistance @ file:///tmp/build/80754af9/textdistance_1612461398012/work threadpoolctl @ file:///tmp/tmp9twdgx9k/threadpoolctl-2.1.0-py3-none-any.whl three-merge @ file:///tmp/build/80754af9/three-merge_1607553261110/work tifffile @ file:///tmp/build/80754af9/tifffile_1619636090847/work toml @ file:///tmp/build/80754af9/toml_1616166611790/work toolz @ file:///home/linux1/recipes/ci/toolz_1610987900194/work tornado @ file:///C:/ci/tornado_1606942392901/work tqdm @ file:///tmp/build/80754af9/tqdm_1615925068909/work traitlets @ file:///home/ktietz/src/ci/traitlets_1611929699868/work typed-ast @ file:///C:/ci/typed-ast_1610466535590/work typing-extensions @ file:///home/ktietz/src/ci_mi/typing_extensions_1612808209620/work ujson @ file:///C:/ci/ujson_1611241570789/work unicodecsv==0.14.1 uritemplate==4.1.1 urllib3 @ file:///tmp/build/80754af9/urllib3_1615837158687/work vtk==9.1.0 watchdog @ file:///C:/ci/watchdog_1612471251191/work wcwidth @ file:///tmp/build/80754af9/wcwidth_1593447189090/work webencodings==0.5.1 Werkzeug @ file:///home/ktietz/src/ci/werkzeug_1611932622770/work widgetsnbextension==3.5.1 win-inet-pton @ file:///C:/ci/win_inet_pton_1605306167264/work win-unicode-console==0.5 wincertstore==0.2 wrapt==1.12.1 wslink==1.5.3 xlrd @ file:///tmp/build/80754af9/xlrd_1608072521494/work XlsxWriter @ file:///tmp/build/80754af9/xlsxwriter_1617224712951/work xlwings==0.23.0 xlwt==1.3.0 xmltodict @ file:///Users/ktietz/demo/mc3/conda-bld/xmltodict_1629301980723/work yapf @ file:///tmp/build/80754af9/yapf_1615749224965/work yarl==1.7.2 zict==2.0.0 zipp @ file:///tmp/build/80754af9/zipp_1615904174917/work zope.event==4.5.0 zope.interface @ file:///C:/ci/zope.interface_1616357322857/work

mikerife commented 2 years ago

Hi @herttim The volumes were plotted, but the working coordinate system was not changed so the VGEN resulted in the volumes being created along a straight path. Zoomed out the volumes appear so small you can't see them. And zoomed in they are not on the screen. In the input file the coordinate system needs to be changed, and the VGEN command changed so that the location increments are along DY which is local theta direction. Additionally the local coordinate system is not defined such that the axis is aligned as you expect, so the volumes are not in the correct plane.

image

Resulting volumes from changes:

image

Mike

herttim commented 2 years ago

Hi @mikerife thanks for your reply, that helps me a lot 👍 Now it is working perfectly fine.