Pitching subroutine fortran question

Hello.
here is a snippet I have taken from my pitching subroutine written into the framework of ‘PitchCntrl_ACH.f90’. I have had problems getting the ‘PitchFileName’ variable to read in the name and file location of the pitch input file which contains the variables for the subroutine. As you can see I have commented it out and simply hard coded the file path to the ‘PitchFileName’ variable.

If anyone can shed some light on getting this working that would be very welcome indeed.

Phillip


!Read control parameters from ‘pitch.ipt’ if control is employed
!I = INDEX( DirRoot, PathSep, BACK=.TRUE. )
!IF ( I < LEN_TRIM(DirRoot) .OR. I > 0 ) THEN
! PitchFileName = DirRoot(1:I-1)//‘Pitch.ipt’
!ELSE
! PitchFileName = ‘pitch.ipt’
!END IF
PitchFileName = “C:/EP0027/20 kW Pitching/Pitch.ipt”

CALL OpenFInpFile (86, TRIM(PitchFileName) )
open(unit = 86, file = ‘Pitch.ipt’,status=‘old’, action=‘read’)
READ(86,FmtText) DESCRIP

Hi, Phillip.

The code you have commented out is supposed to find a file called “Pitch.ipt” in the directory where the primary FAST input file for the simulation is located. (i.e., DirRoot). If you want to use a different directory that’s not hardcoded, you’ll have to pass the PitchCntrl() subroutine a different path name, which you’ll have to set somehow.

I suppose if you are running FAST from a different directory and you used the forward slashes instead of back slashes to specify the name of the primary FAST input file, the code you commented out may be trying to find Pitch.ipt in the current working directory instead…

Thanks for your reply Bonnie,
I have just run my simulation again and it now works! I commented it out weeks ago because I kept getting an error from FAST saying that it couldn’t find Pitch.ipt even though it was in the same directory as the .fst file as you quite rightly state. Now it works and I have no explanation why it didn’t the other wek. I am sure it was user error on my part.

Kind regards from a wet and cold England.

I hope it is more clement where you are.

Phillip