| tdisabled upwind differences, reworked sphere status and build procedure - sphe… | |
| git clone git://src.adamsgaard.dk/sphere | |
| Log | |
| Files | |
| Refs | |
| LICENSE | |
| --- | |
| commit 30fc12a766762eb209feb56bd9ca836c5532b21c | |
| parent aea8ba623c76b3c2b9960a1806f79ddf1f3db490 | |
| Author: Anders Damsgaard <[email protected]> | |
| Date: Thu, 8 May 2014 09:37:00 +0200 | |
| disabled upwind differences, reworked sphere status and build procedure | |
| Diffstat: | |
| M src/CMakeLists.txt | 2 ++ | |
| M src/navierstokes.cuh | 5 ++++- | |
| A src/sphere_status.c | 55 +++++++++++++++++++++++++++++… | |
| D src/sphere_status.cpp | 48 -----------------------------… | |
| D src/sphere_status_compile.sh | 2 -- | |
| 5 files changed, 61 insertions(+), 51 deletions(-) | |
| --- | |
| diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt | |
| t@@ -38,3 +38,5 @@ CUDA_ADD_EXECUTABLE(../porousflow | |
| # ${Boost_FILESYSTEM_LIBRARY} | |
| # ${Boost_SYSTEM_LIBRARY} | |
| # ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}) | |
| + | |
| +ADD_EXECUTABLE(../sphere_status sphere_status.c) | |
| diff --git a/src/navierstokes.cuh b/src/navierstokes.cuh | |
| t@@ -1351,7 +1351,8 @@ __device__ Float divergence( | |
| const Float3 zp = dev_vectorfield[idx(x,y,z+1)]; | |
| // Calculate upwind coefficients | |
| - /*const Float3 a = MAKE_FLOAT3( | |
| + /* | |
| + const Float3 a = MAKE_FLOAT3( | |
| copysign(1.0, v.x), | |
| copysign(1.0, v.y), | |
| copysign(1.0, v.z)); | |
| t@@ -2001,6 +2002,7 @@ __global__ void findPredNSvelocities( | |
| // Save the predicted velocity | |
| __syncthreads(); | |
| + v_p = MAKE_FLOAT3(0.0, 0.0, 0.0); | |
| dev_ns_v_p[cellidx] = v_p; | |
| #ifdef CHECK_NS_FINITE | |
| t@@ -2451,6 +2453,7 @@ __global__ void updateNSvelocityPressure( | |
| // Find new velocity | |
| //Float3 v = v_p - devC_dt/devC_params.rho_f*grad_epsilon; | |
| Float3 v = v_p - ndem*devC_dt/(devC_params.rho_f*phi)*grad_epsilon; | |
| + v = MAKE_FLOAT3(0.0, 0.0, 0.0); | |
| // Print values for debugging | |
| /* if (z == 0) { | |
| diff --git a/src/sphere_status.c b/src/sphere_status.c | |
| t@@ -0,0 +1,55 @@ | |
| +#include <stdio.h> | |
| +#include <unistd.h> | |
| + | |
| +int main(int argc, char *argv[]) | |
| +{ | |
| + | |
| + // Read path to current working directory | |
| + char *cwd; | |
| + cwd = getcwd(0, 0); | |
| + if (!cwd) { // Terminate program execution if path is not obtained | |
| + fprintf(stderr, "getcwd failed"); | |
| + return 1; // Return unsuccessful exit status | |
| + } | |
| + | |
| + // Simulation name/ID read from first input argument | |
| + if (argc != 2) { | |
| + fprintf(stderr, "You need to specify the simulation ID as an input " | |
| + "parameter, e.g.\n%s particle_test\n", argv[0]); | |
| + return 1; | |
| + } | |
| + | |
| + char *sim_name = argv[1]; | |
| + | |
| + // Open the simulation status file | |
| + FILE *fp; | |
| + char file[1000]; // Complete file path+name variable | |
| + sprintf(file,"%s/output/%s.status.dat", cwd, sim_name); | |
| + | |
| + if ((fp = fopen(file, "rt"))) { | |
| + float time_current; | |
| + float time_percentage; | |
| + unsigned int file_nr; | |
| + | |
| + if (fscanf(fp, "%f%f%d", &time_current, &time_percentage, &file_nr) | |
| + != 3) { | |
| + fprintf(stderr, "Error: could not parse file %s\n", file); | |
| + return 1; | |
| + } | |
| + | |
| + printf("Reading %s:\n" | |
| + " - Current simulation time: %f s\n" | |
| + " - Percentage completed: %f %%\n" | |
| + " - Latest output file: %s.output%05d.bin\n", | |
| + file, time_current, time_percentage, sim_name, file_nr); | |
| + | |
| + fclose(fp); | |
| + | |
| + return 0; // Exit program successfully | |
| + | |
| + } else { | |
| + fprintf(stderr, "Error: Could not open file %s\n", file); | |
| + return 1; | |
| + } | |
| +} | |
| +// vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4 | |
| diff --git a/src/sphere_status.cpp b/src/sphere_status.cpp | |
| t@@ -1,48 +0,0 @@ | |
| -#include <iostream> | |
| -#include <cstdio> | |
| - | |
| -int main(int argc, char *argv[]) | |
| -{ | |
| - using std::cout; | |
| - | |
| - // Read path to current working directory | |
| - char *cwd; | |
| - cwd = getcwd (0, 0); | |
| - if (! cwd) { // Terminate program execution if path is not obtained | |
| - cout << "getcwd failed\n"; | |
| - return 1; // Return unsuccessful exit status | |
| - } | |
| - | |
| - // Simulation name/ID read from first input argument | |
| - if (argc != 2) { | |
| - cout << "You need to specify the simulation ID as an input parameter,\… | |
| - << "e.g. " << argv[0] << " 3dtest\n"; | |
| - return 1; | |
| - } | |
| - | |
| - char *sim_name = argv[1]; | |
| - | |
| - // Open the simulation status file | |
| - FILE *fp; | |
| - char file[1000]; // Complete file path+name variable | |
| - sprintf(file,"%s/output/%s.status.dat", cwd, sim_name); | |
| - | |
| - if ((fp = fopen(file, "rt"))) { | |
| - float time_current; | |
| - float time_percentage; | |
| - unsigned int file_nr; | |
| - fscanf(fp, "%f%f%d", &time_current, &time_percentage, &file_nr); | |
| - | |
| - cout << "Reading " << file << ":\n" | |
| - << " - Current simulation time: " << time_current << " s\n" | |
| - << " - Percentage completed: " << time_percentage << "%\n" | |
| - << " - Latest output file: " | |
| - << sim_name << ".output" << file_nr << ".bin\n"; | |
| - | |
| - fclose(fp); | |
| - | |
| - return 0; // Exit program successfully | |
| - | |
| - } | |
| -} | |
| -// vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4 | |
| diff --git a/src/sphere_status_compile.sh b/src/sphere_status_compile.sh | |
| t@@ -1,2 +0,0 @@ | |
| -#!/bin/sh | |
| -g++ sphere_status.cpp -o ../sphere_status -v -Wall |