batch
prop,user,1
end
unumb type tmin tmax ap(1)
ap(2) ap(3) ap(4) ap(5)
Note that once you say `prop,user' then the meaning of the first 2 parameters and the last 5 is entirely up to you. FEAP will only make use of the tmin tmax parameters by deciding when to call your load function.
An example uprop.f for the Haversine is shown below. For the Haversine function implementation shown unumb needs to be = 1 and type is simply ignored.
c-----[--+---------+---------+---------+---------+---------+---------+-]
c Purpose: User
proportional load routine
c Inputs:
c
unumb - User function number
c
type - User type definition
c
tmin - Minimum time applicable
c
tmax - Maximum time applicable
c
ap(5) - User function parameters
c
t - Current time for evaluation point
c
HAVERSINE parameters
c
ap(2) = frequency
c
ap(3) = Pulse magnitude
c
ap(4) = Pulse period
c
ap(5) = Rest period
c Output:
c
upropld - Value of proportional load
c-----[--+---------+---------+---------+---------+---------+---------+-]
implicit
none
include 'iofile.h'
integer
unumb,type, isw, inttimex,i
real*8
tmin, tmax, ap(5), t, upropld
real*8
timex, tfunc, pi, freq, load
real*8
ton, toff, tcycle
save
c Print output of user data for isw=1
if(isw.eq.1) then
c This implementation of uprop ignores ap(1)
write(iow,2000) (ap(i),i=2,5)
if (ior.lt.0) then
write(*,2000) (ap(i),i=2,5)
endif
c.... Format Statements
2000 format(9x,'** H A V E R S I N E
L O A D I N G**',//,
#
5x,'Frequency
',1pe10.3,/
#
5x,'Proportion of load at peak ',1pe10.3,/
#
5x,'Time loading and unloading ',1pe10.3,/
#
5x,'Rest period
',1pe10.3,/)
c Compute function value for 'upropld' when isw=2
elseif (isw.eq.2) then
c Compute load for unumb function = 1, does not make use of type
if(unumb.eq.1) then ! The Haversine
! read parameters input
pi = 4.d0*atan(1.d0)
freq = ap(2)
load = ap(3)
ton = ap(4)
toff = ap(5)
!
calculate factors to determine in haversine or rest
tcycle = ton + toff
timex = t / tcycle
inttimex = int(timex)
tfunc = (timex - inttimex)*tcycle
! get relevant load for time first print warnings for unexpected
! values of tfunc which should never happen
if (tfunc < 0.0d0) then
write(*,*) '***WARNING*** tfunc<0'
else if (tfunc >= tcycle) then
write(*,*) '***WARNING*** tfunc>tcycle'
else if (tfunc <= ton) then
! In the pulse
upropld=load*(ABS(DSIN(2.0d0*pi*freq*t)))
else if (tfunc < tcycle) then
! During the rest period
upropld=0.0d0
else
write(*,*) '***WARNING*** no tfunc operation'
endif
endif
endif
end