Skip to content

Commit f0d2114

Browse files
committed
Remove VF_SmallAngle flag from ModVar
1 parent 363e806 commit f0d2114

11 files changed

Lines changed: 496 additions & 531 deletions

File tree

docs/source/user/glue-code/ModVar.svg

Lines changed: 442 additions & 446 deletions
Loading

docs/source/user/glue-code/modvar.dot

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,15 @@ digraph ModVarDiagram {
3838
<tr><td align="left">VF_RotFrame</td><td>4</td></tr>
3939
<tr><td align="left">VF_Linearize</td><td>8</td></tr>
4040
<tr><td align="left">VF_ExtLin</td><td>16</td></tr>
41-
<tr><td align="left">VF_SmallAngle</td><td>32</td></tr>
42-
<tr><td align="left">VF_2PI</td><td>64</td></tr>
43-
<tr><td align="left">VF_WM_Rot</td><td>128</td></tr>
44-
<tr><td align="left">VF_WriteOut</td><td>256</td></tr>
45-
<tr><td align="left">VF_Solve</td><td>512</td></tr>
46-
<tr><td align="left">VF_AeroMap</td><td>1024</td></tr>
47-
<tr><td align="left">VF_DerivOrder1</td><td>2048</td></tr>
48-
<tr><td align="left">VF_DerivOrder2</td><td>4096</td></tr>
49-
<tr><td align="left">VF_Mapping</td><td>8192</td></tr>
50-
<tr><td align="left">VF_NoLin</td><td>16384</td></tr>
41+
<tr><td align="left">VF_2PI</td><td>32</td></tr>
42+
<tr><td align="left">VF_WM_Rot</td><td>64</td></tr>
43+
<tr><td align="left">VF_WriteOut</td><td>128</td></tr>
44+
<tr><td align="left">VF_Solve</td><td>256</td></tr>
45+
<tr><td align="left">VF_AeroMap</td><td>512</td></tr>
46+
<tr><td align="left">VF_DerivOrder1</td><td>1024</td></tr>
47+
<tr><td align="left">VF_DerivOrder2</td><td>2048</td></tr>
48+
<tr><td align="left">VF_Mapping</td><td>4096</td></tr>
49+
<tr><td align="left">VF_NoLin</td><td>8192</td></tr>
5150
</table>>;];
5251

5352
ModVarType [shape = plain;label = <<table border="0" cellborder="1" cellspacing="0" cellpadding="0">

docs/source/user/glue-code/modvar.rst

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -132,29 +132,25 @@ Flags are combined via ``IOR`` and tested with ``MV_HasFlagsAll`` /
132132
* - ``VF_ExtLin``
133133
- 16
134134
- Variable is included in extended linearization output.
135-
* - ``VF_SmallAngle``
136-
- 32
137-
- Use small-angle approximation when computing orientation differences for
138-
linearization.
139135
* - ``VF_2PI``
140-
- 64
136+
- 32
141137
- Scalar angle with range [0, 2π] (e.g. generator azimuth).
142138
* - ``VF_WriteOut``
143-
- 256
139+
- 64
144140
- Output variable associated with a ``WriteOutput`` channel.
145141
* - ``VF_Solve``
146-
- 512
142+
- 256
147143
- Variable participates in the tight-coupling Jacobian or input-output
148144
convergence solve. Set automatically by ``FAST_SolverInit``;
149145
module developers should not set this flag manually.
150146
* - ``VF_AeroMap``
151-
- 1024
147+
- 512
152148
- Variable used in aeromap computation.
153149
* - ``VF_Mapping``
154-
- 8192
150+
- 1024
155151
- Variable participates in a module-to-module transfer mapping.
156152
* - ``VF_NoLin``
157-
- 16384
153+
- 8192
158154
- Explicitly excludes a variable from both linearization and the solver
159155
(overrides ``VF_Linearize`` and ``VF_Solve``).
160156

@@ -455,5 +451,4 @@ straightforward finite-differencing via quaternion composition
455451

456452
When computing orientation differences for Jacobian rows, ``MV_ComputeDiff``
457453
computes the relative rotation between the negative and positive-perturbation
458-
quaternions and converts it to a rotation vector (small-angle approximation
459-
or full Rodrigues formula depending on ``VF_SmallAngle``).
454+
quaternions and converts it to a rotation vector.

modules/aerodyn/src/AeroDyn.f90

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6149,7 +6149,6 @@ subroutine AD_InitVars(iR, u, p, x, z, OtherState, y, m, InitOut, InputFileData,
61496149
call MV_AddMeshVar(InitOut%Vars%u, "Tower", [FieldTransDisp, FieldOrientation, FieldTransVel, FieldTransAcc], &
61506150
DatLoc(AD_u_TowerMotion), &
61516151
Mesh=u%TowerMotion, &
6152-
Flags=VF_SmallAngle, &
61536152
Perturbs=[PerturbTower, Perturb, PerturbTower, PerturbTower])
61546153

61556154
! Add blade root motion

modules/elastodyn/src/ElastoDyn.f90

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11314,13 +11314,12 @@ subroutine ED_InitVars(u, p, x, y, m, Vars, InputFileData, Linearize, ErrStat, E
1131411314

1131511315
call MV_AddMeshVar(Vars%y, 'Platform', MotionFields, &
1131611316
DatLoc(ED_y_PlatformPtMesh), &
11317-
Mesh=y%PlatformPtMesh, &
11318-
Flags=VF_SmallAngle)
11317+
Mesh=y%PlatformPtMesh)
1131911318

1132011319
call MV_AddMeshVar(Vars%y, 'Tower', MotionFields, &
1132111320
DatLoc(ED_y_TowerLn2Mesh), &
1132211321
Mesh=y%TowerLn2Mesh, &
11323-
Flags=ior(VF_Line, VF_SmallAngle))
11322+
Flags=VF_Line)
1132411323

1132511324
call MV_AddMeshVar(Vars%y, 'Hub', [FieldTransDisp, FieldOrientation, FieldAngularVel], &
1132611325
DatLoc(ED_y_HubPtMotion), &

modules/extptfm/src/ExtPtfm_MCKF.f90

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,8 +263,7 @@ subroutine ExtPtfm_InitVars(u, p, x, y, m, Vars, InputFileData, Linearize, ErrSt
263263

264264
call MV_AddMeshVar(Vars%u, 'Interface node', MotionFields, &
265265
DatLoc(ExtPtfm_u_PtfmMesh), &
266-
Mesh=u%PtfmMesh, &
267-
Flags=VF_SmallAngle)
266+
Mesh=u%PtfmMesh)
268267

269268
!---------------------------------------------------------------------------
270269
! Output variables

modules/nwtc-library/src/ModVar.f90

Lines changed: 6 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -533,16 +533,8 @@ subroutine MV_Perturb(Var, iLin, PerturbSign, BaseAry, PerturbAry)
533533
j = mod(iLin - 1, 3) ! component being modified (0, 1, 2)
534534
i = i - j ! index of start of quaternion parameters (3)
535535
quat = BaseAry(i:i + 2) ! Current quat parameters value
536-
if (MV_HasFlagsAll(Var, VF_SmallAngle)) then
537-
dcm = quat_to_dcm(quat)
538-
rv = GetSmllRotAngs(dcm, ErrStat, ErrMsg)
539-
rv(j + 1) = rv(j + 1) + Perturb
540-
call SmllRotTrans('linearization perturbation', rv(1), rv(2), rv(3), dcm, ErrStat=ErrStat, ErrMsg=ErrMsg)
541-
quat = dcm_to_quat(dcm)
542-
else
543-
quat_p = perturb_quat(Perturb, j + 1) ! Quaternion of perturbed angle
544-
quat = quat_compose(quat, quat_p) ! Compose perturbation and current rotation
545-
end if
536+
quat_p = perturb_quat(Perturb, j + 1) ! Quaternion of perturbed angle
537+
quat = quat_compose(quat, quat_p) ! Compose perturbation and current rotation
546538
PerturbAry(i:i + 2) = quat ! Save perturbed quaternion in array
547539
else
548540
PerturbAry(i) = PerturbAry(i) + Perturb ! Add perturbation directly
@@ -580,21 +572,11 @@ subroutine MV_ComputeDiff(VarAry, PosAry, NegAry, DiffAry)
580572
! If flag set to use small angle rotations
581573
if (UseSmallRotAngles) then
582574

583-
! If variable has flag to use small angles when computing difference
584-
if (MV_HasFlagsAll(VarAry(i), VF_SmallAngle)) then
585-
586-
ang_pos = GetSmllRotAngs(quat_to_dcm(quat_pos), ErrStat, ErrMsg)
587-
ang_neg = GetSmllRotAngs(quat_to_dcm(quat_neg), ErrStat, ErrMsg)
588-
589-
DiffAry(k:k + 2) = ang_pos - ang_neg
590-
else
591-
592-
! Calculate relative rotation from negative to positive perturbation
593-
delta = quat_compose(-quat_neg, quat_pos)
575+
! Calculate relative rotation from negative to positive perturbation
576+
delta = quat_compose(-quat_neg, quat_pos)
594577

595-
! Convert relative rotation from quaternion to rotation vector
596-
DiffAry(k:k + 2) = GetSmllRotAngs(quat_to_dcm(delta), ErrStat, ErrMsg)
597-
end if
578+
! Convert relative rotation from quaternion to rotation vector
579+
DiffAry(k:k + 2) = GetSmllRotAngs(quat_to_dcm(delta), ErrStat, ErrMsg)
598580

599581
else
600582

modules/nwtc-library/src/NWTC_Library_Types.f90

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -53,16 +53,15 @@ MODULE NWTC_Library_Types
5353
INTEGER(IntKi), PUBLIC, PARAMETER :: VF_RotFrame = 4 ! Variable in rotating frame [-]
5454
INTEGER(IntKi), PUBLIC, PARAMETER :: VF_Linearize = 8 ! Variable for linearization [-]
5555
INTEGER(IntKi), PUBLIC, PARAMETER :: VF_ExtLin = 16 ! Variable for extended linearization [-]
56-
INTEGER(IntKi), PUBLIC, PARAMETER :: VF_SmallAngle = 32 ! Use small angles to calculate difference in linearization [-]
57-
INTEGER(IntKi), PUBLIC, PARAMETER :: VF_2PI = 64 ! Variable is an angle with range [0,2pi] [-]
58-
INTEGER(IntKi), PUBLIC, PARAMETER :: VF_WM_Rot = 128 ! Variable is a Wiener-Milenkovic rotation [-]
59-
INTEGER(IntKi), PUBLIC, PARAMETER :: VF_WriteOut = 256 ! Variable for write output [-]
60-
INTEGER(IntKi), PUBLIC, PARAMETER :: VF_Solve = 512 ! Variable for tight coupling solver [-]
61-
INTEGER(IntKi), PUBLIC, PARAMETER :: VF_AeroMap = 1024 ! Variable for aeromap [-]
62-
INTEGER(IntKi), PUBLIC, PARAMETER :: VF_DerivOrder1 = 2048 ! Variable is derivative order 1 in linearization file [-]
63-
INTEGER(IntKi), PUBLIC, PARAMETER :: VF_DerivOrder2 = 4096 ! Variable is derivative order 2 in linearization file [-]
64-
INTEGER(IntKi), PUBLIC, PARAMETER :: VF_Mapping = 8192 ! Variable is used in a module-to-module transfer mapping [-]
65-
INTEGER(IntKi), PUBLIC, PARAMETER :: VF_NoLin = 16384 ! Flag to exclude variable from linearization or solver [-]
56+
INTEGER(IntKi), PUBLIC, PARAMETER :: VF_2PI = 32 ! Variable is an angle with range [0,2pi] [-]
57+
INTEGER(IntKi), PUBLIC, PARAMETER :: VF_WM_Rot = 64 ! Variable is a Wiener-Milenkovic rotation [-]
58+
INTEGER(IntKi), PUBLIC, PARAMETER :: VF_WriteOut = 128 ! Variable for write output [-]
59+
INTEGER(IntKi), PUBLIC, PARAMETER :: VF_Solve = 256 ! Variable for tight coupling solver [-]
60+
INTEGER(IntKi), PUBLIC, PARAMETER :: VF_AeroMap = 512 ! Variable for aeromap [-]
61+
INTEGER(IntKi), PUBLIC, PARAMETER :: VF_DerivOrder1 = 1024 ! Variable is derivative order 1 in linearization file [-]
62+
INTEGER(IntKi), PUBLIC, PARAMETER :: VF_DerivOrder2 = 2048 ! Variable is derivative order 2 in linearization file [-]
63+
INTEGER(IntKi), PUBLIC, PARAMETER :: VF_Mapping = 4096 ! Variable is used in a module-to-module transfer mapping [-]
64+
INTEGER(IntKi), PUBLIC, PARAMETER :: VF_NoLin = 8192 ! Flag to exclude variable from linearization or solver [-]
6665
INTEGER(IntKi), PUBLIC, PARAMETER :: MC_None = 0 ! [-]
6766
INTEGER(IntKi), PUBLIC, PARAMETER :: MC_Tight = 1 ! [-]
6867
INTEGER(IntKi), PUBLIC, PARAMETER :: MC_Option1 = 2 ! [-]

modules/nwtc-library/src/Registry_NWTC_Library.txt

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -63,16 +63,15 @@ param ^ - IntKi VF_Line - 2 -
6363
param ^ - IntKi VF_RotFrame - 4 - "Variable in rotating frame" -
6464
param ^ - IntKi VF_Linearize - 8 - "Variable for linearization" -
6565
param ^ - IntKi VF_ExtLin - 16 - "Variable for extended linearization" -
66-
param ^ - IntKi VF_SmallAngle - 32 - "Use small angles to calculate difference in linearization" -
67-
param ^ - IntKi VF_2PI - 64 - "Variable is an angle with range [0,2pi]" -
68-
param ^ - IntKi VF_WM_Rot - 128 - "Variable is a Wiener-Milenkovic rotation" -
69-
param ^ - IntKi VF_WriteOut - 256 - "Variable for write output" -
70-
param ^ - IntKi VF_Solve - 512 - "Variable for tight coupling solver" -
71-
param ^ - IntKi VF_AeroMap - 1024 - "Variable for aeromap" -
72-
param ^ - IntKi VF_DerivOrder1 - 2048 - "Variable is derivative order 1 in linearization file" -
73-
param ^ - IntKi VF_DerivOrder2 - 4096 - "Variable is derivative order 2 in linearization file" -
74-
param ^ - IntKi VF_Mapping - 8192 - "Variable is used in a module-to-module transfer mapping" -
75-
param ^ - IntKi VF_NoLin - 16384 - "Flag to exclude variable from linearization or solver" -
66+
param ^ - IntKi VF_2PI - 32 - "Variable is an angle with range [0,2pi]" -
67+
param ^ - IntKi VF_WM_Rot - 64 - "Variable is a Wiener-Milenkovic rotation" -
68+
param ^ - IntKi VF_WriteOut - 128 - "Variable for write output" -
69+
param ^ - IntKi VF_Solve - 256 - "Variable for tight coupling solver" -
70+
param ^ - IntKi VF_AeroMap - 512 - "Variable for aeromap" -
71+
param ^ - IntKi VF_DerivOrder1 - 1024 - "Variable is derivative order 1 in linearization file" -
72+
param ^ - IntKi VF_DerivOrder2 - 2048 - "Variable is derivative order 2 in linearization file" -
73+
param ^ - IntKi VF_Mapping - 4096 - "Variable is used in a module-to-module transfer mapping" -
74+
param ^ - IntKi VF_NoLin - 8192 - "Flag to exclude variable from linearization or solver" -
7675

7776
param ^ - IntKi MC_None - 0 - "" -
7877
param ^ - IntKi MC_Tight - 1 - "" -

modules/nwtc-library/src/Registry_NWTC_Library_base.txt

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -63,16 +63,15 @@ param ^ - IntKi VF_Line - 2 -
6363
param ^ - IntKi VF_RotFrame - 4 - "Variable in rotating frame" -
6464
param ^ - IntKi VF_Linearize - 8 - "Variable for linearization" -
6565
param ^ - IntKi VF_ExtLin - 16 - "Variable for extended linearization" -
66-
param ^ - IntKi VF_SmallAngle - 32 - "Use small angles to calculate difference in linearization" -
67-
param ^ - IntKi VF_2PI - 64 - "Variable is an angle with range [0,2pi]" -
68-
param ^ - IntKi VF_WM_Rot - 128 - "Variable is a Wiener-Milenkovic rotation" -
69-
param ^ - IntKi VF_WriteOut - 256 - "Variable for write output" -
70-
param ^ - IntKi VF_Solve - 512 - "Variable for tight coupling solver" -
71-
param ^ - IntKi VF_AeroMap - 1024 - "Variable for aeromap" -
72-
param ^ - IntKi VF_DerivOrder1 - 2048 - "Variable is derivative order 1 in linearization file" -
73-
param ^ - IntKi VF_DerivOrder2 - 4096 - "Variable is derivative order 2 in linearization file" -
74-
param ^ - IntKi VF_Mapping - 8192 - "Variable is used in a module-to-module transfer mapping" -
75-
param ^ - IntKi VF_NoLin - 16384 - "Flag to exclude variable from linearization or solver" -
66+
param ^ - IntKi VF_2PI - 32 - "Variable is an angle with range [0,2pi]" -
67+
param ^ - IntKi VF_WM_Rot - 64 - "Variable is a Wiener-Milenkovic rotation" -
68+
param ^ - IntKi VF_WriteOut - 128 - "Variable for write output" -
69+
param ^ - IntKi VF_Solve - 256 - "Variable for tight coupling solver" -
70+
param ^ - IntKi VF_AeroMap - 512 - "Variable for aeromap" -
71+
param ^ - IntKi VF_DerivOrder1 - 1024 - "Variable is derivative order 1 in linearization file" -
72+
param ^ - IntKi VF_DerivOrder2 - 2048 - "Variable is derivative order 2 in linearization file" -
73+
param ^ - IntKi VF_Mapping - 4096 - "Variable is used in a module-to-module transfer mapping" -
74+
param ^ - IntKi VF_NoLin - 8192 - "Flag to exclude variable from linearization or solver" -
7675

7776
param ^ - IntKi MC_None - 0 - "" -
7877
param ^ - IntKi MC_Tight - 1 - "" -

0 commit comments

Comments
 (0)