Skip to content

Commit 35e26f3

Browse files
same as reference cell
1 parent 6db2cec commit 35e26f3

File tree

4 files changed

+15
-17
lines changed

4 files changed

+15
-17
lines changed

ExampleCodes/EB/NodalPoisson/Poisson.H

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33

44
#include <AMReX_EBMultiFabUtil.H>
55

6-
void InitData (amrex::MultiFab& State);
6+
void InitData (amrex::MultiFab& State, int icenter, int jcenter);
77

88
#endif

ExampleCodes/EB/NodalPoisson/Poisson.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
using namespace amrex;
44

5-
void InitData (MultiFab& State)
5+
void InitData (amrex::MultiFab& State, int icenter, int jcenter)
66
{
77
#ifdef AMREX_USE_OMP
88
#pragma omp parallel
@@ -14,7 +14,7 @@ void InitData (MultiFab& State)
1414
amrex::ParallelFor(bx,
1515
[=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept
1616
{
17-
if (i==70 && j==70 && k==0) {
17+
if (i==icenter && j==jcenter) {
1818
q(i,j,k) = 1.0;
1919
} else {
2020
q(i,j,k) = 0.0;

ExampleCodes/EB/NodalPoisson/inputs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
amrex.fpe_trap_invalid=1
22

33
verbose = 2
4-
n_cell = 128
5-
max_grid_size = 32
4+
n_cell = 256 128
5+
max_grid_size = 256
66

77
eb2.geom_type = merge
88
#eb2.geom_type = sphere

ExampleCodes/EB/NodalPoisson/main.cpp

+10-12
Original file line numberDiff line numberDiff line change
@@ -37,23 +37,24 @@ int main (int argc, char* argv[])
3737
int verbose = 1;
3838
int n_cell = 128;
3939
int max_grid_size = 32;
40-
40+
amrex::Vector<int> n_cell_2d;
4141
// read parameters
4242
{
4343
ParmParse pp;
4444
pp.query("verbose", verbose);
45-
pp.query("n_cell", n_cell);
45+
// pp.query("n_cell", n_cell);
46+
pp.queryarr("n_cell", n_cell_2d);
4647
pp.query("max_grid_size", max_grid_size);
4748
}
4849

4950
Geometry geom;
5051
BoxArray grids;
5152
DistributionMapping dmap;
5253
{
53-
RealBox rb({AMREX_D_DECL(0.,0.,0.)}, {AMREX_D_DECL(1.,1.,1.)});
54+
RealBox rb({AMREX_D_DECL(-.1035,-0.0527,-0.0527)}, {AMREX_D_DECL(0.1035,0.0527,0.0527)});
5455
Array<int,AMREX_SPACEDIM> is_periodic{AMREX_D_DECL(1,1,1)};
5556
Box domain(IntVect{AMREX_D_DECL(0,0,0)},
56-
IntVect{AMREX_D_DECL(n_cell-1,n_cell-1,n_cell-1)});
57+
IntVect{AMREX_D_DECL(n_cell_2d[0]-1,n_cell_2d[1]-1,0)});
5758
geom.define(domain, rb, CoordSys::cartesian, is_periodic);
5859

5960
grids.define(domain); // define the BoxArray to be a single grid
@@ -69,13 +70,10 @@ int main (int argc, char* argv[])
6970
std::string geom_type;
7071
pp.get("geom_type", geom_type);
7172
if (geom_type == "merge") {
72-
EB2::SphereIF sphere1(0.25,{AMREX_D_DECL(0.5,0.5,0.5)},true);
73-
EB2::SphereIF sphere2(0.1,{AMREX_D_DECL(0.5,0.5,0.5)},true);
74-
auto twospheres = EB2::makeUnion(sphere1,sphere2);
75-
EB2::BoxIF box1({AMREX_D_DECL(0.25,0.0,0)},
76-
{AMREX_D_DECL(0.75, 0.25,0)},false);
77-
EB2::BoxIF box2({AMREX_D_DECL(0.25,0.75,0)},
78-
{AMREX_D_DECL(0.75,1. ,0)},false);
73+
EB2::BoxIF box1({AMREX_D_DECL(-0.052,-0.0527,0)},
74+
{AMREX_D_DECL(0.052, -0.0128,0)},false);
75+
EB2::BoxIF box2({AMREX_D_DECL(-0.052,0.0128,0)},
76+
{AMREX_D_DECL(0.052,0.0527 ,0)},false);
7977
auto twoboxes = EB2::makeUnion(box1,box2);
8078
auto gshop = EB2::makeShop(twoboxes);
8179
EB2::Build(gshop, geom, required_coarsening_level, max_coarsening_level);
@@ -101,7 +99,7 @@ int main (int argc, char* argv[])
10199
MultiFab q (nba, dmap, 1, 0, MFInfo(), factory);
102100
MultiFab phi(nba, dmap, 1, 0, MFInfo(), factory);
103101

104-
InitData(q);
102+
InitData(q, n_cell_2d[0]/2, n_cell_2d[1]/2);
105103

106104
LPInfo info;
107105

0 commit comments

Comments
 (0)