Hi David,
That isn’t actually what I’m attempting to do, it was an example (and now that you mention it, a pretty bad example) to show you more or less what I’m doing.
I have attached a PDF with a PDE as a better example to illustrate what I need to do (though the problem is still a bit contrived). If you go down to where “g” is defined, you will see
my conundrum, because I need to use the interpolater to handle the trigonometric functions, and I don’t want to needlessly separate everything into several expressions, but have it all just be “g”, which I can then easily insert into my linear form (the main
reason for this is because the actual problem I’m working on has a lot of automation in the code, and I don’t want to needlessly complicate things).
Andrew
From: Ham, David A <david.ham@imperial.ac.uk>
Sent: Sunday, March 14, 2021 4:15:38 AM
To: Andrew Hicks <ahick17@lsu.edu>; firedrake <firedrake@imperial.ac.uk>
Subject: Re: Interpolate function only on the boundary
Hi Andrew,
Interpolating facet expressions doesn’t work as the interpolation code works cell-wise.
However, can I ask more generally what you are attempting to do? I think dot(nu,nu)=1 on the boundary so I don’t quite understand what you are trying to achieve.
It is possible to project expressions defined only on the boundary, or to use them directly in boundary conditions, but I think we’d need to see what maths you are attempting to achieve in order to be able to say how
to do it.
Cheers,
David
From: firedrake-bounces@imperial.ac.uk <firedrake-bounces@imperial.ac.uk> on behalf of Andrew Hicks <ahick17@lsu.edu>
Date: Sunday, 14 March 2021 at 04:59
To: firedrake <firedrake@imperial.ac.uk>
Subject: [firedrake] Interpolate function only on the boundary
Dear all,
I am wanting to interpolate an expression involving the FacetNormal, but when I execute the following code:
V = FunctionSpace(mesh,’CG’,1)
nu = FacetNormal(mesh)
g = interpolate(dot(nu,nu),V)
Of course I get an AssertionError because the FacetNormal is only defined on the exterior facets of the mesh, and not the interior. My question is, is there perhaps a way to make “g” to be defined
as “dot(nu,nu)” on the boundary, and 0 everywhere else? I bet this would work well. Or maybe there is a way to define “g” only on the boundary?
Andrew Hicks