diff options
author | 2018-10-09 17:30:33 -0700 | |
---|---|---|
committer | 2018-10-09 17:30:33 -0700 | |
commit | 1ae2c3cdb5796d0574de92be4877289b2c7686c6 (patch) | |
tree | 6f7414d9d12583d2b7551ca8b5a9dc75391b90d9 /Source/WarpXEvolve.cpp | |
parent | 5b06f045452084c4c2e113b7bf0435f0602b45cb (diff) | |
parent | 802d9cc9c8db5d0689ab14eae1b6cd348ffb10b4 (diff) | |
download | WarpX-1ae2c3cdb5796d0574de92be4877289b2c7686c6.tar.gz WarpX-1ae2c3cdb5796d0574de92be4877289b2c7686c6.tar.zst WarpX-1ae2c3cdb5796d0574de92be4877289b2c7686c6.zip |
Merge pull request #20 from ECP-WarpX/fix_indent
fix indentation
Diffstat (limited to 'Source/WarpXEvolve.cpp')
-rw-r--r-- | Source/WarpXEvolve.cpp | 108 |
1 files changed, 54 insertions, 54 deletions
diff --git a/Source/WarpXEvolve.cpp b/Source/WarpXEvolve.cpp index be5152fc2..f22eb0b0f 100644 --- a/Source/WarpXEvolve.cpp +++ b/Source/WarpXEvolve.cpp @@ -19,7 +19,7 @@ WarpX::Evolve (int numsteps) { if (do_electrostatic) { EvolveES(numsteps); } else { - EvolveEM(numsteps); + EvolveEM(numsteps); } #else EvolveEM(numsteps); @@ -49,7 +49,7 @@ WarpX::EvolveEM (int numsteps) { Real walltime_beg_step = amrex::second(); - // Start loop on time steps + // Start loop on time steps amrex::Print() << "\nSTEP " << step+1 << " starts ...\n"; #ifdef WARPX_USE_PY if (warpx_py_beforestep) warpx_py_beforestep(); @@ -63,16 +63,18 @@ WarpX::EvolveEM (int numsteps) if (step > 0 && (step+1) % load_balance_int == 0) { LoadBalance(); - // Reset the costs to 0 - for (int lev = 0; lev <= finest_level; ++lev) { - costs[lev]->setVal(0.0); - } + // Reset the costs to 0 + for (int lev = 0; lev <= finest_level; ++lev) + { + costs[lev]->setVal(0.0); + } } - for (int lev = 0; lev <= finest_level; ++lev) { - // Perform running average of the costs - // (Giving more importance to most recent costs) - (*costs[lev].get()).mult( (1. - 2./load_balance_int) ); + for (int lev = 0; lev <= finest_level; ++lev) + { + // Perform running average of the costs + // (Giving more importance to most recent costs) + (*costs[lev].get()).mult( (1. - 2./load_balance_int) ); } } @@ -84,17 +86,18 @@ WarpX::EvolveEM (int numsteps) FillBoundaryB(); UpdateAuxilaryData(); // on first step, push p by -0.5*dt - for (int lev = 0; lev <= finest_level; ++lev) { + for (int lev = 0; lev <= finest_level; ++lev) + { mypc->PushP(lev, -0.5*dt[0], *Efield_aux[lev][0],*Efield_aux[lev][1],*Efield_aux[lev][2], *Bfield_aux[lev][0],*Bfield_aux[lev][1],*Bfield_aux[lev][2]); } - is_synchronized = false; + is_synchronized = false; } else { - // Beyond one step, we have E^{n} and B^{n}. - // Particles have p^{n-1/2} and x^{n}. - UpdateAuxilaryData(); - } + // Beyond one step, we have E^{n} and B^{n}. + // Particles have p^{n-1/2} and x^{n}. + UpdateAuxilaryData(); + } // Push particle from x^{n} to x^{n+1} // from p^{n-1/2} to p^{n+1/2} @@ -129,7 +132,8 @@ WarpX::EvolveEM (int numsteps) FillBoundaryE(); EvolveF(0.5*dt[0], DtType::SecondHalf); EvolveB(0.5*dt[0]); // We now have B^{n+1} - if (do_pml) { + if (do_pml) + { DampPML(); FillBoundaryE(); } @@ -142,29 +146,31 @@ WarpX::EvolveEM (int numsteps) if (cur_time + dt[0] >= stop_time - 1.e-3*dt[0] || step == numsteps_max-1) { // At the end of last step, push p by 0.5*dt to synchronize UpdateAuxilaryData(); - for (int lev = 0; lev <= finest_level; ++lev) { + for (int lev = 0; lev <= finest_level; ++lev) + { mypc->PushP(lev, 0.5*dt[0], *Efield_aux[lev][0],*Efield_aux[lev][1],*Efield_aux[lev][2], *Bfield_aux[lev][0],*Bfield_aux[lev][1],*Bfield_aux[lev][2]); - } + } is_synchronized = true; } #ifdef WARPX_USE_PY if (warpx_py_afterEsolve) warpx_py_afterEsolve(); #endif - for (int lev = 0; lev <= max_level; ++lev) { + for (int lev = 0; lev <= max_level; ++lev) + { ++istep[lev]; } - cur_time += dt[0]; + cur_time += dt[0]; bool to_make_plot = (plot_int > 0) && ((step+1) % plot_int == 0); bool move_j = is_synchronized || to_make_plot; // If is_synchronized we need to shift j too so that next step we can evolve E by dt/2. // We might need to move j because we are going to make a plotfile. - MoveWindow(move_j); + MoveWindow(move_j); if (max_level == 0) { mypc->RedistributeLocal(); @@ -181,10 +187,10 @@ WarpX::EvolveEM (int numsteps) << " s; This step = " << walltime_end_step-walltime_beg_step << " s; Avg. per step = " << walltime/(step+1) << " s\n"; - // sync up time - for (int i = 0; i <= max_level; ++i) { - t_new[i] = cur_time; - } + // sync up time + for (int i = 0; i <= max_level; ++i) { + t_new[i] = cur_time; + } if (do_boosted_frame_diagnostic) { std::unique_ptr<MultiFab> cell_centered_data = nullptr; @@ -194,7 +200,7 @@ WarpX::EvolveEM (int numsteps) myBFD->writeLabFrameData(cell_centered_data.get(), *mypc, geom[0], cur_time, dt[0]); } - if (to_make_plot) + if (to_make_plot) { FillBoundaryE(); FillBoundaryB(); @@ -206,19 +212,19 @@ WarpX::EvolveEM (int numsteps) *Bfield_aux[lev][0],*Bfield_aux[lev][1],*Bfield_aux[lev][2]); } - last_plot_file_step = step+1; - WritePlotFile(); - } + last_plot_file_step = step+1; + WritePlotFile(); + } - if (check_int > 0 && (step+1) % check_int == 0) { - last_check_file_step = step+1; - WriteCheckPointFile(); - } + if (check_int > 0 && (step+1) % check_int == 0) { + last_check_file_step = step+1; + WriteCheckPointFile(); + } - if (cur_time >= stop_time - 1.e-3*dt[0]) { - max_time_reached = true; - break; - } + if (cur_time >= stop_time - 1.e-3*dt[0]) { + max_time_reached = true; + break; + } #ifdef WARPX_USE_PY if (warpx_py_afterstep) warpx_py_afterstep(); @@ -238,11 +244,11 @@ WarpX::EvolveEM (int numsteps) *Bfield_aux[lev][0],*Bfield_aux[lev][1],*Bfield_aux[lev][2]); } - WritePlotFile(); + WritePlotFile(); } if (check_int > 0 && istep[0] > last_check_file_step && (max_time_reached || istep[0] >= max_step)) { - WriteCheckPointFile(); + WriteCheckPointFile(); } if (do_boosted_frame_diagnostic) { @@ -283,9 +289,7 @@ WarpX::EvolveB (int lev, Real dt) Bx = Bfield_fp[lev][0].get(); By = Bfield_fp[lev][1].get(); Bz = Bfield_fp[lev][2].get(); - } - else - { + } else { Ex = Efield_cp[lev][0].get(); Ey = Efield_cp[lev][1].get(); Ez = Efield_cp[lev][2].get(); @@ -338,9 +342,9 @@ WarpX::EvolveB (int lev, Real dt) { const auto& pml_B = (ipatch==0) ? pml[lev]->GetB_fp() : pml[lev]->GetB_cp(); const auto& pml_E = (ipatch==0) ? pml[lev]->GetE_fp() : pml[lev]->GetE_cp(); - int patch_level = (ipatch == 0) ? lev : lev-1; - const std::array<Real,3>& dx = WarpX::CellSize(patch_level); - const std::array<Real,3> dtsdx {dt/dx[0], dt/dx[1], dt/dx[2]}; + int patch_level = (ipatch == 0) ? lev : lev-1; + const std::array<Real,3>& dx = WarpX::CellSize(patch_level); + const std::array<Real,3> dtsdx {dt/dx[0], dt/dx[1], dt/dx[2]}; #ifdef _OPENMP #pragma omp parallel #endif @@ -360,8 +364,8 @@ WarpX::EvolveB (int lev, Real dt) BL_TO_FORTRAN_3D((*pml_B[0])[mfi]), BL_TO_FORTRAN_3D((*pml_B[1])[mfi]), BL_TO_FORTRAN_3D((*pml_B[2])[mfi]), - &dtsdx[0], &dtsdx[1], &dtsdx[2], - &WarpX::maxwell_fdtd_solver_id); + &dtsdx[0], &dtsdx[1], &dtsdx[2], + &WarpX::maxwell_fdtd_solver_id); } } } @@ -407,9 +411,7 @@ WarpX::EvolveE (int lev, Real dt) jy = current_fp[lev][1].get(); jz = current_fp[lev][2].get(); F = F_fp[lev].get(); - } - else - { + } else { Ex = Efield_cp[lev][0].get(); Ey = Efield_cp[lev][1].get(); Ez = Efield_cp[lev][2].get(); @@ -565,9 +567,7 @@ WarpX::EvolveF (int lev, Real dt, DtType dt_type) Ez = Efield_fp[lev][2].get(); rho = rho_fp[lev].get(); F = F_fp[lev].get(); - } - else - { + } else { Ex = Efield_cp[lev][0].get(); Ey = Efield_cp[lev][1].get(); Ez = Efield_cp[lev][2].get(); |