


{"id":371793,"date":"2024-07-13T19:59:54","date_gmt":"2024-07-13T19:59:54","guid":{"rendered":"https:\/\/innovationspace.ansys.com\/forum\/forums\/topic\/applying-the-user-programmable-features-for-user-defined-material-model\/"},"modified":"2024-07-13T19:59:54","modified_gmt":"2024-07-13T19:59:54","slug":"applying-the-user-programmable-features-for-user-defined-material-model","status":"closed","type":"topic","link":"https:\/\/innovationspace.ansys.com\/forum\/forums\/topic\/applying-the-user-programmable-features-for-user-defined-material-model\/","title":{"rendered":"Applying the User Programmable Features for User Defined Material Model"},"content":{"rendered":"<p>Hello,<\/p>\n<p>I want to apply an anisotropic hyperelastic constitutive model for an analysis that I will conduct using Transient Structural module in Workbench environment.<\/p>\n<p>Before writing the actual constitutive equation, I wrote a Fortran subroutine which contains the constitutive equation for a simple Neo-Hookean material just to practice the compiling and linking process into Ansys even though it is already defined in Engineering Data. However, I couldn&#8217;t manage to use it in Ansys Workbench. I found out that there are a couple of ways to implement this fortran file with the extension &#8220;.f&#8221; into Ansys using &ldquo;\/upf&rdquo; or dynamic link library. But as someone new to Fortran programming, I was not able to achieve it.<\/p>\n<p>My main objective is to define the strain-energy potential and its derivatives with respect to the strain invariants.&nbsp;My Fortran subroutine seems like this for a simple Neo-Hookean model:<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p style=\"margin: 0cm;margin-bottom: .0001pt\"><span style=\"font-size: 10.0pt;font-family: Consolas\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>SUBROUTINE USERHYPER(STRENGTH, J, I1B, I2B, W, DWDI1, DWDI2,<\/span><\/p>\n<p style=\"margin: 0cm;margin-bottom: .0001pt\"><span style=\"font-size: 10.0pt;font-family: Consolas\"><span>&nbsp;&nbsp;&nbsp;&nbsp; <\/span>&amp;<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>DWDJ, TEMP, DTEMP, NDI, NSHR, TIME, DTIME,<\/span><\/p>\n<p style=\"margin: 0cm;margin-bottom: .0001pt\"><span style=\"font-size: 10.0pt;font-family: Consolas\"><span>&nbsp;&nbsp;&nbsp;&nbsp; <\/span>&amp;<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>STRAN, D, STRESS, STIFF, DDSDDE, DDSDDT)<\/span><\/p>\n<p style=\"margin: 0cm;margin-bottom: .0001pt\"><span style=\"font-size: 10.0pt;font-family: Consolas\">C<\/span><\/p>\n<p style=\"margin: 0cm;margin-bottom: .0001pt\"><span style=\"font-size: 10.0pt;font-family: Consolas\">C<span>&nbsp;&nbsp;&nbsp;&nbsp; <\/span>The strain-energy potential W and its derivatives<\/span><\/p>\n<p style=\"margin: 0cm;margin-bottom: .0001pt\"><span style=\"font-size: 10.0pt;font-family: Consolas\">C<\/span><\/p>\n<p style=\"margin: 0cm;margin-bottom: .0001pt\"><span style=\"font-size: 10.0pt;font-family: Consolas\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>IMPLICIT NONE<\/span><\/p>\n<p style=\"margin: 0cm;margin-bottom: .0001pt\"><span style=\"font-size: 10.0pt;font-family: Consolas\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>INTEGER NDI, NSHR<\/span><\/p>\n<p style=\"margin: 0cm;margin-bottom: .0001pt\"><span style=\"font-size: 10.0pt;font-family: Consolas\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>REAL*8 STRENGTH(2), J, I1B, I2B, W, DWDI1, DWDI2, DWDJ<\/span><\/p>\n<p style=\"margin: 0cm;margin-bottom: .0001pt\"><span style=\"font-size: 10.0pt;font-family: Consolas\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>REAL*8 TEMP, DTEMP, TIME, DTIME, STRAN(NDI,NDI), D(NDI,NDI)<\/span><\/p>\n<p style=\"margin: 0cm;margin-bottom: .0001pt\"><span style=\"font-size: 10.0pt;font-family: Consolas\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>REAL*8 STRESS(NDI,NDI), STIFF(NDI,NDI,NDI,NDI)<\/span><\/p>\n<p style=\"margin: 0cm;margin-bottom: .0001pt\"><span style=\"font-size: 10.0pt;font-family: Consolas\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>REAL*8 DDSDDE(NDI,NDI,NDI,NDI), DDSDDT(NDI,NDI)<\/span><\/p>\n<p style=\"margin: 0cm;margin-bottom: .0001pt\"><span style=\"font-size: 10.0pt;font-family: Consolas\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>REAL*8 MU, KAPPA<\/span><\/p>\n<p style=\"margin: 0cm;margin-bottom: .0001pt\"><span style=\"font-size: 10.0pt;font-family: Consolas\">&nbsp;<\/span><\/p>\n<p style=\"margin: 0cm;margin-bottom: .0001pt\"><span style=\"font-size: 10.0pt;font-family: Consolas\">C<span>&nbsp;&nbsp;&nbsp;&nbsp; <\/span>Material properties<\/span><\/p>\n<p style=\"margin: 0cm;margin-bottom: .0001pt\"><span style=\"font-size: 10.0pt;font-family: Consolas\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>MU = STRENGTH(1)<\/span><\/p>\n<p style=\"margin: 0cm;margin-bottom: .0001pt\"><span style=\"font-size: 10.0pt;font-family: Consolas\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>KAPPA = STRENGTH(2)<\/span><\/p>\n<p style=\"margin: 0cm;margin-bottom: .0001pt\"><span style=\"font-size: 10.0pt;font-family: Consolas\">&nbsp;<\/span><\/p>\n<p style=\"margin: 0cm;margin-bottom: .0001pt\"><span style=\"font-size: 10.0pt;font-family: Consolas\">C<span>&nbsp;&nbsp;&nbsp;&nbsp; <\/span>Strain-energy potential<\/span><\/p>\n<p style=\"margin: 0cm;margin-bottom: .0001pt\"><span style=\"font-size: 10.0pt;font-family: Consolas\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>W = 0.5D0 * MU * (I1B &#8211; 3.D0) + 0.5D0 * KAPPA * (J &#8211; 1.D0)**2<\/span><\/p>\n<p style=\"margin: 0cm;margin-bottom: .0001pt\"><span style=\"font-size: 10.0pt;font-family: Consolas\">&nbsp;<\/span><\/p>\n<p style=\"margin: 0cm;margin-bottom: .0001pt\"><span style=\"font-size: 10.0pt;font-family: Consolas\">C<span>&nbsp;&nbsp;&nbsp;&nbsp; <\/span>Derivatives of the strain-energy potential<\/span><\/p>\n<p style=\"margin: 0cm;margin-bottom: .0001pt\"><span style=\"font-size: 10.0pt;font-family: Consolas\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>DWDI1 = 0.5D0 * MU<\/span><\/p>\n<p style=\"margin: 0cm;margin-bottom: .0001pt\"><span style=\"font-size: 10.0pt;font-family: Consolas\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>DWDI2 = 0.0D0<\/span><\/p>\n<p style=\"margin: 0cm;margin-bottom: .0001pt\"><span style=\"font-size: 10.0pt;font-family: Consolas\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>DWDJ = KAPPA * (J &#8211; 1.D0)<\/span><\/p>\n<p style=\"margin: 0cm;margin-bottom: .0001pt\"><span style=\"font-size: 10.0pt;font-family: Consolas\">&nbsp;<\/span><\/p>\n<p style=\"margin: 0cm;margin-bottom: .0001pt\"><span style=\"font-size: 10.0pt;font-family: Consolas\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>RETURN<\/span><\/p>\n<p style=\"margin: 0cm;margin-bottom: .0001pt\"><span style=\"font-size: 10.0pt;font-family: Consolas\"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <\/span>END<\/span><\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>I am not sure if my subroutine is correct or not. It was succesfully compiled and it created the &#8220;.dll&#8221; file when I create a new Fortran project for creating a dynamic-link library in Visual Studio 2022. I was wondering how should I link this to the Ansys and use it in my analysis in Workbench environment by defining the mu and kappa constants. Any help is appreciated.<\/p>\n<p>Kind regards,<\/p>\n<p>Emirhan.<\/p>\n","protected":false},"template":"","class_list":["post-371793","topic","type-topic","status-closed","hentry","topic-tag-anisotropic-hyperelastic-2","topic-tag-fortran-1","topic-tag-hyperelastic","topic-tag-neo-hookean","topic-tag-subroutine","topic-tag-upf","topic-tag-visual-studio-1"],"aioseo_notices":[],"acf":[],"custom_fields":[{"0":{"_bbp_subscription":["264431","157520"],"_bbp_author_ip":["78.190.223.148"]," _bbp_last_reply_id":["0"]," _bbp_likes_count":["0"],"_btv_view_count":["1675"],"_bbp_topic_status":["unanswered"],"_bbp_topic_id":["371793"],"_bbp_forum_id":["27815"],"_bbp_engagement":["157520","264431"],"_bbp_voice_count":["2"],"_bbp_reply_count":["2"],"_bbp_last_reply_id":["371987"],"_bbp_last_active_id":["371987"],"_bbp_last_active_time":["2024-07-15 18:16:11"]},"test":"yigitem19itu-edu-tr"}],"_links":{"self":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/topics\/371793","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/topics"}],"about":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/topics\/371793\/revisions"}],"wp:attachment":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/media?parent=371793"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}