Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

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

How to save the original variable in a subroutine?

Status
Not open for further replies.

eispiata

Technical User
Apr 22, 2008
1
US
Hi everybody,

I built up an Abaqus (finite element) model that calls a very simple DISP subroutine (see below) to compute the displacement at its outside boundary.

When i use only one step to get to the solution then i get the final displacement that i expected.

But when i use two or more steps then the solution is always higher than i expected because the COORDS vector (or whatever it is?) is updated at each step so that the new coordinates in the previous step become the original coordinates in the next step. I would like to be able to save the first original coordinates in the DISP subroutine.

I am not good at Fortran but i have been told that i could save the original coordinates of the point using a
COMMON block along with the command SAVE so it should be something like:

COMMON /block/ name of the variables
SAVE /block/

But how can i use this feature in a the following subroutine?

Thanks for your help,

Malik

SUBROUTINE DISP(U,KSTEP,KINC,TIME,NODE,NOEL,JDOF,COORDS)
C
INCLUDE 'ABA_PARAM.INC'
C
DIMENSION U(3),TIME(2),COORDS(3)
C


U(1)=10*COORDS(2)


RETURN
END
 
It seems to me that you wish to save the contents of a variable.

To do that, just assign its value to another variable.

The SAVE statement does something quite different.

It causes tha values of a variable to be retained
even though the procedure in which the SAVE statement
exists terminates and is later re-CALLed.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top