(plasma, phi, N=0, nu=0, c1=0, arak=0, kappa=0, dt=0)
return math.Dict(density=n, omega=o, phi=phi, age=plasma.age + dt, dx=plasma.dx)
time gradient of model
time gradient of model
time gradient of model
def step_gradient_2d(plasma, phi, N=0, nu=0, c1=0, arak=0, kappa=0, dt=0):
    """time gradient of model"""
    # Calculate Gradients
    grad_phi = field.spatial_gradient(phi, stack_dim=channel("gradient"))
    dx_p, dy_p = grad_phi.values.gradient.unstack_spatial("x,y")
    # Get difference
    diff = phi - plasma.density
    # Step 2.1: New Omega.
    o = c1 * diff
    if arak:
        o += -arak * math._nd._periodic_2d_arakawa_poisson_bracket(
            phi.values, plasma.omega.values, plasma.dx  # TODO: Fix dx
        )
    if nu and N:
        o += nu * diffuse(plasma.omega, N=N, dx=plasma.dx)
    # Step 2.2: New Density.
    n = c1 * diff
    if arak:
        n += -arak * math._nd._periodic_2d_arakawa_poisson_bracket(
            phi.values, plasma.density.values, plasma.dx
        )
    if kappa:
        n += -kappa * dy_p
    if nu:
        n += nu * diffuse(plasma.density, N=N, dx=plasma.dx)
    return math.Dict(density=n, omega=o, phi=phi, age=plasma.age + dt, dx=plasma.dx)
def step_gradient_2d ( plasma , phi , N = 0 , nu = 0 , c1 = 0 , arak = 0 , kappa = 0 , dt = 0 ) : # Calculate Gradients grad_phi = field . spatial_gradient ( phi , stack_dim = channel ( "gradient" ) ) dx_p , dy_p = grad_phi . values . gradient . unstack_spatial ( "x,y" ) # Get difference diff = phi - plasma . density # Step 2.1: New Omega. o = c1 * diff if arak : o += - arak * math . _nd . _periodic_2d_arakawa_poisson_bracket ( phi . values , plasma . omega . values , plasma . dx # TODO: Fix dx ) if nu and N : o += nu * diffuse ( plasma . omega , N = N , dx = plasma . dx ) # Step 2.2: New Density. n = c1 * diff if arak : n += - arak * math . _nd . _periodic_2d_arakawa_poisson_bracket ( phi . values , plasma . density . values , plasma . dx ) if kappa : n += - kappa * dy_p if nu : n += nu * diffuse ( plasma . density , N = N , dx = plasma . dx ) return math . Dict ( density = n , omega = o , phi = phi , age = plasma . age + dt , dx = plasma . dx )