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

user defined magnetic profiles via vector potential #745

Open
nicolasaunai opened this issue Sep 18, 2023 · 0 comments
Open

user defined magnetic profiles via vector potential #745

nicolasaunai opened this issue Sep 18, 2023 · 0 comments
Assignees
Milestone

Comments

@nicolasaunai
Copy link
Member

To ensure zero divergence of B with inhomogeneous magnetic user profiles we can't just rely on the prescribed analytical function of have zero divergence. We need to evaluate the function so that it has zero divergence on the Yee grid.

The way to do that is to allow user prescribe the vector potential and calculate magnetic field components as the curl of that vector potential, with a curl operator that knows about the Yee Layout.

So far our profile functions are :

def Bx(x,y):
    return x + 0.1*y # dumb example

we need user to prescribe vector potential components Ax, Ay, Az :

def Az(x,y):
    return x + 0.1*y # dumb example

then the magnetic field functions would be obtained by computing the curl

def Bx(x,y):
    # here do some stuff to get Bx from Ay and Az
    # we need x, y, but also the dx, dy
    # dx and dy are those of the coarsest level since this is only where
   # fields are initialized via python.
   # we need to return:
   # dAy/dz - dAz/dy at x, y.

The simplest and most ergonomic way for the user is probably to give the vector potential to the MaxwellianFluidModel.
So far it only accepts the magnetic field components:

    def __init__(self, bx = None,
                       by = None,
                       bz = None,
                       **kwargs):

but it should also accept ax, ay, az, but if those are provided:

  • they should all 3 be given
  • bx, by, bz can't be provided together with ax, ay, az, they're mutually exclusive.

then MaxwellianFluidInitializer could internally defined bx, by, bz functors that use the vector potential components to get the magnetic field ones from the curl computation without the user having to care...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Do me  👋
Development

No branches or pull requests

2 participants