General Mechanical

General Mechanical

Topics related to Mechanical Enterprise, Motion, Additive Print and more.

Tool (software) for user defined material model subrountine

    • zhonghu
      Subscriber

      Hello,


      I am planning to write a user defined material model subroutine USERMAT compiling with ANSYS, I am wondering if gfortran 4.8.5 is a good one to use for writing and compiling, and currently the what version of fortran ANSYS used? fortran 95/2003/2008? and where is the link to read the interface of the USERMAT? Anything else I need to prepare before starting writing the code?


       


      Thanks

    • peteroznewman
      Subscriber

      I moved this Discussion to Structural from Embedded Software for better visibility.

    • David Weed
      Ansys Employee

      Hi,


      Can you let me know which release of ANSYS you are using? We don't support gfortran, but rather Intel Fortran compilers for both Windows and Linux platforms.

    • zhonghu
      Subscriber

      Hello David,


      Thanks for your response and info. Right now I am using the latest version ANSYS 19.3R research license and planing to write the USERMAT in unix with codeblocks GNU GCC Compiler or  GNU Fortran Compiler. I am not sure if it is ok. Also I am wondering if you can advice me the interface format of the USERMAT.


      Many thanks,


      Zhong

    • zhonghu
      Subscriber

      sorry, I should be working on Linux platform.

    • David Weed
      Ansys Employee

      Hi Zhong,


      You can find the compiler requirements for R19.3 on the Linux Platform here: https://ansyshelp.ansys.com/account/secured?returnurl=/Views/Secured/corp/v193/installation/installation_set_cbn_sqj_r5.html?q=compiler


      Intel 17.0.4 (FORTRAN, C, C++) and GCC 6.3.0 (for user programmable features)


      Please note that GCC 6.3.0 is only available through ANSYS, Inc. Customers are required to go through the Customer Portal to download the compiler there. You may have to discuss doing procuring this with your account manager. Also, for the Intel Fortran compiler, you need an Intel account and your institution would have to purchase the compiler. Please only use the specific software versions listed in the link above. We can't ensure that routines will successfully compile or produce reliable results outside of those versions.

    • zhonghu
      Subscriber

      Hi David,


      Thanks for your info. Now I have some other questions for you:


      (1) What files I need to load in my account on the server machine before I can compile my usermat.f with ANSYS and does ANSYS can provide all these files (such as all MAPDL files);


      (2) Where I can find the current version of the example of usermat3d.f I can check out or compare with mine.


      Thanks,

    • zhonghu
      Subscriber

      Hi David,


      Looks like I found the necessary ANSYS files under the ansys/customize/user folder. Now I left one more question is that can you send me or tell me where the usermat3d example, I need check with mine to see the compatibility to this ansys2019r3 version.


      Thanks. 

    • zhonghu
      Subscriber

      Hi David,


      Ok, I found it in the same folder, but it was generated in 1999, so I guess its format doesn't change. So I can test the compiler I have installed of the Intel.


      Thanks, 

    • David Weed
      Ansys Employee

      Hi Zhong,


      Yes, usermat3D is a subroutine within usermat.F itself. From what I've heard, these routines have changed very little, if at all, since their initial inception.

    • zhonghu
      Subscriber

      Hi David,


      When I compile I need compile all the files in the folder, not just the files with .F?


      Thanks,

    • David Weed
      Ansys Employee

      Hi Zhong,


      I would suggest reading the help which details the different compilation/linking methods: https://ansyshelp.ansys.com/account/secured?returnurl=/Views/Secured/corp/v193/ans_prog/GxI4r398wfl.html. You can create a separate directory specifically for compiling your routines; it should contain the script for whichever compile method you've chosen (e.g., /UPF or shared library) and the routines of interest. You also mentioned using an unsupported compiler; this section may be relevant:


      ANSYS, Inc. recommends using the ANSUSERSHARED script as a template to try compilers that are not supported by ANSYS, Inc., such as the GNU compilers. To do so, edit the ANSUSERSHARED script, making changes to the appropriate platform logic. Note that if you do use compilers other than those listed in the ANSYS Installation and Configuration Guide specific to your operating system, you will need to debug (i.e., find missing libraries, unsatisfied externals, etc.) them yourself. ANSYS, Inc. does not provide assistance for customers using unsupported compilers or if the resulting objects are not compatible with the executable(s) as distributed.

    • zhonghu
      Subscriber

      Hello David,


      Yes, I made the user customized system work.


      I did a test by using ANSYS BISO material and the USERMAT (ANSYS provided sample BISO), I found something different:


      (1) Test conditions: A cylindrical (Axi-symmetric) metallic volume with radius of 20 mm and height of 40 mm undergone a 4% tension;


      (2) Material data: Young's modulus E = 220.8 GPa, Poisson's ratio = 0.3, Yield strength = 1137.7 MPa, Strain Hardening slope H = 1466.0 MPa


      (3) Results extracted from the data: The tension displacement (Uy), tension force (Fy), average von Mises stress (S eqv, actually it is a uniform deformation, every element has the same value), average von Mises elastic strain (EPEL eqv, every element has the same value), and von Mises plastic strain (EPPL eqv, every element has the same value);


      (4) The same: Under the same load step, both ANSYS BISO and USERMAT provided the same Uy, Fy, von Mises stress, von Mises plastic strain;


      (5) Difference: However, at the beginning of tension, it is elastic deformation, so the Young's modulus should be the ratio of the von Mises stress to the von Mises elastic strain, the result from ANSYS BISO provided the right answer, compared to the Young's modulus input in the batch file, but the result from USERMAT is not right (smaller elastic strain, resulting in higher Young's modulus); also all the elastic strains during the tension from USERMAT are smaller than that from ANSYS BISO;


      Attached please find the APDL input batch file and the result files from ANSYS BISO and USERMAT;


      Can you take a look if there is anything wrong? Since I really care about the elastic strain and my project needs very accurate elastic strain modeling.


      By the way, I am wondering if ANSYS can share BKIN subroutine with me, since I am developing a subroutine with a very unique Bauschinger effect (not the 2 time yield stress 2Y by BKIN, but would be very helpful).


      Thanks and happy holidays,


      Zhong



      APDL batch file input


      ! This is a Tension-Compression testing using USERMAT BISO for A723-1130 


      /FILNAM, Tension_USERMAT-ANSYS_BISO


      !/TITLE, This is a Tension-Compression testing using USERMAT BISO A723-1130 material input 


      /UNITS,user  !Length-mm, force-N, stress-MPa


       


      !Specimen dimensions


      r_=20 !width of specimen


      h_=40 !depth of specimen


       


       


      ! generate model


      /PREP7


       


      ET,1,PLANE183,0,,1,     !2-D 8-node for specimen


                             ! keyopt(1)=0, 8-node quadrilateral; keyopt(3)=1, axisymmetric


       


      !!ANSYS BISO input


      MP,EX,1,220.8122966e3         !Young's modulus and Poisson ratio for tension


      MP,PRXY,1,0.3                 !Poisson's ratio


      TB,BISO,1,1


      TBTEMP,0


      TBDATA,1, 1137.708703, 1466.033865   ! Sigy0, H


       


       


      !!Usermat BISO input


      !TB,User,1,1,4         !User defined Bi-linear with four inputs 


      !TBTEMP,0


      !TBDATA,1,220.8122966e3, 0.3, 1137.708703, 1466.033865 !E, Posn, Sigy0, H


      !TB,STATE,1,,16


       


      !Generate model for the specimen


      K,1,0,0


      K,2,r_,0


      K,3,r_,h_


      K,4,0,h_


      A,1,2,3,4


       


      LESIZE,1,,,20


      LESIZE,2,,,40


      LESIZE,3,,,20


      LESIZE,4,,,40


       


      TYPE,1


      MAT,1


      Amesh,1


       


      save


       


      finish


       


      /solution


       


      ANTYPE,trans,new


       


      nlgeom,on


      nropt,full,on


      !predict,off


      neqit,20


      ncnv,0


      solcontrol,on


      cnvtol,f,,0.01


      cnvtol,u,,0.01


      !AUTOTS,ON  !!!!


       


      ! define displacement boundary conditions on the axisymmetric axis of the specimen


      NSEL,S,loc,x,0


      D,all,ux,0


      NSEL,all


       


      ! define displacement boundary conditions on the bottom of the specimen


      NSEL,s,loc,y,0 ! select nodes at the bottom 


      D,all,uy,0


      NSEL,all


       


      !!!!!! apply 4% the tension displacement on the top surface of the specimen


      NSEL,s,loc,y,h_ 


      D,all,uy,0.04*h_


      NSEL,all


       


       


      TIME,1


      DELTIM,0.005,0.001,0.01


      OUTRES,all,-100


      KBC,0


      SOLVE


      save


       


      fini


       


      /post26


      STORE,NEW


       


      NSEL,S,LOC,y,h_


      *GET,NODETOT,NODE,,COUNT


      *GET,MINNODE,NODE,,NUM,MIN


       


      nsol,2,MinNode,u,y,DispY


       


      RFORCE,3,MinNode,F,Y


      *GET,SigEqv,NODE,MinNode,s,eqv


       


      NODENUM=MINNODE


       


      *do,i,1,NodeTot-1,1


        NodeNum=ndnext(NodeNum)


        rforce,4,NodeNum,f,y


        add,3,3,4,,Load,,,1,1


      *enddo


       


      add,3,3,,,Load,,,1


      add,2,2,,,Disp,,,1


       


      NSEL,all


      ESEL,all


      *GET,ELEMTOT,ELEM,,COUNT


       


      *do,i,1,ELEMTOT,1


        ESOL,6,i,,S,EQV,SEQV


        ADD,5,5,6,,SEQV,,,1,1


        ESOL,8,i,,EPEL,EQV,EEEQV


        ADD,7,7,8,,EEEQV,,,1,1


        ESOL,10,i,,EPPL,EQV,EPEQV


        ADD,9,9,10,,EPEQV,,,1,1


      *enddo


       


      add,2,2,,,Disp,,,1


      add,3,3,,,Load,,,1


      add,5,5,,,SEQV,,,1/ELEMTOT


      add,7,7,,,EEEQV,,,1/ELEMTOT


      add,9,9,,,EPEQV,,,1/ELEMTOT


       


      *dim,T_Data,array,100


      *dim,Dy_Data,array,100


      *dim,Fy_Data,array,100


      *dim,Si_Data,array,100


      *dim,Eli_Data,array,100


      *dim,Epi_Data,array,100


       


      vget,T_Data(1),1


      vget,Dy_Data(1),2


      vget,Fy_Data(1),3


      vget,Si_Data(1),5


      vget,Eli_Data(1),7


      vget,Epi_Data(1),9


       


      /xrange,0,0.04*h_


      /yrange,0,2000000


      /grid,1


      xvar,2


      plvar,3


       


      /output,Tension_ANSYS_BISO_Data,txt,,append


      !/output,Tension_USERMAT_BISO_Data,txt,,append


      *vwrite,T_Data(1),Dy_Data(1),Fy_Data(1),Si_Data(1),Eli_Data(1),Epi_Data(1)


      (6(F18.6,2x))


      /output


      fini


       



      Data from ANSYS BISO


               time             Tension Uy (mm)  Tension Fy (N)       von Mises Seqv(MPa)  Elastic strain eqv    Plastic strain eqv


       


                0.010000            0.016000       110943.548964           88.307259            0.000400            0.000000


                0.027500            0.044000       304860.088252          242.760025            0.001099            0.000000


                0.037500            0.060000       415535.645173          330.970276            0.001499            0.000000


                0.047500            0.076000       526113.972334          419.145294            0.001898            0.000000


                0.057500            0.092000       636595.187567          507.285126            0.002297            0.000000


                0.067500            0.108000       746979.408514          595.389771            0.002696            0.000000


                0.077500            0.124000       857266.752633          683.459290            0.003095            0.000000


                0.087500            0.140000       967457.337195          771.493713            0.003494            0.000000


                0.097500            0.156000      1077551.279287          859.493042            0.003892            0.000000


                0.107500            0.172000      1187548.695808          947.457275            0.004291            0.000000


                0.117500            0.188000      1297449.703475         1035.386475            0.004689            0.000000


                0.127500            0.204000      1407254.418817         1123.280762            0.005087            0.000000


                0.137500            0.220000      1425411.889183         1138.196289            0.005155            0.000330


                0.147500            0.236000      1425576.512573         1138.779297            0.005157            0.000725


                0.157500            0.252000      1425740.715944         1139.362183            0.005160            0.001120


                0.167500            0.268000      1425904.500026         1139.944824            0.005163            0.001515


                0.177500            0.284000      1426067.865545         1140.527222            0.005165            0.001910


                0.187500            0.300000      1426230.813230         1141.109375            0.005168            0.002304


                0.197500            0.316000      1426393.343804         1141.691284            0.005170            0.002699


                0.207500            0.332000      1426555.457993         1142.272949            0.005173            0.003093


      .........


       



      Data from USERMAT


                time             Tension Uy (mm)  Tension Fy (N)       von Mises Seqv(MPa)  Elastic strain eqv    Plastic strain eqv


       


                0.010000            0.016000       110943.548964           88.307259            0.000347            0.000000


                0.027500            0.044000       304860.088252          242.760025            0.000953            0.000000


                0.037500            0.060000       415535.645173          330.970276            0.001299            0.000000


                0.047500            0.076000       526113.972334          419.145294            0.001645            0.000000


                0.057500            0.092000       636595.187567          507.285126            0.001991            0.000000


                0.067500            0.108000       746979.408514          595.389771            0.002337            0.000000


                0.077500            0.124000       857266.752633          683.459290            0.002683            0.000000


                0.087500            0.140000       967457.337195          771.493713            0.003028            0.000000


                0.097500            0.156000      1077551.279287          859.493042            0.003373            0.000000


                0.107500            0.172000      1187548.695808          947.457275            0.003719            0.000000


                0.117500            0.188000      1297449.703475         1035.386475            0.004064            0.000000


                0.127500            0.204000      1407254.418817         1123.280762            0.004409            0.000000


                0.137500            0.220000      1425411.889183         1138.196289            0.004467            0.000330


                0.147500            0.236000      1425576.512573         1138.779297            0.004470            0.000725


                0.157500            0.252000      1425740.715944         1139.362183            0.004472            0.001120


                0.167500            0.268000      1425904.500026         1139.944824            0.004474            0.001515


                0.177500            0.284000      1426067.865545         1140.527222            0.004476            0.001910


                0.187500            0.300000      1426230.813230         1141.109375            0.004479            0.002304


                0.197500            0.316000      1426393.343804         1141.691284            0.004481            0.002699


                0.207500            0.332000      1426555.457993         1142.272949            0.004483            0.003093


      ...........


       


       

    • AntiNeutrino03
      Subscriber

      Can the community edition of the Fortran Compilers and Visual studio be used for UDFs?


      Also, do the later versions of the compilers work?

Viewing 13 reply threads
  • The topic ‘Tool (software) for user defined material model subrountine’ is closed to new replies.