Skip to content

Commit f58fda3

Browse files
committed
[BUG]: Fix altitude spacing in dipole grid
- Grid spacing was not exponential, as expected. The issue was with using nZ vs nAlts & is fixed.
1 parent c295433 commit f58fda3

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/init_mag_grid.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ void Grid::init_dipole_grid(Quadtree quadtree, Planets planet)
408408
// - nF=nLats/2 (so nLarts MUST be even)
409409
// - nZ=nAlts
410410
// - nZby2 = nZ/2
411-
int64_t nF = nLats / 2, nZ = nAlts, nZby2 = nAlts / 2;
411+
int64_t nF = nLats / 2, nZ = nAlts*2, nZby2 = nAlts;
412412
// lShells and baseLats are currently set for southern hemisphere then mirrored
413413
arma_vec Lshells(nF), baseLats(nF);
414414

@@ -462,7 +462,7 @@ void Grid::init_dipole_grid(Quadtree quadtree, Planets planet)
462462
// temp holding of results from q,p -> r,theta conversion:
463463
std::pair<precision_t, precision_t> r_theta;
464464

465-
for (int i = 0; i < nZ; i++)
465+
for (int i = 0; i < nAlts; i++)
466466
exp_q_dist(i) = Gamma + (1 - Gamma) * exp(-pow(((i - nZby2) / (nZ / 10.0)), 2.0));
467467

468468
for (int i_nF = 0; i_nF < nF; i_nF++)
@@ -474,7 +474,7 @@ void Grid::init_dipole_grid(Quadtree quadtree, Planets planet)
474474
// calculate const. stride similar to sami2/3 (huba & joyce 2000)
475475
// == >> sinh(gamma*qi)/sinh(gamma*q_S) << ==
476476
// inlo loop thru southern hemisphere, mirror in north.
477-
for (int i_nZ = 0; i_nZ < nZ; i_nZ++)
477+
for (int i_nZ = 0; i_nZ < nAlts; i_nZ++)
478478
{
479479
// Should be using lshell_to_qn_qs, but it wasn't working right.
480480
// This does the same, but won't work for offset dipoles.

0 commit comments

Comments
 (0)