Skip to content

Assigning material properties to newly created materials #4851

Closed Answered by ansys-satyajeet
Somayaji1995 asked this question in Q&A
Discussion options

You must be logged in to vote

Hi,

If you must assign properties for density and specific heat, please see the code lines below. It is a good practice to check if the material already exists before creating a new one. The properties of the object mat can be obtained using dir(mat) as suggested by @gmalinve above.

if not ipk.materials.checkifmaterialexists("matname"):
    mat = ipk.materials.add_material("matname")
    mat.thermal_conductivity = "400"
    mat.mass_density = "8000"
    mat.specific_heat = "700"

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by ansys-satyajeet
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants