From 757709c61506dfccbbd20b21d45fee5501baf6b7 Mon Sep 17 00:00:00 2001 From: Bonnie Jonkman Date: Fri, 4 Jan 2019 10:58:03 -0700 Subject: [PATCH 1/6] MAP Fortran Registry simplification du was defined differently in the two locations (scalar vs allocatable array), so I think it's better to use the same definition file. --- modules-ext/map/src/MAP_Registry.txt | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/modules-ext/map/src/MAP_Registry.txt b/modules-ext/map/src/MAP_Registry.txt index a45a035876..3308e062bf 100644 --- a/modules-ext/map/src/MAP_Registry.txt +++ b/modules-ext/map/src/MAP_Registry.txt @@ -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]" From 5b7634fde76edaf3d76a57bf07aff916485c5bcd Mon Sep 17 00:00:00 2001 From: Bonnie Jonkman Date: Fri, 4 Jan 2019 13:21:38 -0700 Subject: [PATCH 2/6] MAP Fortran Registry updates - The Registry had issues with the module name in usefrom form without the nickname. Should probably fix the Registry, but this fixes the problem for now. - Registry wasn't being run on MAP in all configurations. --- modules-ext/map/src/MAP_Fortran_Registry.txt | 2 +- vs-build/FASTlib/FASTlib.vfproj | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/modules-ext/map/src/MAP_Fortran_Registry.txt b/modules-ext/map/src/MAP_Fortran_Registry.txt index 305dad0590..b1ad941a80 100644 --- a/modules-ext/map/src/MAP_Fortran_Registry.txt +++ b/modules-ext/map/src/MAP_Fortran_Registry.txt @@ -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)" - diff --git a/vs-build/FASTlib/FASTlib.vfproj b/vs-build/FASTlib/FASTlib.vfproj index 1915f5a398..eb2369d05c 100644 --- a/vs-build/FASTlib/FASTlib.vfproj +++ b/vs-build/FASTlib/FASTlib.vfproj @@ -1063,26 +1063,26 @@ - - - + + + - - - + - + - + + + From 0a8930597b45892ededc0919bd5c44783c17db94 Mon Sep 17 00:00:00 2001 From: Bonnie Jonkman Date: Fri, 4 Jan 2019 16:06:32 -0700 Subject: [PATCH 3/6] Added DerivOrder_x for BD linearization + updated template file fixed a few typos, too --- modules-local/aerodyn/src/UnsteadyAero_Driver.f90 | 2 +- modules-local/beamdyn/src/BeamDyn_IO.f90 | 2 ++ modules-local/beamdyn/src/Registry_BeamDyn.txt | 1 + modules-local/elastodyn/src/ElastoDyn.f90 | 6 +++--- modules-local/openfast-library/src/FAST_Subs.f90 | 1 + modules-local/openfast-registry/src/Template_data.c | 3 ++- modules-local/openfast-registry/src/Template_registry.c | 1 + 7 files changed, 11 insertions(+), 5 deletions(-) diff --git a/modules-local/aerodyn/src/UnsteadyAero_Driver.f90 b/modules-local/aerodyn/src/UnsteadyAero_Driver.f90 index f667c58f5d..db73ec86ba 100644 --- a/modules-local/aerodyn/src/UnsteadyAero_Driver.f90 +++ b/modules-local/aerodyn/src/UnsteadyAero_Driver.f90 @@ -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) diff --git a/modules-local/beamdyn/src/BeamDyn_IO.f90 b/modules-local/beamdyn/src/BeamDyn_IO.f90 index bffc78091c..4d6596637b 100644 --- a/modules-local/beamdyn/src/BeamDyn_IO.f90 +++ b/modules-local/beamdyn/src/BeamDyn_IO.f90 @@ -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 @@ -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: diff --git a/modules-local/beamdyn/src/Registry_BeamDyn.txt b/modules-local/beamdyn/src/Registry_BeamDyn.txt index 00f12ddfcc..7858e60f3b 100644 --- a/modules-local/beamdyn/src/Registry_BeamDyn.txt +++ b/modules-local/beamdyn/src/Registry_BeamDyn.txt @@ -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" diff --git a/modules-local/elastodyn/src/ElastoDyn.f90 b/modules-local/elastodyn/src/ElastoDyn.f90 index 2adc01fe65..ad3a21b99a 100644 --- a/modules-local/elastodyn/src/ElastoDyn.f90 +++ b/modules-local/elastodyn/src/ElastoDyn.f90 @@ -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) @@ -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 diff --git a/modules-local/openfast-library/src/FAST_Subs.f90 b/modules-local/openfast-library/src/FAST_Subs.f90 index d8532ee862..b21dd1824f 100644 --- a/modules-local/openfast-library/src/FAST_Subs.f90 +++ b/modules-local/openfast-library/src/FAST_Subs.f90 @@ -414,6 +414,7 @@ SUBROUTINE FAST_InitializeAll( t_initial, p_FAST, y_FAST, m_FAST, ED, BD, SrvD, if (allocated(InitOutData_BD(k)%RotFrame_x)) call move_alloc(InitOutData_BD(k)%RotFrame_x, y_FAST%Lin%Modules(MODULE_BD)%Instance(k)%RotFrame_x ) if (allocated(InitOutData_BD(k)%RotFrame_u)) call move_alloc(InitOutData_BD(k)%RotFrame_u, y_FAST%Lin%Modules(MODULE_BD)%Instance(k)%RotFrame_u ) if (allocated(InitOutData_BD(k)%IsLoad_u )) call move_alloc(InitOutData_BD(k)%IsLoad_u , y_FAST%Lin%Modules(MODULE_BD)%Instance(k)%IsLoad_u ) + if (allocated(InitOutData_BD(k)%DerivOrder_x )) call move_alloc(InitOutData_BD(k)%DerivOrder_x , y_FAST%Lin%Modules(MODULE_BD)%Instance(k)%DerivOrder_x ) if (allocated(InitOutData_BD(k)%WriteOutputHdr)) y_FAST%Lin%Modules(MODULE_BD)%Instance(k)%NumOutputs = size(InitOutData_BD(k)%WriteOutputHdr) diff --git a/modules-local/openfast-registry/src/Template_data.c b/modules-local/openfast-registry/src/Template_data.c index f363319ceb..22aa731e7e 100644 --- a/modules-local/openfast-registry/src/Template_data.c +++ b/modules-local/openfast-registry/src/Template_data.c @@ -165,7 +165,8 @@ char *template_data[] = { "", " ! Otherwise, if the module does allow linearization, return the appropriate Jacobian row/column names and rotating-frame flags here:", " ! Allocate and set these variables: InitOut%LinNames_y, InitOut%LinNames_x, InitOut%LinNames_xd, InitOut%LinNames_z, InitOut%LinNames_u", -" ! Allocate and set these variables: InitOut%RotFrame_y, InitOut%RotFrame_x, InitOut%RotFrame_xd, InitOut%RotFrame_z, InitOut%RotFrame_u, InitOut%IsLoad_u", +" ! Allocate and set these variables: InitOut%RotFrame_y, InitOut%RotFrame_x, InitOut%RotFrame_xd, InitOut%RotFrame_z, InitOut%RotFrame_u", +" ! Allocate and set these variables: InitOut%IsLoad_u, InitOut%DerivOrder_x", "", " end if", "", diff --git a/modules-local/openfast-registry/src/Template_registry.c b/modules-local/openfast-registry/src/Template_registry.c index e4566b762a..e06dc7dcad 100644 --- a/modules-local/openfast-registry/src/Template_registry.c +++ b/modules-local/openfast-registry/src/Template_registry.c @@ -36,6 +36,7 @@ char *template_registry[] = { "#typedef ^ InitOutputType LOGICAL RotFrame_z {:} - - \"Flag that tells FAST if the constraint states used in linearization are in the rotating frame\" -", "#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 matrices)\" -", +"#typedef ^ InitOutputType IntKi DerivOrder_x {:} - - \"Integer that tells FAST/MBC3 the order derivative for the continuous states used in linearization\" -", "", "", "# ..... States ....................................................................................................................", From d61a4ed31801ce742c6979eea04f25b83b059b5d Mon Sep 17 00:00:00 2001 From: Bonnie Jonkman Date: Tue, 15 Jan 2019 13:43:34 -0700 Subject: [PATCH 4/6] Linear: update Assemble_dUdy_Motions to replace version for MAP++ --- .../openfast-library/src/FAST_Lin.f90 | 52 ++++--------------- 1 file changed, 9 insertions(+), 43 deletions(-) diff --git a/modules-local/openfast-library/src/FAST_Lin.f90 b/modules-local/openfast-library/src/FAST_Lin.f90 index e8c561bcfd..6fb9ebf430 100644 --- a/modules-local/openfast-library/src/FAST_Lin.f90 +++ b/modules-local/openfast-library/src/FAST_Lin.f90 @@ -2777,7 +2777,7 @@ SUBROUTINE Linear_MAP_InputSolve_dy( p_FAST, y_FAST, u_MAP, y_ED, MeshMapData, d ED_Out_Start = Indx_y_ED_Platform_Start(y_ED, y_FAST) ! start of y_ED%PlatformPtMesh%TranslationDisp field call Linearize_Point_to_Point( y_ED%PlatformPtMesh, u_MAP%PtFairDisplacement, MeshMapData%ED_P_2_Mooring_P, ErrStat2, ErrMsg2 ) - call Assemble_MAP_dUdy_Motions(y_ED%PlatformPtMesh, u_MAP%PtFairDisplacement, MeshMapData%ED_P_2_Mooring_P, MAP_Start, ED_Out_Start, dUdy, .true.) + call Assemble_dUdy_Motions(y_ED%PlatformPtMesh, u_MAP%PtFairDisplacement, MeshMapData%ED_P_2_Mooring_P, MAP_Start, ED_Out_Start, dUdy, onlyTranslationDisp=.true.) END IF @@ -3354,7 +3354,7 @@ END SUBROUTINE SumBlockMatrix !! \vec{a}^S \\ !! \vec{\alpha}^S \\ !! \end{matrix} \right\} \f$ -SUBROUTINE Assemble_dUdy_Motions(y, u, MeshMap, BlockRowStart, BlockColStart, dUdy, skipRotVel) +SUBROUTINE Assemble_dUdy_Motions(y, u, MeshMap, BlockRowStart, BlockColStart, dUdy, skipRotVel, onlyTranslationDisp) TYPE(MeshType), INTENT(IN) :: y !< the output (source) mesh that is transfering motions TYPE(MeshType), INTENT(IN) :: u !< the input (destination) mesh that is receiving motions TYPE(MeshMapType), INTENT(IN) :: MeshMap !< the mesh mapping from y to u @@ -3362,6 +3362,7 @@ SUBROUTINE Assemble_dUdy_Motions(y, u, MeshMap, BlockRowStart, BlockColStart, dU INTEGER(IntKi), INTENT(IN) :: BlockColStart !< the index of the column defining the block of dUdy to be set REAL(R8Ki), INTENT(INOUT) :: dUdy(:,:) !< full Jacobian matrix LOGICAL, OPTIONAL, INTENT(IN) :: skipRotVel !< if present and true, we skip the rotational velocity and acceleration fields and return early + LOGICAL, OPTIONAL, INTENT(IN) :: onlyTranslationDisp !< if present and true, we set only the destination translationDisp fields and return early INTEGER(IntKi) :: row INTEGER(IntKi) :: col @@ -3385,7 +3386,12 @@ SUBROUTINE Assemble_dUdy_Motions(y, u, MeshMap, BlockRowStart, BlockColStart, dU col = BlockColStart + y%NNodes*3 ! start of y%Orientation field [skip 1 field with 3 components] call SetBlockMatrix( dUdy, MeshMap%dM%fx_p, row, col ) - + + if (PRESENT(onlyTranslationDisp)) then + if (onlyTranslationDisp) return ! destination includes only the translational displacement field, so we'll just return + end if + + !*** row for orientation *** ! source orientation to destination orientation: row = BlockRowStart + u%NNodes*3 ! start of u%Orientation field [skip 1 field with 3 components] @@ -3452,46 +3458,6 @@ SUBROUTINE Assemble_dUdy_Motions(y, u, MeshMap, BlockRowStart, BlockColStart, dU END SUBROUTINE Assemble_dUdy_Motions -!---------------------------------------------------------------------------------------------------------------------------------- -!> This routine assembles the linearization matrices for transfer of motion fields between two meshes. -!> It set the following block matrix, which is the dUdy block for transfering output (source) mesh \f$y\f$ to the -!! input (destination) mesh \f$u\f$:\n -!! \f$ M = - \begin{bmatrix} M_{mi} & M_{f_{\times p}} \\ -!! 0 & 0 \\ -!! \end{bmatrix} \f$ -!! where the matrices correspond to -!! \f$ \left\{ \begin{matrix} -!! \vec{u}^S \\ -!! \end{matrix} \right\} \f$ -SUBROUTINE Assemble_MAP_dUdy_Motions(y, u, MeshMap, BlockRowStart, BlockColStart, dUdy, skipRotVel) - TYPE(MeshType), INTENT(IN) :: y !< the output (source) mesh that is transfering motions - TYPE(MeshType), INTENT(IN) :: u !< the input (destination) mesh that is receiving motions - TYPE(MeshMapType), INTENT(IN) :: MeshMap !< the mesh mapping from y to u - INTEGER(IntKi), INTENT(IN) :: BlockRowStart !< the index of the row defining the block of dUdy to be set - INTEGER(IntKi), INTENT(IN) :: BlockColStart !< the index of the column defining the block of dUdy to be set - REAL(R8Ki), INTENT(INOUT) :: dUdy(:,:) !< full Jacobian matrix - LOGICAL, OPTIONAL, INTENT(IN) :: skipRotVel !< if present and true, we skip the rotational velocity and acceleration fields and return early - - INTEGER(IntKi) :: row - INTEGER(IntKi) :: col - -!! \f$M_{mi}\f$ is modmesh_mapping::meshmaplinearizationtype::mi (motion identity)\n -!! \f$M_{f_{\times p}}\f$ is modmesh_mapping::meshmaplinearizationtype::fx_p \n - - - !*** row for translational displacement *** - ! source translational displacement to destination translational displacement: - row = BlockRowStart ! start of u%TranslationDisp field - col = BlockColStart ! start of y%TranslationDisp field - call SetBlockMatrix( dUdy, MeshMap%dM%mi, row, col ) - - ! source orientation to destination translational displacement: - row = BlockRowStart ! start of u%TranslationDisp field - col = BlockColStart + y%NNodes*3 ! start of y%Orientation field [skip 1 field with 3 components] - call SetBlockMatrix( dUdy, MeshMap%dM%fx_p, row, col ) - -END SUBROUTINE Assemble_MAP_dUdy_Motions - !---------------------------------------------------------------------------------------------------------------------------------- !> This routine assembles the linearization matrices for transfer of load fields between two meshes. !> It set the following block matrix, which is the dUdy block for transfering output (source) mesh \f$y\f$ to the From b6c9df398a08a63aa0eadd83d221e346a409f5d5 Mon Sep 17 00:00:00 2001 From: Bonnie Jonkman Date: Mon, 21 Jan 2019 15:48:31 -0700 Subject: [PATCH 5/6] Linear: simplified some indices HD index is changed slightly (see the if statements around which meshes are initialized) --- .../openfast-library/src/FAST_Lin.f90 | 59 ++++--------------- 1 file changed, 12 insertions(+), 47 deletions(-) diff --git a/modules-local/openfast-library/src/FAST_Lin.f90 b/modules-local/openfast-library/src/FAST_Lin.f90 index 6fb9ebf430..6cd7660a8e 100644 --- a/modules-local/openfast-library/src/FAST_Lin.f90 +++ b/modules-local/openfast-library/src/FAST_Lin.f90 @@ -1676,19 +1676,11 @@ SUBROUTINE Linear_ED_InputSolve_du( p_FAST, y_FAST, u_ED, y_ED, y_AD, u_AD, BD, ! ED inputs on blade from AeroDyn IF (p_FAST%CompElast == Module_ED) THEN - ! blades: - AD_Start_Bl = y_FAST%Lin%Modules(MODULE_AD)%Instance(1)%LinStartIndx(LIN_INPUT_COL) & - + u_AD%TowerMotion%NNodes * 9 & ! 3 fields (MASKID_TRANSLATIONDISP,MASKID_Orientation,MASKID_TRANSLATIONVel) with 3 components - + u_AD%HubMotion%NNodes * 9 ! 3 fields (MASKID_TRANSLATIONDISP,MASKID_Orientation,MASKID_RotationVel) with 3 components - - do k = 1,size(u_AD%BladeRootMotion) - AD_Start_Bl = AD_Start_Bl + u_AD%BladeRootMotion(k)%NNodes * 3 ! 1 field (MASKID_Orientation) with 3 components - end do - ! next is u_AD%BladeMotion(k); note that it has 3 fields and we only need 1 - ED_Start_mt = y_FAST%Lin%Modules(MODULE_ED)%Instance(1)%LinStartIndx(LIN_INPUT_COL) + DO K = 1,SIZE(u_ED%BladePtLoads,1) ! Loop through all blades (p_ED%NumBl) ED_Start_mt = ED_Start_mt + u_ED%BladePtLoads(k)%NNodes*3 ! skip the forces on this blade + AD_Start_Bl = Indx_u_AD_Blade_Start(u_AD, y_FAST, k) CALL Linearize_Line2_to_Point( y_AD%BladeLoad(k), u_ED%BladePtLoads(k), MeshMapData%AD_L_2_BDED_B(k), ErrStat2, ErrMsg2, u_AD%BladeMotion(k), y_ED%BladeLn2Mesh(k) ) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) @@ -1699,7 +1691,6 @@ SUBROUTINE Linear_ED_InputSolve_du( p_FAST, y_FAST, u_ED, y_ED, y_AD, u_AD, BD, end if ! get starting index of next blade - AD_Start_Bl = AD_Start_Bl + u_AD%BladeMotion(k)%Nnodes * 9 ! 3 fields (MASKID_TRANSLATIONDISP,MASKID_Orientation,MASKID_TRANSLATIONVel) with 3 components ED_Start_mt = ED_Start_mt + u_ED%BladePtLoads(k)%NNodes* 3 ! skip the moments on this blade END DO @@ -1709,15 +1700,8 @@ SUBROUTINE Linear_ED_InputSolve_du( p_FAST, y_FAST, u_ED, y_ED, y_AD, u_AD, BD, ! ED inputs on tower from AD: IF ( y_AD%TowerLoad%Committed ) THEN - ED_Start_mt = y_FAST%Lin%Modules(MODULE_ED)%Instance(1)%LinStartIndx(LIN_INPUT_COL) - if (allocated(u_ED%BladePtLoads)) then - do i=1,size(u_ED%BladePtLoads) - ED_Start_mt = ED_Start_mt + u_ED%BladePtLoads(i)%NNodes * 6 ! 3 forces + 3 moments at each node on each blade - end do - end if - ED_Start_mt = ED_Start_mt + u_ED%PlatformPtMesh%NNodes * 6 & ! 3 forces + 3 moments at each node - + u_ED%TowerPtLoads%NNodes * 3 ! 3 forces at each node (we're going to start at the moments) - + ED_Start_mt = Indx_u_ED_Tower_Start(u_ED, y_FAST) & + + u_ED%TowerPtLoads%NNodes * 3 ! 3 forces at each node (we're going to start at the moments) CALL Linearize_Line2_to_Point( y_AD%TowerLoad, u_ED%TowerPtLoads, MeshMapData%AD_L_2_ED_P_T, ErrStat2, ErrMsg2, u_AD%TowerMotion, y_ED%TowerLn2Mesh ) CALL SetErrStat(ErrStat2, ErrMsg2, ErrStat, ErrMsg, RoutineName) @@ -1736,12 +1720,8 @@ SUBROUTINE Linear_ED_InputSolve_du( p_FAST, y_FAST, u_ED, y_ED, y_AD, u_AD, BD, !.......... IF ( p_FAST%CompElast == Module_BD ) THEN ! see routine U_ED_SD_HD_BD_Orca_Residual() in SolveOption1 - - ED_Start_mt = y_FAST%Lin%Modules(MODULE_ED)%Instance(1)%LinStartIndx(LIN_INPUT_COL) - ! u_ED%BladePtLoads(i)%NNodes = 0 here - ED_Start_mt = ED_Start_mt + u_ED%PlatformPtMesh%NNodes * 6 & ! 3 forces + 3 moments at each node - + u_ED%TowerPtLoads%NNodes * 6 & ! 3 forces + 3 moments at each node - + u_ED%HubPtLoad%NNodes * 3 ! 3 forces at the hub (so we start at the moments) + ED_Start_mt = Indx_u_ED_Hub_Start(u_ED, y_FAST) & + + u_ED%HubPtLoad%NNodes * 3 ! 3 forces at the hub (so we start at the moments) ! Transfer BD loads to ED hub input: ! we're mapping loads, so we also need the sibling meshes' displacements: @@ -1769,22 +1749,12 @@ SUBROUTINE Linear_ED_InputSolve_du( p_FAST, y_FAST, u_ED, y_ED, y_AD, u_AD, BD, ! we're just going to assume u_ED%PlatformPtMesh is committed if ( HD%y%AllHdroOrigin%Committed ) then ! meshes for floating - - ED_Start_mt = y_FAST%Lin%Modules(MODULE_ED)%Instance(1)%LinStartIndx(LIN_INPUT_COL) - if (allocated(u_ED%BladePtLoads)) then - do i=1,size(u_ED%BladePtLoads) - ED_Start_mt = ED_Start_mt + u_ED%BladePtLoads(i)%NNodes * 6 ! 3 forces + 3 moments at each node on each blade - end do - end if - ED_Start_mt = ED_Start_mt + u_ED%PlatformPtMesh%NNodes * 3 ! 3 forces at each node (we're going to start at the moments) + ED_Start_mt = Indx_u_ED_Platform_Start(u_ED, y_FAST) & + + u_ED%PlatformPtMesh%NNodes * 3 ! 3 forces at each node (we're going to start at the moments) ! Transfer HD load outputs to ED PlatformPtMesh input: ! we're mapping loads, so we also need the sibling meshes' displacements: - if ( HD%Input(1)%Morison%DistribMesh%Committed ) then - HD_Start = y_FAST%Lin%Modules(MODULE_HD)%Instance(1)%LinStartIndx(LIN_INPUT_COL) - HD_Start = HD_Start + HD%Input(1)%Morison%DistribMesh%NNodes * 18 & ! 3 TranslationDisp, Orientation, TranslationVel, RotationVel, TranslationAcc, and RotationAcc at each node - + HD%Input(1)%Morison%LumpedMesh%NNodes * 18 ! 3 TranslationDisp, Orientation, TranslationVel, RotationVel, TranslationAcc, and RotationAcc at each node - end if + HD_Start = Indx_u_HD_PlatformRef_Start(HD%Input(1), y_FAST) call Linearize_Point_to_Point( HD%y%AllHdroOrigin, u_ED%PlatformPtMesh, MeshMapData%HD_W_P_2_ED_P, ErrStat2, ErrMsg2, HD%Input(1)%Mesh, y_ED%PlatformPtMesh) !HD%Input(1)%Mesh and y_ED%PlatformPtMesh contain the displaced positions for load calculations call SetErrStat(ErrStat2,ErrMsg2, ErrStat, ErrMsg, RoutineName) @@ -1803,14 +1773,8 @@ SUBROUTINE Linear_ED_InputSolve_du( p_FAST, y_FAST, u_ED, y_ED, y_AD, u_AD, BD, ! LIN-TODO: Implement if ( p_FAST%CompMooring == Module_MAP ) then - ED_Start_mt = y_FAST%Lin%Modules(MODULE_ED)%Instance(1)%LinStartIndx(LIN_INPUT_COL) - if (allocated(u_ED%BladePtLoads)) then - do i=1,size(u_ED%BladePtLoads) - ED_Start_mt = ED_Start_mt + u_ED%BladePtLoads(i)%NNodes * 6 ! 3 forces + 3 moments at each node on each blade - end do - end if - ED_Start_mt = ED_Start_mt + u_ED%PlatformPtMesh%NNodes * 3 ! 3 forces at each node (we're going to start at the moments) - + ED_Start_mt = Indx_u_ED_Platform_Start(u_ED, y_FAST) & + + u_ED%PlatformPtMesh%NNodes * 3 ! 3 forces at each node (we're going to start at the moments) ! Transfer MAP loads to ED PlatformPtmesh input: ! we're mapping loads, so we also need the sibling meshes' displacements: @@ -1831,6 +1795,7 @@ SUBROUTINE Linear_ED_InputSolve_du( p_FAST, y_FAST, u_ED, y_ED, y_AD, u_AD, BD, END SUBROUTINE Linear_ED_InputSolve_du + !---------------------------------------------------------------------------------------------------------------------------------- !> This routine forms the dU^{BD}/du^{BD} and dU^{BD}/du^{AD} blocks (BD row) of dUdu. (i.e., how do changes in the AD and BD inputs !! affect the BD inputs?) This should be called only when p_FAST%CompElast == Module_BD. From 3db6267df3763b3338cbb07bbaec9b6ac3d75795 Mon Sep 17 00:00:00 2001 From: Bonnie Jonkman Date: Thu, 24 Jan 2019 12:33:06 -0700 Subject: [PATCH 6/6] Linear: updated IF statements for HD/MAP; also simplified indices The IF statements for the ED to ED transfer due to HD or MAP meshes should be included only if --- .../openfast-library/src/FAST_Lin.f90 | 33 +++++++------------ 1 file changed, 12 insertions(+), 21 deletions(-) diff --git a/modules-local/openfast-library/src/FAST_Lin.f90 b/modules-local/openfast-library/src/FAST_Lin.f90 index 6cd7660a8e..d0df4d3354 100644 --- a/modules-local/openfast-library/src/FAST_Lin.f90 +++ b/modules-local/openfast-library/src/FAST_Lin.f90 @@ -1980,16 +1980,9 @@ SUBROUTINE Linear_AD_InputSolve_du( p_FAST, y_FAST, u_AD, y_ED, BD, MeshMapData, END IF - ! index for u_AD%BladeMotion(1)%translationDisp field - AD_Start_td = y_FAST%Lin%Modules(MODULE_AD)%Instance(1)%LinStartIndx(LIN_INPUT_COL) & - + u_AD%TowerMotion%NNodes * 9 & ! 3 fields (MASKID_TRANSLATIONDISP,MASKID_Orientation,MASKID_TRANSLATIONVel) with 3 components - + u_AD%HubMotion%NNodes * 9 ! 3 fields (MASKID_TRANSLATIONDISP,MASKID_Orientation,MASKID_RotationVel) with 3 components - - do k = 1,size(u_AD%BladeRootMotion) - AD_Start_td = AD_Start_td + u_AD%BladeRootMotion(k)%NNodes * 3 ! 1 field (MASKID_Orientation) with 3 components - end do DO k=1,size(u_AD%BladeMotion) + AD_Start_td = Indx_u_AD_Blade_Start(u_AD, y_FAST, k) ! index for u_AD%BladeMotion(k)%translationDisp field !AD is the destination here, so we need tv_ud if (allocated( MeshMapData%BDED_L_2_AD_L_B(k)%dM%tv_ud)) then @@ -1999,9 +1992,6 @@ SUBROUTINE Linear_AD_InputSolve_du( p_FAST, y_FAST, u_AD, y_ED, BD, MeshMapData, call SetBlockMatrix( dUdu, MeshMapData%BDED_L_2_AD_L_B(k)%dM%tv_ud, AD_Start_tv, AD_Start_td ) end if - ! index for u_AD%BladeMotion(k+1)%translationDisp field - AD_Start_td = AD_Start_td + u_AD%BladeMotion(k)%NNodes * 9 ! 3 fields (TranslationDisp, Orientation, TranslationVel) with 3 components - END DO @@ -2189,12 +2179,13 @@ SUBROUTINE Linear_ED_InputSolve_dy( p_FAST, y_FAST, u_ED, y_ED, y_AD, u_AD, BD, HD_Out_Start = Indx_y_HD_AllHdro_Start(HD%y, y_FAST) ED_Start = Indx_u_ED_Platform_Start(u_ED, y_FAST) ! start of u_ED%PlatformPtMesh%TranslationDisp field call Assemble_dUdy_Loads(HD%y%AllHdroOrigin, u_ED%PlatformPtMesh, MeshMapData%HD_W_P_2_ED_P, ED_Start, HD_Out_Start, dUdy) - end if - ! ED translation displacement-to-ED moment transfer (dU^{ED}/dy^{ED}): - ED_Start = Indx_u_ED_Platform_Start(u_ED, y_FAST) + u_ED%PlatformPtMesh%NNodes*3 ! start of u_ED%PlatformPtMesh%Moment field (skip the ED forces) - ED_Out_Start = Indx_y_ED_Platform_Start(y_ED, y_FAST) ! start of y_ED%PlatformPtMesh%TranslationDisp field - call SetBlockMatrix( dUdy, MeshMapData%HD_W_P_2_ED_P%dM%m_uD, ED_Start, ED_Out_Start ) + ! ED translation displacement-to-ED moment transfer (dU^{ED}/dy^{ED}): + ED_Start = Indx_u_ED_Platform_Start(u_ED, y_FAST) + u_ED%PlatformPtMesh%NNodes*3 ! start of u_ED%PlatformPtMesh%Moment field (skip the ED forces) + ED_Out_Start = Indx_y_ED_Platform_Start(y_ED, y_FAST) ! start of y_ED%PlatformPtMesh%TranslationDisp field + call SetBlockMatrix( dUdy, MeshMapData%HD_W_P_2_ED_P%dM%m_uD, ED_Start, ED_Out_Start ) +! maybe this should be SumBlockMatrix with future changes to linearized modules??? + end if end if @@ -2209,12 +2200,12 @@ SUBROUTINE Linear_ED_InputSolve_dy( p_FAST, y_FAST, u_ED, y_ED, y_AD, u_AD, BD, MAP_Out_Start = y_FAST%Lin%Modules(MODULE_MAP)%Instance(1)%LinStartIndx(LIN_OUTPUT_COL) ED_Start = Indx_u_ED_Platform_Start(u_ED, y_FAST) ! start of u_ED%PlatformPtMesh%TranslationDisp field call Assemble_dUdy_Loads(MAPp%y%ptFairLeadLoad, u_ED%PlatformPtMesh, MeshMapData%Mooring_P_2_ED_P, ED_Start, MAP_Out_Start, dUdy) - end if - ! ED translation displacement-to-ED moment transfer (dU^{ED}/dy^{ED}): - ED_Start = Indx_u_ED_Platform_Start(u_ED, y_FAST) + u_ED%PlatformPtMesh%NNodes*3 ! start of u_ED%PlatformPtMesh%Moment field (skip the ED forces) - ED_Out_Start = Indx_y_ED_Platform_Start(y_ED, y_FAST) ! start of y_ED%PlatformPtMesh%TranslationDisp field - call SumBlockMatrix( dUdy, MeshMapData%Mooring_P_2_ED_P%dM%m_uD, ED_Start, ED_Out_Start ) + ! ED translation displacement-to-ED moment transfer (dU^{ED}/dy^{ED}): + ED_Start = Indx_u_ED_Platform_Start(u_ED, y_FAST) + u_ED%PlatformPtMesh%NNodes*3 ! start of u_ED%PlatformPtMesh%Moment field (skip the ED forces) + ED_Out_Start = Indx_y_ED_Platform_Start(y_ED, y_FAST) ! start of y_ED%PlatformPtMesh%TranslationDisp field + call SumBlockMatrix( dUdy, MeshMapData%Mooring_P_2_ED_P%dM%m_uD, ED_Start, ED_Out_Start ) + end if end if