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

Interior bcs #2007

Merged
merged 12 commits into from
May 13, 2021
Merged

Interior bcs #2007

merged 12 commits into from
May 13, 2021

Conversation

wence-
Copy link
Contributor

@wence- wence- commented Mar 12, 2021

Remove support for method="geometric" boundary conditions and then augment the bc construction such that we can handle bcs on interior marked facets.

@ScottMacLachlan does this work for your use cases? I have only proved it correct, not tested.

@wence- wence- force-pushed the wence/feature/no-geom-bcs branch 3 times, most recently from 683271f to d5c2a87 Compare March 15, 2021 12:24
@sv2518
Copy link
Contributor

sv2518 commented Apr 7, 2021

I think we should change the docs on "Boundary conditions in discontinuous spaces", where we advise to use geometric boundary conditions, within this PR as well. It's line 568 in https://github.com/firedrakeproject/firedrake/blob/wence/feature/no-geom-bcs/docs/source/variational-problems.rst.

@ReubenHill
Copy link
Contributor

I see I've been asked to review - I don't actually know much about how boundary conditions work in firedrake so don't quite feel I am able to comment usefully at the moment. Perhaps if you were to make Sophia's suggested change I might be able to start somewhere with the review?

It's also now quite clear to me why this change as been made in either the description of the PR or the commit that makes the depreciation. Could you please add some context?

@wence-
Copy link
Contributor Author

wence- commented Apr 14, 2021

@ScottMacLachlan have you had a chance to look at this? It would even be useful to have a testcase that you've been using.

@ScottMacLachlan
Copy link
Contributor

I now get an error in my call to MeshHierarchy, on a mesh read in from gmesh:

  File "simpleTestSandwich.py", line 52, in <module>
    mh = MeshHierarchy(base, 1)
  File "/gpfs/fs0/scratch/s/scottmac/scottmac/April_2021/firedrake/src/firedrake/firedrake/mg/mesh.py", line 140, in MeshHierarchy
    meshes = [mesh] + [mesh_builder(dm, dim=mesh.ufl_cell().geometric_dimension(),
  File "/gpfs/fs0/scratch/s/scottmac/scottmac/April_2021/firedrake/src/firedrake/firedrake/mg/mesh.py", line 140, in <listcomp>
    meshes = [mesh] + [mesh_builder(dm, dim=mesh.ufl_cell().geometric_dimension(),
  File "/gpfs/fs0/scratch/s/scottmac/scottmac/April_2021/firedrake/lib/python3.8/site-packages/decorator.py", line 231, in fun
    return caller(func, *(extras + args), **kw)
  File "/gpfs/fs0/scratch/s/scottmac/scottmac/April_2021/firedrake/src/PyOP2/pyop2/profiling.py", line 60, in wrapper
    return f(*args, **kwargs)
  File "/gpfs/fs0/scratch/s/scottmac/scottmac/April_2021/firedrake/src/firedrake/firedrake/mesh.py", line 1711, in Mesh
    topology = MeshTopology(plex, name=name, reorder=reorder,
  File "/gpfs/fs0/scratch/s/scottmac/scottmac/April_2021/firedrake/lib/python3.8/site-packages/decorator.py", line 231, in fun
    return caller(func, *(extras + args), **kw)
  File "/gpfs/fs0/scratch/s/scottmac/scottmac/April_2021/firedrake/src/PyOP2/pyop2/profiling.py", line 60, in wrapper
    return f(*args, **kwargs)
  File "/gpfs/fs0/scratch/s/scottmac/scottmac/April_2021/firedrake/src/firedrake/firedrake/mesh.py", line 700, in __init__
    dmcommon.label_facets(plex, label_boundary=label_boundary)
  File "firedrake/cython/dmcommon.pyx", line 994, in firedrake.cython.dmcommon.label_facets
RuntimeError: 63

Any ideas?

@wence-
Copy link
Contributor Author

wence- commented Apr 16, 2021

Can you provide the .geo?

@ScottMacLachlan
Copy link
Contributor

Can you provide the .geo?

Here it is (extension changed to allow attachment)...
sandwichUniform_h=005_geo.txt

@wence-
Copy link
Contributor Author

wence- commented Apr 16, 2021

This works forr me. I think that you didn't rebuild the Cython extensions in Firedrake after checking out the branch? If you have a separate PETSc, run make in the firedrake source directory, otherwise run firedrake-update after selecting this branch.

@ScottMacLachlan
Copy link
Contributor

You're right (of course). After running make, I get identical output for my test problem using DirichletBC to what I got using the old InteriorBC workaround. Thanks!

@ScottMacLachlan
Copy link
Contributor

FWIW, most of the code changes are in places where I'm not qualified to judge correctness. What I do understand, however, looks good to me...

wence- added 10 commits May 5, 2021 10:26
Provide DeprecationWarning in the top-level constructors.
PETSc errors if a label contains points that are not in the index
range. This is preparation for "completing" facet labels such that
they mark everything in their closure.
We are going to "complete" labels to contain points in their closure,
so we must filter the label stratum by points that fall in a given
mesh stratum (for example only facet points).
Should no longer be necessary.
This will be used for grabbing DirichletBC nodes from section data.
The magic method forwarding doesn't work in this case because we
really want to pass "self" into the shared data boundary_node
extraction (not self.topological).
Now that we're only handling topological boundary conditions, we can
just inspect the section of the function space to determine which
nodes to mask out. This also enables us to easily support constraining
dofs that live on interior facets, so do that too.

Fixes #1661, #1135.
@wence- wence- force-pushed the wence/feature/no-geom-bcs branch from f993f57 to ee86830 Compare May 5, 2021 09:43
@wence-
Copy link
Contributor Author

wence- commented May 5, 2021

I think we should change the docs on "Boundary conditions in discontinuous spaces", where we advise to use geometric boundary conditions, within this PR as well. It's line 568 in https://github.com/firedrakeproject/firedrake/blob/wence/feature/no-geom-bcs/docs/source/variational-problems.rst.

I did this, thanks.

sv2518
sv2518 previously approved these changes May 5, 2021
Copy link
Contributor

@sv2518 sv2518 left a comment

Choose a reason for hiding this comment

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

LGTM

@wence-
Copy link
Contributor Author

wence- commented May 6, 2021

Added a very simple test @ScottMacLachlan do you want to sanity-check?

I also updated the triplot function to colour interior mesh markers as well, @danshapero does that look sane?

Copy link
Contributor

@ScottMacLachlan ScottMacLachlan left a comment

Choose a reason for hiding this comment

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

Looks good to me, and works for my test case

@danshapero
Copy link
Contributor

The plotting changes look good. I also tried it out with an unstructured quad mesh and everything looked fine there too.

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.

5 participants