OpenFAST
Wind turbine multiphysics simulator
Functions/Subroutines | Variables
subdyn Module Reference

SubDyn is a time-domain structural-dynamics module for multi-member fixed-bottom substructures. More...

Functions/Subroutines

subroutine createtpmeshes (TP_RefPoint, inputMesh, outputMesh, ErrStat, ErrMsg)
 
subroutine createy2meshes (NNode, Nodes, NNodes_I, IDI, NNodes_L, IDL, NNodes_C, IDC, inputMesh, outputMesh, ErrStat, ErrMsg)
 
subroutine sd_y2mesh_mapping (p, SDtoMesh)
 Set the index array that maps SD internal nodes to the Y2Mesh nodes. More...
 
subroutine, public sd_init (InitInput, u, p, x, xd, z, OtherState, y, m, Interval, InitOut, ErrStat, ErrMsg)
 This routine is called at the start of the simulation to perform initialization steps. More...
 
subroutine, public sd_updatestates (t, n, Inputs, InputTimes, p, x, xd, z, OtherState, m, ErrStat, ErrMsg)
 Loose coupling routine for solving for constraint states, integrating continuous states, and updating discrete and other states. More...
 
subroutine, public sd_calcoutput (t, u, p, x, xd, z, OtherState, y, m, ErrStat, ErrMsg)
 Routine for computing outputs, used in both loose and tight coupling. More...
 
subroutine, public sd_calccontstatederiv (t, u, p, x, xd, z, OtherState, m, dxdt, ErrStat, ErrMsg)
 Tight coupling routine for computing derivatives of continuous states note that this also sets mUFL and mudotdot_TP. More...
 
subroutine sd_input (SDInputFile, Init, p, ErrStat, ErrMsg)
 
subroutine subrotate (Joints, NJoints, SubRotZ)
 Rotate the joint coordinates with respect to global z.
 
subroutine, public sd_end (u, p, x, xd, z, OtherState, y, m, ErrStat, ErrMsg)
 This routine is called at the end of the simulation. More...
 
subroutine sd_ab4 (t, n, u, utimes, p, x, xd, z, OtherState, m, ErrStat, ErrMsg)
 This subroutine implements the fourth-order Adams-Bashforth Method (RK4) for numerically integrating ordinary differential equations: More...
 
subroutine sd_abm4 (t, n, u, utimes, p, x, xd, z, OtherState, m, ErrStat, ErrMsg)
 This subroutine implements the fourth-order Adams-Bashforth-Moulton Method (RK4) for numerically integrating ordinary differential equations: More...
 
subroutine sd_rk4 (t, n, u, utimes, p, x, xd, z, OtherState, m, ErrStat, ErrMsg)
 This subroutine implements the fourth-order Runge-Kutta Method (RK4) for numerically integrating ordinary differential equations: More...
 
subroutine sd_am2 (t, n, u, utimes, p, x, xd, z, OtherState, m, ErrStat, ErrMsg)
 This subroutine implements the 2nd-order Adams-Moulton Implicit Method (AM2,Trapezoidal rule) for numerically integrating ordinary differential equations: More...
 
subroutine craig_bampton (Init, p, CBparams, ErrStat, ErrMsg)
 Perform Craig Bampton reduction.
 
subroutine breaksysmtrx (Init, p, MRR, MLL, MRL, KRR, KLL, KRL, FGR, FGL)
 
subroutine cbmatrix (MRR, MLL, MRL, KRR, KLL, KRL, DOFM, Init, MBB, MBM, KBB, PhiL, PhiR, OmegaL, ErrStat, ErrMsg, p)
 Sets the CB values, as documented in the SubDyn Theory Guide:
 
subroutine trnsfti (Init, TI, DOFI, IDI, TI2, DOFR, IDR, ErrStat, ErrMsg)
 
subroutine eigensolve (K, M, nDOF, NOmega, Reduced, Init, p, Phi, Omega, ErrStat, ErrMsg)
 Return eigenvalues, Omega, and eigenvectors, Phi,.
 
