- Thank you received: 0
integrals and normals on subdomain boundaries
5 years 6 months ago #1577
by NilsHM
integrals and normals on subdomain boundaries was created by NilsHM
Hello everyone!
1.
I want to integrate a CoefficientFunction over the boundary of a subdomain of the mesh. The subdomain is defined as a material.
Does
Integrate(cf, mesh, BND, definedon = mesh.Materials("mat1"))
integrate over the boundary of mat1?
2.
Also I want to create a CoefficientFunction for the normal vector on the boundary of the subdomain. Is there any function that does that? specialcf.normal doesn't seem to be able to do that.
Thanks!
Nils
1.
I want to integrate a CoefficientFunction over the boundary of a subdomain of the mesh. The subdomain is defined as a material.
Does
Integrate(cf, mesh, BND, definedon = mesh.Materials("mat1"))
integrate over the boundary of mat1?
2.
Also I want to create a CoefficientFunction for the normal vector on the boundary of the subdomain. Is there any function that does that? specialcf.normal doesn't seem to be able to do that.
Thanks!
Nils
5 years 6 months ago #1578
by joachim
Replied by joachim on topic integrals and normals on subdomain boundaries
Hi Nils,
We have now a very new BoundaryFromVolumeCF, which does what you need. Copy from the doc-string:
Attached is also a small test-file providing the domain-wise outgoing normal-vector.
In your case, you have to integrate over a boundary-region, which you have to define via boundary condition labels.
Best, Joachim
We have now a very new BoundaryFromVolumeCF, which does what you need. Copy from the doc-string:
Code:
Help on built-in function BoundaryFromVolumeCF in module ngsolve.comp:
BoundaryFromVolumeCF(...) method of builtins.PyCapsule instance
BoundaryFromVolumeCF(vol_cf: ngsolve.fem.CoefficientFunction) -> ngsolve.fem.CoefficientFunction
Allows the evaluation of volumentric functions on the boundary.
When evaluated on a boundary element, this function searches for the associated
volume element, transforms the local coordinates, and evaluates the function in the
volume. A typical use-case is to visualize L2-functions, or mechanical stresses at
the boundary.
It is different to the boundary Trace()-operator. The trace provides a function
which is defined by boundary degrees of freedom only. E.g. the trace of an H(div)
function is only the normal component, while the BoundaryFromVolumeCF gives the
whole function.
If called on an interface, it evaluates from one side (which one is not specified).
If the function is only defined on one side, this side will be taken. One can use
a domain-wise CF to define a function only locally:
uloc = CoefficientFunction( [None, None, u, None] )
Attached is also a small test-file providing the domain-wise outgoing normal-vector.
In your case, you have to integrate over a boundary-region, which you have to define via boundary condition labels.
Best, Joachim
Attachments:
5 years 6 months ago #1579
by NilsHM
Replied by NilsHM on topic integrals and normals on subdomain boundaries
Hi Joachim,
Thanks for the reply.
I downloaded and installed the latest version of NGSolve but BoundaryFromVolumeCF does not exist in my build. How can I install it?
Best regards,
Nils
Thanks for the reply.
I downloaded and installed the latest version of NGSolve but BoundaryFromVolumeCF does not exist in my build. How can I install it?
Best regards,
Nils
5 years 6 months ago #1580
by joachim
Replied by joachim on topic integrals and normals on subdomain boundaries
you need the latest nightly build
5 years 6 months ago #1635
by NilsHM
Replied by NilsHM on topic integrals and normals on subdomain boundaries
Hello Joachim,
I now have a Version of NGSolve with the BoundaryFromVolumeCF function and tried to get the integral over a subdomain boundary to work. It seems like the normal vector CoefficienFunction is zero everywhere. Also the doc is not very helpful. Can you better explain what that function does? Can you add the integral of gfu times the normals vetor over the inner domain boundary in the test file you provided?
That would probably help alot.
Thank you
Nils
I now have a Version of NGSolve with the BoundaryFromVolumeCF function and tried to get the integral over a subdomain boundary to work. It seems like the normal vector CoefficienFunction is zero everywhere. Also the doc is not very helpful. Can you better explain what that function does? Can you add the integral of gfu times the normals vetor over the inner domain boundary in the test file you provided?
That would probably help alot.
Thank you
Nils
5 years 6 months ago #1639
by joachim
Replied by joachim on topic integrals and normals on subdomain boundaries
As usual, you integrate like that
(whole example is attached).
the result is:
Integral = -0.108
-0.108
-1.27277e-17
see also my reply in
ngsolve.org/forum/ngspy-forum/791-functi...vectors-unclear#1638
Joachim
Code:
print ("Integral = ", Integrate(bfv*bfv2, mesh, definedon=mesh.Boundaries("innerbnd")))
the result is:
Integral = -0.108
-0.108
-1.27277e-17
see also my reply in
ngsolve.org/forum/ngspy-forum/791-functi...vectors-unclear#1638
Joachim
Attachments:
The following user(s) said Thank You: NilsHM
Time to create page: 0.103 seconds