Re: [firedrake] Laplace equation on subdomain
Hi Tomasz, I have just put in a pull request fixing your problem. In essence, you were only applying half of the indicator function fix. In order to correctly use indicator functions to solve problems over a subdomain, it is necessary to *both* use the custom boundary condition to force the solution in the rest of the domain to zero *and* multiply the integrands in your forms by the indicator function. You were only doing the former and not the latter. Making this fix causes the error to drop to 10^-5. I haven't done a convergence test to check that the error converges at the right rate, but you should really do so. Regards, David On Tue, 19 Apr 2016 at 11:52 Tomasz Salwa [RPG] <mmtjs@leeds.ac.uk> wrote:
Hi David,
Here's the code:
https://bitbucket.org/mmtjs/laplace_extended_domain
It's roughly the same as before, just with a gmsh-generated mesh.
Regards,
Tomasz
------------------------------ *From:* firedrake-bounces@imperial.ac.uk <firedrake-bounces@imperial.ac.uk> on behalf of David Ham <David.Ham@imperial.ac.uk> *Sent:* 19 April 2016 09:54 *To:* firedrake
*Subject:* Re: [firedrake] Laplace equation on subdomain Hi Tomasz,
Can you please post the code you are using for this (preferably by pointing us to a git repo we can clone). I can't diagnose what is going wrong just by looking at the visualisation, I'm afraid.
Regards,
David
On Mon, 18 Apr 2016 at 12:12 Tomasz Salwa [RPG] <mmtjs@leeds.ac.uk> wrote:
Hi,
I plotted the difference between analytical and numerical solutions (see attached). It doesn't converge to the right solution with mesh refinement. Is it possible that the Neumann BC is not applied at the interface during the computation, although the extended Dirichlet BCs enforce resulting zero solution beyond the fluid subdomain?
Cheers, Tomasz
________________________________________ From: firedrake-bounces@imperial.ac.uk <firedrake-bounces@imperial.ac.uk> on behalf of Lawrence Mitchell <lawrence.mitchell@imperial.ac.uk> Sent: 15 April 2016 16:00 To: firedrake@imperial.ac.uk Subject: Re: [firedrake] Laplace equation on subdomain
On 15 Apr 2016, at 15:54, Tomasz Salwa [RPG] <mmtjs@leeds.ac.uk> wrote:
Hi David,
It works partially, i.e. the nodes beyond the fluid subdomain are "turned off" now, but it looks like the interface is "smeared". I suspect that the assembled matrix's entries involve also integration over elements one layer beyond the subdomain boundary. Is it possible to exclude them?
If you have neumann conditions on your subdomain boundary you've only constrained the gradient of the solution. Therefore on the boundary nodes you may have non-zero solution values.
Because the domain you visualise in paraview extends outside the subdomain you'll have (in 1D) something like:
........ \............ ^ boundary node
Note how the cell at the boundary has a non-zero coefficient value are one end, but a zero value at the other (assuming piecewise liners). Paraview will linearly interpolate this basis function when visualising, which may be the artefact you're seeing.
Can you construct an analytic solution and determine that you converge at the correct rate as you refine the mesh? This is a safer test than eyeballing the solution.
Lawrence
Hi David, Thank you, now it converges properly. However, I noticed that the error depends on the mesh resolution beyond the fluid subdomain, which I think should not be the case (at least when I refine it in x direction). Perhaps the solution is ok, but the source is in the way I impose the analytical one, or compute the error. Can you diagnose this? Bitbucket's repo is updated. Regards, Tomasz ________________________________ From: firedrake-bounces@imperial.ac.uk <firedrake-bounces@imperial.ac.uk> on behalf of David Ham <David.Ham@imperial.ac.uk> Sent: 20 April 2016 10:05 To: firedrake Subject: Re: [firedrake] Laplace equation on subdomain Hi Tomasz, I have just put in a pull request fixing your problem. In essence, you were only applying half of the indicator function fix. In order to correctly use indicator functions to solve problems over a subdomain, it is necessary to *both* use the custom boundary condition to force the solution in the rest of the domain to zero *and* multiply the integrands in your forms by the indicator function. You were only doing the former and not the latter. Making this fix causes the error to drop to 10^-5. I haven't done a convergence test to check that the error converges at the right rate, but you should really do so. Regards, David On Tue, 19 Apr 2016 at 11:52 Tomasz Salwa [RPG] <mmtjs@leeds.ac.uk<mailto:mmtjs@leeds.ac.uk>> wrote: Hi David, Here's the code: https://bitbucket.org/mmtjs/laplace_extended_domain It's roughly the same as before, just with a gmsh-generated mesh. Regards, Tomasz ________________________________ From: firedrake-bounces@imperial.ac.uk<mailto:firedrake-bounces@imperial.ac.uk> <firedrake-bounces@imperial.ac.uk<mailto:firedrake-bounces@imperial.ac.uk>> on behalf of David Ham <David.Ham@imperial.ac.uk<mailto:David.Ham@imperial.ac.uk>> Sent: 19 April 2016 09:54 To: firedrake Subject: Re: [firedrake] Laplace equation on subdomain Hi Tomasz, Can you please post the code you are using for this (preferably by pointing us to a git repo we can clone). I can't diagnose what is going wrong just by looking at the visualisation, I'm afraid. Regards, David On Mon, 18 Apr 2016 at 12:12 Tomasz Salwa [RPG] <mmtjs@leeds.ac.uk<mailto:mmtjs@leeds.ac.uk>> wrote: Hi, I plotted the difference between analytical and numerical solutions (see attached). It doesn't converge to the right solution with mesh refinement. Is it possible that the Neumann BC is not applied at the interface during the computation, although the extended Dirichlet BCs enforce resulting zero solution beyond the fluid subdomain? Cheers, Tomasz ________________________________________ From: firedrake-bounces@imperial.ac.uk<mailto:firedrake-bounces@imperial.ac.uk> <firedrake-bounces@imperial.ac.uk<mailto:firedrake-bounces@imperial.ac.uk>> on behalf of Lawrence Mitchell <lawrence.mitchell@imperial.ac.uk<mailto:lawrence.mitchell@imperial.ac.uk>> Sent: 15 April 2016 16:00 To: firedrake@imperial.ac.uk<mailto:firedrake@imperial.ac.uk> Subject: Re: [firedrake] Laplace equation on subdomain
On 15 Apr 2016, at 15:54, Tomasz Salwa [RPG] <mmtjs@leeds.ac.uk<mailto:mmtjs@leeds.ac.uk>> wrote:
Hi David,
It works partially, i.e. the nodes beyond the fluid subdomain are "turned off" now, but it looks like the interface is "smeared". I suspect that the assembled matrix's entries involve also integration over elements one layer beyond the subdomain boundary. Is it possible to exclude them?
If you have neumann conditions on your subdomain boundary you've only constrained the gradient of the solution. Therefore on the boundary nodes you may have non-zero solution values. Because the domain you visualise in paraview extends outside the subdomain you'll have (in 1D) something like: ........ \............ ^ boundary node Note how the cell at the boundary has a non-zero coefficient value are one end, but a zero value at the other (assuming piecewise liners). Paraview will linearly interpolate this basis function when visualising, which may be the artefact you're seeing. Can you construct an analytic solution and determine that you converge at the correct rate as you refine the mesh? This is a safer test than eyeballing the solution. Lawrence
participants (2)
- 
                
                David Ham
- 
                
                Tomasz Salwa [RPG]