How to specify material and material model ( like Johnson cook model) using PyMechanical

Raghuvamsi
Raghuvamsi Member Posts: 2
First Comment
edited November 2023 in Structures

The code and issue are stated here : https://github.com/ansys/pymechanical/issues/499

Tagged:

Answers

  • James Derrick
    James Derrick Administrator, Employee Posts: 242
    First Anniversary Solution Developer Community of Practice Member Ansys Employee 5 Up Votes
    admin

    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.

  • Raghuvamsi
    Raghuvamsi Member Posts: 2
    First Comment

    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

  • Pernelle Marone-Hitz
    Pernelle Marone-Hitz Member, Moderator, Employee Posts: 715
    First Comment First Anniversary Ansys Employee Solution Developer Community of Practice Member

    @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?

  • mohamed-koubaa
    mohamed-koubaa Member, Employee Posts: 1
    Name Dropper First Comment

    @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.