Call array from previous increment User-subroutine MARC

Call array from previous increment User-subroutine MARC

Hello,

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.

-Jonathan

subroutine uwearindex(wrnd,n,nuser,inc,
* time,timinc,coord,i2or3,normal,cofornd,frfornd,
* costrs,frstrs,param,tempi,relvelnd,
* itouch,ibody1,ibody2,fric)
c
c user subroutine for wear calculation
c
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
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
c
c the basic archard law calculates wrnd as
c wrnd=(param(1)/param(2))*relvelnd*costrs
c
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.
c
#ifdef _IMPLICITNONE
implicit none
#else
implicit logical (a-z)
#endif
integer MAXND
parameter ( MAXND = 10000 )
integer n,nuser,inc,i2or3,itouch,ibody1,ibody2
integer ndlist(MAXND), numnd, i,k
logical found
real*8 wrnd,time,timinc,coord,normal,cofornd,
* frfornd,costrs,frstrs,param,tempi,relvelnd,
* fric, incold, relvcum(MAXND), array(MAXND,MAXND,MAXND)
real*8 relv(MAXND)
dimension coord(*),normal(*),param(*)
save ndlist, relv, numnd, incold, array, relvcum
data numnd/0/
c
c Method for saving the relative velocities in an array
c
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
c
if( inc.eq.1 )then
c
c Increment zero: set up
c
found = .false.
do i = 1, numnd
if( nuser.eq.ndlist(i) )found = .true.
end do
if( .not.found )then
numnd = numnd + 1
if( numnd.le.MAXND )then
ndlist(numnd) = nuser
relv(numnd) = relvelnd
else
write( 6, * )'Array out of bounds: increase MAXND'
end if
end if
else
c
c Increment > 0: ndlist has been set, now just access & store
c
do i = 1, numnd
if( nuser.eq.ndlist(i) )then
relv(i) = relvelnd
write ( 6, * ) inc, ndlist(i), relv(i)
end if
end do
end if
c
wrnd=(param(1)/param(2))*relvelnd*costrs*2
c
incold=inc
c write( 6, * ) 'incold', incold, 'inc', inc
return
end

1 Beitrag / 0 neu
Nähere Informationen zur Compiler-Optimierung finden Sie in unserem Optimierungshinweis.