Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
M
mbtrack2
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
PA
Collective Effects
mbtrack2
Commits
df86baf7
Commit
df86baf7
authored
5 months ago
by
Vadim Gubaidulin
Browse files
Options
Downloads
Patches
Plain Diff
Added sceleton code for integrated Green function approach of J. Qiang
parent
33232056
No related branches found
No related tags found
1 merge request
!35
2D Particle-in-cell solver
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
mbtrack2/pic/pic2d.py
+26
-0
26 additions, 0 deletions
mbtrack2/pic/pic2d.py
with
26 additions
and
0 deletions
mbtrack2/pic/pic2d.py
+
26
−
0
View file @
df86baf7
...
@@ -50,11 +50,37 @@ class PICSolver2D:
...
@@ -50,11 +50,37 @@ class PICSolver2D:
self
.
phi
=
np
.
fft
.
ifft2
(
phi_hat
,
s
=
(
self
.
nx
,
self
.
ny
)).
real
self
.
phi
=
np
.
fft
.
ifft2
(
phi_hat
,
s
=
(
self
.
nx
,
self
.
ny
)).
real
def
_compute_integrated_green_function
(
self
,
x
,
y
):
return
1
/
(
4
*
np
.
pi
*
epsilon_0
)
*
(
-
3
*
x
*
y
+
x
*
x
*
np
.
arctan2
(
y
,
x
)
+
y
*
y
*
np
.
arctan2
(
x
,
y
)
+
x
*
y
*
np
.
log
(
x
*
x
+
y
*
y
))
def
poisson_solver_2d_green
(
self
):
def
poisson_solver_2d_green
(
self
):
"""
"""
Solves the 2D Poisson equation with open boundary contitions using
Solves the 2D Poisson equation with open boundary contitions using
integrated Green
'
s function approach. Following ...
integrated Green
'
s function approach. Following ...
"""
"""
rho
=
np
.
zeros
((
2
*
self
.
nx
,
2
*
self
.
ny
))
rho
[:
self
.
rho
.
shape
[
0
],
:
self
.
rho
.
shape
[
1
]]
=
self
.
rho
rho_hat
=
np
.
fft
.
fft2
(
rho
,
s
=
(
2
*
self
.
nx
,
2
*
self
.
ny
))
green_function
=
np
.
zeros
((
2
*
self
.
nx
,
2
*
self
.
ny
))
X
,
Y
=
np
.
meshgrid
([
np
.
linspace
(
self
.
x_min
,
self
.
x_max
,
self
.
nx
),
np
.
linspace
(
self
.
y_min
,
self
.
y_max
,
self
.
ny
)
])
green_function0
=
self
.
_compute_integrated_green_function
(
self
,
X
,
Y
)
green_function
[:
self
.
nx
,
:
self
.
ny
]
=
green_function0
green_function
[
self
.
nx
:,
:
self
.
ny
]
=
green_function0
[::
-
1
,
:]
green_function
[:
self
.
nx
,
self
.
ny
:]
=
green_function0
[:,
::
-
1
]
green_function
[
self
.
nx
:,
self
.
ny
:]
=
green_function0
[::
-
1
,
::
-
1
]
green_hat
=
np
.
fft
.
fft2
(
green_function
,
s
=
(
2
*
self
.
nx
,
2
*
self
.
ny
))
self
.
phi
=
np
.
fft
.
ifft2
(
green_hat
*
rho_hat
,
s
=
(
2
*
self
.
nx
,
2
*
self
.
ny
)).
real
[:
self
.
nx
,
:
self
.
ny
]
def
calculate_electric_field
(
self
):
def
calculate_electric_field
(
self
):
E_x
,
E_y
=
np
.
gradient
(
-
self
.
phi
,
self
.
dx
,
self
.
dy
)
E_x
,
E_y
=
np
.
gradient
(
-
self
.
phi
,
self
.
dx
,
self
.
dy
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment