- Thank you received: 6
co-normal value on a 1D surface segment
- Guosheng Fu
- Topic Author
- Offline
- Elite Member
Less
More
3 years 4 months ago #3846
by Guosheng Fu
co-normal value on a 1D surface segment was created 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.
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.
- Guosheng Fu
- Topic Author
- Offline
- Elite Member
Less
More
- Thank you received: 6
3 years 4 months ago #3847
by Guosheng Fu
Replied by Guosheng Fu on topic co-normal value on a 1D surface segment
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
- Guosheng Fu
- Topic Author
- Offline
- Elite Member
Less
More
- Thank you received: 6
3 years 4 months ago #3848
by Guosheng Fu
Replied by Guosheng Fu on topic co-normal value on a 1D surface segment
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
- mneunteufel
- Offline
- Premium Member
Less
More
- Thank you received: 59
3 years 4 months ago #3849
by mneunteufel
Replied by mneunteufel on topic co-normal value on a 1D surface segment
Hi Guosheng,
for a 1D-surface in 2D you can use the specialcf.tangential function for the co-normal vector.
Best,
Michael
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
- Guosheng Fu
- Topic Author
- Offline
- Elite Member
Less
More
- Thank you received: 6
3 years 4 months ago #3850
by Guosheng Fu
Replied by Guosheng Fu on topic co-normal value on a 1D surface segment
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
where t is the tangential vector.
The term that is missing is the transmission condition that enforce back continuity of velocity
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
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
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")
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
- mneunteufel
- Offline
- Premium Member
Less
More
- Thank you received: 59
3 years 4 months ago #3851
by mneunteufel
Replied by mneunteufel on topic co-normal value on a 1D surface segment
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
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
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
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.112 seconds