[firedrake] problems with importing a mesh

Homolya, Miklós m.homolya14 at imperial.ac.uk
Fri Nov 3 15:39:23 GMT 2017


These look like the optional type annotations. I think they were introduced in Python 3.6, while Firedrake requires Python 3.5+


You are probably running Python 3.5.x then. Just remove those colon types, or alternatively try Python 3.6.

________________________________
From: firedrake-bounces at imperial.ac.uk <firedrake-bounces at imperial.ac.uk> on behalf of Francis Poulin <fpoulin at uwaterloo.ca>
Sent: 03 November 2017 15:11:34
To: G. D. McBain
Cc: firedrake
Subject: Re: [firedrake] problems with importing a mesh


Thanks for all the helpful information.  I am starting to understand but not quiet there yet.


I was able to generate the mesh but when I try running your script I get the following problem. Is there a different syntax we should be using?


(firedrake) fpoulin at domlt32:~/Dropbox/Research_Christine/Notebooks/TestGeometry$ python membrane.py quadrant.msh

  File "membrane.py", line 11

    def main(meshfile: str) -> None:

                     ^

SyntaxError: invalid syntax



What I understand is I should be specifying a label to the boundary and use this label to impose the BC's.  I tried importing your geometry into my notebook and that seemed to go okay but when I try plotting I get the Assertion error.


Any more help would be greatly appreciated.



------------------
Francis Poulin
Associate Dean, Undergraduate Studies
Associate Professor
Department of Applied Mathematics
University of Waterloo

email:           fpoulin at uwaterloo.ca
Web:            https://uwaterloo.ca/poulin-research-group/
Telephone:  +1 519 888 4567 x32637



________________________________
From: G. D. McBain <gdmcbain at protonmail.com>
Sent: Friday, November 3, 2017 2:09 AM
To: Francis Poulin
Cc: firedrake at imperial.ac.uk
Subject: Re: [firedrake] problems with importing a mesh



I am curious to see what you find does the trick.

It seems that my warning was obsolete.  Whereas, I find from my old notes, that failure label each part of the boundary in Gmsh raised:

    AssertionError: Every marker has to be contained in unique_markers

and in Feb. 2016, L. M. wrote: ‘If you provide a marker for one of the external boundaries of your mesh, you need to do so for all of them.’

https://mailman.ic.ac.uk/mailman/htdig/firedrake/2016-February/001809.html

I find today that this isn't the case.  I hadn't noticed this being fixed as I'd simply complied by labelling everything.  Anyway thank you to whoever fixed that, in Firedrake or upstream.


As for my coastline problem, the good news is that I can now import the geometry.  The bad news is  that when I solve the weak for of the PDE it does not impose the Dirichlet BCs.

So to satisfy myself of the above, I prepared a simple example with a Dirichlet condition on part of the boundary and natural conditions on the rest.  The same technique might work for your problem.

Consider the plane Poisson equation with constant unit forcing on a circle with homogeneous Dirichlet conditions, but exploiting two lines of symmetry using just a quadrant with natural conditions on the two radii.  The exact answer on the circle is that the integral of the solution divided by the square of the area should be 1/8 pi, or four times on the quarter-model, so 1/2pi.

%<---quadrant.geo
Point(1) = {1, 0, 0, 1.0};
Point(2) = {0, 0, 0, 1.0};
Point(3) = {0, 1, 0, 1.0};
Circle(1) = {1, 2, 3};

Line(2) = {3, 2};
Line(3) = {2, 1};
Line Loop(1) = {1, 2, 3};

Plane Surface(1) = {1};

Physical Surface("membrane", 2) = {1};
Physical Line("rim", 1) = {1};
--->%

Note that the last line specifies the quarter-circle perimeter from "Circle(1)" but not the radii of symmetry "Line(2)" or "Line(3)".

The Dirichlet boundary condition is imposed on the perimeter of the circle using "[1]" for the 1 of the Physical Line:

    bc = DirichletBC(V, 0.0, [1])

Running this with

$ gmsh -2 -clscale 6.25e-2 quadrant.geo
$ python membrane.py quadrant.msh

I get 0.15905285125 which is 1/2 pi to four decimal places.

-------------- next part --------------
HTML attachment scrubbed and removed


More information about the firedrake mailing list