ubermag / help

Repository for raising issues and requesting help on Ubermag
BSD 2-Clause "Simplified" License
11 stars 3 forks source link

Multiple Particle Setup #188

Closed MichaelSherburne closed 3 years ago

MichaelSherburne commented 3 years ago

Does Ubermag support the ability to setup multiple particles near each other?

marijanbeg commented 3 years ago

Hi @MichaelSherburne, thank you for your question. Yes, this is possible. You can set up this simulation by defining two spherical domains with Ms != 0 in a single mesh and passing it as norm to df.Field. For instance, a code draft would be:

def two_particles(point):
    x, y, z = point
    x1, y1, z1 = 10e-9, 0, 0  # particle 1 centre point
    r1 = 10e-9  # particle 1 radius
    x2, y2, z2 = 30e-9, 0, 0  # particle 2 centre point
    r2 = 10e-9  # particle 2 radius

    if (x - x1)**2 + (y - y1)**2 + (z - z1)**2 <= r1**2:
        return Ms  # inside particle 1  
    elif (x - x2)**2 + (y - y2)**2 + (z - z2)**2 <= r2**2:
        return Ms  # inside particle 2   
    else:
        return 0

mesh = df.Mesh(p1=(0, -10e-9, -10e-9), p2=(40e-9, 10e-9, 10e-9), n=(80, 20, 20))
field = df.Field(mesh, dim=3, value=(0, 0, 1), norm=two_particles)
marijanbeg commented 3 years ago

(I have not tested the code in the previous cell)

MichaelSherburne commented 3 years ago

@marijanbeg

Thank you! Just had to modify the cell step length in mesh to make it work.

Just to check, spaces between particles are considered vacuum regions and coupling between them can still be simulated?

marijanbeg commented 3 years ago

Great, thank you for checking. That is correct - Ms = 0 means particles are surrounded by vacuum and they are coupled via stray field (demagnetisation energy term mm.Demag()).

marijanbeg commented 3 years ago

I will close this issue now, please feel free to reopen :)

marijanbeg commented 3 years ago

Transferred issue to help repo.