Skip to content

Commit

Permalink
Merge branch 'next' into hermes3-temp
Browse files Browse the repository at this point in the history
  • Loading branch information
bendudson committed Jul 5, 2024
2 parents 30a93f7 + 20b47f4 commit d7f8807
Show file tree
Hide file tree
Showing 243 changed files with 3,009 additions and 2,882 deletions.
2 changes: 1 addition & 1 deletion .ci_fedora.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ then
cp -a /tmp/BOUT-dev /home/test/
chown -R test /home/test
chmod u+rwX /home/test -R
sudo -u test ${0/\/tmp/\/home\/test} $mpi
su - test -c "${0/\/tmp/\/home\/test} $mpi"
## If we are called as normal user, run test
else
. /etc/profile.d/modules.sh
Expand Down
2 changes: 2 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@ SpacesInParentheses: false
SpacesInSquareBrackets: false
StatementMacros:
- BOUT_OMP
- BOUT_OMP_PERF
- BOUT_OMP_SAFE
Standard: c++14
TabWidth: 8
UseTab: Never
3 changes: 1 addition & 2 deletions .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,14 @@
Checks: 'clang-diagnostic-*,clang-analyzer-*,performance-*,readability-*,bugprone-*,clang-analyzer-*,cppcoreguidelines-*,mpi-*,misc-*,-readability-magic-numbers,-cppcoreguidelines-avoid-magic-numbers,-misc-non-private-member-variables-in-classes,-clang-analyzer-optin.mpi*,-bugprone-exception-escape,-cppcoreguidelines-pro-bounds-pointer-arithmetic,-readability-function-cognitive-complexity,-misc-no-recursion,-bugprone-easily-swappable-parameters'
WarningsAsErrors: ''
HeaderFilterRegex: ''
AnalyzeTemporaryDtors: false
FormatStyle: file
CheckOptions:

# Allow some common short names
- key: readability-identifier-length.IgnoredVariableNames
value: '^[dn]?[xyz]$'
- key: readability-identifier-length.IgnoredParameterNames
value: '^[fijkxyz][01xyz]?$'
value: '^[dfijknxyz][01xyz]?$'
- key: readability-identifier-length.IgnoredLoopCounterNames
value: '^[ijkxyz_]$'

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
is_cron:
- ${{ github.event_name == 'cron' }}
config:
- name: "CMake, PETSc unreleased, ADIOS"
- name: "CMake, PETSc unreleased, ADIOS2"
os: ubuntu-20.04
cmake_options: "-DBUILD_SHARED_LIBS=ON
-DBOUT_ENABLE_METRIC_3D=ON
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -85,3 +85,5 @@ coverage/
/_version.txt
/BOUT++-v*.tar.gz
/BOUT++-v*.tar.xz
/CMakeCache.txt
/CMakeFiles/cmake.check_cache
6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ else()
set(BOUT_GENERATE_FIELDOPS_DEFAULT OFF)
endif()