subroutine reducekmdofs (Kred, K, TDOF, Init, p, ErrStat, ErrMsg)
 Calculate Kred from K after removing consstrained node DOFs from the full M and K matrices Note it works for constrained nodes, still to see how to make it work for interface nodes if needed.
 
subroutine unreducevrdofs (VRred, VR, rDOF, rModes, Init, p, ErrStat, ErrMsg)
 Augments VRred to VR for the constrained DOFs, somehow reversing what ReducedKM did for matrices.
 
subroutine cbapplyconstr (DOFI, DOFR, DOFM, DOFL, MBB, MBM, KBB, PHiR, FGR, MBBb, MBMb, KBBb, PHiRb, FGRb)
 
subroutine setparameters (Init, p, MBBb, MBmb, KBBb, FGRb, PhiRb, OmegaL, FGL, PhiL, ErrStat, ErrMsg)
 
subroutine allocparameters (p, DOFM, ErrStat, ErrMsg)
 Allocate parameter arrays, based on the dimensions already set in the parameter data type. More...
 
subroutine allocmiscvars (p, Misc, ErrStat, ErrMsg)
 Allocate parameter arrays, based on the dimensions already set in the parameter data type. More...
 
subroutine setindexarrays (Init, p, ErrStat, ErrMsg)
 Set the index arrays IDI, IDR, IDL, IDC, and IDY. More...
 
subroutine test_cb_results (MBBt, MBMt, KBBt, OmegaM, DOFTP, DOFM, ErrStat, ErrMsg, Init, p)
 
subroutine constructufl (u, p, UFL)
 Take the input u LMesh and constructs the appropriate corresponding UFL vector.
 
subroutine outsummary (Init, p, FEMparams, CBparams, ErrStat, ErrMsg)
 Output the summary file.
 
real(reki) function memberlength (MemberID, Init, ErrStat, ErrMsg)
 This function calculates the length of a member. More...
 
real(reki) function membermass (rho1, D1, t1, rho2, D2, t2, L, ctube)
 Calculate member mass, given properties at the ends, keep units consistent For now it works only for circular pipes or for a linearly varying area.
 
subroutine symmatdebug (M, MAT)
 Check whether MAT IS SYMMETRIC AND RETURNS THE MAXIMUM RELATIVE ERROR.
 

Variables

type(progdesc), parameter sd_progdesc = ProgDesc( 'SubDyn', '', '' )
 

Detailed Description

SubDyn is a time-domain structural-dynamics module for multi-member fixed-bottom substructures.

SubDyn relies on two main engineering schematizations: (1) a linear frame finite-element beam model (LFEB), and (2) a dynamics system reduction via Craig-Bampton�s (C-B) method, together with a Static-Improvement method, greatly reducing the number of modes needed to obtain an accurate solution.

Function/Subroutine Documentation

◆ allocmiscvars()

subroutine subdyn::allocmiscvars ( type(sd_parametertype), intent(in)  p,
type(sd_miscvartype), intent(inout)  Misc,
integer(intki), intent(out)  ErrStat,
character(*), intent(out)  ErrMsg 
)
private

Allocate parameter arrays, based on the dimensions already set in the parameter data type.

◆ allocparameters()

subroutine subdyn::allocparameters ( type(sd_parametertype), intent(inout)  p,
integer(intki), intent(in)  DOFM,
integer(intki), intent(out)  ErrStat,
character(*), intent(out)  ErrMsg 
)
private

Allocate parameter arrays, based on the dimensions already set in the parameter data type.

◆ memberlength()

real(reki) function subdyn::memberlength ( integer(intki), intent(in)  MemberID,
type(sd_inittype), intent(in)  Init,
integer(intki), intent(out)  ErrStat,
character(*), intent(out)  ErrMsg 
)
private

This function calculates the length of a member.

Parameters
[in]initInput data for initialization routine, this structure contains many variables needed for summary file
[in]memberidMember ID #
Returns
Member Length
Parameters
[out]errstatError status of the operation
[out]errmsgError message if ErrStat /= ErrID_None

