26 March 2020
Your objective can be achieved with the Usermat.F, but it is not clear to me what specific issue you are encountering when you noted that it “did not work.”
If you received an error during compiling or during a solution when using density-dependent properties, can you provide the error message(s)?
On the other hand, if the results obtained for the density-dependent case are not as expected, I’d suggest that you use state variables to store intermediate results throughout your solution. Then, use a simple 1-element cube model to check results with hand calculations (apply uniaxial load to just have 1 stress component, for example, for easier checking with hand calculations). For example, you seem to already be storing state variable #3 as (relative) density, but by storing other variables (yield stress, etc.), you can then check results to see which quantity/quantities are not being updated correctly throughout the solution, which may give some clue regarding what is occurring in your usermat.F code. (If you do not see state variables stored for all substeps, include OUTRES,SVAR,ALL in your “Commands (APDL)” object, so you can see all intermediate results.)
As a side note, it seems that you are updating relative density based on equivalent plastic strain (“dpleq”, if I am reading your code snippet correctly), but please note that equivalent plastic strain (“pleq&rdquo is the deviatoric component, and you want the volumetric component to calculate relative density. The volumetric plastic strain needs to be calculated by taking the average of x, y, z plastic strain components. Also, you seem to be replacing the “pleq_t” value with the first state variable, but “pleq_t” is an input parameter and should generally not be changed. As noted above, by storing and reviewing state variables in a simple 1-element model, I think that it will be easier for you to debug your Fortran code and see what variables are problematic in your usermat.F code.