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

Subcycling method1 #4

Merged
merged 63 commits into from
Oct 18, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
d1018ef
extend the boosted frame diagnostics to multiple levels of refinement.
atmyers Aug 6, 2018
e988791
start reimplementing subcycling method 1
WeiqunZhang Sep 10, 2018
2de5551
WIP
WeiqunZhang Sep 11, 2018
91efd23
WIP
WeiqunZhang Sep 11, 2018
3c0bbe5
first pass
WeiqunZhang Sep 11, 2018
23231af
fix a bug
WeiqunZhang Sep 11, 2018
93dcb15
dive cleaning
WeiqunZhang Sep 12, 2018
599da98
Merge branch 'master' into subcycling-method1
WeiqunZhang Sep 12, 2018
fe73bd3
ParallelDescriptor::second -> amrex::second for more accurate clock
WeiqunZhang Sep 12, 2018
77f4e1a
use_filter
WeiqunZhang Sep 12, 2018
8cadb20
Merge branch 'master' into subcycling-method1
WeiqunZhang Sep 14, 2018
009c74a
if test nullptr
WeiqunZhang Sep 14, 2018
c893145
filter coarse patch too
WeiqunZhang Sep 14, 2018
dd6cb04
missed a restriction of rho
WeiqunZhang Sep 15, 2018
598d43d
Merge branch 'master' into subcycling-method1
WeiqunZhang Sep 17, 2018
458c7b6
Remove ApplyFilterAndSumBoundary from loop
RemiLehe Sep 18, 2018
4c7a1bc
Merge branch 'master' into subcycling-method1
RemiLehe Sep 18, 2018
fc6ab62
Merge branch 'master' into subcycling-method1
WeiqunZhang Sep 18, 2018
01883c3
Merge branch 'master' into subcycling-method1
WeiqunZhang Sep 20, 2018
22c7341
add one extra ghost cell to J
WeiqunZhang Sep 20, 2018
f5cce0a
summboundary on coarse patch and do nodal sync
WeiqunZhang Sep 21, 2018
d5dc055
fix the component index in sumboundary
WeiqunZhang Sep 22, 2018
e18edfb
Merge branch 'master' into subcycling-method1
WeiqunZhang Sep 24, 2018
b0a1347
current deposition buffer for subcycling method 1
WeiqunZhang Sep 24, 2018
c264548
make sure E and B have enough ghost cells for subcycling
WeiqunZhang Sep 24, 2018
3425ed3
add particles.deposit_on_main_grid option to allow deposit some parti…
WeiqunZhang Sep 24, 2018
9d30650
adding option to plot F and rho
atmyers Sep 24, 2018
a6a10fa
also use a buffer region for charge deposition
atmyers Sep 24, 2018
c627cc8
only turn on the current buffers if dive cleaning is on.
atmyers Sep 24, 2018
fdaf457
don't name this argument since it isn't used
atmyers Sep 24, 2018
482f763
also initialize the crho to zero
atmyers Sep 24, 2018
cc64b39
fix typo
atmyers Sep 24, 2018
cac001d
fix nic corrector for non-subcycling
WeiqunZhang Sep 24, 2018
5aa0d85
MultiFab::Copy -> MultiFab::Add
atmyers Sep 25, 2018
8fc2f55
MultiFab::Copy -> MultiFab::Add
atmyers Sep 25, 2018
ba719e8
Merge branch 'subcycling-method1' of bitbucket.org:berkeleylab/warpx …
atmyers Sep 25, 2018
c914b2a
Merge branch 'subcycling-method1' into charge_buffers
atmyers Sep 25, 2018
7eda00a
add missing FillBoundary
WeiqunZhang Sep 25, 2018
aeb2dc6
Merge branch 'subcycling-method1' of bitbucket.org:berkeleylab/warpx …
WeiqunZhang Sep 25, 2018
1eac7fb
change deposit charge lambda function for consistency
atmyers Sep 25, 2018
6f8e228
fixing merge conflicts
atmyers Sep 25, 2018
b367873
Merged in charge_buffers (pull request #113)
atmyers Sep 25, 2018
74765aa
Merge branch 'boosted_frame_mr' into subcycling-method1
atmyers Sep 25, 2018
1a0ee5f
use correct species names in the boosted frame diagnostics
atmyers Sep 25, 2018
59793e2
Merge branch 'pml_fix_f' into subcycling-method1
WeiqunZhang Sep 26, 2018
3e1b5b3
patch for PML F
WeiqunZhang Sep 26, 2018
33a5300
Merge branch 'master' into subcycling-method1
WeiqunZhang Sep 26, 2018
0daf6cc
add FillBoundaryF to subcycling
WeiqunZhang Sep 26, 2018
ab2dc42
need to make sure there are at least two ghost cells when there is mo…
WeiqunZhang Sep 26, 2018
80090d4
use fines_level instead of max_level in moving window
WeiqunZhang Sep 27, 2018
026e892
fix bug in load balance
WeiqunZhang Sep 27, 2018
da6e0bf
recreate current_store in regrid
WeiqunZhang Sep 27, 2018
194e94f
more walltime info
WeiqunZhang Sep 28, 2018
27a32f2
Merge branch 'dev' into subcycling-method1
WeiqunZhang Oct 2, 2018
4574c27
Merge branch 'dev' into subcycling-method1
WeiqunZhang Oct 4, 2018
c54e10f
Merge branch 'dev' into subcycling-method1
RemiLehe Oct 8, 2018
f1c2977
Merge branch 'dev' into subcycling-method1
RemiLehe Oct 10, 2018
878b4d6
Merge branch 'dev' into subcycling-method1
RemiLehe Oct 10, 2018
afc99d2
Fix merge error
RemiLehe Oct 11, 2018
05d31ae
Add script for subcycling
RemiLehe Oct 15, 2018
abbee70
Add comments
RemiLehe Oct 17, 2018
8cd1ff6
Add more comments
RemiLehe Oct 17, 2018
c3d396d
minor comment
MaxThevenet Oct 18, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
154 changes: 154 additions & 0 deletions Examples/Tests/subcycling/inputs.2d
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
# stop_time = 1.12966840205e-10
amrex.v=1
max_step = 2500
amr.n_cell = 64 256

amr.max_grid_size = 4096
amr.blocking_factor = 16

# 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 = 200

warpx.fine_tag_lo = -2.e-6 -15.e-6
warpx.fine_tag_hi = 2.e-6 -7.e-6


# Geometry
geometry.coord_sys = 0 # 0: Cartesian
geometry.is_periodic = 0 0 # Is periodic?
geometry.prob_lo = -30.e-6 -20.e-6 # physical domain
geometry.prob_hi = 30.e-6 0.e-6

# Verbosity
warpx.verbose = 1
warpx.plot_raw_fields = 1
warpx.do_dive_cleaning = 0
warpx.use_filter = 1
warpx.do_pml = 1
warpx.do_subcycling = 0
warpx.refine_plasma = 0
warpx.plot_raw_fields = 1
warpx.plot_raw_fields_guards = 1
warpx.plot_finepatch = 1
warpx.plot_crsepatch = 1
warpx.n_current_deposition_buffer = 0
warpx.n_field_gather_buffer = 0

# Algorithms
algo.current_deposition = 0
algo.charge_deposition = 0
algo.field_gathering = 0
algo.particle_pusher = 0
algo.maxwell_fdtd_solver = "ckc"

# CFL
warpx.cfl = .9999
particles.nspecies = 4
particles.species_names = driver beam plasma_e plasma_p

# interpolation
interpolation.nox = 3
interpolation.noy = 3
interpolation.noz = 3

#
# The driver species information
#

driver.charge = -q_e
driver.mass = m_e
driver.injection_style = "gaussian_beam"
driver.x_rms = 3.e-6
driver.y_rms = 3.e-6
driver.z_rms = .2e-6
driver.x_m = 0.
driver.y_m = 0.
driver.z_m = -3.e-6
driver.npart = 10000
driver.q_tot = -1.e-10
driver.profile = "constant"
driver.density = 5.e24 # number of particles per m^3
driver.momentum_distribution_type = "gaussian"
driver.ux_m = 0.0
driver.uy_m = 0.0
driver.uz_m = 1e6
driver.uz_th = 0.
#driver.ux_th = 2.
#driver.uy_th = 2.
#driver.uz_th = 20000.
driver.zinject_plane = 0.
driver.rigid_advance = true
driver.projected = true
driver.focused = false

#
# The beam species information
#

beam.charge = -q_e
beam.mass = m_e
beam.injection_style = "gaussian_beam"
beam.x_rms = .1e-6
beam.y_rms = .1e-6
beam.z_rms = .2e-6
beam.x_m = 0.
beam.y_m = 0.
beam.z_m = -11.e-6
beam.npart = 10000
beam.q_tot = -1.e-12
beam.profile = "constant"
beam.density = 1.e24
beam.momentum_distribution_type = "gaussian"
beam.ux_m = 0.0
beam.uy_m = 0.0
beam.uz_m = 20.
beam.u_th = 0.

#
# The plasma species information
#

plasma_e.charge = -q_e
plasma_e.mass = m_e
plasma_e.injection_style = "NUniformPerCell"
plasma_e.xmin = -15.e-6
plasma_e.xmax = 15.e-6
plasma_e.ymin = -15.e-6
plasma_e.ymax = 15.e-6
plasma_e.zmin = 0.e-6
plasma_e.profile = "constant"
plasma_e.density = 1.e25
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.xmin = -15.e-6
plasma_p.xmax = 15.e-6
plasma_p.ymin = -15.e-6
plasma_p.ymax = 15.e-6
plasma_p.zmin = 0.e-6
plasma_p.profile = "constant"
plasma_p.density = 1.e25
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 = 2 3
13 changes: 13 additions & 0 deletions Regression/WarpX-tests.ini
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,19 @@ doVis = 0
compareParticles = 1
particleTypes = electrons beam

[subcyclingMR]
buildDir = .
inputFile = Examples/Tests/subcycling/inputs.2d
dim = 2
restartTest = 0
useMPI = 1
numprocs = 2
useOMP = 1
numthreads = 2
compileTest = 0
doVis = 0
compareParticles = 0

[LaserAccelerationMR]
buildDir = .
inputFile = Examples/Physics_applications/laser_acceleration/inputs.2d
Expand Down
25 changes: 23 additions & 2 deletions Source/WarpX.H
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ private:
/// Advance the simulation by numsteps steps, electromagnetic case.
///
void EvolveEM(int numsteps);

void FillBoundaryB (int lev, PatchType patch_type);
void FillBoundaryE (int lev, PatchType patch_type);
void FillBoundaryF (int lev, PatchType patch_type);
Expand All @@ -246,6 +246,21 @@ private:
void EvolveF (int lev, PatchType patch_type, amrex::Real dt, DtType dt_type);
void DampPML (int lev, PatchType patch_type);

void OneStep_nosub (amrex::Real t);
void OneStep_sub1 (amrex::Real t);

void RestrictCurrentFromFineToCoarsePatch (int lev);
void AddCurrentFromFineLevelandSumBoundary (int lev);
void StoreCurrent (int lev);
void RestoreCurrent (int lev);
void ApplyFilterandSumBoundaryJ (int lev, PatchType patch_type);
void NodalSyncJ (int lev, PatchType patch_type);

void RestrictRhoFromFineToCoarsePatch (int lev);
void ApplyFilterandSumBoundaryRho (int lev, PatchType patch_type, int icomp, int ncomp);
void AddRhoFromFineLevelandSumBoundary (int lev, int icomp, int ncomp);
void NodalSyncRho (int lev, PatchType patch_type, int icomp, int ncomp);

#ifdef WARPX_DO_ELECTROSTATIC
///
/// Advance the simulation by numsteps steps, electrostatic case.
Expand Down Expand Up @@ -344,7 +359,8 @@ private:

void LoadBalance ();

static void applyFilter (amrex::MultiFab& dstmf, const amrex::MultiFab& srcmf);
static void applyFilter (amrex::MultiFab& dstmf, const amrex::MultiFab& srcmf,
int scomp = 0, int dcomp = 0, int ncomp = 10000);

void BuildBufferMasks ();
const amrex::iMultiFab* getCurrentBufferMasks (int lev) const {
Expand Down Expand Up @@ -382,6 +398,9 @@ private:
amrex::Vector<std::array< std::unique_ptr<amrex::MultiFab>, 3 > > Efield_fp;
amrex::Vector<std::array< std::unique_ptr<amrex::MultiFab>, 3 > > Bfield_fp;

// store fine patch
amrex::Vector<std::array< std::unique_ptr<amrex::MultiFab>, 3 > > current_store;

// Coarse patch
amrex::Vector< std::unique_ptr<amrex::MultiFab> > F_cp;
amrex::Vector< std::unique_ptr<amrex::MultiFab> > rho_cp;
Expand Down Expand Up @@ -429,6 +448,8 @@ private:
// Other runtime parameters
int verbose = 1;

int do_subcycling = 0;

int max_step = std::numeric_limits<int>::max();
amrex::Real stop_time = std::numeric_limits<amrex::Real>::max();

Expand Down
Loading