◆ sd_ab4()

subroutine subdyn::sd_ab4 ( real(dbki), intent(in)  t,
integer(intki), intent(in)  n,
type(sd_inputtype), dimension(:), intent(inout)  u,
real(dbki), dimension(:), intent(in)  utimes,
type(sd_parametertype), intent(in)  p,
type(sd_continuousstatetype), intent(inout)  x,
type(sd_discretestatetype), intent(in)  xd,
type(sd_constraintstatetype), intent(in)  z,
type(sd_otherstatetype), intent(inout)  OtherState,
type(sd_miscvartype), intent(inout)  m,
integer(intki), intent(out)  ErrStat,
character(*), intent(out)  ErrMsg 
)
private

This subroutine implements the fourth-order Adams-Bashforth Method (RK4) for numerically integrating ordinary differential equations:

Let f(t, x) = xdot denote the time (t) derivative of the continuous states (x).

x(t+dt) = x(t) + (dt / 24.) * ( 55.*f(t,x) - 59.*f(t-dt,x) + 37.*f(t-2.*dt,x) - 9.*f(t-3.*dt,x) )

See, e.g.,

Parameters
[in]tCurrent simulation time in seconds
[in]ntime step number
[in,out]uInputs at t
[in]utimestimes of input
[in]pParameters
[in,out]xContinuous states at t on input at t + dt on output
[in]xdDiscrete states at t
[in]zConstraint states at t (possibly a guess)
[in,out]otherstateOther states at t on input at t + dt on output
[in,out]mMisc/optimization variables
[out]errstatError status of the operation
[out]errmsgError message if ErrStat /= ErrID_None

◆ sd_abm4()

subroutine subdyn::sd_abm4 ( real(dbki), intent(in)  t,
integer(intki), intent(in)  n,
type(sd_inputtype), dimension(:), intent(inout)  u,
real(dbki), dimension(:), intent(in)  utimes,
type(sd_parametertype), intent(in)  p,
type(sd_continuousstatetype), intent(inout)  x,
type(sd_discretestatetype), intent(in)  xd,
type(sd_constraintstatetype), intent(in)  z,
type(sd_otherstatetype), intent(inout)  OtherState,
type(sd_miscvartype), intent(inout)  m,
integer(intki), intent(out)  ErrStat,
character(*), intent(out)  ErrMsg 
)
private

This subroutine implements the fourth-order Adams-Bashforth-Moulton Method (RK4) for numerically integrating ordinary differential equations:

Let f(t, x) = xdot denote the time (t) derivative of the continuous states (x).

Adams-Bashforth Predictor: x^p(t+dt) = x(t) + (dt / 24.) * ( 55.*f(t,x) - 59.*f(t-dt,x) + 37.*f(t-2.*dt,x) - 9.*f(t-3.*dt,x) )

Adams-Moulton Corrector: x(t+dt) = x(t) + (dt / 24.) * ( 9.*f(t+dt,x^p) + 19.*f(t,x) - 5.*f(t-dt,x) + 1.*f(t-2.*dt,x) )

See, e.g.,

Parameters
[in]tCurrent simulation time in seconds
[in]ntime step number
[in,out]uInputs at t
[in]utimestimes of input
[in]pParameters
[in,out]xContinuous states at t on input at t + dt on output
[in]xdDiscrete states at t
[in]zConstraint states at t (possibly a guess)
[in,out]otherstateOther states at t on input at t + dt on output
[in,out]mMisc/optimization variables
[out]errstatError status of the operation
[out]errmsgError message if ErrStat /= ErrID_None

◆ sd_am2()

