Skip to content

Commit

Permalink
Merge pull request #131 from mwarusz/mwarusz/omega/update-time-levels
Browse files Browse the repository at this point in the history
Refactor `OceanState::updateTimeLevels`
  • Loading branch information
sbrus89 authored Sep 24, 2024
2 parents 33e3b4f + 504463a commit 2b346b2
Showing 1 changed file with 3 additions and 14 deletions.
17 changes: 3 additions & 14 deletions components/omega/src/ocn/OceanState.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -382,25 +382,14 @@ void OceanState::updateTimeLevels() {

int NewLevel = NTimeLevels - 1;

// Update time levels for layer thickness
copyToHost(NewLevel);
MeshHalo->exchangeFullArrayHalo(LayerThicknessH[NewLevel], OnCell);
copyToDevice(NewLevel);

Array2DR8 Temp;
HostArray2DR8 TempH;
// Exchange halo
exchangeHalo(NewLevel);

// Update time levels for layer thickness and normal velocity
for (int Level = 0; Level < NTimeLevels - 1; Level++) {
std::swap(LayerThickness[Level + 1], LayerThickness[Level]);
std::swap(LayerThicknessH[Level + 1], LayerThicknessH[Level]);
}

// Update time levels for normal velocity
copyToHost(NewLevel);
MeshHalo->exchangeFullArrayHalo(NormalVelocityH[NewLevel], OnEdge);
copyToDevice(NewLevel);

for (int Level = 0; Level < NTimeLevels - 1; Level++) {
std::swap(NormalVelocity[Level + 1], NormalVelocity[Level]);
std::swap(NormalVelocityH[Level + 1], NormalVelocityH[Level]);
}
Expand Down

0 comments on commit 2b346b2

Please sign in to comment.