B field from wire current

General discussion about Elmer
WidderElmer
Posts: 6
Joined: 30 Jan 2024, 12:29
Antispam: Yes

B field from wire current

Post by WidderElmer »

I am trying to solve what I thought would be an easy test case to look at the magnetic field around a wire with current running through it, in 3D. I was able to solve this problem in 2D but for some reason I am not getting any kind of solution for 3D.
I have attempted several types of boundary conditions, body forces, etc... but nothing is converging.
Attached is a zip file of the mesh, SIF etc... Any advice on how to get started is greatly appreciated.
I should mention that I am a very new user of Elmer so I may have missed something very basic.
Thanks
Marc
Attachments
Magfield_from_wire_current.zip
(466.07 KiB) Downloaded 50 times
kevinarden
Posts: 2418
Joined: 25 Jan 2019, 01:28
Antispam: Yes

Re: B field from wire current

Post by kevinarden »

Whenever post is solver 1 and magdyn is solver 2, post goes first before magdyn runs. So it is trying to calculate the fields before the whitney solver runs
WidderElmer
Posts: 6
Joined: 30 Jan 2024, 12:29
Antispam: Yes

Re: B field from wire current

Post by WidderElmer »

Kevin,
I swapped the solver order but I'm getting the same error (that I should have already mentioned)
"DirichletAfromB: Floodfall failing"
Thanks
Marc
kevinarden
Posts: 2418
Joined: 25 Jan 2019, 01:28
Antispam: Yes

Re: B field from wire current

Post by kevinarden »

I ran it and received the same error, not seen that error before
floodfill is a programming function to fill an array typically by area.

It must have something to do with the BCs

These BCs do not throw the error

Boundary Condition 1
Target Boundaries(3) = 4 5 6
Name = "cube_4_faces"
AV {e} = real 0
End

Boundary Condition 2
Target Boundaries(1) = 1
AV {e} = real 1
end

Boundary Condition 3
Target Boundaries(1) = 2
AV {e} = real 0
end
raback
Site Admin
Posts: 4851
Joined: 22 Aug 2009, 11:57
Antispam: Yes
Location: Espoo, Finland
Contact:

Re: B field from wire current

Post by raback »

Hi,

Yes, the primary field for the solver is the vector potential. If we want to set magnetic flux density directly the code needs to do some non-trivial bookkeeping since the value of flux density is obtained by looping over element edges. In this case no value for AV was given so where should the code start flooding the BCs.

I would recommend looking at the test cases with "wire" e.g.
lmeruser@elmer-VirtualBox:~/Source/elmerfem/fem/tests$ ls | grep wire
mgdyn_steady_wire
mgdyn_steady_wire2
mgdyn_steady_wire_conforming
mgdyn_steady_wire_periodic

These have been verified against analytical solutions.

-Peter
WidderElmer
Posts: 6
Joined: 30 Jan 2024, 12:29
Antispam: Yes

Re: B field from wire current

Post by WidderElmer »

Kevin,
I am getting results now!
Thanks

Peter,
I appreciate the input and I'll go look at some of the test cases.
Thanks

Marc
WidderElmer
Posts: 6
Joined: 30 Jan 2024, 12:29
Antispam: Yes

Re: B field from wire current

Post by WidderElmer »

Peter,
I have been looking at the mgdyn_stead_wire test case and I have a few questions. If you have a moment, any input is appreciated. Note that I mapped this test case to the GUI format as I am not familiar with the non-GUI method.
1) I am not sure why a body force is needed when the current coil is specified, this is probably a basic lack of Elmer understanding on my part
2) The body force specifies "CoilPot", but I don't see where this variable is identified. When I ran with the GUI this caused an error. I added a body force and specified the Electric Potential as "1", but I am not sure if this is equivalent.
3) I believe specifying AV {e} "X" = 0 (where "X" is 1, 2 or 3) is stating that the electric field potential in the "X" direction is zero. This kind of makes sense at the outer boundary but I am having trouble understanding how the E-field potential is zero at the surface of the wire or at the entire ends of the boundary that the end of the wire is on. I am also not sure what the general AV = 0 means (no 1, 2 or 3 direction specified)

I have some follow up questions on the scaling and results, but I don't want to throw too many questions out at one time.

General comment. I believe most of the folks posting are not native English speakers. I really appreciate (and I am fortunate) that you are able to post in English, on top of the help in general.

Thanks
Marc
raback
Site Admin
Posts: 4851
Joined: 22 Aug 2009, 11:57
Antispam: Yes
Location: Espoo, Finland
Contact:

Re: B field from wire current

Post by raback »

Hi Marc,

The AVSolver is a beast where "A" refers to vector potential and "V" to scalar potential. They are solved at the same time and the field is thus called "AV". The solution is actually a vector where "A" is defined on edges (on the lowest order elements) and "V" nodes. The edge basis is Hcurl conforming which is essential for 3D electromagnetics in order to have proper BCs. There is no components for (x,y,z) direction. Intead the field is always defined only in the direction of the element edge. To separate between the standard nodal dofs and the edge dofs we use naming convention where "AV = 0" sets the nodes and "AV {e} = 0" the edges.

One result from the Hcurl conforming basis is that you can at the boundary only define "A" in the tangential direction since all edges are tangential. There is no edge in the surface that would be in the normal direction. Hence setting "AV {e} = 0" sets tangent directions to zero. Setting stuff component-wise make the code do some projections from cartesian directions to edges.

When we define a current density in a wire in a hierarchical manner it is not a result of the coupled AV solution. Then we also can give zero "AV=0" at both ends. If we solve from a coupled system then we cannot do that. You will see differences in the test cases in this regard.

-Peter
WidderElmer
Posts: 6
Joined: 30 Jan 2024, 12:29
Antispam: Yes

Re: B field from wire current

Post by WidderElmer »

Peter,
I see now how AV sets the nodes and AV {e} sets the edges, but confused as to why the AV {e} 1, 2 and 3 terms are needed.
Assuming 1,2 and 3 refer to Cartesian axes, is it the case that BC's are required along Cartesian axes even if the Nodes and element edges are set to zero?
If that is the case it looks like, for this case, that the X, and Y directions (along the face of the defined surfaces) need to be set to 0, whereas the perpendicular Z direction, does not.

Thanks for your time
Marc
mika
Posts: 252
Joined: 15 Sep 2009, 07:44

Re: B field from wire current

Post by mika »

WidderElmer wrote: 07 Jun 2024, 18:42 AV {e} sets the edges, but confused as to why the AV {e} 1, 2 and 3 terms are needed
For the documentation of setting Dirichlet BCs for curl-conforming basis functions see the section F.2.5 of Appendix F:

https://www.nic.funet.fi/pub/sci/physic ... Manual.pdf

As explained there, we have two alternate constructs in forms

AV {e} j = ... (j=1,2,3)

and

AV {e} = ...

The former version is the only construct that works for all types of curl-conforming basis functions. Therefore the latter version is somewhat useless, and it would also be less easy to apply if a nonhomogenous Dirichlet BC were to be created, especially on a curved boundary. That there exist two constructs is an unfortunate situation related to the history of the code.

So, if one uses a basic curl-conforming basis, one may define

AV {e} = ...

and forget giving AV {e} j = ... On the other hand, if one gives

AV {e} j = ...

one doesn't need AV {e} = ... (the code uses AV {e} = 0) by default).
Post Reply