How can I add netCDF support during cmake mfix solver

I try to add netCDF support in my mfix solver, and my netcdf was built from source. But, there is a error just like:


Since netCDF is compiled by python. However, I DO NOT how to add python lib in my cmake.

@mark.meredith have you tried building with netCDF?

@luyuan
On Ubuntu, you should install apt install libnetcdf-dev libnetcdff-dev since those packages provide netCDFConfig.cmake:
Ubuntu – Package Contents Search Results -- netCDFConfig.cmake

This should be better documented; I’ll add a note about NetCDF in the user manual.

Also, only -DENABLE_NETCDF=ON is required. The other CMake options in your screenshot are using are not needed and have not effect when building MFIX.

Thanks for your suggestion. I install the lib as you told, but there is another problem:

Is it a bug? Or, setup error?

You should use -DENABLE_NETCDF=1 ( not -DENABLE-NETCDF=1).

Delete your build/ directory and try again.

It is not necessary to build with sudo.

I changed the command as you told, but the error wasn’t change.
In my computer, I install both mfix-gui and mfix-source-build. And, I can use netcdf function in GUI, but fail in source-building.
I think the error may cause by conda-GUI.

If you want to build a solver with NetCDF support, build with cmake (like you have above) with the source tarball. (Don’t build with NetCDF with the GUI).

Try building from the tarball, without a conda environment activated.