git: 50bbd0a5727b - main - science/bout++: New port: Plasma fluid finite-difference simulation code

From: Yuri Victorovich <yuri_at_FreeBSD.org>
Date: Sat, 24 Dec 2022 11:06:25 UTC
The branch main has been updated by yuri:

URL: https://cgit.FreeBSD.org/ports/commit/?id=50bbd0a5727b5fce864681796afba3c47aee70e7

commit 50bbd0a5727b5fce864681796afba3c47aee70e7
Author:     Yuri Victorovich <yuri@FreeBSD.org>
AuthorDate: 2022-12-24 08:53:22 +0000
Commit:     Yuri Victorovich <yuri@FreeBSD.org>
CommitDate: 2022-12-24 11:06:21 +0000

    science/bout++: New port: Plasma fluid finite-difference simulation code
---
 science/Makefile                                   |   1 +
 science/bout++/Makefile                            | 110 +++++++++++++++
 science/bout++/distinfo                            |  13 ++
 science/bout++/files/patch-CMakeLists.txt          |  20 +++
 science/bout++/files/patch-include_datafile.hxx    |  13 ++
 science/bout++/files/patch-include_options.hxx     |  13 ++
 ...ver_impls_adams__bashforth_adams__bashforth.cxx |  11 ++
 science/bout++/pkg-descr                           |   5 +
 science/bout++/pkg-plist                           | 152 +++++++++++++++++++++
 9 files changed, 338 insertions(+)

diff --git a/science/Makefile b/science/Makefile
index 60c62f11692a..7192941683d6 100644
--- a/science/Makefile
+++ b/science/Makefile
@@ -38,6 +38,7 @@
     SUBDIR += bddsolve
     SUBDIR += berkeleygw
     SUBDIR += bodr
+    SUBDIR += bout++
     SUBDIR += buddy
     SUBDIR += cantera
     SUBDIR += cardioid
