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

#705 fix sign error #706

Merged
merged 4 commits into from
Nov 6, 2019
Merged

#705 fix sign error #706

merged 4 commits into from
Nov 6, 2019

Conversation

rtimms
Copy link
Contributor

@rtimms rtimms commented Nov 5, 2019

Description

Fixes a sign error when implementing Dirichlet BCs in the finite element method

EDIT: also fixes a bug where spatial variables were discretised to a vector of length N_y or N_z for y and z, respectively, instead of a vector of length N_y*N_z

Fixes #705

Type of change

Please add a line in the relevant section of CHANGELOG.md to document the change (include PR #) - note reverse order of PR #s.

  • New feature (non-breaking change which adds functionality)
  • Optimization (back-end change that speeds up the code)
  • Bug fix (non-breaking change which fixes an issue)

Key checklist:

  • No style issues: $ flake8
  • All tests pass: $ python run-tests.py --unit
  • The documentation builds: $ cd docs and then $ make clean; make html

You can run all three at once, using $ python run-tests.py --quick.

Further checks:

  • Code is commented, particularly in hard-to-understand areas
  • Tests added that prove fix is effective or that feature works

Copy link
Member

@valentinsulzer valentinsulzer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice one Rob!

@@ -461,6 +461,43 @@ def test_pure_neumann_poisson(self):
u_exact = z ** 2 / 2 - 1 / 6
np.testing.assert_array_almost_equal(solution.y[:-1], u_exact, decimal=1)

def test_dirichlet_bcs(self):
# manufactured solution u = a*z^2 + b*z + c
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😍

@codecov
Copy link

codecov bot commented Nov 5, 2019

Codecov Report

Merging #706 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #706   +/-   ##
=======================================
  Coverage   98.17%   98.17%           
=======================================
  Files         176      176           
  Lines        9135     9135           
=======================================
  Hits         8968     8968           
  Misses        167      167
Impacted Files Coverage Δ
pybamm/spatial_methods/scikit_finite_element.py 97.93% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 595a101...cb19c95. Read the comment docs.

Copy link
Contributor

@Scottmar93 Scottmar93 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice one

@rtimms rtimms merged commit aba1aae into master Nov 6, 2019
@rtimms rtimms deleted the issue-705-fem-bc-bug branch November 6, 2019 14:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

sign error in fem dirichlet bcs
3 participants