NREL / SOWFA

Other
131 stars 113 forks source link

Compilation issue FAST #5

Closed WeatherMan5 closed 6 years ago

WeatherMan5 commented 7 years ago

Hi everyone, I am trying to compile SOWFA using OpenFOAM 2.4.0 The compilation seems to progress fine until it crash complaining it cannot find:

horizontalAxisWindTurbinesALMfastv8/horizontalAxisWindTurbinesALMfastv8.H:68:29: fatal error: FAST_cInterface.h: No such file or directory

Do I have to compile FASTv8 beforehand? Is there a guide on how to compile it for Linux (ubuntu)? Thanks

NeuerYao commented 7 years ago

Hi,

I met same problem.

Have you solved it? If so, can you explain how you solve it?

Thank you!

Best, Neuer

mchurchf commented 7 years ago

All,

Sorry for the lack of instructions on the compilation of the FAST8-coupled parts of SOWFA because this is a new development piece of SOWFA. It uses a customized version of FAST 8 for which all the internal FAST workings are the same, but a proper C-interface is provided. This C-interface code will soon be incorporated into what we call OpenFAST, which is basically FAST8, but will be the new name moving forward. Once that is complete, one will grab the standard OpenFAST and be able to couple with any flow code.

But, for now, here are instructions:

------ FAST 8 ------

The FAST 8 part itself may be a little tricky. The custom FAST 8 version for this purpose was made by one of our postdocs. Eventually this will be all incorporated into the main FAST branch, which will be called OpenFAST. But it works for now. So, to get it clone it from: https://github.com/gantech/fastv8DriverProgram.git. After you clone the FAST 8 from Ganesh’s repository, you need to do “git checkout OpenFOAMcoupling”. It is setup to compile well on our supercomputer, so we may have to work on this a bit, but I’m sure we can get it to compile on your machine too. To build it, go into the directory that you clone, and do the following:

COMPILER=gnu BUILD=release LAPACK=mkl ./install.sh

OR

COMPILER=gnu BUILD=release LAPACK=lapack ./install.sh

depending on what you have for Lapack. This assumes you are using the gnu compilers (it needs gfortran, gcc, openmpi, mkl (or lapack), and hdf5). However, you’ll see that install.sh does something called prepareSourceMods, which creates and runs this file called sourceMods.sh, which is created from .sourceMods.sh. (Yes, this process needs to be cleaned up—OpenFAST uses cmake, so it is much better.) Take a look at .sourceMods.sh. It loads modules on our machine as follows:

module load gcc/4.8.2 mkl cmake/3.3.2 openmpi-gcc/1.7.3-4.8.2 hdf5/1.8.12/openmpi-gcc

If your machine has modules, then you’ll want to adjust this accordingly. If you don’t have modules, you’ll have to manually make sure all this stuff is in your path, etc.

------ SOWFA ------

You’ll also need to create an environment variable FAST_DIR. SOWFA will use this when it compiles the FAST coupled parts. For example, mine is set like this:

FAST_DIR=$HOME/bin/OpenFOAM/fastv8DriverProgram/fastv8

Once that is done, and you’ve pulled the new SOWFA commits, I think if you run makeNewWorkingDir, it will put any new stuff in your $USER-2.4.x directory. It may be safer to just remove your current $USER-2.4.x directory and make a fresh one with makeNewWorkingDir. Then go to your $USER-2.4.x directory and do Allwclean and Allwmake like normal, and hopefully all should be good.

In the exampleCases directory, you’ll see a new FAST 8 coupled example. It is an NREL 5 MW turbine in a big box of uniform 8 m/s flow. There is no ground. The runscript.preprocess script will make a big coarse block mesh, and then refineHexMesh will add cylindrical refinement regions around the turbine and wake. A neat thing you’ll see in the .fst files (1 for each turbine — this example is set up for 2 turbines, but in the turbineArrayProperties, the 2nd turbine is commented out to make your first try simpler) that FAST write out VTK files, so you can easily load these into Paraview to visualize the blades (either as lines or fullgeometry) and their deformation and rotation. Same for the tower.

I apologize for the somewhat complicated compilation with FAST 8. The FAST developers are trying to make this much simpler, so hopefully that happens in the next few months.

NeuerYao commented 7 years ago

Hi mchurchf, thanks for your help. I'll try the compilation again. Thank you.

casedano1167 commented 6 years ago

Hi, I have successfully compiled the FAST tool from the repository above. However, when I run the Allwmake script to compile SOWFA, i get the following error when compiling 'horizontalAxisWindTurbinesALMfastv8': horizontalAxisWindTurbinesALMfastv8/horizontalAxisWindTurbinesALMfastv8.C:416:11: error: ‘class FAST_cInterface’ has no member named ‘setGlobalInputs’ This is not the only error of this type. There are several other members missing such as 'setTurbineData' or 'getHubShftDir' amongst others. How can I solve this issues?

Thanks. Best regards, casedano

mchurchf commented 6 years ago

I recommend moving to OpenFAST, which you can get at github.com/OpenFAST. It is basically FAST 8 in a new framework that will enhance community collaboration going forward, and the interface to CFD solvers is streamlined. Then, we currently have an OpenFAST branch of SOWFA that has the OpenFAST coupled actuator line. Please try this. Eventually, and hopefully soon, this OpenFAST branch will be merged to the main branch to avoid confusion. As soon as I get time to further test things, I'll clean this up.

JackPerdue commented 6 years ago

I've been working this for a week now and started with OpenFAST but went to fastv8DriverProgram due to a lack of FAST_cInterface.c. But I can't get the OpenFOAMcoupling branch to compile because it wants something that only defined in the master branch.

