Skip to content

Commit

Permalink
Merge pull request #4 from bjonkman/f/FloatingLin
Browse files Browse the repository at this point in the history
Added DerivOrd to BeamDyn linearization + minor fixes
  • Loading branch information
ghaymanNREL authored Feb 4, 2019
2 parents 5195b97 + 3db6267 commit b688f5a
Show file tree
Hide file tree
Showing 11 changed files with 56 additions and 133 deletions.
2 changes: 1 addition & 1 deletion modules-ext/map/src/MAP_Fortran_Registry.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

include Registry_NWTC_Library.txt

typedef MAP_Fortran Lin_InitInputType LOGICAL linearize - .false. - "Flag that tells this module if the glue code wants to linearize. (fortran-only)" -
typedef MAP_Fortran/MAP_Fortran Lin_InitInputType LOGICAL linearize - .false. - "Flag that tells this module if the glue code wants to linearize. (fortran-only)" -
typedef ^ Lin_InitOutputType CHARACTER(200) LinNames_y {:} "" - "second line of output file contents: units (fortran-only)" -
typedef ^ ^ CHARACTER(200) LinNames_u {:} "" - "Names of the inputs used in linearization (fortran-only)" -
typedef ^ ^ LOGICAL IsLoad_u {:} - - "Flag that tells FAST if the inputs used in linearization are loads (for preconditioning matrix) (fortran-only)" -
Expand Down
11 changes: 3 additions & 8 deletions modules-ext/map/src/MAP_Registry.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,10 @@
# column 10 Units
# Keyword ModuleName/ModName Derived data type Field type Variable name variable dimension Initial value for mix language, not used Description Units


include Registry_NWTC_Library.txt
#include MAP_Fortran_Registry.txt
usefrom MAP_Fortran Lin_InitInputType LOGICAL linearize -
usefrom ^ Lin_InitOutputType CHARACTER(200) LinNames_y {:}
usefrom ^ ^ CHARACTER(200) LinNames_u {:}
usefrom ^ ^ INTEGER IsLoad_u {:}
usefrom ^ Lin_ParamType Integer Jac_u_indx {:}{:}
usefrom ^ ^ R8Ki du {:}
usefrom ^ ^ Integer Jac_ny -
usefrom MAP_Fortran_Registry.txt

## ============================== Define input types here: ============================================================================================================================================
typedef MAP InitInputType DbKi gravity - -999.9 - "gravity constant" "[m/s^2]"
typedef ^ ^ DbKi sea_density - -999.9 - "sea density" "[kg/m^3]"
Expand Down
2 changes: 1 addition & 1 deletion modules-local/aerodyn/src/UnsteadyAero_Driver.f90
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ program UnsteadyAero_Driver
type(UA_InputType) :: u(NumInp) ! System inputs
type(UA_OutputType) :: y ! System outputs
integer(IntKi) :: ErrStat, errStat2 ! Status of error message
character(1024) :: ErrMsg, errMsg2 ! Error message if ErrStat /= ErrID_None
character(ErrMsgLen) :: ErrMsg, errMsg2 ! Error message if ErrStat /= ErrID_None

integer, parameter :: NumAFfiles = 1
character(1024) :: afNames(NumAFfiles)
Expand Down
2 changes: 2 additions & 0 deletions modules-local/beamdyn/src/BeamDyn_IO.f90
Original file line number Diff line number Diff line change
Expand Up @@ -2307,6 +2307,7 @@ SUBROUTINE Init_Jacobian_x_z( p, InitOut, ErrStat, ErrMsg)
!call allocAry(p%dx, p%dof_node*(p%node_total-1), 'p%dx', ErrStat2, ErrMsg2); call SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName)
CALL AllocAry(InitOut%LinNames_x, p%Jac_nx*2, 'LinNames_x', ErrStat2, ErrMsg2); CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName)
CALL AllocAry(InitOut%RotFrame_x, p%Jac_nx*2, 'RotFrame_x', ErrStat2, ErrMsg2); CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName)
CALL AllocAry(InitOut%DerivOrder_x, p%Jac_nx*2, 'DerivOrder_x', ErrStat2, ErrMsg2); CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName)
!CALL AllocAry(InitOut%LinNames_z, p%dof_node*2, 'LinNames_z', ErrStat2, ErrMsg2); CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName)
!CALL AllocAry(InitOut%RotFrame_z, p%dof_node*2, 'RotFrame_z', ErrStat2, ErrMsg2); CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName)
if (ErrStat >= AbortErrLev) return
Expand All @@ -2319,6 +2320,7 @@ SUBROUTINE Init_Jacobian_x_z( p, InitOut, ErrStat, ErrMsg)
p%dx(4:6) = 0.2_ReKi*D2R ! deflection states in rad and rad/s

