Closed CallumG-Ed closed 4 years ago
Open the file pisoFoamTurbine.ALMAdvancedOpenFAST/Make/options and in the EXE_INC variable, at the end, add the include path to the HDF5 headers, like this:
EXE_INC = \
-I$(LIB_SRC)/turbulenceModels/incompressible/turbulenceModel \
-I$(LIB_SRC)/transportModels \
-I$(LIB_SRC)/transportModels/incompressible/singlePhaseTransportModel \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/fvOptions/lnInclude \
-I$(LIB_SRC)/sampling/lnInclude \
-I$(SOWFA_DIR)/src/turbineModels/turbineModelsOpenFAST/lnInclude \
$(PFLAGS) \
$(PINC) \
-I$(OPENFAST_DIR)/include \
-I$(HDF5_DIR)/include
Of course, the HDF5_DIR environment variable must point to /usr/include/hdf5/serial (the default installation path for Ubuntu HDF5 serial library)
Hi thanks for the reply.
I have added: -I$(HDF5_DIR) to both
/home/callum/OpenFOAM/callum-2.4.0/SOWFA/applications/solvers/incompressible/windEnergy
pisoFoamTurbine.ALMAdvancedOpenFAST/Make/options
and
windPlantSolver.ALMAdvancedOpenFAST/Make/options
(because the header files are in /usr/include/hdf5/serial not /usr/include/hdf5/serial/include)
I updated the variable $HDF5 to equal /usr/include/hdf5/serial
and unfortunately I am still getting the error.
Ops, my mistake.. The path that I told you was for Ubuntu 16.. You're right, on Ubuntu 18, the header files are inside /usr/include/hdf5/serial
It's weird.. What happens if you directly plug the full hdf5 path in the options file?, like this:
EXE_INC = \
-I$(LIB_SRC)/turbulenceModels/incompressible/turbulenceModel \
-I$(LIB_SRC)/transportModels \
-I$(LIB_SRC)/transportModels/incompressible/singlePhaseTransportModel \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/fvOptions/lnInclude \
-I$(LIB_SRC)/sampling/lnInclude \
-I$(SOWFA_DIR)/src/turbineModels/turbineModelsOpenFAST/lnInclude \
$(PFLAGS) \
$(PINC) \
-I$(OPENFAST_DIR)/include \
-I/usr/include/hdf5/serial/
If the hdf5.h
file is on that path, this should work.
Maybe the environment variable HDF5_DIR was not properly set, or you forgot to export it.
Hi Pablo,
So I have reassigned the $HDF5_DIR
variable to /usr/lib/x86_64-linux-gnu/hdf5/serial so that it is inline with I$(HDF5_DIR)/include
. I then source the bash_profile here:
And run the function SOWFA-2.4.0 within it.
I have added I$(HDF5_DIR)/include
to EXE_INC
in 3 files:
1) SOWFA/src/turbineModelsOpenFAST/Make/options
2) SOWFA/applications/solvers/incompressible/windEnergy/pisoFoamTurbine.ALMAdvancedOpenFAST/Make/options
3) SOWFA/applications/solvers/incompressible/windEnergy/windPlantSolver.ALMAdvancedOpenFAST/Make/options
After running the ./Allwclean
and then ./Allwmake
command now I get:
OPENFAST_DIR is set to '/home/callum/OpenFAST/openfast/install'. Attempting to compile OpenFAST pisoFoam solver. Making dependency list for source file pisoFoamTurbine.C could not open file horizontalAxisWindTurbinesALMOpenFAST.H for source file pisoFoamTurbine.C due to No such file or directory SOURCE=pisoFoamTurbine.C ; g++ -m64 -Dlinux64 -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3 -DNoRepository -ftemplate-depth-100 -I/home/callum/OpenFOAM/OpenFOAM-2.4.0/src/turbulenceModels/incompressible/turbulenceModel -I/home/callum/OpenFOAM/OpenFOAM-2.4.0/src/transportModels -I/home/callum/OpenFOAM/OpenFOAM-2.4.0/src/transportModels/incompressible/singlePhaseTransportModel -I/home/callum/OpenFOAM/OpenFOAM-2.4.0/src/finiteVolume/lnInclude -I/home/callum/OpenFOAM/OpenFOAM-2.4.0/src/meshTools/lnInclude -I/home/callum/OpenFOAM/OpenFOAM-2.4.0/src/fvOptions/lnInclude -I/home/callum/OpenFOAM/OpenFOAM-2.4.0/src/sampling/lnInclude -I/home/callum/OpenFOAM/callum-2.4.0/SOWFA/src/turbineModels/turbineModelsOpenFAST/lnInclude -DOMPI_SKIP_MPICXX -I/usr/lib/x86_64-linux-gnu/openmpi/include/openmpi -I/usr/lib/x86_64-linux-gnu/openmpi/include/openmpi/opal/mca/event/libevent2022/libevent -I/usr/lib/x86_64-linux-gnu/openmpi/include/openmpi/opal/mca/event/libevent2022/libevent/include -I/usr/lib/x86_64-linux-gnu/openmpi/include -pthread -I/home/callum/OpenFAST/openfast/install/include -I/usr/lib/x86_64-linux-gnu/hdf5/serial/include -IlnInclude -I. -I/home/callum/OpenFOAM/OpenFOAM-2.4.0/src/OpenFOAM/lnInclude -I/home/callum/OpenFOAM/OpenFOAM-2.4.0/src/OSspecific/POSIX/lnInclude -fPIC -c $SOURCE -o Make/linux64GccDPOpt/pisoFoamTurbine.o pisoFoamTurbine.C:38:10: fatal error: horizontalAxisWindTurbinesALMOpenFAST.H: No such file or directory
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated. pisoFoamTurbine.dep:687: recipe for target 'Make/linux64GccDPOpt/pisoFoamTurbine.o' failed make: *** [Make/linux64GccDPOpt/pisoFoamTurbine.o] Error 1
ok, from what I see in the SOWFA_compile_log.txt, now you have a link error. (The compiler cannot find the libhdf5.so and libhdf5_hl files)
The things is, that in Ubuntu 18, the HDF5 heades (the .h files) are located inside /usr/include/hdf5/serial
, but the libraries (the libhdf5.so and libhdf5_hl.so) are inside /usr/lib/x86_64-linux-gnu/hdf5/serial/
. So, it is impossible to define a single base directory for the headers and the libraries. And in the options file, at the end, in the EXE_LIBS variable, it defines the location of the HDF5 libraries with the line
-L$(HDF5_DIR)/lib/ \
which, in your case, it will point to an incorrect path (/usr/include/hdf5/serial/lib).. I recommend you to replace that line with the full path to the proper location:
-L/usr/lib/x86_64-linux-gnu/hdf5/serial/ \
Apologies Pablo,
I think I recognised the same as you replied so I editted my comment above. I have done as you said and the error remains as in my previous comment.
Sorry, I just saw the first comment..
Again, in the options file of pisoFoamTurbine.ALMAdvancedOpenFAST, the location of that header, horizontalAxisWindTurbinesALMOpenFAST.H, is selected with the line:
-I$(SOWFA_DIR)/src/turbineModels/turbineModelsOpenFAST/lnInclude \
and, looking at your logs, this gets resolved to
-I/home/callum/OpenFOAM/callum-2.4.0/SOWFA/src/turbineModels/turbineModelsOpenFAST/lnInclude
Can you check if this path is correct? The horizontalAxisWindTurbinesALMOpenFAST.H must be inside that path
Yes you are quite correct the line in the pisoFoamTurbine.ALMAdvancedOpenFAST options file is:
-I$(SOWFA_DIR)/src/turbineModels/turbineModelsOpenFAST/lnInclude \
which resolves as you say to:
-I/home/callum/OpenFOAM/callum-2.4.0/SOWFA/src/turbineModels/turbineModelsOpenFAST/lnInclude
So I've made a directory lnInclude in:
$SOWFA_DIR/src/turbineModels/turbineModelsOpenFAST
and symlinked into
$SOWFA_DIR/src/turbineModels/turbineModelsOpenFAST/horizontalAxisWindTurbinesALMOpenFAST
that has done the trick!
Thanks very much for the support Pablo, it's much appreciated! Great work!
Cheers Callum
You're welcome. It's always a pleasure to help
Cheers!
Just when I thought everything was compiled, I realised the FAST coupled solvers still haven't worked! I have attached log here:
Any help on this would be much appreciated
You linker is failing to locate the Lapack routines. I think that you compiled OpenFAST without turning on the BUILD_SHARED_LIBS flag..
In that case, the shared version of OpenFAST libraries have implicit the dependency to the blas/lapack library, and you don't have to declare them again when compiling Sowfa. When you only have static libraries (libnwtclibs.a, libopenfastlib.a, etc.), that information is lost. You have to add it explicitly when you link to those libraries. As pisoFoamTurbine.ALMAdvancedOpenFAST
do not declare this dependency (to liblapack.so/.a) in the options file, the compilation fails..
You can try to add the dependency to lapack (-llapack) in the EXE_LIBS
variable of the options file, and see if that works. Or, recompile OpenFAST with that flag turned on, and then recompile the SOWFA binaries..
Also, I will suggest you to take a look at the document I uploaded some time ago to my github, on how to compile this thing:
https://github.com/pablo-benito/SOWFA-installation
P.S. I have to update the document with the modifications about the location of the HDF5 headers/library on Ubuntu 18.04, that we talked the other day..
Hi Pablo thanks again for the info! I hadn't realised you'd put together a nice install guide.
I'm trying to re-compile OpenFAST with the added flag -BUILD_SHARED_LIBS:BOOL=ON, however now cmake warning:
CMake Warning:
Manually-specified variables were not used by the project:
BUILD_FAST_CPP_API
which I know is required for coulping SOWFA. I know it's probably something silly but I can't seem to get it to take the flag.
The steps I've taken to get OpenFAST are:
sudo apt install gcc gfortran cmake libblas-dev liblapack-dev libxml2-dev libhdf5-serial-dev libyaml-cpp-dev python3-pip libopenblas-dev libyaml-cpp-dev
pip3 install numpy matplotlib
mkdir OpenFAST && cd OpenFAST
git clone --recursive https://github.com/OpenFAST/openfast.git
cd openfast/
after that I've made a little bash script with all the options etc:
#!/bin/bash
#build openfast script
git checkout dev
git submodule update
if [ -d "build" ]; then
rm -r build
echo "build exists - deleting"
fi
if [ -d "install" ]; then
rm -r install
echo "install exists - deleting"
fi
echo "creating new directories"
mkdir build install && cd build
cmake \
-DCMAKE_INSTALL_PREFIX=~/OpenFAST/openfast/install/ \
-DFPE_TRAP_ENABLED=ON \
-DBUILD_FAST_CPP_API:BOOL=ON \
-DBUILD_SHARED_LIBS:BOOL=ON \
../
make install
Any help would be apppreciated as always.
Thanks again for your time Pablo!
uops, my document is a little outdated...
The flag name changed from BUILD_FAST_CPP_API
to BUILD_OPENFAST_CPP_API
Cheers Pablo you're awesome! Recompiling now hopefully thats got it, I will let you know when I recompile SOWFA.
Thats got it Pablo all the FAST solvers have now compiled with SOWFA! Again thanks very much, I appreciate all you efforts!
Hi, I'm having an issue getting the OpenFAST solvers in SOWFA to compile. I'm running ubuntu 18.04 and OpenFOAM-2.4.0.
The error I'm getting on the SOWFA compile solvers is:
OPENFAST_DIR is set to '/home/gx/OpenFAST'. Attempting to compile OpenFAST windPlant solver. SOURCE=windPlantSolver.C ; g++ -m64 -Dlinux64 -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3 -DNoRepository -ftemplate-depth-100 -I/home/gx/OpenFOAM/OpenFOAM-2.4.x/src/turbulenceModels/incompressible/turbulenceModel -I/home/gx/OpenFOAM/OpenFOAM-2.4.x/src/transportModels -I/home/gx/OpenFOAM/OpenFOAM-2.4.x/src/transportModels/incompressible/singlePhaseTransportModel -I/home/gx/OpenFOAM/OpenFOAM-2.4.x/src/finiteVolume/lnInclude -I/home/gx/OpenFOAM/OpenFOAM-2.4.x/src/meshTools/lnInclude -I/home/gx/OpenFOAM/OpenFOAM-2.4.x/src/fvOptions/lnInclude -I/home/gx/OpenFOAM/OpenFOAM-2.4.x/src/sampling/lnInclude -I/home/gx/SOWFA/src/turbineModels/turbineModelsOpenFAST/lnInclude -DOMPI_SKIP_MPICXX -I/usr/lib/x86_64-linux-gnu/openmpi/include/openmpi -I/usr/lib/x86_64-linux-gnu/openmpi/include/openmpi/opal/mca/event/libevent2022/libevent -I/usr/lib/x86_64-linux-gnu/openmpi/include/openmpi/opal/mca/event/libevent2022/libevent/include -I/usr/lib/x86_64-linux-gnu/openmpi/include -pthread -I/home/gx/OpenFAST/include -I./interpolate2D -I/usr/lib/x86_64-linux-gnu/hdf5/serial/include/ -IlnInclude -I. -I/home/gx/OpenFOAM/OpenFOAM-2.4.x/src/OpenFOAM/lnInclude -I/home/gx/OpenFOAM/OpenFOAM-2.4.x/src/OSspecific/POSIX/lnInclude -fPIC -c $SOURCE -o Make/linux64GccDPOpt/windPlantSolver.o In file included from windPlantSolver.C:63:0: /home/gx/SOWFA/src/turbineModels/turbineModelsOpenFAST/lnInclude/horizontalAxisWindTurbinesALMOpenFAST.H:68:10: fatal error: OpenFAST.H: No such file or directory
^~~~~~~~~~~~
compilation terminated. windPlantSolver.dep:724: recipe for target 'Make/linux64GccDPOpt/windPlantSolver.o' failed make: *** [Make/linux64GccDPOpt/windPlantSolver.o] Error 1
So I would like to ask, how to solve this problem
Hi, I'm having an issue getting the OpenFAST solvers in SOWFA to compile. I'm running ubuntu 18.04 and OpenFOAM-2.4.0.
The error I'm getting on the OpenFAST solvers is:
In file included from /home/callum/OpenFAST/openfast/install/include/OpenFAST.H:20:0, from /home/callum/OpenFOAM/callum-2.4.0/SOWFA/src/turbineModels/turbineModelsOpenFAST/lnInclude/horizontalAxisWindTurbinesALMOpenFAST.H:68, from pisoFoamTurbine.C:38: /home/callum/OpenFAST/openfast/install/include/SC.h:5:10: fatal error: hdf5.h: No such file or directory
include "hdf5.h"
compilation terminated. pisoFoamTurbine.dep:759: recipe for target 'Make/linux64GccDPOpt/pisoFoamTurbine.o' failed make: *** [Make/linux64GccDPOpt/pisoFoamTurbine.o] Error 1
I have tryed:
setting the variable $HDF5_DIR to /usr/include/hdf5/serial and also added the same location to the variable $LD_LIBRARY_PATH
linked folder hdf5 to my OpenFAST location ~/OpenFAST/openfast/install/include (resetting the above variables to match)
I'd appreciate any help.
Cheers Callum