Skip to content

Commit

Permalink
AD: minor changes for future linearization
Browse files Browse the repository at this point in the history
This will help sync with Envision code better later.
  • Loading branch information
bjonkman committed Feb 16, 2021
1 parent e9d8f66 commit 57383cd
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
12 changes: 7 additions & 5 deletions modules/aerodyn/src/AeroDyn.f90
Original file line number Diff line number Diff line change
Expand Up @@ -4218,6 +4218,7 @@ SUBROUTINE AD_GetOP( t, u, p, x, xd, z, OtherState, y, m, ErrStat, ErrMsg, u_op,
end do

FieldMask(MASKID_TRANSLATIONDISP) = .true.
FieldMask(MASKID_Orientation) = .true.
FieldMask(MASKID_TRANSLATIONVel) = .true.
FieldMask(MASKID_RotationVel) = .true.
FieldMask(MASKID_TRANSLATIONAcc) = .true.
Expand Down Expand Up @@ -4309,7 +4310,7 @@ SUBROUTINE AD_GetOP( t, u, p, x, xd, z, OtherState, y, m, ErrStat, ErrMsg, u_op,
if (p%BEMT%UA%lin_nx>0) then
do j=1,p%NumBlades ! size(x%BEMT%UA%element,2)
do i=1,p%NumBlNds ! size(x%BEMT%UA%element,1)
do k=1,size(x%BEMT%UA%element(i,j)%x)
do k=1,4 !size(x%BEMT%UA%element(i,j)%x) !linearize only first 4 states (5th is vortex)
x_op(index) = x%BEMT%UA%element(i,j)%x(k)
index = index + 1
end do
Expand Down Expand Up @@ -4362,7 +4363,7 @@ SUBROUTINE AD_GetOP( t, u, p, x, xd, z, OtherState, y, m, ErrStat, ErrMsg, u_op,
if (p%BEMT%UA%lin_nx>0) then
do j=1,p%NumBlades ! size(dxdt%BEMT%UA%element,2)
do i=1,p%NumBlNds ! size(dxdt%BEMT%UA%element,1)
do k=1,size(dxdt%BEMT%UA%element(i,j)%x)
do k=1,4 !size(dxdt%BEMT%UA%element(i,j)%x) don't linearize 5th state
dx_op(index) = dxdt%BEMT%UA%element(i,j)%x(k)
index = index + 1
end do
Expand Down Expand Up @@ -5048,7 +5049,8 @@ SUBROUTINE Perturb_x( p, n, perturb_sign, x, dx )
endif

else
call GetStateIndices( n - p%BEMT%DBEMT%lin_nx, size(x%BEMT%UA%element,2), size(x%BEMT%UA%element,1), size(x%BEMT%UA%element(1,1)%x), Blade, BladeNode, StateIndex )
!call GetStateIndices( n - p%BEMT%DBEMT%lin_nx, size(x%BEMT%UA%element,2), size(x%BEMT%UA%element,1), size(x%BEMT%UA%element(1,1)%x), Blade, BladeNode, StateIndex )
call GetStateIndices( n - p%BEMT%DBEMT%lin_nx, size(x%BEMT%UA%element,2), size(x%BEMT%UA%element,1), 4, Blade, BladeNode, StateIndex )
x%BEMT%UA%element(BladeNode,Blade)%x(StateIndex) = x%BEMT%UA%element(BladeNode,Blade)%x(StateIndex) + dx * perturb_sign

end if
Expand Down Expand Up @@ -5153,8 +5155,8 @@ SUBROUTINE Compute_dX(p, x_p, x_m, delta_p, delta_m, dX)

do j=1,size(x_p%BEMT%UA%element,2) ! number of blades
do i=1,size(x_p%BEMT%UA%element,1) ! number of nodes per blade
dX(indx_first:indx_first+3) = x_p%BEMT%UA%element(i,j)%x - x_m%BEMT%UA%element(i,j)%x
indx_first = indx_first + size(x_p%BEMT%UA%element(i,j)%x) ! = index_first += 4
dX(indx_first:indx_first+3) = x_p%BEMT%UA%element(i,j)%x(1:4) - x_m%BEMT%UA%element(i,j)%x(1:4)
indx_first = indx_first + 4 ! = index_first += 4
end do
end do

Expand Down
1 change: 1 addition & 0 deletions modules/aerodyn/src/AeroDyn_Driver_Subs.f90
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ subroutine Init_AeroDyn(iCase, DvrData, AD, dt, errStat, errMsg)
InitInData%NumBlades = DvrData%numBlades
InitInData%RootName = DvrData%outFileData%Root
InitInData%Gravity = 9.80665_ReKi
InitInData%Linearize = .false.


! set initialization data:
Expand Down
4 changes: 2 additions & 2 deletions modules/aerodyn/src/AeroDyn_Registry.txt
Original file line number Diff line number Diff line change
Expand Up @@ -252,12 +252,12 @@ typedef ^ ParameterType ReKi dx {:} - - "vector that determines size of perturba
typedef ^ ParameterType Integer Jac_ny - - - "number of outputs in jacobian matrix" -

# ..... Inputs ....................................................................................................................
# Define inputs that are contained on the mesh here:
# Define inputs that are contained on a mesh here:
typedef ^ InputType MeshType TowerMotion - - - "motion on the tower" -
typedef ^ InputType MeshType HubMotion - - - "motion on the hub" -
typedef ^ InputType MeshType BladeRootMotion {:} - - "motion on each blade root" -
typedef ^ InputType MeshType BladeMotion {:} - - "motion on each blade" -
# Define inputs that are not on this mesh here:
# Define inputs that are not on a mesh here:
typedef ^ InputType ReKi InflowOnBlade {:}{:}{:} - - "U,V,W at nodes on each blade (note if we change the requirement that NumNodes is the same for each blade, this will need to change)" m/s
typedef ^ InputType ReKi InflowOnTower {:}{:} - - "U,V,W at nodes on the tower" m/s
typedef ^ InputType ReKi UserProp {:}{:} - - "Optional user property for interpolating airfoils (per element per blade)" -
Expand Down

0 comments on commit 57383cd

Please sign in to comment.