diff --git a/Src/LinearSolvers/MLMG/AMReX_MLCurlCurl.H b/Src/LinearSolvers/MLMG/AMReX_MLCurlCurl.H index ce8859eae1..1d6aa22401 100644 --- a/Src/LinearSolvers/MLMG/AMReX_MLCurlCurl.H +++ b/Src/LinearSolvers/MLMG/AMReX_MLCurlCurl.H @@ -109,7 +109,11 @@ public: // public for cuda +#if (AMREX_SPACEDIM > 1) void smooth4 (int amrlev, int mglev, MF& sol, MF const& rhs, int color) const; +#else + void smooth1D (int amrlev, int mglev, MF& sol, MF const& rhs, int color) const; +#endif void compresid (int amrlev, int mglev, MF& resid, MF const& b) const; @@ -130,8 +134,10 @@ private: Array m_etype #if (AMREX_SPACEDIM == 3) {IntVect(0,1,1), IntVect(1,0,1), IntVect(1,1,0)}; -#else +#elif (AMREX_SPACEDIM == 2) {IntVect(0,1), IntVect(1,0), IntVect(1,1)}; +#else + {IntVect(0), IntVect(1), IntVect(1)}; #endif mutable Vector,3>>> m_dotmask; diff --git a/Src/LinearSolvers/MLMG/AMReX_MLCurlCurl.cpp b/Src/LinearSolvers/MLMG/AMReX_MLCurlCurl.cpp index 5e797e9a5b..3e500351c9 100644 --- a/Src/LinearSolvers/MLMG/AMReX_MLCurlCurl.cpp +++ b/Src/LinearSolvers/MLMG/AMReX_MLCurlCurl.cpp @@ -78,7 +78,7 @@ void MLCurlCurl::setBeta (const Vector>& a_bcoefs) *m_bcoefs[amrlev][mglev ][idim], ratio); m_bcoefs[amrlev][mglev][idim]->FillBoundary(m_geom[amrlev][mglev].periodicity()); } -#if (AMREX_SPACEDIM == 2) +#if (AMREX_SPACEDIM < 3) if (m_bcoefs[amrlev][mglev][2] == nullptr) { m_bcoefs[amrlev][mglev][2] = std::make_unique (amrex::convert(m_grids[amrlev][mglev], m_etype[2]), @@ -86,6 +86,15 @@ void MLCurlCurl::setBeta (const Vector>& a_bcoefs) } average_down_nodal(*m_bcoefs[amrlev][mglev-1][2], *m_bcoefs[amrlev][mglev ][2], ratio); +#endif +#if (AMREX_SPACEDIM == 1) + if (m_bcoefs[amrlev][mglev][1] == nullptr) { + m_bcoefs[amrlev][mglev][1] = std::make_unique + (amrex::convert(m_grids[amrlev][mglev], m_etype[1]), + m_dmap[amrlev][mglev], 1, 0); + } + average_down_nodal(*m_bcoefs[amrlev][mglev-1][1], + *m_bcoefs[amrlev][mglev ][1], ratio); #endif } } @@ -316,15 +325,72 @@ void MLCurlCurl::smooth (int amrlev, int mglev, MF& sol, const MF& rhs, applyBC(amrlev, mglev, const_cast(rhs), CurlCurlStateType::b); - for (int color = 0; color < 4; ++color) { +#if (AMREX_SPACEDIM == 1) + int ncolors = 2; +#else + int ncolors = 4; +#endif + + for (int color = 0; color < ncolors; ++color) { if (!skip_fillboundary) { applyBC(amrlev, mglev, sol, CurlCurlStateType::x); } skip_fillboundary = false; +#if (AMREX_SPACEDIM == 1) + smooth1D(amrlev, mglev, sol, rhs, color); +#else smooth4(amrlev, mglev, sol, rhs, color); +#endif + } +} + +#if (AMREX_SPACEDIM == 1) +void MLCurlCurl::smooth1D (int amrlev, int mglev, MF& sol, MF const& rhs, + int color) const +{ + auto const& ex = sol[0].arrays(); + auto const& ey = sol[1].arrays(); + auto const& ez = sol[2].arrays(); + auto const& rhsx = rhs[0].const_arrays(); + auto const& rhsy = rhs[1].const_arrays(); + auto const& rhsz = rhs[2].const_arrays(); + + auto b = m_beta; + + auto dinfo = getDirichletInfo(amrlev,mglev); + auto adxinv = this->m_geom[amrlev][mglev].InvCellSizeArray(); + for (int idim = 0; idim < AMREX_SPACEDIM; ++idim) { + adxinv[idim] *= std::sqrt(m_alpha); + } + + MultiFab nmf(amrex::convert(rhs[0].boxArray(),IntVect(1)), + rhs[0].DistributionMap(), 1, 0, MFInfo().SetAlloc(false)); + + if (m_bcoefs[amrlev][mglev][0]) { + auto const& bcx = m_bcoefs[amrlev][mglev][0]->const_arrays(); + auto const& bcy = m_bcoefs[amrlev][mglev][1]->const_arrays(); + auto const& bcz = m_bcoefs[amrlev][mglev][2]->const_arrays(); + ParallelFor( nmf, [=] AMREX_GPU_DEVICE(int bno, int i, int j, int k) + { + mlcurlcurl_1D(i,j,k,ex[bno],ey[bno],ez[bno], + rhsx[bno],rhsy[bno],rhsz[bno], + bcx[bno],bcy[bno],bcz[bno], + adxinv,color,dinfo); + }); + Gpu::streamSynchronize(); + } else { + ParallelFor( nmf, [=] AMREX_GPU_DEVICE(int bno, int i, int j, int k) + { + mlcurlcurl_1D(i,j,k,ex[bno],ey[bno],ez[bno], + rhsx[bno],rhsy[bno],rhsz[bno], + b,adxinv,color,dinfo); + }); + Gpu::streamSynchronize(); } } +#endif +#if (AMREX_SPACEDIM > 1) void MLCurlCurl::smooth4 (int amrlev, int mglev, MF& sol, MF const& rhs, int color) const { @@ -386,6 +452,7 @@ void MLCurlCurl::smooth4 (int amrlev, int mglev, MF& sol, MF const& rhs, } Gpu::streamSynchronize(); } +#endif void MLCurlCurl::solutionResidual (int amrlev, MF& resid, MF& x, const MF& b, const MF* /*crse_bcdata*/) @@ -453,6 +520,7 @@ void MLCurlCurl::compresid (int amrlev, int mglev, MF& resid, MF const& b) const void MLCurlCurl::prepareForSolve () { +#if (AMREX_SPACEDIM > 1) if (m_bcoefs[0][0][0] == nullptr) { for (int amrlev = 0; amrlev < m_num_amr_levels; ++amrlev) { for (int mglev = 0; mglev < m_num_mg_levels[amrlev]; ++mglev) { @@ -536,6 +604,7 @@ void MLCurlCurl::prepareForSolve () } } } +#endif } Real MLCurlCurl::xdoty (int amrlev, int mglev, const MF& x, const MF& y, @@ -634,6 +703,10 @@ void MLCurlCurl::applyBC (int amrlev, int mglev, MF& in, CurlCurlStateType type) if (CurlCurlStateType::b == type) { nmfs = 2; // no need to applyBC on Ez } +#elif (AMREX_SPACEDIM == 1) + if (CurlCurlStateType::b == type) { + nmfs = 1; // no need to applyBC on Ey and Ez + } #endif Vector mfs(nmfs); for (int imf = 0; imf < nmfs; ++imf) { @@ -798,6 +871,10 @@ CurlCurlDirichletInfo MLCurlCurl::getDirichletInfo (int amrlev, int mglev) const if (idim == 2) { return std::numeric_limits::lowest(); } +#elif (AMREX_SPACEDIM == 1) + if (idim > 0) { + return std::numeric_limits::lowest(); + } #endif if (face == 0) { @@ -832,6 +909,10 @@ CurlCurlSymmetryInfo MLCurlCurl::getSymmetryInfo (int amrlev, int mglev) const if (idim == 2) { return std::numeric_limits::lowest(); } +#elif (AMREX_SPACEDIM == 1) + if (idim > 0) { + return std::numeric_limits::lowest(); + } #endif if (face == 0) { diff --git a/Src/LinearSolvers/MLMG/AMReX_MLCurlCurl_K.H b/Src/LinearSolvers/MLMG/AMReX_MLCurlCurl_K.H index e243b245f5..db8ea8affe 100644 --- a/Src/LinearSolvers/MLMG/AMReX_MLCurlCurl_K.H +++ b/Src/LinearSolvers/MLMG/AMReX_MLCurlCurl_K.H @@ -189,7 +189,10 @@ struct CurlCurlDirichletInfo [[nodiscard]] AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool is_dirichlet_node (int i, int j, int k) const { -#if (AMREX_SPACEDIM == 2) +#if (AMREX_SPACEDIM == 1) + amrex::ignore_unused(j,k); + return (i == dirichlet_lo[0]) || (i == dirichlet_hi[0]); +#elif (AMREX_SPACEDIM == 2) amrex::ignore_unused(k); return (i == dirichlet_lo[0]) || (i == dirichlet_hi[0]) || (j == dirichlet_lo[1]) || (j == dirichlet_hi[1]); @@ -201,9 +204,12 @@ struct CurlCurlDirichletInfo } [[nodiscard]] AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE - bool is_dirichlet_x_edge (int, int j, int k) const + bool is_dirichlet_x_edge (int, int j, int k) const // NOLINT(readability-convert-member-functions-to-static) { -#if (AMREX_SPACEDIM == 2) +#if (AMREX_SPACEDIM == 1) + amrex::ignore_unused(j, k); + return false; +#elif (AMREX_SPACEDIM == 2) amrex::ignore_unused(k); return (j == dirichlet_lo[1]) || (j == dirichlet_hi[1]); #else @@ -215,7 +221,7 @@ struct CurlCurlDirichletInfo [[nodiscard]] AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool is_dirichlet_y_edge (int i, int, int k) const { -#if (AMREX_SPACEDIM == 2) +#if (AMREX_SPACEDIM < 3) amrex::ignore_unused(k); return (i == dirichlet_lo[0]) || (i == dirichlet_hi[0]); #else @@ -227,8 +233,13 @@ struct CurlCurlDirichletInfo [[nodiscard]] AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool is_dirichlet_z_edge (int i, int j, int) const { +#if (AMREX_SPACEDIM == 1) + amrex::ignore_unused(j); + return (i == dirichlet_lo[0]) || (i == dirichlet_hi[0]); +#else return (i == dirichlet_lo[0]) || (i == dirichlet_hi[0]) || (j == dirichlet_lo[1]) || (j == dirichlet_hi[1]); +#endif } [[nodiscard]] AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE @@ -261,6 +272,7 @@ struct CurlCurlSymmetryInfo return i == symmetry_hi[0]; } +#if (AMREX_SPACEDIM > 1) [[nodiscard]] AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool ylo_is_symmetric (int j) const { @@ -272,6 +284,7 @@ struct CurlCurlSymmetryInfo { return j == symmetry_hi[1]; } +#endif #if (AMREX_SPACEDIM == 3) [[nodiscard]] AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE @@ -289,7 +302,10 @@ struct CurlCurlSymmetryInfo [[nodiscard]] bool is_symmetric (int dir, int side, int idx) const { -#if (AMREX_SPACEDIM == 2) +#if (AMREX_SPACEDIM == 1) + amrex::ignore_unused(dir); + return (side == 0) ? xlo_is_symmetric(idx) : xhi_is_symmetric(idx); +#elif (AMREX_SPACEDIM == 2) if (dir == 0) { return (side == 0) ? xlo_is_symmetric(idx) : xhi_is_symmetric(idx); } else { @@ -316,7 +332,10 @@ void mlcurlcurl_adotx_x (int i, int j, int k, Array4 const& Ax, Array4 const& ez, Real beta, GpuArray const& adxinv) { -#if (AMREX_SPACEDIM == 2) +#if (AMREX_SPACEDIM == 1) + amrex::ignore_unused(ey,ez,adxinv); + Real ccex = 0; +#elif (AMREX_SPACEDIM == 2) amrex::ignore_unused(ez); Real dyy = adxinv[1] * adxinv[1]; Real dxy = adxinv[0] * adxinv[1]; @@ -327,7 +346,7 @@ void mlcurlcurl_adotx_x (int i, int j, int k, Array4 const& Ax, - ey(i ,j ,k ) - ey(i+1,j-1,k ) + ey(i+1,j ,k )); -#else +#elif (AMREX_SPACEDIM == 3) Real dyy = adxinv[1] * adxinv[1]; Real dzz = adxinv[2] * adxinv[2]; Real dxy = adxinv[0] * adxinv[1]; @@ -356,7 +375,13 @@ void mlcurlcurl_adotx_y (int i, int j, int k, Array4 const& Ay, Array4 const& ez, Real beta, GpuArray const& adxinv) { -#if (AMREX_SPACEDIM == 2) +#if (AMREX_SPACEDIM == 1) + amrex::ignore_unused(ex,ez); + Real dxx = adxinv[0] * adxinv[0]; + Real ccey = ey(i ,j ,k ) * dxx * Real(2.0) + - dxx * (ey(i-1,j ,k ) + + ey(i+1,j ,k )); +#elif (AMREX_SPACEDIM == 2) amrex::ignore_unused(ez); Real dxx = adxinv[0] * adxinv[0]; Real dxy = adxinv[0] * adxinv[1]; @@ -367,7 +392,7 @@ void mlcurlcurl_adotx_y (int i, int j, int k, Array4 const& Ay, - ex(i ,j ,k ) - ex(i-1,j+1,k ) + ex(i ,j+1,k )); -#else +#elif (AMREX_SPACEDIM == 3) Real dxx = adxinv[0] * adxinv[0]; Real dzz = adxinv[2] * adxinv[2]; Real dxy = adxinv[0] * adxinv[1]; @@ -396,7 +421,13 @@ void mlcurlcurl_adotx_z (int i, int j, int k, Array4 const& Az, Array4 const& ez, Real beta, GpuArray const& adxinv) { -#if (AMREX_SPACEDIM == 2) +#if (AMREX_SPACEDIM == 1) + amrex::ignore_unused(ex,ey); + Real dxx = adxinv[0] * adxinv[0]; + Real ccez = ez(i ,j ,k ) * dxx*Real(2.0) + - dxx * (ez(i-1,j ,k ) + + ez(i+1,j ,k )); +#elif (AMREX_SPACEDIM == 2) amrex::ignore_unused(ex,ey); Real dxx = adxinv[0] * adxinv[0]; Real dyy = adxinv[1] * adxinv[1]; @@ -405,7 +436,7 @@ void mlcurlcurl_adotx_z (int i, int j, int k, Array4 const& Az, ez(i+1,j ,k )) - dyy * (ez(i ,j-1,k ) + ez(i ,j+1,k )); -#else +#elif (AMREX_SPACEDIM == 3) Real dxx = adxinv[0] * adxinv[0]; Real dyy = adxinv[1] * adxinv[1]; Real dxz = adxinv[0] * adxinv[2]; @@ -427,6 +458,88 @@ void mlcurlcurl_adotx_z (int i, int j, int k, Array4 const& Az, Az(i,j,k) = ccez + beta * ez(i,j,k); } +#if (AMREX_SPACEDIM == 1) +AMREX_GPU_DEVICE AMREX_FORCE_INLINE +void mlcurlcurl_1D (int i, int j, int k, + Array4 const& ex, + Array4 const& ey, + Array4 const& ez, + Array4 const& rhsx, + Array4 const& rhsy, + Array4 const& rhsz, + Real beta, + GpuArray const& adxinv, + int color, + CurlCurlDirichletInfo const& dinfo) +{ + if (dinfo.is_dirichlet_node(i,j,k)) {return; } + + Real dxx = adxinv[0] * adxinv[0]; + + int my_color = i%2; + + if (my_color == color) + { + ex(i,j,k) = rhsx(i,j,k) / beta; + + Real gamma_y = dxx * Real(2.0) + beta; + Real ccey = - dxx * (ey(i-1,j ,k ) + + ey(i+1,j ,k ) ); + Real res_y = rhsy(i,j,k) - ( gamma_y * ey(i,j,k) + ccey ); + ey(i,j,k) += res_y/gamma_y; + + Real gamma_z = dxx * Real(2.0) + beta; + Real ccez = -dxx * (ez(i-1,j ,k ) + + ez(i+1,j ,k ) ); + Real res_z = rhsz(i,j,k) - ( gamma_z * ez(i,j,k) + ccez ); + ez(i,j,k) += res_z/gamma_z; + } +} + + +AMREX_GPU_DEVICE AMREX_FORCE_INLINE +void mlcurlcurl_1D (int i, int j, int k, + Array4 const& ex, + Array4 const& ey, + Array4 const& ez, + Array4 const& rhsx, + Array4 const& rhsy, + Array4 const& rhsz, + Array4 const& betax, + Array4 const& betay, + Array4 const& betaz, + GpuArray const& adxinv, + int color, + CurlCurlDirichletInfo const& dinfo) +{ + if (dinfo.is_dirichlet_node(i,j,k)) {return; } + Real dxx = adxinv[0] * adxinv[0]; + + int my_color = i%2; + + if (my_color == color) + { + ex(i,j,k) = rhsx(i,j,k) / betax(i,j,k); + + Real gamma_y = dxx * Real(2.0) + betay(i,j,k); + Real ccey = - dxx * (ey(i-1,j ,k ) + + ey(i+1,j ,k ) ); + Real res_y = rhsy(i,j,k) - ( gamma_y * ey(i,j,k) + ccey ); + ey(i,j,k) += res_y/gamma_y; + + Real gamma_z = dxx * Real(2.0) + betaz(i,j,k); + Real ccez = -dxx * (ez(i-1,j ,k ) + + ez(i+1,j ,k ) ); + Real res_z = rhsz(i,j,k) - ( gamma_z * ez(i,j,k) + ccez ); + ez(i,j,k) += res_z/gamma_z; + } +} + + +#endif + +#if (AMREX_SPACEDIM > 1) + AMREX_GPU_DEVICE AMREX_FORCE_INLINE void mlcurlcurl_gs4_lu (int i, int j, int k, Array4 const& ex, @@ -509,7 +622,7 @@ void mlcurlcurl_gs4_lu (int i, int j, int k, ey(i ,j-1,k ) = x[2]; ey(i ,j ,k ) = x[3]; -#else +#elif (AMREX_SPACEDIM == 3) if (my_color != color) { return; } @@ -739,7 +852,7 @@ void mlcurlcurl_gs4 (int i, int j, int k, ey(i ,j ,k ) = beta[3]; } -#else +#elif (AMREX_SPACEDIM == 3) if (my_color != color) { return; } @@ -925,6 +1038,8 @@ void mlcurlcurl_gs4 (int i, int j, int k, #endif } +#endif + AMREX_GPU_DEVICE AMREX_FORCE_INLINE void mlcurlcurl_interpadd (int dir, int i, int j, int k, Array4 const& fine, @@ -1051,7 +1166,7 @@ void mlcurlcurl_restriction (int dir, int i, int j, int k, fine(ii ,jj+1,kk+1) * Real(2.0) + fine(ii+1,jj+1,kk+1) ); } -#else +#elif (AMREX_SPACEDIM == 2) if (dir == 0) { crse(i,j,0) = Real(0.125) * (fine(ii ,jj-1,0) + fine(ii ,jj ,0) * Real(2.0) + @@ -1072,6 +1187,15 @@ void mlcurlcurl_restriction (int dir, int i, int j, int k, + fine(ii-1,jj+1,0) + Real(2.)*fine(ii ,jj+1,0) + fine(ii+1,jj+1,0)); } + +#elif (AMREX_SPACEDIM == 1) + if (dir == 0) { + crse(i,0,0) = Real(0.5) * (fine(ii,0,0) + fine(ii+1,0,0)); + } else { + crse(i,0,0) = Real(0.25) * (fine(ii-1,0,0) + + fine(ii ,0,0) * Real(2.0) + + fine(ii+1,0,0)); + } #endif } } diff --git a/Src/LinearSolvers/MLMG/Make.package b/Src/LinearSolvers/MLMG/Make.package index 8e8d9b3ac1..434c40849f 100644 --- a/Src/LinearSolvers/MLMG/Make.package +++ b/Src/LinearSolvers/MLMG/Make.package @@ -88,11 +88,9 @@ endif endif # ifneq ($(USE_LINEAR_SOLVERS_INCFLO),FALSE) ifneq ($(USE_LINEAR_SOLVERS_EM),FALSE) -ifneq ($(DIM),1) CEXE_headers += AMReX_MLCurlCurl.H CEXE_sources += AMReX_MLCurlCurl.cpp CEXE_headers += AMReX_MLCurlCurl_K.H -endif CEXE_headers += AMReX_MLEBNodeFDLaplacian.H CEXE_sources += AMReX_MLEBNodeFDLaplacian.cpp diff --git a/Tests/LinearSolvers/CurlCurl/MyTest.cpp b/Tests/LinearSolvers/CurlCurl/MyTest.cpp index 1093e8c8de..f8a84ca505 100644 --- a/Tests/LinearSolvers/CurlCurl/MyTest.cpp +++ b/Tests/LinearSolvers/CurlCurl/MyTest.cpp @@ -135,7 +135,7 @@ MyTest::initData () for (int idim = 0; idim < 3; ++idim) { IntVect itype(1); -#if (AMREX_SPACEDIM == 2) +#if (AMREX_SPACEDIM < 3) if (idim < AMREX_SPACEDIM) #endif { diff --git a/Tests/LinearSolvers/CurlCurl/initProb_K.H b/Tests/LinearSolvers/CurlCurl/initProb_K.H index 66b7d2916c..b568f57500 100644 --- a/Tests/LinearSolvers/CurlCurl/initProb_K.H +++ b/Tests/LinearSolvers/CurlCurl/initProb_K.H @@ -16,9 +16,11 @@ void actual_init_prob (int i, int j, int k, constexpr Real pi = amrex::Math::pi(); Real xnd = problo[0] + Real(i)*dx[0]; - Real ynd = problo[1] + Real(j)*dx[1]; Real xcc = xnd + Real(0.5)*dx[0]; +#if (AMREX_SPACEDIM > 1) + Real ynd = problo[1] + Real(j)*dx[1]; Real ycc = ynd + Real(0.5)*dx[1]; +#endif #if (AMREX_SPACEDIM == 3) Real znd = problo[2] + Real(k)*dx[2]; Real zcc = znd + Real(0.5)*dx[2]; @@ -26,8 +28,11 @@ void actual_init_prob (int i, int j, int k, if (sol[0].contains(i,j,k)) { Real x = xcc; + Real Ex = std::sin(pi*x); +#if (AMREX_SPACEDIM > 1) Real y = ynd; - Real Ex = std::sin(pi*x) * std::sin(Real(2.5)*pi*y); + Ex *= std::sin(Real(2.5)*pi*y); +#endif #if (AMREX_SPACEDIM == 3) Real z = znd; Ex *= std::sin(Real(2.0)*pi*z + Real(1./3.)*pi); @@ -37,8 +42,11 @@ void actual_init_prob (int i, int j, int k, if (sol[1].contains(i,j,k)) { Real x = xnd; + Real Ey = std::cos(Real(2.5)*pi*x); +#if (AMREX_SPACEDIM > 1) Real y = ycc; - Real Ey = std::cos(Real(2.5)*pi*x) * std::sin(Real(3.)*pi*y); + Ey *= std::sin(Real(3.)*pi*y); +#endif #if (AMREX_SPACEDIM == 3) Real z = znd; Ey *= std::sin(Real(4.)*pi*z + Real(0.25)*pi); @@ -48,8 +56,11 @@ void actual_init_prob (int i, int j, int k, if (sol[2].contains(i,j,k)) { Real x = xnd; + Real Ez = std::cos(Real(3.5)*pi*x); +#if (AMREX_SPACEDIM > 1) Real y = ynd; - Real Ez = std::cos(Real(3.5)*pi*x) * std::sin(Real(3.5)*pi*y); + Ez *= std::sin(Real(3.5)*pi*y); +#endif #if (AMREX_SPACEDIM == 3) Real z = zcc; Ez *= std::sin(Real(4.)*pi*z + Real(1./6.)*pi); @@ -58,9 +69,13 @@ void actual_init_prob (int i, int j, int k, } if (rhs[0].contains(i,j,k)) { +#if (AMREX_SPACEDIM > 1) Real x = xcc; Real y = ynd; -#if (AMREX_SPACEDIM == 2) +#endif +#if (AMREX_SPACEDIM == 1) + Real cce = 0; +#elif (AMREX_SPACEDIM == 2) Real cce = Real(-7.5)*pi*pi*std::sin(Real(2.5)*pi*x)*std::cos(Real(3.)*pi*y) + Real(6.25)*pi*pi*std::sin(pi*x)*std::sin(Real(2.5)*pi*y); #else @@ -75,8 +90,12 @@ void actual_init_prob (int i, int j, int k, if (rhs[1].contains(i,j,k)) { Real x = xnd; +#if (AMREX_SPACEDIM > 1) Real y = ycc; -#if (AMREX_SPACEDIM == 2) +#endif +#if (AMREX_SPACEDIM == 1) + Real cce = Real(6.25)*pi*pi*std::cos(Real(2.5)*pi*x); +#elif (AMREX_SPACEDIM == 2) Real cce = Real(6.25)*pi*pi*std::cos(Real(2.5)*pi*x)*std::sin(Real(3.)*pi*y) + Real(2.5)*pi*pi*std::cos(pi*x)*std::cos(Real(2.5)*pi*y); #else @@ -91,8 +110,12 @@ void actual_init_prob (int i, int j, int k, if (rhs[2].contains(i,j,k)) { Real x = xnd; +#if (AMREX_SPACEDIM > 1) Real y = ynd; -#if (AMREX_SPACEDIM == 2) +#endif +#if (AMREX_SPACEDIM == 1) + Real cce = Real(12.25)*pi*pi*std::cos(Real(3.5)*pi*x); +#elif (AMREX_SPACEDIM == 2) Real cce = Real(24.5)*pi*pi*std::cos(Real(3.5)*pi*x)*std::sin(Real(3.5)*pi*y); #else Real z = zcc;