Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue 1129 julia #1942

Merged
merged 59 commits into from
May 26, 2022
Merged
Show file tree
Hide file tree
Changes from 56 commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
4ac20b6
#1129 revert deletions
valentinsulzer Jun 3, 2021
56035b1
Revert "use tox.ini and setup.py from develop branch"
valentinsulzer Jun 3, 2021
aecfcea
udpate tox.ini
valentinsulzer Jun 3, 2021
c327e7e
#1129 test fix
valentinsulzer Jun 3, 2021
001553e
#1129 fix some tests
valentinsulzer Jun 3, 2021
64ed751
Merge branch 'develop' into issue-1129-julia
valentinsulzer Jun 10, 2021
43132df
#1129 minor refactorings
valentinsulzer Jun 10, 2021
088f0ca
#1129 merge develop
valentinsulzer Jul 6, 2021
d8f8911
Merge branch 'develop' into issue-1129-julia
valentinsulzer Jul 14, 2021
1237c16
#1129 merge develop
valentinsulzer Aug 18, 2021
ebb5d3f
#1129 merge develop
valentinsulzer Aug 31, 2021
f1d4985
fix no domain issue
valentinsulzer Sep 2, 2021
fc2b1c6
#1129 merge develop
valentinsulzer Sep 17, 2021
0050d42
#1129 fix julia tests
valentinsulzer Sep 18, 2021
d7dc913
#1129 skip julia on windows and python3.9
valentinsulzer Sep 18, 2021
d99a2f8
#1129 don't install julia on ubuntu wuth python 3.9
valentinsulzer Sep 20, 2021
2090c62
Merge branch 'develop' into issue-1129-julia
valentinsulzer Oct 1, 2021
313e118
Merge branch 'develop' into issue-1129-julia
valentinsulzer Oct 27, 2021
0ad500a
merge develop
valentinsulzer Nov 11, 2021
904c5e0
#1129 merge develop
valentinsulzer Nov 27, 2021
c0aee07
Merge branch 'develop' into issue-1129-julia
valentinsulzer Nov 30, 2021
61b6f13
#1129 fix julia generation for discretized equations
valentinsulzer Dec 2, 2021
802966d
#1129 fix mtk model generation
valentinsulzer Dec 2, 2021
3774e28
#1129 merge develop
valentinsulzer Dec 4, 2021
5f5e006
fix mtk for spme
valentinsulzer Dec 4, 2021
d87761a
merge develop
valentinsulzer Dec 9, 2021
6a025eb
Merge branch 'averages-class' into issue-1129-julia
valentinsulzer Dec 9, 2021
52644bb
Merge branch 'averages-class' into issue-1129-julia
valentinsulzer Dec 9, 2021
a12a967
#1129 fix print_names
valentinsulzer Dec 9, 2021
7148413
Merge branch 'develop' into issue-1129-julia
valentinsulzer Dec 14, 2021
fa8ecc1
#1129 merge develop
valentinsulzer Feb 2, 2022
e27db82
#1129 fix tests
valentinsulzer Feb 2, 2022
3e5373a
#1129 julia on linux only
valentinsulzer Feb 3, 2022
8c14f80
#1129 try python 3.9
valentinsulzer Feb 3, 2022
ed81c53
Merge branch 'develop' into issue-1129-julia
valentinsulzer Feb 3, 2022
735b5ae
#1129 try julia tests on mac
valentinsulzer Feb 3, 2022
7f737d2
#1129 minor debugging
valentinsulzer Feb 3, 2022
6886069
#1129 add rounding
valentinsulzer Feb 4, 2022
a473140
#1129 remove test.py
valentinsulzer Feb 18, 2022
d5c9451
Merge branch 'develop' into issue-1129-julia
valentinsulzer Mar 2, 2022
05f11a5
#1129 remove imports
valentinsulzer Mar 4, 2022
2079ded
Merge branch 'develop' into issue-1129-julia
valentinsulzer Mar 8, 2022
2e80558
#1129 add more tests
valentinsulzer Mar 8, 2022
754c502
#1129 add model tests for MTK
valentinsulzer Mar 8, 2022
69201f6
Merge branch 'develop' into issue-1129-julia
valentinsulzer Mar 11, 2022
81a01a5
#1129 coverage
valentinsulzer Mar 11, 2022
8962d50
Merge branch 'develop' into issue-1129-julia
valentinsulzer Mar 14, 2022
4b9b2a4
#1129 coverage
valentinsulzer Mar 15, 2022
779e9da
Merge branch 'develop' into issue-1129-julia
valentinsulzer Mar 15, 2022
d037ed5
#1129 coverage
valentinsulzer Mar 15, 2022
183e441
#1129 changelog
valentinsulzer Mar 15, 2022
81d0261
#1129 fix min/max
valentinsulzer Mar 16, 2022
c7948b9
#1129 need to work on preallocate=False
valentinsulzer Mar 21, 2022
429a9d7
more logging
valentinsulzer Mar 28, 2022
006725e
Merge branch 'develop' into issue-1129-julia
valentinsulzer Apr 22, 2022
9319dd6
PR review
valentinsulzer Apr 22, 2022
88e42ce
Merge branch 'develop' into issue-1129-julia
valentinsulzer May 26, 2022
b71c20b
#1129 fix preallocating tests
valentinsulzer May 26, 2022
3cd7388
test both with and without preallocate
valentinsulzer May 26, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion .github/workflows/test_on_push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,13 @@ jobs:
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}