So.... what should I use.... the latest OpenFAST or the SOWFA OpenFAST.... if the latter, where do I get that???

Where is this documented in the README (or elsewhere)?

I'm not convinced this issue is closed (it isn't for me).

Bartdoekemeijer commented 6 years ago

@JackPerdue I've made some attempts too, but unfortunately have not succeeded either.

As far as I could understand it, you need to download OpenFAST from the official repo) and compile this including the C++ API. More details about compiling OpenFAST can be found here. Basically, it comes down to adding it to the cmake command: cmake -DBUILD_FAST_CPP_API:BOOL=ON .. Note that you will need to have YAML-CPP and HDF5 installed.

Then, you should be able to compile the OpenFAST branch from this SOWFA repository using the compiled OpenFAST libraries. I myself needed to redefine the dependencies in src/turbineModels/... and in the /applications/solvers/ folders. I managed to compile the turbine codes inside SOWFA using the latest OpenFAST version, but without the C++ API the solvers won't compile.

Could you please let me know if you can compile OpenFAST with the C++ API enabled? If not, then we should open a ticket there, rather than in SOWFA. I myself have been having issues with the compilation of the C++ API. OpenFAST first needs to compile successfully before we attempt to compile it together with SOWFA.

JackPerdue commented 6 years ago

Here's the EasyBuild recipe I came up with for OpenFAST 1.0.0. If not familiar with EB, it basically just runs cmake && make && make install.

Still no joy with SOWFA though... e.g.

In file included from pisoFoamTurbine.C(38): /scratch/user/j-perdue/SOWFA/20171008/src/turbineModels/turbineModelsFASTv8/lnInclude/horizontalAxisWindTurbinesALMfastv8.H(68): catastrophic error: cannot open source file "FAST_cInterface.h"

include "FAST_cInterface.h"

What other changes did you make?

OpenFAST-1.0.0-intel-2017A.eb.txt

JackPerdue commented 6 years ago

Build script (ignore the OpenFAST/FAST8 bits.... they are disabled.... uses the OpenFAST module above). build_SOWFA.sh.txt

JackPerdue commented 6 years ago

A little progress... unset FAST_DIR and set OPENFAST_DIR instead.... didn't realize I needed to change that. Having some link errors at the moment but its progress.

Bartdoekemeijer commented 6 years ago

Hi Jack. Nice to see progress! I'll take a look at the EB code and give it another try. Something important you may have to take a look at, especially if you're missing certain turbine files, is what I addressed in this pull request: https://github.com/NREL/SOWFA/pull/16 . There are some dependencies which I guess differ per platform.

ewquon commented 6 years ago

Jack and Bart,

Have either of you tried the configuration scripts included in the openfast repo, e.g., share/fast-build-cpp.sh? If you're missing the interface code code or headers, those are compiled and included with the cmake BUILD_FAST_CPP_API=ON flag.

The latest SOWFA code (OpenFAST branch) should include the correct interfaces to OpenFAST.

Good luck! Eliot

-- Eliot Quon Research Engineer | National Wind Technology Center

National Renewable Energy Laboratory (NREL) 15013 Denver West Parkway | Golden, CO 80401 303-384-7172 eliot.quon@nrel.gov | www.nrel.gov

From: Jack Perdue notifications@github.com<mailto:notifications@github.com> Reply-To: NREL/SOWFA reply@reply.github.com<mailto:reply@reply.github.com> Date: Friday, October 6, 2017 at 10:42 AM To: NREL/SOWFA SOWFA@noreply.github.com<mailto:SOWFA@noreply.github.com> Cc: Subscribed subscribed@noreply.github.com<mailto:subscribed@noreply.github.com> Subject: Re: [NREL/SOWFA] Compilation issue FAST (#5)

I've been working this for a week now and started with OpenFAST but went to fastv8DriverProgram due to a lack of FAST_cInterface.c. But I can't get the OpenFOAMcoupling branch to compile because it wants something that only defined in the master branch.

So.... what should I use.... the latest OpenFAST or the SOWFA OpenFAST.... if the latter, where do I get that???

Where is this documented in the README (or elsewhere)?

I'm not convinced this issue is closed (it isn't for me).

- You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FNREL%2FSOWFA%2Fissues%2F5%23issuecomment-334808020&data=02%7C01%7Celiot.quon%40nrel.gov%7C5a24b7bbb538458afcaf08d50cd93387%7Ca0f29d7e28cd4f5484427885aee7c080%7C0%7C0%7C636429049368421028&sdata=X4m6%2FyOGQhmHvyHGMsJdvyOSztR3wWctrjaemb2l5Jk%3D&reserved=0, or mute the threadhttps://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FARa7sx9_lCX3NQIL44VT_7d3BZvjjOh7ks5splhegaJpZM4NaOAz&data=02%7C01%7Celiot.quon%40nrel.gov%7C5a24b7bbb538458afcaf08d50cd93387%7Ca0f29d7e28cd4f5484427885aee7c080%7C0%7C0%7C636429049368421028&sdata=srTbmzeIH9O1PxfGnoWIgc7v4P5qN0Q6bsKpxFVOirc%3D&reserved=0.

Bartdoekemeijer commented 6 years ago

@ewquon Thanks Eliot! Just a quick question -- can you tell me which OpenFOAM version and which compiler versions you are using on Peregrine? Unfortunately, I have had only little success with a variety of GNU GCC compiler versions in combination with OpenFOAM 2.4.0.

mchurchf commented 6 years ago

@Bartdoekemeijer We are using OpenFOAM 2.4.x with the following compiler info:

gcc 4.8.2 openmpi 1.7.3