Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nci corrector in gather buffer bugfix #1

Merged
merged 2 commits into from
Oct 2, 2018

Conversation

atmyers
Copy link
Member

@atmyers atmyers commented Oct 2, 2018

This applies the nci corrector to the coarse level fields when using the field gather buffer.

Before this fix:

without_fix_slice_z_ez

After this fix:

with_fix_slice_z_ez

Script to reproduce:

stop_time = 5.e-12
amr.n_cell = 32 640

amr.max_grid_size = 1280
amr.blocking_factor = 8

warpx.n_current_deposition_buffer = 32
warpx.n_field_gather_buffer = 32

# Maximum level in hierarchy (for now must be 0, i.e., one level in total)
amr.max_level = 1
amr.plot_file = plotfiles/plt
amr.plot_int = 100

# Geometry
geometry.coord_sys   = 0                  # 0: Cartesian
geometry.is_periodic = 0 0      # Is periodic?
# In the lab frame: z between -1300um and -1000um
geometry.prob_lo     = -64.e-6  -128.e-6
geometry.prob_hi     =  64.e-6     0.
warpx.fine_tag_lo    = -30.e-6  -128.e-6
warpx.fine_tag_hi    =  30.e-6     0.e-6

# Verbosity
warpx.verbose = 1
warpx.plot_raw_fields = 0
warpx.do_dive_cleaning = 0
warpx.use_filter = 1
warpx.do_pml = 1
warpx.do_subcycling = 0
warpx.refine_plasma = 0
algo.maxwell_fdtd_solver = yee
amrex.v = 1
warpx.plot_raw_fields = 1 
warpx.plot_raw_fields_guards = 1 
warpx.plot_finepatch = 1 
warpx.plot_crsepatch = 1
#warpx.plot_rho = 1
#warpx.plot_F = 1

# Boost
warpx.gamma_boost = 10.0
warpx.boost_direction = z
warpx.do_boosted_frame_diagnostic = 0
warpx.num_snapshots_lab = 20
warpx.dt_snapshots_lab = 2.5e-11

# Algorithms
algo.current_deposition = 0
algo.charge_deposition = 0
algo.field_gathering = 0
algo.particle_pusher = 0

# CFL
warpx.cfl = 1.0
particles.nspecies = 6
#particles.species_names = plasma_e plasma_p
particles.species_names = driver plasma_e beam plasma_p driverback beamback
#particles.deposit_on_main_grid = driver plasma_e plasma_p driverback beamback
particles.use_fdtd_nci_corr = 1
particles.rigid_injected_species = driver beam

# interpolation
interpolation.nox = 1
interpolation.noy = 1
interpolation.noz = 1

constants.use_my_constants = 1
constants.constant_names  = lramp  pi                 dens
constants.constant_values = 2.e-3 3.141592653589793   1e+23

driver.charge = -q_e
driver.mass = m_e
driver.injection_style = "gaussian_beam"
driver.x_rms = 4.e-6
driver.y_rms = 4.e-6
driver.z_rms = 8.e-6
driver.x_m = 0.
driver.y_m = 0.
driver.z_m = -20.e-6
driver.npart = 5000
driver.q_tot = -4e-11
driver.profile = "constant"
driver.density = 8.e23                   # number of particles per m^3
driver.momentum_distribution_type = "gaussian"
driver.ux_m = 0.0
driver.uy_m = 0.0
driver.uz_m = 200000.
driver.ux_th = 2.
driver.uy_th = 2.
driver.uz_th = 0.
driver.zinject_plane = 0.
driver.rigid_advance = true
driver.projected = true
driver.focused = false

