Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Current density function of a wire in LinearForm in electromagnetism #3953

Open
JianboLong opened this issue Oct 25, 2023 · 8 comments
Open

Comments

@JianboLong
Copy link

JianboLong commented Oct 25, 2023

Hi @mlstowell @tzanio Recently, I'm working with the same problem in solving Maxwell's equation:

Curl mu^{-1} Curl E - omega^2 epsilon E + i omega sigma E = - i omega J

with a tetrahedral mesh. The issue is how to correctly represent the current density function J above. Suppose its a loop wire transmitting a current with the amplitude of 1 Ampere (and with the frequency defined by omega). In this case, the diameter of this physical wire is considered 0 when sigma /= 0 exists everywhere (i.e., diffusive EM field).

Mathematically, the current density function J is only non-zero in the "line-segment" position in the space, as shown here in the attached picture (in 2-D view). In the 3-D space, this line loop will intersect with some tetrahedral cells in the mesh. I believe similar issues have been raised before (see the below quoted reply from Mark to issue #3707, and issues #648 and #632 ). Unfortunately, my question remains as to how best to do this in MFEM ...

If we can somehow find all the intersection points between a line segment and the mesh, then in each of the intersected cells, the linear form of <- i omega J, V> (J and V are vector functions here, V is test function) will be non-zero. In all other cells, the linear form is zero. In this case (I'm not sure if MFEM has such capability to find all intersections), is there a way to construct a vector function for LinearForm, and then use the "standard" way to do the integration (as in below) ?

LinearForm J(fespace);
VectorFunctionCoefficient Jfunc(3, J_line); // This vector function would return -i omega J
J.AddDomainIntegrator(new VectorFEDomainLFIntegrator(Jfunc));
J.Assemble(); /// This step performs the integration you mentioned

Thanks !

          Hi, @Marshdweller,

This is an interesting question and I'm not sure of the best approach. In the past I've modeled wires using a chain of edges. This scheme didn't work that well on unstructured meshes because it's hard to get the scaling correct (the current density appears to span a tube of elements touching the chain of edges). In your case it would require building a specialized mesh for each wire and this doesn't sound practical either.

Normally we view the linear form as an integral over each element of a coefficient multiplied by the basis functions within that element. In this case I might try to look at this from a different perspective. We could try to integrate along the wire rather than over each element. Determine a set of integration points and weights along the wire and use FindPoints to locate the elements containing each integration point. Then loop over the elements returned by FindPoints and evaluate the basis functions within those elements at the quadrature points given by FindPoints. Take the inner product of the basis function values with the current density vector (and the integration weight) at that point and sum the results into the appropriate rows of the LinearForm.

This would require some familiarity with the inner details of basis functions and finite element spaces but I think it could work.

If this does work it might be useful to implement this in a general purpose manner by using a 1D mesh to represent the wire. This will make integration along the wire a little easier (or at least make it look like more standard MFEM). FindPoints has been used before to share information between overlapping meshes and this is quite similar.

Best wishes,
Mark

Originally posted by @mlstowell in #3707 (comment)

CSEM_wire.pdf

@JianboLong JianboLong changed the title Current density function of a wire in LinearForm Current density function of a wire in LinearForm in electromagnetism Oct 25, 2023
@Marshdweller
Copy link

A lot of time passed since I asked the question quoted. Since then I adopted the following approach: construct adaptive mesh such that a wire is represented by a set of edges, then put delta functions at the midpoints.

@JianboLong
Copy link
Author

JianboLong commented Oct 26, 2023

Hi @Marshdweller That's what I did when not using MFEM: using a set of edges in the mesh, which makes things much easier. Could you elaborate more how you did this using MFEM functions ? Did you implement your own integrators ? I'm not particularly familiar with the details of FEM classes.

Thanks !

@Marshdweller
Copy link

@JianboLong

I put VectorDeltaFunction (sorry if I misspell class names, cannot acess the docs atvthe moment) into the LinearForm. You need to specify coordinates of the edge midpoint and the dipole(s) orientation. This procedure activates the global DOF corresponding to that edge. This method is accurate provided you adapt the mesh to the wire. Other methods exist, such as injecting analitical solution into the RHS or replacing a wire with a nonsingular function.

@JianboLong
Copy link
Author

Thanks for the inputs @Marshdweller !

Is the class VectorDeltaCoefficient you were using ? I'm currently testing this but this is just an electric dipole, of course. The key problem is that we have a line current source here. For the first approach, I think it will cause problems when the mesh is refined later. I do like the idea of defining an analytical function for the current density, and then use the above integrators. However, all the examples I can find in Examples (including Tesla and maxwell) are using volumetric current density, which is not the same thing here. Any ideas about this ? Are you aware of any posts and/or examples using line current sources ?

@Marshdweller
Copy link

@JianboLong

This is meshes I use. A wire is broken into a set of edges, each of them approproxomated with a VectorDeltaCoefficient
Uploading IMG-20230907-WA0001.jpg…

@Marshdweller
Copy link

@JianboLong

Sorry for typos in the previous message. This is the image I wanted to share. There are two wires in the mesh, each of which consists of many edges.

image

Copy link

stale bot commented Dec 15, 2023

⚠️ This issue or PR has been automatically marked as stale because it has not had any activity in the last month. If no activity occurs in the next week, it will be automatically closed. Thank you for your contributions.

@JianboLong
Copy link
Author

@Marshdweller Nice picture, thanks ! I've done similar meshing with wire coincident with smaller edges. Could you elaborate how you handled the right-hand-size integration using MFEM functions ?

@stale stale bot removed the stale label Mar 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants