tuse correct face index function for writing face velocities - sphere - GPU-bas… | |
git clone git://src.adamsgaard.dk/sphere | |
Log | |
Files | |
Refs | |
LICENSE | |
--- | |
commit 4df908f08d8b32257ec0e176f7a620382d798e98 | |
parent e07f904c139196389023592dc85028e8cd657a3b | |
Author: Anders Damsgaard <[email protected]> | |
Date: Sat, 28 Jun 2014 14:56:31 +0200 | |
use correct face index function for writing face velocities | |
Diffstat: | |
M src/file_io.cpp | 6 +++--- | |
M src/navierstokes.cpp | 2 +- | |
M src/navierstokes.cuh | 15 +++++++++------ | |
3 files changed, 13 insertions(+), 10 deletions(-) | |
--- | |
diff --git a/src/file_io.cpp b/src/file_io.cpp | |
t@@ -471,9 +471,9 @@ void DEM::writebin(const char *target) | |
//ofs.write(as_bytes(ns.v[i].x), sizeof(Float)); | |
//ofs.write(as_bytes(ns.v[i].y), sizeof(Float)); | |
//ofs.write(as_bytes(ns.v[i].z), sizeof(Float)); | |
- ofs.write(as_bytes(ns.v_x[i]), sizeof(Float)); | |
- ofs.write(as_bytes(ns.v_y[i]), sizeof(Float)); | |
- ofs.write(as_bytes(ns.v_z[i]), sizeof(Float)); | |
+ ofs.write(as_bytes(ns.v_x[vidx(x,y,z)]), sizeof(Float)… | |
+ ofs.write(as_bytes(ns.v_y[vidx(x,y,z)]), sizeof(Float)… | |
+ ofs.write(as_bytes(ns.v_z[vidx(x,y,z)]), sizeof(Float)… | |
ofs.write(as_bytes(ns.p[i]), sizeof(Float)); | |
ofs.write(as_bytes(ns.phi[i]), sizeof(Float)); | |
ofs.write(as_bytes(ns.dphi[i]), sizeof(Float)); | |
diff --git a/src/navierstokes.cpp b/src/navierstokes.cpp | |
t@@ -21,7 +21,7 @@ void DEM::initNSmem() | |
ns.ny = grid.num[1]; | |
ns.nz = grid.num[2]; | |
unsigned int ncells = NScells(); | |
- //unsigned int ncells_st = NScellsVelocity(); | |
+ unsigned int ncells_st = NScellsVelocity(); | |
ns.p = new Float[ncells]; // hydraulic pressure | |
ns.v = new Float3[ncells]; // hydraulic velocity | |
diff --git a/src/navierstokes.cuh b/src/navierstokes.cuh | |
t@@ -2291,15 +2291,15 @@ __global__ void findPredNSvelocities( | |
//// Neumann BCs | |
// Free slip | |
- if ((z == 0 && bc_bot == 1) || (z == nz-1 && bc_top == 1)) | |
- v_p.z = v.z; | |
+ /*if ((z == 0 && bc_bot == 1) || (z == nz-1 && bc_top == 1)) | |
+ v_p.z = v.z;*/ | |
// No slip | |
- if ((z == 0 && bc_bot == 2) || (z == nz-1 && bc_top == 2)) { | |
+ /*if ((z == 0 && bc_bot == 2) || (z == nz-1 && bc_top == 2)) { | |
v_p.x = 0.0; | |
v_p.y = 0.0; | |
v_p.z = 0.0; | |
- } | |
+ }*/ | |
#ifdef REPORT_V_P_COMPONENTS | |
t@@ -2830,8 +2830,11 @@ __global__ void updateNSvelocity( | |
e_down); | |
}*/ | |
- //if ((z == 0 && bc_bot == 1) || (z == nz-1 && bc_top == 1)) | |
- //v.z = 0.0; | |
+ if ((z == 0 && bc_bot == 1) || (z == nz-1 && bc_top == 1)) | |
+ v.z = 0.0; | |
+ | |
+ if ((z == 0 && bc_bot == 2) || (z == nz-1 && bc_top == 2)) | |
+ v = MAKE_FLOAT3(0.0, 0.0, 0.0); | |
// Check the advection term using the Courant-Friedrichs-Lewy condition | |
if (v.x*ndem*devC_dt/dx |