# This species is the back-propagating counterpart of the driver species
# used to reduce the effect of spurious fields at injection.
# it mostly has the same parameters, with the following differences:
# - opposite charge
# - opposite q_tot
# - flag do_backward_propagation is set to true (default is false)
driverback.charge = q_e
driverback.mass = m_e
driverback.injection_style = "gaussian_beam"
driverback.x_rms = 4.e-6
driverback.y_rms = 4.e-6
driverback.z_rms = 8.e-6
driverback.x_m = 0.
driverback.y_m = 0.
driverback.z_m = -20.e-6
driverback.npart = 5000
driverback.q_tot = 4.e-11
driverback.profile = "constant"
driverback.density = 8.e23                   # number of particles per m^3
driverback.momentum_distribution_type = "gaussian"
driverback.ux_m = 0.0
driverback.uy_m = 0.0
driverback.uz_m = 200000.
driverback.ux_th = 2.
driverback.uy_th = 2.
driverback.uz_th = 0.
driverback.zinject_plane = 0.
driverback.rigid_advance = true
driverback.projected = true
driverback.focused = false
driverback.do_backward_propagation = true

beam.charge = -q_e
beam.mass = m_e
beam.injection_style = "gaussian_beam"
beam.x_rms = 2.e-6
beam.y_rms = 2.e-6
beam.z_rms = 4.e-6
beam.x_m = 0.
beam.y_m = 0.
beam.z_m = -98.e-6
beam.npart = 5000
beam.q_tot = -6e-12
beam.profile = "constant"
beam.density = 8.e23                   # number of particles per m^3
beam.momentum_distribution_type = "gaussian"
beam.ux_m = 0.0
beam.uy_m = 0.0
beam.uz_m = 2000.
beam.ux_th = 2.
beam.uy_th = 2.
beam.uz_th = 0.
beam.zinject_plane = 0.e-6
beam.rigid_advance = true
beam.projected = true
beam.focused = false

# This species is the back-propagating counterpart of the beam species
# used to reduce the effect of spurious fields at injection.
# it mostly has the same parameters, with the following differences:
# - opposite charge
# - opposite q_tot
# - flag do_backward_propagation is set to true (default is false)
beamback.charge = q_e
beamback.mass = m_e
beamback.injection_style = "gaussian_beam"
beamback.x_rms = 2.e-6
beamback.y_rms = 2.e-6
beamback.z_rms = 4.e-6
beamback.x_m = 0.
beamback.y_m = 0.
beamback.z_m = -98.e-6
beamback.npart = 5000
beamback.q_tot = 6e-12
beamback.profile = "constant"
beamback.density = 8.e23                   # number of particles per m^3
beamback.momentum_distribution_type = "gaussian"
beamback.ux_m = 0.0
beamback.uy_m = 0.0
beamback.uz_m = 2000.
beamback.ux_th = 2.
beamback.uy_th = 2.
beamback.uz_th = 0.
beamback.zinject_plane = 0.
beamback.rigid_advance = true
beamback.projected = true
beamback.focused = false
beamback.do_backward_propagation = true

plasma_e.charge = -q_e
plasma_e.mass = m_e
plasma_e.injection_style = "NUniformPerCell"
plasma_e.zmin = 0.e-6
plasma_e.zmax = 10.
plasma_e.xmin = -50.e-6
plasma_e.xmax =  50.e-6
plasma_e.profile = parse_density_function
plasma_e.density_function(x,y,z) = "(z<lramp)*0.5*(1-cos(pi*z/lramp))*dens+(z>lramp)*dens"
# plasma_e.profile = "constant"
# plasma_e.density = 1.e23
plasma_e.num_particles_per_cell_each_dim = 2 2
plasma_e.momentum_distribution_type = "constant"
plasma_e.ux = 0.0
plasma_e.uy = 0.0
plasma_e.uz = 0.0

plasma_p.charge = q_e
plasma_p.mass = m_p
plasma_p.injection_style = "NUniformPerCell"
plasma_p.zmin = 0.e-6
plasma_p.zmax = 10.
plasma_p.profile = parse_density_function
plasma_p.density_function(x,y,z) = "(z<lramp)*0.5*(1-cos(pi*z/lramp))*dens+(z>lramp)*dens"
# plasma_p.profile = "constant"
# plasma_p.density = 1.e23
plasma_p.xmin = -50.e-6
plasma_p.xmax =  50.e-6
plasma_p.num_particles_per_cell_each_dim = 2 2
plasma_p.momentum_distribution_type = "constant"
plasma_p.ux = 0.0
plasma_p.uy = 0.0
plasma_p.uz = 0.0

