A blank or template FORTRAN listing of subroutine usrdsp, the Flexcom boundary condition user-subroutine, is shown in the user-subroutine template 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.
! Subroutine usrdsp -- to prescribe time-dependent displacements.
! Do not modify the following lines.
subroutine usrdsp(node, ndof, time, ramp, dispx, dispy, dispz, disp)
!dec$ attributes dllexport, stdcall, reference :: usrdsp
implicit none
integer, intent(in) :: node
!dec$ attributes reference :: node
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(in) :: dispx
!dec$ attributes reference :: dispx
real(8), intent(in) :: dispy
!dec$ attributes reference :: dispy
real(8), intent(in) :: dispz
!dec$ attributes reference :: dispz
real(8), intent(inout) :: disp
!dec$ attributes reference :: disp
!
! Variable Names
!
! node : The number of the node for which usrdsp is being called.
! ndof : The number of the degree of freedom (dof) for which usrdsp
! is being called.
! time : The present simulation time.
! ramp : The current value of the ramp being applied to loads and
! displacements.
!
! dispx : The displacement value currently in the array of nodal
! displacements for the vertical dof at this node.
! If heave motions have been specified at this node, dispx will
! contain the heave calculated at this time.
! dispy : The displacement value currently in the array of nodal
! displacements for dof 2 at this node.
! dispz : The displacement value currently in the array of nodal
! displacements for dof 3 at this node.
!
! disp : The displacement value to be assigned to this node and dof
! for this time value (user-specified).
!
! Declare local variables.
! Insert coding to define user-specified motion below this line.
! Do not alter the next line.
end subroutine usrdsp
The eight arguments of subroutine usrdsp are described in the comments statements of the above table. Of these, the first seven - the node number, the degree of freedom, the present simulation time, the current value of the ramp and the current position of the node - are passed to usrdsp for information only, to be used in calculating the user-defined displacement value. The values of these variables should not be altered. The eighth variable is the one to which the user-defined displacement value is to be assigned. The coding to define the value of disp should be inserted after the Insert coding comment, but before the end subroutine statement, as indicated in the above table and illustrated further in the next section.
It is important to note that the variable disp is a displacement, that is a motion from or about the user-specified initial coordinate. The actual position in space of the node at any time is the sum of the initial coordinate and the displacement value in disp. If the node in question is specified as being a cable interior node, then the initial nodal coordinate is the location calculated by the cable pre-static step. This location is echoed to the output file jobname.out for user scrutiny. Invoking the user-subroutine option to define the subsequent motion of such a node would constitute an unusual step.
The values of dispx, dispy and dispz are the displacements of the node from the initial coordinates in the global X, Y and Z directions respectively. For the case of any of these displacements which is not determined by the motions of an attached vessel, the value of the variable which is passed to subroutine usrdsp is the value of that displacement at the last solution time. So for example, if the present solution time is 12.1s and the previous solution was at 12s, and if the vertical motion of the node in question is not determined from the motions of an attached vessel; then the value of dispx when subroutine usrdsp is called at 12.1s is the value of the vertical displacement of the node at 12s.
What this means is that the values of dispx, dispy and dispz can be used in calculating the value of disp, which will then in the normal course of events become the next value (the value at the present solution time) of one of these (dispx, dispy or dispz). Of course in very many analyses, the value to be assigned to disp will be independent of dispx, dispy and dispz, and the values of these variables will be immaterial and unused in your FORTRAN coding.
Of greater significance is the situation where one or other (or indeed all) of dispx, dispy and dispz are defined by the motions of an attached vessel. In this case the value(s) of these variables will be the values calculated from the vessel motions at the current solution time. So for example, if the present solution time is 12.1s, and the motions in the global Y and Z directions of the node for which the subroutine is called are determined from the motions of an attached vessel; then the values of dispy and dispz when subroutine usrdsp is called at 12.1s are the values of the displacements of the node in these degrees of freedom at this solution time.