Skip to content

Commit

Permalink
Merge pull request #102 from titoiride/titoiride/fix_envelope_bugs
Browse files Browse the repository at this point in the history
Fixed some bugs in particle exchange an x parallelization
  • Loading branch information
titoiride committed Jan 29, 2020
2 parents 72d4d11 + cbc11ec commit 191008c
Show file tree
Hide file tree
Showing 19 changed files with 629 additions and 403 deletions.
45 changes: 24 additions & 21 deletions .github/workflows/main.yml
@@ -1,22 +1,25 @@
name: Docs

on: push

jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Build
id: build
uses: ./
- name: Deploy
if: success()
uses: crazy-max/ghaction-github-pages@v1
with:
target_branch: gh-pages
build_dir: ${{ steps.build.outputs.output_dir }}
env:
GITHUB_PAT: ${{ secrets.PAT }}
name: Docs

on:
push:
branches:
- master

jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Build
id: build
uses: ./
- name: Deploy
if: success()
uses: crazy-max/ghaction-github-pages@v1
with:
target_branch: gh-pages
build_dir: ${{ steps.build.outputs.output_dir }}
env:
GITHUB_PAT: ${{ secrets.PAT }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4 changes: 2 additions & 2 deletions aladyn_doc.md
Expand Up @@ -42,10 +42,10 @@ creation_date: %Y-%m-%d

[Input guide](|url|/page/NAMELIST_GUIDE.html)

@Bug
@warning
ALaDyn code is fully maintained and tested.
Anyway, if while using it you find any bug affecting the code or if you simply
have questions, please feel free to open an issue in the [GitHub page](https://github.com/ALaDyn/ALaDyn/issues).
@endbug
@endwarning

Copyright on the code is by the ALaDyn Collaboration.
6 changes: 3 additions & 3 deletions docs/CHANNELS.md
@@ -1,4 +1,4 @@
## Support channels

We have a Telegram channel to promote latest news: [join here](https://t.me/ALaDyn_Collaboration)
## Support channels

We have a Telegram channel to promote latest news: [join here](https://t.me/ALaDyn_Collaboration)
We also have a group on Telegram ([join here](https://t.me/ALaDyn_Chat)) (for quick questions and unofficial discussions), an [official slack channel](http://aladyn.slack.com) (for more technical discussions) and another slack channel for the [italian plasma community](http://plasmaitaly.slack.com).
38 changes: 19 additions & 19 deletions docs/INTRO.md
@@ -1,19 +1,19 @@
[![Build Status Master](https://travis-ci.org/ALaDyn/ALaDyn.png?branch=master)](https://travis-ci.org/ALaDyn/ALaDyn "master")
[![Build status](https://ci.appveyor.com/api/projects/status/evol3yvpqqfyxi7p?svg=true)](https://ci.appveyor.com/project/cenit/aladyn-kul79)
[![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)
[![DOI](https://zenodo.org/badge/doi/10.5281/zenodo.592388.svg)](http://dx.doi.org/10.5281/zenodo.592388)
![GitHub tag (latest SemVer)](https://img.shields.io/github/tag/aladyn/aladyn.svg?label=Latest%20Release)

![ALaDyn Logo](https://raw.githubusercontent.com/ALaDyn/ALaDyn/master/media/logo_small.png)

`ALaDyn` (**A**cceleration by **La**ser and **Dyn**amics of charged particles) is a PIC code firstly described in *ALaDyn: A High-Accuracy PIC code for the Maxwell-Vlasov Equations* by C. Benedetti et al., published on IEEE Transactions on Plasma Science, **36** 4, 1790-1798 (2008) and then again in the update *Charge preserving high order PIC schemes* by P. Londrillo et al., published on Nucl. Instrum. Meth. A, **620** 1, 28-35 (2010). PWFA modules have been presented in *Numerical investigation of beam-driven PWFA in quasi-nonlinear regime* by P. Londrillo et al., published on Nucl. Instrum. Meth. A, **740** (2014).

To date, main usage of the code has been carried on in simulating:

- **L**aser **W**ake**F**ield **A**cceleration (**LWFA** Laser driven),

- **P**lasma **W**ake**F**ield **A**cceleration (**PWFA** Beam driven),

- **T**arget **N**ormal **S**heath **A**cceleration (**TNSA** Interaction with solid targets).

This newer version, in part rewritten from scratch, is released as is, without any warranty, and will be maintained here on GitHub. A new publication is currently underway to describe progresses on this new code. If you use `ALaDyn`, you're kindly required to cite the Zenodo DOI of the latest release: [![DOI](https://zenodo.org/badge/doi/10.5281/zenodo.592388.svg)](http://dx.doi.org/10.5281/zenodo.592388).
[![Build Status Master](https://travis-ci.org/ALaDyn/ALaDyn.png?branch=master)](https://travis-ci.org/ALaDyn/ALaDyn "master")
[![Build status](https://ci.appveyor.com/api/projects/status/evol3yvpqqfyxi7p?svg=true)](https://ci.appveyor.com/project/cenit/aladyn-kul79)
[![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)
[![DOI](https://zenodo.org/badge/doi/10.5281/zenodo.592388.svg)](http://dx.doi.org/10.5281/zenodo.592388)
![GitHub tag (latest SemVer)](https://img.shields.io/github/tag/aladyn/aladyn.svg?label=Latest%20Release)

![ALaDyn Logo](https://raw.githubusercontent.com/ALaDyn/ALaDyn/master/media/logo_small.png)

`ALaDyn` (**A**cceleration by **La**ser and **Dyn**amics of charged particles) is a PIC code firstly described in *ALaDyn: A High-Accuracy PIC code for the Maxwell-Vlasov Equations* by C. Benedetti et al., published on IEEE Transactions on Plasma Science, **36** 4, 1790-1798 (2008) and then again in the update *Charge preserving high order PIC schemes* by P. Londrillo et al., published on Nucl. Instrum. Meth. A, **620** 1, 28-35 (2010). PWFA modules have been presented in *Numerical investigation of beam-driven PWFA in quasi-nonlinear regime* by P. Londrillo et al., published on Nucl. Instrum. Meth. A, **740** (2014).

To date, main usage of the code has been carried on in simulating:

- **L**aser **W**ake**F**ield **A**cceleration (**LWFA** Laser driven),

- **P**lasma **W**ake**F**ield **A**cceleration (**PWFA** Beam driven),

- **T**arget **N**ormal **S**heath **A**cceleration (**TNSA** Interaction with solid targets).

This newer version, in part rewritten from scratch, is released as is, without any warranty, and will be maintained here on GitHub. A new publication is currently underway to describe progresses on this new code. If you use `ALaDyn`, you're kindly required to cite the Zenodo DOI of the latest release: [![DOI](https://zenodo.org/badge/doi/10.5281/zenodo.592388.svg)](http://dx.doi.org/10.5281/zenodo.592388).
26 changes: 13 additions & 13 deletions docs/RELEASES.md
@@ -1,13 +1,13 @@
## Releases

latest release: [![DOI](https://zenodo.org/badge/doi/10.5281/zenodo.3607652.svg)](http://dx.doi.org/10.5281/zenodo.3607652)

Other releases:
v2.3.0 (v2019.1): [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.2626679.svg)](https://doi.org/10.5281/zenodo.2626679)
v2.2.0 (v2018.3): [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.1477315.svg)](https://doi.org/10.5281/zenodo.1477315)
v2.1.0 (v2018.2): [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.1406920.svg)](https://doi.org/10.5281/zenodo.1406920)
v2.0.0 (v2018.1): [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.1195760.svg)](https://doi.org/10.5281/zenodo.1195760)
v1.0.0 (v2017.1): [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.1065413.svg)](https://doi.org/10.5281/zenodo.1065413)
v1.0.0-beta: [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.49553.svg)](https://doi.org/10.5281/zenodo.49553)
v1.0.0-alpha2: [![DOI](https://zenodo.org/badge/doi/10.5281/zenodo.48933.svg)](http://dx.doi.org/10.5281/zenodo.48933)
v1.0.0-alpha: [![DOI](https://zenodo.org/badge/doi/10.5281/zenodo.47467.svg)](http://dx.doi.org/10.5281/zenodo.47467)
## Releases

latest release: [![DOI](https://zenodo.org/badge/doi/10.5281/zenodo.3607652.svg)](http://dx.doi.org/10.5281/zenodo.3607652)

Other releases:
v2.3.0 (v2019.1): [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.2626679.svg)](https://doi.org/10.5281/zenodo.2626679)
v2.2.0 (v2018.3): [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.1477315.svg)](https://doi.org/10.5281/zenodo.1477315)
v2.1.0 (v2018.2): [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.1406920.svg)](https://doi.org/10.5281/zenodo.1406920)
v2.0.0 (v2018.1): [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.1195760.svg)](https://doi.org/10.5281/zenodo.1195760)
v1.0.0 (v2017.1): [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.1065413.svg)](https://doi.org/10.5281/zenodo.1065413)
v1.0.0-beta: [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.49553.svg)](https://doi.org/10.5281/zenodo.49553)
v1.0.0-alpha2: [![DOI](https://zenodo.org/badge/doi/10.5281/zenodo.48933.svg)](http://dx.doi.org/10.5281/zenodo.48933)
v1.0.0-alpha: [![DOI](https://zenodo.org/badge/doi/10.5281/zenodo.47467.svg)](http://dx.doi.org/10.5281/zenodo.47467)
2 changes: 1 addition & 1 deletion docs/VERSION.md
@@ -1 +1 @@
3.0
3.0.1
36 changes: 12 additions & 24 deletions src/IO/init_laser_field.f90
Expand Up @@ -68,23 +68,19 @@ subroutine lp_pulse(lp_mod, part_in)
if (plane_wave) lp_ind = 0
if (angle>0.0) then
shx_lp = lpx(7)
if (lp_end(1)>xm) then
call init_lp_fields(ebf, lp_amp, tt, t0_lp, w0_x, w0_y, xf, oml, &
angle, shx_lp, lp_ind, i1, i2, y0_cent(1), z0_cent(1))
end if
call init_lp_fields(ebf, lp_amp, tt, t0_lp, w0_x, w0_y, xf, oml, &
angle, shx_lp, lp_ind, i1, i2, y0_cent(1), z0_cent(1))
else !normal incidence
if (lp_end(1)>xm) then
call init_lp_inc0_fields(ebf, lp_amp, tt, t0_lp, w0_x, w0_y, xf, &
oml, lp_ind, i1, i2, y0_cent(1), z0_cent(1))
end if
call init_lp_inc0_fields(ebf, lp_amp, tt, t0_lp, w0_x, w0_y, xf, &
oml, lp_ind, i1, i2, y0_cent(1), z0_cent(1))
end if
if (nb_laser>1) then
do ic = 2, nb_laser
lp_in(ic) = lp_in(ic-1) - lp_delay(ic-1)
lp_end(ic) = lp_end(ic-1) - lp_delay(ic-1)
xc_loc(ic) = xc_loc(ic-1) - lp_delay(ic-1)
xf_loc(ic) = xc_loc(ic) + t0_lp
if (lp_end(ic)>xm) call init_lp_inc0_fields(ebf, lp_amp, tt, t0_lp, &
call init_lp_inc0_fields(ebf, lp_amp, tt, t0_lp, &
w0_x, w0_y, xf_loc(ic), oml, lp_ind, i1, i2, y0_cent(ic), &
z0_cent(ic))
end do
Expand Down Expand Up @@ -178,15 +174,13 @@ subroutine set_envelope(part_in)
xc_loc(1) = xc_lp
xf_loc(1) = xf
env(:, :, :, :) = 0.0
if (lp_end(1)>xm) then
if (g_prof) then
call init_gprof_envelope_field(env, a0, tt, t0_lp, w0_x, w0_y, &
xf, oml, pw_ind, i1, i2, y0_cent(1), z0_cent(1))
else
call init_envelope_field(env, a0, tt, t0_lp, w0_x, w0_y, xf, &
oml, pw_ind, i1, i2, y0_cent(1), z0_cent(1))
!call init_env_filtering(env,i1,i2,j1,nyp,k1,nzp)
end if
if (g_prof) then
call init_gprof_envelope_field(env, a0, tt, t0_lp, w0_x, w0_y, &
xf, oml, pw_ind, i1, i2, y0_cent(1), z0_cent(1))
else
call init_envelope_field(env, a0, tt, t0_lp, w0_x, w0_y, xf, &
oml, pw_ind, i1, i2, y0_cent(1), z0_cent(1))
!call init_env_filtering(env,i1,i2,j1,nyp,k1,nzp)
end if
if (nb_laser>1) then
do ic = 2, nb_laser
Expand Down Expand Up @@ -229,12 +223,6 @@ subroutine set_envelope(part_in)
end if
end if

str = 2
stl = 2
call env_bds(env, dt_loc, str, stl, init_ic = 1, end_ic = 4)
if ( TWO_COLOR ) then
call env_bds(env1, dt_loc, str, stl, init_ic = 1, end_ic = 4)
end if
!=======================
ebf = 0.0
!=====================
Expand Down
12 changes: 6 additions & 6 deletions src/IO/pic_out_util.f90
Expand Up @@ -357,8 +357,9 @@ subroutine prl_den_energy_interp(ic,cmp_out)
select case (cmp_out)
case (1)
call set_grid_charge(spec(ic), ebfp, jc, np, 1)

!nden=1 exit density for each ic species
case (2)
!nden=2 exit density and energy density for each species
if (envelope) then
if(ic==1)then
do k = kz1, kz2
Expand All @@ -372,14 +373,13 @@ subroutine prl_den_energy_interp(ic,cmp_out)
end do
if (prl) call fill_ebfield_yzxbdsdata(jc, 3, 3, 2, 2)
call set_grid_env_den_energy(spec(ic), ebfp, jc, np, 3)
else
call set_grid_den_energy(spec(ic), ebfp, jc, np) !ic >1 in envelope scheme
endif
! in jc(1) is the plasma density in jc(2) (gam-1)density with env-gamma component
!ONLY for electrons
else
call set_grid_den_energy(spec(ic), ebfp, jc, np)

! in jc(1) is plasma norm density in jc(2) <(gam-1)density> with
! kineticagamma for each species
! in jc(1) is plasma norm density in jc(2) <(gam-1)density> using kinetic
! gamma for each species
end if
end select
if (prl) call fill_curr_yzxbdsdata(jc,cmp_out)
Expand Down
12 changes: 5 additions & 7 deletions src/dynamics/curr_and_fields_util.f90
Expand Up @@ -168,7 +168,7 @@ subroutine pfields_prepare(ef, nc, spr, spl)
! iby,ibz,ibx =2
!==================
end if
call field_xyzbd(ef, nc, spl, spr)
call field_xyzbd(ef, nc)
! extends for one point at the box boundaries
!==================================================
end subroutine
Expand Down Expand Up @@ -267,17 +267,18 @@ subroutine advance_lpf_envelope(curr, evf, omg)
integer :: str, stl, cind, ib
!====== enter env(3:4)=A^{n-1} and env(1:2)= A^{n}
! enters jc(3)=<wgh*n/gamp> >0

str = 2
stl = 2
!ord=2
cind = 1 !cind=0 FFT cind=1 grid deriv
ib = 2 !ib=1 implicit ib=2 optimazid explicit
!optimized advection scheme
if (comoving) ib = 0
if (prl) then
str = 2
stl = 2
call fill_ebfield_yzxbdsdata(evf, 1, 2, str, stl)
end if
call env_bds( evf, str, stl )

do k = kz1, kz2
do j = jy1, jy2
do i = ix1, ix2
Expand All @@ -295,9 +296,6 @@ subroutine advance_lpf_envelope(curr, evf, omg)
call env_maxw_solve(jc, evf, omg, dt_loc)
end if
! =================================
str = 2
stl = 2
call env_bds(evf, dt_loc, str, stl)
end subroutine
!========================================================

Expand Down
30 changes: 15 additions & 15 deletions src/dynamics/env_evolve_in_time.f90
Expand Up @@ -111,18 +111,17 @@ subroutine env_fields_average(evf, av, spl_in, spr_in)
integer, intent (in) :: spl_in, spr_in
integer :: ix, iy, iz, ord
real (dp) :: ar, ai
real (dp), parameter :: frac = one_dp/8.
!===================
ord = 2
do iz = kz1, kz2
do iy = jy1, jy2
do ix = ix1, ix2
ar = 0.5*(evf(ix,iy,iz,1)+evf(ix,iy,iz,3)) !A^{n+1/2}=(A^n+1+A^n)/2
ai = 0.5*(evf(ix,iy,iz,2)+evf(ix,iy,iz,4))
av(ix, iy, iz, 1) = 0.5*(ar*ar+ai*ai)
! |A|^2/2 at t^{n+1/2}=> gamp^{n+1/2}
end do
end do
end do
! |A|^2/2 at t^{n+1/2}=> gamp^{n+1/2}
av(ix1:ix2, jy1:jy2, kz1:kz2, 1) = &
frac*( &
(evf(ix1:ix2, jy1:jy2, kz1:kz2, 1)+evf(ix1:ix2, jy1:jy2, kz1:kz2, 3)) * &
(evf(ix1:ix2, jy1:jy2, kz1:kz2, 1)+evf(ix1:ix2, jy1:jy2, kz1:kz2, 3)) + &
(evf(ix1:ix2, jy1:jy2, kz1:kz2, 2)+evf(ix1:ix2, jy1:jy2, kz1:kz2, 4)) * &
(evf(ix1:ix2, jy1:jy2, kz1:kz2, 2)+evf(ix1:ix2, jy1:jy2, kz1:kz2, 4)) )

if (prl) call fill_ebfield_yzxbdsdata(av, 1, 1, spr_in, spl_in)
call env_grad(av)
!Exit staggered grad|A|^2/2 in jc(2:4) or jc(2:3)
Expand Down Expand Up @@ -211,7 +210,7 @@ subroutine env_lpf2_evolve(it_loc)
end if
id_ch = nd2 + 1
if (enable_ionization(1)) then
if (prl) call fill_ebfield_yzxbdsdata(env, 1, 2, 2, 2)
if (prl) call pfields_prepare(env, 2, 2, 2)
do ic = 2, nsp_ionz
np = loc_npart(imody, imodz, imodx, ic)
if (np>0) then
Expand All @@ -232,7 +231,7 @@ subroutine env_lpf2_evolve(it_loc)
end if
if (Two_color) then
if (enable_ionization(2)) then
if (prl) call fill_ebfield_yzxbdsdata(env1, 1, 2, 2, 2)
if (prl) call pfields_prepare(env1, 2, 2, 2)
do ic = 2, nsp_ionz
np = loc_npart(imody, imodz, imodx, ic)
if (np>0) then
Expand Down Expand Up @@ -365,6 +364,10 @@ subroutine env_run(t_loc, iter_loc)

real (dp), intent (in) :: t_loc
integer, intent (in) :: iter_loc

!=========================
call env_lpf2_evolve(iter_loc)
!================================
!+++++++++++++++++++++++++++++++++
!for vbeam >0 uses the xw=(x+vbeam*t)
!x=xi=(xw-vbeam*t) fixed
Expand All @@ -387,9 +390,6 @@ subroutine env_run(t_loc, iter_loc)
end if
end if
end if
!=========================
call env_lpf2_evolve(iter_loc)
!================================
end subroutine
!============================
! END ENVELOPE MODULE
Expand Down
2 changes: 2 additions & 0 deletions src/dynamics/fluid_density_momenta.f90
Expand Up @@ -71,6 +71,7 @@ subroutine fluid_curr_accumulate(flx, curr)
end do
end if
call fill_ebfield_yzxbdsdata(flx, 1, curr_ndim, str, stl)
call field_xyzbd(flx,curr_ndim)
if(pe1x)then
do k = kz1, kz2
do j = jy1, jy2
Expand Down Expand Up @@ -202,6 +203,7 @@ subroutine update_adam_bash_fluid_variables( u, u0, flx, ef )
!extends flux data to j1-2,j2+2 and k1-2,k2+2
call fill_ebfield_yzxbdsdata(flx, 1, fldim, 2, 2)
call fill_ebfield_yzxbdsdata(ef, 1, nfield, str, stl)
call field_xyzbd(ef,nfield)
end if
if (initial_time) then !a one_step update
u0(:, :, :, :) = zero_dp
Expand Down
8 changes: 5 additions & 3 deletions src/dynamics/pic_evolve_in_time.f90
Expand Up @@ -116,6 +116,11 @@ subroutine lp_run(t_loc, iter_loc)
integer, intent (in) :: iter_loc
real (dp) :: ts
!================================

!=========================
call lpf2_evolve(iter_loc)
!===================================

ts = t_loc
if (w_speed>0.0) then ! moves the computational box with w_speed>0.
if (ts>=wi_time .and. ts<wf_time) then
Expand All @@ -136,9 +141,6 @@ subroutine lp_run(t_loc, iter_loc)
!vbeam >0 uses the xw=(x+vbeam*t)
!x=xi=(xw-vbeam*t) fixed
!==============================
!=========================
call lpf2_evolve(iter_loc)
!===================================
end subroutine

end module
Expand Down

0 comments on commit 191008c

Please sign in to comment.