From 6a910565733eb78224957ad455e50469908592f0 Mon Sep 17 00:00:00 2001 From: James McClung Date: Wed, 12 Nov 2025 13:55:35 -0500 Subject: [PATCH 01/14] dim: +get_noninvariant_mask --- src/include/dim.hxx | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/include/dim.hxx b/src/include/dim.hxx index a98cfa1872..1f5ccfe762 100644 --- a/src/include/dim.hxx +++ b/src/include/dim.hxx @@ -3,12 +3,24 @@ #include +#include "kg/Vec3.h" + template struct Invar { using InvarX = std::integral_constant; using InvarY = std::integral_constant; using InvarZ = std::integral_constant; + + /// @brief Gets a mask of noninvariant dimensions (i.e., 0 for invariant + /// dimensions, 1 for noninvariant dimensions). This is useful for multiplying + /// by a constant to, say, get the number of ghost cells in each dimension + /// (where invariant dimensions have no ghosts). + /// @return the mask + static Int3 get_noninvariant_mask() + { + return {!InvarX::value, !InvarY::value, !InvarZ::value}; + } }; using dim_xyz = Invar; From 7ff4a1074fd1785292d28cb723a1afbac9f1e55d Mon Sep 17 00:00:00 2001 From: James McClung Date: Wed, 12 Nov 2025 14:00:11 -0500 Subject: [PATCH 02/14] *: ibn = n_ghosts * noninvariant_mask --- src/libpsc/tests/test_boundary_injector.cxx | 12 ++---------- src/libpsc/tests/test_reflective_bcs.cxx | 12 ++---------- src/libpsc/tests/test_reflective_bcs_integration.cxx | 12 ++---------- src/psc_2d_shock.cxx | 12 ++---------- src/psc_bgk.cxx | 12 ++---------- src/psc_bubble_yz.cxx | 12 ++---------- src/psc_flatfoil_yz.cxx | 12 ++---------- src/psc_harris_xz.cxx | 12 ++---------- src/psc_harris_yz.cxx | 12 ++---------- src/psc_radiation.cxx | 12 ++---------- src/psc_shock.cxx | 12 ++---------- src/psc_whistler.cxx | 12 ++---------- 12 files changed, 24 insertions(+), 120 deletions(-) diff --git a/src/libpsc/tests/test_boundary_injector.cxx b/src/libpsc/tests/test_boundary_injector.cxx index d424c8354e..002930265d 100644 --- a/src/libpsc/tests/test_boundary_injector.cxx +++ b/src/libpsc/tests/test_boundary_injector.cxx @@ -68,16 +68,8 @@ Grid_t* setupGrid() double dt = .1; Grid_t::Normalization norm{norm_params}; - Int3 ibn = {2, 2, 2}; - if (Dim::InvarX::value) { - ibn[0] = 0; - } - if (Dim::InvarY::value) { - ibn[1] = 0; - } - if (Dim::InvarZ::value) { - ibn[2] = 0; - } + int n_ghosts = 2; + Int3 ibn = n_ghosts * Dim::get_noninvariant_mask(); return new Grid_t{domain, bc, kinds, norm, dt, -1, ibn}; } diff --git a/src/libpsc/tests/test_reflective_bcs.cxx b/src/libpsc/tests/test_reflective_bcs.cxx index 18cb4206b1..e16721eb1f 100644 --- a/src/libpsc/tests/test_reflective_bcs.cxx +++ b/src/libpsc/tests/test_reflective_bcs.cxx @@ -65,16 +65,8 @@ Grid_t* setupGrid() double dt = psc_params.cfl * courant_length(domain); Grid_t::Normalization norm{norm_params}; - Int3 ibn = {2, 2, 2}; - if (Dim::InvarX::value) { - ibn[0] = 0; - } - if (Dim::InvarY::value) { - ibn[1] = 0; - } - if (Dim::InvarZ::value) { - ibn[2] = 0; - } + int n_ghosts = 2; + Int3 ibn = n_ghosts * Dim::get_noninvariant_mask(); return new Grid_t{domain, bc, kinds, norm, dt, -1, ibn}; } diff --git a/src/libpsc/tests/test_reflective_bcs_integration.cxx b/src/libpsc/tests/test_reflective_bcs_integration.cxx index 8519c5690a..b2cefb3abe 100644 --- a/src/libpsc/tests/test_reflective_bcs_integration.cxx +++ b/src/libpsc/tests/test_reflective_bcs_integration.cxx @@ -65,16 +65,8 @@ Grid_t* setupGrid() double dt = psc_params.cfl * courant_length(domain); Grid_t::Normalization norm{norm_params}; - Int3 ibn = {2, 2, 2}; - if (Dim::InvarX::value) { - ibn[0] = 0; - } - if (Dim::InvarY::value) { - ibn[1] = 0; - } - if (Dim::InvarZ::value) { - ibn[2] = 0; - } + int n_ghosts = 2; + Int3 ibn = n_ghosts * Dim::get_noninvariant_mask(); return new Grid_t{domain, bc, kinds, norm, dt, -1, ibn}; } diff --git a/src/psc_2d_shock.cxx b/src/psc_2d_shock.cxx index e5dc8485a1..97d72c4d1c 100644 --- a/src/psc_2d_shock.cxx +++ b/src/psc_2d_shock.cxx @@ -320,16 +320,8 @@ Grid_t* setupGrid() double dt = psc_params.cfl * courant_length(domain); Grid_t::Normalization norm{norm_params}; - Int3 ibn = {2, 2, 2}; - if (Dim::InvarX::value) { - ibn[0] = 0; - } - if (Dim::InvarY::value) { - ibn[1] = 0; - } - if (Dim::InvarZ::value) { - ibn[2] = 0; - } + int n_ghosts = 2; + Int3 ibn = n_ghosts * Dim::get_noninvariant_mask(); return new Grid_t{domain, bc, kinds, norm, dt, -1, ibn}; } diff --git a/src/psc_bgk.cxx b/src/psc_bgk.cxx index a0c50254ea..da9fdea3d8 100644 --- a/src/psc_bgk.cxx +++ b/src/psc_bgk.cxx @@ -129,16 +129,8 @@ Grid_t* setupGrid() double dt = psc_params.cfl * courant_length(domain); Grid_t::Normalization norm{norm_params}; - Int3 ibn = {2, 2, 2}; - if (Dim::InvarX::value) { - ibn[0] = 0; - } - if (Dim::InvarY::value) { - ibn[1] = 0; - } - if (Dim::InvarZ::value) { - ibn[2] = 0; - } + int n_ghosts = 2; + Int3 ibn = n_ghosts * Dim::get_noninvariant_mask(); return new Grid_t{domain, bc, kinds, norm, dt, -1, ibn}; } diff --git a/src/psc_bubble_yz.cxx b/src/psc_bubble_yz.cxx index 0ee3089921..93c67ca7f3 100644 --- a/src/psc_bubble_yz.cxx +++ b/src/psc_bubble_yz.cxx @@ -141,16 +141,8 @@ Grid_t* setupGrid() double dt = psc_params.cfl * courant_length(domain); Grid_t::Normalization norm{norm_params}; - Int3 ibn = {2, 2, 2}; - if (Dim::InvarX::value) { - ibn[0] = 0; - } - if (Dim::InvarY::value) { - ibn[1] = 0; - } - if (Dim::InvarZ::value) { - ibn[2] = 0; - } + int n_ghosts = 2; + Int3 ibn = n_ghosts * Dim::get_noninvariant_mask(); return new Grid_t{domain, bc, kinds, norm, dt, -1, ibn}; } diff --git a/src/psc_flatfoil_yz.cxx b/src/psc_flatfoil_yz.cxx index 37c92ce9e2..ff2910e74f 100644 --- a/src/psc_flatfoil_yz.cxx +++ b/src/psc_flatfoil_yz.cxx @@ -339,16 +339,8 @@ Grid_t* setupGrid() mpi_printf(MPI_COMM_WORLD, "dt = %g\n", dt); - Int3 ibn = {2, 2, 2}; - if (Dim::InvarX::value) { - ibn[0] = 0; - } - if (Dim::InvarY::value) { - ibn[1] = 0; - } - if (Dim::InvarZ::value) { - ibn[2] = 0; - } + int n_ghosts = 2; + Int3 ibn = n_ghosts * Dim::get_noninvariant_mask(); return new Grid_t{domain, bc, kinds, norm, dt, -1, ibn}; } diff --git a/src/psc_harris_xz.cxx b/src/psc_harris_xz.cxx index 276676d19d..b8e65c11ff 100644 --- a/src/psc_harris_xz.cxx +++ b/src/psc_harris_xz.cxx @@ -368,16 +368,8 @@ Grid_t* setupGrid() #ifdef VPIC Int3 ibn = {1, 1, 1}; #else - Int3 ibn = {2, 2, 2}; - if (Dim::InvarX::value) { - ibn[0] = 0; - } - if (Dim::InvarY::value) { - ibn[1] = 0; - } - if (Dim::InvarZ::value) { - ibn[2] = 0; - } + int n_ghosts = 2; + Int3 ibn = n_ghosts * Dim::get_noninvariant_mask(); #endif auto grid_ptr = new Grid_t{domain, bc, kinds, norm, dt, -1, ibn}; diff --git a/src/psc_harris_yz.cxx b/src/psc_harris_yz.cxx index 0d1f27a126..aa2df93a27 100644 --- a/src/psc_harris_yz.cxx +++ b/src/psc_harris_yz.cxx @@ -247,16 +247,8 @@ Grid_t* setupGrid() mpi_printf(MPI_COMM_WORLD, "dt = %g\n", dt); - Int3 ibn = {2, 2, 2}; - if (Dim::InvarX::value) { - ibn[0] = 0; - } - if (Dim::InvarY::value) { - ibn[1] = 0; - } - if (Dim::InvarZ::value) { - ibn[2] = 0; - } + int n_ghosts = 2; + Int3 ibn = n_ghosts * Dim::get_noninvariant_mask(); return new Grid_t{domain, bc, kinds, norm, dt, -1, ibn}; } diff --git a/src/psc_radiation.cxx b/src/psc_radiation.cxx index 3097c831fb..369b76a94a 100644 --- a/src/psc_radiation.cxx +++ b/src/psc_radiation.cxx @@ -150,16 +150,8 @@ Grid_t* setupGrid() mpi_printf(MPI_COMM_WORLD, "dt = %g\n", dt); - Int3 ibn = {2, 2, 2}; - if (Dim::InvarX::value) { - ibn[0] = 0; - } - if (Dim::InvarY::value) { - ibn[1] = 0; - } - if (Dim::InvarZ::value) { - ibn[2] = 0; - } + int n_ghosts = 2; + Int3 ibn = n_ghosts * Dim::get_noninvariant_mask(); return new Grid_t{domain, bc, kinds, norm, dt, -1, ibn}; } diff --git a/src/psc_shock.cxx b/src/psc_shock.cxx index 0ccc424784..85874b9e77 100644 --- a/src/psc_shock.cxx +++ b/src/psc_shock.cxx @@ -175,16 +175,8 @@ Grid_t* setupGrid() double dt = psc_params.cfl * courant_length(domain); Grid_t::Normalization norm{norm_params}; - Int3 ibn = {2, 2, 2}; - if (Dim::InvarX::value) { - ibn[0] = 0; - } - if (Dim::InvarY::value) { - ibn[1] = 0; - } - if (Dim::InvarZ::value) { - ibn[2] = 0; - } + int n_ghosts = 2; + Int3 ibn = n_ghosts * Dim::get_noninvariant_mask(); return new Grid_t{domain, bc, kinds, norm, dt, -1, ibn}; } diff --git a/src/psc_whistler.cxx b/src/psc_whistler.cxx index 793cd2f89e..6437bdac15 100644 --- a/src/psc_whistler.cxx +++ b/src/psc_whistler.cxx @@ -163,16 +163,8 @@ Grid_t* setupGrid() double dt = psc_params.cfl * courant_length(domain); Grid_t::Normalization norm{norm_params}; - Int3 ibn = {2, 2, 2}; - if (Dim::InvarX::value) { - ibn[0] = 0; - } - if (Dim::InvarY::value) { - ibn[1] = 0; - } - if (Dim::InvarZ::value) { - ibn[2] = 0; - } + int n_ghosts = 2; + Int3 ibn = n_ghosts * Dim::get_noninvariant_mask(); return new Grid_t{domain, bc, kinds, norm, dt, -1, ibn}; } From 5a6770c2790e2121edde0ab47b116985b8415e92 Mon Sep 17 00:00:00 2001 From: James McClung Date: Tue, 18 Nov 2025 11:53:11 -0500 Subject: [PATCH 03/14] Domain: log error instead of assert --- src/include/grid/Domain.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/include/grid/Domain.h b/src/include/grid/Domain.h index a6bb98f214..9c289bf54f 100644 --- a/src/include/grid/Domain.h +++ b/src/include/grid/Domain.h @@ -4,6 +4,7 @@ #include #include +#include "../libpsc/vpic/psc_vpic_bits.h" namespace psc { @@ -26,7 +27,11 @@ struct Domain : gdims(gdims), length(length), corner(corner), np(np) { for (int d = 0; d < 3; d++) { - assert(gdims[d] % np[d] == 0); + if (gdims[d] % np[d] != 0) { + LOG_ERROR("in dimension %d, number of patches (%d) doesn't divide " + "number of cells (%d)\n", + d, np[d], gdims[d]); + } ldims[d] = gdims[d] / np[d]; } dx = length / Real3(gdims); From c4702a9fdc4fd0d18e745538e4d6cea96688e40c Mon Sep 17 00:00:00 2001 From: James McClung Date: Tue, 18 Nov 2025 11:55:50 -0500 Subject: [PATCH 04/14] Domain: check length and gdims --- src/include/grid/Domain.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/include/grid/Domain.h b/src/include/grid/Domain.h index 9c289bf54f..2d9ec90fc9 100644 --- a/src/include/grid/Domain.h +++ b/src/include/grid/Domain.h @@ -32,6 +32,16 @@ struct Domain "number of cells (%d)\n", d, np[d], gdims[d]); } + + if (length[d] <= 0.0) { + LOG_ERROR("dimension %d has non-positive length (%f)\n", d, length[d]); + } + + if (gdims[d] <= 0) { + LOG_ERROR("dimension %d has non-positive number of cells (%d)\n", d, + gdims[d]); + } + ldims[d] = gdims[d] / np[d]; } dx = length / Real3(gdims); From f415a3a57a5929a6180d1279ce9c2cd87efeec89 Mon Sep 17 00:00:00 2001 From: James McClung Date: Tue, 18 Nov 2025 11:55:57 -0500 Subject: [PATCH 05/14] grid: rm redundant assertions --- src/include/grid.hxx | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/include/grid.hxx b/src/include/grid.hxx index e11cc9ff4c..972cc2aaf2 100644 --- a/src/include/grid.hxx +++ b/src/include/grid.hxx @@ -81,10 +81,6 @@ struct Grid_ mpi_printf(MPI_COMM_WORLD, "::: dx = %g %g %g\n", domain.dx[0], domain.dx[1], domain.dx[2]); #endif - assert(domain.dx[0] > 0.); - assert(domain.dx[1] > 0.); - assert(domain.dx[2] > 0.); - for (auto off : mrc_domain_.offs()) { patches.push_back(Patch( off, Vec3(off) * domain.dx + domain.corner, From 53d96f284204c878d8f3b1ca5a8e601659551db2 Mon Sep 17 00:00:00 2001 From: James McClung Date: Tue, 18 Nov 2025 11:58:33 -0500 Subject: [PATCH 06/14] Domain: pragma once --- src/include/grid/Domain.h | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/include/grid/Domain.h b/src/include/grid/Domain.h index 2d9ec90fc9..83277a587c 100644 --- a/src/include/grid/Domain.h +++ b/src/include/grid/Domain.h @@ -1,6 +1,4 @@ - -#ifndef GRID_DOMAIN_H -#define GRID_DOMAIN_H +#pragma once #include #include @@ -78,5 +76,3 @@ inline std::ostream& operator<<(std::ostream& os, const Domain& domain) } // namespace grid } // namespace psc - -#endif From 516f763aa5ee64997e76c48b56e43eca49283e9b Mon Sep 17 00:00:00 2001 From: James McClung Date: Tue, 18 Nov 2025 11:59:44 -0500 Subject: [PATCH 07/14] domain: rename and fix ext --- src/include/grid.hxx | 2 +- src/include/grid/{Domain.h => domain.hxx} | 0 src/include/mrc_domain.hxx | 2 +- 3 files changed, 2 insertions(+), 2 deletions(-) rename src/include/grid/{Domain.h => domain.hxx} (100%) diff --git a/src/include/grid.hxx b/src/include/grid.hxx index 972cc2aaf2..d3e3c60e11 100644 --- a/src/include/grid.hxx +++ b/src/include/grid.hxx @@ -7,7 +7,7 @@ #include "psc_bits.h" #include "mrc_domain.hxx" #include "grid/BC.h" -#include "grid/Domain.h" +#include "grid/domain.hxx" #include #include diff --git a/src/include/grid/Domain.h b/src/include/grid/domain.hxx similarity index 100% rename from src/include/grid/Domain.h rename to src/include/grid/domain.hxx diff --git a/src/include/mrc_domain.hxx b/src/include/mrc_domain.hxx index 1d7c0ea475..3a98d393c1 100644 --- a/src/include/mrc_domain.hxx +++ b/src/include/mrc_domain.hxx @@ -2,7 +2,7 @@ #pragma once #include "grid/BC.h" -#include "grid/Domain.h" +#include "grid/domain.hxx" #include From c0b2f97721246d52a4845d6ac5d5a9c7de7ebb34 Mon Sep 17 00:00:00 2001 From: James McClung Date: Tue, 18 Nov 2025 12:01:02 -0500 Subject: [PATCH 08/14] domain: use Int3 div --- src/include/grid/domain.hxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/include/grid/domain.hxx b/src/include/grid/domain.hxx index 83277a587c..30ec47b57d 100644 --- a/src/include/grid/domain.hxx +++ b/src/include/grid/domain.hxx @@ -39,9 +39,9 @@ struct Domain LOG_ERROR("dimension %d has non-positive number of cells (%d)\n", d, gdims[d]); } - - ldims[d] = gdims[d] / np[d]; } + + ldims = gdims / np; dx = length / Real3(gdims); } From 954718ea8a47dc465bc62dc650d75527c19008cf Mon Sep 17 00:00:00 2001 From: James McClung Date: Tue, 18 Nov 2025 12:04:26 -0500 Subject: [PATCH 09/14] domain: fancier comments --- src/include/grid/domain.hxx | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/include/grid/domain.hxx b/src/include/grid/domain.hxx index 30ec47b57d..7aaaa2ff70 100644 --- a/src/include/grid/domain.hxx +++ b/src/include/grid/domain.hxx @@ -53,11 +53,17 @@ struct Domain bool isInvar(int d) const { return gdims[d] == 1; } - Int3 gdims; ///< Number of grid-points in each dimension - Real3 length; ///< The physical size of the simulation-box + /// @brief Total number of grid cells in each dimension. + Int3 gdims; + /// @brief Side lengths of the domain, in physical units. + Real3 length; + /// @brief Location of lower-right corner of the domain, in physical units. Real3 corner; - Int3 np; ///< Number of patches in each dimension + /// @brief Number of patches in each dimension. + Int3 np; + /// @brief Number of grid cells per patch in each dimension. Int3 ldims; + /// @brief Side lengths of each grid cell, in physical units. Real3 dx; }; From 6342f568697472583cd9118c07179e4a53511516 Mon Sep 17 00:00:00 2001 From: James McClung Date: Tue, 18 Nov 2025 12:05:46 -0500 Subject: [PATCH 10/14] domain: check gdims first --- src/include/grid/domain.hxx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/include/grid/domain.hxx b/src/include/grid/domain.hxx index 7aaaa2ff70..ce7f20f6a2 100644 --- a/src/include/grid/domain.hxx +++ b/src/include/grid/domain.hxx @@ -25,6 +25,11 @@ struct Domain : gdims(gdims), length(length), corner(corner), np(np) { for (int d = 0; d < 3; d++) { + if (gdims[d] <= 0) { + LOG_ERROR("dimension %d has non-positive number of cells (%d)\n", d, + gdims[d]); + } + if (gdims[d] % np[d] != 0) { LOG_ERROR("in dimension %d, number of patches (%d) doesn't divide " "number of cells (%d)\n", @@ -34,11 +39,6 @@ struct Domain if (length[d] <= 0.0) { LOG_ERROR("dimension %d has non-positive length (%f)\n", d, length[d]); } - - if (gdims[d] <= 0) { - LOG_ERROR("dimension %d has non-positive number of cells (%d)\n", d, - gdims[d]); - } } ldims = gdims / np; From 7b29bca7d2843531175a2da8a191750a59b1fe43 Mon Sep 17 00:00:00 2001 From: James McClung Date: Tue, 18 Nov 2025 12:12:22 -0500 Subject: [PATCH 11/14] grid: error when mismatched ibn, dim --- src/include/grid.hxx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/include/grid.hxx b/src/include/grid.hxx index d3e3c60e11..37f50867ff 100644 --- a/src/include/grid.hxx +++ b/src/include/grid.hxx @@ -81,6 +81,13 @@ struct Grid_ mpi_printf(MPI_COMM_WORLD, "::: dx = %g %g %g\n", domain.dx[0], domain.dx[1], domain.dx[2]); #endif + for (int d = 0; d < 3; d++) { + if (ibn[d] > 0 && domain.isInvar(d)) { + LOG_ERROR("dimension %d is invariant, but has %d ghost cells\n", d, + ibn[d]); + } + } + for (auto off : mrc_domain_.offs()) { patches.push_back(Patch( off, Vec3(off) * domain.dx + domain.corner, From 252a28c0e67283fda8c4038b87494441073e0399 Mon Sep 17 00:00:00 2001 From: James McClung Date: Tue, 18 Nov 2025 12:20:53 -0500 Subject: [PATCH 12/14] grid: catch gdims/ibn mismatch --- src/include/grid.hxx | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/include/grid.hxx b/src/include/grid.hxx index 37f50867ff..5deff4c07e 100644 --- a/src/include/grid.hxx +++ b/src/include/grid.hxx @@ -83,8 +83,15 @@ struct Grid_ for (int d = 0; d < 3; d++) { if (ibn[d] > 0 && domain.isInvar(d)) { - LOG_ERROR("dimension %d is invariant, but has %d ghost cells\n", d, - ibn[d]); + LOG_ERROR("dimension %d is assumed to be invariant (gdims[%d]=1), but " + "has %d ghost cells\n", + d, d, ibn[d]); + } + + if (ibn[d] == 0 && !domain.isInvar(d)) { + LOG_ERROR("dimension %d is assumed to be non-invariant (gdims[%d]=%d), " + "but has no ghost cells\n", + d, d, domain.gdims[d]); } } From 6b9d78370eadf8609c3214cd30b6fe0f3ee01780 Mon Sep 17 00:00:00 2001 From: James McClung Date: Tue, 18 Nov 2025 12:43:46 -0500 Subject: [PATCH 13/14] dim: +is_invar --- src/include/dim.hxx | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/include/dim.hxx b/src/include/dim.hxx index 1f5ccfe762..089097a270 100644 --- a/src/include/dim.hxx +++ b/src/include/dim.hxx @@ -21,6 +21,16 @@ struct Invar { return {!InvarX::value, !InvarY::value, !InvarZ::value}; } + + static bool is_invar(int dim) + { + switch (dim) { + case 0: return InvarX::value; + case 1: return InvarY::value; + case 2: return InvarZ::value; + default: return false; + } + } }; using dim_xyz = Invar; From 2973d410ee8d383f61cc3c756b3b21387a1690e2 Mon Sep 17 00:00:00 2001 From: James McClung Date: Tue, 18 Nov 2025 12:44:04 -0500 Subject: [PATCH 14/14] grid, psc: mv invar check --- src/include/grid.hxx | 14 -------------- src/include/psc.hxx | 9 ++++++--- 2 files changed, 6 insertions(+), 17 deletions(-) diff --git a/src/include/grid.hxx b/src/include/grid.hxx index 5deff4c07e..d3e3c60e11 100644 --- a/src/include/grid.hxx +++ b/src/include/grid.hxx @@ -81,20 +81,6 @@ struct Grid_ mpi_printf(MPI_COMM_WORLD, "::: dx = %g %g %g\n", domain.dx[0], domain.dx[1], domain.dx[2]); #endif - for (int d = 0; d < 3; d++) { - if (ibn[d] > 0 && domain.isInvar(d)) { - LOG_ERROR("dimension %d is assumed to be invariant (gdims[%d]=1), but " - "has %d ghost cells\n", - d, d, ibn[d]); - } - - if (ibn[d] == 0 && !domain.isInvar(d)) { - LOG_ERROR("dimension %d is assumed to be non-invariant (gdims[%d]=%d), " - "but has no ghost cells\n", - d, d, domain.gdims[d]); - } - } - for (auto off : mrc_domain_.offs()) { patches.push_back(Patch( off, Vec3(off) * domain.dx + domain.corner, diff --git a/src/include/psc.hxx b/src/include/psc.hxx index de7e386bef..0a51e11838 100644 --- a/src/include/psc.hxx +++ b/src/include/psc.hxx @@ -177,9 +177,12 @@ struct Psc { time_start_ = MPI_Wtime(); - assert(grid.isInvar(0) == Dim::InvarX::value); - assert(grid.isInvar(1) == Dim::InvarY::value); - assert(grid.isInvar(2) == Dim::InvarZ::value); + for (int d = 0; d < 3; d++) { + if (grid.isInvar(d) != Dim::is_invar(d)) { + LOG_ERROR("dimension %d is%s invariant, but gdims[%d]=%d\n", d, + Dim::is_invar(d) ? "" : " not", d, grid.domain.gdims[d]); + } + } int rank; MPI_Comm_rank(MPI_COMM_WORLD, &rank);