Source Code file name

Hello,

What is the difference between “Modname.F90” files and “Modname_Subs.F90”. Meaning when is the later created? For example, some modules have “xxxx_Subs.F90” and some don’t. Forexample, “InflowWind_Subs.F90” and “InflowWind.F90”. But, there is no “AeroDyn_Subs.F90”. I have referred to the “NWTC Programmer’s Handbook” but couldn’t find any leads.

Regards,
Kumara

Hi Kumara,

There is no specific rule about how SUBROUTINEs are split between source files. This is just up to the programmer’s discretion. The Modname.f90 file is typically the main source file containing the framework-specific SUBROUTINEs (*_Init, *_UpdateStates, *_CalcOutput, *_End, etc.). Sometimes local SUBROUTINEs are included in that source file and sometimes they are separated out into a distinct source file, Modname_Subs.f90.

Best regards,

Thanks Jason.

Regards,
Kumara

Dear Jason,

Is there any particular resource (document/video/paper) that you recommend that would be helpful for understanding the source code from the aspects like sequence in which subroutines are called or executed etc. ?

Regards,
Kumara

Dear Kumara,

The NWTC Programmer’s Handbook provides a lot of guidance on the modularization framework that FAST v8 and OpenFAST are based on: ProgrammingHandbook_Mod20130802.pdf - Google Drive.

In terms of the sequencing of SUBROUTINE calls, we don’t have a complete list for all SUBROUTINEs, but we do have pseudocode document that explains the sequencing of how each module is called by the OpenFAST glue code within the update states and calculate output steps in the solve of each time step–see: https://openfast.readthedocs.io/en/main/_downloads/5b41013535246747552e426d7d2fe4d0/OpenFAST_Algorithms.pdf.

Best regards,

Thanks, Jason.

Regards,
Kumara

Hello all,

I am referring to the source code provided in OpenFastV3.0.0.
This is more of a suggestion to update the comment (a minor one) in the source code than a query, provided my below understanding is correct.

In the “…\glue-codes\openfast\src\FAST_Prog.f90” the command in line60
CALL NWTC_Init() ! open console for writing
As per my understanding this is not opening the console unit as mentioned in the comment.
Because there is no command in the subroutine of CALL OpenCon( ) which performs the said action. For quick reference, I have copied OpenCon subroutine below.

SUBROUTINE OpenCon

  • ! This routine opens the console for standard output.*
    !bjj: Because CU = 6 now, this statement is not necessary
    ! OPEN ( CU , FILE=‘/dev/stdout’ , STATUS=‘OLD’ )
    ! CALL FlushOut ( CU )
  • RETURN*
    END SUBROUTINE OpenCon

Please revert if my understanding is incorrect.

Regards,
Kumara

Dear Kumara,

SUBROUTINE NWTC_Init() does CALL SUBROUTINE OpenCon(); it also initializes the global constants (like pi).

Best regards,

Dear Jason,
I agree to what you said, but, my concern is that the only uncommented command in the SUBROUTINE OpenCon is RETURN.
Does the RETURN statement here take the program execution control to console? Otherwise which part of the code open Console?

 This routine opens the console for standard output.
!bjj: Because CU = 6 now, this statement is not necessary
! OPEN ( CU , FILE=’/dev/stdout’ , STATUS=‘OLD’ )
! CALL FlushOut ( CU )

*RETURN
END SUBROUTINE OpenCon

Dear Kumara,

Which version of the source code are you looking at? The SUBROUTINE OpenCon() from SysIVF.f90 in the main branch of OpenFAST v3.0 does not have all lines commented out–see: openfast/SysIVF.f90 at main · OpenFAST/openfast · GitHub.

Best regards,

Dear Jason,

I am looking at the OpenFAST V3.0 source code too. But I realize the problem now.
NWTC_Init is calling the SUBROUTINE OpenCon( ) which is located in …\openfast-3.0.0\modules\nwtc-library\src\SysIVF.f90, but, the VisualStudioCode IDE that I am using to browse through the source code is taking me to the definition of SUBROUTINE OpenCon which is located in the …\openfast-3.0.0\modules\nwtc-library\src\SysGnuWin.f90 . I wish OpenCon( ) was christened bit differently to avoid such traps due to IDE or remove the SUBROUTINE OpenCon. But, I admit I should’ve paid more attention. Thanks alot for your patience.

Regards,
Kumara