diff --git a/appveyor.yml b/.appveyor.yml
similarity index 67%
rename from appveyor.yml
rename to .appveyor.yml
index df22ca4ad7..54cc55eb26 100644
--- a/appveyor.yml
+++ b/.appveyor.yml
@@ -3,30 +3,31 @@
environment:
matrix:
- - TARGET_ARCH: x86
- CONDA_PY: 27
- CONDA_INSTALL_LOCN: C:\\Miniconda
- FIPY_SOLVERS: pysparse
-
- TARGET_ARCH: x64
CONDA_PY: 27
CONDA_INSTALL_LOCN: C:\\Miniconda-x64
FIPY_SOLVERS: pysparse
- - TARGET_ARCH: x86
- CONDA_PY: 27
- CONDA_INSTALL_LOCN: C:\\Miniconda
- FIPY_SOLVERS: scipy
+# - TARGET_ARCH: x64
+# CONDA_PY: 27
+# CONDA_INSTALL_LOCN: C:\\Miniconda-x64
+# FIPY_SOLVERS: pysparse
+# FIPY_INLINE: 1
+
+# - TARGET_ARCH: x86
+# CONDA_PY: 27
+# CONDA_INSTALL_LOCN: C:\\Miniconda
+# FIPY_SOLVERS: scipy
- TARGET_ARCH: x64
CONDA_PY: 27
CONDA_INSTALL_LOCN: C:\\Miniconda-x64
FIPY_SOLVERS: scipy
- - TARGET_ARCH: x86
- CONDA_PY: 36
- CONDA_INSTALL_LOCN: C:\\Miniconda36
- FIPY_SOLVERS: scipy
+# - TARGET_ARCH: x86
+# CONDA_PY: 36
+# CONDA_INSTALL_LOCN: C:\\Miniconda36
+# FIPY_SOLVERS: scipy
- TARGET_ARCH: x64
CONDA_PY: 36
@@ -60,23 +61,27 @@ install:
- cmd: conda.exe config --set changeps1 no
- cmd: conda.exe config --remove channels defaults
- cmd: conda.exe config --add channels defaults
- - cmd: conda.exe config --add channels guyer
- cmd: conda.exe config --add channels conda-forge
# Configure the VM.
- - cmd: conda.exe install --quiet --name root fipy
+ - cmd: if "%TARGET_ARCH%" == "x64" conda.exe install --quiet --name root python fipy
+ - cmd: if "%TARGET_ARCH%" == "x64" conda.exe uninstall --quiet fipy
+
+ - cmd: if "%TARGET_ARCH%" == "x86" conda.exe install --quiet --name root python numpy scipy matplotlib
+ - cmd: if "%TARGET_ARCH%" == "x86" if "%CONDA_PY%" == "27" conda.exe install --quiet --name root mayavi weave
+ - cmd: if "%TARGET_ARCH%" == "x86" if "%FIPY_SOLVERS%" == "pysparse" conda.exe install --quiet --name root pysparse
- cmd: if "%CONDA_PY%" == "36" 2to3 --write . 1> NUL 2>&1
- cmd: if "%CONDA_PY%" == "36" 2to3 --write --doctests_only . 1> NUL 2>&1
- - cmd: python setup.py install
-
- cmd: pip install scikit-fmm
# Skip .NET project specific build phase.
build: off
test_script:
- - python setup.py test --%FIPY_SOLVERS%
+ - if !%FIPY_INLINE%==! python setup.py test 1> NUL 2>&1
+ - python setup.py test
+ - conda env export
# deploy_script:
# - cmd: upload_or_check_non_existence .\recipe guyer --channel=main
diff --git a/.circleci/config.yml b/.circleci/config.yml
index 855ccbb8e3..b5ce3f35c6 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -2,116 +2,281 @@
#
# Check https://circleci.com/docs/2.0/language-python/ for more details
#
-version: 2
+version: 2.1
-jobs:
- test-27-pysparse:
- docker:
- # specify the version you desire here
- - image: continuumio/miniconda2
+defaults: &defaults
+ working_directory: ~/project
- working_directory: ~/repo
+defaults2: &defaults2
+ <<: *defaults
- steps:
- - checkout
+ docker:
+ - image: continuumio/miniconda2
- # Download and cache dependencies
- - restore_cache:
- keys:
- - v1-dependencies-{{ arch }}
- # fallback to using the latest cache if no exact match is found
- - v1-dependencies-
+defaults3: &defaults3
+ <<: *defaults
+
+ docker:
+ - image: continuumio/miniconda3
+
+commands:
+ createenv:
+ description: "Create conda environment"
+ parameters:
+ env:
+ type: string
+ default: "cache"
+
+ packages:
+ type: string
+ default: ""
+
+ steps:
- run:
- name: install dependencies
+ name: Create Conda Environment
command: |
- apt-get --yes update
- apt-get --yes install build-essential
- conda config --set always_yes yes --set changeps1 no
- conda update -q conda
- conda config --remove channels defaults
- conda create -v --quiet --name test-environment --show-channel-urls --channel guyer --channel conda-forge python=2.7 numpy scipy gmsh pysparse mpi4py matplotlib mayavi fipytrilinos weave
- source activate test-environment
- conda info -a
+ conda create -v --quiet --prefix << parameters.env >> --show-channel-urls --channel conda-forge << parameters.packages >>
+ source activate ~/project/<< parameters.env >>
+ conda uninstall --quiet fipy
pip install scikit-fmm
- - save_cache:
- paths:
- - /.conda
- key: v1-dependencies-{{ arch }}
+ test_fipy:
+ description: "Run FiPy Tests"
+
+ parameters:
+ mpirun:
+ type: string
+ default: ""
+
+ steps:
+ - restore_conda_cache
+
+ - attach_workspace:
+ at: ~/project
- run:
- name: install fipy
+ name: Run Tests
+ no_output_timeout: 30m
command: |
- source activate test-environment
- python setup.py install
+ source activate ~/project/test-environment
+ if [[ ! -z "${FIPY_INLINE}" ]]; then
+ << parameters.mpirun >> python setup.py test > /dev/null 2>&1 || true;
+ fi
+ << parameters.mpirun >> python setup.py test
- run:
- name: run tests
+ name: Output Environment
command: |
- source activate test-environment
- python setup.py test --pysparse
+ conda env export --prefix ~/project/test-environment
- store_artifacts:
path: test-reports
destination: test-reports
- test-27-scipy:
- docker:
- # specify the version you desire here
- - image: continuumio/miniconda2
+ test_fipy2:
+ description: "Run FiPy Tests with python 2.x"
- working_directory: ~/repo
+ parameters:
+ mpirun:
+ type: string
+ default: ""
steps:
+ - run:
+ name: Install libGLU
+ command: |
+ apt-get --yes update
+ apt-get --yes install libglu1-mesa
+
- checkout
- # Download and cache dependencies
+ - test_fipy:
+ mpirun: << parameters.mpirun >>
+
+ test_fipy3:
+ description: "Run FiPy Tests with Py3k"
+
+ parameters:
+ mpirun:
+ type: string
+ default: ""
+
+ steps:
+ - run:
+ name: Install libGL
+ command: |
+ apt-get --yes update
+ apt-get --yes install libglu1-mesa
+ apt-get --yes install libgl1-mesa-glx
+ apt-get --yes install libxrender1
+
+ - checkout
+
+ - run:
+ name: 2to3
+ command: |
+ 2to3 --write . &> /dev/null;
+ 2to3 --write --doctests_only . &> /dev/null;
+
+ - test_fipy:
+ mpirun: << parameters.mpirun >>
+
+ # localize changes to cache name to these two commands
+ save_conda_cache:
+ steps:
+ - save_cache:
+ paths:
+ - /opt/conda
+ - /root/.cache/pip
+ key: v7-dependencies-{{ arch }}
+
+ restore_conda_cache:
+ description: "Restore cache holding conda and pip"
+
+ steps:
- restore_cache:
keys:
- - v1-dependencies-{{ arch }}
+ - v7-dependencies-{{ arch }}
# fallback to using the latest cache if no exact match is found
- - v1-dependencies-
+ - v7-dependencies-
+ install_dependencies:
+ steps:
- run:
- name: install dependencies
+ name: Install Dependencies
command: |
apt-get --yes update
apt-get --yes install build-essential
conda config --set always_yes yes --set changeps1 no
conda update -q conda
conda config --remove channels defaults
- conda create -v --quiet --name test-environment --show-channel-urls --channel guyer --channel conda-forge python=2.7 numpy scipy gmsh pysparse mpi4py matplotlib mayavi fipytrilinos weave
- source activate test-environment
- conda info -a
- pip install scikit-fmm
-
- - save_cache:
- paths:
- - /.conda
- key: v1-dependencies-{{ arch }}
+ remove_extracted_conda_packages:
+ description: "force conda to download packages into the cache and then
+ clean out extracted packages
+ after https://gist.github.com/mcg1969/cbb1760cea6b0671959d8cbf957c89bf"
+ steps:
- run:
- name: install fipy
+ name: Remove Extracted Conda Packages
command: |
- source activate test-environment
- python setup.py install
+ conda clean --packages
- - run:
- name: run tests
- command: |
- source activate test-environment
- python setup.py test --scipy
+ install_conda_packages:
+ description: "Restore conda environment and install packages"
- - store_artifacts:
- path: test-reports
- destination: test-reports
+ parameters:
+ packages:
+ type: string
+ default: ""
+
+ steps:
+ # Download and cache dependencies
+ - restore_conda_cache
+
+ - install_dependencies
+
+ - createenv:
+ env: "test-environment"
+ packages: << parameters.packages >>
+
+ - remove_extracted_conda_packages
+
+ - save_conda_cache
+
+ - persist_to_workspace:
+ root: ~/project
+ paths:
+ - test-environment
+
+jobs:
+ conda2_env:
+ <<: *defaults2
+
+ steps:
+ - install_conda_packages:
+ packages: "python=2.7 fipy"
+
+ conda3_env:
+ <<: *defaults3
+
+ steps:
+ - install_conda_packages:
+ packages: "python=3.6 fipy"
+
+ test-27-pysparse:
+ <<: *defaults2
+
+ steps:
+ - test_fipy2
+ environment:
+ FIPY_SOLVERS: pysparse
+
+ test-27-inline:
+ <<: *defaults2
+
+ steps:
+ - test_fipy2
+ environment:
+ FIPY_SOLVERS: pysparse
+ FIPY_INLINE: 1
+
+ test-27-scipy:
+ <<: *defaults2
+
+ steps:
+ - test_fipy2
+ environment:
+ FIPY_SOLVERS: scipy
+
+ test-27-trilinos:
+ <<: *defaults2
+
+ steps:
+ - test_fipy2
+ environment:
+ FIPY_SOLVERS: trilinos
+
+ test-27-parallel:
+ <<: *defaults2
+
+ steps:
+ - test_fipy2:
+ mpirun: "mpirun -np 2"
+ environment:
+ FIPY_SOLVERS: trilinos
+ OMP_NUM_THREADS: 1
+
+ test-36-scipy:
+ <<: *defaults3
+
+ steps:
+ - test_fipy3
+ environment:
+ FIPY_SOLVERS: scipy
workflows:
version: 2
test:
jobs:
- - test-27-pysparse
- - test-27-scipy
-
\ No newline at end of file
+ - conda2_env
+ - conda3_env
+ - test-27-pysparse:
+ requires:
+ - conda2_env
+# - test-27-inline:
+# requires:
+# - conda2_env
+ - test-27-scipy:
+ requires:
+ - conda2_env
+ - test-27-trilinos:
+ requires:
+ - conda2_env
+ - test-27-parallel:
+ requires:
+ - conda2_env
+ - test-36-scipy:
+ requires:
+ - conda3_env
diff --git a/.travis.yml b/.travis.yml
index efd4f89376..453dcb6d83 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -3,47 +3,37 @@
# language: python causes grief on osx
language: generic
os:
- # - osx
- - linux
+ - osx
+ # - linux
env:
- TRAVIS_PYTHON_VERSION=2.7 MPIRUN= FIPY_SOLVERS=pysparse
- # - TRAVIS_PYTHON_VERSION=2.7 MPIRUN= FIPY_SOLVERS=pysparse FIPY_INLINE=1
+# - TRAVIS_PYTHON_VERSION=2.7 MPIRUN= FIPY_SOLVERS=pysparse FIPY_INLINE=1
- TRAVIS_PYTHON_VERSION=2.7 MPIRUN= FIPY_SOLVERS=scipy
- TRAVIS_PYTHON_VERSION=2.7 MPIRUN= FIPY_SOLVERS=trilinos
- TRAVIS_PYTHON_VERSION=2.7 MPIRUN="mpirun -np 2" FIPY_SOLVERS=trilinos
- TRAVIS_PYTHON_VERSION=3.6 MPIRUN= FIPY_SOLVERS=scipy
cache: apt
-addons:
- apt:
- packages:
- # - liblapack3
- # - liblapack.so.3
- # - libatlas-dev
- # - libatlas-base-dev
- # - liblapack-dev
- # - liblapack3gf
- # - gfortran
branches:
except:
- nist-pages
before_install:
# sudo ln -s /usr/lib/lapack/liblapack.so.3gf /usr/lib/lapack/liblapack.so.3;
# sudo ldconfig;
- - if [[ $TRAVIS_OS_NAME -eq "linux" ]]; then
+ - if [[ $TRAVIS_OS_NAME = "linux" ]]; then
sudo apt-get update;
fi
# We do this conditionally because it saves us some downloading if the
# version is the same.
- PY3K=$(echo "$TRAVIS_PYTHON_VERSION >= 3.0" | bc)
- - if [[ $TRAVIS_OS_NAME -eq "linux" ]]; then
+ - if [[ $TRAVIS_OS_NAME = "linux" ]]; then
export MINICONDA_OS_NAME=Linux;
- elif [[ $TRAVIS_OS_NAME -eq "osx" ]]; then
+ elif [[ $TRAVIS_OS_NAME = "osx" ]]; then
export MINICONDA_OS_NAME=MacOSX;
fi
- if [[ $PY3K -eq 1 ]]; then
export MINICONDA_VERSION=3;
else
- export MINICONDA_VERSION=;
+ export MINICONDA_VERSION=2;
fi
- wget https://repo.continuum.io/miniconda/Miniconda${MINICONDA_VERSION}-latest-${MINICONDA_OS_NAME}-x86_64.sh -O miniconda.sh;
- bash miniconda.sh -b -p $HOME/miniconda
@@ -51,18 +41,9 @@ before_install:
- hash -r
- conda config --set always_yes yes --set changeps1 no
- conda update -q conda
- # fipy conda package does not properly load scipy and numpy from
- # conda-forge channel when on linux
- - if [[ $TRAVIS_OS_NAME -eq "linux" ]]; then
- if [[ $PY3K -eq 1 ]]; then
- conda create --quiet --name test-environment --show-channel-urls --channel guyer --channel conda-forge python=$TRAVIS_PYTHON_VERSION numpy scipy gmsh matplotlib;
- else
- conda create --quiet --name test-environment --show-channel-urls --channel guyer --channel conda-forge python=$TRAVIS_PYTHON_VERSION numpy scipy gmsh pysparse mpi4py matplotlib mayavi pytrilinos weave;
- fi
- elif [[ $TRAVIS_OS_NAME -eq "osx" ]]; then
- conda create --quiet --name test-environment --show-channel-urls --channel guyer --channel conda-forge python=$TRAVIS_PYTHON_VERSION fipy;
- fi
+ - conda create --quiet --name test-environment --show-channel-urls --channel conda-forge python=$TRAVIS_PYTHON_VERSION fipy;
- source activate test-environment
+ - conda uninstall --quiet fipy
# Useful for debugging any issues with conda
- conda info -a
- pip install scikit-fmm
@@ -76,15 +57,17 @@ before_script:
# lack of display causes tests to abort at VtkViewer
# Workaround @ http://docs.enthought.com/mayavi/mayavi/tips.html#rendering-using-the-virtual-framebuffer
# and https://docs.travis-ci.com/user/gui-and-headless-browsers/#Using-xvfb-to-Run-Tests-That-Require-a-GUI
- - if [[ $TRAVIS_OS_NAME -eq "linux" ]]; then
+ - if [[ $TRAVIS_OS_NAME = "linux" ]]; then
export DISPLAY=:99.0;
sh -e /etc/init.d/xvfb start;
sleep 3;
fi
+ # inline must be run twice to clear out compiler warnings
+ # we don't care if it fails the first time
+ - if [[ ! -z "${FIPY_INLINE}" ]]; then
+ travis_wait 40 $MPIRUN python setup.py test || true;
+ fi
script:
- # inline must be run twice to clear out compiler warnings
- # we don't care if it fails the first time
- - if [[ ! -z "${FIPY_INLINE}" ]]; then
- $MPIRUN python setup.py test > /dev/null 2>&1 || true;
- fi
- - $MPIRUN python setup.py test;
+ - $MPIRUN python setup.py test;
+after_success:
+ - conda env export
diff --git a/CHANGELOG.rst b/CHANGELOG.rst
index ed6d55026e..1a1743a574 100644
--- a/CHANGELOG.rst
+++ b/CHANGELOG.rst
@@ -1094,8 +1094,7 @@ The significant changes since version 1.0 are:
- Installation on Windows has been made considerably easier by
constructing executable installers for :term:`FiPy` and its
- dependencies. Instructions for Windows installation can be found in
- :ref:`WINDOWS-INSTALLATION`.
+ dependencies.
- The arithmetic for ``Variable`` subclasses now works, and returns
sensible answers. For example, ``VectorCellVariable * CellVariable``
diff --git a/INSTALLATION.rst b/INSTALLATION.rst
index 1db9ee6a4b..42d5e07b2f 100644
--- a/INSTALLATION.rst
+++ b/INSTALLATION.rst
@@ -55,7 +55,7 @@ Recommended Method
* `install Miniconda`_ on your computer
* run::
- $ conda create --name FiPy: A Finite Volume PDE Solver Using Python
href="documentation/references.html#nist-damascene-2001">[NIST:damascene:2001].
-
+
+
diff --git a/documentation/introduction.rst b/documentation/introduction.rst
index cc78713734..7fb7d82cc8 100644
--- a/documentation/introduction.rst
+++ b/documentation/introduction.rst
@@ -14,3 +14,4 @@ Introduction
design
FAQ
glossary
+ ADMINISTRATA
diff --git a/examples/diffusion/steadyState/otherMeshes/grid3Dinput.py b/examples/diffusion/steadyState/otherMeshes/grid3Dinput.py
index fb97d201eb..d783861e70 100755
--- a/examples/diffusion/steadyState/otherMeshes/grid3Dinput.py
+++ b/examples/diffusion/steadyState/otherMeshes/grid3Dinput.py
@@ -17,7 +17,7 @@
from fipy import CellVariable, Grid2D, Grid3D, DiffusionTerm, Viewer
from fipy.tools import numerix
-nx = 10
+nx = 8 # FIXME: downsized temporarily from 10 due to https://github.com/usnistgov/fipy/issues/622
ny = 5
nz = 3
@@ -41,7 +41,7 @@
#do the 2D problem for comparison
-nx = 10
+nx = 8 # FIXME: downsized temporarily from 10 due to https://github.com/usnistgov/fipy/issues/622
ny = 5
dx = 1.
diff --git a/fipy/meshes/gmshMesh.py b/fipy/meshes/gmshMesh.py
index 1d31fee323..fc10134f10 100755
--- a/fipy/meshes/gmshMesh.py
+++ b/fipy/meshes/gmshMesh.py
@@ -1479,7 +1479,7 @@ class Gmsh2D(Mesh2D):
... square = Gmsh2D(geo, background=bkg) # doctest: +GMSH
... x, y = square.cellCenters # doctest: +GMSH
... bkg = CellVariable(mesh=square, value=abs(x / 4) + 0.01) # doctest: +GMSH
- ... std.append(numerix.std(numerix.sqrt(2 * square.cellVolumes) / bkg)) # doctest: +GMSH
+ ... std.append((numerix.sqrt(2 * square.cellVolumes) / bkg).std()) # doctest: +GMSH
Check that the mesh is monotonically approaching the desired density
@@ -1498,12 +1498,12 @@ class Gmsh2D(Mesh2D):
>>> trisquare = Tri2D(nx=1, ny=1)
>>> x, y = trisquare.cellCenters
>>> bkg = CellVariable(mesh=trisquare, value=abs(x / 4) + 0.01)
- >>> std1 = numerix.std(numerix.sqrt(2 * trisquare.cellVolumes) / bkg)
+ >>> std1 = (numerix.sqrt(2 * trisquare.cellVolumes) / bkg).std()
>>> square = Gmsh2D(geo, background=bkg) # doctest: +GMSH
>>> x, y = square.cellCenters # doctest: +GMSH
>>> bkg = CellVariable(mesh=square, value=abs(x / 4) + 0.01) # doctest: +GMSH
- >>> std2 = numerix.std(numerix.sqrt(2 * square.cellVolumes) / bkg) # doctest: +GMSH
+ >>> std2 = (numerix.sqrt(2 * square.cellVolumes) / bkg).std() # doctest: +GMSH
>>> print std1 > std2 # doctest: +GMSH
True
diff --git a/fipy/tools/dimensions/physicalField.py b/fipy/tools/dimensions/physicalField.py
index dffd7fb1aa..9997e559cf 100755
--- a/fipy/tools/dimensions/physicalField.py
+++ b/fipy/tools/dimensions/physicalField.py
@@ -520,14 +520,14 @@ def itemset(self, value):
>>> print a.allclose("1.8288 m")
1
>>> a = PhysicalField(((3.,4.),(5.,6.)),"m")
- >>> try:
+ >>> try: #doctest: +IGNORE_EXCEPTION_DETAIL
... a.itemset(PhysicalField("6 ft"))
... except IndexError:
... # NumPy 1.7 has changed the exception type
... raise ValueError("can only place a scalar for an array of size 1")
Traceback (most recent call last):
...
- ValueError: can only place a scalar for an array of size 1
+ ValueError: can only convert an array of size 1 to a Python scalar
>>> a.itemset(PhysicalField("2 min"))
Traceback (most recent call last):
...
diff --git a/fipy/variables/meshVariable.py b/fipy/variables/meshVariable.py
index 48275a4d88..30dd2cf556 100644
--- a/fipy/variables/meshVariable.py
+++ b/fipy/variables/meshVariable.py
@@ -455,6 +455,30 @@ def allequalParallel(a, b):
else:
return Variable.allequal(self, other)
+ def std(self, axis=None, **kwargs):
+ """Evaluate standard deviation of all the elements of a `MeshVariable`.
+
+ Adapted from http://mpitutorial.com/tutorials/mpi-reduce-and-allreduce/
+
+ >>> import fipy as fp
+ >>> mesh = fp.Grid2D(nx=2, ny=2, dx=2., dy=5.)
+ >>> var = fp.CellVariable(value=(1., 2., 3., 4.), mesh=mesh)
+ >>> print (var.std()**2).allclose(1.25)
+ True
+ """
+ if self.mesh.communicator.Nproc > 1 and (axis is None or axis == len(self.shape) - 1):
+ def stdParallel(a):
+ N = self.mesh.globalNumberOfCells
+ mean = self.sum(axis=axis).value / N
+ sq_diff = (self - mean)**2
+
+ return numerix.sqrt(sq_diff.sum(axis=axis).value / N)
+
+ return self._axisOperator(opname="stdVar",
+ op=stdParallel,
+ axis=axis)
+ else:
+ return Variable.std(self, axis=axis)
def _shapeClassAndOther(self, opShape, operatorClass, other):
"""
diff --git a/fipy/variables/variable.py b/fipy/variables/variable.py
index 83361d5229..80dd978b13 100644
--- a/fipy/variables/variable.py
+++ b/fipy/variables/variable.py
@@ -1392,6 +1392,11 @@ def min(self, axis=None):
op=lambda a: a.min(axis=axis),
axis=axis)
+ def std(self, axis=None, **kwargs):
+ return self._axisOperator(opname="stdVar",
+ op=lambda a: numerix.std(a, **kwargs),
+ axis=axis)
+
def _getitemClass(self, index):
return self._OperatorVariableClass()