InitOut%RotFrame_x = p%RotStates
InitOut%DerivOrder_x = 2

!......................................
! set linearization output names:
Expand Down
1 change: 1 addition & 0 deletions modules-local/beamdyn/src/Registry_BeamDyn.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ typedef ^ InitOutputType LOGICAL RotFrame_y {:} - -
typedef ^ InitOutputType LOGICAL RotFrame_x {:} - - "Flag that tells FAST/MBC3 if the continuous states used in linearization are in the rotating frame (not used for glue)" -
typedef ^ InitOutputType LOGICAL RotFrame_u {:} - - "Flag that tells FAST/MBC3 if the inputs used in linearization are in the rotating frame" -
typedef ^ InitOutputType LOGICAL IsLoad_u {:} - - "Flag that tells FAST if the inputs used in linearization are loads (for preconditioning matrix)" -
typedef ^ InitOutputType IntKi DerivOrder_x {:} - - "Integer that tells FAST/MBC3 the maximum derivative order of continuous states used in linearization" -

# ..... Blade Input file data........................................................................
typedef ^ BladeInputData IntKi station_total - - - "Number of blade input stations"
Expand Down
6 changes: 3 additions & 3 deletions modules-local/elastodyn/src/ElastoDyn.f90
Original file line number Diff line number Diff line change
Expand Up @@ -10810,7 +10810,7 @@ SUBROUTINE ED_JacobianPContState( t, u, p, x, xd, z, OtherState, y, m, ErrStat,

! Calculate the partial derivative of the continuous state functions (X) with respect to the continuous states (x) here:

! allocate dXdu if necessary
! allocate dXdx if necessary
if (.not. allocated(dXdx)) then
call AllocAry(dXdx, p%DOFs%NActvDOF * 2, p%DOFs%NActvDOF * 2, 'dXdx', ErrStat2, ErrMsg2)
call SetErrStat(ErrStat2,ErrMsg2,ErrStat,ErrMsg,RoutineName)
Expand Down Expand Up @@ -11534,9 +11534,9 @@ SUBROUTINE ED_Perturb_u( p, n, perturb_sign, u, du )
CASE (12) !Module/Mesh/Field: u%HubPtLoad%Moment = 12
u%HubPtLoad%Moment(fieldIndx,node) = u%HubPtLoad%Moment(fieldIndx,node) + du * perturb_sign

CASE (13) !Module/Mesh/Field: u%HubPtLoad%Force = 13
CASE (13) !Module/Mesh/Field: u%NacelleLoads%Force = 13
u%NacelleLoads%Force( fieldIndx,node) = u%NacelleLoads%Force( fieldIndx,node) + du * perturb_sign
CASE (14) !Module/Mesh/Field: u%HubPtLoad%Moment = 14
CASE (14) !Module/Mesh/Field: u%NacelleLoads%Moment = 14
u%NacelleLoads%Moment(fieldIndx,node) = u%NacelleLoads%Moment(fieldIndx,node) + du * perturb_sign

CASE (15) !Module/Mesh/Field: u%BlPitchCom = 15
Expand Down
Loading

0 comments on commit b688f5a

Please sign in to comment.