From b54665e35fd15f48bb9e8f1a22eee8add51d3cba Mon Sep 17 00:00:00 2001 From: Aaron Ridley Date: Mon, 1 Apr 2024 13:38:24 -0400 Subject: [PATCH] FEAT: fill corners and moved the function to the top --- src/exchange_messages.cpp | 72 ++++++++++++++++++++++----------------- 1 file changed, 40 insertions(+), 32 deletions(-) diff --git a/src/exchange_messages.cpp b/src/exchange_messages.cpp index d9ceaf64..be57db04 100644 --- a/src/exchange_messages.cpp +++ b/src/exchange_messages.cpp @@ -27,6 +27,43 @@ // near the equator. // ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +// This is the main exchange messages for the neutrals. +// We are exchanging densities, temperatures, and velocities +// ----------------------------------------------------------------------------- + + +bool Neutrals::exchange_old(Grid &grid) { + + std::string function = "Neutrals::exchange"; + static int iFunction = -1; + report.enter(function, iFunction); + + bool DidWork = true; + int64_t nGCs = grid.get_nGCs(); + + for (int iSpecies = 0; iSpecies < nSpecies; iSpecies++) { + if (species[iSpecies].DoAdvect) + DidWork = exchange_one_var(grid, species[iSpecies].density_scgc, false); + } + + DidWork = exchange_one_var(grid, temperature_scgc, false); + + // velocity components: + // reverse east across the pole: + DidWork = exchange_one_var(grid, velocity_vcgc[0], true); + // reverse north across the pole: + DidWork = exchange_one_var(grid, velocity_vcgc[1], true); + // don't reverse vertical across the pole: + DidWork = exchange_one_var(grid, velocity_vcgc[2], false); + + report.exit(function); + return DidWork; +} + + + // ----------------------------------------------------------------------------- // Pack variables for message passing // value is variable to pack @@ -473,38 +510,6 @@ Grid::messages_struct Grid::make_new_interconnection(int64_t iDir, return new_inter; } -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- - - -bool Neutrals::exchange_old(Grid &grid) { - - std::string function = "Neutrals::exchange"; - static int iFunction = -1; - report.enter(function, iFunction); - - bool DidWork = true; - - for (int iSpecies = 0; iSpecies < nSpecies; iSpecies++) { - if (species[iSpecies].DoAdvect) - DidWork = exchange_one_var(grid, species[iSpecies].density_scgc, false); - } - - DidWork = exchange_one_var(grid, temperature_scgc, false); - - // velocity components: - // reverse east across the pole: - DidWork = exchange_one_var(grid, velocity_vcgc[0], true); - // reverse north across the pole: - DidWork = exchange_one_var(grid, velocity_vcgc[1], true); - // don't reverse vertical across the pole: - DidWork = exchange_one_var(grid, velocity_vcgc[2], false); - - report.exit(function); - return DidWork; -} - /* // ----------------------------------------------------------------------------- @@ -994,6 +999,9 @@ bool exchange_one_var(Grid &grid, var_to_pass = var_scgc; } + // Now we fill in the corners so that we don't have zero values there: + fill_corners(var_to_pass, nG); + report.exit(function); return DidWork; }