Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations Toost on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Understanding a User Subroutine 1

Status
Not open for further replies.

Jlog50

Mechanical
Sep 16, 2010
118
Hi all,
I am going through a simple exmaple to try and understand how user subroutines work with abaqus at the same time as trying to understand the Fortran language. Can anyone provide a

SUBROUTINE DLOAD(F,KSTEP,KINC,TIME,NOEL,NPT,LAYER,KSPT,COORDS,
1 JLTYP,SNAME)
INCLUDE 'ABA_PARAM.INC'
DIMENSION COORDS(3)
CHARACTER*80 SNAME
C NOTE THAT COORDS(3) IS THE ANGULAR COORD IN DEGREES
PI=2.*ASIN(1.D0)
THETA=PI*COORDS(3)/180.
F=-COORDS(1)*COS(THETA)
C WRITE(6,9991)NOEL,NPT,JLTYP,F,PI,THETA,COORDS
C9991 FORMAT(' NOEL,NPT,JLTYP,F,PI,THETA,COORDS',3I5,1P6G10.3)
RETURN
END

Can anyone who understands subrotuines and the fortran language provide an explanation of this subroutine, to give you an exmaple of what I am looking for... for example what does PI=2.*ASIN(1.D0) mean?

Thanks
 
Replies continue below

Recommended for you

PI=2.*ASIN(1.D0) : A clumsy way of specifying PI=3.14159...
"ASIN()" is "arcsine" of the function in brackets. The resulting angle is given in radians.

THETA=PI*COORDS(3)/180. : COORDS() is an array passed in giving the coordinates of the current integration station. As it says, COORDS(3) is the angular coordinate in degrees, so this statement converts it to radians.

F=-COORDS(1)*COS(THETA) : This works out the pressure to apply to the current integration station as the first coordinate, (radial position r) times the cosine of the angular position, theta.

C WRITE(6,9991)NOEL,NPT,JLTYP,F,PI,THETA,COORDS : this is a statement used for initial checking. It writes out the element number, integration point number in element,...the distributed load worked out here and so on. The "C" in front makes the statement a comment, so inactivates it once the analyst was satisfied that the subroutine worked OK.

C9991 FORMAT(' NOEL,NPT,JLTYP,F,PI,THETA,COORDS',3I5,1P6G10.3) : this specifies the format for the above write statement. Again, it's now a comment so inactive.



 
Thanks for your valuable input, just a few more small questions please:

CHARACTER*80 SNAME
1a)For the above statement, why is there a "*", what does that mean?
1b) What does "SNAME" mean, and why is it needed?

PI=2.*ASIN(1.D0)
2) What function is 1.D0?

Thanks again
 
Also I could not find the definition of COORDS(1)
 
sorry one more thing.... why WRITE(6,9991), why those numbers? Thanks.
 
I know the 1.D0 is a way of writing a double precision number in scientific notation in Fortran. The D is like E, but E is single precision. So 1.D0 actually means 1*10^0, or the value 1. Arcsign of 1=pi/2

I think COORDS was assigned a value by the first line. Abaqus will pass in a line of arguments, and this Fortran code will catch that line of arguments and assign them to the variables F, KSTEP, etc. in the order it receives them.

The first write number is the unit number and the second is the format. The 6 is a tag to say which specific file to write to I think. The format number 9991 links that output to the formatting tagged with the label 9991 (the line with that number in the columns 2-5.

Go here. This site rocks. I picked up Fortran pretty quickly with these pages. Short and to the point.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor