Instructions for Compiling FAST

Andre,

You shouldn’t have to recompile the DLL, but you could try.

I recall having some segmentation faults with gfortran reading the DLL due to an incredible obscure difference in my interface block. A while ago I pulled some FAST v8 code for using a Bladed DLL with gfortran into FAST v7. I dug it up this afternoon and removed a few lines that were specialized for the project I was helping with. You are welcome to use it, but I really can’t support questions on it (it may not even compile right now). Here’s a link: wind.nrel.gov/public/bjonkman/De … ortran.f90.

My guess is the problem with the “mexprintf” vs “mexPrintf” is the calling convention. You might be able to fix that with a compiler switch, but I don’t know what it is off the top of my head.

Thanks for the new source. But this one also fails to run. It compiles but doing a calculation gives the same segmentation fault sadly.

Hello Bonnie and Marshall,

I want to make a simulation with Adams using the output (Adams.adm or Adams.acf) extracted from Fast.
I suppose I have to compile fast using CompileLinkA2AD.bat but it has been impossible. I get the adams.f and adams.f90 but I have this problem:

Compiling ADAMS2AD and AeroDyn routines to create ADAMS.obj:
Intel(R) Visual Fortran Compiler for applications running on IA-32, Version 10.1
    Build 20080602 Package ID: w_fc_p_10.1.024
Copyright (C) 1985-2008 Intel Corporation.  All rights reserved.
ifort: command line warning #10121: overriding '/automatic' with '/Qsave'

Intel(R) Visual Fortran Compiler for applications running on IA-32, Version 10.1
    Build 20080602 Package ID: w_fc_p_10.1.024
Copyright (C) 1985-2008 Intel Corporation.  All rights reserved.
ifort: command line warning #10121: overriding '/automatic' with '/Qsave'

Linking ADAMS2AD and AeroDyn routines with ADAMS 2008r1:
"ADAMS08r1" no se reconoce como un comando interno o externo,
programa o archivo por lotes ejecutable.

The versions of the programs I am working with are the next ones:
 Intel visual fortran 10.1.024
 Microsoft Visual Studio 2008
 Fast v7
 Msc Adams 2013 2.0 (x64)

I have read older posts and I suppose that the problem is because of the version of Adams I have installed and I know you recommended using Adams 2008r1, but I have only access to the 2013 version.
So, what changes do I have to make to compile with adams 2013? Or is any possibility of making the simulation I need without compiling?
Thank you very much,
Nagore

Hi, Nagore.

It’s been a while since I’ve looked at compiling Adams, and I’m not sure version 2013 will work well with the A2AD source code.

However, the first thing you need to do is find out how to call Adams. Version 2008 provided batch files like “ADAMS08r1”, which you could use to easily call the program. Later version do not have these shortcuts, so you’ll need to find out where the mdi.bat files are stored. The easiest way to do this is to find the shortcut to “Adams Command”. Go to your Windows start menu and navigate to MSC.Software, then right-click on the “Adams Command” shortcut. Go to properties and copy the “target” field into the A2AD batch script, replacing “ADAMS08r1” in the following line CALL ADAMS08r1 cr-user n %ROOT_NAME%.obj %ROOT_NAME%f.obj -n %DLLName%.dll exit < NewLine.txt with the shortcut’s target.

Good luck!

Hi Bonnie,

Thank you for your fast reply. I think I have made the changes you suggested me. I have found the “mdi.bat” file and I have put it in the line you told me:

[code]ECHO Linking ADAMS2AD and AeroDyn routines with ADAMS 2008r1:
SET DLLName=%ROOT_NAME%
IF /I “%1”==“DLL” SET DLLName=%DLLName%_forBladedDLL

CALL mdi cr-user n %ROOT_NAME%.obj %ROOT_NAME%f.obj -n %DLLName%.dll exit < NewLine.txt

GOTO end[/code]

But I have had the next error:

[code]Linking Adams/Solver (User) DLL…
Microsoft (R) Incremental Linker Version 9.00.21022.08
Copyright (C) Microsoft Corporation. All rights reserved.

