Skip to content

Commit b54665e

Browse files
committed
FEAT: fill corners and moved the function to the top
1 parent c38c7dc commit b54665e

File tree

1 file changed

+40
-32
lines changed

1 file changed

+40
-32
lines changed

src/exchange_messages.cpp

Lines changed: 40 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,43 @@
2727
// near the equator.
2828
// -----------------------------------------------------------------------------
2929

30+
31+
// -----------------------------------------------------------------------------
32+
// This is the main exchange messages for the neutrals.
33+
// We are exchanging densities, temperatures, and velocities
34+
// -----------------------------------------------------------------------------
35+
36+
37+
bool Neutrals::exchange_old(Grid &grid) {
38+
39+
std::string function = "Neutrals::exchange";
40+
static int iFunction = -1;
41+
report.enter(function, iFunction);
42+
43+
bool DidWork = true;
44+
int64_t nGCs = grid.get_nGCs();
45+
46+
for (int iSpecies = 0; iSpecies < nSpecies; iSpecies++) {
47+
if (species[iSpecies].DoAdvect)
48+
DidWork = exchange_one_var(grid, species[iSpecies].density_scgc, false);
49+
}
50+
51+
DidWork = exchange_one_var(grid, temperature_scgc, false);
52+
53+
// velocity components:
54+
// reverse east across the pole:
55+
DidWork = exchange_one_var(grid, velocity_vcgc[0], true);
56+
// reverse north across the pole:
57+
DidWork = exchange_one_var(grid, velocity_vcgc[1], true);
58+
// don't reverse vertical across the pole:
59+
DidWork = exchange_one_var(grid, velocity_vcgc[2], false);
60+
61+
report.exit(function);
62+
return DidWork;
63+
}
64+
65+
66+
3067
// -----------------------------------------------------------------------------
3168
// Pack variables for message passing
3269
// value is variable to pack
@@ -473,38 +510,6 @@ Grid::messages_struct Grid::make_new_interconnection(int64_t iDir,
473510
return new_inter;
474511
}
475512

476-
// -----------------------------------------------------------------------------
477-
//
478-
// -----------------------------------------------------------------------------
479-
480-
481-
bool Neutrals::exchange_old(Grid &grid) {
482-
483-
std::string function = "Neutrals::exchange";
484-
static int iFunction = -1;
485-
report.enter(function, iFunction);
486-
487-
bool DidWork = true;
488-
489-
for (int iSpecies = 0; iSpecies < nSpecies; iSpecies++) {
490-
if (species[iSpecies].DoAdvect)
491-
DidWork = exchange_one_var(grid, species[iSpecies].density_scgc, false);
492-
}
493-
494-
DidWork = exchange_one_var(grid, temperature_scgc, false);
495-
496-
// velocity components:
497-
// reverse east across the pole:
498-
DidWork = exchange_one_var(grid, velocity_vcgc[0], true);
499-
// reverse north across the pole:
500-
DidWork = exchange_one_var(grid, velocity_vcgc[1], true);
501-
// don't reverse vertical across the pole:
502-
DidWork = exchange_one_var(grid, velocity_vcgc[2], false);
503-
504-
report.exit(function);
505-
return DidWork;
506-
}
507-
508513

509514
/*
510515
// -----------------------------------------------------------------------------
@@ -994,6 +999,9 @@ bool exchange_one_var(Grid &grid,
994999
var_to_pass = var_scgc;
9951000
}
9961001

1002+
// Now we fill in the corners so that we don't have zero values there:
1003+
fill_corners(var_to_pass, nG);
1004+
9971005
report.exit(function);
9981006
return DidWork;
9991007
}

0 commit comments

Comments
 (0)