How to specify material and material model ( like Johnson cook model) using PyMechanical
Answers
-
Hi @Raghuvamsi, welcome to the forum! Please replicate the question you'd like answering here so that we can preserve it. We try to avoid linking out to external sites where possible as those links could break or people might not have access etc.
0 -
I simply want to specify material like aluminium alloy and use johnson cook plasticity and failure models, problem is I don't know how to perform that in PyMechanical. body.Material gives error. And I have no idea. I linked it because here python notebooks can't be attached. So please guide me how to achieve my objective
0 -
@Raghuvamsi , from the screenshot of Mechanical you shared in the Github post, I can see that Geometry and Analysis Settings are under-defined (blue question mark). You need to figure out what is underdefined in those sections and complete the information needed there. The error message you obtain is because you issue a Solve command, but the model cannot be solved, as it is under-defined.
There are many posts on creating/assigning materials in the forum. Have you looked at them?0 -
@Raghuvamsi according to the documentation, Johnson-Cook is indeed supported.
Normally, material models are defined in Ansys Workbench using the Engineering Data module, not in Ansys Mechanical.
Assuming the library has been defined in Ansys Workbench, it can be exported as an XML file and then imported into PyMechanical. Then, you can use the API
body.Material = "material name"
to assign the material to the body.I highly recommend getting an end-to-end simulation working in Mechanical without scripting first, to understand how it ought to work in a script. Then, any question you might have would be shaped like "I can do this in Mechanical like this, how do I script it?", which is much more straightforward for us to support.
0