Dear all,
I'm trying to save an user array so that it can be accessed from the restart file invoked by the RESTart command.
My idea was to do it with an user macro, as given below. It seems to properly read the values (I'm getting the correct value in each element) when (urest.eq.1), but when I'm checking whether it has properly written it to the save file (urest.eq.2), I'm getting as an output just "Writing crack 0 in el 0". Do you maybe know what is the problem with my macro? Do I perhaps have to give the exact location before starting to write the data to the ios? Is it a problem that I made a loop over all elements, when in reality the allocation was made just in the user element module elmt10.f that is called under material 3 and 4 (and another user element is used for materials 1 and 2)?
c$Id:$
subroutine umacr3(lct,ctl)
c * * F E A P * * A Finite Element Analysis Program
c.... Copyright (c) 1984-2014: Regents of the University of California
c All rights reserved
c-----[--.----+----.----+----.-----------------------------------------]
c Modification log Date (dd/mm/year)
c Original version 01/11/2006
c 1. Remove 'prt' from argument list 09/07/2009
c-----[--.----+----.----+----.-----------------------------------------]
c Purpose: User interface for adding solution command language
c instructions.
c Inputs:
c lct - Command character parameters
c ctl(3) - Command numerical parameters
c Outputs:
c N.B. Users are responsible for command actions. See
c programmers manual for example.
c-----[--.----+----.----+----.-----------------------------------------]
implicit none
include 'iofile.h'
include 'iodata.h' ! ios
include 'umac1.h' ! uct
include 'pointer.h' ! up
include 'comblk.h' ! hr, mr
include 'cdata.h' ! nen, numnp, numel
include 'eldata.h' ! n, ma
logical pcomp
integer i
character lct*15
real*8 ctl(3)
save
c Set command word
if(pcomp(uct,'mac3',4)) then ! Usual form
uct = 'hres' ! Specify 'name'
elseif(urest.eq.1) then ! Read restart data
do i = 1,numel
if(up(1).ne.0) then
read(ios) hr(up(1) + i-1)
end if
end do
write(*,*) 'Reading crack', hr(up(1) + i-1), 'in el', i
elseif(urest.eq.2) then ! Write restart data
do i=1,numel
if(up(1).ne.0) then
write(ios) hr(up(1) + i-1)
end if
end do
write(*,*) 'Writing crack', hr(up(1) + i-1), 'in el', i
else ! Perform user operation
endif
end
The array is defined in ualloc.f as:
data (names(i),i=1,list)/
& 'CRACK'/
In the user subroutine elmt10.f I allocate it as:
! Allocate memory for crack
setvar = ualloc(1,'CRACK',numel,2)
if(.not.setvar) then
write(*,*) 'UALLOC ERROR - CRACK'
endif
(for isw=1)
I initialize it and later update as:
crack = hr(up(1)+(n-1))
(for isw=3 or 6)
I would be grateful for any advice.