From b8cff5d7c6f5b2329367aa5213da09b67bf5f60f Mon Sep 17 00:00:00 2001 From: Jonathan Guyer Date: Fri, 2 Apr 2021 19:14:15 -0400 Subject: [PATCH 1/9] Document Gmsh partitioning --- fipy/meshes/gmshMesh.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/fipy/meshes/gmshMesh.py b/fipy/meshes/gmshMesh.py index fc3ff6c8d5..265c7634b8 100755 --- a/fipy/meshes/gmshMesh.py +++ b/fipy/meshes/gmshMesh.py @@ -1387,6 +1387,11 @@ def _localOverlappingCellIDs(self): class Gmsh2D(Mesh2D): """Construct a 2D Mesh using Gmsh + If called in parallel, mesh will be partitioned based on + `parallelComm.Nproc`. If an MSH file is supplied, it must have been + previously partitioned with the number of partitions matching + `parallelComm.Nproc`. + >>> radius = 5. >>> side = 4. >>> squaredCircle = Gmsh2D(''' @@ -1875,6 +1880,11 @@ def _test(self): class Gmsh2DIn3DSpace(Gmsh2D): """Create a topologically 2D Mesh in 3D coordinates using Gmsh + If called in parallel, mesh will be partitioned based on + `parallelComm.Nproc`. If an MSH file is supplied, it must have been + previously partitioned with the number of partitions matching + `parallelComm.Nproc`. + Parameters ---------- arg : str @@ -1959,6 +1969,11 @@ def _test(self): class Gmsh3D(Mesh): """Create a 3D Mesh using Gmsh + If called in parallel, mesh will be partitioned based on + `parallelComm.Nproc`. If an MSH file is supplied, it must have been + previously partitioned with the number of partitions matching + `parallelComm.Nproc`. + Parameters ---------- arg : str From de17f9e339f010e34030f484b9714f71c1694fcc Mon Sep 17 00:00:00 2001 From: Jonathan Guyer Date: Fri, 2 Apr 2021 19:20:14 -0400 Subject: [PATCH 2/9] Document gmsh optional with conda --- INSTALLATION.rst | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/INSTALLATION.rst b/INSTALLATION.rst index 03f3d95a2c..b29c0132ad 100644 --- a/INSTALLATION.rst +++ b/INSTALLATION.rst @@ -67,7 +67,7 @@ Recommended Method * `install Miniconda`_ on your computer * run:: - $ conda create --name --channel conda-forge python= fipy + $ conda create --name --channel conda-forge python= fipy gmsh .. note:: @@ -75,6 +75,9 @@ Recommended Method downloads and populates the environment with the prerequisites for :term:`FiPy` from the conda-forge_ channel at https://anaconda.org. + :term:`Gmsh` is an optional package because some versions are + incompatible with :term:`FiPy`, so it must be requested explicitly. + .. attention:: Windows x86_64 is fully supported, but this does not work on @@ -85,7 +88,7 @@ Recommended Method and for Python 3.x, you should be able to do:: - conda create --name --channel conda-forge python=3.6 numpy scipy matplotlib pysparse + conda create --name --channel conda-forge "python>3" numpy scipy matplotlib pysparse gmsh followed, for either, by:: From a21a9beea20e31916d751bdae957f304371c817a Mon Sep 17 00:00:00 2001 From: Jonathan Guyer Date: Fri, 2 Apr 2021 19:24:18 -0400 Subject: [PATCH 3/9] Relax constraints on gmsh installation --- .appveyor.yml | 2 +- .circleci/config.yml | 2 +- .travis.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index 4449b28bfe..9b64a6c4dc 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -77,7 +77,7 @@ install: # Configure the VM. - cmd: if "%TARGET_ARCH%" == "x64" if "%CONDA_PY%" == "27" conda.exe install --quiet --name root python=2.7 fipy - - cmd: if "%TARGET_ARCH%" == "x64" if "%CONDA_PY%" == "36" conda.exe install --quiet --name root python=3.6 fipy "gmsh<4.0" + - cmd: if "%TARGET_ARCH%" == "x64" if "%CONDA_PY%" == "36" conda.exe install --quiet --name root "python>3" fipy gmsh - cmd: conda.exe remove --quiet --force fipy # FIXME: fipy recipe on conda-forge doesn't have gmsh compatible with Python 2.7 - ps: | diff --git a/.circleci/config.yml b/.circleci/config.yml index c02914de20..d8af09228b 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -36,7 +36,7 @@ commands: - run: name: Create Conda Environment command: | - conda create -v --quiet --prefix << parameters.condaenv >> --show-channel-urls --channel conda-forge << parameters.packages >> "gmsh<4.0" + conda create -v --quiet --prefix << parameters.condaenv >> --show-channel-urls --channel conda-forge << parameters.packages >> gmsh source activate ~/project/<< parameters.condaenv >> conda remove --quiet --channel conda-forge --force fipy pip install scikit-fmm diff --git a/.travis.yml b/.travis.yml index 2d246a3007..aa69b740ed 100644 --- a/.travis.yml +++ b/.travis.yml @@ -45,7 +45,7 @@ before_install: - hash -r - conda config --set always_yes yes --set changeps1 no - conda update -q conda - - conda create --quiet --name test-environment --show-channel-urls --channel conda-forge python=$TRAVIS_PYTHON_VERSION fipy "gmsh<4.0"; + - conda create --quiet --name test-environment --show-channel-urls --channel conda-forge python=$TRAVIS_PYTHON_VERSION fipy gmsh; - source activate test-environment - conda remove --quiet --channel conda-forge --force fipy - if [[ $PY3K -eq 0 ]]; then From 36a929a61bfefdb386c89f91196d71768bf84243 Mon Sep 17 00:00:00 2001 From: Jonathan Guyer Date: Fri, 2 Apr 2021 19:29:29 -0400 Subject: [PATCH 4/9] Document that newer Gmsh can partition again --- INSTALLATION.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/INSTALLATION.rst b/INSTALLATION.rst index b29c0132ad..0df34b5ff3 100644 --- a/INSTALLATION.rst +++ b/INSTALLATION.rst @@ -272,7 +272,7 @@ http://www.geuz.org/gmsh/ :term:`Gmsh` is an application that allows the creation of irregular meshes. When running in parallel, :term:`FiPy` requires a version of :term:`Gmsh` ->= 2.5 and < 4.0. +>= 2.5 and < 4.0 or >= 4.5.2. SciPy ===== From 98b6c4a434d10515aa990004d56b8491aa9b5360 Mon Sep 17 00:00:00 2001 From: Jonathan Guyer Date: Sat, 3 Apr 2021 12:07:13 -0400 Subject: [PATCH 5/9] Fix spelling --- fipy/meshes/gmshMesh.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fipy/meshes/gmshMesh.py b/fipy/meshes/gmshMesh.py index 265c7634b8..4cb582a5d2 100755 --- a/fipy/meshes/gmshMesh.py +++ b/fipy/meshes/gmshMesh.py @@ -1388,7 +1388,7 @@ class Gmsh2D(Mesh2D): """Construct a 2D Mesh using Gmsh If called in parallel, mesh will be partitioned based on - `parallelComm.Nproc`. If an MSH file is supplied, it must have been + `parallelComm.Nproc`. If an `MSH` file is supplied, it must have been previously partitioned with the number of partitions matching `parallelComm.Nproc`. @@ -1881,7 +1881,7 @@ class Gmsh2DIn3DSpace(Gmsh2D): """Create a topologically 2D Mesh in 3D coordinates using Gmsh If called in parallel, mesh will be partitioned based on - `parallelComm.Nproc`. If an MSH file is supplied, it must have been + `parallelComm.Nproc`. If an `MSH` file is supplied, it must have been previously partitioned with the number of partitions matching `parallelComm.Nproc`. @@ -1970,7 +1970,7 @@ class Gmsh3D(Mesh): """Create a 3D Mesh using Gmsh If called in parallel, mesh will be partitioned based on - `parallelComm.Nproc`. If an MSH file is supplied, it must have been + `parallelComm.Nproc`. If an `MSH` file is supplied, it must have been previously partitioned with the number of partitions matching `parallelComm.Nproc`. From 44a8407be8321b843bc3e422e39ed27d3da94921 Mon Sep 17 00:00:00 2001 From: Jonathan Guyer Date: Sat, 3 Apr 2021 12:22:21 -0400 Subject: [PATCH 6/9] Fix version check for partitioning --- fipy/meshes/gmshMesh.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/fipy/meshes/gmshMesh.py b/fipy/meshes/gmshMesh.py index 4cb582a5d2..0fbb8ced16 100755 --- a/fipy/meshes/gmshMesh.py +++ b/fipy/meshes/gmshMesh.py @@ -176,9 +176,11 @@ def openMSHFile(name, dimensions=None, coordDimensions=None, communicator=parall gmshFlags = ["-%d" % dimensions, "-nopopup"] if communicator.Nproc > 1: - if not (StrictVersion("2.5") < version <= StrictVersion("4.0")): - warnstr = "Cannot partition with Gmsh version < 2.5 or >= 4.0. " \ - + "Reverting to serial." + if ((version < StrictVersion("2.5")) + or (StrictVersion("4.0") <= version < StrictVersion("4.5.2"))): + warnstr = ("Cannot partition with Gmsh version < 2.5 " + "or 4.0 <= version < 4.5.2. " + "Reverting to serial." warnings.warn(warnstr, RuntimeWarning, stacklevel=2) communicator = serialComm @@ -190,7 +192,7 @@ def openMSHFile(name, dimensions=None, coordDimensions=None, communicator=parall gmshFlags += ["-part", "%d" % communicator.Nproc] if version >= StrictVersion("4.0"): # Gmsh 4.x needs to be told to generate ghost cells - # Unfortunately, the ghosts are broken + # Unfortunately, the ghosts are broken in Gmsh 4.0--4.5.1 # https://gitlab.onelab.info/gmsh/gmsh/issues/733 gmshFlags += ["-part_ghosts"] From e8fd0098e4e88523c1bb9b9fb2ff9d2463137f43 Mon Sep 17 00:00:00 2001 From: Jonathan Guyer Date: Sat, 3 Apr 2021 12:30:49 -0400 Subject: [PATCH 7/9] Fix typo --- fipy/meshes/gmshMesh.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fipy/meshes/gmshMesh.py b/fipy/meshes/gmshMesh.py index 0fbb8ced16..00bd59dbee 100755 --- a/fipy/meshes/gmshMesh.py +++ b/fipy/meshes/gmshMesh.py @@ -180,7 +180,7 @@ def openMSHFile(name, dimensions=None, coordDimensions=None, communicator=parall or (StrictVersion("4.0") <= version < StrictVersion("4.5.2"))): warnstr = ("Cannot partition with Gmsh version < 2.5 " "or 4.0 <= version < 4.5.2. " - "Reverting to serial." + "Reverting to serial.") warnings.warn(warnstr, RuntimeWarning, stacklevel=2) communicator = serialComm From c5606b21cfdd087b7073a072ebf87fcd2dce2162 Mon Sep 17 00:00:00 2001 From: Jonathan Guyer Date: Wed, 7 Apr 2021 11:44:56 -0400 Subject: [PATCH 8/9] Specify Py3k with "python=3" Should give latest version of Python 3.x, but not 4.x. --- .appveyor.yml | 2 +- INSTALLATION.rst | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index 9b64a6c4dc..6874f840bc 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -77,7 +77,7 @@ install: # Configure the VM. - cmd: if "%TARGET_ARCH%" == "x64" if "%CONDA_PY%" == "27" conda.exe install --quiet --name root python=2.7 fipy - - cmd: if "%TARGET_ARCH%" == "x64" if "%CONDA_PY%" == "36" conda.exe install --quiet --name root "python>3" fipy gmsh + - cmd: if "%TARGET_ARCH%" == "x64" if "%CONDA_PY%" == "36" conda.exe install --quiet --name root python>3 fipy gmsh - cmd: conda.exe remove --quiet --force fipy # FIXME: fipy recipe on conda-forge doesn't have gmsh compatible with Python 2.7 - ps: | diff --git a/INSTALLATION.rst b/INSTALLATION.rst index 0df34b5ff3..ecfbbf02e2 100644 --- a/INSTALLATION.rst +++ b/INSTALLATION.rst @@ -88,7 +88,7 @@ Recommended Method and for Python 3.x, you should be able to do:: - conda create --name --channel conda-forge "python>3" numpy scipy matplotlib pysparse gmsh + conda create --name --channel conda-forge python=3 numpy scipy matplotlib pysparse gmsh followed, for either, by:: From 91495028151632ba9217ae87afd7de9a9ad5286c Mon Sep 17 00:00:00 2001 From: Jonathan Guyer Date: Wed, 7 Apr 2021 11:47:32 -0400 Subject: [PATCH 9/9] Improve phrasing --- fipy/meshes/gmshMesh.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/fipy/meshes/gmshMesh.py b/fipy/meshes/gmshMesh.py index 00bd59dbee..e06a455a11 100755 --- a/fipy/meshes/gmshMesh.py +++ b/fipy/meshes/gmshMesh.py @@ -1389,9 +1389,9 @@ def _localOverlappingCellIDs(self): class Gmsh2D(Mesh2D): """Construct a 2D Mesh using Gmsh - If called in parallel, mesh will be partitioned based on - `parallelComm.Nproc`. If an `MSH` file is supplied, it must have been - previously partitioned with the number of partitions matching + If called in parallel, the mesh will be partitioned based on the value + of `parallelComm.Nproc`. If an `MSH` file is supplied, it must have + been previously partitioned with the number of partitions matching `parallelComm.Nproc`. >>> radius = 5. @@ -1882,9 +1882,9 @@ def _test(self): class Gmsh2DIn3DSpace(Gmsh2D): """Create a topologically 2D Mesh in 3D coordinates using Gmsh - If called in parallel, mesh will be partitioned based on - `parallelComm.Nproc`. If an `MSH` file is supplied, it must have been - previously partitioned with the number of partitions matching + If called in parallel, the mesh will be partitioned based on the value + of `parallelComm.Nproc`. If an `MSH` file is supplied, it must have + been previously partitioned with the number of partitions matching `parallelComm.Nproc`. Parameters @@ -1971,9 +1971,9 @@ def _test(self): class Gmsh3D(Mesh): """Create a 3D Mesh using Gmsh - If called in parallel, mesh will be partitioned based on - `parallelComm.Nproc`. If an `MSH` file is supplied, it must have been - previously partitioned with the number of partitions matching + If called in parallel, the mesh will be partitioned based on the value + of `parallelComm.Nproc`. If an `MSH` file is supplied, it must have + been previously partitioned with the number of partitions matching `parallelComm.Nproc`. Parameters