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.

Setting a point value

More
2 years 4 months ago #4102 by pbmonk
Setting a point value was created by pbmonk
I have searched the forum, but didn't find this topic.

I am using H1 elements in 2D and want to set my solution to have u=0 at a point in the mesh (I know this is odd but the trace of the solution is H1 on a portion of a curve in 2D and hence talking about a point value is allowed!). I could see two ways but lack a detailed knowledge of BGSpy

1) I thought to tag a single point and use a dirichlet="point" when building the space, but how?
2) or I could use a Lagrange multiplier but don't see how to build the constraint using SymbolicBFI.

Any suggestions would be gratefully received!

Thanks
Peter
More
2 years 4 months ago #4103 by Guosheng Fu
Replied by Guosheng Fu on topic Setting a point value
Peter,

There is a bbnd flag for H1 space, where you can prescribe point values.
You shall add the point in your mesh, and give it a flag. Then, you can set the value using
.Set(***, definedon=mesh.BBoundaries("..."))
See attachment for a minimal example.

Best,
Guosheng
Attachments:
More
2 years 4 months ago #4104 by Guosheng Fu
Replied by Guosheng Fu on topic Setting a point value
Here the point shall be the node of the mesh. I think you can postprocess the mesh to include this point.

If you generate the mesh by hand, you already have the target node id number, then the following line provide this node with a name tag,

mesh.ngmesh.SetCD2Name(id,"name")

This is a co-dimension 2 tag for a point in 2D mesh.

With H1(mesh, dirichlet_bbnd="name"), you are restricting the H1 DOF on this node to be a dirichlet DOF.
More
2 years 4 months ago #4105 by pbmonk
Replied by pbmonk on topic Setting a point value
Thanks!!

Peter
More
2 years 4 months ago - 2 years 4 months ago #4106 by christopher
Replied by christopher on topic Setting a point value
Another note, if you are using the new python-occ interface you can set a name for the vertex in the geometry like with any other shape object (solids, faces, edges) and then call it with the syntax Gousheng posted.
This allows for a nicer syntax for example something like this:
Code:
shape.edges["leftboundary"].vertices.Max(Y).name = "special_vertex" ... u.Set(1, definedon=mesh.BBoundaries("special_vertex"))
Last edit: 2 years 4 months ago by christopher.
Time to create page: 0.194 seconds