-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathFAST2ADAMS.f90
4219 lines (3048 loc) · 223 KB
/
FAST2ADAMS.f90
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
MODULE FAST2ADAMSSubs
USE NWTC_Library
IMPLICIT NONE
!------------------------------------------------------------------------------
! The following parameters must agree with the values defined in the Adams
! dataset. See FAST2ADAMSStatements.xls for definitions.
!------------------------------------------------------------------------------
INTEGER, PARAMETER :: AdamsIntKi = 4 ! The ADAMS integer type
! STRING PARAMETERS (ID numbers)
INTEGER(AdamsIntKi), PARAMETER :: ADIptFile_SG = 90
INTEGER(AdamsIntKi), PARAMETER :: FTitle_SG = 21
INTEGER(AdamsIntKi), PARAMETER :: HDIptFile_SG = 31
INTEGER(AdamsIntKi), PARAMETER :: OutFmt_SG = 22
INTEGER(AdamsIntKi), PARAMETER :: OutNamesI_SG = 1000 ! OutNamesI_SG = 1000 + I, I=0:NumOuts
INTEGER(AdamsIntKi), PARAMETER :: OutUnitsI_SG = 2000 ! OutUnitsI_SG = 2000 + I, I=0:NumOuts
INTEGER(AdamsIntKi), PARAMETER :: RootName_SG = 95
INTEGER(AdamsIntKi), PARAMETER :: ProgVerOfA2AD_SG = 1
! MARKER PARAMETERS (ID numbers)
INTEGER(AdamsIntKi), PARAMETER :: AeroDynGround_M = 1
INTEGER(AdamsIntKi), PARAMETER :: HubCS_M = 4000 ! FAST hub coordinate system
INTEGER(AdamsIntKi), PARAMETER :: NacelleCS_M = 2000 ! Nacelle origin - Bed plate center of mass / FAST Nacelle coordinate system
INTEGER(AdamsIntKi), PARAMETER :: NacelleHubRef_M = 2050 ! Nacelle/hub reference MARKER
INTEGER(AdamsIntKi), PARAMETER :: PlatformRef_M = 1000
INTEGER(AdamsIntKi), PARAMETER :: TailFinAero_M = 5110
INTEGER(AdamsIntKi), PARAMETER :: YawBrBottom_M = 1010 ! Portion of the yaw bearing attached to the tower-top.
INTEGER(AdamsIntKi), PARAMETER :: YawBrTop_M = 2010 ! Portion of yaw bearing attached to the bed plate / nacelle
! ARRAY PARAMETERS (ID numbers)
INTEGER(AdamsIntKi), PARAMETER :: BldGagNd_A = 2
INTEGER(AdamsIntKi), PARAMETER :: IDCntrl_A(3) = (/6, 7, 8/)
INTEGER(AdamsIntKi), PARAMETER :: ModelConstants_A = 5
INTEGER(AdamsIntKi), PARAMETER :: OutIndSign_A = 1
INTEGER(AdamsIntKi), PARAMETER :: TwrGagNd_A = 3
INTEGER(AdamsIntKi), PARAMETER :: DGSEdummyU_A = 20
INTEGER(AdamsIntKi), PARAMETER :: DGSEdummyX_A = 21
INTEGER(AdamsIntKi), PARAMETER :: DGSEdummyY_A = 22
INTEGER(AdamsIntKi), PARAMETER :: DGSEdummyIC_A = 23
! GSE PARAMETERS (ID Numbers)
INTEGER(AdamsIntKi), PARAMETER :: A2AD_GSE = 1
! VARIABLE PARAMETERS (ID numbers)
INTEGER(AdamsIntKi), PARAMETER :: CalcOuts_V = 1
INTEGER(AdamsIntKi), PARAMETER :: DGSEdummy_V = 2
!------------------------------------------------------------------------------
CHARACTER(7), PARAMETER :: ProgVerOfA2AD = "v13.01." ! version of A2AD that is required to run this dataset
CHARACTER(6) :: OutNameID ! temporary string to hold the integer name for output names and units (this should be a local variable)
CONTAINS
!=======================================================================
SUBROUTINE MakeACF
! This routine generates an ADAMS control file (.acf) for an ADAMS
! SIMULATE analysis using the properties specified in the FAST
! input files as model parameters.
USE ADAMSInput
USE Blades
USE EnvCond
USE Features
USE General
USE MassInert
USE Output
USE SimCont
USE Tower
USE TurbConf
USE TurbCont
IMPLICIT NONE
! Local variables.
INTEGER(4) :: K ! Loops through blades.
CHARACTER( 3) :: FmtText = '(A)' ! Format for outputting pure text.
CHARACTER(12) :: FmtTRT = '(A,ES13.6,A)' ! Format for outputting text then a real value then text again.
CHARACTER(19) :: FmtTRTR = '(A,ES13.6,A,ES13.6)' ! Format for outputting text, a real value, text, and a real value.
! Open the ADAMS control file and give it a heading:
CALL OpenFOutFile ( UnAC, TRIM( RootName )//'_ADAMS.acf' )
! Read in the ADAMS datset file (.adm):
WRITE (UnAC,FmtText ) TRIM( RootName )//'_ADAMS'
! Use the same name for the output files:
WRITE (UnAC,FmtText ) TRIM( RootName )//'_ADAMS'
! Specify the INTEGRATOR properties:
!bjj: JMJ wants this removed for release!!!!
!IF ( CompHydro ) THEN !ALLOW error an order of magnitude greater for this case
! WRITE (UnAC,FmtTRT ) 'INTEGRATOR/GSTIFF, ERROR = 0.010, HMAX = ', DT, ', INTERPOLATE = ON'
!ELSE
WRITE (UnAC,FmtTRT ) 'INTEGRATOR/GSTIFF, ERROR = 0.001, HMAX = ', DT, ', INTERPOLATE = ON'
!END IF
!JASON: Make ERROR an input!--Do this when you add variable-step size integration in FAST!
! Run the simulation for the first time step:
WRITE (UnAC,FmtTRTR ) 'SIMULATE/DYNAMICS, END = ', DT, ', DTOUT = ', DT*DecFact
! DEACTIVATE the MOTION statements for the translational platform DOFs if
! the corresponding DOFs are enabled:
IF ( PtfmSgDOF ) WRITE (UnAC,FmtText ) 'DEACTIVATE/MOTION, ID = 1001'
IF ( PtfmSwDOF ) WRITE (UnAC,FmtText ) 'DEACTIVATE/MOTION, ID = 1002'
IF ( PtfmHvDOF ) WRITE (UnAC,FmtText ) 'DEACTIVATE/MOTION, ID = 1003'
! DEACTIVATE the JPRIM statement for the rotational platform DOFs if the
! platform roll DOF is enabled [all of the platform rotational DOFs are
! controlled by the the roll DOF since PtfmRDOF, PtfmPDOF, and PtfmYDOF
! must all be set to the same value, a requirement enforced in routine
! MakeADM()]:
IF ( PtfmRDOF ) WRITE (UnAC,FmtText ) 'DEACTIVATE/JPRIM, ID = 1000'
! DEACTIVATE the MOTION statements for the yaw, rotor-furl, tail-furl, HSS,
! and teeter bearings and the drivetrain LSS/HSS lock if the corresponding
! DOFs are enabled:
IF ( YawDOF ) WRITE (UnAC,FmtText ) 'DEACTIVATE/MOTION, ID = 2010'
IF ( TFrlDOF ) WRITE (UnAC,FmtText ) 'DEACTIVATE/MOTION, ID = 5040'
IF ( RFrlDOF ) WRITE (UnAC,FmtText ) 'DEACTIVATE/MOTION, ID = 2130'
IF ( TeetDOF ) WRITE (UnAC,FmtText ) 'DEACTIVATE/MOTION, ID = 4010'
IF ( DrTrDOF ) WRITE (UnAC,FmtText ) 'DEACTIVATE/MOTION, ID = 3020'
IF ( GenDOF ) WRITE (UnAC,FmtText ) 'DEACTIVATE/MOTION, ID = 3150'
! Turn off fixed pitch MOTION; use advanced, individual blade pitch control
! instead:
! Only do this if we will be modifying the blade pitch angles during
! our run.
DO K = 1,NumBl ! Loop through all blades
IF ( ( ( PCMode /= 0 ) .AND. ( TPCOn < TMax ) ) .OR. ( TPitManS(K) < TMax ) ) &
WRITE (UnAC,FmtText ) 'DEACTIVATE/MOTION, ID = '//TRIM(Int2LStr( 10000*K ))
ENDDO ! K - Blades
! DEACTIVATE the FIXED JOINTS in the tower and blade if tower and blade
! flexibility are enabled:
! It is necessary to lock the flexible elements together at the start
! of the simulation since the initial rotor speed kicks the system
! to intensly during the initial condition solution. Locking the
! elements together during the initial condition solution eliminates
! this problem.
IF ( TwFADOF1 ) THEN ! Tower flexibility is enabled.
WRITE (UnAC,FmtText ) 'DEACTIVATE/JOINT, RANGE = '//TRIM(Int2LStr( 1300 + 1 ))//', '// &
TRIM(Int2LStr( 1300 + TwrNodes ))
WRITE (UnAC,FmtText ) 'DEACTIVATE/JOINT, ID = '//TRIM( Int2LStr( 1500 ))
ENDIF
IF ( FlapDOF1 ) THEN ! Blade flexibility is enabled.
DO K = 1,NumBl ! Loop through all the blades
WRITE ( UnAC,FmtText ) 'DEACTIVATE/JOINT, RANGE = '//TRIM(Int2LStr( 10000*K + 3000 + 1 ))//', '// &
TRIM(Int2LStr( 10000*K + 3000 + BldNodes ))
IF ( TipMass(K) /= 0.0 ) &
WRITE (UnAC,FmtText ) 'DEACTIVATE/JOINT, ID = '//TRIM( Int2LStr( 10000*K + 5000 ))
ENDDO ! K - blades
ENDIF
! DEACTIVATE the MOTION statements for the translational DOFs of the free
! surface if necessary:
IF ( CompHydro .AND. SaveGrphcs .AND. ( WaveMod /= 4 ) ) THEN ! .TRUE. if we are using the undocumented monopile or platform features .AND. SaveGrphcs is enabled, but not with GH Bladed wave data
WRITE (UnAC,FmtText ) 'DEACTIVATE/MOTION, RANGE = '//TRIM(Int2LStr( 100900 + 0 ))//', '// &
TRIM(Int2LStr( 100900 + NFreeSrfc ))
ENDIF
! Continue the simulation from where we left off before, but now
! with tower and blade flexibility and other DOFs if requested:
WRITE (UnAC,FmtTRTR ) 'SIMULATE/DYNAMICS, END = ', TMax, ', DTOUT = ', DT*DecFact
! We're done!
WRITE (UnAC,FmtText ) 'STOP'
! Inform the users of this great news!
CALL WrScr (' ADAMS command file '''//TRIM( RootName )//'_ADAMS.acf'' created.')
! Close the file.
CLOSE ( UnAC )
RETURN
END SUBROUTINE MakeACF
!=======================================================================
SUBROUTINE MakeACF_LIN
! This routine generates an ADAMS control file (.acf) for an ADAMS
! LINEAR analysis using the properties specified in the FAST input
! files as model parameters.
USE Blades
USE EnvCond
USE Features
USE General
USE InitCond
USE MassInert
USE Output
USE Platform
USE SimCont
USE TipBrakes
USE Tower
USE TurbConf
IMPLICIT NONE
! Local variables.
INTEGER(4) :: J ! Loops through nodes / elements.
INTEGER(4) :: K ! Loops through blades.
CHARACTER( 3) :: FmtText = '(A)' ! Format for outputting pure text.
CHARACTER(10) :: FmtTR = '(A,ES13.6)' ! Format for outputting text then a real value.
CHARACTER(12) :: FmtTRT = '(A,ES13.6,A)' ! Format for outputting text then a real value then text again.
CHARACTER(19) :: FmtTRTR = '(A,ES13.6,A,ES13.6)' ! Format for outputting text, a real value, text, and a real value.
! The ADAMS LINEAR analysis will fail when the hydrodynamic loads are time
! variant.
! Make sure FAST aborts if any of the following conditions are met:
IF ( ( WaveMod /= 0 ) .AND. CompHydro ) &
CALL ProgAbort ( ' An ADAMS control file for a LINEAR analysis can''t be built when using incident wave kinematics.'// &
' Set WaveMod to 0 or MakeLINacf to False.' )
IF ( ( RdtnTMax /= 0.0 ) .AND. CompHydro ) &
CALL ProgAbort ( ' An ADAMS control file for a LINEAR analysis can''t be built when using wave radiation damping.'// &
' Set RdtnTMax to 0.0 or MakeLINacf to False.' )
! Open the ADAMS control file and give it a heading:
CALL OpenFOutFile ( UnAL, TRIM( RootName )//'_ADAMS_LIN.acf' )
! Read in the ADAMS datset file (.adm):
WRITE (UnAL,FmtText ) TRIM( RootName )//'_ADAMS'
! Use the same name appended with "_LIN" for the output files:
WRITE (UnAL,FmtText ) TRIM( RootName )//'_ADAMS_LIN'
! Make sure generator and rotor are not spinning by switching
! MOTION/3150 from a VELOCITY statement to a DISPLACEMENT
! statement (since a VELOCITY statement will give an error
! during the STATICS simulation):
WRITE (UnAL,FmtText ) 'MOTION/3150, VELOCITY, ICDISP = 0' ! Make sure ICDISP = 0 or else ADAMS/SOLVER will generate an error when switching this MOTION statement from VELOCITY to DISPLACEMENT.
WRITE (UnAL,FmtTR ) 'MOTION/3150, DISPLACEMENT, FUNCTION = ', MOD( Azimuth - AzimB1Up + 180.0, 360.0 )*D2R ! Set the fixid DISPLACEMENT to what was previously the ICDISP value.
! Disable AeroDynamics if AeroDyn was called from the dataset by
! setting all the aerodynamic forces and moments to zero:
IF ( CompAero ) THEN
DO K = 1,NumBl ! Loop through all blades
DO J = 1,BldNodes ! Loop through the blade nodes/elements
WRITE (UnAL,FmtText ) 'GFORCE/'//TRIM(Int2LStr( 10000*K + 1000 + 10*J ))// &
', FX = 0\ FY = 0\ FZ = 0\ TX = 0\ TY = 0\ TZ = 0\'
ENDDO ! J - Blade nodes/elements
ENDDO ! K - Blades
ENDIF
! Similarly, let's remove tip brake drag effects if necessary:
IF ( ( TBDrConN /= 0.0 ) .OR. ( TBDrConD /= 0.0 ) ) THEN ! Only removed when TBDrConN or TBDrConD is nonzero:
DO K = 1,NumBl ! Loop through all blades
WRITE (UnAL,FmtText ) 'VFORCE/'//TRIM(Int2LStr( 10000*K + 7100 ))//', FX = 0\ FY = 0\ FZ = 0\'
ENDDO ! K - Blades
ENDIF
! Make sure no outputs are calculated and no "reqsub1.plt" file
! is created (indicated by zero as the first input; all other
! inputs are don't cares):
WRITE (UnAL,FmtText ) 'REQUEST/1, FUNCTION = USER( 0, 0 )'
! Specify the INTEGRATOR properties:
WRITE (UnAL,FmtTRT ) 'INTEGRATOR/GSTIFF, ERROR = 0.001, HMAX = ', DT, ', INTERPOLATE = ON'
! Run the simulation for a single time step:
WRITE (UnAL,FmtTRTR ) 'SIMULATE/DYNAMICS, END = ', DT, ', DTOUT = ', DT*DecFact
! DEACTIVATE the MOTION statements for the translational platform DOFs if
! the corresponding DOFs are enabled:
IF ( PtfmSgDOF ) WRITE (UnAL,FmtText ) 'DEACTIVATE/MOTION, ID = 1001'
IF ( PtfmSwDOF ) WRITE (UnAL,FmtText ) 'DEACTIVATE/MOTION, ID = 1002'
IF ( PtfmHvDOF ) WRITE (UnAL,FmtText ) 'DEACTIVATE/MOTION, ID = 1003'
! DEACTIVATE the JPRIM statement for the rotational platform DOFs if the
! platform roll DOF is enabled [all of the platform rotational DOFs are
! controlled by the the roll DOF since PtfmRDOF, PtfmPDOF, and PtfmYDOF
! must all be set to the same value, a requirement enforced in routine
! MakeADM()]:
IF ( PtfmRDOF ) WRITE (UnAL,FmtText ) 'DEACTIVATE/JPRIM, ID = 1000'
! DEACTIVATE the MOTION statements for the yaw, rotor-furl, tail-furl, and
! teeter bearings and the drivetrain LSS/HSS lock if the corresponding
! DOFs are enabled.
! Do not DEACTIVATE the generator MOTION statement:
IF ( YawDOF ) WRITE (UnAL,FmtText ) 'DEACTIVATE/MOTION, ID = 2010'
IF ( TFrlDOF ) WRITE (UnAL,FmtText ) 'DEACTIVATE/MOTION, ID = 5040'
IF ( RFrlDOF ) WRITE (UnAL,FmtText ) 'DEACTIVATE/MOTION, ID = 2130'
IF ( TeetDOF ) WRITE (UnAL,FmtText ) 'DEACTIVATE/MOTION, ID = 4010'
IF ( DrTrDOF ) WRITE (UnAL,FmtText ) 'DEACTIVATE/MOTION, ID = 3020'
! DEACTIVATE the FIXED JOINTS in the tower and blade if tower and blade
! flexibility are enabled:
! It is necessary to lock the flexible elements together at the start
! of the simulation since the initial rotor speed kicks the system
! to intensly during the initial condition solution. Locking the
! elements together during the initial condition solution eliminates
! this problem.
! Do not DEACTIVATE the free surface MOTION statements here:
IF ( TwFADOF1 ) THEN ! Tower flexibility is enabled.
WRITE ( UnAL,FmtText ) 'DEACTIVATE/JOINT, RANGE = '//TRIM(Int2LStr( 1300 + 1 ))//', '// &
TRIM(Int2LStr( 1300 + TwrNodes ))
WRITE ( UnAL,FmtText ) 'DEACTIVATE/JOINT, ID = '//TRIM( Int2LStr( 1500 ))
ENDIF
IF ( FlapDOF1 ) THEN ! Blade flexibility is enabled.
DO K = 1,NumBl ! Loop through all the blades
WRITE ( UnAL,FmtText ) 'DEACTIVATE/JOINT, RANGE = '//TRIM(Int2LStr( 10000*K + 3000 + 1 ))//', '// &
TRIM(Int2LStr( 10000*K + 3000 + BldNodes ))
IF ( TipMass(K) /= 0.0 ) &
WRITE (UnAL,FmtText ) 'DEACTIVATE/JOINT, ID = '//TRIM( Int2LStr( 10000*K + 5000 ))
ENDDO ! K - blades
ENDIF
! Run a STATICS analysis:
WRITE (UnAL,FmtText ) 'SIMULATE/STATICS'
! Run the ADAMS LINEAR analysis; send the first 25 mode shapes to the .out file:
WRITE (UnAL,FmtText ) 'LINEAR/EIGENSOL, COORDS = 1, 25'
! We're done!
WRITE (UnAL,FmtText ) 'STOP'
! Inform the users of this great news!
CALL WrScr (' ADAMS command file '''//TRIM( RootName )//'_ADAMS_LIN.acf'' created.')
! Close the file.
CLOSE ( UnAL )
RETURN
END SUBROUTINE MakeACF_LIN
!=======================================================================
SUBROUTINE MakeADM
! This routine generates an ADAMS dataset file (.adm) using the
! geometry and mechanical properties specified in the FAST input
! files as model parameters.
! AeroDyn MODULEs:
USE AeroDyn !to get the unit number for AeroDyn... can we fix this????
! FAST MODULEs:
USE ADAMSInput
USE Blades
USE Constants
USE CoordSys
USE DOFs
USE DriveTrain
USE EnvCond
USE Features
USE General
USE InitCond
USE MassInert
USE Modes
USE NacelleYaw
USE Output
USE Platform
USE RotorFurling
USE RtHndSid
USE SimCont
USE TeeterVars
USE TailAero
USE TailFurling
USE TipBrakes
USE Tower
USE TurbConf
USE TurbCont
USE FASTSubs !SetCoordSy
IMPLICIT NONE
! Local variables:
REAL(ReKi) :: CMatrix (6,6) ! A temporary element damping CMatrix for FIELD statements.
REAL(ReKi) :: CRatioBEd ! The ratio of CMatrix to KMatrix for the blade edge deflection.
REAL(ReKi) :: CRatioBFl ! The ratio of CMatrix to KMatrix for the blade flap deflection.
REAL(ReKi) :: CRatioTFA ! The ratio of CMatrix to KMatrix for the tower FA deflection.
REAL(ReKi) :: CRatioTSS ! The ratio of CMatrix to KMatrix for the tower SS deflection.
REAL(ReKi) :: CWaveDir ! COS( WaveDir )
REAL(ReKi), ALLOCATABLE :: DRNodesGRA(:) ! Length of variable-spaced blade elements used in blade graphics.
REAL(ReKi), ALLOCATABLE :: EAVec (:,:,:) ! Position vector directed from the structural axis of blade K, element J-1 to the structural axis of blade K, element J.
REAL(ReKi) :: KMatrix (6,6) ! A temporary element stiffness KMatrix for FIELD statements.
REAL(ReKi) :: Ref1 (3) ! Vector / direction Ref1 of the reference blade axis (= j1 if precurve and presweep are zero).
REAL(ReKi) :: Ref2 (3) ! Vector / direction Ref2 of the reference blade axis (= j2 if precurve and presweep are zero).
REAL(ReKi) :: Ref3 (3) ! Vector / direction Ref3 of the reference blade axis (= j3 if precurve and presweep are zero).
REAL(ReKi) :: Slopexb ! Slope of the reference axis about the xb-axis using central difference differentation.
REAL(ReKi) :: Slopeyb ! Slope of the reference axis about the yb-axis using central difference differentation.
REAL(ReKi), PARAMETER :: SmllNmbr = 9.999E-4 ! A small number used to define masses and inertias of PARTs in ADAMS to avoid singularities in ADAMS' equations of motion (EoM).
REAL(ReKi) :: SWaveDir ! SIN( WaveDir )
REAL(ReKi) :: ThnBarI ! The tranverse inertia of thin uniform bar about the bar's c.g. used to determine the transverse inertias of tower and blade elements
REAL(ReKi) :: TmpLength ! A temporary distance
REAL(ReKi) :: TmpLength2 ! = TmpLength^2.
REAL(ReKi) :: TmpLength3 ! = TmpLength^3.
REAL(ReKi) :: TmpVec (3) ! A temporary vector used in various computations.
REAL(ReKi) :: TmpVec1 (3) ! A temporary vector used in various computations.
REAL(ReKi) :: TmpVec2 (3) ! A temporary vector used in various computations.
REAL(ReKi) :: TransMat (3,3) ! The resulting transformation matrix due to three orthogonal rotations, (-).
INTEGER(4) :: CompAeroI ! An INTEGER representing what is in CompAero: = 0 if CompAero = .FALSE., 1 if CompAero = .TRUE.
INTEGER(4) :: CompHydroI ! An INTEGER representing what is in CompHydro: = 0 if CompHydro = .FALSE., 1 if CompHydro = .TRUE.
INTEGER(4) :: GenTiStrp ! An INTEGER representing what is in GenTiStr and GenTiStp = (1 if GenTiStr = .TRUE.) (+ 10 if GenTiStp = .TRUE.).
INTEGER(4) :: I ! Generic Index
INTEGER, ALLOCATABLE :: IDCntrl (:,:) ! Array for MulTabLoc functionality in Adams
INTEGER(4) :: J ! Loops through nodes / elements.
INTEGER(4) :: K ! Loops through blades.
INTEGER :: Sttus ! Status of an attempted array allocation.
INTEGER(4) :: SubAxI ! An INTEGER representing what is in SubAxInd = (1 if SubAxInd = .TRUE.; 0 otherwise).
INTEGER(4) :: TabDelimI ! An INTEGER representing what is in TabDelim : = 0 if TabDelim = .FALSE., 1 if TabDelim = .TRUE.
INTEGER(4) :: TmpID ! A temporary ID for a PART, MARKER, etc...
INTEGER(4) :: TmpID2 ! A temporary ID for a PART, MARKER, etc...
CHARACTER( 3) :: FmtText = '(A)' ! Format for outputting pure text.
CHARACTER(10) :: FmtTR = '(A,ES13.6)' ! Format for outputting text then a real value.
CHARACTER(28) :: FmtTRTRTR = '(A,ES13.6,A,ES13.6,A,ES13.6)' ! Format for outputting text, a real value, text, a real value, text, and (you guessed it!) a real value.
CHARACTER(55) :: FmtTRTRTRTRTRTR = '(A,ES11.4,A,ES11.4,A,ES11.4,A,ES11.4,A,ES11.4,A,ES11.4)' ! Format for outputting text, a real value, text, a real value, text, a real value, text, a real value, text, a real value, text, and (you guessed it!) a real value.
! An equivalent ADAMS model can't be built for all possible FAST models.
! Make sure FAST aborts if any of the following conditions are met:
IF ( SCAN( FTitle, ',' ) /= 0 ) &
CALL ProgAbort ( ' An ADAMS dataset can''t be built if character "," appears in the title of the primary FAST input file: "'// &
TRIM( FTitle )//'".' )
IF ( SCAN( FTitle, ';' ) /= 0 ) &
CALL ProgAbort ( ' An ADAMS dataset can''t be built if character ";" appears in the title of the primary FAST input file: "'// &
TRIM( FTitle )//'".' )
IF ( SCAN( FTitle, '&' ) /= 0 ) &
CALL ProgAbort ( ' An ADAMS dataset can''t be built if character "&" appears in the title of the primary FAST input file: "'// &
TRIM( FTitle )//'".' )
IF ( SCAN( FTitle, '!' ) /= 0 ) &
CALL ProgAbort ( ' An ADAMS dataset can''t be built if character "!" appears in the title of the primary FAST input file: "'// &
TRIM( FTitle )//'".' )
IF ( ( PtfmRDOF .NEQV. PtfmPDOF ) .OR. ( PtfmRDOF .NEQV. PtfmYDOF ) ) & ! .TRUE. if one platform rotation DOF is set differently than the other two
CALL ProgAbort ( ' An ADAMS dataset can''t be built when one of the platform rotational DOFs is set differently than the'// &
' other two. Set PtfmRDOF, PtfmPDOF, and PtfmYDOF to the same value (i.e., all .TRUE. or all .FALSE.).' )
IF ( ( .NOT. YawDOF ) .AND. ( ( ( YCMode /= 0 ) .AND. ( TYCOn < TMax ) ) .OR. ( TYawManS < TMax ) ) ) &
CALL ProgAbort ( ' An ADAMS dataset can''t be built with yaw control unless the yaw DOF is enabled.'// &
' Set YawDOF to .TRUE., YCMode to 0, or TYawManS > TMax.' )
IF ( TwFADOF1 .AND. ( .NOT. TwSSDOF1 ) ) THEN ! FA flexibility is enabled, SS is rigid
CALL ProgAbort ( ' An ADAMS dataset can''t be built with tower FA flexibility and SS rigidity.'// &
' Force TwFADOF1 to equal TwSSDOF1 or vice-versa.' )
ELSEIF ( TwSSDOF1 .AND. ( .NOT. TwFADOF1 ) ) THEN ! SS flexibility is enabled, FA is rigid
CALL ProgAbort ( ' An ADAMS dataset can''t be built with tower SS flexibility and FA rigidity.'// &
' Force TwFADOF1 to equal TwSSDOF1 or vice-versa.' )
ENDIF
! NOTE: Blade flexibility is determined by FlapDOF1
! NOTE: FlapDOF2 is ignored by MakeADM()
IF ( FlapDOF1 .AND. ( .NOT. EdgeDOF ) ) THEN ! flap flexibility is enabled, edge is rigid
CALL ProgAbort ( ' An ADAMS dataset can''t be built with blade flap flexibility and edge rigidity.'// &
' Force FlapDOF1 to equal EdgeDOF or vice-versa.' )
ELSEIF ( EdgeDOF .AND. ( .NOT. FlapDOF1 ) ) THEN ! edge flexibility is enabled, flap is rigid
CALL ProgAbort ( ' An ADAMS dataset can''t be built with blade edge flexibility and flap rigidity.'// &
' Force FlapDOF1 to equal EdgeDOF or vice-versa.' )
ENDIF
IF ( OoPDefl /= 0.0 ) CALL ProgAbort ( ' An ADAMS dataset can''t be built with initial OoP blade-tip displacements.'// &
' Set OoPDefl to 0.0.' )
IF ( IPDefl /= 0.0 ) CALL ProgAbort ( ' An ADAMS dataset can''t be built with initial IP blade-tip displacements.'// &
' Set IPDefl to 0.0.' )
IF ( TTDspFA /= 0.0 ) CALL ProgAbort ( ' An ADAMS dataset can''t be built with an initial FA tower-top displacement.'// &
' Set TTDspFA to 0.0.' )
IF ( TTDspSS /= 0.0 ) CALL ProgAbort ( ' An ADAMS dataset can''t be built with an initial SS tower-top displacement.'// &
' Set TTDspSS to 0.0.' )
If ( TeetDefl /= 0.0 ) CALL ProgAbort ( ' An ADAMS dataset can''t be built with an initial teeter angle.'// &
' Set TeetDefl to 0.0.' )
IF ( GBoxEff /= 1.0 ) CALL ProgAbort ( ' An ADAMS dataset can''t be built with a non-ideal gearbox.'// &
' Set GBoxEff to 100.0.' )
IF ( GBRevers ) CALL ProgAbort ( ' An ADAMS dataset can''t be built with a gearbox reversal.'// &
' Set GBRevers to False.' )
IF ( TwrNodes > 99 ) CALL ProgAbort ( ' An ADAMS dataset can''t be built with more than 99 tower elements.'// &
' Set TwrNodes <= 99.' )
IF ( BldNodes > 99 ) CALL ProgAbort ( ' An ADAMS dataset can''t be built with more than 99 blade elements.'// &
' Set BldNodes <= 99.' )
IF ( NumLines > 99 ) CALL ProgAbort ( ' An ADAMS dataset can''t be built with more than 99 mooring lines.'// &
' Set NumLines <= 99.' )
! ALLOCATE some arrays:
ALLOCATE ( DRNodesGRA(BldNodes) , STAT=Sttus )
IF ( Sttus /= 0 ) THEN
CALL ProgAbort ( ' Error allocating memory for the DRNodesGRA array.' )
ENDIF
ALLOCATE ( EAVec(NumBl,TipNode,3) , STAT=Sttus )
IF ( Sttus /= 0 ) THEN
CALL ProgAbort ( ' Error allocating memory for the EAVec array.' )
ENDIF
ALLOCATE ( IDCntrl(NumBl,BldNodes) , STAT=Sttus )
IF ( Sttus /= 0 ) THEN
CALL ProgAbort ( ' Error allocating memory for the IDCntrl array.' )
ENDIF
IDCntrl = 0.0
! Lets define the coordinate systems that will be used throughout this
! routine to orient PARTs and MARKERs:
QT = Q (:,1) ! Transfer the initial conditions of the DOFs to the QT array, which is used throughout SetCoordSy().
CALL SetCoordSy
! Open the ADAMS dateset file and give it a heading:
CALL OpenFOutFile ( UnAD, TRIM( RootName )//'_ADAMS.adm' )
WRITE (UnAD,FmtText ) '!ADAMS/View model name: '//TRIM( FTitle )
WRITE (UnAD,FmtText ) '!This ADAMS dataset file was generated by '//TRIM(ProgName)//' '//TRIM( ProgVer )// &
' on '//CurDate()//' at '//CurTime()//'.'
WRITE (UnAD,FmtText ) '!Turbine input data from file "'//TRIM( PriFile )//'".'
! The VARIABLE statement for calling routine CalcOuts() at every time step:
! Find CompAeroI = 0 if CompAero = .FALSE., 1 if CompAero = .TRUE.:
! Find CompHydroI = 0 if CompHydro = .FALSE., 1 if CompHydro = .TRUE.:
! Find TabDelimI = 0 if TabDelim = .FALSE., 1 if TabDelim = .TRUE.:
IF ( CompAero ) THEN
CompAeroI = 1
ELSE
CompAeroI = 0
ENDIF
IF ( CompHydro ) THEN
CompHydroI = 1
ELSE
CompHydroI = 0
ENDIF
IF ( TabDelim ) THEN
TabDelimI = 1
ELSE
TabDelimI = 0
ENDIF
WRITE (UnAD,FmtText ) '! adams_view_name=''CalcOuts_V'''
WRITE (UnAD,FmtText ) 'VARIABLE/'//TRIM(Int2LStr(CalcOuts_V))//', FUNCTION = USER(1)'
!WRITE (UnAD,FmtText ) 'VARIABLE/1'
!WRITE (UnAD,FmtText ) ', FUNCTION = USER( '//TRIM(Flt2LStr( AzimB1Up ))//', '//TRIM(Flt2LStr( GBRatio ))// &
! ', '//TRIM(Flt2LStr( AvgNrmTpRd ))//', '//TRIM(Flt2LStr( ProjArea ))// &
! ', '//TRIM(Int2LStr( CompAeroI ))//', '//TRIM(Int2LStr( CompHydroI ))// &
! ', '//TRIM(Int2LStr( TabDelimI ))//', '//TRIM(Int2LStr( NumBl ))//','
!WRITE (UnAD,FmtText ) ', '//TRIM(Int2LStr( BldNodes ))//', '//TRIM(Int2LStr( TwrNodes ))// &
! ', '//TRIM(Flt2LStr( TipRad ))//', '//TRIM(Flt2LStr( GenIner ))//' )'
! Begin defining PARTs, MARKERs, and GRAPHICS:
WRITE (UnAD,FmtText ) '!=================================== PARTS ====================================='
! Those on the GROUND:
WRITE (UnAD,FmtText ) '!----------------------------------- Ground ------------------------------------'
! GROUND:
WRITE (UnAD,FmtText ) '! adams_view_name=''Ground_P'''
WRITE (UnAD,FmtText ) 'PART/1'
WRITE (UnAD,FmtText ) ', GROUND'
! AeroDyn GROUND MARKER:
WRITE (UnAD,FmtText ) '! adams_view_name=''AeroDynGround_M'''
WRITE (UnAD,FmtText ) 'MARKER/1'
WRITE (UnAD,FmtText ) ', PART = 1'
WRITE (UnAD,FmtTRTRTR) ', QP = ', 0.0, ', ', 0.0, ', ', PtfmRef
WRITE (UnAD,FmtText ) ', REULER = 0D, 0D, 0D'
! Inertial frame coordinate system:
WRITE (UnAD,FmtText ) '! adams_view_name=''InertialFrameCS_M'''
WRITE (UnAD,FmtText ) 'MARKER/10' ! MARKER/10 is equivalent to the inertial frame coordinate system: X = Xi, Y = Yi, Z = Zi
WRITE (UnAD,FmtText ) ', PART = 1'
! Initial platform orientation MARKER:
WRITE (UnAD,FmtText ) '! adams_view_name=''InitPtfmOrientation_M'''
WRITE (UnAD,FmtText ) 'MARKER/11'
WRITE (UnAD,FmtText ) ', PART = 1'
WRITE (UnAD,FmtTRTRTR) ', QP = ', 0.0 , ', ', 0.0 , ', ', 0.0 ! Orient the initial platform
WRITE (UnAD,FmtTRTRTR) ', ZP = ', a2(1), ', ', -a2(3), ', ', a2(2) ! orientation MARKER
WRITE (UnAD,FmtTRTRTR) ', XP = ', a1(1), ', ', -a1(3), ', ', a1(2) ! using the 3-point method
IF ( ( PtfmModel == 3 ) .AND. CompHydro ) THEN ! .TRUE. if we have floating offshore turbine and we are using the undocumented platform features.
IF ( LineMod == 1 ) THEN ! .TRUE if we have standard quasi-static mooring lines; store the mooring line data into the ARRAY
! Anchors:
DO I = 1,NumLines ! Loop through all mooring lines
WRITE (UnAD,'(A,I2.2,A)') '! adams_view_name=''Anchor', I, '_M'''
WRITE (UnAD,FmtText ) 'MARKER/'//TRIM(Int2LStr( 700 + I ))
WRITE (UnAD,FmtText ) ', PART = 1'
WRITE (UnAD,FmtTRTRTR ) ', QP = ', LAnchxi(I), ', ', LAnchyi(I), ', ', LAnchzi(I) ! NOTE: PtfmRef = 0.0 in this equation
WRITE (UnAD,FmtText ) ', REULER = 0D, 0D, 0D'
ENDDO ! I - All mooring lines
ENDIF
ENDIF
! FLOATING Aerodynamic and Hydrodynamic MARKERs:
WRITE (UnAD,FmtText ) '! adams_view_name=''TailFinFloatingAero_M'''
WRITE (UnAD,FmtText ) 'MARKER/500'
WRITE (UnAD,FmtText ) ', PART = 1'
WRITE (UnAD,FmtText ) ', FLOATING'
WRITE (UnAD,FmtText ) '! adams_view_name=''PlatformLoadingFloating_M'''
WRITE (UnAD,FmtText ) 'MARKER/800'
WRITE (UnAD,FmtText ) ', PART = 1'
WRITE (UnAD,FmtText ) ', FLOATING'
WRITE (UnAD,FmtText ) '!------------------ Ground: Floating Aero and Hydro for Tower ------------------'
DO J = 1,TwrNodes ! Loop through the blade nodes / elements
TmpID = 800 + J
WRITE (UnAD,'(A,I2.2,A)') '! adams_view_name=''TowerSec', J, 'FloatingAeroHydro_M'''
WRITE (UnAD,FmtText ) 'MARKER/'//TRIM(Int2LStr( TmpID ))
WRITE (UnAD,FmtText ) ', PART = 1'
WRITE (UnAD,FmtText ) ', FLOATING'
ENDDO ! J - Blade nodes / elements
DO K = 1,NumBl ! Loop through all blades
WRITE (UnAD,'(A,I1,A)') '!--------------------- Ground: Floating Aero for Blade ', K, ' -----------------------'
DO J = 1,BldNodes ! Loop through the blade nodes / elements
TmpID = K*100 + J
WRITE (UnAD,'(A,I1,A,I2.2,A)') '! adams_view_name=''Bld', K , 'Sec', J, 'FloatingAero_M'''
WRITE (UnAD,FmtText ) 'MARKER/'//TRIM(Int2LStr( TmpID ))
WRITE (UnAD,FmtText ) ', PART = 1'
WRITE (UnAD,FmtText ) ', FLOATING'
ENDDO ! J - Blade nodes / elements
TmpID = 500 + K
WRITE (UnAD,'(A,I1,A)') '! adams_view_name=''TipBrake', K, 'FloatingAero_M'''
WRITE (UnAD,FmtText ) 'MARKER/'//TRIM(Int2LStr( TmpID ))
WRITE (UnAD,FmtText ) ', PART = 1'
WRITE (UnAD,FmtText ) ', FLOATING'
ENDDO ! K - All Blades
WRITE (UnAD,FmtText ) '!------------------------------- Ground GRAPHICS -------------------------------'
IF ( CompHydro ) THEN ! .TRUE. if we are using the undocumented monopile or platform features
! Seabed MARKER:
WRITE (UnAD,FmtText ) '! adams_view_name=''Seabed_M'''
WRITE (UnAD,FmtText ) 'MARKER/20'
WRITE (UnAD,FmtText ) ', PART = 1'
WRITE (UnAD,FmtTRTRTR) ', QP = ', 0.0, ', ', 0.0, ', ', PtfmRef - WtrDpth
WRITE (UnAD,FmtText ) ', REULER = 0D, 0D, 0D'
! Seabed graphics:
WRITE (UnAD,FmtText ) '! adams_view_name=''Seabed_G'''
WRITE (UnAD,FmtText ) 'GRAPHICS/20'
WRITE (UnAD,FmtText ) ', CIRCLE'
WRITE (UnAD,FmtText ) ', CM = 20'
WRITE (UnAD,FmtTR ) ', RADIUS = ', MAX( TipRad, MaxLRadAnch )
WRITE (UnAD,FmtText ) ', SEG = '//TRIM(Int2LStr( NSides ))
ENDIF
!JASON: MOVE THE ADAMS STATEMENTS TO THE PROPER LOCATIONS WITHIN THE ADM FILE ONCE WE DOCUMENT THIS FEATURE!!!!!
IF ( CompHydro .AND. SaveGrphcs .AND. ( WaveMod /= 4 ) ) THEN ! .TRUE. if we are using the undocumented monopile or platform features .AND. SaveGrphcs is enabled, but not with GH Bladed wave data
! Those on the free surface of the water:
WRITE (UnAD,FmtText ) '!--------------------- Free Surface of the Water GRAPHICS ----------------------'
! Compute the variables needed to place MARKERs on the incident wave
! propogation heading direction:
NFreeSrfc = CEILING ( ( 2.0*TipRad )/FrSrfcSpc )
IF ( NFreeSrfc > 99 ) CALL ProgAbort ( ' An ADAMS dataset can''t be built with more than 99 free'// &
' surface GRAPHICS statements. Set FrSrfcSpc >= 2*TipRad/99.' )
TmpLength = 0.5*NFreeSrfc*FrSrfcSpc ! The distance in the xi/yi plane between the inertial frame reference point and the line of MARKERs representing the incident wave propogation heading direction.
CWaveDir = COS( D2R*WaveDir )
SWaveDir = SIN( D2R*WaveDir )
DO I = 0,NFreeSrfc ! Loop through all points on free surface (including the zero'th point) where the elevation of the incident waves will be computed
! The free surface MARKER attached to the GROUND:
TmpID = 100900 + I
TmpID2 = 100800 + I
WRITE (UnAD,'(A,I2.2,A)') '! adams_view_name=''FreeSrfc', I , 'OnGround_M'''
WRITE (UnAD,FmtText ) 'MARKER/'//TRIM(Int2LStr( TmpID - 100000 ))
WRITE (UnAD,FmtText ) ', PART = 1'
WRITE (UnAD,FmtTRTRTR ) ', QP = ', ( I*FrSrfcSpc - TmpLength )*CWaveDir + TmpLength*SWaveDir, &
', ' , ( I*FrSrfcSpc - TmpLength )*SWaveDir - TmpLength*CWaveDir, ', ', PtfmRef
WRITE (UnAD,FmtTRTRTR ) ', REULER = ', WaveDir*D2R, ', ', 0.0, ', ', 0.0
! Free surface PART:
WRITE (UnAD,'(A,I2.2,A)') '! adams_view_name=''FreeSrfc', I , '_P'''
WRITE (UnAD,FmtText ) 'PART/'//TRIM(Int2LStr( TmpID ))
WRITE (UnAD,FmtTRTRTR ) ', QG = ', ( I*FrSrfcSpc - TmpLength )*CWaveDir + TmpLength*SWaveDir, &
', ' , ( I*FrSrfcSpc - TmpLength )*SWaveDir - TmpLength*CWaveDir, ', ', PtfmRef
WRITE (UnAD,FmtTRTRTR ) ', REULER = ', WaveDir*D2R, ', ', 0.0, ', ', 0.0
WRITE (UnAD,FmtText ) ', CM = '//TRIM(Int2LStr( TmpID ))
WRITE (UnAD,FmtTR ) ', MASS = ', SmllNmbr
WRITE (UnAD,FmtTRTRTR ) ', IP = ', SmllNmbr, ', ', SmllNmbr, ', ', SmllNmbr
! First free surface MARKER attached to the PART:
WRITE (UnAD,'(A,I2.2,A)') '! adams_view_name=''FreeSrfc', I , 'Ref1_M'''
WRITE (UnAD,FmtText ) 'MARKER/'//TRIM(Int2LStr( TmpID ))
WRITE (UnAD,FmtText ) ', PART = '//TRIM(Int2LStr( TmpID ))
! Second free surface MARKER attached to the PART:
WRITE (UnAD,'(A,I2.2,A)') '! adams_view_name=''FreeSrfc', I , 'Ref2_M'''
WRITE (UnAD,FmtText ) 'MARKER/'//TRIM(Int2LStr( TmpID2 ))
WRITE (UnAD,FmtText ) ', PART = '//TRIM(Int2LStr( TmpID ))
WRITE (UnAD,FmtTRTRTR) ', QP = ', 0.0, ', ', 2.0*TmpLength, ', ', 0.0
WRITE (UnAD,FmtText ) ', REULER = 0D, 0D, 0D'
! Free surface elevation JOINT and MOTION:
WRITE (UnAD,'(A,I2.2,A)') '! adams_view_name=''FreeSrfc', I , '_J'''
WRITE (UnAD,FmtText ) 'JOINT/'//TRIM(Int2LStr( TmpID ))
WRITE (UnAD,FmtText ) ', TRANSLATIONAL'
WRITE (UnAD,FmtText ) ', I = '//TRIM(Int2LStr( TmpID ))
WRITE (UnAD,FmtText ) ', J = '//TRIM(Int2LStr( TmpID - 100000 ))
WRITE (UnAD,'(A,I2.2,A)') '! adams_view_name=''FreeSrfc', I , 'Demand_V'''
WRITE (UnAD,FmtText ) 'VARIABLE/'//TRIM(Int2LStr( TmpID ))
WRITE (UnAD,FmtText ) ', FUNCTION = USER( 0 )'
WRITE (UnAD,'(A,I2.2,A)') '! adams_view_name=''FreeSrfc', I , 'Error_V'''
WRITE (UnAD,FmtText ) 'VARIABLE/'//TRIM(Int2LStr( TmpID2 ))
WRITE (UnAD,FmtText ) ', FUNCTION = VARVAL('//TRIM(Int2LStr( TmpID ))//') '// &
'- DZ('//TRIM(Int2LStr( TmpID ))//','//TRIM(Int2LStr( TmpID - 100000 ))//',10)'
WRITE (UnAD,'(A,I2.2,A)') '! adams_view_name=''FreeSrfc', I , 'Actuator_SF'''
WRITE (UnAD,FmtText ) 'SFORCE/'//TRIM(Int2LStr( TmpID ))
WRITE (UnAD,FmtText ) ', TRANSLATION'
WRITE (UnAD,FmtText ) ', ACTIONONLY'
WRITE (UnAD,FmtText ) ', I = '//TRIM(Int2LStr( TmpID ))
WRITE (UnAD,FmtText ) ', J = '//TRIM(Int2LStr( TmpID ))
WRITE (UnAD,FmtText ) ', FUNCTION = '//TRIM(Flt2LStr( 0.0009868617 ))//'*VARVAL('//TRIM(Int2LStr( TmpID2 ))//')'// & ! NOTE: 0.0009868617kN/m = 0.001* Mass*NaturalFrequency^2 = 0.001* (9.999E-4kg)*(5Hz)^2 = 0.001* (9.999E-4kg)*(31.41593rad/s)^2
' - '//TRIM(Flt2LStr( 0.0000439779 ))//'*VZ('//TRIM(Int2LStr( TmpID ))//',0,10,0)' ! NOTE: 0.0000439779kN/(m/s) = 0.001*2*Mass*NaturalFrequency*DampingRatio = 0.001*2*(9.999E-4kg)*(5Hz)*(0.7) = 0.001*2*(9.999E-4kg)*(31.41593rad/s)*(0.7)
WRITE (UnAD,'(A,I2.2,A)') '! adams_view_name=''FreeSrfc', I , 'Locked_MO'''
WRITE (UnAD,FmtText ) 'MOTION/'//TRIM(Int2LStr( TmpID ))
WRITE (UnAD,FmtText ) ', I = '//TRIM(Int2LStr( TmpID ))
WRITE (UnAD,FmtText ) ', J = '//TRIM(Int2LStr( TmpID - 100000 ))
WRITE (UnAD,FmtText ) ', Z'
WRITE (UnAD,FmtText ) ', DISPLACEMENT'
WRITE (UnAD,FmtText ) ', FUNCTION = 0' ! Lock free surface PART at the MSL
! Free surface GRAPHICS:
IF ( I > 0 ) THEN ! All but the zero'th point
WRITE (UnAD,'(A,I2.2,A)') '! adams_view_name=''FreeSrfc', I , '_G'''
WRITE (UnAD,FmtText ) 'GRAPHICS/'//TRIM(Int2LStr( TmpID ))
WRITE (UnAD,FmtText ) ', OUTLINE = '//TRIM(Int2LStr( TmpID ))//', '//TRIM(Int2LStr( TmpID2 ))// &
', ' //TRIM(Int2LStr( TmpID2 - 1 ))//', '//TRIM(Int2LStr( TmpID - 1 ))// &
', ' //TRIM(Int2LStr( TmpID ))
ENDIF
ENDDO ! I - All points on free surface (including the zero'th point) where the elevation of the incident waves will be computed
ELSE
! GROUND graphics:
WRITE (UnAD,FmtText ) '! adams_view_name=''Ground_G'''
WRITE (UnAD,FmtText ) 'GRAPHICS/1'
WRITE (UnAD,FmtText ) ', CIRCLE'
WRITE (UnAD,FmtText ) ', CM = 1'
WRITE (UnAD,FmtTR ) ', RADIUS = ', TipRad
WRITE (UnAD,FmtText ) ', SEG = '//TRIM(Int2LStr( NSides ))
ENDIF
IF ( ( PtfmModel == 3 ) .AND. CompHydro .AND. SaveGrphcs ) THEN ! .TRUE. if we have floating offshore turbine and we are using the undocumented platform features .AND. SaveGrphcs is enabled.
IF ( LineMod == 1 ) THEN ! .TRUE if we have standard quasi-static mooring lines; store the mooring line data into the ARRAY
! Those on the mooring lines:
WRITE (UnAD,FmtText ) '!--------------------------- Mooring Lines GRAPHICS ----------------------------'
IF ( NLnNodes > 99 ) CALL ProgAbort ( ' An ADAMS dataset can''t be built with more than 99 GRAPHICS'// &
' nodes per mooring line. Set NLnNodes <= 99.' )
DO I = 1,NumLines ! Loop through all mooring lines
TmpVec = PtfmSurge *z1 + PtfmHeave *z2 - PtfmSway *z3 &
+ LFairxt(I)*a1 + LFairzt(I)*a2 - LFairyt(I)*a3 &
- LAnchxi(I)*z1 - LAnchzi(I)*z2 + LAnchyi(I)*z3 ! = Position vector directed from the anchor to the fairlead of the current mooring line at simulation initialization
DO J = 1,NLnNodes ! Loop through all the nodes per line for mooring line GRAPHICS
! Mooring line node POINT_MASS:
! NOTE: Since we don't yet know the position of each node (because routine
! Catenary() has not been called yet), instead, the mooring line nodes
! are placed at equally-spaced increments between the anchor and
! fairlead.
TmpID = 100000*I + 700 + J
WRITE (UnAD,'(A,I2.2,A,I2.2,A)') '! adams_view_name=''Line', I, 'Node', J, '_PM'''
WRITE (UnAD,FmtText ) 'POINT_MASS/'//TRIM(Int2LStr( TmpID ))
WRITE (UnAD,FmtTRTRTR ) ', QG = ', LAnchxi(I) + TmpVec(1)*J/( NLnNodes + 1 ), &
', ' , LAnchyi(I) - TmpVec(3)*J/( NLnNodes + 1 ), &
', ' , LAnchzi(I) + TmpVec(2)*J/( NLnNodes + 1 ) ! NOTE: PtfmRef = 0.0 in this equation
WRITE (UnAD,FmtText ) ', REULER = 0D, 0D, 0D'
WRITE (UnAD,FmtText ) ', CM = '//TRIM(Int2LStr( TmpID ))
WRITE (UnAD,FmtTR ) ', MASS = ', SmllNmbr
! Mooring line node center of mass:
WRITE (UnAD,'(A,I2.2,A,I2.2,A)') '! adams_view_name=''Line', I, 'Node', J, 'CM_M'''
WRITE (UnAD,FmtText ) 'MARKER/'//TRIM(Int2LStr( TmpID ))
WRITE (UnAD,FmtText ) ', POINT_MASS = '//TRIM(Int2LStr( TmpID ))
! Nodal position control:
WRITE (UnAD,'(A,I2.2,A,I2.2,A)') '! adams_view_name=''Line', I, 'Node', J, 'Floating_M'''
WRITE (UnAD,FmtText ) 'MARKER/'//TRIM(Int2LStr( TmpID + 1000 ))
WRITE (UnAD,FmtText ) ', PART = 1'
WRITE (UnAD,FmtText ) ', FLOATING'
WRITE (UnAD,'(A,I2.2,A,I2.2,A)') '! adams_view_name=''Line', I, 'Node', J, 'Demandxi_V'''
WRITE (UnAD,FmtText ) 'VARIABLE/'//TRIM(Int2LStr( TmpID + 1000 ))
WRITE (UnAD,FmtText ) ', FUNCTION = USER( 0 )'
WRITE (UnAD,'(A,I2.2,A,I2.2,A)') '! adams_view_name=''Line', I, 'Node', J, 'Demandyi_V'''
WRITE (UnAD,FmtText ) 'VARIABLE/'//TRIM(Int2LStr( TmpID + 2000 ))
WRITE (UnAD,FmtText ) ', FUNCTION = USER( 0 )'