Subroutine Format

<< Click to Display Table of Contents >>

Navigation:  Flexcom > Theory > Applied Loading > Additional Loading Options > User-Defined Forces >

Subroutine Format

Previous pageNext page

A blank or template FORTRAN listing of subroutine usrlod, the Flexcom load user-subroutine, is shown below. The format of the user-subroutine file is now detailed with reference to this table. Obviously, experienced FORTRAN users will be aware that the comment lines are optional, and serve no function other than to make the code more comprehensible. Other than the comments, there are some lines that this user-subroutine must contain. These are:

the subroutine statement

the implicit none statement

the integer and real(8) statements

the !dec$ attributes statements to make the variables and subroutine available to Flexcom

the end subroutine statement

The subroutine statement has eight arguments, to be described shortly. The implicit none statement requires that all variables used in the routine be declared explicitly. The integer and real(8) statements are used to declare integer and double precision variables. It is important to note that all calculations in Flexcom use double precision arithmetic, so you should always use the double precision form of any FORTRAN intrinsic functions you invoke (for example, use dcos rather than cos for the cosine of an angle). The !dec$ attributes statements are used to make the variables and subroutine available to Flexcom. Finally, the use of the end subroutine statement signals the end of the subroutine coding.

User-Subroutine Template

! Subroutine usrlod -- to prescribe time-dependent loads.

! Do not modify the following lines.

subroutine usrlod(key, node, lsta, lend, ndof, time, ramp, value)

!dec$ attributes dllexport, stdcall, reference :: usrlod

  implicit none

  

  integer, intent(in) :: key

  !dec$ attributes reference :: key

  integer, intent(in) :: node

  !dec$ attributes reference :: node

  integer, intent(in) :: lsta

  !dec$ attributes reference :: lsta

  integer, intent(in) :: lend

  !dec$ attributes reference :: lend

  integer, intent(in) :: ndof

  !dec$ attributes reference :: ndof

  real(8), intent(in) :: time

  !dec$ attributes reference :: time

  real(8), intent(in) :: ramp

  !dec$ attributes reference :: ramp

  real(8), intent(inout) :: value

  !dec$ attributes reference :: value

!

! Variable Names

!

!     key     : Key to indicate point load (key = 1) or udl (key = 2).

!     node    : The number of the node for which usrlod is being called,

!               for key = 1; node is 0 for key = 2.

!     lsta    : The number of the start element for which usrlod is being

!             : called to prescribe a udl, for key = 2; lsta is 0 for

!             : key = 1.

!     lend    : The number of the endt element for which usrlod is being

!             : called to prescribe a udl, for key = 2; lend is 0 for

!             : key = 1.

!     ndof    : The number of the degree of freedom (dof) for which usrlod

!               is being called.

!     time    : The present simulation time.

!     ramp    : The current value of the ramp being applied to loads and

!               displacements.

!     value   : The value of the load to be applied for this time value

!               (user-specified).

!

! Declare local variables.

 

 

! Insert coding to define user-specified loading below this line.

 

 

 

! Do not alter the next line. 

end subroutine usrlod

 

The eight arguments of subroutine usrlod are listed in the comments statements above. Of these, the first seven - the key, the node number, the start element, the end element, the degree of freedom, the present simulation time and the current value of the ramp - are passed to usrlod for information only, to be used in calculating the user-defined load value. The values of these variables should not be altered. The eighth variable is the one to which the user-defined load value is to be assigned. The coding to define the value of value should be inserted after the Insert coding comment, but before the end subroutine statement, as indicated in the table above and illustrated further in the next section.

All applied loads and displacements in Flexcom are optionally ramped or gradually increased up to the full values over a time period (the ramp time) you define. Further information is provided in Load Ramping. However, with regard to user-programmed load values, it is important to note that a ramp is not applied to the value you assign to the variable value after the return from usrlod. If you want this value to be gradually ramped on, then the responsibility for applying the ramp is yours and you should do so in the user-subroutine coding. This generality is necessary, since you have no way of indicating to the program whether the application of a ramp is appropriate or not. Refer to Sample User-Subroutine Load in the next section for more details.