subroutine subdyn::sd_am2 ( real(dbki), intent(in)  t,
integer(intki), intent(in)  n,
type(sd_inputtype), dimension(:), intent(inout)  u,
real(dbki), dimension(:), intent(in)  utimes,
type(sd_parametertype), intent(in)  p,
type(sd_continuousstatetype), intent(inout)  x,
type(sd_discretestatetype), intent(in)  xd,
type(sd_constraintstatetype), intent(in)  z,
type(sd_otherstatetype), intent(inout)  OtherState,
type(sd_miscvartype), intent(inout)  m,
integer(intki), intent(out)  ErrStat,
character(*), intent(out)  ErrMsg 
)
private

This subroutine implements the 2nd-order Adams-Moulton Implicit Method (AM2,Trapezoidal rule) for numerically integrating ordinary differential equations:

Let f(t, x) = xdot denote the time (t) derivative of the continuous states (x). Define constants k1, k2, k3, and k4 as k1 = f(t , x_t ) k2 = f(t + dt , x_t+dt ) Then the continuous states at t = t + dt are x_(t+dt) =x_n+1 = x_t + deltat/2*(k1 + k2) + O(dt^3) Now this can be re-written as: 0=Z(x_n+1) = x_n - x_n+1 +dt/2 *(f_n + f_n+1) = 0 f_n= A*x_n + B*u_n + Fx from Eq. 1.12 of the manual So to solve this linear system, I can just use x(k)=x(k-1) -J^-1 * Z(x(k-1)) (this is a simple root solver of the linear equation) with J=dZ/dx_n+1 = -I +dt/2*A

Thus x_n+1 = x_n - J^-1 dt/2 * (2*A*x_n + B *(u_n + u_n+1) +2*Fx) or J( x_n - x_n+1 ) = dt * ( A*x_n + B *(u_n + u_n+1)/2 + Fx)

Parameters
[in]tCurrent simulation time in seconds
[in]ntime step number
[in,out]uInputs at t
[in]utimestimes of input
[in]pParameters
[in,out]xContinuous states at t on input at t + dt on output
[in]xdDiscrete states at t
[in]zConstraint states at t (possibly a guess)
[in,out]otherstateOther states at t on input at t + dt on output
[in,out]mMisc/optimization variables
[out]errstatError status of the operation
[out]errmsgError message if ErrStat /= ErrID_None

◆ sd_calccontstatederiv()

subroutine, public subdyn::sd_calccontstatederiv ( real(dbki), intent(in)  t,
type(sd_inputtype), intent(in)  u,
type(sd_parametertype), intent(in)  p,
type(sd_continuousstatetype), intent(in)  x,
type(sd_discretestatetype), intent(in)  xd,
type(sd_constraintstatetype), intent(in)  z,
type(sd_otherstatetype), intent(in)  OtherState,
type(sd_miscvartype), intent(inout)  m,
type(sd_continuousstatetype), intent(out)  dxdt,
integer(intki), intent(out)  ErrStat,
character(*), intent(out)  ErrMsg 
)

Tight coupling routine for computing derivatives of continuous states note that this also sets mUFL and mudotdot_TP.

Parameters
[in]tCurrent simulation time in seconds
[in]uInputs at t
[in]pParameters
[in]xContinuous states at t -WHY IS THIS INOUT and not JUST IN? RRD, changed to IN on2/19/14 check with Greg
[in]xdDiscrete states at t
[in]zConstraint states at t
[in]otherstateOther states at t
[in,out]mMisc/optimization variables
[out]dxdtContinuous state derivatives at t
[out]errstatError status of the operation
[out]errmsgError message if ErrStat /= ErrID_None

◆ sd_calcoutput()

subroutine, public subdyn::sd_calcoutput ( real(dbki), intent(in)  t,
type(sd_inputtype), intent(in)  u,
type(sd_parametertype), intent(in)  p,
type(sd_continuousstatetype), intent(in)  x,
type(sd_discretestatetype), intent(in)  xd,
type(sd_constraintstatetype), intent(in)  z,
type(sd_otherstatetype), intent(in)  OtherState,
type(sd_outputtype), intent(inout)  y,
type(sd_miscvartype), intent(inout)  m,
integer(intki), intent(out)  ErrStat,
character(*), intent(out)  ErrMsg 
)