execute_process(COMMAND ${Python3_EXECUTABLE} -c "import zoidberg"
execute_process(COMMAND ${Python3_EXECUTABLE} -c "import importlib.util ; import sys; sys.exit(importlib.util.find_spec(\"zoidberg\") is None)"
RESULT_VARIABLE zoidberg_FOUND)
if (zoidberg_FOUND EQUAL 0)
set(zoidberg_FOUND ON)
Expand Down Expand Up @@ -774,7 +774,7 @@ set(BOUT_HAS_PNETCDF OFF)
# while for static builds we need the dependencies too
if (BUILD_SHARED_LIBS)
# Include rpath linker flag so user doesn't need to set LD_LIBRARY_PATH
set(CONFIG_LDFLAGS "${CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG}\$BOUT_LIB_PATH -L\$BOUT_LIB_PATH -lbout++ -lfmt")
set(CONFIG_LDFLAGS "${CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG}\$BOUT_LIB_PATH -L\$BOUT_LIB_PATH -lbout++ -lfmt ${CONFIG_LDFLAGS_SHARED}")
else()
set(CONFIG_LDFLAGS "${CONFIG_LDFLAGS}")
endif()
Expand Down Expand Up @@ -935,7 +935,7 @@ message("
SUNDIALS support : ${BOUT_HAS_SUNDIALS}
HYPRE support : ${BOUT_HAS_HYPRE}
NetCDF support : ${BOUT_HAS_NETCDF}
ADIOS support : ${BOUT_HAS_ADIOS}
ADIOS2 support : ${BOUT_HAS_ADIOS2}
FFTW support : ${BOUT_HAS_FFTW}
LAPACK support : ${BOUT_HAS_LAPACK}
OpenMP support : ${BOUT_USE_OPENMP}
Expand Down
14 changes: 7 additions & 7 deletions bin/bout-build-deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ netcdf() {

nccxx() {
cd $BUILD
wget -c ftp://ftp.unidata.ucar.edu/pub/netcdf/netcdf-cxx4-$NCCXXVER.tar.gz || :
wget -c https://downloads.unidata.ucar.edu/netcdf-cxx/$NCCXXVER/netcdf-cxx4-$NCCXXVER.tar.gz || :
tar -xf netcdf-cxx4-$NCCXXVER.tar.gz
cd netcdf-cxx4-$NCCXXVER
CPPFLAGS="-I$PREFIX/include" LDFLAGS="-L$PREFIX/lib/" ./configure --prefix=$PREFIX $NCCXXFLAGS
Expand Down Expand Up @@ -286,17 +286,17 @@ set -x
## Setup folders and links
setup
## Build and install hdf5
hdf5
test $NO_HDF5 || hdf5
## Build and install netcdf
netcdf
test $NO_NETCDF || netcdf
## Build and install C++ interface for netcdf
nccxx
test $NO_NCXX || nccxx
## Build and install FFTW
fftw
test $NO_FFTW || fftw
## Build and install Sundials
sundials
test $NO_SUNDIALS || sundials
## Build and install PETSc
petsc
test $NO_PETSC || petsc
## Download BOUT++ submodules
submod
# Install python packages
Expand Down
25 changes: 13 additions & 12 deletions bin/bout-config.in
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ idlpath="@IDLCONFIGPATH@"
pythonpath="@PYTHONCONFIGPATH@"

has_netcdf="@BOUT_HAS_NETCDF@"
has_adios="@BOUT_HAS_ADIOS@"
has_adios2="@BOUT_HAS_ADIOS2@"
has_legacy_netcdf="@BOUT_HAS_LEGACY_NETCDF@"
has_pnetcdf="@BOUT_HAS_PNETCDF@"
has_pvode="@BOUT_HAS_PVODE@"
Expand Down Expand Up @@ -71,18 +71,18 @@ Available values for OPTION include:
--idl IDL path
--python Python path
--has-netcdf NetCDF file support
--has-adios ADIOS file support
--has-netcdf NetCDF file support
--has-adios2 ADIOS2 file support
--has-legacy-netcdf Legacy NetCDF file support
--has-pnetcdf Parallel NetCDF file support
--has-pvode PVODE solver support
--has-cvode SUNDIALS CVODE solver support
--has-ida SUNDIALS IDA solver support
--has-lapack LAPACK support
--has-petsc PETSc support
--has-hypre Hypre support
--has-slepc SLEPc support
--has-nls Natural Language Support
--has-pnetcdf Parallel NetCDF file support
--has-pvode PVODE solver support
--has-cvode SUNDIALS CVODE solver support
--has-ida SUNDIALS IDA solver support
--has-lapack LAPACK support
--has-petsc PETSc support
--has-hypre Hypre support
--has-slepc SLEPc support
--has-nls Natural Language Support
--petsc-has-sundials
Expand Down Expand Up @@ -123,6 +123,7 @@ all()
echo " --has-slepc -> $has_slepc"
echo " --has-arkode -> $has_arkode"
echo " --has-nls -> $has_nls"
echo " --has-openmp -> $has_openmp"
echo
echo " --petsc-has-sundials -> $petsc_has_sundials"
echo
Expand Down
2 changes: 1 addition & 1 deletion bout++Config.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ set(BOUT_USE_METRIC_3D @BOUT_USE_METRIC_3D@)

set(BOUT_HAS_PVODE @BOUT_HAS_PVODE@)
set(BOUT_HAS_NETCDF @BOUT_HAS_NETCDF@)
set(BOUT_HAS_ADIOS @BOUT_HAS_ADIOS@)
set(BOUT_HAS_ADIOS2 @BOUT_HAS_ADIOS2@)
set(BOUT_HAS_FFTW @BOUT_HAS_FFTW@)
set(BOUT_HAS_LAPACK @BOUT_HAS_LAPACK@)
set(BOUT_HAS_PETSC @BOUT_HAS_PETSC@)
Expand Down
2 changes: 1 addition & 1 deletion cmake/FindCython.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# CYTHON_FOUND - true if Cython was found
# CYTHON_VERSION - Cython version

execute_process(COMMAND ${Python_EXECUTABLE} -c "import cython ; print(cython.__version__)"
execute_process(COMMAND ${Python3_EXECUTABLE} -c "import cython ; print(cython.__version__)"
RESULT_VARIABLE _cython_runs
OUTPUT_VARIABLE CYTHON_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE
Expand Down
14 changes: 7 additions & 7 deletions cmake/FindNumpy.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -12,32 +12,32 @@
# Numpy_INCLUDE_DIR


find_package(Python 3.6 COMPONENTS Interpreter Development)
find_package(Python3 3.6 COMPONENTS Interpreter Development)

if (NOT Python_FOUND)
if (NOT Python3_FOUND)
message(STATUS "Could not find numpy as python was not found. Maybe the developement package is missing?")
set(Numpy_FOUND ${Python_FOUND})
set(Numpy_FOUND ${Python3_FOUND})
return()
endif()

if (NOT Numpy_FOUND)
execute_process(COMMAND ${Python_EXECUTABLE} -c "import numpy ; print(numpy.__version__)"
execute_process(COMMAND ${Python3_EXECUTABLE} -c "import numpy ; print(numpy.__version__)"
OUTPUT_STRIP_TRAILING_WHITESPACE
OUTPUT_VARIABLE Numpy_VERSION
)
execute_process(COMMAND ${Python_EXECUTABLE} -c "import numpy ; print(numpy.get_include())"
execute_process(COMMAND ${Python3_EXECUTABLE} -c "import numpy ; print(numpy.get_include())"
OUTPUT_STRIP_TRAILING_WHITESPACE
OUTPUT_VARIABLE _numpy_include_dirs
)
endif()

if (Numpy_DEBUG)
message(STATUS "Looking for numpy headers in: ${_numpy_include_dirs} ${PYTHON_INCLUDE_DIR}")
message(STATUS "Looking for numpy headers in: ${_numpy_include_dirs} ${Python3_INCLUDE_DIRS}")
endif()

find_path(Numpy_INCLUDE_DIR
numpy/arrayobject.h
PATHS "${_numpy_include_dirs}" "${PYTHON_INCLUDE_DIR}"
PATHS "${_numpy_include_dirs}" "${Python3_INCLUDE_DIRS}"
PATH_SUFFIXES numpy/core/include
)

Expand Down
12 changes: 2 additions & 10 deletions cmake/FindSUNDIALS.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -104,16 +104,8 @@ endforeach()

if (SUNDIALS_INCLUDE_DIR)
file(READ "${SUNDIALS_INCLUDE_DIR}/sundials_config.h" SUNDIALS_CONFIG_FILE)
string(FIND "${SUNDIALS_CONFIG_FILE}" "SUNDIALS_PACKAGE_VERSION" index)
if("${index}" LESS 0)
# Version >3
set(SUNDIALS_VERSION_REGEX_PATTERN
".*#define SUNDIALS_VERSION \"([0-9]+)\\.([0-9]+)\\.([0-9]+)\".*")
else()
# Version <3
set(SUNDIALS_VERSION_REGEX_PATTERN
".*#define SUNDIALS_PACKAGE_VERSION \"([0-9]+)\\.([0-9]+)\\.([0-9]+)\".*")
endif()
set(SUNDIALS_VERSION_REGEX_PATTERN
".*#define SUNDIALS_VERSION \"([0-9]+)\\.([0-9]+)\\.([0-9]+)\".*")
string(REGEX MATCH ${SUNDIALS_VERSION_REGEX_PATTERN} _ "${SUNDIALS_CONFIG_FILE}")
set(SUNDIALS_VERSION_MAJOR ${CMAKE_MATCH_1} CACHE STRING "")
set(SUNDIALS_VERSION_MINOR ${CMAKE_MATCH_2} CACHE STRING "")
Expand Down
25 changes: 16 additions & 9 deletions cmake/SetupBOUTThirdParty.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ endif ()
# determined in SetupCompilers.cmake
if (BOUT_USE_OPENMP)
target_link_libraries(bout++ PUBLIC OpenMP::OpenMP_CXX)
set(CONFIG_LDFLAGS "${CONFIG_LDFLAGS} -fopenmp")
set(CONFIG_LDFLAGS_SHARED "${CONFIG_LDFLAGS_SHARED} -fopenmp")
set(CONFIG_CFLAGS "${CONFIG_CFLAGS} -fopenmp")
endif()

# determined in SetupCompilers.cmake
Expand Down Expand Up @@ -187,10 +190,10 @@ endif()
message(STATUS "NetCDF support: ${BOUT_USE_NETCDF}")
set(BOUT_HAS_NETCDF ${BOUT_USE_NETCDF})

option(BOUT_USE_ADIOS "Enable support for ADIOS output" ON)
option(BOUT_DOWNLOAD_ADIOS "Download and build ADIOS2" OFF)
if (BOUT_USE_ADIOS)
if (BOUT_DOWNLOAD_ADIOS)
option(BOUT_USE_ADIOS2 "Enable support for ADIOS output" ON)
option(BOUT_DOWNLOAD_ADIOS2 "Download and build ADIOS2" OFF)
if (BOUT_USE_ADIOS2)
if (BOUT_DOWNLOAD_ADIOS2)
message(STATUS "Downloading and configuring ADIOS2")
include(FetchContent)
FetchContent_Declare(
Expand All @@ -217,12 +220,12 @@ if (BOUT_USE_ADIOS)
find_package(MPI REQUIRED COMPONENTS C)
target_link_libraries(bout++ PUBLIC adios2::cxx11_mpi MPI::MPI_C)
else()
set(BOUT_USE_ADIOS OFF)
set(BOUT_USE_ADIOS2 OFF)
endif()
endif()
endif()
message(STATUS "ADIOS support: ${BOUT_USE_ADIOS}")
set(BOUT_HAS_ADIOS ${BOUT_USE_ADIOS})
message(STATUS "ADIOS2 support: ${BOUT_USE_ADIOS2}")
set(BOUT_HAS_ADIOS2 ${BOUT_USE_ADIOS2})


option(BOUT_USE_FFTW "Enable support for FFTW" ON)
Expand Down Expand Up @@ -278,8 +281,8 @@ if (BOUT_USE_SUNDIALS)
include(FetchContent)
FetchContent_Declare(
sundials
GIT_REPOSITORY https://github.com/ZedThree/sundials
GIT_TAG cmake-export-fixes
GIT_REPOSITORY https://github.com/LLNL/sundials
GIT_TAG v7.0.0
)
# Note: These are settings for building SUNDIALS
set(EXAMPLES_ENABLE_C OFF CACHE BOOL "" FORCE)
Expand All @@ -294,7 +297,11 @@ if (BOUT_USE_SUNDIALS)
FetchContent_MakeAvailable(sundials)
message(STATUS "SUNDIALS done configuring")
else()
enable_language(C)
find_package(SUNDIALS REQUIRED)
if (SUNDIALS_VERSION VERSION_LESS 4.0.0)
message(FATAL_ERROR "SUNDIALS_VERSION 4.0.0 or newer is required. Found version ${SUNDIALS_VERSION}.")
endif()
endif()
target_link_libraries(bout++ PUBLIC SUNDIALS::nvecparallel)
target_link_libraries(bout++ PUBLIC SUNDIALS::cvode)
Expand Down
2 changes: 1 addition & 1 deletion cmake_build_defines.hxx.in
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#cmakedefine01 BOUT_HAS_IDA
#cmakedefine01 BOUT_HAS_LAPACK
#cmakedefine01 BOUT_HAS_NETCDF
#cmakedefine01 BOUT_HAS_ADIOS
#cmakedefine01 BOUT_HAS_ADIOS2
#cmakedefine01 BOUT_HAS_PETSC
#cmakedefine01 BOUT_HAS_PRETTY_FUNCTION
#cmakedefine01 BOUT_HAS_PVODE
Expand Down
1 change: 1 addition & 0 deletions examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ add_subdirectory(backtrace)
add_subdirectory(blob2d)
add_subdirectory(blob2d-outerloop)
add_subdirectory(blob2d-laplacexz)
add_subdirectory(boutpp)
add_subdirectory(boundary-conditions/advection)
add_subdirectory(conducting-wall-mode)
add_subdirectory(conduction)
Expand Down
2 changes: 0 additions & 2 deletions examples/blob2d/blob2d.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ class Blob2D : public PhysicsModel {
BoutReal rho_s; ///< Bohm gyro radius
BoutReal Omega_i; ///< Ion cyclotron frequency
BoutReal c_s; ///< Bohm sound speed
BoutReal n0; ///< Reference density

// Constants to calculate the parameters
BoutReal Te0; ///< Isothermal temperature [eV]
Expand Down Expand Up @@ -61,7 +60,6 @@ class Blob2D : public PhysicsModel {
m_i = options["m_i"].withDefault(2 * 1.667e-27);
m_e = options["m_e"].withDefault(9.11e-31);

n0 = options["n0"].doc("Background density in cubic m").withDefault(1e19);
D_vort = options["D_vort"].doc("Viscous diffusion coefficient").withDefault(0.0);
D_n = options["D_n"].doc("Density diffusion coefficient").withDefault(0.0);

Expand Down
2 changes: 0 additions & 2 deletions examples/blob2d/delta_0.25/BOUT.inp
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,6 @@ flags = 49152 # set_rhs i.e. identity matrix in boundaries

Te0 = 5 # Electron Temperature (eV)

n0 = 2e+18 # Background plasma density (m^-3)

compressible = false # Compressibility?

boussinesq = true # Boussinesq approximation (no perturbed n in vorticity)
Expand Down
2 changes: 0 additions & 2 deletions examples/blob2d/delta_1/BOUT.inp
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,6 @@ flags = 49152 # set_rhs i.e. identity matrix in boundaries

Te0 = 5 # Electron Temperature (eV)

n0 = 2e+18 # Background plasma density (m^-3)

compressible = false # Compressibility?

boussinesq = true # Boussinesq approximation (no perturbed n in vorticity)
Expand Down
2 changes: 0 additions & 2 deletions examples/blob2d/delta_10/BOUT.inp
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,6 @@ flags = 49152 # set_rhs i.e. identity matrix in boundaries

Te0 = 5 # Electron Temperature (eV)

n0 = 2e+18 # Background plasma density (m^-3)

compressible = false # Compressibility?

boussinesq = true # Boussinesq approximation (no perturbed n in vorticity)
Expand Down
10 changes: 10 additions & 0 deletions examples/boutpp/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
cmake_minimum_required(VERSION 3.13)

if (NOT TARGET bout++::bout++)
find_package(bout++ REQUIRED)
endif()

bout_copy_file(runexample)
bout_copy_file(blob2d.py)
bout_copy_file(simulation.py)
bout_copy_file(data/BOUT.inp)
Loading

0 comments on commit d7f8807

Please sign in to comment.