Simulation of Metallic Sphere in Uniform Magnetic Field

General discussion about Elmer
kevinarden
Posts: 2317
Joined: 25 Jan 2019, 01:28
Antispam: Yes

Re: Simulation of Metallic Sphere in Uniform Magnetic Field

Post by kevinarden »

The whole case study is here. The 3D meshes are done in Salome.
https://github.com/mrkearden/Uniform-Mag-Field
kevinarden
Posts: 2317
Joined: 25 Jan 2019, 01:28
Antispam: Yes

Re: Simulation of Metallic Sphere in Uniform Magnetic Field

Post by kevinarden »

This is the case with the magnetic field = Bcos(wt)
function.PNG
(210.41 KiB) Not downloaded yet
2dcase.sif
(3.01 KiB) Downloaded 31 times
Tom_B
Posts: 27
Joined: 14 Jun 2023, 12:28
Antispam: Yes

Re: Simulation of Metallic Sphere in Uniform Magnetic Field

Post by Tom_B »

Hi Kevin!

I'm excited to share that I've discovered a way to achieve a perfect homogeneous magnetic field throughout the entire cube! Every point now has a magnetic field strength of 1.

When we fixed the value of the magnetic field on the boundaries, we can notice some instability near them. So, I came up with an idea: instead of imposing the magnetic field directly, I decided to impose the vector potential. And guess what? It worked like a charm! Check out this image to see the perfect result:

Code: Select all

Boundary Condition 1
  Name = "no name"
  Target Boundaries(6) = 1 2 3 4 5 6
  AV {e} 3 = REAL 0
  AV {e} 2 = Variable "Coordinate 1"; REAL MATC "tx/2"
  AV {e} 1 = Variable "Coordinate 2"; REAL MATC "-tx/2"
End
homo_field.PNG
(342.04 KiB) Not downloaded yet
Now, here's where I could use your expertise. I attempted to generate the magnetic field of a magnetic dipole using the same technique. I applied the right values on the boundaries using MATC, but unfortunately, the result is a bit off. I'm wondering if you have any suggestions on how to tweak it to make it work correctly. Any help or ideas you can provide would be greatly appreciated.

Code: Select all

Boundary Condition 1
  Name = "NO name"
  Target Boundaries(6) = 1 2 3 4 5 6
  AV {e} 3 = REAL 0
  AV {e} 2 = Variable "Coordinate"; REAL MATC "(tx(0))/(sqrt(tx(0)^2+tx(1)^2+tx(2)^2)^3)"
  AV {e} 1 = Variable "Coordinate"; REAL MATC "(-tx(1))/(sqrt(tx(0)^2+tx(1)^2+tx(2)^2)^3)"
End
By the way, thanks a ton for sharing the files. You're the best!

Looking forward to your insights.

Warm regards,
Rich_B
Posts: 423
Joined: 24 Aug 2009, 20:18

Re: Simulation of Metallic Sphere in Uniform Magnetic Field

Post by Rich_B »

Hello Tom,

Good work on the mag field!

Would you be able to post a working example of your latest setup, with sif and geometry? It would be very helpful for troubleshooting.

Thanks, Rich.
Tom_B
Posts: 27
Joined: 14 Jun 2023, 12:28
Antispam: Yes

Re: Simulation of Metallic Sphere in Uniform Magnetic Field

Post by Tom_B »

Hey Rich!

I appreciate your prompt response.

I've attached the files to this post for your reference.

I had a question regarding the coordinates tx(0), tx(1), and tx(2) that I believe could be influencing my results. Are these coordinates referring to the x, y, and z axes within the same frame of reference, or do they vary based on the boundary?

To provide some context, the geometry I'm working with is a simple cube measuring 20cm^3.
Attachments
View.PNG
View.PNG (509.84 KiB) Viewed 508 times
YZ_view.PNG
YZ_view.PNG (199.45 KiB) Viewed 508 times
sim6.sif
(2.91 KiB) Downloaded 27 times
Tom_B
Posts: 27
Joined: 14 Jun 2023, 12:28
Antispam: Yes

Re: Simulation of Metallic Sphere in Uniform Magnetic Field

Post by Tom_B »

I wanted to provide some further clarification on my objective. I'm working on generating the magnetic field of a magnetic dipole. aka:

Bx = 3M xz/r^5
By = 3M yz/r^5
Bz = M (3z^2-r^2)/r^5

I've already calculated the vector potential and obtained the following results:
vector potential.PNG
vector potential.PNG (35.41 KiB) Viewed 503 times
In my latest attempt, I exported the data into a CSV file and compared the results( The B from Elmer and the theorical B).

Unfortunately, they were significantly different, which is a bit disappointing.
Last edited by Tom_B on 03 Jul 2023, 17:15, edited 1 time in total.
Rich_B
Posts: 423
Joined: 24 Aug 2009, 20:18

Re: Simulation of Metallic Sphere in Uniform Magnetic Field

Post by Rich_B »

Hello Tom,

I believe that with Variable Coordinates then tx(0), tx(1), and tx(2) refer to x, y, and z in the global frame.

Rich.
Rich_B
Posts: 423
Joined: 24 Aug 2009, 20:18

Re: Simulation of Metallic Sphere in Uniform Magnetic Field

Post by Rich_B »

Hello,

Looking at the ElmerGUI tutorial, Thermal Flow in a Curved Pipe, where the outflow face is placed on angle, the boundary condition is applied to an angled face, like this:
Name = Outflow
Navier-Stokes
Use normal-tangential coordinate system = on
Velocity 2 = 0.0
Velocity 3 = 0.0
Add
New
The use of N-T makes it easier to apply the BC.

Rich.
Tom_B
Posts: 27
Joined: 14 Jun 2023, 12:28
Antispam: Yes

Re: Simulation of Metallic Sphere in Uniform Magnetic Field

Post by Tom_B »

Hey !

I'm a bit confused about something, and I hope you can help me out. When we use N-T, does it involve a change in the frame of reference? And in this particular case, when we have a velocity of 2/3, I'm not sure if it refers to Vy and Vz, or if it corresponds to Vn and Vt?

Tom
Rich_B
Posts: 423
Joined: 24 Aug 2009, 20:18

Re: Simulation of Metallic Sphere in Uniform Magnetic Field

Post by Rich_B »

Hello,

This is from the Elmer Models Manual:
Normal-Tangential Displacement Logical
The Dirichlet conditions for the vector variables may be given in normal-tangential coordinate
system instead of the coordinate axis directed system. The first component will in this case be
the normal component and the components 2; 3 two orthogonal tangent directions.
So tx(0) would be the normal component and tx(1) and tx(2) would be the two tangential components.

Rich.
Post Reply