# Moving window
warpx.do_moving_window = 1
warpx.moving_window_dir = z
warpx.moving_window_v = 1. # in units of the speed of light

# Particle Injection
warpx.do_plasma_injection = 1
warpx.num_injected_species = 2
warpx.injected_plasma_species = 1 3 

@RemiLehe
Copy link
Member

RemiLehe commented Oct 2, 2018

Great! Thanks for these changes!

@RemiLehe RemiLehe merged commit 55ed30f into dev Oct 2, 2018
@atmyers atmyers deleted the nci_corrector_in_gather_buffer_bugfix branch October 2, 2018 19:24
lucafedeli88 added a commit that referenced this pull request Jun 6, 2019
lucafedeli88 added a commit that referenced this pull request Jun 6, 2019
Merge pull request #1 from ECP-WarpX/qed_playground
dwillcox pushed a commit to dwillcox/WarpX that referenced this pull request Sep 5, 2019
MaxThevenet pushed a commit that referenced this pull request Feb 1, 2020
hightower8083 referenced this pull request in hightower8083/WarpX Dec 2, 2020
fixed active window for negative end_step
ax3l added a commit that referenced this pull request Nov 19, 2021
* add github ci compile check for ascent

* now with less whitespace

* add ascent to insitu workflow

* Update .github/workflows/insitu.yml

Co-authored-by: Axel Huebl <[email protected]>

* more style

* try to run as existing user

* new container

* use env script

* path fix

* add ascent test

* fix space

* move test resources

* get into style

* style

* Ascent CI: Cleanup (#1)

- make sure inputs file stays up-to-date
- locate alongside example

* Update .github/workflows/insitu.yml

Co-authored-by: Axel Huebl <[email protected]>

* Update .github/workflows/insitu.yml

Co-authored-by: Axel Huebl <[email protected]>

* rename test file

* fix for cp

* improve color table for vol rendering

* now with rotation

Co-authored-by: Axel Huebl <[email protected]>
dpgrote pushed a commit to dpgrote/WarpX that referenced this pull request Nov 29, 2021
* add github ci compile check for ascent

* now with less whitespace

* add ascent to insitu workflow

* Update .github/workflows/insitu.yml

Co-authored-by: Axel Huebl <[email protected]>

* more style

* try to run as existing user

* new container

* use env script

* path fix

* add ascent test

* fix space

* move test resources

* get into style

* style

* Ascent CI: Cleanup (ECP-WarpX#1)

- make sure inputs file stays up-to-date
- locate alongside example

* Update .github/workflows/insitu.yml

Co-authored-by: Axel Huebl <[email protected]>

* Update .github/workflows/insitu.yml

Co-authored-by: Axel Huebl <[email protected]>

* rename test file

* fix for cp

* improve color table for vol rendering

* now with rotation

Co-authored-by: Axel Huebl <[email protected]>
hklion referenced this pull request in hklion/WarpX Sep 12, 2022
roelof-groenewald added a commit that referenced this pull request May 16, 2023
…3890)

* break application of PEC to rho into separate loops over boxes

* round #1: fix failing CI tests

* also apply the fix to the `ApplyPECtoJfield`

* round 2: fix failing CI tests

* round 3: fix failing CI tests

* refactor PEC handling for charge and current density

* removed unused variable

* round 4: fix failing CI tests

* Fix `mirrorfac` calculation for `rho`

* only apply rho and J PEC boundaries for Cartesian grid (for now) in `SyncCurrentAndRho()`

* use the same kernel to apply PEC boundary to rho and J

* perform J and rho PEC application for RZ but warn about incorrect results if r_max is PEC

* do not apply PEC boundary for rho and J to r-max in RZ

* set warning level to medium and increase abort_on_warning_threshold to high for failing CI tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants