Forum Message

 

 

We have moved the forum to https://forum.ngsolve.org . This is an archived version of the topics until 05/05/23. All the topics were moved to the new forum and conversations can be continued there. This forum is just kept as legacy to not invalidate old links. If you want to continue a conversation just look for the topic in the new forum.

Notice

The forum is in read only mode.

co-normal value on a 1D surface segment

More
2 years 9 months ago #3846 by Guosheng Fu
Hello, I am trying to hack a co-normal value for 1D surface segment that is needed for a HDG formulation...
Basically, for each line segment on a 1D surface mesh (embedded in a 2D mesh), I want to assign value +1 or -1 to the two nodes of the segment based on its tangential direction.... any suggestion to hack this?
In the 2D surface case, we can do Cross(n, t), but it is not available in 1D.
More
2 years 9 months ago #3847 by Guosheng Fu
Well, I found a not so elegant solution based on orientation of the edge and a SurfaceL2 grid function...
Code:
gfn = GridFunction(Compress(SurfaceL2(mesh, order=1, definedon=mesh.Boundaries("interface")))) count = 0 for e in mesh.Elements(BND): if e.mat=="interface": if e.vertices[0].nr > e.vertices[1].nr: gfn.vec[2*count+1] = 1 else: gfn.vec[2*count+1] = -1 count += 1
More
2 years 9 months ago #3848 by Guosheng Fu
Well, I found a not so elegant solution based on orientation of the edge and a SurfaceL2 grid function...
Code:
gfn = GridFunction(Compress(SurfaceL2(mesh, order=1, definedon=mesh.Boundaries("interface")))) count = 0 for e in mesh.Elements(BND): if e.mat=="interface": if e.vertices[0].nr > e.vertices[1].nr: gfn.vec[2*count+1] = 1 else: gfn.vec[2*count+1] = -1 count += 1
More
2 years 9 months ago #3849 by mneunteufel
Hi Guosheng,

for a 1D-surface in 2D you can use the specialcf.tangential function for the co-normal vector.
Code:
conormal = specialcf.tangential(2)

Best,
Michael
More
2 years 9 months ago #3850 by Guosheng Fu
Hi Michael,

Well, I want a hybrid mixed method on a 1D surface mesh, for this purpose, I need to have a co-normal on the nodes that changes signs when evaluated from neighboring segments.
Since there is no SurfaceHDiv space for 1D, currently, I am simply using SurfaceL2 space for the (scalar) velocity field, and evaluate the surface divergence as
Code:
grad(u).Trace()*t
where t is the tangential vector.
The term that is missing is the transmission condition that enforce back continuity of velocity
Code:
qhat*u*co_n*ds(element_boundary=True"interface")
where qhat is a H1-P1 (hybrid) space on the surface and u is the SurfaceL2 velocity space. You can see that, basically, I need the co-normal direction co_n that is like the normal constant in 1D mesh....
The previous snipt is a way to hack such a co-normal coefficient using P1-SurfaceL2, but I am not confident it will work for all meshes.
Any ideas?

Best,
Guosheng
More
2 years 9 months ago #3851 by mneunteufel
Hi Guosheng,

it is possible to imitate the HDivSurface by using an H1-space and equip it with the tangential vector. E.g. a lowest order HDivSurface could be achieved by
Code:
fesH = H1(mesh, order=1) u,v = fesH.TnT() con = specialcf.tangential(2) u = u*con v = v*con

Then, u and v are co-normal continuous functions on the mesh.

Another idea, similar to your code with the edge orientation, is to use two different specialcf.tangential vectors
Code:
nel = specialcf.tangential() nel_c = specialcf.tangential(consistent=True)

The second one does not change its sign depending from which element you are coming. Thus the product nel*nel_c will be 1 from the one and -1 from the other side. The consistent=True flag is rather new, but it should work also for 1D-surfaces.

Best,
Michael
Time to create page: 0.117 seconds