tbegun implementing boundary conditions - ns2dfd - 2D finite difference Navier … | |
git clone git://src.adamsgaard.dk/ns2dfd | |
Log | |
Files | |
Refs | |
LICENSE | |
--- | |
commit c98b527b4afc40731b835e59e9fe57a431ee0dd6 | |
parent d0adbc625218b6a15d9a4e01da69a7196fe5284f | |
Author: Anders Damsgaard <[email protected]> | |
Date: Mon, 3 Mar 2014 09:34:24 +0100 | |
begun implementing boundary conditions | |
Diffstat: | |
A src/boundary.c | 29 +++++++++++++++++++++++++++++ | |
1 file changed, 29 insertions(+), 0 deletions(-) | |
--- | |
diff --git a/src/boundary.c b/src/boundary.c | |
t@@ -0,0 +1,29 @@ | |
+ | |
+#define BC_NO_SLIP 1 | |
+#define BC_FREE_SLIP 2 | |
+#define BC_OUTFLOW 3 | |
+#define BC_PERIODIC 4 | |
+ | |
+/* Set boundary values of u, v and p according to the boundary conditions. | |
+ * The BC flags are as follows: | |
+ * 1: No-slip condition | |
+ * 2: Free-slip condition | |
+ * 3: Outflow condition | |
+ * 4: Periodic condition | |
+ */ | |
+void set_boundary_conditions(int w_left, int w_right, int w_top, int w_bottom, | |
+ double **P, double **U, double **V, int nx, int ny) | |
+{ | |
+ int i, j; | |
+ | |
+ if (w_left == BC_NO_SLIP) { | |
+ i = 0; | |
+ for (j=1; j<ny+1; j++) { | |
+ U[i][j] = 0.0; | |
+ | |
+ | |
+ } | |
+ } | |
+ | |
+ | |
+} |