“ADAMS.obj”
“ADAMSf.obj”
“-out:ADAMS.dll”
-def:mysolver.def
-debug:none
-nodefaultlib
-dll
“-libpath:C:\MSC~1.SOF\ADAMS_~1\2013_2\win64”
msvcrt.lib msvcprt.lib
ws2_32.lib
kernel32.lib
libifcoremd.lib libmmd.lib libifportmd.lib
libirc.lib svml_dispmd.lib
asutility_imp.lib mdiloader_imp.lib
abgtire_imp.lib vpgutility_imp.lib
tire_imp.lib amd_imp.lib
Creando biblioteca ADAMS.lib y objeto ADAMS.exp
ADAMS.obj : error LNK2019: símbolo externo _TIMGET@4 sin resolver al que se hace
referencia en la función _VFOSUB
ADAMS.obj : error LNK2019: símbolo externo _SYSFNC@24 sin resolver al que se hac
e referencia en la función _VFOSUB
ADAMS.obj : error LNK2019: símbolo externo _SYSARY@28 sin resolver al que se hac
e referencia en la función _VFOSUB
ADAMS.obj : error LNK2019: símbolo externo _GETMOD@4 sin resolver al que se hace
referencia en la función _A2AD_MOD_mp_PSEUDO_HANDLER
ADAMS.obj : error LNK2019: símbolo externo _GTARAY@16 sin resolver al que se hac
e referencia en la función _A2AD_MOD_mp_PSEUDO_HANDLER
ADAMS.obj : error LNK2019: símbolo externo _GTSTRG@20 sin resolver al que se hac
e referencia en la función _A2AD_MOD_mp_PSEUDO_HANDLER
ADAMS.obj : error LNK2019: símbolo externo _GETVER@8 sin resolver al que se hace
referencia en la función _A2AD_MOD_mp_PSEUDO_HANDLER
ADAMS.obj : error LNK2019: símbolo externo _GTUNTS@16 sin resolver al que se hac
e referencia en la función _A2AD_MOD_mp_UNITCHK
ADAMS.obj : error LNK2019: símbolo externo _INFARY@28 sin resolver al que se hac
e referencia en la función _A2AD_MOD_mp_AEROINPUT
ADAMS.obj : error LNK2019: símbolo externo _INFFNC@24 sin resolver al que se hac
e referencia en la función _A2AD_MOD_mp_GETADAEROMARKERS
ADAMS.dll : fatal error LNK1120: 10 externos sin resolver
Adams/Solver (User) has been linked…

Microsoft (R) Manifest Tool version 5.2.3790.2075
Copyright (c) Microsoft Corporation 2005.
All rights reserved.

mt.exe : general error c10100b1: Failed to load file “ADAMS.dll”. El sistema no
puede encontrar el archivo especificado.
[/code]

So do you have any idea about how can I solve this problem?
Thank you very much,

Nagore

The linking errors you are getting are all ADAMS routines, which makes me think there is something wrong with some of the paths Adams is using. Actually, looking back at your previous post, it looks like you’re using a 32-bit compiler with 64-bit Adams. You should use the 64-bit platform of the compiler (intel64) so that the libraries are compatible.

Hi Bonnie,

First of all, thanks for your quick answers.
I have been able to acquire the dll and the library files. But when I try to simulate with Adams the “acf” or “adm” files obtained from the Fast simulation, I get the next errors:

[code]C:\Users\Nagore\Desktop\Fast v7\Prueba 5>adams2013_2_x64

 +------------------------------------------------------+
 |        | Adams 2013.2                     |          |
 |        ------------------------------------          |
 |Action                                  Selection Code|
 |------                                  --------------|
 |                                                      |
 |Create Adams/Solver with                              |
 |   Adams User-DLL                          cr-user    |
 |                                                      |
 |Run Adams/Solver with                                 |
 |   Standard Adams executable               ru-standard|
 |   User executable                         ru-user    |
 |                                                      |
 |Pre- or Post-process with                             |
 |   Adams/View                              aview      |
 |   Adams/Car                               acar       |
 |   Adams/Driveline                         adriveline |
 |   Adams/PostProcessor                     appt       |
 |   Adams/Insight                           ainsight   |
 |   Adams/Flex Toolkit                      flextk     |
 |   Adams/Durability Toolkit                durtk      |
 |   MSC Registry Editor                     redit      |
 |   MSC Registry Shell Tool                 rtool      |
 |   Custom Memory Model (uconfg_user)       cmm        |
 +------------------------------------------------------+

 Enter your selection code or EXIT: ru-user

Enter name of your Adams/Solver User-DLL, or EXIT:
ADAMS.dll

Enter the name of the Adams command file or EXIT (=none):
Test01_ADAMS.acf


