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 1029 reformat geometry #1032

Merged
merged 4 commits into from
Jun 1, 2020
Merged

Conversation

valentinsulzer
Copy link
Member

Description

Reformats and simplifies geometries. See discussion in #1029

The geometry no longer has keys "primary" and "secondary". The first keys can either be spatial variables or "tabs", e.g.

geometry = {
        "negative electrode": {var.x_n: {"min": 0, "max": l_n}},
        "separator": {var.x_s: {"min": l_n, "max": l_n + l_s}},
        "positive electrode": {var.x_p: {"min": l_n + l_s, "max": 1}},
                "negative particle": {var.r_n: {"min": 0, "max": 1}},
                "positive particle": {var.r_p: {"min": 0, "max": 1}},
            }

    if current_collector_dimension == 0:
        geometry["current collector"] = {var.z: {"position": 1}}
    elif current_collector_dimension == 1:
        geometry["current collector"] = {
            var.z: {"min": 0, "max": 1},
            "tabs": {
                "negative": {"z_centre": pybamm.geometric_parameters.centre_z_tab_n},
                "positive": {"z_centre": pybamm.geometric_parameters.centre_z_tab_p},
            },
        }

Meshes are no longer lists, and auxiliary domains are used instead to figure out the number of repeats. There is a chance this could raise some obscure errors if a variable's auxiliary domains aren't set right, but not yet sure how to catch those.

Also fixes a bug with timescale (when time_units are hours) in quickplot.

Fixes #1029

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. If necessary, also add to the list of breaking changes.

  • 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
Contributor

@rtimms rtimms left a comment

Choose a reason for hiding this comment

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

thanks @tinosulzer this is so much neater!!

@valentinsulzer valentinsulzer merged commit 40e2045 into develop Jun 1, 2020
@valentinsulzer valentinsulzer deleted the issue-1029-reformat-geometry branch June 1, 2020 12:42
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.

Cleaning up geometries and meshes
2 participants