Routine for computing outputs, used in both loose and tight coupling.

Parameters
[in]tCurrent simulation time in seconds
[in]uInputs at t
[in]pParameters
[in]xContinuous states at t
[in]xdDiscrete states at t
[in]zConstraint states at t
[in]otherstateOther states at t
[in,out]yOutputs computed at t (Input only so that mesh con- nectivity information does not have to be recalculated)
[in,out]mMisc/optimization variables
[out]errstatError status of the operation
[out]errmsgError message if ErrStat /= ErrID_None

◆ sd_end()

subroutine, public subdyn::sd_end ( type(sd_inputtype), intent(inout)  u,
type(sd_parametertype), intent(inout)  p,
type(sd_continuousstatetype), intent(inout)  x,
type(sd_discretestatetype), intent(inout)  xd,
type(sd_constraintstatetype), intent(inout)  z,
type(sd_otherstatetype), intent(inout)  OtherState,
type(sd_outputtype), intent(inout)  y,
type(sd_miscvartype), intent(inout)  m,
integer(intki), intent(out)  ErrStat,
character(*), intent(out)  ErrMsg 
)

This routine is called at the end of the simulation.

Parameters
[in,out]uSystem inputs
[in,out]pParameters
[in,out]xContinuous states
[in,out]xdDiscrete states
[in,out]zConstraint states
[in,out]otherstateOther states
[in,out]ySystem outputs
[in,out]mMisc/optimization variables
[out]errstatError status of the operation
[out]errmsgError message if ErrStat /= ErrID_None

◆ sd_init()

subroutine, public subdyn::sd_init ( type(sd_initinputtype), intent(in)  InitInput,
type(sd_inputtype), intent(out)  u,
type(sd_parametertype), intent(out)  p,
type(sd_continuousstatetype), intent(out)  x,
type(sd_discretestatetype), intent(out)  xd,
type(sd_constraintstatetype), intent(out)  z,
type(sd_otherstatetype), intent(out)  OtherState,
type(sd_outputtype), intent(out)  y,
type(sd_miscvartype), intent(out)  m,
real(dbki), intent(inout)  Interval,
type(sd_initoutputtype), intent(out)  InitOut,
integer(intki), intent(out)  ErrStat,
character(*), intent(out)  ErrMsg 
)

This routine is called at the start of the simulation to perform initialization steps.

The parameters are set here and not changed during the simulation. The initial states and initial guess for the input are defined.

Parameters
[in]initinputInput data for initialization routine
[out]uAn initial guess for the input; input mesh must be defined
[out]pParameters
[out]xInitial continuous states
[out]xdInitial discrete states
[out]zInitial guess of the constraint states
[out]otherstateInitial other states
[out]yInitial system outputs (outputs are not calculated; only the output mesh is initialized)
[in,out]intervalCoupling interval in seconds: the rate that (1) Mod1_UpdateStates() is called in loose coupling & (2) Mod1_UpdateDiscState() is called in tight coupling. Input is the suggested time from the glue code; Output is the actual coupling interval that will be used by the glue code.
[out]mInitial misc/optimization variables
[out]initoutOutput for initialization routine
[out]errstatError status of the operation
[out]errmsgError message if ErrStat /= ErrID_None

◆ sd_rk4()

subroutine subdyn::sd_rk4 ( real(dbki), intent(in)  t,
integer(intki), intent(in)  n,
type(sd_inputtype), dimension(:), intent(inout)  u,
real(dbki), dimension(:), intent(in)  utimes,
type(sd_parametertype), intent(in)  p,
type(sd_continuousstatetype), intent(inout)  x,
type(sd_discretestatetype), intent(in)  xd,
type(sd_constraintstatetype), intent(in)  z,
type(sd_otherstatetype), intent(inout)  OtherState,
type(sd_miscvartype), intent(inout)  m,
integer(intki), intent(out)  ErrStat,
character(*), intent(out)  ErrMsg 
)
private