| … … |
| ####*. ####. |
| ###*. #. MSC Software |
| ###. #. ------------ | | ##. ## |
| ##. ## | | ## ##’ A d a m s C++ S o l v e r |
| #### [Build: 2013.2.0-CL221316] |
| ###. Version: 2013.2 |
| ####. Patch Version: None | | .### # |
| #### # | | #### #. | | ##### # http://www.mscsoftware.com |
| .##### |
| #####’ |
| #### |
| |
| ********************************************************************* |
| * * |
| * MSC Software Corporation * |
| * * |
| * A d a m s * |
| * * |
| * Automatic Dynamic Analysis of Mechanical Systems * |
| * * |
| ********************************************************************* |
| * * |
| * LEGAL INFORMATION * |
| * * |
| * Warning: This computer program is protected by copyright law * |
| * and international treaties. Unauthorized reproduction or * |
| * distribution of this computer program, or any portion of it, * |
| * may result in severe civil and criminal penalties. * |
| * * |
| * Copyright (C) 2013 MSC Software Corporation and its licensors. * |
| * All rights reserved. * |
| * * |
| ********************************************************************* |

*********************************************************************
* *
* Local Time: 2015-03-24 14:28:31 *
* Host Name: Nagore1 *
* Uname: MS Windows NT *
* OS Info: 6.2 *
* User: Nagore *
* Customer ID: 0897E1FA-D938F5BC *
* Current dir: C:\Users\Nagore\Desktop\Fast v7\Prueba 5 *
* *
*********************************************************************

command: FILE/MODEL=Test01_ADAMS, OUTPUT_PREFIX=Test01_ADAMS

Running NWTC Subroutine Library (v1.07.02a-mlb, 21-May-2013).

Running A2AD (v13.01.00a-bjj, 15-Feb-2012).

| Model Title |
|=============================================================================|
| |
| !ADAMS/View model name: FAST certification Test #01: AWT-27CR2 with many DOFs
wi|

command: INTEGRATOR/GSTIFF, ERROR = 0.001, HMAX = 4.000000E-03, INTERPOLATE =
ON
command: SIMULATE/DYNAMICS, END = 4.000000E-03, DTOUT = 2.000000E-02

Begin Simulation

****** Performing Dynamic Simulation using Gstiff I3 Integrator ******

---- START: WARNING ----
The data set is kinematically determinate. However, a dynamic analysis
has been requested. A kinematic analysis with the SIMULATE/KINEMATICS
command would be more efficient and possibly more accurate for some of
the computed quantities.
As requested, the simulation will continue with a dynamic analysis.

---- END: WARNING ----
The system is modelled with INDEX-3 DAEs.
The integrator is GSTIFF, CORRECTOR = original
Integration error = 1.000000E-03

Detected system force units of kilonewtons (kN).

---- START: ERROR ----
GFOSUB(11010, 1, 1) has been illegally defined. A new functional dependency on
the measure
TDISP(4000,1,1) has been encountered during execution.

---- END: ERROR ----

Error calling INFARY for hub position coordinates.

Aborting A2AD.[/code]

I want to make that simulation, so can you help me with the errors I have obtained?
Thank you very much,

Nagore

Hello,

I am trying to install FAST v8 in Linux in a cloud.

I was wondering in which platform it has been tested previously. I have two other questions regarding the make file in the FAST_V_8/FAST/Compiling > compiling folder .

  1. Was there any flag used?
  2. What were the compiling options used

Thanks.

I have not tested FAST v8 on Linux. It compiles using gfortran for Windows, but as of yet, the offshore cases do not properly run using gfortran. The \Compiling folder contains a makefile you can use to compile with gfortran; you should be able to use it on Linux with little change. Please read the FAST8 ReadMe and compiling instructions that are distributed in the FAST archive.

Hello Bonnie,

I do not know if you had read my last post. I have been hardly trying to solve my problem, but I have not been able to find a solution.
The fact is that I created the DLL file with CompileLinkA2AD.bat. And when I try to make a simulation with Adams, I get the next error.

[code]---- START: ERROR ----
GFOSUB(11010, 1, 1) has been illegally defined. A new functional dependency on
the measure
TDISP(4000,1,1) has been encountered during execution.

---- END: ERROR ----

Error calling INFARY for hub position coordinates.

Aborting A2AD.
[/code]

If you require any further information (the complete code or the versions of the programs I am using) it is detailed in my previous post.
I am developing my final degree project and I need this simulation to continue with it.
Thank you very much and I hope you could help me.
Regards,

Nagore

Hi, Nagore.

Thanks for drawing my attention to your last post.

I haven’t used Adams in quite some time, so I’m a little rusty with this. But, my first thought is to make sure you are using the Fortran solver (under Adams - Settings, make sure ASolver / solverSelection) is F77. It seems to be complaining about InfAry, which isn’t supported in the C++ solver.

