MCPcopy Create free account
hub / github.com/BLAST-WarpX/warpx / Init

Method Init

Source/Parallelization/GuardCellManager.cpp:35–393  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

33using namespace amrex;
34
35void
36guardCellManager::Init (
37 const amrex::Real dt,
38 const amrex::Real *dx,
39 const bool do_subcycling,
40 const bool do_fdtd_nci_corr,
41 ablastr::utils::enums::GridType grid_type,
42 const bool do_moving_window,
43 const int moving_window_dir,
44 const int particle_max_grid_crossings,
45 const int nox,
46 const int nox_fft, const int noy_fft, const int noz_fft,
47 const int nci_corr_stencil,
48 const ElectromagneticSolverAlgo electromagnetic_solver_id,
49 const EvolveScheme evolve_scheme,
50 const int max_level,
51 const amrex::Vector<amrex::Real>& v_galilean,
52 const amrex::Vector<amrex::Real>& v_comoving,
53 const bool safe_guard_cells,
54 const int do_psatd_JRhom,
55 const bool fft_do_time_averaging,
56 const bool do_pml,
57 const int do_pml_in_domain,
58 const int pml_ncell,
59 const amrex::Vector<amrex::IntVect>& ref_ratios,
60 const bool use_filter,
61 const amrex::IntVect& bilinear_filter_stencil_length)
62{
63 // When using subcycling, the particles on the fine level perform two pushes
64 // before being redistributed ; therefore, we need one extra guard cell
65 // (the particles may move by 2*c*dt)
66 int ngx_tmp = (max_level > 0 && do_subcycling) ? nox+1 : nox;
67 int ngy_tmp = (max_level > 0 && do_subcycling) ? nox+1 : nox;
68 int ngz_tmp = (max_level > 0 && do_subcycling) ? nox+1 : nox;
69
70 const bool galilean = (v_galilean[0] != 0. || v_galilean[1] != 0. || v_galilean[2] != 0.);
71 const bool comoving = (v_comoving[0] != 0. || v_comoving[1] != 0. || v_comoving[2] != 0.);
72
73 // Add one guard cell in the case of the Galilean or comoving algorithms
74 if (galilean || comoving)
75 {
76 ngx_tmp += 1;
77 ngy_tmp += 1;
78 ngz_tmp += 1;
79 }
80
81 // Ex, Ey, Ez, Bx, By, and Bz have the same number of ghost cells.
82 // jx, jy, jz and rho have the same number of ghost cells.
83 // E and B have the same number of ghost cells as j and rho if NCI filter is not used,
84 // but different number of ghost cells in z-direction if NCI filter is used.
85 // The number of cells should be even, in order to easily perform the
86 // interpolation from coarse grid to fine grid.
87 int ngx = (ngx_tmp % 2) ? ngx_tmp+1 : ngx_tmp; // Always even number
88 int ngy = (ngy_tmp % 2) ? ngy_tmp+1 : ngy_tmp; // Always even number
89 const int ngz_nonci = (ngz_tmp % 2) ? ngz_tmp+1 : ngz_tmp; // Always even number
90 int ngz;
91 if (do_fdtd_nci_corr) {
92 const int ng = ngz_tmp + nci_corr_stencil;

Callers

nothing calls this directly

Calls 1

queryWithParserFunction · 0.85

Tested by

no test coverage detected