- name: Set up Julia
if: matrix.os != 'windows-latest'
uses: julia-actions/setup-julia@v1
with:
version: 1.7

- name: Install Linux system dependencies
if: matrix.os == 'ubuntu-latest'
run: |
Expand Down Expand Up @@ -87,6 +93,10 @@ jobs:
if: matrix.os == 'ubuntu-latest'
run: tox -e pybamm-requires

- name: Install Julia
if: matrix.os != 'windows-latest'
run: tox -e julia

- name: Run unit tests for GNU/Linux with Python 3.7 and 3.8
if: matrix.os == 'ubuntu-latest' && matrix.python-version != 3.9
run: python -m tox -e unit
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

- Added "Discharge energy [W.h]", which is the integral of the power in Watts, as an optional output. Set the option "calculate discharge energy" to "true" to get this output ("false" by default, since it can slow down some of the simple models) ([#1969](https://github.com/pybamm-team/PyBaMM/pull/1969)))
- Added an option "calculate heat source for isothermal models" to choose whether or not the heat generation terms are computed when running models with the option `thermal="isothermal"` ([#1958](https://github.com/pybamm-team/PyBaMM/pull/1958))
- Added functionality to generate Julia expressions from a model. See [PyBaMM.jl](https://github.com/tinosulzer/PyBaMM.jl) for how to use these ([#1942](https://github.com/pybamm-team/PyBaMM/pull/1942)))
valentinsulzer marked this conversation as resolved.
Show resolved Hide resolved

## Bug fixes

Expand Down
2 changes: 1 addition & 1 deletion docs/source/expression_tree/functions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Functions

.. autofunction:: pybamm.erfc

.. autoclass:: pybamm.Exponential
.. autoclass:: pybamm.Exp
:members:

.. autofunction:: pybamm.exp
Expand Down
31 changes: 16 additions & 15 deletions examples/notebooks/expression_tree/expression-tree.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -194,19 +194,7 @@
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [
{
"ename": "ImportError",
"evalue": "cannot import name 'get_discretisation_for_testing' from 'tests' (/home/ferranbrosa/PyBaMM/env/lib/python3.7/site-packages/tests/__init__.py)",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mImportError\u001b[0m Traceback (most recent call last)",
"\u001b[0;32m<ipython-input-7-90399bb3e6ad>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0;32mfrom\u001b[0m \u001b[0mtests\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mget_discretisation_for_testing\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 2\u001b[0m \u001b[0mdisc\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mget_discretisation_for_testing\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 3\u001b[0m \u001b[0mdisc\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0my_slices\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m{\u001b[0m\u001b[0mc\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mid\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0;34m[\u001b[0m\u001b[0mslice\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;36m40\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m}\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 4\u001b[0m \u001b[0mdcdt\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mdisc\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mprocess_symbol\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mdcdt\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 5\u001b[0m \u001b[0mdcdt\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mvisualise\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'expression_tree5.png'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;31mImportError\u001b[0m: cannot import name 'get_discretisation_for_testing' from 'tests' (/home/ferranbrosa/PyBaMM/env/lib/python3.7/site-packages/tests/__init__.py)"
]
}
],
"outputs": [],
"source": [
"from tests import get_discretisation_for_testing\n",
"disc = get_discretisation_for_testing()\n",
Expand Down Expand Up @@ -243,7 +231,7 @@
"output_type": "stream",
"text": [
"[1] Charles R. Harris, K. Jarrod Millman, Stéfan J. van der Walt, Ralf Gommers, Pauli Virtanen, David Cournapeau, Eric Wieser, Julian Taylor, Sebastian Berg, Nathaniel J. Smith, and others. Array programming with NumPy. Nature, 585(7825):357–362, 2020. doi:10.1038/s41586-020-2649-2.\n",
"[2] Valentin Sulzer, Scott G. Marquis, Robert Timms, Martin Robinson, and S. Jon Chapman. Python Battery Mathematical Modelling (PyBaMM). ECSarXiv. February, 2020. doi:10.1149/osf.io/67ckj.\n",
"[2] Valentin Sulzer, Scott G. Marquis, Robert Timms, Martin Robinson, and S. Jon Chapman. Python Battery Mathematical Modelling (PyBaMM). Journal of Open Research Software, 9(1):14, 2021. doi:10.5334/jors.309.\n",
"\n"
]
}
Expand All @@ -269,7 +257,20 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.0"
"version": "3.8.12"
},
"toc": {
"base_numbering": 1,
"nav_menu": {},
"number_sections": true,
"sideBar": true,
"skip_h1_title": false,
"title_cell": "Table of Contents",
"title_sidebar": "Contents",
"toc_cell": false,
"toc_position": {},
"toc_section_display": true,
"toc_window_display": true
}
},
"nbformat": 4,
Expand Down
Binary file modified examples/notebooks/expression_tree/expression_tree1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified examples/notebooks/expression_tree/expression_tree2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified examples/notebooks/expression_tree/expression_tree3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified examples/notebooks/expression_tree/expression_tree4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified examples/notebooks/expression_tree/expression_tree5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading