Skip to content

Commit

Permalink
migration of mprans to xtensor (#1068)
Browse files Browse the repository at this point in the history
* Added xtensor-python to environment.yaml

* AddedMass based on xtensor

* xtensor

* SedClosure based on xtensor

* VOF3P based on xtensor

* NCLS3P based on xtensor

* Moved mprans2/setup.py into proteus/setup.py

* MCorr3P based on xtensor

* Install xtensor for hashdist

* Add PROTEUS_OPT compilation options for xtensor-based extensions

* mprans.RANS3PSed

* mprans.RANS3PSed2D

* Moved RANS3PSed to mprans

* Add calculateVelocityAverage

* Dissipation2D

* VOS3P

* PresInc

* Dissipation

* CLSVOF

* NCLS

* MCorr

* RANS2P

* RANS2P2D

* RANS2P_IB

* Travis parallel compilation disabled

* RDLS

* VOF

* MoveMesh

* MoveMesh2D

* SW2D

* SW2DCV

* GN_SW2DCV

* Fixed AddedMass

* Fixed VOF3P

* Fixed NCLS3P

* Fixed MCorr3P

* Kappa and Kappa2D

* RANS3PF

* SedClosure.h

* Splitted RANS3PF.h and RANS3PF2D.h

* Disabled optimizations

* Fixed build after rebase

* Reverted RANS3PF and enabled optimizations again

Co-authored-by: David Brochart <[email protected]>
Co-authored-by: Alvin Zhang <[email protected]>
  • Loading branch information
3 people authored Feb 13, 2020
1 parent 5ee9138 commit cf9c7f9
Show file tree
Hide file tree
Showing 140 changed files with 41,153 additions and 49,521 deletions.
5 changes: 1 addition & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ linux2/
garnet.gnu/
Cygwin
proteus.egg-info/
proteus/ADR.cpp
proteus/subsurfaceTransportFunctions.c
cygwin_bootstrap.done
matlab_setup.done
dist/
tmp/

# Generated files

Expand All @@ -58,14 +58,12 @@ proteus/csparsity.cpp
proteus/csubgridError.c
proteus/ctimeIntegration.c
proteus/ctransportCoefficients.c
proteus/elastoplastic/cElastoPlastic.cpp
proteus/equivalent_polynomials.cpp
proteus/fenton/Fenton.cpp
proteus/flcbdfWrappers.cpp
proteus/mbd/CouplingFSI.cpp
proteus/mprans/BoundaryConditions.cpp
proteus/mprans/MeshSmoothing.cpp
proteus/mprans/SedClosure.cpp
proteus/mprans/cAddedMass.cpp
proteus/mprans/cCLSVOF.cpp
proteus/mprans/cGN_SW2DCV.cpp
Expand All @@ -79,5 +77,4 @@ proteus/mprans/cRANS3PF.cpp
proteus/mprans/cRANS3PSed.cpp
proteus/mprans/cVOF3P.cpp
proteus/mprans/cVOS3P.cpp
proteus/richards/cRichards.cpp
proteus/superluWrappers.c
7 changes: 4 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ jobs:
env: TEST_PROFILE="proteus-hashdist"
install:
- git lfs pull
- ./get_xtensor.sh
- ./stack/hit/bin/hit init-home
- ./stack/hit/bin/hit remote add http://levant.hrwallingford.com/hashdist_src --objects="source"
- ./stack/hit/bin/hit remote add http://levant.hrwallingford.com/hashdist_ubuntu_16_04 --objects="build"
Expand All @@ -51,7 +52,7 @@ jobs:
- export PATHSAVE=$PATH
- export PATH=$PWD/linux/bin:$PATH
- export LD_LIBRARY_PATH=$PWD/linux/lib:$LD_LIBRARY_PATH
- PROTEUS_OPT="-w -O2 -UNDEBUG" FC=gfortran CC=mpicc CXX=mpicxx make develop N=2
- PROTEUS_OPT="-w -O2 -UNDEBUG" FC=gfortran CC=mpicc CXX=mpicxx make develop N=1
- export SSL_CERT_DIR=/etc/ssl/certs
- #./linux/bin/pip3 install matplotlib
script:
Expand All @@ -76,7 +77,7 @@ jobs:
- conda info -a
- conda env create -f environment-dev.yml
- conda activate proteus-dev
- pip install -v -e .
- make develop-conda N=1
script:
- export MPLBACKEND="AGG"
- py.test -n 1 --dist=loadfile --forked -v proteus/tests --ignore proteus/tests/POD --ignore proteus/tests/MeshAdaptPUMI --cov=proteus
Expand Down Expand Up @@ -108,4 +109,4 @@ jobs:
- git lfs pull
- cd proteus/tests/ci
- parun poisson_3d_tetgen_p.py poisson_3d_tetgen_c0p1_n.py -l 5 -v
# - py.test -n 1 --dist=no --forked -v proteus/tests --ignore proteus/tests/POD --ignore proteus/tests/MeshAdaptPUMI --cov=proteus
# - py.test -n 1 --dist=no --forked -v proteus/tests --ignore proteus/tests/POD --ignore proteus/tests/MeshAdaptPUMI --cov=proteus
1 change: 1 addition & 0 deletions environment-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,5 @@ dependencies:
- ipyparallel
- pillow
- recordtype
- xtensor-python
- git-lfs
1 change: 1 addition & 0 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@ dependencies:
- cython
- pillow
- pip
- xtensor-python
- pip:
- recordtype
15 changes: 15 additions & 0 deletions get_xtensor.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash

rm -rf proteus/xtensor
mkdir -p proteus/xtensor
cd proteus/xtensor
mkdir xtl xtensor-python xtensor pybind11
wget https://github.com/QuantStack/xtl/archive/0.6.11.tar.gz -O xtl.tar.gz
wget https://github.com/QuantStack/xtensor-python/archive/0.24.1.tar.gz -O xtensor-python.tar.gz
wget https://github.com/xtensor-stack/xtensor/archive/0.21.2.tar.gz -O xtensor.tar.gz
wget https://github.com/pybind/pybind11/archive/v2.4.3.tar.gz -O pybind11.tar.gz
tar zxf xtl.tar.gz --strip-components=1 -C xtl
tar zxf xtensor-python.tar.gz --strip-components=1 -C xtensor-python
tar zxf xtensor.tar.gz --strip-components=1 -C xtensor
tar zxf pybind11.tar.gz --strip-components=1 -C pybind11
rm *.gz
29 changes: 29 additions & 0 deletions proteus/ADR.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#include "pybind11/pybind11.h"
#include "pybind11/stl_bind.h"

#define FORCE_IMPORT_ARRAY
#include "ADR.h"

#if defined(__GNUC__) && !defined(__clang__)
namespace workaround
{
inline void define_allocators()
{
std::allocator<int> a0;
std::allocator<double> a1;
}
}
#endif

namespace py = pybind11;
using proteus::cppADR_base;

PYBIND11_MODULE(ADR, m)
{
xt::import_numpy();

py::class_<cppADR_base>(m, "ADR")
.def(py::init(&proteus::newADR))
.def("calculateResidual", &cppADR_base::calculateResidual)
.def("calculateJacobian", &cppADR_base::calculateJacobian);
}
Loading

0 comments on commit cf9c7f9

Please sign in to comment.