Skip to content

Commit f43ddd6

Browse files
committed
Merge branch 'ortho_dipole' of github.com:AetherModel/Aether into ortho_dipole
2 parents 5fe11f9 + eb9e29b commit f43ddd6

File tree

4 files changed

+19
-16
lines changed

4 files changed

+19
-16
lines changed

edu/examples/Dipole/MoreDipoleInfo.ipynb

Lines changed: 6 additions & 6 deletions
Large diffs are not rendered by default.

edu/examples/Dipole/dipole.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def main(alt_minRE, alt_maxRE, lat_min, lat_max, origins, extent, nLatsPerBlock,
5353
origin = -1*origin - extent
5454

5555
lat0 = (2*(lat_max - lat_min))*origin
56-
dlat = extent * ((lat_max - lat_min)*2) / (nLatsPerBlock - nGCs)
56+
dlat = extent * (2*(lat_max - lat_min)) / (nLatsPerBlock - nGCs*2)
5757

5858
# Put latitudes down evenly (centers & corners)
5959
# - This forms the invariant latitudes which field lines must pass thru

src/init_mag_grid.cpp

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ void Grid::create_dipole_connection(Quadtree quadtree) {
4444
edge_Xm = middle_norm - size_right_norm / 2.0;
4545
edge_Yp = middle_norm + size_up_norm / 2.0;
4646
edge_Ym = middle_norm - size_up_norm / 2.0;
47-
// by default, edge_Z isn't even an edge, since most processors should
47+
// by default, edge_Z isn't even an edge, since most processors should
4848
// not exchange messages in the Z direction.
4949
edge_Z = middle_norm;
5050

@@ -65,6 +65,7 @@ void Grid::create_dipole_connection(Quadtree quadtree) {
6565
// along the Z direction, which turns out to be the same processor
6666
// as the Y direction, so just take that one:
6767
IsClosed = false;
68+
6869
if ((middle_norm(1) < 0) && (up_norm(1) > 0)) {
6970
// We are in the south and need to pass to the north:
7071
iRootZ = iRootYp;
@@ -77,6 +78,7 @@ void Grid::create_dipole_connection(Quadtree quadtree) {
7778
edge_Z(2) = 5.0;
7879
IsClosed = true;
7980
}
81+
8082
if ((middle_norm(1) > 0) && (down_norm(1) < 0)) {
8183
// We are in the north and need to pass to the south:
8284
iRootZ = iRootYm;
@@ -221,6 +223,7 @@ bool Grid::init_dipole_grid(Quadtree quadtree_ion, Planets planet) {
221223
IsDipole = true;
222224

223225
report.print(0, "Creating inter-node dipole connections");
226+
224227
if (!Is0D & !Is1Dz)
225228
create_dipole_connection(quadtree_ion);
226229

@@ -332,7 +335,7 @@ bool Grid::init_dipole_grid(Quadtree quadtree_ion, Planets planet) {
332335

333336
precision_t lat0 = 2.0 * (max_lat - min_lat) * lat_origin;
334337
precision_t dlat = 2.0 * size_up_norm(1) * (max_lat - min_lat) /
335-
(nLats - nGCs);
338+
(nLats - nGCs * 2);
336339

337340
arma_vec lat1d(nLats);
338341
arma_vec lat1dDown(nLats + 1);
@@ -350,7 +353,7 @@ bool Grid::init_dipole_grid(Quadtree quadtree_ion, Planets planet) {
350353
// - evenly space the ghost cells between these.
351354

352355
// Check if we're touching the pole, need to look at original quadtree values
353-
if ((abs(lower_left_norm(1) + size_up_norm(1)) > 0.49) // north pole
356+
if ((lower_left_norm(1) + size_up_norm(1) > 0.49) // north pole
354357
|| (lower_left_norm(1) < -0.49)) { // south pole
355358
lat1dDown(nLats) = 89.9 * cDtoR;
356359
lat1dDown(nLats - 1) = (lat1dDown(nLats) + lat1dDown(nLats - 2)) / 2.0;
@@ -608,11 +611,11 @@ bool Grid::init_dipole_grid(Quadtree quadtree_ion, Planets planet) {
608611
}
609612

610613
// Gravity should be negative in the k direction, since the grid switches directions.
611-
// j direction should switch signs when crossing the equator (+ in south, - in north)
612-
rad_unit_vcgc[1] = sign(magLat_scgc) % cos(magLat_scgc) / pow(abs(1.0 + 3.0 * sin(magLat_scgc)
613-
% sin(magLat_scgc)), 0.5);
614-
rad_unit_vcgc[2] = - 2.0 * abs(sin(magLat_scgc)) / pow(abs(1.0 + 3.0 * sin(magLat_scgc)
615-
% sin(magLat_scgc)), 0.5);
614+
// j direction should switch signs when crossing the equator (+ in south, - in north)
615+
rad_unit_vcgc[1] = sign(magLat_scgc) % cos(magLat_scgc)
616+
/ pow(abs(1.0 + 3.0 * sin(magLat_scgc) % sin(magLat_scgc)), 0.5);
617+
rad_unit_vcgc[2] = - 2.0 * abs(sin(magLat_scgc))
618+
/ pow(abs(1.0 + 3.0 * sin( magLat_scgc) % sin(magLat_scgc)), 0.5);
616619

617620
precision_t mu = planet.get_mu();
618621
gravity_vcgc[1] = mu * rad_unit_vcgc[1] % radius2i_scgc;

src/solver_gradients.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ arma_cube calc_gradient4o_j(arma_cube value, Grid grid) {
264264
iY = 0;
265265
gradient.col(iY) =
266266
(value.col(iY + 1) - value.col(iY)) /
267-
grid.dj_center_m_scgc.row(iY);
267+
grid.dj_center_m_scgc.col(iY);
268268

269269
// Upper (one sided):
270270
iY = nY - 1;

0 commit comments

Comments
 (0)