Hope that solves the problem.

Hi Bonnie,

Thank you very much for your answers. I have solved my problem!
Kind regards,

Nagore

Dear all
I am a beginner. I want to design an controller for wind turbine smart blade( use flaps). The FAST_SFunc block have 3 control signal inputs (the Generator torque, nacelle yaw, and pitch), now i want to add an flap control signal input to the FAST_SFunc block. So far as I know, I need to modify FASTSimulink.f90 (add flap control signal input) and AeroSubs.f90 (choose the flap aerodata) , and recompile the mex function. But I met a problem.
Could FASTSimulink.f90 compile with FAST program package? I could successfully compile the FAST program package by IVF, but when I add FASTSimulink.f90 and FASTGateway.f90 to the IVF project, then compile it, lots of errors occur. I don’t know if FASTSimulink.f90 could compile with FAST program package by IVF, if no, how can I check the modification of program package is correct?

Best regards,
keshan

When you use FAST_SFunc (for FAST v7), you need to compile the FAST source code using MATLAB with the “make_FAST_SFunc.m” script found in the Simulink\Source folder of the archive. This will create a dynamic library with a “.mex*” extension; it is completely separate from the main FAST executable (FAST.exe).

The main FAST program used to generated FAST.exe does not compile with FASTSimulink.f90 or FASTGateway.f90. Those two files are used only when compiling in MATLAB (and are used instead of FAST_Prog.f90).

Dear all,

I am performing tests with FAST on Linux and OSX platforms, compiled using gfortran or Intel Fortran Compiler. I mode little modifications on the FAST makefile and on SysGnuLinux.f90 (to allow dll loading).
I can send you my modified scripts when everything will be ready but I’m still experiencing a problem:

Both Gfortran and Ifort compilations work succesfully and give the same results as Windows executables on certification tests, but when turning on the new TMD module, the gfortran-compiled executable crashes (not the Ifort one), with this output:


 **************************************************************************************************
 FAST (v8.10.00a-bjj, 31-Mar-2015)

 Copyright (C) 2015 National Renewable Energy Laboratory

 This program comes with ABSOLUTELY NO WARRANTY. See the "license.txt" file distributed with this
 software for details.
 **************************************************************************************************

  Running FAST (v8.10.00a-bjj, 31-Mar-2015), compiled as a 64-bit application using single
  precision
  linked with NWTC Subroutine Library (v2.05.02a-bjj, 25-Feb-2015)

  Heading of the FAST input file:
    FAST Certification Test #18: NREL 5.0 MW Baseline Wind Turbine (Onshore)

  Running ElastoDyn (v1.02.00a-bjj, 31-Mar-2015).

  Running ServoDyn (v1.02.00a-bjj, 31-Mar-2015).

  Running ServoDyn Interface for Bladed Controllers (using GNU Fortran for Linux, 1-May-2013).

  Running TMD (v1.00.00-wgl, 11-March-2015).

  Running AeroDyn (v14.03.01a-bjj, 13-Mar-2015).

  Running InflowWind (v2.01.00a-bjj, 13-Mar-2015).

    Assuming ./NoShr_12.wnd is a formatted HH wind file.
    Processed 3 records of HH data
  Timestep: 0 of 60 seconds.

 FAST_Solution0:CalcOutputs_And_SolveForInputs:SolveOption2:SrvD_CalcOutput:Running with torque
 and pitch control of the NREL offshore 5MW baseline wind turbine from DISCON.dll as written by J.
 Jonkman of NREL/NWTC for use in the IEA Annex XXIII OC3 studies.


Program received signal SIGSEGV: Segmentation fault - invalid memory reference.

Backtrace for this error:

and no backtrace…

Does anyone have an idea about the reason of this crash?

Thank you.

Hi, Jean Marc.

Thanks for reporting this issue. I took a look at it in the gnu debugger (gdb) and it seems similar to the issue preventing us from running models with HydroDyn when compiling with gfortran. It looks like some memory related to the TMD mesh is getting overwritten somehow, and it’s crashing on a call to MeshCopy. I don’t have a solution right now (other than to use Intel Fortran), but I’ll keep looking as I find time.

Jean Marc,

I was able to track down the issue with Test18 with TMD in gfortran, and have it running on my version of the code. I’ll get this fix in the next FAST release, but meanwhile, I’ve put new source files for ServoDyn and TMD that you can use here.

Thank you so much Bonnie!

I will test these routines right now. Do you have the 2.07 registry so I could test my own modules as well?

Here are some links to archives of the latest version of the Registry:

Thank you very much, it works.

