- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I received the following error when trying to compile a test program I wrote. The purpose of the program is to output data from Aerodyn so I can compare it to the output from Aerodyn I receive from a matlab interface I wrote. All the data is the same
ERROR 7822 : Variables containing ultimate allocatable array components are forbidden from appearing directly in input/output lists/
write (2,*) MarkersResults
**********************************************
I just want the results from one time step from the aerodyn program written in a text file. Is there any easy work around for this error?
Thanks,
Chris
Link Copied
10 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You'll have to name the individual components you want to write in the I/O list, rather than the whole variable. Offhand, I don't know why the standard restricts this for output statements (I do for input), but perhaps it was intended to reduce complexity of implementation.
The language provides a feature "user-defined derived type I/O" that can be used to specify how a derived type variable should be transmitted, but this is not yet supported by Intel Fortran.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Steve,
Thanks for your response. I tried your suggestion by listing the individual components as follows:
write(2,*) MarkersResults(1,1), MarkersResults(2,1), ...etc and I receive the following error
error #6410 This name as not been declared as an array or function "MarkersResults"
******************************************
I then tried to assign the MarkersResults to variables declared as real as follows:
a = MarkersResults(1,1)
b = MarkersResults(2,1)
......etc
I would then try to write them into the output list but I received the same error as above.
Is there any issue with using the derived data types in this manner?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Please show the declaration of MarkersResults (and its TYPE declaration if there is one). From the earlier message, MarkersResults is a derived type variable with components and not itself an array. You need to say something like MarkersResults%ComponentName(2,1) where ComponentName is the name of some array component of the derived type.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi all,
a quick search in NREL's aerodyn bib has shown no variable named MarkersResults but this definitions:
[fortran]
TYPE, PUBLIC :: Marker
REAL(ReKi) :: Position(3)
REAL(ReKi) :: Orientation(3,3) ! Direction Cosine Matrix (DCM)
REAL(ReKi) :: TranslationVel(3)
REAL(ReKi) :: RotationVel(3)
END TYPE Marker
TYPE, PUBLIC :: AllAeroMarkers
TYPE(Marker), ALLOCATABLE :: Blade(:,:)
TYPE(Marker), ALLOCATABLE :: Hub(:)
TYPE(Marker), ALLOCATABLE :: RotorFurl(:)
TYPE(Marker), ALLOCATABLE :: Nacelle(:)
TYPE(Marker), ALLOCATABLE :: Tower(:)
TYPE(Marker), ALLOCATABLE :: Tail(:)
END TYPE AllAeroMarkers
[/fortran]
@Chris Is MarkersResults defined by yourself? If MarkersResults is of type Marker then this should work:
[fortran]
write(10,'(3f8.2)') MarkerDummy%Position(1:3) ! MarkerDummy is a scalar of type Marker
[/fortran]
for an AllAeroMarkers variable it is not totally clear to me how to address this. I guess:
[fortran]
type(AllAeroMarkers) :: AllAeroMarkersDummy
! allocate the components Blade, Hub, etc.
write(10,'(3f8.2)') AllAeroMarkersDummy%Blade(1,1)%Position(1:3) ! is this correct?
[/fortran]
Best regards,
Johannes
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
type(Markers) :: MarkersResults(nMarkers)
write(2,*) MarkersResults(iMarker)%Position, MarkersResults(iMarker)%Orientation, ...
Note, if your MarkersResults is a two dimentional array then
write(2,*) MarkersResults(iMarker,jMarker)%Position, MarkersResults(iMarker,jMarker)%Orientation, ...
Jim Dempsey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have it now, I was leaving out the components. Thanks for all your help.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Now that the above problems are sorted out and the program compiles w/out error, it does not seem to work. It creates the output file just fine (although its blank) but it seems like it is not calling for the calculation subroutine. The end of my code is below:
****************************************************************
Write (2,*) MarkersResults%Blade(1,1)%Position, MarkersResults%Blade(2,1)%Position
call ADInitialize(MarkersResults,ADOptions,TurbineComponents,ErrStat)
close (2)
Contains
subroutine ADInitialize(MarkersResults,ADOptions,TurbineComponents,ErrStat)
USE Aerodyn
Type(Aeroconfig) :: TurbineComponents
Type(AD_InitOptions) :: ADOptions
Type(AllAeroMarkers) :: MarkersResults
Integer :: ErrStat
!Computational Routine Using Aerodyn Function AD_init
ADOptions%ADInputFile = 'NRELOffshrBsline5MW_AeroDyn.ipt'
ADOptions%OutRootName = 'OutPut'
ADOptions%WrSumFile = .True.
MarkersResults = AD_Init(ADOptions, TurbineComponents, ErrStat)
return
end subroutine ADInitialize
end program
*************************************************************
The subroutine uses the AD_Init function contained in Aerodyn. Is there some reason the program would be ignoring the "call" statement to the subroutine? There is no data being written to the output file because the program is not calling subroutine it appears. Everything seems to link ok when I build with VS2010.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You should step through the code with the debugger to see what is going on. The compiler is not "ignoring" the call. Whether the call is skipped due to program logic or the cause of the blank file is something else is what you need to find out. You may also want to verify that the file you're looking at is the correct one. For example, the default for files created while running in Visual Studio is the project folder - you may be assuming it is somewhere else.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Steve,
I ran it through the debugger and fixed the allocated part but I still ouput a blank data file. I'm pretty confident the logic must be wrong and the "call" statement is being skipped because the call to the initializing function should also produce a summary file which is never created. My entire program code is as follows:
*********************************************
program test
Use Aerodyn
Implicit none
!Variable Declarations
TYPE(AD_InitOptions) :: ADOptions
TYPE(AeroConfig) :: TurbineComponents
TYPE(AllAeroMarkers) :: MarkersResults, InputMarkers
Type(AllAeroLoads) :: LoadResults
Type(AeroLoadsOptions) :: CurrentADOptions
INTEGER :: ErrStat
Real(ReKi) :: CurrentTime
open (unit=2, file = "out.dat", action = "write")
! Place Data
!
!
!
!
IF ( .NOT. ALLOCATED(TurbineComponents%Blade )) THEN
ALLOCATE( TurbineComponents%Blade(3), STAT=ErrStat )
END IF
TurbineComponents%Blade(1)%Position = [5.4343, 0.2258, 91.0480]
TurbineComponents%Blade(1)%Orientation = reshape ( (/ -0.5726, 0.8199, 0.0030, -0.8158, -0.5693, -0.1020, -0.0819, -0.0608, 0.9948/), & (/3,3/))
TurbineComponents%Blade(1)%TranslationVel = [ 0.0723, -1.9573, -0.1987]
TurbineComponents%Blade(1)%RotationVel = [ 1.2674, 0.0024, -0.0058]
TurbineComponents%Blade(2)%Position = [ 5.4292, -0.8371, 88.6773]
TurbineComponents%Blade(2)%Orientation = reshape ( (/ -0.5762, 0.8173, -0.0004, 0.4789, 0.3372, -0.8105, -0.6623, -0.4672, -0.5857/), & (/3,3/))
TurbineComponents%Blade(2)%TranslationVel = [ 0.0604, 1.0474, -1.5458]
TurbineComponents%Blade(2)%RotationVel = [ 1.2674, 0.0024, -0.0058]
TurbineComponents%Blade(3)%Position = [ 5.4260, 1.7475, 88.9422]
TurbineComponents%Blade(3)%Orientation = reshape ( (/ -0.5720, 0.8203, -0.0026, 0.3342, 0.2359, 0.9125, 0.7491, 0.5211, -0.4091/), & (/3,3/))
TurbineComponents%Blade(3)%TranslationVel = [ 0.0761, 0.7117, 1.7300 ]
TurbineComponents%Blade(3)%RotationVel = [ 1.2674, 0.0024, -0.0058]
TurbineComponents%BladeLength = 61.5000
TurbineComponents%Hub%Position = [5.4299, 0.3787, 89.5558]
TurbineComponents%Hub%Orientation = reshape ( (/0.0012, -0.9948, -0.1020, 1.0000, 0.0015, -0.0028, 0.0030, -0.1020, 0.9948/), & (/3,3/))
TurbineComponents%Hub%TranslationVel = [0.0696, -0.0661, -0.0048]
TurbineComponents%Hub%RotationVel = [1.2674, 0.0024, -0.0058]
TurbineComponents%RotorFurl%Position = [5.4299, 0.3787, 89.5558]
TurbineComponents%RotorFurl%Orientation = reshape ( (/0.0015, -1.0000, 0.0026, 1.0000, 0.0015, -0.0028, 0.0028, 0.0026, 1.0000/), & (/3,3/))
TurbineComponents%RotorFurl%TranslationVel = [0.0696, -0.0661, -0.0048]
TurbineComponents%RotorFurl%RotationVel = [0.0003, 0.0005, -0.0022]
TurbineComponents%Nacelle%Position = [0.4102, 0.3676, 89.3628]
TurbineComponents%Nacelle%Orientation = reshape ( (/0.0015, -1.0000, 0.0026, 1.0000, 0.0015, -0.0028, 0.0028, 0.0026, 1.0000/), & (/3,3/))
TurbineComponents%Nacelle%TranslationVel = [ 0.0703, -0.0511, -0.0016]
TurbineComponents%Nacelle%RotationVel = [ 0.0003, 0.0005, -0.0022]
TurbineComponents%Tower%Position = [ 0.1578, 0.1396, 0.0081]
TurbineComponents%Tower%Orientation = reshape ( (/ 0.0015, -1.0000, 0.0026, 1.0000, 0.0015, -0.0028, 0.0028, 0.0026, 1.0000/), & (/3,3/))
TurbineComponents%Tower%TranslationVel = [ 0.0277, -0.0241, -0.0025]
TurbineComponents%Tower%RotationVel = [ 0.0003, 0.0005, -0.0022]
call ADInitialize(MarkersResults,ADOptions,TurbineComponents,ErrStat)
Write (2,*) MarkersResults%Blade(1,1)%Position, MarkersResults%Blade(2,1)%Position, MarkersResults%Blade(3,1)%Position
deallocate (TurbineComponents%Blade )
deallocate ( MarkersResults%Blade )
Contains
subroutine ADInitialize(MarkersResults,ADOptions,TurbineComponents,ErrStat)
USE Aerodyn
Type(Aeroconfig) :: TurbineComponents
Type(AD_InitOptions) :: ADOptions
Type(AllAeroMarkers) :: MarkersResults
Integer :: ErrStat
!Computational Routine Using Aerodyn Function AD_init
ADOptions%ADInputFile = 'NRELOffshrBsline5MW_AeroDyn.ipt'
ADOptions%OutRootName = 'OutPut'
ADOptions%WrSumFile = .True.
MarkersResults = AD_Init(ADOptions, TurbineComponents, ErrStat)
return
end subroutine ADInitialize
end program test
***********************************************
Is there anything obviously wrong with the program that would be causing this problem?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Well, this isn't the whole program... I wonder if you're looking at the wrong output file. You say you "ran it through the debugger" but did you step into the call and see what got executed?
Two things I can think of. 1) You're looking in the wrong folder for the output file - as an experiment, try giving it a complete path. 2) Part of this program is in a DLL and you didn't build the executable to link to the DLL form of the run-time libraries.

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page