From b14546892437b3fdc0d02c6ad35c8569ce9f7ca1 Mon Sep 17 00:00:00 2001 From: peters <peters@irmb.tu-bs.de> Date: Thu, 24 Jun 2021 17:35:03 +0200 Subject: [PATCH] Remove unused stuff --- apps/gpu/LBM/DrivenCavity/DrivenCavity.cpp | 2 - src/basics/config/ConfigurationFile.h | 2 +- src/gpu/VirtualFluids_GPU/Init/DefineGrid.cpp | 444 ------------------ src/gpu/VirtualFluids_GPU/Init/DefineGrid.h | 11 - .../VirtualFluids_GPU/Init/InitLattice.cpp | 138 +++--- src/gpu/VirtualFluids_GPU/Init/InitLattice.h | 32 ++ .../VirtualFluids_GPU/Init/SetParameter.cpp | 260 ---------- src/gpu/VirtualFluids_GPU/Init/SetParameter.h | 15 - .../VirtualFluids_GPU/Input/ConfigFile.cpp | 198 -------- src/gpu/VirtualFluids_GPU/Input/ConfigFile.h | 31 -- src/gpu/VirtualFluids_GPU/LBM/Simulation.cpp | 3 - .../VirtualFluids_GPU/Parameter/Parameter.cpp | 256 +--------- .../VirtualFluids_GPU/Parameter/Parameter.h | 23 +- .../Parameter/ParameterTest.cpp | 6 + .../Utilities/EnumMapper/EnumMapperImp.h | 52 -- 15 files changed, 121 insertions(+), 1352 deletions(-) delete mode 100644 src/gpu/VirtualFluids_GPU/Init/DefineGrid.cpp delete mode 100644 src/gpu/VirtualFluids_GPU/Init/DefineGrid.h delete mode 100644 src/gpu/VirtualFluids_GPU/Init/SetParameter.cpp delete mode 100644 src/gpu/VirtualFluids_GPU/Init/SetParameter.h delete mode 100644 src/gpu/VirtualFluids_GPU/Input/ConfigFile.cpp delete mode 100644 src/gpu/VirtualFluids_GPU/Input/ConfigFile.h delete mode 100644 src/gpu/VirtualFluids_GPU/Utilities/EnumMapper/EnumMapperImp.h diff --git a/apps/gpu/LBM/DrivenCavity/DrivenCavity.cpp b/apps/gpu/LBM/DrivenCavity/DrivenCavity.cpp index 8fe7281f6..f6043d351 100644 --- a/apps/gpu/LBM/DrivenCavity/DrivenCavity.cpp +++ b/apps/gpu/LBM/DrivenCavity/DrivenCavity.cpp @@ -356,8 +356,6 @@ int main( int argc, char* argv[]) targetPath = targetPath.substr(0, targetPath.find_last_of('/') + 1); - - std::cout << targetPath << std::endl; multipleLevel(targetPath + "configDrivenCavity.txt"); diff --git a/src/basics/config/ConfigurationFile.h b/src/basics/config/ConfigurationFile.h index 8988d1065..ef7e7c9f0 100644 --- a/src/basics/config/ConfigurationFile.h +++ b/src/basics/config/ConfigurationFile.h @@ -122,7 +122,7 @@ T ConfigurationFile::getValue(const std::string& key) const { bFlag = true; } - + std::istringstream iss(str); T x; iss >> x; diff --git a/src/gpu/VirtualFluids_GPU/Init/DefineGrid.cpp b/src/gpu/VirtualFluids_GPU/Init/DefineGrid.cpp deleted file mode 100644 index 98119ce6f..000000000 --- a/src/gpu/VirtualFluids_GPU/Init/DefineGrid.cpp +++ /dev/null @@ -1,444 +0,0 @@ -#include "Init/DefineGrid.h" -#include "Init/ReadGeometry.h" -#include "Temperature/FindTemperature.h" -#include "FindInterface/FindInterface.h" -#include <cuda_runtime.h> -#include <helper_cuda.h> - -//////////////////////////////////////////////////////////////////////////////// -void defineGrid(Parameter* para, vf::gpu::Communicator* comm, CudaMemoryManager* cudaManager) -{ - for (int lev=para->getFine(); lev >= para->getCoarse(); lev--) - { - /////////////////////////////////////////////////////////////////////////////////////////////////// - // Allocate Host Memory - /////////////////////////////////////////////////////////////////////////////////////////////////// - cudaManager->cudaAllocFull(lev); - /////////////////////////////////////////////////////////////////////////////////////////////////// - if (para->getDiffOn()==true) - { - checkCudaErrors( cudaMallocHost((void**) &(para->getParH(lev)->Conc_Full ), para->getParH(lev)->mem_size_real)); - } - /////////////////////////////////////////////////////////////////////////////////////////////////// - if (lev==para->getCoarse()) - { - /////////////////////////////////////////////////////////////////////////////////////////////////// - if (para->getReadGeo()==true) - { - std::cout << "read geometry...\n" ; - readGeometry(para, comm, lev, para->getGeometryFileC()); - std::cout << "done.\n"; - } - /////////////////////////////////////////////////////////////////////////////////////////////////// - for (unsigned int k=0; k<para->getParH(lev)->nz; k++) - { - for (unsigned int j=0; j<para->getParH(lev)->ny; j++) - { - for (unsigned int i=0; i<para->getParH(lev)->nx; i++) - { - int m = para->getParH(lev)->nx*(para->getParH(lev)->ny*k + j) + i; - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - if (para->getReadGeo()==true) - { - if ( i <= STARTOFFX || i >= para->getParH(lev)->gridNX + STARTOFFX - 1 - || j <= STARTOFFY || j >= para->getParH(lev)->gridNY + STARTOFFY - 1 - || k <= STARTOFFZ || k >= para->getParH(lev)->gridNZ + STARTOFFZ - 1 ) - { - para->getParH(lev)->geo[m] = GEO_VOID; - } - //else if ( (k >= STARTOFFZ +1) && (k <= STARTOFFZ + 20) ) - //{ - // para->getParH(lev)->geo[m] = GEO_FLUID; - //} - } - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - else - { - //////////////////////////////////////////////////////////////////////////////////////////////// - //Test - ////unsigned int centerX = para->getParH(lev)->gridNX / 2 + STARTOFFX; - ////unsigned int centerY = para->getParH(lev)->gridNY / 2 + STARTOFFY; - ////unsigned int centerZ = para->getParH(lev)->gridNZ / 4 + STARTOFFZ; - //real centerX = para->getParH(lev)->gridNX / 2. + STARTOFFX - 0.5; - //real centerY = para->getParH(lev)->gridNY / 2. + STARTOFFY - 0.5; - //real centerZ = para->getParH(lev)->gridNZ / 4. + STARTOFFZ - 0.5; - //real radius = para->getParH(lev)->gridNY / 10.;//2.56f; - //////unsigned int distSq = (centerX-i)*(centerX-i)+(centerY-j)*(centerY-j); - ////unsigned int distSq = (centerX-i)*(centerX-i)+(centerY-j)*(centerY-j)+(centerZ-k)*(centerZ-k); - //real distSq = (centerX-i)*(centerX-i)+(centerY-j)*(centerY-j)+(centerZ-k)*(centerZ-k); - //real radiSq = radius*radius; - //////////////////////////////////////////////////////////////////////////////////////////////// - - if ( i < STARTOFFX || i > para->getParH(lev)->gridNX + STARTOFFX - 1 - || j < STARTOFFY || j > para->getParH(lev)->gridNY + STARTOFFY - 1 - || k < STARTOFFZ || k > para->getParH(lev)->gridNZ + STARTOFFZ - 1 ) - { - para->getParH(lev)->geo[m] = GEO_VOID; - if (para->getDiffOn()==true) - { - para->getParH(lev)->Conc_Full[m] = 0.0; - } - } - //else if ( j == STARTOFFY || j == para->getParH(lev)->gridNY + STARTOFFY - 1 ) - //{ - // para->getParH(lev)->geo[m] = GEO_SOLID; - // if (ic.diffOn==true) - // { - // para->getParH(lev)->Conc_Full[m] = 0.0; - // } - //} - //else if ( k == STARTOFFZ || k == para->getParH(lev)->gridNZ + STARTOFFZ - 1) - //{ - // para->getParH(lev)->geo[m] = GEO_SOLID; - // if (ic.diffOn==true) - // { - // para->getParH(lev)->Conc_Full[m] = 0.0; - // } - //} - //else if ( i == STARTOFFX+1 || i == para->getParH(lev)->gridNX + STARTOFFX - 2 ) - //{ - // para->getParH(lev)->geo[m] = GEO_VELO; - // if (ic.diffOn==true) - // { - // para->getParH(lev)->Conc_Full[m] = 0.0; - // } - //} - //else if ((i >= para->getParH(lev+1)->XdistKn + STARTOFFX + 3) && (i <= (para->getParH(lev+1)->XdistKn + para->getParH(lev+1)->gridNX / 2) + STARTOFFX - 3) && - // (j >= para->getParH(lev+1)->YdistKn + STARTOFFY + 3) && (j <= (para->getParH(lev+1)->YdistKn + para->getParH(lev+1)->gridNY / 2) + STARTOFFY - 3) && - // (k >= para->getParH(lev+1)->ZdistKn + STARTOFFZ /*+ 3*/) && (k <= (para->getParH(lev+1)->ZdistKn + para->getParH(lev+1)->gridNZ / 2) + STARTOFFZ - 3) ) - //{ - // para->getParH(lev)->geo[m] = GEO_VOID; - // if (para->getDiffOn()==true) - // { - // para->getParH(lev)->Conc_Full[m] = 0.0; - // } - //} - //else if ((i >= para->getParH(lev)->gridNX / 4 + STARTOFFX + 4) && (i <= (para->getParH(lev)->gridNX * 3 / 4) + STARTOFFX - 4) && - // (j >= para->getParH(lev)->gridNY / 4 + STARTOFFY + 4) && (j <= (para->getParH(lev)->gridNY * 3 / 4) + STARTOFFY - 4) && - // (k >= para->getParH(lev)->gridNZ / 8 + STARTOFFZ + 4) && (k <= (para->getParH(lev)->gridNZ * 5 / 8) + STARTOFFZ - 4) && maxlevel>1) - //{ - // para->getParH(lev)->geo[m] = GEO_SOLID; - // if (ic.diffOn==true) - // { - // para->getParH(lev)->Conc_Full[m] = 0.0; - // } - //} - //else if (distSq < /*>*/ radiSq) - //{ - // para->getParH(lev)->geo[m] = GEO_SOLID; - // if (ic.diffOn==true) - // { - // para->getParH(lev)->Conc_Full[m] = 0.0; - // } - //} - //else if ( i <= STARTOFFX + 30 && i >=STARTOFFX + 20 - // && j <= STARTOFFY + 30 && j >=STARTOFFY + 20 - // && k <= STARTOFFZ + 30 && k >=STARTOFFZ + 20 ) - //{ - // para->getParH(lev)->geo[m] = GEO_FLUID; - // para->getParH(lev)->Conc_Full[m] = 1.0; - //} - //else if ( i <= STARTOFFX + 30 && i >=STARTOFFX + 20 - // && j <= STARTOFFY + 30 && j >=STARTOFFY + 20 - // && k <= STARTOFFZ + 30 && k >=STARTOFFZ + 20 ) - //{ - // para->getParH(lev)->geo[m] = GEO_FLUID; - // para->getParH(lev)->Conc_Full[m] = 1.0; - //} - else - { - para->getParH(lev)->geo[m] = GEO_FLUID; - if (para->getDiffOn()==true) - { - para->getParH(lev)->Conc_Full[m] = (real)para->getTemperatureInit(); - } - } - //if (i == STARTOFFZ) - //{ - // para->getParH(lev)->geo[m] = GEO_SOLID; - // if (para->getDiffOn()==true) - // { - // para->getParH(lev)->Conc_Full[m] = 0.0; - // } - //} - - } - para->getParH(lev)->k[m] = 0; - } - } - } - } - else if (lev==para->getFine() && para->getMaxLevel()>=1) - { - for (unsigned int k=0; k<para->getParH(lev)->nz; k++) - { - for (unsigned int j=0; j<para->getParH(lev)->ny; j++) - { - for (unsigned int i=0; i<para->getParH(lev)->nx; i++) - { - //unsigned int centerX = para->getParH(lev)->gridNX / 2 + STARTOFFX; - //unsigned int centerY = para->getParH(lev)->gridNY / 2 + STARTOFFY; - //unsigned int centerZ = para->getParH(lev)->gridNZ / 2 + STARTOFFZ; - //real radius = para->getParH(lev)->gridNY / 5.f;//2.56f; - //real centerX = para->getParH(lev)->gridNX / 2.f + STARTOFFX - 0.5f; - //real centerY = para->getParH(lev)->gridNY / 2.f + STARTOFFY - 0.5f; - //real centerZ = para->getParH(lev)->gridNZ / 2.f + STARTOFFZ - 0.5f; - //real radius = para->getParH(lev)->gridNY / 5.f;//2.56f; - - int m = para->getParH(lev)->nx*(para->getParH(lev)->ny*k + j) + i; - - ////unsigned int distSq = (centerX-i)*(centerX-i)+(centerY-j)*(centerY-j)+(centerZ-k)*(centerZ-k); - //real distSq = (centerX-i)*(centerX-i)+(centerY-j)*(centerY-j)+(centerZ-k)*(centerZ-k); - //real radiSq = radius*radius; - - //diff stuff - //real mradsq = (real)((real)i-(STARTOFFX + 30)) * (real)((real)i-(STARTOFFX + 30)) + (real)((real)j-(STARTOFFY + 30)) * (real)((real)j-(STARTOFFY + 30)) +(real) ((real)k-(STARTOFFZ + 30)) * (real) ((real)k-(STARTOFFZ + 30)); - - if ( i < STARTOFFX || i > para->getParH(lev)->gridNX + STARTOFFX - 1 - || j < STARTOFFY || j > para->getParH(lev)->gridNY + STARTOFFY - 1 - || k < STARTOFFZ || k > para->getParH(lev)->gridNZ + STARTOFFZ - 1 ) - { - para->getParH(lev)->geo[m] = GEO_VOID; - if (para->getDiffOn()==true) - { - para->getParH(lev)->Conc_Full[m] = 0.0; - } - } - //else if (i = STARTOFFX) - //{ - // para->getParH(lev)->geo[m] = GEO_SOLID; - // if (ic.diffOn==true) - // { - // para->getParH(lev)->Conc_Full[m] = 0.0; - // } - //} - //else if ((i > STARTOFFX ) && (i <= para->getParH(lev)->gridNX + STARTOFFX - 38) && - // (j >= 19 + STARTOFFY) && (j <= para->getParH(lev)->gridNY + STARTOFFY - 19) && - // (k >= 30 + STARTOFFZ) && (k <= para->getParH(lev)->gridNZ + STARTOFFZ - 30) ) - //{ - // para->getParH(lev)->geo[m] = GEO_SOLID; - // if (ic.diffOn==true) - // { - // para->getParH(lev)->Conc_Full[m] = 0.0; - // } - //} - //else if ((i >= STARTOFFX ) && (i <= (para->getParH(lev)->gridNX * 4 / 8) + STARTOFFX) && - // (j >= para->getParH(lev)->gridNY / 4 + STARTOFFY) && (j <= (para->getParH(lev)->gridNY * 3 / 4) + STARTOFFY) && - // (k >= para->getParH(lev)->gridNZ * 8 / 20 + STARTOFFZ) && (k <= (para->getParH(lev)->gridNZ * 12 / 20) + STARTOFFZ) ) - //{ - // para->getParH(lev)->geo[m] = GEO_SOLID; - // if (ic.diffOn==true) - // { - // para->getParH(lev)->Conc_Full[m] = 0.0; - // } - //} - ////diff stuff - //else if ( mradsq < 100.f ) - //{ - // para->getParH(lev)->geo[m] = GEO_FLUID; - // if (ic.diffOn==true) - // { - // para->getParH(lev)->Conc_Full[m] = 1.0f - mradsq * 0.01f; - // } - //} - //else if ( i <= STARTOFFX + 30 && i >=STARTOFFX + 20 - // && j <= STARTOFFY + 30 && j >=STARTOFFY + 20 - // && k <= STARTOFFZ + 30 && k >=STARTOFFZ + 20 ) - //{ - // para->getParH(lev)->geo[m] = GEO_FLUID; - // para->getParH(lev)->Conc_Full[m] = 1.0; - //} - //else if (distSq < radiSq) - //{ - // para->getParH(lev)->geo[m] = GEO_SOLID; - // if (ic.diffOn==true) - // { - // para->getParH(lev)->Conc_Full[m] = 0.0; - // } - //} - else - { - para->getParH(lev)->geo[m] = GEO_FLUID; - if (para->getDiffOn()==true) - { - para->getParH(lev)->Conc_Full[m] = 0.0; - } - } - //if (i == STARTOFFX) - //{ - // para->getParH(lev)->geo[m] = GEO_SOLID; - // if (ic.diffOn==true) - // { - // para->getParH(lev)->Conc_Full[m] = 0.0; - // } - //} - if (k == STARTOFFZ) - { - para->getParH(lev)->geo[m] = GEO_SOLID; - if (para->getDiffOn()==true) - { - para->getParH(lev)->Conc_Full[m] = 0.0; - } - } - - - para->getParH(lev)->k[m] = 0; - } - } - } - } - else if( lev > para->getCoarse() && lev < para->getFine() ) - { - for (unsigned int k=0; k<para->getParH(lev)->nz; k++) - { - for (unsigned int j=0; j<para->getParH(lev)->ny; j++) - { - for (unsigned int i=0; i<para->getParH(lev)->nx; i++) - { - int m = para->getParH(lev)->nx*(para->getParH(lev)->ny*k + j) + i; - - if ( i < STARTOFFX || i > para->getParH(lev)->gridNX + STARTOFFX - 1 - || j < STARTOFFY || j > para->getParH(lev)->gridNY + STARTOFFY - 1 - || k < STARTOFFZ || k > para->getParH(lev)->gridNZ + STARTOFFZ - 1 ) - { - para->getParH(lev)->geo[m] = GEO_VOID; - if (para->getDiffOn()==true) - { - para->getParH(lev)->Conc_Full[m] = 0.0; - } - } - else if ((i >= para->getParH(lev+1)->XdistKn + STARTOFFX + 3) && (i <= (para->getParH(lev+1)->XdistKn + para->getParH(lev+1)->gridNX / 2) + STARTOFFX - 3) && - (j >= para->getParH(lev+1)->YdistKn + STARTOFFY + 3) && (j <= (para->getParH(lev+1)->YdistKn + para->getParH(lev+1)->gridNY / 2) + STARTOFFY - 3) && - (k >= para->getParH(lev+1)->ZdistKn + STARTOFFZ + 3) && (k <= (para->getParH(lev+1)->ZdistKn + para->getParH(lev+1)->gridNZ / 2) + STARTOFFZ - 3) ) - { - para->getParH(lev)->geo[m] = GEO_VOID; - if (para->getDiffOn()==true) - { - para->getParH(lev)->Conc_Full[m] = 0.0; - } - } - //else if (i = STARTOFFX) - //{ - // para->getParH(lev)->geo[m] = GEO_SOLID; - // if (ic.diffOn==true) - // { - // para->getParH(lev)->Conc_Full[m] = 0.0; - // } - //} - //else if ((i >= para->getParH(lev)->gridNX / 4 + STARTOFFX + 3) && (i <= (para->getParH(lev)->gridNX * 3 / 4) + STARTOFFX - 3) && - // (j >= para->getParH(lev)->gridNY / 4 + STARTOFFY + 3) && (j <= (para->getParH(lev)->gridNY * 3 / 4) + STARTOFFY - 3) && - // (k >= para->getParH(lev)->gridNZ / 8 + STARTOFFZ + 3) && (k <= (para->getParH(lev)->gridNZ * 5 / 8) + STARTOFFZ - 3) ) - //{ - // para->getParH(lev)->geo[m] = GEO_SOLID; - //} - else - { - para->getParH(lev)->geo[m] = GEO_FLUID; - if (para->getDiffOn()==true) - { - para->getParH(lev)->Conc_Full[m] = 0.0; - } - } - if (i == STARTOFFX) - { - para->getParH(lev)->geo[m] = GEO_SOLID; - if (para->getDiffOn()==true) - { - para->getParH(lev)->Conc_Full[m] = 0.0; - } - } - para->getParH(lev)->k[m] = 0; - } - } - } - } - - //std::cout << "read geoFull..." ; - //readVFgeoFull(para, "D:/temp/gpuBenchmarkCylinder/GPU/geoFull.dat"); - //std::cout << "done.\n"; - - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //Buffer GEO - //geo_sbuf_t.setSize(1,para->getParH(0)->sizePlaneXY); - //geo_rbuf_t.setSize(1,para->getParH(0)->sizePlaneXY); - //geo_sbuf_b.setSize(1,para->getParH(0)->sizePlaneXY); - //geo_rbuf_b.setSize(1,para->getParH(0)->sizePlaneXY); - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //Exchange GEO - //if (numprocs>1) - //{ - // exchangeDataGeo(lev); - //} - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - para->setSizeMatSparse(lev); - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - cudaManager->cudaAllocSP(lev); - //F3 - cudaManager->cudaAllocF3SP(lev); - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //Buffer - //sbuf_t.setSize(27,para->getParH(0)->sizePlaneST); - //rbuf_t.setSize(27,para->getParH(0)->sizePlaneRT); - //sbuf_b.setSize(27,para->getParH(0)->sizePlaneSB); - //rbuf_b.setSize(27,para->getParH(0)->sizePlaneRB); - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - if (para->getDiffOn()==true) - { - cudaManager->cudaAllocConc(lev); - } - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - para->fillSparse(lev); - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - cudaManager->cudaCopySP(lev); - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - if (para->getDiffOn()==true) - { - std::cout << "Maikes Thermo-Stuff...\n" ; - initTemperatur(para, cudaManager, lev);//thermostuff(lev); - std::cout << "done.\n"; - } - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - if ( lev < para->getFine() && para->getMaxLevel()>=1) - { - ////////////////////////////////////////////////////////////////////////////////////////////////////// - cudaManager->cudaAllocInterfaceCF(lev); - cudaManager->cudaAllocInterfaceFC(lev); - cudaManager->cudaAllocInterfaceOffCF(lev); - cudaManager->cudaAllocInterfaceOffFC(lev); - ////////////////////////////////////////////////////////////////////////////////////////////////////// - //Find Interpolation Interface - ////////////////////////////////////////////////////////////////////////////////////////////////////// - std::cout << "Anzahl der CF-Interpolationzellen vorher:" << para->getParH(lev)->K_CF << "\n"; - std::cout << "Anzahl der FC-Interpolationzellen vorher:" << para->getParH(lev)->K_FC << "\n"; - ////////////////////////////////////////////////////////////////////////////////////////////////////// - interpolation(para->getParH(lev)->intCF, para->getParH(lev)->intFC, - para->getParH(lev)->gridNX, para->getParH(lev)->gridNY, para->getParH(lev)->gridNZ, - para->getParH(lev+1)->gridNX, para->getParH(lev+1)->gridNY, para->getParH(lev+1)->gridNZ, - para->getParH(lev+1)->XdistKn, para->getParH(lev+1)->YdistKn, para->getParH(lev+1)->ZdistKn, - para->getParH(lev)->k, para->getParH(lev+1)->k, para->getParH(lev)->need_interface, - para->getParH(lev)->offCF, para->getParH(lev)->offFC); - ////////////////////////////////////////////////////////////////////////////////////////////////////// - std::cout << "Anzahl der CF-Interpolationzellen nachher:" << para->getParH(lev)->intCF.kCF << "\n"; - std::cout << "Anzahl der FC-Interpolationzellen nachher:" << para->getParH(lev)->intFC.kFC << "\n"; - ////////////////////////////////////////////////////////////////////////////////////////////////////// - //Test - //for (int test = 0; test < para->getParH(lev)->intCF.kCF; test++) - //{ - // para->getParH(lev)->offCF.xOffCF[test] = -para->getParH(lev)->offCF.xOffCF[test]; - // para->getParH(lev)->offCF.yOffCF[test] = -para->getParH(lev)->offCF.yOffCF[test]; - // para->getParH(lev)->offCF.zOffCF[test] = -para->getParH(lev)->offCF.zOffCF[test]; - //} - ////////////////////////////////////////////////////////////////////////////////////////////////////// - cudaManager->cudaCopyInterfaceCF(lev); - cudaManager->cudaCopyInterfaceFC(lev); - cudaManager->cudaCopyInterfaceOffCF(lev); - cudaManager->cudaCopyInterfaceOffFC(lev); - ////////////////////////////////////////////////////////////////////////////////////////////////////// - } - } - //////////////////////////////////////////////////////////////////////////////////////////////////////// - //if (para->getMyID() == para->getPressInID()) setSizeOfPlane(para, 0, para->getPressInZ()); - //else if(para->getMyID() == para->getPressOutID()) setSizeOfPlane(para, 0, para->getPressOutZ()); - //////////////////////////////////////////////////////////////////////////////////////////////////////// - -} diff --git a/src/gpu/VirtualFluids_GPU/Init/DefineGrid.h b/src/gpu/VirtualFluids_GPU/Init/DefineGrid.h deleted file mode 100644 index 474ab9080..000000000 --- a/src/gpu/VirtualFluids_GPU/Init/DefineGrid.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef DEFINE_GRID_H -#define DEFINE_GRID_H - -#include "LBM/LB.h" -#include "Parameter/Parameter.h" -#include "Communication/Communicator.h" -#include "GPU/CudaMemoryManager.h" - -extern "C" void defineGrid(Parameter* para, vf::gpu::Communicator* comm, CudaMemoryManager* cudaManager); - -#endif diff --git a/src/gpu/VirtualFluids_GPU/Init/InitLattice.cpp b/src/gpu/VirtualFluids_GPU/Init/InitLattice.cpp index c5969ba6e..e2b7b34d7 100644 --- a/src/gpu/VirtualFluids_GPU/Init/InitLattice.cpp +++ b/src/gpu/VirtualFluids_GPU/Init/InitLattice.cpp @@ -1,86 +1,72 @@ +//======================================================================================= +// ____ ____ __ ______ __________ __ __ __ __ +// \ \ | | | | | _ \ |___ ___| | | | | / \ | | +// \ \ | | | | | |_) | | | | | | | / \ | | +// \ \ | | | | | _ / | | | | | | / /\ \ | | +// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ +// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| +// \ \ | | ________________________________________________________________ +// \ \ | | | ______________________________________________________________| +// \ \| | | | __ __ __ __ ______ _______ +// \ | | |_____ | | | | | | | | | _ \ / _____) +// \ | | _____| | | | | | | | | | | \ \ \_______ +// \ | | | | |_____ | \_/ | | | | |_/ / _____ | +// \ _____| |__| |________| \_______/ |__| |______/ (_______/ +// +// This file is part of VirtualFluids. VirtualFluids is free software: you can +// redistribute it and/or modify it under the terms of the GNU General Public +// License as published by the Free Software Foundation, either version 3 of +// the License, or (at your option) any later version. +// +// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. +// +//! \file InitLattice.h +//! \ingroup Init +//! \author Martin Schoenherr +//======================================================================================= #include "Init/InitLattice.h" -#include <cuda_runtime.h> -#include <helper_cuda.h> -#include "Parameter/Parameter.h" +#include "GPU/CudaMemoryManager.h" #include "GPU/GPU_Interface.h" -#include "Temperature/FindTemperature.h" +#include "Parameter/Parameter.h" #include "PreProcessor/PreProcessor.h" -#include "GPU/CudaMemoryManager.h" +#include "Temperature/FindTemperature.h" + -//////////////////////////////////////////////////////////////////////////////// void initLattice(SPtr<Parameter> para, SPtr<PreProcessor> preProcessor, SPtr<CudaMemoryManager> cudaManager) { - for (int lev=para->getFine(); lev >= para->getCoarse(); lev--) - { - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - preProcessor->init(para, lev); + for (int lev = para->getFine(); lev >= para->getCoarse(); lev--) { + preProcessor->init(para, lev); + + CalcMacCompSP27( + para->getParD(lev)->vx_SP, para->getParD(lev)->vy_SP, para->getParD(lev)->vz_SP, para->getParD(lev)->rho_SP, + para->getParD(lev)->press_SP, para->getParD(lev)->geoSP, para->getParD(lev)->neighborX_SP, + para->getParD(lev)->neighborY_SP, para->getParD(lev)->neighborZ_SP, para->getParD(lev)->size_Mat_SP, + para->getParD(lev)->numberofthreads, para->getParD(lev)->d0SP.f[0], para->getParD(lev)->evenOrOdd); + + if (para->getCalcMedian()) { + constexpr uint tdiff = 1; + CalcMacMedSP27(para->getParD(lev)->vx_SP_Med, para->getParD(lev)->vy_SP_Med, para->getParD(lev)->vz_SP_Med, + para->getParD(lev)->rho_SP_Med, para->getParD(lev)->press_SP_Med, para->getParD(lev)->geoSP, + para->getParD(lev)->neighborX_SP, para->getParD(lev)->neighborY_SP, + para->getParD(lev)->neighborZ_SP, tdiff, para->getParD(lev)->size_Mat_SP, + para->getParD(lev)->numberofthreads, para->getParD(lev)->evenOrOdd); + } + // advection - diffusion + if (para->getDiffOn()) { + + cudaManager->cudaAllocConc(lev); - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - //CalcMacSP27(para->getParD(lev)->vx_SP, - // para->getParD(lev)->vy_SP, - // para->getParD(lev)->vz_SP, - // para->getParD(lev)->rho_SP, - // para->getParD(lev)->press_SP, - // para->getParD(lev)->geoSP, - // para->getParD(lev)->neighborX_SP, - // para->getParD(lev)->neighborY_SP, - // para->getParD(lev)->neighborZ_SP, - // para->getParD(lev)->size_Mat_SP, - // para->getParD(lev)->numberofthreads, - // para->getParD(lev)->d0SP.f[0], - // para->getParD(lev)->evenOrOdd); - //getLastCudaError("Kernel CalcMacSP27 execution failed"); - CalcMacCompSP27(para->getParD(lev)->vx_SP, - para->getParD(lev)->vy_SP, - para->getParD(lev)->vz_SP, - para->getParD(lev)->rho_SP, - para->getParD(lev)->press_SP, - para->getParD(lev)->geoSP, - para->getParD(lev)->neighborX_SP, - para->getParD(lev)->neighborY_SP, - para->getParD(lev)->neighborZ_SP, - para->getParD(lev)->size_Mat_SP, - para->getParD(lev)->numberofthreads, - para->getParD(lev)->d0SP.f[0], - para->getParD(lev)->evenOrOdd); - getLastCudaError("Kernel execution failed"); - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - if (para->getCalcMedian()) - { - unsigned int tdiff = 1; - CalcMacMedSP27( para->getParD(lev)->vx_SP_Med, - para->getParD(lev)->vy_SP_Med, - para->getParD(lev)->vz_SP_Med, - para->getParD(lev)->rho_SP_Med, - para->getParD(lev)->press_SP_Med, - para->getParD(lev)->geoSP, - para->getParD(lev)->neighborX_SP, - para->getParD(lev)->neighborY_SP, - para->getParD(lev)->neighborZ_SP, - tdiff, - para->getParD(lev)->size_Mat_SP, - para->getParD(lev)->numberofthreads, - para->getParD(lev)->evenOrOdd); - getLastCudaError("CalcMacMedSP27 execution failed"); - } - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - // advection - diffusion stuff - if (para->getDiffOn()==true){ - //malloc - //printf("vor cudaAllocConc\n"); - cudaManager->cudaAllocConc(lev); - //define init conc/temp - //printf("vor Schleife\n"); - for (unsigned int i = 0; i < para->getParH(lev)->size_Mat_SP; i++) - { - para->getParH(lev)->Conc[i] = para->getTemperatureInit(); - } - //malloc and init fs - //printf("vor initTemperatur\n"); - initTemperatur(para.get(), cudaManager.get(), lev); - } - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + for (unsigned int i = 0; i < para->getParH(lev)->size_Mat_SP; i++) { + para->getParH(lev)->Conc[i] = para->getTemperatureInit(); + } + initTemperatur(para.get(), cudaManager.get(), lev); + } } } diff --git a/src/gpu/VirtualFluids_GPU/Init/InitLattice.h b/src/gpu/VirtualFluids_GPU/Init/InitLattice.h index 4e781f96e..e69386b78 100644 --- a/src/gpu/VirtualFluids_GPU/Init/InitLattice.h +++ b/src/gpu/VirtualFluids_GPU/Init/InitLattice.h @@ -1,3 +1,35 @@ +//======================================================================================= +// ____ ____ __ ______ __________ __ __ __ __ +// \ \ | | | | | _ \ |___ ___| | | | | / \ | | +// \ \ | | | | | |_) | | | | | | | / \ | | +// \ \ | | | | | _ / | | | | | | / /\ \ | | +// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ +// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| +// \ \ | | ________________________________________________________________ +// \ \ | | | ______________________________________________________________| +// \ \| | | | __ __ __ __ ______ _______ +// \ | | |_____ | | | | | | | | | _ \ / _____) +// \ | | _____| | | | | | | | | | | \ \ \_______ +// \ | | | | |_____ | \_/ | | | | |_/ / _____ | +// \ _____| |__| |________| \_______/ |__| |______/ (_______/ +// +// This file is part of VirtualFluids. VirtualFluids is free software: you can +// redistribute it and/or modify it under the terms of the GNU General Public +// License as published by the Free Software Foundation, either version 3 of +// the License, or (at your option) any later version. +// +// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. +// +//! \file InitLattice.h +//! \ingroup Init +//! \author Martin Schoenherr +//======================================================================================= #ifndef INIT_LATTICE_H #define INIT_LATTICE_H diff --git a/src/gpu/VirtualFluids_GPU/Init/SetParameter.cpp b/src/gpu/VirtualFluids_GPU/Init/SetParameter.cpp deleted file mode 100644 index a4279516b..000000000 --- a/src/gpu/VirtualFluids_GPU/Init/SetParameter.cpp +++ /dev/null @@ -1,260 +0,0 @@ -//#include "Init/SetParameter.h" -//#include "Interface_OpenFOAM/Interface.h" -// -////////////////////////////////////////////////////////////////////////////////// -//void setParameters(Parameter* para, vf::gpu::Communicator* comm, std::string &cstr) -//{ -// ConfigFile cf(cstr.c_str()); -// if ( !cf.read() ) -// { -// std::string exceptionText = "Unable to read configuration file\n"; -// throw exceptionText; -// } -// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// para->setMaxDev( StringUtil::toInt(cf.getValue( "NumberOfDevices" ))); -// para->setMyID( comm->getPID()); -// para->setNumprocs( comm->getNummberOfProcess()); -// para->setDevices( StringUtil::toVector<int>(cf.getValue( "Devices" ))); -// devCheck( comm->mapCudaDevice(para->getMyID(), para->getNumprocs(), para->getDevices(), para->getMaxDev())); -// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// std::string _path = cf.getValue( "Path" ); -// std::string _prefix = cf.getValue( "Prefix" ); -// std::string _gridpath = cf.getValue( "GridPath" ); -// std::string gridPath = getGridPath(para, _gridpath); -// para->setOutputPath( _path); -// para->setOutputPrefix( _prefix); -// para->setFName( _path + "/" + _prefix); -// para->setPrintFiles( false); -// para->setPrintFiles( StringUtil::toBool( cf.getValue( "WriteGrid" ))); -// para->setGeometryValues( StringUtil::toBool( cf.getValue( "GeometryValues" ))); -// para->setCalc2ndOrderMoments( StringUtil::toBool( cf.getValue( "calc2ndOrderMoments" ))); -// para->setCalc3rdOrderMoments( StringUtil::toBool( cf.getValue( "calc3rdOrderMoments" ))); -// para->setCalcHighOrderMoments(StringUtil::toBool( cf.getValue( "calcHigherOrderMoments" ))); -// para->setReadGeo( StringUtil::toBool( cf.getValue( "ReadGeometry" ))); -// para->setCalcMedian( StringUtil::toBool( cf.getValue( "calcMedian" ))); -// para->setConcFile( StringUtil::toBool( cf.getValue( "UseConcFile" ))); -// para->setUseMeasurePoints( StringUtil::toBool( cf.getValue( "UseMeasurePoints"))); -// para->setUseWale( StringUtil::toBool( cf.getValue( "UseWale" ))); -// para->setSimulatePorousMedia( StringUtil::toBool( cf.getValue( "SimulatePorousMedia" ))); -// para->setD3Qxx( StringUtil::toInt( cf.getValue( "D3Qxx" ))); -// para->setMaxLevel( StringUtil::toInt( cf.getValue( "NOGL" ))); -// para->setTEnd( StringUtil::toInt( cf.getValue( "TimeEnd" ))); -// para->setTOut( StringUtil::toInt( cf.getValue( "TimeOut" ))); -// para->setTStartOut( StringUtil::toInt( cf.getValue( "TimeStartOut"))); -// para->setTimeCalcMedStart( StringUtil::toInt( cf.getValue( "TimeStartCalcMedian" ))); -// para->setTimeCalcMedEnd( StringUtil::toInt( cf.getValue( "TimeEndCalcMedian" ))); -// para->setPressInID( StringUtil::toInt( cf.getValue( "PressInID" ))); -// para->setPressOutID( StringUtil::toInt( cf.getValue( "PressOutID" ))); -// para->setPressInZ( StringUtil::toInt( cf.getValue( "PressInZ" ))); -// para->setPressOutZ( StringUtil::toInt( cf.getValue( "PressOutZ" ))); -// ////////////////////////////////////////////////////////////////////////// -// para->setDiffOn( StringUtil::toBool( cf.getValue( "DiffOn" ))); -// para->setDiffMod( StringUtil::toInt( cf.getValue( "DiffMod" ))); -// para->setDiffusivity( StringUtil::toFloat(cf.getValue( "Diffusivity" ))); -// para->setTemperatureInit( StringUtil::toFloat(cf.getValue( "Temp" ))); -// para->setTemperatureBC( StringUtil::toFloat(cf.getValue( "TempBC" ))); -// ////////////////////////////////////////////////////////////////////////// -// para->setViscosity( StringUtil::toFloat(cf.getValue( "Viscosity_LB" ))); -// para->setVelocity( StringUtil::toFloat(cf.getValue( "Velocity_LB" ))); -// para->setViscosityRatio( StringUtil::toFloat(cf.getValue( "Viscosity_Ratio_World_to_LB" ))); -// para->setVelocityRatio( StringUtil::toFloat(cf.getValue( "Velocity_Ratio_World_to_LB" ))); -// para->setDensityRatio( StringUtil::toFloat(cf.getValue( "Density_Ratio_World_to_LB" ))); -// para->setPressRatio( StringUtil::toFloat(cf.getValue( "Delta_Press" ))); -// para->setRealX( StringUtil::toFloat(cf.getValue( "SliceRealX" ))); -// para->setRealY( StringUtil::toFloat(cf.getValue( "SliceRealY" ))); -// para->setFactorPressBC( StringUtil::toFloat(cf.getValue( "dfpbc" ))); -// para->setGeometryFileC( cf.getValue( "GeometryC" )); -// para->setGeometryFileM( cf.getValue( "GeometryM" )); -// para->setGeometryFileF( cf.getValue( "GeometryF" )); -// ////////////////////////////////////////////////////////////////////////// -// para->setgeoVec( gridPath + cf.getValue( "geoVec" )); -// para->setcoordX( gridPath + cf.getValue( "coordX" )); -// para->setcoordY( gridPath + cf.getValue( "coordY" )); -// para->setcoordZ( gridPath + cf.getValue( "coordZ" )); -// para->setneighborX( gridPath + cf.getValue( "neighborX" )); -// para->setneighborY( gridPath + cf.getValue( "neighborY" )); -// para->setneighborZ( gridPath + cf.getValue( "neighborZ" )); -// para->setscaleCFC( gridPath + cf.getValue( "scaleCFC" )); -// para->setscaleCFF( gridPath + cf.getValue( "scaleCFF" )); -// para->setscaleFCC( gridPath + cf.getValue( "scaleFCC" )); -// para->setscaleFCF( gridPath + cf.getValue( "scaleFCF" )); -// para->setscaleOffsetCF( gridPath + cf.getValue( "scaleOffsetCF" )); -// para->setscaleOffsetFC( gridPath + cf.getValue( "scaleOffsetFC" )); -// para->setgeomBoundaryBcQs( gridPath + cf.getValue( "geomBoundaryBcQs" )); -// para->setgeomBoundaryBcValues(gridPath + cf.getValue( "geomBoundaryBcValues" )); -// para->setinletBcQs( gridPath + cf.getValue( "inletBcQs" )); -// para->setinletBcValues( gridPath + cf.getValue( "inletBcValues" )); -// para->setoutletBcQs( gridPath + cf.getValue( "outletBcQs" )); -// para->setoutletBcValues( gridPath + cf.getValue( "outletBcValues" )); -// para->settopBcQs( gridPath + cf.getValue( "topBcQs" )); -// para->settopBcValues( gridPath + cf.getValue( "topBcValues" )); -// para->setbottomBcQs( gridPath + cf.getValue( "bottomBcQs" )); -// para->setbottomBcValues( gridPath + cf.getValue( "bottomBcValues" )); -// para->setfrontBcQs( gridPath + cf.getValue( "frontBcQs" )); -// para->setfrontBcValues( gridPath + cf.getValue( "frontBcValues" )); -// para->setbackBcQs( gridPath + cf.getValue( "backBcQs" )); -// para->setbackBcValues( gridPath + cf.getValue( "backBcValues" )); -// para->setnumberNodes( gridPath + cf.getValue( "numberNodes" )); -// para->setLBMvsSI( gridPath + cf.getValue( "LBMvsSI" )); -// //////////////////////////////gridPath + //////////////////////////////////////////// -// para->setmeasurePoints( gridPath + cf.getValue( "measurePoints" )); -// para->setpropellerValues( gridPath + cf.getValue( "propellerValues" )); -// para->setclockCycleForMP( StringUtil::toFloat(cf.getValue( "measureClockCycle" ))); -// para->settimestepForMP( StringUtil::toInt(cf.getValue( "measureTimestep" ))); -// para->setcpTop( gridPath + cf.getValue( "cpTop" )); -// para->setcpBottom( gridPath + cf.getValue( "cpBottom" )); -// para->setcpBottom2( gridPath + cf.getValue( "cpBottom2" )); -// para->setConcentration( gridPath + cf.getValue( "Concentration" )); -// ////////////////////////////////////////////////////////////////////////// -// //Normals - Geometry -// para->setgeomBoundaryNormalX( gridPath + cf.getValue( "geomBoundaryNormalX" )); -// para->setgeomBoundaryNormalY( gridPath + cf.getValue( "geomBoundaryNormalY" )); -// para->setgeomBoundaryNormalZ( gridPath + cf.getValue( "geomBoundaryNormalZ" )); -// //Normals - Inlet -// para->setInflowBoundaryNormalX( gridPath + cf.getValue( "inletBoundaryNormalX" )); -// para->setInflowBoundaryNormalY( gridPath + cf.getValue( "inletBoundaryNormalY" )); -// para->setInflowBoundaryNormalZ( gridPath + cf.getValue( "inletBoundaryNormalZ" )); -// //Normals - Outlet -// para->setOutflowBoundaryNormalX( gridPath + cf.getValue( "outletBoundaryNormalX" )); -// para->setOutflowBoundaryNormalY( gridPath + cf.getValue( "outletBoundaryNormalY" )); -// para->setOutflowBoundaryNormalZ( gridPath + cf.getValue( "outletBoundaryNormalZ" )); -// ////////////////////////////////////////////////////////////////////////// -// //Forcing -// para->setForcing(StringUtil::toFloat(cf.getValue( "ForcingX")), StringUtil::toFloat(cf.getValue( "ForcingY")), StringUtil::toFloat(cf.getValue( "ForcingZ"))); -// ////////////////////////////////////////////////////////////////////////// -// //Particles -// para->setCalcParticles( StringUtil::toBool( cf.getValue( "calcParticles" ))); -// para->setParticleBasicLevel(StringUtil::toInt( cf.getValue( "baseLevel" ))); -// para->setParticleInitLevel( StringUtil::toInt( cf.getValue( "initLevel" ))); -// para->setNumberOfParticles( StringUtil::toInt( cf.getValue( "numberOfParticles" ))); -// para->setneighborWSB( gridPath + cf.getValue( "neighborWSB" )); -// para->setStartXHotWall( StringUtil::toDouble(cf.getValue("startXHotWall" ))); -// para->setEndXHotWall( StringUtil::toDouble(cf.getValue("endXHotWall" ))); -// ////////////////////////////////////////////////////////////////////////// -// //for Multi GPU -// if (para->getNumprocs()>1) -// { -// //////////////////////////////////////////////////////////////////////////// -// ////1D domain decomposition -// //std::vector<std::string> sendProcNeighbors; -// //std::vector<std::string> recvProcNeighbors; -// //for (int i = 0; i<para->getNumprocs();i++) -// //{ -// // sendProcNeighbors.push_back(gridPath + StringUtil::toString(i) + "s.dat"); -// // recvProcNeighbors.push_back(gridPath + StringUtil::toString(i) + "r.dat"); -// //} -// //para->setPossNeighborFiles(sendProcNeighbors, "send"); -// //para->setPossNeighborFiles(recvProcNeighbors, "recv"); -// ////////////////////////////////////////////////////////////////////////// -// //3D domain decomposition -// std::vector<std::string> sendProcNeighborsX, sendProcNeighborsY, sendProcNeighborsZ; -// std::vector<std::string> recvProcNeighborsX, recvProcNeighborsY, recvProcNeighborsZ; -// for (int i = 0; i<para->getNumprocs();i++) -// { -// sendProcNeighborsX.push_back(gridPath + StringUtil::toString(i) + "Xs.dat"); -// sendProcNeighborsY.push_back(gridPath + StringUtil::toString(i) + "Ys.dat"); -// sendProcNeighborsZ.push_back(gridPath + StringUtil::toString(i) + "Zs.dat"); -// recvProcNeighborsX.push_back(gridPath + StringUtil::toString(i) + "Xr.dat"); -// recvProcNeighborsY.push_back(gridPath + StringUtil::toString(i) + "Yr.dat"); -// recvProcNeighborsZ.push_back(gridPath + StringUtil::toString(i) + "Zr.dat"); -// } -// para->setPossNeighborFilesX(sendProcNeighborsX, "send"); -// para->setPossNeighborFilesY(sendProcNeighborsY, "send"); -// para->setPossNeighborFilesZ(sendProcNeighborsZ, "send"); -// para->setPossNeighborFilesX(recvProcNeighborsX, "recv"); -// para->setPossNeighborFilesY(recvProcNeighborsY, "recv"); -// para->setPossNeighborFilesZ(recvProcNeighborsZ, "recv"); -// } -// ////////////////////////////////////////////////////////////////////////// -// //para->setkFull( cf.getValue( "kFull" )); -// //para->setgeoFull( cf.getValue( "geoFull" )); -// //para->setnoSlipBcPos( cf.getValue( "noSlipBcPos" )); -// //para->setnoSlipBcQs( cf.getValue( "noSlipBcQs" )); -// //para->setnoSlipBcValues( cf.getValue( "noSlipBcValues" )); -// //para->setnoSlipBcValue( cf.getValue( "noSlipBcValue" )); -// //para->setslipBcPos( cf.getValue( "slipBcPos" )); -// //para->setslipBcQs( cf.getValue( "slipBcQs" )); -// //para->setslipBcValue( cf.getValue( "slipBcValue" )); -// //para->setpressBcPos( cf.getValue( "pressBcPos" )); -// //para->setpressBcQs( cf.getValue( "pressBcQs" )); -// //para->setpressBcValues( cf.getValue( "pressBcValues" )); -// //para->setpressBcValue( cf.getValue( "pressBcValue" )); -// //para->setvelBcQs( cf.getValue( "velBcQs" )); -// //para->setvelBcValues( cf.getValue( "velBcValues" )); -// //para->setpropellerCylinder( cf.getValue( "propellerCylinder" )); -// //para->setpropellerQs( cf.getValue( "propellerQs" )); -// //para->setwallBcQs( cf.getValue( "wallBcQs" )); -// //para->setwallBcValues( cf.getValue( "wallBcValues" )); -// //para->setperiodicBcQs( cf.getValue( "periodicBcQs" )); -// //para->setperiodicBcValues( cf.getValue( "periodicBcValues" )); -// //cout << "Try this: " << para->getgeomBoundaryBcValues() << endl; -// -// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// //Restart -// para->setTimeDoCheckPoint( StringUtil::toInt( cf.getValue( "TimeDoCheckPoint" ))); -// para->setTimeDoRestart( StringUtil::toInt( cf.getValue( "TimeDoRestart" ))); -// para->setDoCheckPoint( StringUtil::toBool( cf.getValue( "DoCheckPoint" ))); -// para->setDoRestart( StringUtil::toBool( cf.getValue( "DoRestart" ))); -// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// para->setGridX( StringUtil::toVector<int>(cf.getValue( "GridX" ))); //GridX = StringUtil::toVector<int>(cf.getValue( "GridX" )); -// para->setGridY( StringUtil::toVector<int>(cf.getValue( "GridY" ))); //GridY = StringUtil::toVector<int>(cf.getValue( "GridY" )); -// para->setGridZ( StringUtil::toVector<int>(cf.getValue( "GridZ" ))); //GridZ = StringUtil::toVector<int>(cf.getValue( "GridZ" )); -// para->setDistX( StringUtil::toVector<int>(cf.getValue( "DistX" ))); //DistX = StringUtil::toVector<int>(cf.getValue( "DistX" )); -// para->setDistY( StringUtil::toVector<int>(cf.getValue( "DistY" ))); //DistY = StringUtil::toVector<int>(cf.getValue( "DistY" )); -// para->setDistZ( StringUtil::toVector<int>(cf.getValue( "DistZ" ))); //DistZ = StringUtil::toVector<int>(cf.getValue( "DistZ" )); -// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// para->setNeedInterface( StringUtil::toVector<bool>(cf.getValue( "NeedInterface" ))); -// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// Interface *config = new Interface(false); -// config->setDimensions(para); -// config->setBoundingBox(para); -// delete config; -// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// para->initParameter(); -// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// para->setRe(para->getVelocity() * (real)1.0 / para->getViscosity()); -// para->setPhi((real) 0.0); -// para->setlimitOfNodesForVTK(30000000); //max 30 Million nodes per VTK file -// if (para->getDoRestart()) -// { -// para->setStartTurn(para->getTimeDoRestart()); -// } -// else -// { -// para->setStartTurn((unsigned int)0); //100000 -// } -// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -//} -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -////////////////////////////////////////////////////////////////////////////////// -//std::string getGridPath(Parameter* para, std::string Gridpath) -//{ -// if(para->getNumprocs()==1) -// { -// return Gridpath + "/"; -// } -// else -// { -// return Gridpath + "/" + StringUtil::toString(para->getMyID()) + "/"; -// } -// -//} -////////////////////////////////////////////////////////////////////////////////// -// diff --git a/src/gpu/VirtualFluids_GPU/Init/SetParameter.h b/src/gpu/VirtualFluids_GPU/Init/SetParameter.h deleted file mode 100644 index 7298c40f2..000000000 --- a/src/gpu/VirtualFluids_GPU/Init/SetParameter.h +++ /dev/null @@ -1,15 +0,0 @@ -//#ifndef SET_PARAMETER_H -//#define SET_PARAMETER_H -// -//#include "Parameter/Parameter.h" -//#include "Input/ConfigFile.h" -//#include "Utilities/StringUtil.hpp" -//#include "GPU/devCheck.h" -//#include "Communication/Communicator.h" -// -//#include <iostream> -// -//void setParameters(Parameter* para, vf::gpu::Communicator* comm, std::string &cstr); -//std::string getGridPath(Parameter* para, std::string Gridpath); -// -//#endif diff --git a/src/gpu/VirtualFluids_GPU/Input/ConfigFile.cpp b/src/gpu/VirtualFluids_GPU/Input/ConfigFile.cpp deleted file mode 100644 index cfe4da2c7..000000000 --- a/src/gpu/VirtualFluids_GPU/Input/ConfigFile.cpp +++ /dev/null @@ -1,198 +0,0 @@ -#include "ConfigFile.h" -#include <errno.h> -#include <algorithm> -#include <sstream> -#include <iostream> -#include <string> - -#include "Core/StringUtilities/StringUtil.h" - - -ConfigFile::ConfigFile( const char *strConfigFile ) -{ - if ( strConfigFile ) - m_sConfigFile = strConfigFile; -} -ConfigFile::~ConfigFile() -{ -} -bool ConfigFile::read() -{ - m_in.open(m_sConfigFile.c_str(),std::ios::in); - if (m_in.fail()) - { - return false; - } - while (!m_in.eof()) - { - //-------------------------------------------------------- - // Get a token and value. - // This gives values to member vars: m_token and m_value. - //---------------------------------------------------------- - get_token_and_value(); - if ( m_token.length() ) - m_ConfigEntries.insert( String_Pair(m_token, m_value) ); - } - m_in.close(); - return true; -} -void ConfigFile::get_token_and_value(void) -{ - char token[1024]; - char ch; - bool found_equal=false; - int i=0; - eat_white_and_comments(); - while(!(m_in.get(ch)).fail()) - { - if ((ch != '\t')) - { - if ( (ch == '=') || (ch == ' ') || (ch == '\n') || (ch == '\r') || - (ch == '\t')) - { - if (ch == '=')found_equal=true; - break; - } - token[i++]=ch; - } - } - if (i==0) - { - // It didn�t find a token, in this case. - m_token=""; - m_value=""; - return; - } - // Null-terminate the token that was found. - token[i++]='\0'; - m_token = token; - makeLower(m_token); - // Advance to the equal sign, if need be. - if (!found_equal) - { - if (!advance_to_equal_sign_on_line()) - { - // The token had no value. - m_token=""; - m_value=""; - return; - } - } - // Get the token�s value. - i=0; - char c = eat_white_and_comments(false); - if ( c != '\n' ) - { - i=0; - while(!(m_in.get(ch)).fail()) - { - if ((ch == '\t') || (ch == '\r') || (ch == '\n') || (ch == '#') ) - { - while (ch!='\n') - { - if (m_in.get(ch).fail()) break; - } - break; - } - else - { - token[i++]=ch; - } - } - } - if (i==0) - { - // This token had no value. - m_value=""; - } - else - { - token[i++]='\0'; - m_value=token; - // Remove leading/trailing spaces. - m_value = StringUtil::trim(m_value); - // Strip leading and trailing quotes, if there are any. - if ( m_value[0] == '"' ) - m_value = m_value.substr( 1 ); - if ( m_value[ m_value.length() -1 ] == '"' ) - m_value = m_value.substr( 0, m_value.length()-1 ); - } -} -bool ConfigFile::advance_to_equal_sign_on_line() -{ - char ch; - bool found_equal=false; - while ( !(m_in.get(ch)).fail() ) - { - if ((ch=='\r')||(ch=='\n')) break; - if (ch == '=') - { - found_equal=true; - break; - } - } - return found_equal; -} -char ConfigFile::eat_white_and_comments(bool traverse_newlines) -{ - char ch; - bool in_comment; - in_comment = false; - while (!(m_in.get(ch)).fail()) - { - if (ch == '#') - in_comment = true; - else if (ch == '\n') - { - in_comment = false; - if (!traverse_newlines) - { - return(ch); // Stop eating. - } - } - else if ((!in_comment) && (ch != ' ') && - (ch != '\t') && (ch != '\r')) - { - m_in.putback(ch); - return 0; - } - } - return 0; -} -void ConfigFile::makeLower(std::string &instring) -{ - for(unsigned i=0; i < instring.size(); - i++) - { - instring[i] = tolower(instring[i]); - } -} -bool ConfigFile::hasValue( const char *key ) -{ - bool bRet = false; - std::string sKey = key; - makeLower( sKey ); - if ( m_ConfigEntries.find( sKey.c_str() ) != m_ConfigEntries.end() ) - { - bRet = true; - } - return bRet; -} -std::string ConfigFile::getValue( const char *key ) -{ - std::string sKey = key; - makeLower( sKey ); - if ( m_ConfigEntries.find( sKey.c_str() ) != m_ConfigEntries.end() ) - { - std::map<std::string, std::string>::iterator iter; - iter = m_ConfigEntries.find(sKey.c_str()); - return (*iter).second; - } - return ""; -} -void ConfigFile::setValue( const char *key, const char *value ) -{ - std::string sKey = key; - makeLower( sKey ); - m_ConfigEntries[sKey] = value; -} \ No newline at end of file diff --git a/src/gpu/VirtualFluids_GPU/Input/ConfigFile.h b/src/gpu/VirtualFluids_GPU/Input/ConfigFile.h deleted file mode 100644 index 6df713326..000000000 --- a/src/gpu/VirtualFluids_GPU/Input/ConfigFile.h +++ /dev/null @@ -1,31 +0,0 @@ -#ifndef CONFIGFILE_H -#define CONFIGFILE_H -#include <string> -#include <vector> -#include <fstream> -#include <map> -#include <list> - -class ConfigFile -{ -public: - ConfigFile(const char *strFileName); - virtual ~ConfigFile(void); - bool read(void); - bool hasValue( const char *key ); - std::string getValue( const char *key ); - void setValue( const char *key, const char *value ); -protected: - virtual void get_token_and_value(); - virtual char eat_white_and_comments(bool traverse_newlines=true); - virtual bool advance_to_equal_sign_on_line(); - virtual void makeLower(std::string &instring); -protected: - std::fstream m_in; - std::string m_token; - std::string m_value; - std::string m_sConfigFile; - typedef std::pair <std::string, std::string> String_Pair; - std::map<std::string, std::string> m_ConfigEntries; -}; -#endif diff --git a/src/gpu/VirtualFluids_GPU/LBM/Simulation.cpp b/src/gpu/VirtualFluids_GPU/LBM/Simulation.cpp index d73d300ed..2edb79a8a 100644 --- a/src/gpu/VirtualFluids_GPU/LBM/Simulation.cpp +++ b/src/gpu/VirtualFluids_GPU/LBM/Simulation.cpp @@ -13,7 +13,6 @@ #include "GPU/devCheck.h" #include "basics/utilities/UbFileOutputASCII.h" ////////////////////////////////////////////////////////////////////////// -#include "Input/ConfigFile.h" #include "Input/VtkGeometryReader.h" #include "Input/kFullReader.h" #include "Input/PositionReader.h" @@ -27,8 +26,6 @@ #include "Core/StringUtilities/StringUtil.h" ////////////////////////////////////////////////////////////////////////// #include "Init/InitLattice.h" -#include "Init/DefineGrid.h" -#include "Init/SetParameter.h" #include "Init/VfReader.h" ////////////////////////////////////////////////////////////////////////// #include "FindQ/FindQ.h" diff --git a/src/gpu/VirtualFluids_GPU/Parameter/Parameter.cpp b/src/gpu/VirtualFluids_GPU/Parameter/Parameter.cpp index 8d163c0b6..8f5c04018 100644 --- a/src/gpu/VirtualFluids_GPU/Parameter/Parameter.cpp +++ b/src/gpu/VirtualFluids_GPU/Parameter/Parameter.cpp @@ -373,7 +373,13 @@ void Parameter::readConfigData(const vf::basics::ConfigurationFile &configData) this->setDoRestart(configData.getValue<bool>("DoRestart")); //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// if (configData.contains("NOGL")) - this->setMaxLevel(configData.getValue<int>("NOGL")); + { + maxlevel = configData.getValue<int>("NOGL") - 1; + fine = maxlevel; + + parH.resize(maxlevel + 1); + parD.resize(maxlevel + 1); + } this->setGridX(std::vector<int>(this->getMaxLevel() + 1, 32)); this->setGridY(std::vector<int>(this->getMaxLevel() + 1, 32)); @@ -437,11 +443,6 @@ void Parameter::readConfigData(const vf::basics::ConfigurationFile &configData) void Parameter::initLBMSimulationParameter() { - coarse = 0; - fine = this->maxlevel; - parH.resize(this->maxlevel+1); - parD.resize(this->maxlevel+1); - //host for (int i = coarse; i <= fine; i++) { @@ -558,241 +559,6 @@ void Parameter::initLBMSimulationParameter() } } -void Parameter::setSizeMatSparse(int level) -{ - parH[level]->size_Mat_SP = 1; - parD[level]->size_Mat_SP = 1; - parH[level]->sizePlaneSB = 0; - parH[level]->sizePlaneST = 0; - parH[level]->sizePlaneRB = 0; - parH[level]->sizePlaneRT = 0; - parH[level]->isSetSendB = false; - parH[level]->isSetSendT = false; - parH[level]->isSetRecvB = false; - parH[level]->isSetRecvT = false; - unsigned int mm[8]; - - for (unsigned int k=1; k<parH[level]->gridNZ + 2 * STARTOFFZ - 1; k++) - { - for (unsigned int j=1; j<parH[level]->gridNY + 2 * STARTOFFY - 1; j++) - { - for (unsigned int i=1; i<parH[level]->gridNX + 2 * STARTOFFX - 1; i++) - { - mm[0]= parH[level]->nx*(parH[level]->ny*k + j) + i; - mm[1]= mm[0] -1; //W - mm[2]= mm[0] -parH[level]->nx-1; //SW - mm[3]= mm[0] -parH[level]->nx; //S - mm[4]= mm[0]-(parH[level]->nx*parH[level]->ny); //B - mm[5]= mm[0]-(parH[level]->nx*parH[level]->ny) -1; //BW - mm[6]= mm[0]-(parH[level]->nx*parH[level]->ny)-parH[level]->nx; //BS - mm[7]= mm[0]-(parH[level]->nx*parH[level]->ny)-parH[level]->nx-1; //BSW - - if ( parH[level]->geo[mm[0]] != GEO_VOID || - parH[level]->geo[mm[1]] != GEO_VOID || - parH[level]->geo[mm[2]] != GEO_VOID || - parH[level]->geo[mm[3]] != GEO_VOID || - parH[level]->geo[mm[4]] != GEO_VOID || - parH[level]->geo[mm[5]] != GEO_VOID || - parH[level]->geo[mm[6]] != GEO_VOID || - parH[level]->geo[mm[7]] != GEO_VOID ) - { - ////////////////////////////////////////////////////////////////////////// - //add some stuff for the data exchange between the GPUs ////////////////// - if (k == STARTOFFZ) - { - parH[level]->sizePlaneSB += 1; - if (parH[level]->isSetSendB == false) - { - parH[level]->startB = mm[0]; - parH[level]->isSetSendB = true; - } - } - else if (k == parH[level]->gridNZ + STARTOFFZ - 1) - { - parH[level]->sizePlaneST += 1; - if (parH[level]->isSetSendT == false) - { - parH[level]->startT = mm[0]; - parH[level]->isSetSendT = true; - } - } - else if (k == parH[level]->gridNZ + STARTOFFZ) - { - parH[level]->sizePlaneRB += 1; - if (parH[level]->isSetRecvB == false) - { - parH[level]->endB = mm[0]; - parH[level]->isSetRecvB = true; - } - } - else if (k == STARTOFFZ-1) - { - parH[level]->sizePlaneRT += 1; - if (parH[level]->isSetRecvT == false) - { - parH[level]->endT = mm[0]; - parH[level]->isSetRecvT = true; - } - } - ////////////////////////////////////////////////////////////////////////// - parH[level]->k[mm[0]] = parH[level]->size_Mat_SP; - parH[level]->size_Mat_SP = parH[level]->size_Mat_SP + 1; - parD[level]->size_Mat_SP = parD[level]->size_Mat_SP + 1; - } - else parH[level]->k[mm[0]] = 0; - } - } - } - parH[level]->mem_size_real_SP = sizeof(real ) * parH[level]->size_Mat_SP; - parH[level]->mem_size_int_SP = sizeof(unsigned int) * parH[level]->size_Mat_SP; - parD[level]->mem_size_real_SP = sizeof(real ) * parD[level]->size_Mat_SP; - parD[level]->mem_size_int_SP = sizeof(unsigned int) * parD[level]->size_Mat_SP; -} -void Parameter::fillSparse(int level) -{ - //nsigned int li = ((parH[level]->gridNX+STARTOFFX-2)-(STARTOFFX+1)-1); - //unsigned int lj = ((parH[level]->gridNY+STARTOFFY-2)-(STARTOFFY+1)-1); - // real globalX, globalY, globalZ; - - real PI = 3.141592653589793238462643383279f; - - for (unsigned int k=1; k<parH[level]->gridNZ + 2 * STARTOFFZ - 1; k++) - { - for (unsigned int j=1; j<parH[level]->gridNY + 2 * STARTOFFY - 1; j++) - { - for (unsigned int i=1; i<parH[level]->gridNX + 2 * STARTOFFX - 1; i++) - { - int m = parH[level]->nx*(parH[level]->ny*k + j) + i; - if ((k < parH[level]->gridNZ + 2 * STARTOFFZ - 2) && (j < parH[level]->gridNY + 2 * STARTOFFY - 2) && (i < parH[level]->gridNX + 2 * STARTOFFX - 2)) - { - if ((X1PERIODIC == true) && (level==coarse) && (i==parH[level]->gridNX + STARTOFFX - 1)) - { - int mm = parH[level]->nx*(parH[level]->ny*k + j) + STARTOFFX; - parH[level]->neighborX_SP[parH[level]->k[m]] = parH[level]->k[mm]; - } - else - { - parH[level]->neighborX_SP[parH[level]->k[m]] = parH[level]->k[m+1]; - } - if ((X2PERIODIC == true) && (level==coarse) && (j==parH[level]->gridNY + STARTOFFY - 1)) - { - int mm = parH[level]->nx*(parH[level]->ny*k + STARTOFFY) + i; - parH[level]->neighborY_SP[parH[level]->k[m]] = parH[level]->k[mm]; - } - else - { - parH[level]->neighborY_SP[parH[level]->k[m]] = parH[level]->k[m+parH[level]->nx]; - } - if ((X3PERIODIC == true) && (level==coarse) && (k==parH[level]->gridNZ + STARTOFFZ - 1)) - { - int mm = parH[level]->nx*(parH[level]->ny*STARTOFFZ + j) + i; - parH[level]->neighborZ_SP[parH[level]->k[m]] = parH[level]->k[mm]; - } - else - { - parH[level]->neighborZ_SP[parH[level]->k[m]] = parH[level]->k[m+(parH[level]->nx*parH[level]->ny)]; - } - } - parH[level]->geoSP[parH[level]->k[m]] = parH[level]->geo[m]; - //////////////////////////////////////////////////////////////////////////// - ////Coordinates - //parH[level]->coordX_SP[parH[level]->k[m]] = i; - //parH[level]->coordY_SP[parH[level]->k[m]] = j; - //parH[level]->coordZ_SP[parH[level]->k[m]] = k; - //////////////////////////////////////////////////////////////////////////// - if (diffOn==true) - { - parH[level]->Conc[parH[level]->k[m]] = parH[level]->Conc_Full[m]; - } - //////////////////////////////////////////////////////////////////////////// - ////set pressure in the middle of the fine grid - //if (level == getFine()) - //{ - // if( i == parH[level]->gridNX/2 + STARTOFFX - // && j == parH[level]->gridNY/2 + STARTOFFY - // && k == parH[level]->gridNZ/2 + STARTOFFZ) - // parH[level]->rho_SP[parH[level]->k[m]] = (real)0.1f; - // else - // parH[level]->rho_SP[parH[level]->k[m]] = (real)0.0f; - //} - //else - //{ - // parH[level]->rho_SP[parH[level]->k[m]] = (real)0.0f; - //} - // globalX = TrafoXtoWorld(i,level); - // globalY = TrafoYtoWorld(j,level); - // globalZ = TrafoZtoWorld(k,level); - //without setting a pressure - parH[level]->rho_SP[parH[level]->k[m]] = (real)0.0f; //parH[level]->Conc_Full[m];//bitte schnell wieder entfernen!!! - ////////////////////////////////////////////////////////////////////////// - parH[level]->vx_SP[parH[level]->k[m]] = (real)0.0f; - //parH[level]->vx_SP[parH[level]->k[m]] = u0/3.0; - parH[level]->vy_SP[parH[level]->k[m]] = (real)0.0f; - //parH[level]->vy_SP[parH[level]->k[m]] = u0/3.0; - parH[level]->vz_SP[parH[level]->k[m]] = (real)0.0f; - //parH[level]->vz_SP[parH[level]->k[m]] = u0/3.0; - //parH[level]->vz_SP[parH[level]->k[m]] = (real)(u0*2.f)*((-4.f*globalX*globalX + parH[level]->gridNX*(-2.f - 4.f*STARTOFFX) - 4.f*(-1.5f + STARTOFFX)*(0.5f + STARTOFFX) + globalX*(-4.f + 4.f*parH[level]->gridNX + 8.f*STARTOFFX))*(-4.f*globalY*globalY + parH[level]->gridNY*(-2.f - 4.f*STARTOFFY) - 4.f*(-1.5f + STARTOFFY)*(0.5f + STARTOFFY) + globalY*(-4.f + 4.f*parH[level]->gridNY + 8.f*STARTOFFY)))/((2.f - parH[level]->gridNX)*(2.f - parH[level]->gridNX)*(2.f - parH[level]->gridNY)*(2.f - parH[level]->gridNY)); - //parH[level]->vz_SP[parH[level]->k[m]] = (real)(u0*2.f)*((-4.f*i*i + parH[level]->gridNX*(-2.f - 4.f*STARTOFFX) - 4.f*(-1.5f + STARTOFFX)*(0.5f + STARTOFFX) + i*(-4.f + 4.f*parH[level]->gridNX + 8.f*STARTOFFX))*(-4.f*j*j + parH[level]->gridNY*(-2.f - 4.f*STARTOFFY) - 4.f*(-1.5f + STARTOFFY)*(0.5f + STARTOFFY) + j*(-4.f + 4.f*parH[level]->gridNY + 8.f*STARTOFFY)))/((2.f - parH[level]->gridNX)*(2.f - parH[level]->gridNX)*(2.f - parH[level]->gridNY)*(2.f - parH[level]->gridNY)); - //parH[level]->vz_SP[parH[level]->k[m]] = (real)(16.f*(u0*2.f)*(i-(STARTOFFX+1)-0.5f)*(li-1.5f-(i-(STARTOFFX+1)))*(j-(STARTOFFY+1)-0.5f)*(lj-1.5f-(j-(STARTOFFY+1))))/(li*lj*li*lj);//(16.f*(u0*2.f)*i*j*(parH[level]->nx-i)*(parH[level]->ny-j))/(parH[level]->nx*parH[level]->nx*parH[level]->ny*parH[level]->ny); //u0; - ////////////////////////////////////////////////////////////////////////// - ////gerade - //parH[level]->vx_SP[parH[level]->k[m]] = (real)((32. * 32. * 3.) / (1000.*(real)parH[level]->gridNX));//(real)parH[level]->gridNX / (real)1000 * 3.0; - //parH[level]->vy_SP[parH[level]->k[m]] = (real)((getVelocity() * sin(2.0 * i / parH[level]->gridNX * PI) * cos(2.0 * k / parH[level]->gridNZ * PI)) * (32. / (real)parH[level]->gridNX)); - //parH[level]->vz_SP[parH[level]->k[m]] = (real)0.0f; - //schraeg x - // parH[level]->vx_SP[parH[level]->k[m]] = (real)((32. * 32. * 3.)/(1000.*(real)parH[level]->gridNX) + (getVelocity() * cos((2.0 * k / parH[level]->gridNZ * PI) + (2.0 * i / parH[level]->gridNX * PI)))); - // parH[level]->vy_SP[parH[level]->k[m]] = (real)0.0; - // parH[level]->vz_SP[parH[level]->k[m]] = (real)(getVelocity() * cos((2.0 * k / parH[level]->gridNZ * PI) + (2.0 * i / parH[level]->gridNX * PI))); - //schraeg z - //parH[level]->vx_SP[parH[level]->k[m]] = (real)(getVelocity() * std::cos((2.0 * k / parH[level]->gridNZ * PI) + (2.0 * i / parH[level]->gridNX * PI))); - //parH[level]->vy_SP[parH[level]->k[m]] = (real)0.0; - //parH[level]->vz_SP[parH[level]->k[m]] = (real)((32. * 32. * 3.)/(1000.*(real)parH[level]->gridNZ) + (getVelocity() * std::cos((2.0 * k / parH[level]->gridNZ * PI) + (2.0 * i / parH[level]->gridNX * PI)))); - - //Taylor Green Vortex uniform - parH[level]->rho_SP[parH[level]->k[m]] = (real)((getVelocity()*getVelocity())*3.0/4.0*(cos((i)*4.0*PI/(real)parH[level]->gridNX)+cos((k)*4.0*PI/(real)parH[level]->gridNZ)))*(real)(parH[level]->gridNZ)/(real)(parH[level]->gridNX); - //inkl. ueberlagerter Geschwindigkeit - // parH[level]->vx_SP[parH[level]->k[m]] = (real)((32. * 32. * 3.)/(1000.*(real)parH[level]->gridNX) + getVelocity()*sin(((i)*2.0*PI/(real)parH[level]->gridNX))*cos((k)*2.0*PI/(real)parH[level]->gridNZ)); - parH[level]->vx_SP[parH[level]->k[m]] = (real)((32. * 32. * 3.)/(1000. * 32.) * getVelocity() / 0.001 + getVelocity()*sin(((i)*2.0*PI/(real)parH[level]->gridNX))*cos((k)*2.0*PI/(real)parH[level]->gridNZ)); - //ohne ueberlagerter Geschwindigkeit - // parH[level]->vx_SP[parH[level]->k[m]] = (real)(getVelocity()*sin(((i)*2.0*PI/(real)parH[level]->gridNX))*cos((k)*2.0*PI/(real)parH[level]->gridNZ)); - parH[level]->vy_SP[parH[level]->k[m]] = (real)0.0; - parH[level]->vz_SP[parH[level]->k[m]] = (real)(-getVelocity()*cos(((i)*2.0*PI/(real)parH[level]->gridNX))*sin((k)*2.0*PI/(real)parH[level]->gridNZ))*(real)(parH[level]->gridNZ)/(real)(parH[level]->gridNX); - - //Kernel Fix Test - //parH[level]->vx_SP[parH[level]->k[m]] = (real)((32. * 32. * 3.)/(1000.*(real)parH[level]->gridNX) + (getVelocity() * std::cos((2.0 * k / parH[level]->gridNZ * PI) + (2.0 * i / parH[level]->gridNX * PI)))); - //parH[level]->vy_SP[parH[level]->k[m]] = (real)0.0; - //parH[level]->vz_SP[parH[level]->k[m]] = (real)(getVelocity() * std::cos((2.0 * k / parH[level]->gridNZ * PI) + (2.0 * i / parH[level]->gridNX * PI))); - ////parH[level]->vx_SP[parH[level]->k[m]] = (real)(getVelocity() * std::cos((2.0 * k / parH[level]->gridNZ * PI) + (2.0 * i / parH[level]->gridNX * PI))); - ////parH[level]->vy_SP[parH[level]->k[m]] = (real)0.0; - ////parH[level]->vz_SP[parH[level]->k[m]] = (real)((32. * 32. * 3.)/(1000.*(real)parH[level]->gridNZ) + (getVelocity() * std::cos((2.0 * k / parH[level]->gridNZ * PI) + (2.0 * i / parH[level]->gridNX * PI)))); - ////////////////////////////////////////////////////////////////////////// - //Taylor Green Vortex - //InitglobalX = TrafoXtoMGsWorld(i,level); - //InitglobalY = TrafoYtoMGsWorld(j,level); - //InitglobalZ = TrafoZtoMGsWorld(k,level); - //parH[level]->rho_SP[parH[level]->k[m]] = (real)((u0*u0)*3.f/4.f*(cos((InitglobalX)*4.f*PI/parH[level]->gridNX)+cos((InitglobalY)*4.f*PI/parH[level]->gridNY))); - //parH[level]->vx_SP[parH[level]->k[m]] = (real)( u0*sin(((InitglobalX)*2.f*PI/parH[level]->gridNX))*cos((InitglobalY)*2.f*PI/parH[level]->gridNY)); - //parH[level]->vy_SP[parH[level]->k[m]] = (real)(-u0*cos(((InitglobalX)*2.f*PI/parH[level]->gridNX))*sin((InitglobalY)*2.f*PI/parH[level]->gridNY)); - //parH[level]->vz_SP[parH[level]->k[m]] = (real)0.0f; - ////////////////////////////////////////////////////////////////////////// - } - } - } - parH[level]->neighborX_SP[parH[level]->k[0]] = 0; - parH[level]->neighborY_SP[parH[level]->k[0]] = 0; - parH[level]->neighborZ_SP[parH[level]->k[0]] = 0; - parH[level]->geoSP[ parH[level]->k[0]] = GEO_VOID; - parH[level]->rho_SP[ parH[level]->k[0]] = (real)0.f; - parH[level]->vx_SP[ parH[level]->k[0]] = (real)0.f; - parH[level]->vy_SP[ parH[level]->k[0]] = (real)0.f; - parH[level]->vz_SP[ parH[level]->k[0]] = (real)0.f; - //////////////////////////////////////////////////////////////////////////// - ////Coordinates - //parH[level]->coordX_SP[parH[level]->k[0]] = 0; - //parH[level]->coordY_SP[parH[level]->k[0]] = 0; - //parH[level]->coordZ_SP[parH[level]->k[0]] = 0; - //////////////////////////////////////////////////////////////////////////// -} void Parameter::copyMeasurePointsArrayToVector(int lev) { int valuesPerClockCycle = (int)(getclockCycleForMP()/getTimestepForMP()); @@ -808,12 +574,6 @@ void Parameter::copyMeasurePointsArrayToVector(int lev) } } } -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - - - - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -873,7 +633,7 @@ void Parameter::setD3Qxx(int d3qxx) } void Parameter::setMaxLevel(int maxlevel) { - this->maxlevel = maxlevel-1; + this->maxlevel = maxlevel-1; } void Parameter::setParticleBasicLevel(int pbl) { diff --git a/src/gpu/VirtualFluids_GPU/Parameter/Parameter.h b/src/gpu/VirtualFluids_GPU/Parameter/Parameter.h index e128f47e4..72f11338d 100644 --- a/src/gpu/VirtualFluids_GPU/Parameter/Parameter.h +++ b/src/gpu/VirtualFluids_GPU/Parameter/Parameter.h @@ -756,23 +756,26 @@ public: void setInitialCondition(std::function<void(real, real, real, real &, real &, real &, real &)> initialCondition); std::function<void(real, real, real, real &, real &, real &, real &)> &getInitialCondition(); + std::vector<std::shared_ptr<LBMSimulationParameter>> parH; + std::vector<std::shared_ptr<LBMSimulationParameter>> parD; private: void readConfigData(const vf::basics::ConfigurationFile &configData); void initLBMSimulationParameter(); bool compOn; - bool diffOn{ false }; + bool diffOn { false }; bool isF3; - bool calcDragLift{ false }; - bool calcCp{ false }; - bool writeVeloASCII{ false }; - bool calcPlaneConc{ false }; + bool calcDragLift { false }; + bool calcCp { false }; + bool writeVeloASCII { false }; + bool calcPlaneConc { false }; bool isBodyForce; - int diffMod{ 27 }; - int maxlevel{ 0 }; - int coarse, fine; + int diffMod {27}; + int maxlevel {0}; + int coarse {0}; + int fine {0}; int factor_gridNZ {2}; - int D3Qxx{ 27 }; + int D3Qxx {27}; InitCondition ic; double memsizeGPU; unsigned int limitOfNodesForVTK; @@ -815,8 +818,6 @@ private: // Step of Ensight writing// unsigned int stepEnsight; - std::vector<std::shared_ptr<LBMSimulationParameter>> parH; - std::vector<std::shared_ptr<LBMSimulationParameter>> parD; // LogWriter output; void initInterfaceParameter(int level); diff --git a/src/gpu/VirtualFluids_GPU/Parameter/ParameterTest.cpp b/src/gpu/VirtualFluids_GPU/Parameter/ParameterTest.cpp index b38b5ca2e..da7844839 100644 --- a/src/gpu/VirtualFluids_GPU/Parameter/ParameterTest.cpp +++ b/src/gpu/VirtualFluids_GPU/Parameter/ParameterTest.cpp @@ -145,6 +145,12 @@ TEST(ParameterTest, check_all_Parameter_CanBePassedToConstructor) for (size_t i = 0; i < kernel.size(); ++i) { EXPECT_THAT(kernel_actual[i], testing::Eq(kernel[i])); } + + + EXPECT_THAT(para.getCoarse(), testing::Eq(0)); + EXPECT_THAT(para.getFine(), testing::Eq(1)); // NOGL - 1 + EXPECT_THAT(para.parH.size(), testing::Eq(2)); + EXPECT_THAT(para.parD.size(), testing::Eq(2)); } diff --git a/src/gpu/VirtualFluids_GPU/Utilities/EnumMapper/EnumMapperImp.h b/src/gpu/VirtualFluids_GPU/Utilities/EnumMapper/EnumMapperImp.h deleted file mode 100644 index 6e7238a0a..000000000 --- a/src/gpu/VirtualFluids_GPU/Utilities/EnumMapper/EnumMapperImp.h +++ /dev/null @@ -1,52 +0,0 @@ -#ifndef ENUM_MAPPER_IMP_H -#define ENUM_MAPPER_IMP_H - -#include <map> -#include <string> -#include <stdexcept> - -template <typename T> -class EnumMapperImp -{ -public: - std::string getString(T enumeration); - T getEnum(std::string name); - void addEnum(T enumeration, std::string name); - -private: - std::map< T, std::string> enumMap; - std::map< std::string, T> stringMap; - -}; -#endif - -template<typename T> -inline std::string EnumMapperImp<T>::getString(T enumeration) -{ - typename std::map< T, std::string>::iterator it; - it = enumMap.find(enumeration); - if (it == enumMap.end()) { - throw std::runtime_error("Enumeration is not registered."); - } - else - return it->second; -} - -template<typename T> -inline T EnumMapperImp<T>::getEnum(std::string name) -{ - typename std::map< std::string, T>::iterator it; - it = stringMap.find(name); - if (it == stringMap.end()) { - throw std::runtime_error("String is not registered."); - } - else - return it->second; -} - -template<typename T> -inline void EnumMapperImp<T>::addEnum(T enumeration, std::string name) -{ - enumMap.insert(std::pair< T, std::string>(enumeration, name)); - stringMap.insert(std::pair< std::string, T>(name, enumeration)); -} -- GitLab