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.

Excluding gradients in non conducting regions of a mesh

More
5 years 1 month ago #1485 by BenWilson94
Hi,

I’m interested in solving eddy current problems with ngsolve. I’ve already done some experiments with magnetostatic problems. Here I know that I can turn off the gradients in the complete domain by specifying a finite element space of the form

fes=HCurl(mesh, order=1, flags={“no grads”:True})

and adding an appropriate regularisation term to the bilinear form.

However, for eddy current problems, I have a conducting region and a non-conducting region. If I used a vector potential formulation, I know that I need to keep the gradients in the conducting region but that are not needed in the non-conducting region. To save on the number of degrees of freedom I would like to turn off the gradients in the non-conducting region. Is this possible through defining an appropriate finite element space that tags a region in the mesh? Or do I need to define two different fes and combine them in someway?

Also, in terms of the local Jacobi preconditioner, can I apply this directly to such problems?

Thanks for your help,

Ben
More
5 years 1 month ago - 5 years 1 month ago #1486 by christopher
Yes there is a feature for that:
Code:
from netgen.csg import * from ngsolve import * ngsglobals.msg_level = 0 geo = CSGeometry() block = OrthoBrick(Pnt(-1,-1,-1), Pnt(1,1,1)) sphere = Sphere(Pnt(0,0,0),0.5) geo.Add((block-sphere).mat("air")) geo.Add(sphere.mat("metal").bc("metalbc")) mesh = Mesh(geo.GenerateMesh()) Draw(mesh) dom_nrs_metal = [1 if mat == "metal" else 0 for mat in mesh.GetMaterials()] order = 3 full_fes = HCurl(mesh, order=order) nograds_fes = HCurl(mesh, order=order, nograds=True) domainwisegrad_fes = HCurl(mesh, order=order, gradientdomains=dom_nrs_metal) ndofs = {"air" : {}, "metal" : {}} for el in domainwisegrad_fes.Elements(VOL): if len(el.dofs) not in ndofs[el.mat]: ndofs[el.mat][len(el.dofs)] = 1 else: ndofs[el.mat][len(el.dofs)] += 1 print(ndofs) print("ndof full = ", full_fes.ndof) print("reduce all = ", nograds_fes.ndof) print("gradient domains =", domainwisegrad_fes.ndof)

Results in
Code:
{'air': {41: 188, 32: 156, 29: 100, 35: 6, 50: 2}, 'metal': {60: 142}} ndof full = 15164 reduce all = 8639 gradient domains = 11124
So you can see, that the gradients are only in the metal and on the boundary to the metal (thats why some of the air elements have some gradients as well). You can ignore the warning about the undocumented flag.
Best
Christopher
Last edit: 5 years 1 month ago by christopher.
Time to create page: 0.146 seconds