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

How to cancel the warning #2415

Closed
xiaodizhang29 opened this issue Apr 18, 2022 · 2 comments
Closed

How to cancel the warning #2415

xiaodizhang29 opened this issue Apr 18, 2022 · 2 comments

Comments

@xiaodizhang29
Copy link
Contributor

xiaodizhang29 commented Apr 18, 2022

Hello, everyone! When I run the example of Stokes equations with PressureFixBC, it always give some warnings. I want to cancel it, could you give some comments.

/home/firedrake/firedrake/src/firedrake/firedrake/bcs.py:277: DeprecationWarning: Selecting a bcs method is deprecated. Only topological association is supported
  warnings.warn("Selecting a bcs method is deprecated. Only topological association is supported",
# We fix the pressure at one vertex on every level
class PressureFixBC(DirichletBC):
    def __init__(self, V, val, subdomain, method="topological"):
        super().__init__(V, val, subdomain, method)
        sec = V.dm.getDefaultSection()
        dm = V.mesh().topology_dm

        coordsSection = dm.getCoordinateSection()
        dim = dm.getCoordinateDim()
        coordsVec = dm.getCoordinatesLocal()

        (vStart, vEnd) = dm.getDepthStratum(0)
        indices = []
        for pt in range(vStart, vEnd):
            x = dm.getVecClosure(coordsSection, coordsVec, pt).reshape(-1, dim).mean(axis=0)
            if x.dot(x) == 0.0:  # fix [0, 0] in original mesh coordinates (bottom left corner)
                if dm.getLabelValue("pyop2_ghost", pt) == -1:
                    indices = [pt]
                break

        nodes = []
        for i in indices:
            if sec.getDof(i) > 0:
                nodes.append(sec.getOffset(i))

        if V.mesh().comm.rank == 0:
            nodes = [0]
        else:
            nodes = []
        self.nodes = numpy.asarray(nodes, dtype=IntType)

        if len(self.nodes) > 0:
            print("Fixing nodes %s" % self.nodes)
        import sys
        sys.stdout.flush()
@ScottMacLachlan
Copy link
Contributor

I'm not sure what example you're looking at - I can't find the PressureFixBC method in the current repo, and only in one example discussed in Issue #1923 . So, this may not be a Firedrake issue directly, if it isn't in code that we maintain and provide. If you did find this code somewhere in the repository, please do provide a pointer so that we can fix it!

In any case, the root of your problem is that in #2007 , we removed support for the method argument for DirichletBC that this subclasses. Just remove method="topological" from the arguments in the def init(... line above, and method from the arguments in the super().init line, and you shouldn't get the warning anymore.

@xiaodizhang29
Copy link
Contributor Author

Thank you, I have got it.

@wence- wence- closed this as completed Apr 19, 2022
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

No branches or pull requests

3 participants