aboutsummaryrefslogtreecommitdiff
path: root/src/boundary_conditions.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/boundary_conditions.h')
-rw-r--r--src/boundary_conditions.h44
1 files changed, 2 insertions, 42 deletions
diff --git a/src/boundary_conditions.h b/src/boundary_conditions.h
index c825c32..6b7de19 100644
--- a/src/boundary_conditions.h
+++ b/src/boundary_conditions.h
@@ -3,46 +3,6 @@
#include "vector.h"
#include "data_cell_buffer.h"
-std::pair<Vector<int>, Vector<int>> neighbors(Vector<int> v) {
- if ( v[0] == 0 ) {
- return {
- { -1, v[1] },
- { 1, v[1] }
- };
- } else if ( v[1] == 0 ) {
- return {
- { v[0], -1 },
- { v[0], 1 }
- };
- } else {
- return {
- { 0, v[1] },
- { v[0], 0 }
- };
- }
-}
+void computeWallCell(DataCellBuffer& pop, Vector<std::size_t> cell, Vector<int> normal);
-void computeWallCell(DataCellBuffer& pop, Vector<std::size_t> cell, Vector<int> normal) {
- const auto [neighborA, neighborB] = neighbors(normal);
-
- pop.curr(cell).get(neighborA) = pop.curr(cell).get(-neighborA);
- pop.curr(cell).get(normal ) = pop.curr(cell).get(-normal );
- pop.curr(cell).get(neighborB) = pop.curr(cell).get(-neighborB);
-}
-
-void computeZouHeVelocityWallCell(DataCellBuffer& pop, Vector<std::size_t> cell, Vector<int> normal, double vX) {
- const auto [neighborA, neighborB] = neighbors(normal);
-
- const double rho = pop.curr(cell).get(-1,0) + pop.curr(cell).get(0,0) + pop.curr(cell).get(1,0)
- + 2.*(
- pop.curr(cell).get(-neighborA) +
- pop.curr(cell).get(-normal ) +
- pop.curr(cell).get(-neighborB)
- );
-
- pop.curr(cell).get(neighborA) = pop.curr(cell).get(-neighborA)
- + 0.5*( pop.curr(cell).get( 1,0) - pop.curr(cell).get(-1,0) - vX*rho );
- pop.curr(cell).get(normal ) = pop.curr(cell).get(-normal );
- pop.curr(cell).get(neighborB) = pop.curr(cell).get(-neighborB)
- + 0.5*( pop.curr(cell).get(-1,0) - pop.curr(cell).get( 1,0) + vX*rho );
-}
+void computeZouHeVelocityWallCell(DataCellBuffer& pop, Vector<std::size_t> cell, Vector<int> normal, double vX);