diff options
Diffstat (limited to 'Source')
-rw-r--r-- | Source/BoundaryConditions/PML.cpp | 3 | ||||
-rw-r--r-- | Source/Diagnostics/BTDiagnostics.cpp | 2 | ||||
-rw-r--r-- | Source/Diagnostics/BackTransformedDiagnostic.cpp | 4 | ||||
-rw-r--r-- | Source/Diagnostics/ReducedDiags/BeamRelevant.cpp | 4 | ||||
-rw-r--r-- | Source/FieldSolver/SpectralSolver/SpectralFieldData.cpp | 44 | ||||
-rw-r--r-- | Source/Filter/NCIGodfreyFilter.cpp | 5 | ||||
-rw-r--r-- | Source/Laser/LaserProfilesImpl/LaserProfileFromTXYEFile.cpp | 10 | ||||
-rw-r--r-- | Source/Parallelization/WarpXComm_K.H | 1 | ||||
-rw-r--r-- | Source/Particles/ElementaryProcess/QEDSchwingerProcess.H | 5 | ||||
-rw-r--r-- | Source/Particles/MultiParticleContainer.cpp | 4 | ||||
-rw-r--r-- | Source/Particles/PhysicalParticleContainer.cpp | 6 | ||||
-rw-r--r-- | Source/WarpX.cpp | 8 |
12 files changed, 74 insertions, 22 deletions
diff --git a/Source/BoundaryConditions/PML.cpp b/Source/BoundaryConditions/PML.cpp index 47e4cce62..276641f38 100644 --- a/Source/BoundaryConditions/PML.cpp +++ b/Source/BoundaryConditions/PML.cpp @@ -111,6 +111,7 @@ namespace }); } +#if (AMREX_SPACEDIM != 1) static void FillZero (int idim, Sigma& sigma, Sigma& sigma_cumsum, Sigma& sigma_star, Sigma& sigma_star_cumsum, const Box& overlap) @@ -136,8 +137,10 @@ namespace } }); } +#endif } + SigmaBox::SigmaBox (const Box& box, const BoxArray& grids, const Real* dx, int ncell, int delta) { BL_ASSERT(box.cellCentered()); diff --git a/Source/Diagnostics/BTDiagnostics.cpp b/Source/Diagnostics/BTDiagnostics.cpp index 236516f07..93572026a 100644 --- a/Source/Diagnostics/BTDiagnostics.cpp +++ b/Source/Diagnostics/BTDiagnostics.cpp @@ -322,7 +322,7 @@ BTDiagnostics::InitializeFieldBufferData ( int i_buffer , int lev) #elif (AMREX_SPACEDIM == 2) m_snapshot_ncells_lab[i_buffer] = {Nx_lab, Nz_lab}; #else - m_snapshot_ncells_lab[i_buffer] = amrex::IntVect({Nz_lab}); + m_snapshot_ncells_lab[i_buffer] = amrex::IntVect(Nz_lab); #endif } diff --git a/Source/Diagnostics/BackTransformedDiagnostic.cpp b/Source/Diagnostics/BackTransformedDiagnostic.cpp index c2d255d06..73f06323a 100644 --- a/Source/Diagnostics/BackTransformedDiagnostic.cpp +++ b/Source/Diagnostics/BackTransformedDiagnostic.cpp @@ -602,7 +602,7 @@ BackTransformedDiagnostic (Real zmin_lab, Real zmax_lab, Real v_window_lab, #else // Nx_lab = 1; // Ny_lab = 1; - IntVect prob_ncells_lab({Nz_lab}); + IntVect prob_ncells_lab(Nz_lab); #endif writeMetaData(); @@ -689,7 +689,7 @@ BackTransformedDiagnostic (Real zmin_lab, Real zmax_lab, Real v_window_lab, #elif (AMREX_SPACEDIM == 2) amrex::IntVect slice_ncells_lab = {Nx_slice_lab, Nz_slice_lab}; #else - amrex::IntVect slice_ncells_lab({Nz_slice_lab}); + amrex::IntVect slice_ncells_lab(Nz_slice_lab); #endif IntVect slice_lo(AMREX_D_DECL(0,0,0)); diff --git a/Source/Diagnostics/ReducedDiags/BeamRelevant.cpp b/Source/Diagnostics/ReducedDiags/BeamRelevant.cpp index 0c2cf7e95..ee191d2ec 100644 --- a/Source/Diagnostics/ReducedDiags/BeamRelevant.cpp +++ b/Source/Diagnostics/ReducedDiags/BeamRelevant.cpp @@ -276,20 +276,22 @@ void BeamRelevant::ComputeDiags (int step) const ParticleReal p_uz = p.rdata(PIdx::uz); const ParticleReal p_us = p_ux*p_ux + p_uy*p_uy + p_uz*p_uz; const ParticleReal p_gm = std::sqrt(1.0_rt+p_us*inv_c2); - const ParticleReal p_pos0 = p.pos(0); const ParticleReal p_w = p.rdata(PIdx::w); #if (defined WARPX_DIM_1D_Z) const ParticleReal p_x = 0.0; const ParticleReal p_y = 0.0; #elif (defined WARPX_DIM_RZ) + const ParticleReal p_pos0 = p.pos(0); const ParticleReal p_theta = p.rdata(PIdx::theta); const ParticleReal p_x = p_pos0*std::cos(p_theta); const ParticleReal p_y = p_pos0*std::sin(p_theta); #elif (defined WARPX_DIM_XZ) + const ParticleReal p_pos0 = p.pos(0); const ParticleReal p_x = p_pos0; const ParticleReal p_y = 0.0; #else + const ParticleReal p_pos0 = p.pos(0); const ParticleReal p_pos1 = p.pos(1); const ParticleReal p_x = p_pos0; const ParticleReal p_y = p_pos1; diff --git a/Source/FieldSolver/SpectralSolver/SpectralFieldData.cpp b/Source/FieldSolver/SpectralSolver/SpectralFieldData.cpp index 7caa6fe51..ebb720854 100644 --- a/Source/FieldSolver/SpectralSolver/SpectralFieldData.cpp +++ b/Source/FieldSolver/SpectralSolver/SpectralFieldData.cpp @@ -203,12 +203,16 @@ SpectralFieldData::ForwardTransform (const int lev, amrex::LayoutData<amrex::Real>* cost = WarpX::getCosts(lev); // Check field index type, in order to apply proper shift in spectral space +#if (AMREX_SPACEDIM >= 2) const bool is_nodal_x = (stag[0] == amrex::IndexType::NODE) ? true : false; +#endif #if (AMREX_SPACEDIM == 3) const bool is_nodal_y = (stag[1] == amrex::IndexType::NODE) ? true : false; const bool is_nodal_z = (stag[2] == amrex::IndexType::NODE) ? true : false; -#else +#elif (AMREX_SPACEDIM == 2) const bool is_nodal_z = (stag[1] == amrex::IndexType::NODE) ? true : false; +#elif (AMREX_SPACEDIM == 1) + const bool is_nodal_z = (stag[0] == amrex::IndexType::NODE) ? true : false; #endif // Loop over boxes @@ -253,7 +257,9 @@ SpectralFieldData::ForwardTransform (const int lev, { Array4<Complex> fields_arr = SpectralFieldData::fields[mfi].array(); Array4<const Complex> tmp_arr = tmpSpectralField[mfi].array(); +#if (AMREX_SPACEDIM >= 2) const Complex* xshift_arr = xshift_FFTfromCell[mfi].dataPtr(); +#endif #if (AMREX_SPACEDIM == 3) const Complex* yshift_arr = yshift_FFTfromCell[mfi].dataPtr(); #endif @@ -265,12 +271,16 @@ SpectralFieldData::ForwardTransform (const int lev, [=] AMREX_GPU_DEVICE(int i, int j, int k) noexcept { Complex spectral_field_value = tmp_arr(i,j,k); // Apply proper shift in each dimension +#if (AMREX_SPACEDIM >= 2) if (is_nodal_x==false) spectral_field_value *= xshift_arr[i]; +#endif #if (AMREX_SPACEDIM == 3) if (is_nodal_y==false) spectral_field_value *= yshift_arr[j]; if (is_nodal_z==false) spectral_field_value *= zshift_arr[k]; #elif (AMREX_SPACEDIM == 2) if (is_nodal_z==false) spectral_field_value *= zshift_arr[j]; +#elif (AMREX_SPACEDIM == 1) + if (is_nodal_z==false) spectral_field_value *= zshift_arr[i]; #endif // Copy field into the right index fields_arr(i,j,k,field_index) = spectral_field_value; @@ -299,16 +309,26 @@ SpectralFieldData::BackwardTransform (const int lev, amrex::LayoutData<amrex::Real>* cost = WarpX::getCosts(lev); // Check field index type, in order to apply proper shift in spectral space +#if (AMREX_SPACEDIM >= 2) const bool is_nodal_x = mf.is_nodal(0); +#endif #if (AMREX_SPACEDIM == 3) const bool is_nodal_y = mf.is_nodal(1); const bool is_nodal_z = mf.is_nodal(2); -#else +#elif (AMREX_SPACEDIM == 2) const bool is_nodal_z = mf.is_nodal(1); +#elif (AMREX_SPACEDIM == 1) + const bool is_nodal_z = mf.is_nodal(0); #endif +#if (AMREX_SPACEDIM >= 2) const int si = (is_nodal_x) ? 1 : 0; -#if (AMREX_SPACEDIM == 2) +#endif +#if (AMREX_SPACEDIM == 1) + const int si = (is_nodal_z) ? 1 : 0; + const int sj = 0; + const int sk = 0; +#elif (AMREX_SPACEDIM == 2) const int sj = (is_nodal_z) ? 1 : 0; const int sk = 0; #elif (AMREX_SPACEDIM == 3) @@ -336,7 +356,9 @@ SpectralFieldData::BackwardTransform (const int lev, { Array4<const Complex> field_arr = SpectralFieldData::fields[mfi].array(); Array4<Complex> tmp_arr = tmpSpectralField[mfi].array(); +#if (AMREX_SPACEDIM >= 2) const Complex* xshift_arr = xshift_FFTtoCell[mfi].dataPtr(); +#endif #if (AMREX_SPACEDIM == 3) const Complex* yshift_arr = yshift_FFTtoCell[mfi].dataPtr(); #endif @@ -348,12 +370,16 @@ SpectralFieldData::BackwardTransform (const int lev, [=] AMREX_GPU_DEVICE(int i, int j, int k) noexcept { Complex spectral_field_value = field_arr(i,j,k,field_index); // Apply proper shift in each dimension +#if (AMREX_SPACEDIM >= 2) if (is_nodal_x==false) spectral_field_value *= xshift_arr[i]; +#endif #if (AMREX_SPACEDIM == 3) if (is_nodal_y==false) spectral_field_value *= yshift_arr[j]; if (is_nodal_z==false) spectral_field_value *= zshift_arr[k]; #elif (AMREX_SPACEDIM == 2) if (is_nodal_z==false) spectral_field_value *= zshift_arr[j]; +#elif (AMREX_SPACEDIM == 1) + if (is_nodal_z==false) spectral_field_value *= zshift_arr[i]; #endif // Copy field into temporary array tmp_arr(i,j,k) = spectral_field_value; @@ -374,18 +400,26 @@ SpectralFieldData::BackwardTransform (const int lev, // Total number of cells, including ghost cells (nj represents ny in 3D and nz in 2D) const int ni = mf_box.length(0); +#if (AMREX_SPACEDIM == 1) + constexpr int nj = 1; + constexpr int nk = 1; +#elif (AMREX_SPACEDIM == 2) const int nj = mf_box.length(1); -#if (AMREX_SPACEDIM == 2) constexpr int nk = 1; #elif (AMREX_SPACEDIM == 3) + const int nj = mf_box.length(1); const int nk = mf_box.length(2); #endif // Lower bound of the box (lo_j represents lo_y in 3D and lo_z in 2D) const int lo_i = amrex::lbound(mf_box).x; +#if (AMREX_SPACEDIM == 1) + constexpr int lo_j = 0; + constexpr int lo_k = 0; +#elif (AMREX_SPACEDIM == 2) const int lo_j = amrex::lbound(mf_box).y; -#if (AMREX_SPACEDIM == 2) constexpr int lo_k = 0; #elif (AMREX_SPACEDIM == 3) + const int lo_j = amrex::lbound(mf_box).y; const int lo_k = amrex::lbound(mf_box).z; #endif // If necessary, do not fill the guard cells diff --git a/Source/Filter/NCIGodfreyFilter.cpp b/Source/Filter/NCIGodfreyFilter.cpp index fa88eb854..5237a7b3b 100644 --- a/Source/Filter/NCIGodfreyFilter.cpp +++ b/Source/Filter/NCIGodfreyFilter.cpp @@ -23,19 +23,18 @@ using namespace amrex; NCIGodfreyFilter::NCIGodfreyFilter(godfrey_coeff_set coeff_set, amrex::Real cdtodz, bool nodal_gather){ -#if (AMREX_SPACEDIM >= 2) // Store parameters into class data members m_coeff_set = coeff_set; m_cdtodz = cdtodz; m_nodal_gather = nodal_gather; + // NCI Godfrey filter has fixed size, and is applied along z only. #if (AMREX_SPACEDIM == 3) stencil_length_each_dir = {1,1,5}; slen = {1,1,5}; -#else +#elif (AMREX_SPACEDIM == 2) stencil_length_each_dir = {1,5}; slen = {1,5,1}; -#endif #else amrex::ignore_unused(coeff_set, cdtodz, nodal_gather); amrex::Abort("NCIGodfreyFilter not implemented in 1D!"); diff --git a/Source/Laser/LaserProfilesImpl/LaserProfileFromTXYEFile.cpp b/Source/Laser/LaserProfilesImpl/LaserProfileFromTXYEFile.cpp index dd59bd225..d36386591 100644 --- a/Source/Laser/LaserProfilesImpl/LaserProfileFromTXYEFile.cpp +++ b/Source/Laser/LaserProfilesImpl/LaserProfileFromTXYEFile.cpp @@ -425,6 +425,11 @@ WarpXLaserProfiles::FromTXYEFileLaserProfile::internal_fill_amplitude_uniform( p_E_data[idx(idx_t_right, idx_x_right)], t, Xp[i])*tmp_e_max; amrex::ignore_unused(Yp); +#else + // TODO: implement WARPX_DIM_1D_Z + amrex::ignore_unused(x_0, x_1, tmp_e_max, p_E_data, tmp_idx_first_time, + t_left, t_right, Xp, Yp, t, idx_x_left); + amrex::Abort("WarpXLaserProfiles::FromTXYEFileLaserProfile Not implemented for the current geometry"); #endif } ); @@ -522,6 +527,11 @@ WarpXLaserProfiles::FromTXYEFileLaserProfile::internal_fill_amplitude_nonuniform p_E_data[idx(idx_t_right, idx_x_left)], p_E_data[idx(idx_t_right, idx_x_right)], t, Xp[ip])*tmp_e_max; +#else + // TODO: implement WARPX_DIM_1D_Z + amrex::ignore_unused(idx_x_left, idx_t_left, idx_t_right, tmp_e_max, + p_E_data, tmp_idx_first_time, t_left, t_right, t); + amrex::Abort("WarpXLaserProfiles::FromTXYEFileLaserProfile Not implemented for the current geometry"); #endif } ); diff --git a/Source/Parallelization/WarpXComm_K.H b/Source/Parallelization/WarpXComm_K.H index 5995243f5..f81f61f55 100644 --- a/Source/Parallelization/WarpXComm_K.H +++ b/Source/Parallelization/WarpXComm_K.H @@ -803,6 +803,7 @@ void warpx_interp (const int j, else // PSATD (finite-order interpolation) { #if (AMREX_SPACEDIM == 1) + amrex::ignore_unused(stencil_coeffs_z); amrex::Abort("PSATD not implemented in 1D"); #endif diff --git a/Source/Particles/ElementaryProcess/QEDSchwingerProcess.H b/Source/Particles/ElementaryProcess/QEDSchwingerProcess.H index c3582563b..6867544b8 100644 --- a/Source/Particles/ElementaryProcess/QEDSchwingerProcess.H +++ b/Source/Particles/ElementaryProcess/QEDSchwingerProcess.H @@ -78,7 +78,10 @@ struct SchwingerTransformFunc const amrex::Real total_weight) const noexcept { for (int n = 0; n < N; ++n){ -#if (AMREX_SPACEDIM == 3) +#if (AMREX_SPACEDIM == 1) + amrex::ignore_unused(dst1, dst2, i_dst1, i_dst2, N, total_weight); + amrex::Abort("SchwingerTransformFunc not implemented in 1D"); +#elif (AMREX_SPACEDIM == 3) dst1.m_rdata[m_weight_index][i_dst1+n] = total_weight/N; dst2.m_rdata[m_weight_index][i_dst2+n] = total_weight/N; #elif (AMREX_SPACEDIM == 2) diff --git a/Source/Particles/MultiParticleContainer.cpp b/Source/Particles/MultiParticleContainer.cpp index 70254aadd..fa0ffd2ee 100644 --- a/Source/Particles/MultiParticleContainer.cpp +++ b/Source/Particles/MultiParticleContainer.cpp @@ -1314,7 +1314,9 @@ MultiParticleContainer::doQEDSchwinger () // Get cell volume. In 2D the transverse size is // chosen by the user in the input file. amrex::Geometry const & geom = warpx.Geom(level_0); -#if (AMREX_SPACEDIM == 2) +#if (AMREX_SPACEDIM == 1) + const auto dV = geom.CellSize(0); // TODO: scale properly +#elif (AMREX_SPACEDIM == 2) const auto dV = geom.CellSize(0) * geom.CellSize(1) * m_qed_schwinger_y_size; #elif (AMREX_SPACEDIM == 3) diff --git a/Source/Particles/PhysicalParticleContainer.cpp b/Source/Particles/PhysicalParticleContainer.cpp index e34c4c28b..cdc1b0e02 100644 --- a/Source/Particles/PhysicalParticleContainer.cpp +++ b/Source/Particles/PhysicalParticleContainer.cpp @@ -1816,12 +1816,12 @@ PhysicalParticleContainer::applyNCIFilter ( const auto& nci_godfrey_filter_bxbyez = WarpX::GetInstance().nci_godfrey_filter_bxbyez; #if (AMREX_SPACEDIM == 1) - const Box& tbox = amrex::grow(box,{static_cast<int>(WarpX::noz)}); + const Box& tbox = amrex::grow(box, static_cast<int>(WarpX::noz)); #elif (AMREX_SPACEDIM == 2) - const Box& tbox = amrex::grow(box,{static_cast<int>(WarpX::nox), + const Box& tbox = amrex::grow(box, {static_cast<int>(WarpX::nox), static_cast<int>(WarpX::noz)}); #else - const Box& tbox = amrex::grow(box,{static_cast<int>(WarpX::nox), + const Box& tbox = amrex::grow(box, {static_cast<int>(WarpX::nox), static_cast<int>(WarpX::noy), static_cast<int>(WarpX::noz)}); #endif diff --git a/Source/WarpX.cpp b/Source/WarpX.cpp index f923c9121..e0613b3f1 100644 --- a/Source/WarpX.cpp +++ b/Source/WarpX.cpp @@ -1435,7 +1435,7 @@ WarpX::AllocLevelData (int lev, const BoxArray& ba, const DistributionMapping& d bool aux_is_nodal = (field_gathering_algo == GatheringAlgo::MomentumConserving); #if (AMREX_SPACEDIM == 1) - amrex::RealVect dx({WarpX::CellSize(lev)[2]}); + amrex::RealVect dx(WarpX::CellSize(lev)[2]); #elif (AMREX_SPACEDIM == 2) amrex::RealVect dx = {WarpX::CellSize(lev)[0], WarpX::CellSize(lev)[2]}; #elif (AMREX_SPACEDIM == 3) @@ -1964,11 +1964,7 @@ void WarpX::AllocLevelSpectralSolverRZ (amrex::Vector<std::unique_ptr<SpectralSo const amrex::DistributionMapping& dm, const std::array<Real,3>& dx) { -#if (AMREX_SPACEDIM == 3) - RealVect dx_vect(dx[0], dx[1], dx[2]); -#elif (AMREX_SPACEDIM == 2) RealVect dx_vect(dx[0], dx[2]); -#endif amrex::Real solver_dt = dt[lev]; if (WarpX::do_multi_J) solver_dt /= static_cast<amrex::Real>(WarpX::do_multi_J_n_depositions); @@ -2017,6 +2013,8 @@ void WarpX::AllocLevelSpectralSolver (amrex::Vector<std::unique_ptr<SpectralSolv RealVect dx_vect(dx[0], dx[1], dx[2]); #elif (AMREX_SPACEDIM == 2) RealVect dx_vect(dx[0], dx[2]); +#elif (AMREX_SPACEDIM == 1) + RealVect dx_vect(dx[2]); #endif amrex::Real solver_dt = dt[lev]; |