[firedrake] boundary extrema [was: problems with importing a mesh]

G. D. McBain gdmcbain at protonmail.com
Fri Nov 10 04:49:53 GMT 2017


> On 08/11/17 09:13, Lawrence Mitchell wrote:
>
>> On 03/11/17 20:15, Francis Poulin wrote:
>>
>>>  I don't suppose
>>> there is an easy way to find out the maximum of the boundary value in
>>> the numerical solution?
>>
>> If you are imposing strong (Dirichlet) conditions, then the solution
>> on the boundary nodes is, by definition, whatever you set it to.
>> If you have some other means of enforcing boundary conditions and just
>> want to know that the values are on the boundary, you could do:
>> V = FunctionSpace(...)
>> selector = DirichletBC(V, 0, "on_boundary")
>> f = Function(V)
>>
>> solve into f
>>
>> boundary_values = f.dat.data_ro[selector.nodes, ...]
>>
>> Note this assumes that inspecting the point values of your space makes
>> sense: this is fine for CG and DG, not so for other spaces.

Hey, thanks very much!  I didn't realize that the object returned by DirichletBC had a .nodes attribute.  That's much more direct than the procedures in the other codes!  (As usual for Firedrake.)

This is very useful; in gratitude, I attach a simple example from

    Ostroumov, G. A. (1958). Free convection under the conditions of the
    internal problem. Technical Report [NACA-TM](https://wiki.memjet.local/display/lib/NASA+Technical+Memorandum)-1407, NACA, eq. 5.18, p. 34

lap w = -x in the first quadrant of the unit circle with w=0 on perimeter and y-axis and natural boundary conditions on x-axis, where the boundary maximum is to be sought.  The exact solution is w=x(1-x**2-y**2)/8 with maximum w(1/sqrt(3), 0) = 1/12 sqrt(3).

Using the same Gmsh-generated mesh as in the previous thread (again: -clscale 0.0625), but now also marking the x-axis as Physical Line 3, the nodal maximum is found as w=0.048122 at x=0.562500, the value being accurate to the fifth decimal place and the location as good as possible on the mesh.
-------------- next part --------------
HTML attachment scrubbed and removed
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ostroumov.py
Type: text/x-python
Size: 1835 bytes
Desc: not available
URL: <http://mailman.ic.ac.uk/pipermail/firedrake/attachments/20171109/652e7e2a/attachment.py>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: quadrant.geo
Type: application/vnd.dynageo
Size: 332 bytes
Desc: not available
URL: <http://mailman.ic.ac.uk/pipermail/firedrake/attachments/20171109/652e7e2a/attachment.geo>


More information about the firedrake mailing list