ansys / pymechanical

Pythonic interface to Ansys Mechanical ™
https://mechanical.docs.pyansys.com/
MIT License
38 stars 19 forks source link

Bug located in "Ansys Mechanical" or "MAPDL" #276

Closed The-Limo closed 1 year ago

The-Limo commented 1 year ago

🔍 Before submitting the issue

🐞 Description of the bug

"MAPDL" and "Ansys Mechanical" simulation result in different results.

📝 Steps to reproduce

Hey everyone, for an automation where a step file is imported, boundary conditions are defined, a mesh is generated, and a rotation speed is applied, I created a MAPDL script. You can find the file in the attachment called "main.py". The simulation results with a von-Misis stress of about 156MPa. You can also find in the attachment the imported Step file with the name: "File_Export_No_Mag.step".

In the aftermath I wanted to verify the result and I created the Model in "Ansys Mechanical" again. Via the workbench. You can find the file in the attachment as well (Workbench.wbpj). Unfortunately, I got different results (about 92,4MPa), and I'm not sure why, as the solver and boundary conditions are the same.

I am well aware that the two meshes do not match 100% (lack of knowledge), but the results should not differ that much.

In addition to this question, I would like to know which platform (MAPDL or Mechanical direct) is better for the problem mentioned? We would like to simulate thousands of similar structures simulated, changing the angle and the inner circle diameter where the boundary condition is applied and the rotation speed.

main.zip

Mechanical_Result Ansys Mechanical Result Deformed 500x

PY_MAPDL_Result Ansys MAPDL Result Deformed 500x

💻 Which operating system are you using?

Windows

📀 Which ANSYS version are you using?

2023 R1

🐍 Which Python version are you using?

3.10

📦 Installed packages

ansys-api-fluent==0.3.12
ansys-api-mapdl==0.5.1                        
ansys-api-mechanical==0.1.0                   
ansys-api-meshing-prime==0.1.1                
ansys-api-platform-instancemanagement==1.0.0b3
ansys-api-systemcoupling==0.1.0               
ansys-dpf-composites==0.2.0                   
ansys-dpf-core==0.8.1                         
ansys-dpf-gate==0.3.1                         
ansys-dpf-gatebin==0.3.1
ansys-dpf-post==0.4.0
ansys-fluent-core==0.14.0
ansys-grantami-bomanalytics==1.1.3
ansys-grantami-bomanalytics-openapi==1.0.0
ansys-grpc-dpf==0.7.1
ansys-mapdl-core==0.64.1
ansys-mapdl-reader==0.52.13
ansys-math-core==0.1.1
ansys-mechanical-core==0.8.0
ansys-meshing-prime==0.3.2
ansys-motorcad-core==0.1.3
ansys-openapi-common==1.2.1
ansys-optislang-core==0.2.1
ansys-platform-instancemanagement==1.1.1
ansys-pythonnet==3.1.0rc1
ansys-seascape==0.2.0
ansys-systemcoupling-core==0.1.3
appdirs==1.4.4
bpy==3.4.0
cachetools==5.3.1
certifi==2022.12.7
cffi==1.15.1
charset-normalizer==2.1.1
click==8.1.3
clr-loader==0.2.5
colorama==0.4.6
contourpy==1.0.6
cryptography==41.0.1
cycler==0.11.0
Cython==0.29.32
fonttools==4.38.0
geomdl==5.3.1
gmsh==4.11.1
google-api-core==2.11.0
google-api-python-client==2.88.0
google-auth==2.19.1
google-auth-httplib2==0.1.0
googleapis-common-protos==1.59.0
grpcio==1.54.2
grpcio-status==1.48.2
h5py==3.8.0
httplib2==0.22.0
idna==3.4
imageio==2.23.0
importlib-metadata==6.6.0
kiwisolver==1.4.4
lxml==4.9.2
markdown-it-py==2.2.0
matplotlib==3.6.2
mdurl==0.1.2
meshio==5.3.4
numpy==1.24.1
packaging==22.0
pandas==2.0.2
pansys==0.1.3
pexpect==4.8.0
Pillow==9.4.0
plumbum==1.8.2
pooch==1.6.0
protobuf==3.20.3
protoc-gen-swagger==0.1.0
psutil==5.9.5
ptyprocess==0.7.0
pyaedt==0.6.76
pyansys==2023.2.2
pyansys-tools-versioning==0.3.3
pyasn1==0.5.0
pyasn1-modules==0.3.0
pycparser==2.21
Pygments==2.15.1
pyiges==0.2.1
pyparsing==3.0.9
pypiwin32==223
pyspnego==0.9.0
python-dateutil==2.8.2
pythonnet==3.0.1
pytwin==0.3.0
pytz==2023.3
pyvista==0.37.0
pywin32==306
PyYAML==6.0
requests==2.28.1
requests-negotiate-sspi==0.5.2
requests-ntlm==1.2.0
rich==13.4.1
rpyc==5.3.1
rsa==4.9
scipy==1.10.1
scooby==0.7.0
six==1.16.0
tqdm==4.64.1
tzdata==2023.3
uritemplate==4.1.1
urllib3==1.26.13
vtk==9.2.4
zipp==3.15.0
zstandard==0.19.0
pthieffry commented 1 year ago

Hi @The-Limo, I don't think there is a bug, or at least your models can't lead to that conclusion yet. There are some inconsistencies between your 2 models:

mapdl model

WB model

If I change the element type and set boundary conditions in WB to be in the global coordinate system, I get a max stress of 150MPa, so closer to what you see in MAPDL (would be 157.5 with a modified Young's Modulus)

Also, your model is very sensitive to mesh size. If I look at both averaged and unaveraged stresses, getting a converged solution will require some local refinement, especially as you have sharp corners.

Could you please revise your model based on the above remarks? Also, I would avoid using triangle elements if possible.

Thanks Pierre

The-Limo commented 1 year ago

@pthieffry first of all, thanks a lot for your quick response and helpful approaches.

Also, your model is very sensitive to mesh size. If I look at both averaged and unaveraged stresses, getting a converged solution will require some local refinement, especially as you have sharp corners.<

You're absolutely right with your assumption, and I'm also aware of this. But my little research does not show that the singularity problem has a large effect on the stress. As you can see in the picture below.

sinuglarity

WB model is 3D quadratic shell (shell281), as the model is assumed to be 3D. You can switch it to 2D under the "Geometrie" properties. Then set to Plane Stress has boundary conditions in the cylindrical coordinate system Young's modulus is 200000MPa<

Unfortunately, I'm still not capable to redesign your results with 150 MPa. I changed the WB design from 3D to 2D, changed the boundary conditions to the main coordinate system (to be the same as in MAPDL) and change the Young's modulus to 200 GPa. But my results are still way higher in the WB compared to MAPDL.

Workbench.zip

I hope you can still help me out, to figure out my issue, as it seems to be something minor I'm missing.

Best regards and thanks a lot for your help. Tobi

koubaa commented 1 year ago

Closing this issue - since it is related to the use of the Ansys Mechanical application, not specifically the PyMechanical interface.