diff --git a/science/bout++/Makefile b/science/bout++/Makefile
new file mode 100644
index 000000000000..c1f24e366579
--- /dev/null
+++ b/science/bout++/Makefile
@@ -0,0 +1,110 @@
+PORTNAME=	bout++
+DISTVERSIONPREFIX=	v
+DISTVERSION=	4.4.2
+CATEGORIES=	science math # physics
+
+MAINTAINER=	yuri@FreeBSD.org
+COMMENT=	Plasma fluid finite-difference simulation code
+WWW=		https://boutproject.github.io/
+
+LICENSE=	GPLv3
+LICENSE_FILE=	${WRKSRC}/LICENSE
+
+BUILD_DEPENDS=	gmake:devel/gmake
+LIB_DEPENDS=	libfftw3.so:math/fftw3 \
+		libopenblas.so:math/openblas \
+		libuuid.so:misc/e2fsprogs-libuuid
+RUN_DEPENDS=	bash:shells/bash
+
+USES=		cmake:testing python:3.6+ gettext-runtime shebangfix
+USE_LDCONFIG=	yes
+
+USE_GITHUB=	yes
+GH_ACCOUNT=	boutproject
+GH_PROJECT=	BOUT-dev
+GH_TUPLE=	boutproject:boutdata:3a66e6c:boutdata/externalpackages/boutdata \
+		boutproject:boututils:a79a00a:boututils/externalpackages/boututils \
+		google:googletest:96f4ce0:googletest/externalpackages/googletest \
+		meitar:git-archive-all.sh:fc86194:git_archive_all_sh/externalpackages/git-archive-all.sh \
+		mpark:variant:0b488da:variant/externalpackages/mpark.variant
+
+SHEBANG_GLOB=	*.sh
+SHEBANG_FILES=	bin/bout-boutdata-restart-create \
+		bin/bout-pylib-cmd-to-bin \
+		bin/bout-sonnet \
+		bin/bout-stop-script \
+		bin/bout_3to4.py \
+		bin/bout_4to5
+
+CMAKE_ON=	BUILD_SHARED_LIBS
+CMAKE_OFF=	BOUT_TESTS
+CMAKE_TESTING_ON=	BOUT_TESTS # tests fail to build, see https://github.com/boutproject/BOUT-dev/issues/2618
+
+CXXFLAGS+=	-I${WRKSRC}/include
+LDFLAGS+=	-lexecinfo
+
+OPTIONS_DEFINE=		OPENMP PETSC SLEPC SUNDIALS
+OPTIONS_MULTI=		FORMAT
+OPTIONS_MULTI_FORMAT=	HDF5 NETCDF
+OPTIONS_SINGLE=		MPI
+OPTIONS_SINGLE_MPI=	MPICH OPENMPI
+OPTIONS_DEFAULT=	MPICH NETCDF PETSC SLEPC
+
+FORMAT_DESC=		File format support
+
+HDF5_CMAKE_BOOL=	BOUT_USE_HDF5
+HDF5_LIB_DEPENDS=	libhdf5.so:science/hdf5
+
+NETCDF_USES=		localbase:ldflags pkgconfig # because of the cmake patch in files/
+NETCDF_CMAKE_BOOL=	BOUT_USE_NETCDF
+NETCDF_LIB_DEPENDS=	libnetcdf_c++4.so:science/netcdf-cxx \
+			libnetcdf.so:science/netcdf
+
+MPICH_USES=		mpi:mpich
+
+OPENMP_CMAKE_BOOL=	BOUT_ENABLE_OPENMP
+OPRNMP_BROKEN=		SEGV when OpenMP is enabled, see https://github.com/boutproject/BOUT-dev/issues/2620
+
+OPENMPI_USES=		mpi:openmpi
+
+PETSC_CMAKE_BOOL=	BOUT_USE_PETSC
+
+PETSC_DESC=		Build with PETSc support
+PETSC_CMAKE_BOOL=	BOUT_USE_PETSC
+PETSC_LIB_DEPENDS=	libpetsc.so:science/PETSc
+
+SLEPC_DESC=		Build with SLEPc support
+SLEPC_CMAKE_BOOL=	BOUT_USE_SLEPC
+SLEPC_LIB_DEPENDS=	libslepc.so:math/slepc
+SLEPC_IMPLIES=		PETSC # build breaks w/out petsc
+
+SUNDIALS_DESC=		Build with Sundials support
+SUNDIALS_CMAKE_BOOL=	BOUT_USE_SUNDIALS
+SUNDIALS_CMAKE_ON=	-DBOUT_DOWNLOAD_SUNDIALS=OFF
+SUNDIALS_BROKEN=	fails to build with sundials, see https://github.com/boutproject/BOUT-dev/issues/2617
+
+BINARY_ALIAS=		make=${GMAKE}
+
+.if defined(WITH_EXAMPLES) # Build executables demonstrating BOUT++ capabilities. They aren't installed and don't need to be built for packaging.
+CMAKE_ON+=	BOUT_BUILD_EXAMPLES
+.endif
+
+post-install:
+	# workaround for /usr/local/lib/cmake/bout++/bout++Config.cmake:if
+	@${REINPLACE_CMD} -i '' \
+		-e 's|${BUILD_WRKSRC}/externalpackages/mpark.variant|${PREFIX}/lib/cmake/mpark_variant|' \
+		-e 's|${BUILD_WRKSRC}/externalpackages/PVODE|${PREFIX}/lib/cmake/PVODE|' \
+		-e 's|${WRKSRC}/cmake|${PREFIX}/lib/cmake/bout++|' \
+		${STAGEDIR}${PREFIX}/lib/cmake/bout++/bout++Config.cmake
+	# remove *.orig files created by patching
+	@${RM} ${STAGEDIR}${PREFIX}/include/*.orig
+	# install missing PVODE cmake files
+	@${RM} ${STAGEDIR}${PREFIX}/lib/cmake/PVODE/*
+	${INSTALL_DATA} ${BUILD_WRKSRC}/externalpackages/PVODE/PVODEConfig.cmake ${STAGEDIR}${PREFIX}/lib/cmake/PVODE
+	${INSTALL_DATA} ${BUILD_WRKSRC}/externalpackages/PVODE/PVODEConfigVersion.cmake ${STAGEDIR}${PREFIX}/lib/cmake/PVODE
+	@${REINPLACE_CMD} -i '' \
+		-e 's|${BUILD_WRKSRC}/lib|${PREFIX}/lib|' \
+		-e 's|${PORTSDIR}/.*/BOUT-dev-${PORTVERSION}/externalpackages/PVODE/include|${PREFIX}/include|g' \
+		${STAGEDIR}${PREFIX}/lib/cmake/PVODE/*
+
+.include <bsd.port.mk>
diff --git a/science/bout++/distinfo b/science/bout++/distinfo
new file mode 100644
index 000000000000..9b13b34d7483
--- /dev/null
+++ b/science/bout++/distinfo
@@ -0,0 +1,13 @@
+TIMESTAMP = 1671818294
+SHA256 (boutproject-BOUT-dev-v4.4.2_GH0.tar.gz) = 0ae02f353f936a2838f6c5088d1706eb0fbf668e702d2e2d5c5f7c472c6827ba
+SIZE (boutproject-BOUT-dev-v4.4.2_GH0.tar.gz) = 17341124
+SHA256 (boutproject-boutdata-3a66e6c_GH0.tar.gz) = a52faa54547a61603b738558ddbd7431eef2795d8be118097e998f27f4566242
+SIZE (boutproject-boutdata-3a66e6c_GH0.tar.gz) = 65076
+SHA256 (boutproject-boututils-a79a00a_GH0.tar.gz) = ab3c925995dc1709e00b9d6098256841b633bb3f55374a56c63d9918f6930e11
+SIZE (boutproject-boututils-a79a00a_GH0.tar.gz) = 59415
+SHA256 (google-googletest-96f4ce0_GH0.tar.gz) = 5d4ca5c67886183e4a6917dc0e35b31d7b8454495db39fad43c6a9a298ebab37
+SIZE (google-googletest-96f4ce0_GH0.tar.gz) = 888310
+SHA256 (meitar-git-archive-all.sh-fc86194_GH0.tar.gz) = cf07813444e441fcfbd6a78ad11228880bc2c2f12ce72b312872d9d7c3c341de
+SIZE (meitar-git-archive-all.sh-fc86194_GH0.tar.gz) = 4033
+SHA256 (mpark-variant-0b488da_GH0.tar.gz) = 81f8e07d3a500689358400e7347168f39c14d3b944c3181d76c25ae7c838fd96
+SIZE (mpark-variant-0b488da_GH0.tar.gz) = 33435
diff --git a/science/bout++/files/patch-CMakeLists.txt b/science/bout++/files/patch-CMakeLists.txt
new file mode 100644
index 000000000000..3f028df02480
--- /dev/null
+++ b/science/bout++/files/patch-CMakeLists.txt
@@ -0,0 +1,20 @@
+- workaround for: find_package(netCDFCxx REQUIRED) fails to find it because netcdf-cxx is built w/out cmake support
+
+--- CMakeLists.txt.orig	2022-03-03 17:36:51 UTC
++++ CMakeLists.txt
+@@ -556,10 +556,12 @@ if (BOUT_USE_NETCDF)
+     find_package(netCDF REQUIRED)
+     FetchContent_MakeAvailable(netcdf-cxx4)
+   else()
+-    find_package(netCDFCxx REQUIRED)
+-    set(CONFIG_LDFLAGS "${CONFIG_LDFLAGS} ${netCDF_CXX_LIBRARY} ${netCDF_LIBRARIES}")
++    find_package(PkgConfig REQUIRED)
++    #find_package(netCDFCxx REQUIRED)
++    pkg_check_modules(NETCDF REQUIRED IMPORTED_TARGET netcdf-cxx4)
++    set(CONFIG_LDFLAGS "${CONFIG_LDFLAGS} ${netCDF_CXX_LIBRARY} ${NETCDF_LDFLAGS}")
+   endif()
+-  target_link_libraries(bout++ PUBLIC netCDF::netcdf-cxx4)
++  target_link_libraries(bout++ PUBLIC ${NETCDF_LDFLAGS})
+   target_compile_definitions(bout++
+     PUBLIC "NCDF4"
+     PUBLIC "BOUT_HAS_NETCDF")
diff --git a/science/bout++/files/patch-include_datafile.hxx b/science/bout++/files/patch-include_datafile.hxx
new file mode 100644
index 000000000000..c36741c75ca6
--- /dev/null
+++ b/science/bout++/files/patch-include_datafile.hxx
@@ -0,0 +1,13 @@
+- workaround for https://github.com/boutproject/BOUT-dev/issues/2621
+
+--- include/datafile.hxx.orig	2022-12-24 02:25:29 UTC
++++ include/datafile.hxx
+@@ -18,7 +18,7 @@ class Datafile;
+ #include "bout/macro_for_each.hxx"
+ 
+ #include "dataformat.hxx"
+-#include "../src/fileio/impls/hdf5/h5_format.hxx"
++//#include "../src/fileio/impls/hdf5/h5_format.hxx"
+ #include "bout/format.hxx"
+ 
+ #include <cstdarg>
diff --git a/science/bout++/files/patch-include_options.hxx b/science/bout++/files/patch-include_options.hxx
new file mode 100644
index 000000000000..d7fd9a951633
--- /dev/null
+++ b/science/bout++/files/patch-include_options.hxx
@@ -0,0 +1,13 @@
+- workaround for clang++ failure, see https://github.com/llvm/llvm-project/issues/59683
+
+--- include/options.hxx.orig	2022-12-23 21:59:09 UTC
++++ include/options.hxx
+@@ -198,7 +198,7 @@ class Options { (public)
+     /// Copy constructor
+     AttributeType(const AttributeType& other) = default;
+     /// Move constructor
+-    AttributeType(AttributeType&& other) : Base(std::move(other)) {}
++    AttributeType(AttributeType& other) : Base(std::move(other)) {}
+ 
+     /// Destructor
+     ~AttributeType() = default;
diff --git a/science/bout++/files/patch-src_solver_impls_adams__bashforth_adams__bashforth.cxx b/science/bout++/files/patch-src_solver_impls_adams__bashforth_adams__bashforth.cxx
new file mode 100644
index 000000000000..217525ddbc72
--- /dev/null
+++ b/science/bout++/files/patch-src_solver_impls_adams__bashforth_adams__bashforth.cxx
@@ -0,0 +1,11 @@
+--- src/solver/impls/adams_bashforth/adams_bashforth.cxx.orig	2022-12-23 20:47:59 UTC
++++ src/solver/impls/adams_bashforth/adams_bashforth.cxx
+@@ -7,6 +7,8 @@
+ 
+ #include <output.hxx>
+ 
++#include <array>
++
+ namespace {
+ BoutReal lagrange_at_position_denominator(const std::deque<BoutReal>& grid,
+                                           const int position, const int order) {
diff --git a/science/bout++/pkg-descr b/science/bout++/pkg-descr
new file mode 100644
index 000000000000..6536232114da
--- /dev/null
+++ b/science/bout++/pkg-descr
@@ -0,0 +1,5 @@
+BOUT++ is a framework for writing fluid and plasma simulations in curvilinear
+geometry. It is intended to be quite modular, with a variety of numerical
+methods and time-integration solvers available. BOUT++ is primarily designed
+and tested with reduced plasma fluid models in mind, but it can evolve any
+number of equations, with equations appearing in a readable form.
diff --git a/science/bout++/pkg-plist b/science/bout++/pkg-plist
new file mode 100644
index 000000000000..15e6c7224646
--- /dev/null
+++ b/science/bout++/pkg-plist
@@ -0,0 +1,152 @@
+bin/bout-archive-helper.sh
+bin/bout-boutdata-restart-create
+bin/bout-config
+bin/bout-config.in
+bin/bout-log-color
+bin/bout-pylib-cmd-to-bin
+bin/bout-sonnet
+bin/bout-squashoutput
+bin/bout-stop-script
+bin/bout_3to4.py
+bin/bout_4to5
+bin/bout_4to5_header_file_list
+include/boundary_factory.hxx
+include/boundary_op.hxx
+include/boundary_region.hxx
+include/boundary_standard.hxx
+include/bout.hxx
+include/bout/array.hxx
+include/bout/assert.hxx
+include/bout/bout_enum_class.hxx
+include/bout/constants.hxx
+include/bout/coordinates.hxx
+include/bout/deprecated.hxx
+include/bout/deriv_store.hxx
+include/bout/expr.hxx
+include/bout/field_visitor.hxx
+include/bout/fieldgroup.hxx
+include/bout/format.hxx
+include/bout/fv_ops.hxx
+include/bout/generic_factory.hxx
+include/bout/globalfield.hxx
+include/bout/griddata.hxx
+include/bout/index_derivs.hxx
+include/bout/index_derivs_interface.hxx
+include/bout/invert/laplacexy.hxx
+include/bout/invert/laplacexz.hxx
+include/bout/invertable_operator.hxx
+include/bout/macro_for_each.hxx
+include/bout/mesh.hxx
+include/bout/monitor.hxx
+include/bout/openmpwrap.hxx
+include/bout/paralleltransform.hxx
+include/bout/petsclib.hxx
+include/bout/physicsmodel.hxx
+include/bout/region.hxx
+include/bout/rkscheme.hxx
+include/bout/rvec.hxx
+include/bout/scorepwrapper.hxx
+include/bout/slepclib.hxx
+include/bout/snb.hxx
+include/bout/solver.hxx
+include/bout/solverfactory.hxx
+include/bout/surfaceiter.hxx
+include/bout/sys/expressionparser.hxx
+include/bout/sys/gettext.hxx
+include/bout/sys/range.hxx
+include/bout/sys/timer.hxx
+include/bout/sys/type_name.hxx
+include/bout/sys/uncopyable.hxx
+include/bout/sys/uuid.h
+include/bout/sys/variant.hxx
+include/bout/template_combinations.hxx
+include/bout/traits.hxx
+include/bout_types.hxx
+include/boutcomm.hxx
+include/boutconfig/__init__.py
+include/boutexception.hxx
+include/boutmain.hxx
+include/cyclic_reduction.hxx
+include/datafile.hxx
+include/dataformat.hxx
+include/dcomplex.hxx
+include/derivs.hxx
+include/difops.hxx
+include/fft.hxx
+include/field.hxx
+include/field2d.hxx
+include/field3d.hxx
+include/field_data.hxx
+include/field_factory.hxx
+include/fieldperp.hxx
+include/globals.hxx
+include/gyro_average.hxx
+include/initialprofiles.hxx
+include/interpolation.hxx
+include/interpolation_factory.hxx
+include/invert_laplace.hxx
+include/invert_parderiv.hxx
+include/lapack_routines.hxx
+include/mask.hxx
+include/mpark/config.hpp
+include/mpark/in_place.hpp
+include/mpark/lib.hpp
+include/mpark/variant.hpp
+include/msg_stack.hxx
+include/multiostream.hxx
+include/options.hxx
+include/options_netcdf.hxx
+include/optionsreader.hxx
+include/output.hxx
+include/parallel_boundary_op.hxx
+include/parallel_boundary_region.hxx
+include/pvode/band.h
+include/pvode/cvdiag.h
+include/pvode/cvode.h
+include/pvode/cvspgmr.h
+include/pvode/iterativ.h
+include/pvode/llnlmath.h
+include/pvode/llnltyps.h
+include/pvode/nvector.h
+include/pvode/pvbbdpre.h
+include/pvode/smalldense.h
+include/pvode/spgmr.h
+include/pvode/vector.h
+include/smoothing.hxx
+include/sourcex.hxx
+include/stencils.hxx
+include/unused.hxx
+include/utils.hxx
+include/vecops.hxx
+include/vector2d.hxx
+include/vector3d.hxx
+include/where.hxx
+lib/cmake/PVODE/PVODEConfig.cmake
+lib/cmake/PVODE/PVODEConfigVersion.cmake
+lib/cmake/bout++/BOUT++functions.cmake
+lib/cmake/bout++/CorrectWindowsPaths.cmake
+lib/cmake/bout++/FindClangFormat.cmake
+lib/cmake/bout++/FindFFTW.cmake
+lib/cmake/bout++/FindLibuuid.cmake
+lib/cmake/bout++/FindPETSc.cmake
+lib/cmake/bout++/FindPackageMultipass.cmake
+lib/cmake/bout++/FindSLEPc.cmake
+lib/cmake/bout++/FindSUNDIALS.cmake
+lib/cmake/bout++/FindScoreP.cmake
+lib/cmake/bout++/FindSphinx.cmake
+lib/cmake/bout++/FindnetCDF.cmake
+lib/cmake/bout++/FindnetCDFCxx.cmake
+lib/cmake/bout++/ResolveCompilerPaths.cmake
+lib/cmake/bout++/bout++Config.cmake
+lib/cmake/bout++/bout++ConfigVersion.cmake
+lib/cmake/bout++/bout++Targets-%%CMAKE_BUILD_TYPE%%.cmake
+lib/cmake/bout++/bout++Targets.cmake
+lib/cmake/mpark_variant/mpark_variant-config-version.cmake
+lib/cmake/mpark_variant/mpark_variant-config.cmake
+lib/cmake/mpark_variant/mpark_variant-targets.cmake
+lib/libbout++.so
+lib/libbout++.so.4.4.0
+lib/libpvode.so
+lib/libpvode.so.1.0.0
+lib/libpvpre.so
+lib/libpvpre.so.1.0.0