I store an array value and save it for the next increment in a user-subroutine. How do I call this array for the next increment to do a calculation on it? I'd like to be able to call the previous increment based on the increment value. Here is my code:
PS: If you look at my write statement in BOLD, I can write out exactly what I want. Is there a way to store this into an (3D) array? And then how do I call the previous values to the current increment? I'd like to update my wear equation (also in BOLD) based on the change in relevant velocity.
Thank you in advance!
c user subroutine for wear calculation
c the routine is called for each node that is in contact when the
c contact body the node belongs to is set up to do wear calculation.
c The WEAR input option must flag that the user subroutine uwearindex
c should be used in the wear calculation.
c wrnd rate of wear at node n, to be defined in this routine
c n internal node id
c nuser user node id
c inc increment number
c time time at beginning of increment
c timinc incremental time
c coord current coordinate position of the node
c i2or3 2 or 3 based upon dimension
c normal surface normal direction at contact point (out from contact body)
c cofornd contact force
c frfornd friction force
c costrs contact stress
c frstrs friction stress
c param input parameters from input, including any table effects:
c param(1): wear coefficient
c param(2): hardness
c param(3): stress exponent
c param(4): velocity exponent
c param(5): activation temperature
c tempi temperature at node n
c relvelnd relative sliding velocity at the node
c itouch set to 1 if the node is part of the touching body
c set to 2 if the node is part of a touched segment
c ibody1 contact body the node belongs to
c ibody2 second contact body:
c touched body if itouch=1
c touching body if itouch=2
c fric coefficient of friction between ibody1 and ibody2,
c including any table effects
c the basic archard law calculates wrnd as
c wrnd is available as nodal post code 78.
c the total amount of wear is accumulated as wtot=wtot+wrnd*timinc
c and is available as post code 77.
implicit logical (a-z)
parameter ( MAXND = 10000 )
integer ndlist(MAXND), numnd, i,k
* fric, incold, relvcum(MAXND), array(MAXND,MAXND,MAXND)
save ndlist, relv, numnd, incold, array, relvcum
c Method for saving the relative velocities in an array
c In inc 0, store two "linked" lists: node list & velocity list
c Check to see Marc actually uses inc 0, if it starts w 1, then
c use "inc.eq.1" in line below
if( inc.eq.1 )then
c Increment zero: set up
found = .false.
do i = 1, numnd
if( nuser.eq.ndlist(i) )found = .true.
if( .not.found )then
numnd = numnd + 1
if( numnd.le.MAXND )then
ndlist(numnd) = nuser
relv(numnd) = relvelnd
write( 6, * )'Array out of bounds: increase MAXND'
c Increment > 0: ndlist has been set, now just access & store
do i = 1, numnd
if( nuser.eq.ndlist(i) )then
relv(i) = relvelnd
write ( 6, * ) inc, ndlist(i), relv(i)
c write( 6, * ) 'incold', incold, 'inc', inc