Ansys Interfacing With VC&Fortran
Ansys Interfacing With VC&Fortran
39;) 3. 1 2 input_file APDL ANSYS ansys_product_feature ANSYS VC ANSYS ANSYS ANSYS VC FORTRAN ANSYS FORTRAN FORTRAN ANSYS VC FORTRAN file.err ANSYS file.err -b -p ansys_product_feature -i input_file -o
The hundreds of documented template scripts found within the installation directory in
/custom/user
XANSYS. Submit your questions to the XANSYS community. PADT. Submit your questions to us.
4. Locate the new executable for use 5. In your model, activate user features by applicable method a. Define user element b. Define user material model c. Turn on user feature in element real constants d. Define user command with /UCMD e. Setup in USRCAL command 6. Debug
Good example of structure of routines Shows how other routines are called
Typical Header Information. Includes source control data (*deck), copyright information, confidentiality, and pointer to more information. Also function statement. *deck,user02 ANSYS,INC function c c c c user02 (initin,dpin,ch4in,ch8in) user routine number 02 c *** primary function: usr2,dx,dy,dz *** ansys (r) copyright(c) 2000 *** ansys, inc. user
c /************************************************************* \ c | see user01 for additional information on user routines c \*************************************************************/ <snip> |
Arguments Section. Describes input and output arguments, what type they are, and what they are used for. Also, additional examples and help are put in this section. Externally passed and local variables are also defined here. Finally, the standard include statements are placed here. <snip> c input arguments: c c c c c variable (typ,siz,intent) intin dpin ch4in ch8in (int,ar(12),in) (dp,ar(12),in) description - integers from command line - double precision from cmnd line
(ch*4,ar(12),in) - upper case 4 characters from cmnd (ch*8,ar(12),in) - as input 8 characters from cmnd
c output arguments: none c c user02 (int,sc,out) - result code (should be zero) (which is ignored for now)
c ************************************************************** c c c intin(2), dpin(2), ch4in(2), & ch8in are all representations of the contents of the second field on the command line (the field after the command label) external integer integer wrinqr,ndinqr,ndgxyz,ndpxyz,erhandler wrinqr,ndinqr,ndgxyz usr02,intin(12),iott,maxnp,i,ksel dpin(12),xyz(3) ch4in(12) ch8in(12)
c **************************************************************
Calculations. Use ndinqr() to get max node number. This code snippet loops on all possible node numbers, checks to see if the node is selected, and gets its x, y, and z values. Then it does the offset and updates the x,y,z position with ndpxyz().
<snip> maxnp = ndinqr (0,DB_MAXDEFINED) do i = 1,maxnp ksel = ndgxyz (i,xyz(i)) if (ksel .eq. 1) then xyz(1) = xyz(1) + dpin(2) xyz(2) = xyz(2) + dpin(3) xyz(3) = xyz(3) + dpin(4) call ndpxyz (i,xyz(i)) endif enddo <snip>
Clean Up and Exit. This code snippet is used to figure out the standard ouput unit, and then write a message to it. It will also write a message to a GUI pop-up box. It will then set the return value and leave. <snip> c ***** write to output file ***** iott = wrinqr(WR_OUTPUT) write (iott,2000) 2000 format (/' NODE OFFSET COMPLETE '/) c ***** write to GUI window ***** call erhandler ('user02',3000, x 2,'NODE OFFSET COMPLETE',0.0d0,' ')
subroutine usercr (elem,intpt,mat,ncomp,kfirst,kfsteq,e,posn,d, x proptb,timval,timinc,tem,dtem,toffst,fluen,dfluen,epel, x epcrp,statev,usvr,delcr) c #include "impcom.inc" external erhandler c c user-defined fortran parameters c --- size of usvr data integer nuval,nintp parameter (nuval=1,nintp=1) c c external subroutines and functions external egen double precision egen external vapb1,vamb1,vmult c c integer variables integer elem,intpt,mat,ncomp,kfirst,kfsteq c c double precision variables double precision x e,posn,d(ncomp,ncomp),proptb(72),timval,timinc,tem,dtem, x toffst,fluen,dfluen,epel(ncomp),epcrp(ncomp), x statev(ncomp*5+2),usvr(nuval,nintp),delcr,temabs,con, x del(6),epet,sigen,eptot,ept(6), c -PADT--- PADT added variables x qovrk,c1,alpha,dbln,crprt,vrbflg, x aaaa,bbbb,cccc,dddd <snip>
<snip> c c --- initial checks c --- author should remove the warning below when making changes if (intpt.eq.1 .and. kfirst.eq.1) c x call erhandler('usercr',5000,2, x x x c if (nuval*nintp.gt.840) x call erhandler('usercr',5010,4, x x c c --- initialize creep strain increment in case on creep delcr = 0.0d0 c --- no creep if time is not moving if (timinc .le. 0.0d0 .and timval .le. 0.0d0) fo to 999 c --- no creep if temperature is not defined temabs = tem + toffst if (temabs .le. 0.0d0) then c call erhandler('usercr',5020,3, x 'Temperature= %G must be greater than zero for creep.' x ,temabs,' '_ c go to 999 endif <snip> 'Maximum storage allowed by USVR has been exceeded.' ,0.0d0,' ') 'ANSYS,INC.-supplied version of coding for USERCR has been used.' ,0.0d0,' ')
<snip> c c ***** define the equivalent strain and stress ***** c --- define the equivalent strain using the function egen epet = egen (nocomp,epel(1),posn) c --- no cree if the strain is zero if (epet .eq. 0.0d0) go to 999 c --- define the stress sigen = e*epet c c ***** define the creep strain rate ***** c ***** normal beginning of user changes c c -PADT--- Put table values in constants for clarity c c1 = proptb(1) alpha = proptb(2) dbin = proptb(3) vrbflg = proptb(5) c c -PADT--- If table item 4 (Q/k) is 0, set default of 8110 if (proptb(4) .eq. 0) then qovrk = 8110 else qovrk = proptb(4) endif <snip> <snip> c c --- define the creep strain rate crprt = c1*(sinh(alpha*sigen)**dbln)*dexp(-1*qovrk/temabs) c ***** end of sample creep law c ***** normal end of user changes c c ***** compute creep strain increments for each component ***** c c --- define the creep strain increment from the rate delcr = crprt*timinc c c --- use prandtl-reuss relations to compute increments for each if (ncomp .eq. 1) then
del(1) = delcr*epel(1)/epet else con = delcr/epet con = con/(2.0d0*(1.0d0+posn)) call vmult (epel(4),del(4),ncomp-3,3.0d0*con) del(1) = con*(2.0d0*epel(1) - epel(2) - epel(3)) del(2) = con*(2.0d0*epel(2) - epel(3) - epel(1)) del(3) = con*(2.0d0*epel(3) - epel(1) - epel(2)) endif c c --- update the strains call vapb1 (epcrp(1),del(1),ncomp) call vamb1 (epel(1),del(1),ncomp) <snip> <snip> c -PADT--- Do Verbose I/O, if vrbflg eq 1 if (intpt.eq.1 .and. vrbflg .eq. 1) then iott=6 write (iott,*) 'element number = ',elem,' gauss point 1' write (iott,1) 'time=',timval,' stress=',sigen,' temp=',tem write (iott,2) 'delcr=',delcr,' del=',del(1) endif c -PADT--- Do Summary I/O, if vrbflr eq 2 if (intpt.eq.1 .and. vrbflg .eq. 2) then iott = 34 if (elem .eq. 1) then epet = egen (ncomp,epel(1),posn) write (iott,3) elem,timval,sigen,temabs,crprt,delcr,epet endif endif c 999 1 2 3 return format(2x,3(a,d15.8)) format(2x,2(a,d15.8)) format(2x,i6,6(',',g16.9)) end
! 2 alpha-sub-1 ! 3 n ! 4 Q/k (defaults to 8110) ! 5 Verbose output flag (1 = verbose output, 0 = standard output) ! c1 = 9.62e4 a1 = 6e-4 n1 = 3.3 qovrk = 8110 vrbs = 2 TB,CREEP, 1 tbdata,6,100 !use user creep tbdata,1,c1 tbdata,2,a1 tbdata,3,n1 tbdata,4,qovrk tbdata,5,vrbs