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

Trouble with current density inside domain #73

Open
eduardobehr opened this issue Aug 6, 2023 · 6 comments
Open

Trouble with current density inside domain #73

eduardobehr opened this issue Aug 6, 2023 · 6 comments

Comments

@eduardobehr
Copy link

Greetings!

Firstly, I'd like to say I'm very happy to get to learn about this library. Hopefully I'll try to add some contributions in the future.


I'm trying to solve an electromagnetism problem for my thesis based on the magnetodynamics-av-induction-3d, but without time derivatives for now.

The problem consists on a two windings transformer:
image

By applying a voltage potential on the inner windings terminal, we get the expected linearly decaying potential distribution $v$:
image

... and a curl of current density $\vec{J}$:
image

However, the generated solution for the magnetic vector potential $\vec{A}$ and the flux density $\vec{B}$ yield unexpected results:

image

When I tried setting the coil terminals in the domain boundary, I got somewhat close to the expected results. I've also tried defining a curled field $\vec{J}$ on the winding, but it instead got defined everywhere (making even the air conduct the same as the coppers), despite generating a convincing $\vec{B}$ field in the core.

However, by making the windings go from and to the boundary, the mesh and geometry complexity increases manifolds, not only making the simulation take much longer, but also making some glitches in Gmsh/OCC (possibly due to the high number of points to interpolate a pipe on) and making it harder to place one winding inside another.

I've seen some tutorial videos using commercial softwares, in which the windings are just cylinders with a forced current, but I could not get them working in Sparselizard for now.

Is it possible to define a current contained in the domain, and have it generate a magnetic field? How?

Could anybody give me a hint on it? I've attached the project folder below using the same structure as the examples in the repo, in case someone wants to try it out.

EER-core-3d-magnetostatics.tar.gz

@halbux
Copy link
Owner

halbux commented Aug 7, 2023

Hi Eduardo,

I guess you use the spanningtree etc as needed.

It is against Maxwell's equations to have current appearing and disappearing in A-v inside the geometry as in your case: you get this noise magnetic solution because of that. There are ways to cleanly solve your problem with the closed loop without having to cut-open the coils (both for the A-v and for the h-phi) formulations, but that more on the product side Quanscient.allsolve that we sell.

Alternatively, you could try your code without spanningtree (it makes things really sensitive to the appearing currents out of nowhere) and add an extra formulation line:

+= integral(all, 1e-5/mu * dof(A)*tf(A))

I hope this helps!

@eduardobehr
Copy link
Author

Hi Alexandre,

Thanks for your reply. I tried your approach, but it seems the library objectively opposes removing the spanningtree:

terminate called after throwing an instance of 'std::runtime_error'
  what():  Error in 'rawfield' object: spanning tree was not provided to rawfield

The extra formulation line also didn't solve it, unfortunately.

@halbux
Copy link
Owner

halbux commented Aug 8, 2023

That's because you have to also remove the field.setgauge call!

@eduardobehr
Copy link
Author

Removing that call results in a NaN solution.

@UmarWheemo
Copy link

Hi Eduardo,

Was your problem solved ?

Kind regards

@eduardobehr
Copy link
Author

Hi Eduardo,

Was your problem solved ?

Kind regards

Hi Umar,

Unfortunately I could not solve it properly. As a workaround I defined the vector current density field by hand, which is easy for this simple geometry, but not generalized for more complex geometries.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants