@@ -71,6 +71,8 @@ MODULE ExtLoadsDX_Types
71
71
INTEGER (C_int) :: twrDia_Len = 0
72
72
TYPE (C_ptr) :: twrHloc = C_NULL_PTR
73
73
INTEGER (C_int) :: twrHloc_Len = 0
74
+ TYPE (C_ptr) :: bldPitch = C_NULL_PTR
75
+ INTEGER (C_int) :: bldPitch_Len = 0
74
76
END TYPE ExtLdDX_InputType_C
75
77
TYPE, PUBLIC :: ExtLdDX_InputType
76
78
TYPE ( ExtLdDX_InputType_C ) :: C_obj
@@ -91,6 +93,7 @@ MODULE ExtLoadsDX_Types
91
93
REAL (KIND= C_DOUBLE) , DIMENSION (:), POINTER :: bldRloc = > NULL () ! < Radial location along the blade [m]
92
94
REAL (KIND= C_DOUBLE) , DIMENSION (:), POINTER :: twrDia = > NULL () ! < Tower diameter [m]
93
95
REAL (KIND= C_DOUBLE) , DIMENSION (:), POINTER :: twrHloc = > NULL () ! < Height location along the tower [m]
96
+ REAL (KIND= C_DOUBLE) , DIMENSION (:), POINTER :: bldPitch = > NULL () ! < Pitch angle of blade [-]
94
97
END TYPE ExtLdDX_InputType
95
98
! =======================
96
99
! ========= ExtLdDX_OutputType_C =======
@@ -377,6 +380,21 @@ SUBROUTINE ExtLdDX_CopyInput( SrcInputData, DstInputData, CtrlCode, ErrStat, Err
377
380
DstInputData% c_obj% twrHloc = C_LOC( DstInputData% twrHloc(i1_l) )
378
381
END IF
379
382
DstInputData% twrHloc = SrcInputData% twrHloc
383
+ ENDIF
384
+ IF (ASSOCIATED (SrcInputData% bldPitch)) THEN
385
+ i1_l = LBOUND (SrcInputData% bldPitch,1 )
386
+ i1_u = UBOUND (SrcInputData% bldPitch,1 )
387
+ IF (.NOT. ASSOCIATED (DstInputData% bldPitch)) THEN
388
+ ALLOCATE (DstInputData% bldPitch(i1_l:i1_u),STAT= ErrStat2)
389
+ IF (ErrStat2 /= 0 ) THEN
390
+ CALL SetErrStat(ErrID_Fatal, ' Error allocating DstInputData%bldPitch.' , ErrStat, ErrMsg,RoutineName)
391
+ RETURN
392
+ END IF
393
+ DstInputData% c_obj% bldPitch_Len = SIZE (DstInputData% bldPitch)
394
+ IF (DstInputData% c_obj% bldPitch_Len > 0 ) &
395
+ DstInputData% c_obj% bldPitch = C_LOC( DstInputData% bldPitch(i1_l) )
396
+ END IF
397
+ DstInputData% bldPitch = SrcInputData% bldPitch
380
398
ENDIF
381
399
END SUBROUTINE ExtLdDX_CopyInput
382
400
@@ -490,6 +508,12 @@ SUBROUTINE ExtLdDX_DestroyInput( InputData, ErrStat, ErrMsg )
490
508
InputData% twrHloc = > NULL ()
491
509
InputData% C_obj% twrHloc = C_NULL_PTR
492
510
InputData% C_obj% twrHloc_Len = 0
511
+ ENDIF
512
+ IF (ASSOCIATED (InputData% bldPitch)) THEN
513
+ DEALLOCATE (InputData% bldPitch)
514
+ InputData% bldPitch = > NULL ()
515
+ InputData% C_obj% bldPitch = C_NULL_PTR
516
+ InputData% C_obj% bldPitch_Len = 0
493
517
ENDIF
494
518
END SUBROUTINE ExtLdDX_DestroyInput
495
519
@@ -613,6 +637,11 @@ SUBROUTINE ExtLdDX_PackInput( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMs
613
637
Int_BufSz = Int_BufSz + 2 * 1 ! twrHloc upper/lower bounds for each dimension
614
638
Db_BufSz = Db_BufSz + SIZE (InData% twrHloc) ! twrHloc
615
639
END IF
640
+ Int_BufSz = Int_BufSz + 1 ! bldPitch allocated yes/no
641
+ IF ( ASSOCIATED (InData% bldPitch) ) THEN
642
+ Int_BufSz = Int_BufSz + 2 * 1 ! bldPitch upper/lower bounds for each dimension
643
+ Db_BufSz = Db_BufSz + SIZE (InData% bldPitch) ! bldPitch
644
+ END IF
616
645
IF ( Re_BufSz .GT. 0 ) THEN
617
646
ALLOCATE ( ReKiBuf( Re_BufSz ), STAT= ErrStat2 )
618
647
IF (ErrStat2 /= 0 ) THEN
@@ -897,6 +926,21 @@ SUBROUTINE ExtLdDX_PackInput( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat, ErrMs
897
926
Db_Xferred = Db_Xferred + 1
898
927
END DO
899
928
END IF
929
+ IF ( .NOT. ASSOCIATED (InData% bldPitch) ) THEN
930
+ IntKiBuf( Int_Xferred ) = 0
931
+ Int_Xferred = Int_Xferred + 1
932
+ ELSE
933
+ IntKiBuf( Int_Xferred ) = 1
934
+ Int_Xferred = Int_Xferred + 1
935
+ IntKiBuf( Int_Xferred ) = LBOUND (InData% bldPitch,1 )
936
+ IntKiBuf( Int_Xferred + 1 ) = UBOUND (InData% bldPitch,1 )
937
+ Int_Xferred = Int_Xferred + 2
938
+
939
+ DO i1 = LBOUND (InData% bldPitch,1 ), UBOUND (InData% bldPitch,1 )
940
+ DbKiBuf(Db_Xferred) = InData% bldPitch(i1)
941
+ Db_Xferred = Db_Xferred + 1
942
+ END DO
943
+ END IF
900
944
END SUBROUTINE ExtLdDX_PackInput
901
945
902
946
SUBROUTINE ExtLdDX_UnPackInput ( ReKiBuf , DbKiBuf , IntKiBuf , Outdata , ErrStat , ErrMsg )
@@ -1283,6 +1327,27 @@ SUBROUTINE ExtLdDX_UnPackInput( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrStat, Er
1283
1327
Db_Xferred = Db_Xferred + 1
1284
1328
END DO
1285
1329
END IF
1330
+ IF ( IntKiBuf( Int_Xferred ) == 0 ) THEN ! bldPitch not allocated
1331
+ Int_Xferred = Int_Xferred + 1
1332
+ ELSE
1333
+ Int_Xferred = Int_Xferred + 1
1334
+ i1_l = IntKiBuf( Int_Xferred )
1335
+ i1_u = IntKiBuf( Int_Xferred + 1 )
1336
+ Int_Xferred = Int_Xferred + 2
1337
+ IF (ASSOCIATED (OutData% bldPitch)) DEALLOCATE (OutData% bldPitch)
1338
+ ALLOCATE (OutData% bldPitch(i1_l:i1_u),STAT= ErrStat2)
1339
+ IF (ErrStat2 /= 0 ) THEN
1340
+ CALL SetErrStat(ErrID_Fatal, ' Error allocating OutData%bldPitch.' , ErrStat, ErrMsg,RoutineName)
1341
+ RETURN
1342
+ END IF
1343
+ OutData% c_obj% bldPitch_Len = SIZE (OutData% bldPitch)
1344
+ IF (OutData% c_obj% bldPitch_Len > 0 ) &
1345
+ OutData% c_obj% bldPitch = C_LOC( OutData% bldPitch(i1_l) )
1346
+ DO i1 = LBOUND (OutData% bldPitch,1 ), UBOUND (OutData% bldPitch,1 )
1347
+ OutData% bldPitch(i1) = REAL (DbKiBuf(Db_Xferred), C_DOUBLE)
1348
+ Db_Xferred = Db_Xferred + 1
1349
+ END DO
1350
+ END IF
1286
1351
END SUBROUTINE ExtLdDX_UnPackInput
1287
1352
1288
1353
SUBROUTINE ExtLdDX_C2Fary_CopyInput ( InputData , ErrStat , ErrMsg , SkipPointers )
@@ -1453,6 +1518,15 @@ SUBROUTINE ExtLdDX_C2Fary_CopyInput( InputData, ErrStat, ErrMsg, SkipPointers )
1453
1518
CALL C_F_POINTER(InputData% C_obj% twrHloc, InputData% twrHloc, (/ InputData% C_obj% twrHloc_Len/ ))
1454
1519
END IF
1455
1520
END IF
1521
+
1522
+ ! -- bldPitch Input Data fields
1523
+ IF ( .NOT. SkipPointers_local ) THEN
1524
+ IF ( .NOT. C_ASSOCIATED( InputData% C_obj% bldPitch ) ) THEN
1525
+ NULLIFY( InputData% bldPitch )
1526
+ ELSE
1527
+ CALL C_F_POINTER(InputData% C_obj% bldPitch, InputData% bldPitch, (/ InputData% C_obj% bldPitch_Len/ ))
1528
+ END IF
1529
+ END IF
1456
1530
END SUBROUTINE ExtLdDX_C2Fary_CopyInput
1457
1531
1458
1532
SUBROUTINE ExtLdDX_F2C_CopyInput ( InputData , ErrStat , ErrMsg , SkipPointers )
@@ -1674,6 +1748,18 @@ SUBROUTINE ExtLdDX_F2C_CopyInput( InputData, ErrStat, ErrMsg, SkipPointers )
1674
1748
InputData% c_obj% twrHloc = C_LOC( InputData% twrHloc( LBOUND (InputData% twrHloc,1 ) ) )
1675
1749
END IF
1676
1750
END IF
1751
+
1752
+ ! -- bldPitch Input Data fields
1753
+ IF ( .NOT. SkipPointers_local ) THEN
1754
+ IF ( .NOT. ASSOCIATED (InputData% bldPitch)) THEN
1755
+ InputData% c_obj% bldPitch_Len = 0
1756
+ InputData% c_obj% bldPitch = C_NULL_PTR
1757
+ ELSE
1758
+ InputData% c_obj% bldPitch_Len = SIZE (InputData% bldPitch)
1759
+ IF (InputData% c_obj% bldPitch_Len > 0 ) &
1760
+ InputData% c_obj% bldPitch = C_LOC( InputData% bldPitch( LBOUND (InputData% bldPitch,1 ) ) )
1761
+ END IF
1762
+ END IF
1677
1763
END SUBROUTINE ExtLdDX_F2C_CopyInput
1678
1764
1679
1765
SUBROUTINE ExtLdDX_CopyOutput ( SrcOutputData , DstOutputData , CtrlCode , ErrStat , ErrMsg )
@@ -2183,6 +2269,12 @@ SUBROUTINE ExtLdDX_Input_ExtrapInterp1(u1, u2, tin, u_out, tin_out, ErrStat, Err
2183
2269
b = - (u1% twrHloc(i1) - u2% twrHloc(i1))
2184
2270
u_out% twrHloc(i1) = u1% twrHloc(i1) + b * ScaleFactor
2185
2271
END DO
2272
+ END IF ! check if allocated
2273
+ IF (ASSOCIATED (u_out% bldPitch) .AND. ASSOCIATED (u1% bldPitch)) THEN
2274
+ DO i1 = LBOUND (u_out% bldPitch,1 ),UBOUND (u_out% bldPitch,1 )
2275
+ b = - (u1% bldPitch(i1) - u2% bldPitch(i1))
2276
+ u_out% bldPitch(i1) = u1% bldPitch(i1) + b * ScaleFactor
2277
+ END DO
2186
2278
END IF ! check if allocated
2187
2279
END SUBROUTINE ExtLdDX_Input_ExtrapInterp1
2188
2280
@@ -2344,6 +2436,13 @@ SUBROUTINE ExtLdDX_Input_ExtrapInterp2(u1, u2, u3, tin, u_out, tin_out, ErrStat,
2344
2436
c = ( (t(2 )- t(3 ))* u1% twrHloc(i1) + t(3 )* u2% twrHloc(i1) - t(2 )* u3% twrHloc(i1) ) * scaleFactor
2345
2437
u_out% twrHloc(i1) = u1% twrHloc(i1) + b + c * t_out
2346
2438
END DO
2439
+ END IF ! check if allocated
2440
+ IF (ASSOCIATED (u_out% bldPitch) .AND. ASSOCIATED (u1% bldPitch)) THEN
2441
+ DO i1 = LBOUND (u_out% bldPitch,1 ),UBOUND (u_out% bldPitch,1 )
2442
+ b = (t(3 )** 2 * (u1% bldPitch(i1) - u2% bldPitch(i1)) + t(2 )** 2 * (- u1% bldPitch(i1) + u3% bldPitch(i1)))* scaleFactor
2443
+ c = ( (t(2 )- t(3 ))* u1% bldPitch(i1) + t(3 )* u2% bldPitch(i1) - t(2 )* u3% bldPitch(i1) ) * scaleFactor
2444
+ u_out% bldPitch(i1) = u1% bldPitch(i1) + b + c * t_out
2445
+ END DO
2347
2446
END IF ! check if allocated
2348
2447
END SUBROUTINE ExtLdDX_Input_ExtrapInterp2
2349
2448
0 commit comments