This subroutine implements the fourth-order Runge-Kutta Method (RK4) for numerically integrating ordinary differential equations:

Let f(t, x) = xdot denote the time (t) derivative of the continuous states (x). Define constants k1, k2, k3, and k4 as k1 = dt * f(t , x_t ) k2 = dt * f(t + dt/2 , x_t + k1/2 ) k3 = dt * f(t + dt/2 , x_t + k2/2 ), and k4 = dt * f(t + dt , x_t + k3 ). Then the continuous states at t = t + dt are x_(t+dt) = x_t + k1/6 + k2/3 + k3/3 + k4/6 + O(dt^5)

For details, see: Press, W. H.; Flannery, B. P.; Teukolsky, S. A.; and Vetterling, W. T. "Runge-Kutta Method" and "Adaptive Step Size Control for Runge-Kutta." sections 16.1 and 16.2 in Numerical Recipes in FORTRAN: The Art of Scientific Computing, 2nd ed. Cambridge, England: Cambridge University Press, pp. 704-716, 1992.

Parameters
[in]tCurrent simulation time in seconds
[in]ntime step number
[in,out]uInputs at t
[in]utimestimes of input
[in]pParameters
[in,out]xContinuous states at t on input at t + dt on output
[in]xdDiscrete states at t
[in]zConstraint states at t (possibly a guess)
[in,out]otherstateOther states at t on input at t + dt on output
[in,out]mMisc/optimization variables
[out]errstatError status of the operation
[out]errmsgError message if ErrStat /= ErrID_None

◆ sd_updatestates()

subroutine, public subdyn::sd_updatestates ( real(dbki), intent(in)  t,
integer(intki), intent(in)  n,
type(sd_inputtype), dimension(:), intent(inout)  Inputs,
real(dbki), dimension(:), intent(in)  InputTimes,
type(sd_parametertype), intent(in)  p,
type(sd_continuousstatetype), intent(inout)  x,
type(sd_discretestatetype), intent(inout)  xd,
type(sd_constraintstatetype), intent(inout)  z,
type(sd_otherstatetype), intent(inout)  OtherState,
type(sd_miscvartype), intent(inout)  m,
integer(intki), intent(out)  ErrStat,
character(*), intent(out)  ErrMsg 
)

Loose coupling routine for solving for constraint states, integrating continuous states, and updating discrete and other states.

Continuous, discrete, constraint, and other states are updated for t + Interval.

Parameters
[in]tCurrent simulation time in seconds
[in]nCurrent step of the simulation: t = n*Interval
[in,out]inputsInputs at Times
[in]inputtimesTimes in seconds associated with Inputs
[in]pParameters
[in,out]xInput: Continuous states at t; Output: Continuous states at t + Interval
[in,out]xdInput: Discrete states at t; Output: Discrete states at t + Interval
[in,out]zInput: Constraint states at t; Output: Constraint states at t + Interval
[in,out]otherstateInput: Other states at t; Output: Other states at t + Interval
[in,out]mMisc/optimization variables
[out]errstatError status of the operation
[out]errmsgError message if ErrStat /= ErrID_None

◆ sd_y2mesh_mapping()

subroutine subdyn::sd_y2mesh_mapping ( type(sd_parametertype), intent(in)  p,
integer(intki), dimension(:), intent(out)  SDtoMesh 
)
private

Set the index array that maps SD internal nodes to the Y2Mesh nodes.

NOTE: SDtoMesh is not checked for size, nor are the index array values checked for validity, so this routine could easily have segmentation faults if any errors exist.

Parameters
[in]pParameters
[out]sdtomeshindex/mapping of mesh nodes with SD mesh

◆ setindexarrays()

subroutine subdyn::setindexarrays ( type(sd_inittype), intent(in)  Init,
type(sd_parametertype), intent(inout)  p,
integer(intki), intent(out)  ErrStat,
character(*), intent(out)  ErrMsg 
)
private

Set the index arrays IDI, IDR, IDL, IDC, and IDY.