parameters: (plasma, phi, N=0, nu=0, c1=0, arak=0, kappa=0, dt=0)
return_statement: return math.Dict(density=n, omega=o, phi=phi, age=plasma.age + dt, dx=plasma.dx)
docstring: time gradient of model
docstring_summary: time gradient of model
docstring_tokens: time gradient of model
function: 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)
function_tokens: 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 )