Skip to content

Commit 9143e77

Browse files
authored
assume full sphere symmetry in SPHERICAL with 1 dimension and Components>1
assume full sphere symmetry when SPHERICAL coordinates with 1 dimension (#291) fix #290
1 parent f83e560 commit 9143e77

1 file changed

Lines changed: 17 additions & 7 deletions

File tree

src/gridHost.cpp

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -201,15 +201,25 @@ void GridHost::MakeGrid(Input &input) {
201201
// dir >= DIMENSIONS/ Init simple uniform grid
202202
for(int i = 0 ; i < np_tot[dir] ; i++) {
203203
// Initialize to default values
204-
xstart[dir] = -0.5;
205-
xend[dir] = 0.5;
206-
204+
#if GEOMETRY != SPHERICAL
205+
xstart[dir] = -0.5;
206+
xend[dir] = 0.5;
207+
#elif GEOMETRY == SPHERICAL
208+
if(dir == JDIR) {
209+
xstart[dir] = 0;
210+
xend[dir] = M_PI;
211+
}
212+
if(dir == KDIR) {
213+
xstart[dir] = -0.5;
214+
xend[dir] = 0.5;
215+
}
216+
#endif
207217
this->xbeg[dir] = xstart[dir];
208218
this->xend[dir] = xend[dir];
209-
dx[dir](i) = 1.0;
210-
x[dir](i)=0.0;
211-
xl[dir](i)=-0.5;
212-
xr[dir](i)=0.5;
219+
dx[dir](i) = xend[dir] - xstart[dir];
220+
x[dir](i)=0.5*(xstart[dir]+xend[dir]);
221+
xl[dir](i)=xstart[dir];
222+
xr[dir](i)=xend[dir];
213223
}
214224
}
215225
}

0 commit comments

Comments
 (0)