Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Nov 15, 2023
1 parent cefe2c0 commit 3fcf3e9
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions examples/iota_lens/run_iotalens_sdep.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@
#
# -*- coding: utf-8 -*-

import amrex.space3d as amr
import math

import amrex.space3d as amr
from impactx import ImpactX, distribution, elements

sim = ImpactX()
Expand Down Expand Up @@ -47,21 +48,21 @@
tune_advance = 0.3
c_parameter = 0.01
t_strength = 0.4
ds = lens_length/num_lenses
ds = lens_length / num_lenses

# drift elements
ds_half = ds/2.0
ds_half = ds / 2.0
dr = elements.Drift(ds=ds_half)

# define the nonlinear lens segments
for j in range(0,num_lenses):
s = -lens_length/2.0 + ds_half + j*ds
beta = 1.0 + 4.0*s**2*math.tan(math.pi*tune_advance)**2/lens_length**2
knll_s = t_strength*c_parameter**2*ds/beta
cnll_s = c_parameter*math.sqrt(beta)
nllens = elements.NonlinearLens(knll=knll_s, cnll=cnll_s)
segments = [dr, nllens, dr]
sim.lattice.extend(segments)
for j in range(0, num_lenses):
s = -lens_length / 2.0 + ds_half + j * ds
beta = 1.0 + 4.0 * s**2 * math.tan(math.pi * tune_advance) ** 2 / lens_length**2
knll_s = t_strength * c_parameter**2 * ds / beta
cnll_s = c_parameter * math.sqrt(beta)
nllens = elements.NonlinearLens(knll=knll_s, cnll=cnll_s)
segments = [dr, nllens, dr]
sim.lattice.extend(segments)

# run simulation
sim.evolve()
Expand Down

0 comments on commit 3fcf3e9

Please sign in to comment.