Here are some tricks to build a version of FAST for linux and/or osx using gfortran or ifort:

Firstly, we need to patch the SysGnuLinux.f90 file (NWTC Library) using:

@@ -92,7 +92,11 @@
 
 !=======================================================================
    FUNCTION FileSize( Unit )
-
+   
+#ifndef __GFORTRAN__
+    USE IFPORT
+#else
+#endif
 
       ! This function calls the portability routine, FSTAT, to obtain the file size
       ! in bytes corresponding to a file unit number or returns -1 on error.
@@ -149,7 +153,10 @@
 !bjj note: this subroutine is not tested for this compiler
    SUBROUTINE Get_CWD ( DirName, Status )
 
-
+#ifndef __GFORTRAN__
+    USE IFPORT
+#else
+#endif
       ! This routine retrieves the path of the current working directory.
 
 
@@ -433,6 +440,11 @@
 
 !   WRITE (CU,'(1X,A)',ADVANCE='NO')  Str
    WRITE (CU,'(A)',ADVANCE='NO')  Str
+   
+#ifndef __GFORTRAN__
+      FLUSH(CU)
+#else
+#endif
 
 
    RETURN
@@ -465,10 +477,21 @@
       WRITE (Fmt(5:7),'(I3)')  NChars
 
       WRITE (CU,Fmt,ADVANCE='NO')  CR, Str
+   
+#ifndef __GFORTRAN__
+      FLUSH(CU)
+#else
+#endif
 
    ELSE
       ! bjj: note that this will almost certainly write more than MaxWrScrLen characters on a line
       WRITE (CU,'(A)',ADVANCE='NO')  CR, Str
+   
+#ifndef __GFORTRAN__
+      FLUSH(CU)
+#else
+#endif
+
    END IF
 
 
@@ -524,11 +547,11 @@
    INTEGER(C_INT), PARAMETER :: RTLD_LOCAL=0           ! "This is the converse of RTLD_GLOBAL, and the default if neither flag is specified. Symbols defined in this library are not made available to resolve references in subsequently loaded libraries."
 
 
-   ErrStat = ErrID_Fatal
-   ErrMsg = ' LoadDynamicLib: Not implemented for '//TRIM(OS_Desc)
-   
-   
-#if 0           
+!   ErrStat = ErrID_Fatal
+!   ErrMsg = ' LoadDynamicLib: Not implemented for '//TRIM(OS_Desc)
+   
+   
+!#if 0           
 !bjj: note that this is not tested:
    INTERFACE !linux API routines
       !bjj see http://linux.die.net/man/3/dlopen
@@ -582,7 +605,7 @@
       RETURN
    END IF
 
-#endif
+!#endif
    
    RETURN
 END SUBROUTINE LoadDynamicLib
@@ -602,11 +625,11 @@
    INTEGER(C_INT), PARAMETER                 :: TRUE  = 0
 
 
-   ErrStat = ErrID_Fatal
-   ErrMsg = ' FreeDynamicLib: Not implemented for '//TRIM(OS_Desc)
-   
-   
-#if 0   
+!   ErrStat = ErrID_Fatal
+!   ErrMsg = ' FreeDynamicLib: Not implemented for '//TRIM(OS_Desc)
+   
+   
+!#if 0   
 !bjj: note that this is not tested.
    INTERFACE !linux API routine
       !bjj see http://linux.die.net/man/3/dlopen
@@ -635,7 +658,7 @@
       ErrStat = ErrID_None
       ErrMsg = ''
    END IF
-#endif
+!#endif
    
    RETURN
 END SUBROUTINE FreeDynamicLib

This allows the loading of dlls, and it resolves some portability issues between gfortran and ifort.

Next, here are the compilers options I used to build the code.

  • Using gfortran

[code]
FC = gfortran

F90_FLAGS = -x f95-cpp-input -ffree-line-length-none -O2 -m64 -finit-local-zero -fno-automatic
F77_FLAGS = -x f77-cpp-input -O2 -m64 -finit-local-zero -fno-automatic
LD_FLAGS = -O2 -m64 -ldl -finit-local-zero -fno-automatic[/code]

  • Using Intel Fortran for Linux
FC              =       ifort

F90_FLAGS       =       -fpp -threads -O2 -mkl:sequential -finline-functions -xhost
F77_FLAGS       =       -fpp -threads -O2 -mkl:sequential -finline-functions -xhost
LD_FLAGS         =       -fpp -threads -O2 -I$(MKLROOT)/include -mkl:sequential -finline-functions -xhost

Hope this helps someone.