Ansys Upf
Ansys Upf
Ansys Upf
Eric Miller
Co-Owner Principal, Simulation and Business Technologies
09/27/2012 PADT, Inc.
DX R13: 02/17/2011 1
Agenda
Note: This presentation is being recorded Introductions Background and Requirements Compiling & Linking The User Material routines Simple Example Thoughts
DX R13: 02/17/2011 2
Introductions
DX R13: 02/17/2011 3
Upcoming Webinars
Upcoming Webinars
October 11, 2012 12:00 - 1:00 MST An Example of Moving Mesh Modeling of a Valve October 25, 2012 12:00 - 1:00 MST Getting Started with ANSYS Engineering Knowledge Manager (EKM) November/December: Start the ANSYS 14.5 Webinars?
DX R13: 02/17/2011 4
About PADT
We Make Innovation Work PADT is an Engineering Services Company
Mechanical Engineering 18 Years of Growth and Happy customers 70ish Employees
3 Business Areas
CAE Sales & Services
Consulting, Training, Sales, Support
www.CUBE-HVPC.com
DX R13: 02/17/2011 6
DX R13: 02/17/2011 7
Twitter: #padtinc
Web: www.PADTINC.com
DX R13: 02/17/2011 8
DX R13: 02/17/2011 9
FORTRAN API
No longer fully documented
DX R13: 02/17/2011 10
User Routines
Can be C or FORTRAN
But we recommend only FORTRAN Provided user subroutines are all FORTRAN
We are covering materials today, but most is applicable to all the other uses Note: Some routines wont work correctly with Parallel
Verify parallel on test cases.
DX R13: 02/17/2011 11
DX R13: 02/17/2011 12
Read and Write access to the vNNN directory and all sub folders The Programmers Manual
Mechanical APDL >Programmers Manual
And
DX R13: 02/17/2011 13
DX R13: 02/17/2011 14
DX R13: 02/17/2011 15
Intel Compiler
ANSYS has been using the Intel compiler for some time Start at the Intel website:
http://software.intel.com/en-us/intel-compilers
You may have to contact them to make sure you get the right version
Be very careful on this, ANSYS usually uses an older version because it is more stable and QAd
DX R13: 02/17/2011 16
But First!
Do you really need a UPF?
Dig a little deeper into the material models and make sure you cant use what is already there
DX R13: 02/17/2011 17
Some Advice
Before you get deep into your model get the system working
Compiler, ANSYS, environment variables, etc
Take the standard usermat.f routine and get it to compile and link.
It has the basic TB, BISO model built in as a demo.
Test it
I like to build two beams and run one with a standard BISO and another with the use routine
Get everything working. Then make a small difference to the calculations and make sure you can see it Keep the test routine
If something stops working, you can go back and verify where you are.
DX R13: 02/17/2011 18
DX R13: 02/17/2011 19
Documentation can be used to see the differences Also: we will talk about USERMAT, it works for creep, hyperelasticity and all other user material UPFs.
DX R13: 02/17/2011 20
Cons:
Cons:
DX R13: 02/17/2011 21
DX R13: 02/17/2011 23
Using /UPF
First, set up some environment variable letting the program know you are going to use /UPF
Make sure that your ANSYS executable directory is in your PATH
It needs to run a script called findUPF.bat
Set ANS_USE_UPF=TRUE
From your working directory, launch the FORTRAN command line Add /upf,usermat.f to your input command file Run ansys in batch mode from the command line shell A DLL will be made, reuse it just like when you make the DLL
DX R13: 02/17/2011 24
Using /UPF
Im not a fan of this method
Have to run ANSYS from the FORTRAN shell
If you set up paths so any routine can compile/link you can run without shell
Need compiler on machine you are solving on If your compile fails you are kind of screwed Added because ABAQUS allows for compile at run
DX R13: 02/17/2011 25
To use it, specify the path in the launcher (customization/preferences) or with the custom <path> switch
DX R13: 02/17/2011 26
DX R13: 02/17/2011 27
Compiling Recommendations
Debug using the DLL If it is just you, keep using the DLL If you deploy to others, when everything is working, make a new ansys.exe and deploy that Remember to do everything from the FORTRAN shell
DX R13: 02/17/2011 28
DX R13: 02/17/2011 29
The Basics
Standard FORTRAN, nothing fancy Well documented Comes with the TB, BISO model Contains several subroutines
Usermat
Doesnt do much, just figures out dimension of element and calls proper routine:
Usermat1d: 1D truss Usermat3d: 3D elements Usermatbm: beam elements Usermatps: plain strain
DX R13: 02/17/2011 30
The Basics
The routine gets called for every integration point in your model that is assigned the material number that is defined by a TB, User Stress, Strain, state variables, time increment, strain increment are passed in Your routine updates values and passes them back Read documentation on math
// Programmer's Manual // II. Guide to User-Programmable Features // 2. UPF Subroutines and Functions // 2.4. Subroutines for Customizing Material Behavior
DX R13: 02/17/2011 31
Call
Standard call, all the info that gets passed to the routine is listed
DX R13: 02/17/2011 32
Input Arguments
Documented in the comments
DX R13: 02/17/2011 33
Input/Output
These go in and out, so be careful. Note the VARn is not used right now State variables: Important
These for your use to pass things back and forth How you supply values that you can change
As opposed to properties that dont change Unique to each integration point
Also how you store any specific result or intermediate values at each integration point that you want to plot or list Very powerful See TB info at end of this section
DX R13: 02/17/2011 34
Output
Stuff that is passed out
DX R13: 02/17/2011 35
Important details
Ncomp: Number of terms for each type of element Vector orders Matrix order
DX R13: 02/17/2011 36
Rest of Routine
Declares types Then has and If-then-else to call the proper subroutine for the dimension of the element
Just pass everything through They do this so that the logic of the program is not full of if-then-else statements.
DX R13: 02/17/2011 37
USERMAT3D
This is where you would do your own thing Simple example for biso is here
Get values Calc elastic and plastic slopes Our first helper function: vmove (copies vectors)
DX R13: 02/17/2011 38
USERMAT3D
This is where you would do your own thing Simple example for biso is here
Get values Calc elastic and plastic slopes Our first helper function: vmove (copies vectors)
DX R13: 02/17/2011 39
USERMAT3D
Calculate the elastic stiffness matrix
DX R13: 02/17/2011 40
Stop
At this point, if the inputs and outputs sound confusing you need to back up and understand ANSYS non-linear solving and how their elements work
Theory manual Hughes, Thomas J.R. and James Winget. Finite Rotation Effects in Numerical Integration of Rate Constitutive Equations Arising in LargeDeformation Analysis. [International Journal for Numerical Methods in Engineering]. 15.9 (1980): 1413-1418.
Book that was used by ANSYS
DX R13: 02/17/2011 41
USERMAT3D
Calculate the stresses Note use of get_ElmData to get elmement call
Documented as part of usermat documentation Used to get info that is not passed in
Get yield
DX R13: 02/17/2011 42
USERMAT3D
Next section checks for yield
If no, use a goto (yes, a goto!) to skip plastic stuff
Do plastic calcs
DX R13: 02/17/2011 43
USERMAT3D
Clean up and get out
Note the 500-600 elastic portion
Thoughts
Simple calcs, yours will probably be much more complex
But steps are the same Gather your properties Branch if needed to for different equations Figure out strain/stress Return the info
Didnt use a lot of calls to other routines Remember it gets called for every integration point
You need to be efficient
DX R13: 02/17/2011 44
USERMAT
Restrictions
Current-technology elements only If you want to plot state variables, you need to use /graph, full Not enough hooks in/out for incompressible materials
Special routine (UserHyper) for that
DX R13: 02/17/2011 45
TB
TB, User, Mat, NTEMPS, NPTS
Mat is material number NTEMPS is number of temperature points you will provide properties at NPTS, number of property values tb,user,1,2,4 tbtemp,1.0 tbdata,1,19e5, 0.3, 1e3,100 tbtemp,2.0 tbdata,1,21e5, 0.3, 2e3,100
DX R13: 02/17/2011 46
Simple Example
DX R13: 02/17/2011 47
DX R13: 02/17/2011 48
DX R13: 02/17/2011 49
1: Modify usermat.f
Make sure ANS_USER_PATH is pointing to my user directory Copy to my working directory Edit and in usermat3d subroutine change sigy0 line to:
sigy0 = prop(3)*.75
Save file Launch FORTRAN command line shell ansusershared.bat Run ANSYS with demo input file as input Check output: BISO and USER stresses and strains are different
DX R13: 02/17/2011 50
Results
Note that it tells us we are using a user mat
DX R13: 02/17/2011 51
DX R13: 02/17/2011 52
Thoughts
DX R13: 02/17/2011 53
Parallel
Things get tricky with parallel You can get it to work Compare parallel and non-parallel on all hardware options
Make sure they match
For shared memory parallel: All UPF s are supported in parallel But dont use Common Block variables.
Each core may have a different value. You dont want to set them different on each core You can usually read them if they are not something that is changed by a solve But dont write to them
DX R13: 02/17/2011 54
DX R13: 02/17/2011 55
Hints
Use state variable to set flag for first time used, write something to output that says HEY, Im BEING USED!
Maybe even give more info on the routine Use iout= wrinqr(2) to get output unit
User /UNDO to write a *.db file at ansy point Crawl, Walk, Run
DX R13: 02/17/2011 56
Thank You
PADT Enjoys doing these webinars Please consider us as your partner ANSYS Related
Training, Mentoring Consulting Services Customization Sales (if in AZ, NM, CO, UT, NV)
Rapid Prototyping
SLA, SLS, FDM, PolyJet, CNC, Soft Tooling, Injection Molding
DX R13: 02/17/2011 57