From 557114e22224ef3f8d6b02e7a8e9ecd2fe101e92 Mon Sep 17 00:00:00 2001 From: Anna Wellmann <a.wellmann@tu-bs.de> Date: Mon, 30 May 2022 14:59:53 +0000 Subject: [PATCH] Pass a bool to setUseStreams() automatically set para->useStreams to false for single gpu --- .../DrivenCavityMultiGPU.cpp | 2 +- apps/gpu/LBM/MusselOyster/MusselOyster.cpp | 5 +- apps/gpu/LBM/SphereScaling/SphereScaling.cpp | 4 +- .../VirtualFluids_GPU/Parameter/Parameter.cpp | 2894 +++++------------ .../VirtualFluids_GPU/Parameter/Parameter.h | 8 +- 5 files changed, 861 insertions(+), 2052 deletions(-) diff --git a/apps/gpu/LBM/DrivenCavityMultiGPU/DrivenCavityMultiGPU.cpp b/apps/gpu/LBM/DrivenCavityMultiGPU/DrivenCavityMultiGPU.cpp index 17708541a..c82519150 100644 --- a/apps/gpu/LBM/DrivenCavityMultiGPU/DrivenCavityMultiGPU.cpp +++ b/apps/gpu/LBM/DrivenCavityMultiGPU/DrivenCavityMultiGPU.cpp @@ -110,7 +110,7 @@ void multipleLevel(const std::string& configPath) bool useGridGenerator = true; bool useLevels = true; - // para->setUseStreams(); // set in config + // para->setUseStreams(useStreams); // set in config // para->useReducedCommunicationAfterFtoC = true; // set in config para->setCalcTurbulenceIntensity(false); diff --git a/apps/gpu/LBM/MusselOyster/MusselOyster.cpp b/apps/gpu/LBM/MusselOyster/MusselOyster.cpp index 5327147f3..d26f63959 100644 --- a/apps/gpu/LBM/MusselOyster/MusselOyster.cpp +++ b/apps/gpu/LBM/MusselOyster/MusselOyster.cpp @@ -128,7 +128,6 @@ void multipleLevel(const std::string& configPath) para->setCalcTurbulenceIntensity(true); if (para->getNumprocs() == 1) { - useStreams = false; para->useReducedCommunicationAfterFtoC = false; } @@ -192,8 +191,8 @@ void multipleLevel(const std::string& configPath) para->setMaxLevel(1); - if (useStreams) - para->setUseStreams(); + + para->setUseStreams(useStreams); // para->setMainKernel("CumulantK17CompChim"); para->setMainKernel("CumulantK17CompChimStream"); *logging::out << logging::Logger::INFO_HIGH << "Kernel: " << para->getMainKernel() << "\n"; diff --git a/apps/gpu/LBM/SphereScaling/SphereScaling.cpp b/apps/gpu/LBM/SphereScaling/SphereScaling.cpp index bfaf742b2..7b872e7bf 100644 --- a/apps/gpu/LBM/SphereScaling/SphereScaling.cpp +++ b/apps/gpu/LBM/SphereScaling/SphereScaling.cpp @@ -126,7 +126,6 @@ void multipleLevel(const std::string& configPath) bool useStreams = para->getUseStreams(); if (para->getNumprocs() == 1) { - useStreams = false; para->useReducedCommunicationAfterFtoC = false; } if (scalingType != "weak" && scalingType != "strong") @@ -175,8 +174,7 @@ void multipleLevel(const std::string& configPath) para->setMaxLevel(1); - if (useStreams) - para->setUseStreams(); + para->setUseStreams(useStreams); //para->setMainKernel("CumulantK17CompChim"); para->setMainKernel("CumulantK17CompChimStream"); *logging::out << logging::Logger::INFO_HIGH << "Kernel: " << para->getMainKernel() << "\n"; diff --git a/src/gpu/VirtualFluids_GPU/Parameter/Parameter.cpp b/src/gpu/VirtualFluids_GPU/Parameter/Parameter.cpp index ca2481ff9..7019eb6cc 100644 --- a/src/gpu/VirtualFluids_GPU/Parameter/Parameter.cpp +++ b/src/gpu/VirtualFluids_GPU/Parameter/Parameter.cpp @@ -1,28 +1,28 @@ //======================================================================================= -// ____ ____ __ ______ __________ __ __ __ __ -// \ \ | | | | | _ \ |___ ___| | | | | / \ | | -// \ \ | | | | | |_) | | | | | | | / \ | | -// \ \ | | | | | _ / | | | | | | / /\ \ | | -// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ -// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| -// \ \ | | ________________________________________________________________ -// \ \ | | | ______________________________________________________________| -// \ \| | | | __ __ __ __ ______ _______ -// \ | | |_____ | | | | | | | | | _ \ / _____) -// \ | | _____| | | | | | | | | | | \ \ \_______ +// ____ ____ __ ______ __________ __ __ __ __ +// \ \ | | | | | _ \ |___ ___| | | | | / \ | | +// \ \ | | | | | |_) | | | | | | | / \ | | +// \ \ | | | | | _ / | | | | | | / /\ \ | | +// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ +// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| +// \ \ | | ________________________________________________________________ +// \ \ | | | ______________________________________________________________| +// \ \| | | | __ __ __ __ ______ _______ +// \ | | |_____ | | | | | | | | | _ \ / _____) +// \ | | _____| | | | | | | | | | | \ \ \_______ // \ | | | | |_____ | \_/ | | | | |_/ / _____ | -// \ _____| |__| |________| \_______/ |__| |______/ (_______/ +// \ _____| |__| |________| \_______/ |__| |______/ (_______/ // -// This file is part of VirtualFluids. VirtualFluids is free software: you can +// 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 +// 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 +// +// 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/>. // @@ -32,9 +32,9 @@ //======================================================================================= #include "Parameter.h" +#include <math.h> #include <stdio.h> #include <stdlib.h> -#include <math.h> #include <curand_kernel.h> @@ -44,15 +44,13 @@ #include "Parameter/CudaStreamManager.h" - - Parameter::Parameter(const vf::basics::ConfigurationFile &configData, int numberOfProcesses, int myId) { ic.numprocs = numberOfProcesses; - ic.myid = myId; + ic.myid = myId; readConfigData(configData); - //initLBMSimulationParameter(); + // initLBMSimulationParameter(); } Parameter::~Parameter() = default; @@ -154,7 +152,7 @@ void Parameter::readConfigData(const vf::basics::ConfigurationFile &configData) this->setPressOutZ(configData.getValue<int>("PressOutZ")); ////////////////////////////////////////////////////////////////////////// - //second component + // second component if (configData.contains("DiffOn")) this->setDiffOn(configData.getValue<bool>("DiffOn")); ////////////////////////////////////////////////////////////////////////// @@ -201,19 +199,20 @@ void Parameter::readConfigData(const vf::basics::ConfigurationFile &configData) ////////////////////////////////////////////////////////////////////////// // CUDA streams and optimized communication - if(this->getNumprocs() > 1) { + if (this->getNumprocs() > 1) { if (configData.contains("useStreams")) { - if (configData.getValue<bool>("useStreams")) - this->setUseStreams(); + if (configData.getValue<bool>("useStreams")) + this->setUseStreams(true); } - if (configData.contains("useReducedCommunicationInInterpolation")){ - this->useReducedCommunicationAfterFtoC = configData.getValue<bool>("useReducedCommunicationInInterpolation"); + if (configData.contains("useReducedCommunicationInInterpolation")) { + this->useReducedCommunicationAfterFtoC = + configData.getValue<bool>("useReducedCommunicationInInterpolation"); } } ////////////////////////////////////////////////////////////////////////// - //read Geometry (STL) + // read Geometry (STL) if (configData.contains("ReadGeometry")) this->setReadGeo(configData.getValue<bool>("ReadGeometry")); @@ -449,124 +448,117 @@ void Parameter::readConfigData(const vf::basics::ConfigurationFile &configData) void Parameter::initLBMSimulationParameter() { - //host - for (int i = coarse; i <= fine; i++) - { - parH[i] = std::make_shared<LBMSimulationParameter>(); - parH[i]->numberofthreads = 64;// 128; - parH[i]->gridNX = getGridX().at(i); - parH[i]->gridNY = getGridY().at(i); - parH[i]->gridNZ = getGridZ().at(i); - parH[i]->vis = ic.vis*pow(2.f,i); - parH[i]->diffusivity = ic.Diffusivity*pow(2.f,i); - parH[i]->omega = 1.0f/(3.0f*parH[i]->vis+0.5f);//omega :-) not s9 = -1.0f/(3.0f*parH[i]->vis+0.5f);// - parH[i]->nx = parH[i]->gridNX + 2 * STARTOFFX; - parH[i]->ny = parH[i]->gridNY + 2 * STARTOFFY; - parH[i]->nz = parH[i]->gridNZ + 2 * STARTOFFZ; - parH[i]->size_Mat = parH[i]->nx * parH[i]->ny * parH[i]->nz; - parH[i]->sizePlaneXY = parH[i]->nx * parH[i]->ny; - parH[i]->sizePlaneYZ = parH[i]->ny * parH[i]->nz; - parH[i]->sizePlaneXZ = parH[i]->nx * parH[i]->nz; - parH[i]->mem_size_real = sizeof(real ) * parH[i]->size_Mat; - parH[i]->mem_size_int = sizeof(unsigned int) * parH[i]->size_Mat; - parH[i]->mem_size_bool = sizeof(bool ) * parH[i]->size_Mat; - parH[i]->mem_size_real_yz = sizeof(real ) * parH[i]->ny * parH[i]->nz; - parH[i]->evenOrOdd = true; - parH[i]->startz = parH[i]->gridNZ * ic.myid; - parH[i]->endz = parH[i]->gridNZ * ic.myid + parH[i]->gridNZ; - parH[i]->Lx = (real)((1.f*parH[i]->gridNX - 1.f)/(pow(2.f,i))); - parH[i]->Ly = (real)((1.f*parH[i]->gridNY - 1.f)/(pow(2.f,i))); - parH[i]->Lz = (real)((1.f*parH[i]->gridNZ - 1.f)/(pow(2.f,i))); - parH[i]->dx = (real)(1.f/(pow(2.f,i))); - parH[i]->XdistKn = getDistX().at(i); - parH[i]->YdistKn = getDistY().at(i); - parH[i]->ZdistKn = getDistZ().at(i); - if (i == coarse) - { - parH[i]->distX = (real)getDistX().at(i); - parH[i]->distY = (real)getDistY().at(i); - parH[i]->distZ = (real)getDistZ().at(i); - parH[i]->mTtoWx = (real)1.0f; - parH[i]->mTtoWy = (real)1.0f; - parH[i]->mTtoWz = (real)1.0f; - parH[i]->cTtoWx = (real)0.0f; - parH[i]->cTtoWy = (real)0.0f; - parH[i]->cTtoWz = (real)0.0f; + // host + for (int i = coarse; i <= fine; i++) { + parH[i] = std::make_shared<LBMSimulationParameter>(); + parH[i]->numberofthreads = 64; // 128; + parH[i]->gridNX = getGridX().at(i); + parH[i]->gridNY = getGridY().at(i); + parH[i]->gridNZ = getGridZ().at(i); + parH[i]->vis = ic.vis * pow(2.f, i); + parH[i]->diffusivity = ic.Diffusivity * pow(2.f, i); + parH[i]->omega = 1.0f / (3.0f * parH[i]->vis + 0.5f); // omega :-) not s9 = -1.0f/(3.0f*parH[i]->vis+0.5f);// + parH[i]->nx = parH[i]->gridNX + 2 * STARTOFFX; + parH[i]->ny = parH[i]->gridNY + 2 * STARTOFFY; + parH[i]->nz = parH[i]->gridNZ + 2 * STARTOFFZ; + parH[i]->size_Mat = parH[i]->nx * parH[i]->ny * parH[i]->nz; + parH[i]->sizePlaneXY = parH[i]->nx * parH[i]->ny; + parH[i]->sizePlaneYZ = parH[i]->ny * parH[i]->nz; + parH[i]->sizePlaneXZ = parH[i]->nx * parH[i]->nz; + parH[i]->mem_size_real = sizeof(real) * parH[i]->size_Mat; + parH[i]->mem_size_int = sizeof(unsigned int) * parH[i]->size_Mat; + parH[i]->mem_size_bool = sizeof(bool) * parH[i]->size_Mat; + parH[i]->mem_size_real_yz = sizeof(real) * parH[i]->ny * parH[i]->nz; + parH[i]->evenOrOdd = true; + parH[i]->startz = parH[i]->gridNZ * ic.myid; + parH[i]->endz = parH[i]->gridNZ * ic.myid + parH[i]->gridNZ; + parH[i]->Lx = (real)((1.f * parH[i]->gridNX - 1.f) / (pow(2.f, i))); + parH[i]->Ly = (real)((1.f * parH[i]->gridNY - 1.f) / (pow(2.f, i))); + parH[i]->Lz = (real)((1.f * parH[i]->gridNZ - 1.f) / (pow(2.f, i))); + parH[i]->dx = (real)(1.f / (pow(2.f, i))); + parH[i]->XdistKn = getDistX().at(i); + parH[i]->YdistKn = getDistY().at(i); + parH[i]->ZdistKn = getDistZ().at(i); + if (i == coarse) { + parH[i]->distX = (real)getDistX().at(i); + parH[i]->distY = (real)getDistY().at(i); + parH[i]->distZ = (real)getDistZ().at(i); + parH[i]->mTtoWx = (real)1.0f; + parH[i]->mTtoWy = (real)1.0f; + parH[i]->mTtoWz = (real)1.0f; + parH[i]->cTtoWx = (real)0.0f; + parH[i]->cTtoWy = (real)0.0f; + parH[i]->cTtoWz = (real)0.0f; ////MGs Trafo/////////////////////////////////////////////////////////////// - //parH[i]->cStartx = (real)parH[i]->XdistKn; - //parH[i]->cStarty = (real)parH[i]->XdistKn; - //parH[i]->cStartz = (real)parH[i]->XdistKn; + // parH[i]->cStartx = (real)parH[i]->XdistKn; + // parH[i]->cStarty = (real)parH[i]->XdistKn; + // parH[i]->cStartz = (real)parH[i]->XdistKn; //////////////////////////////////////////////////////////////////////////// - } - else - { - //Geller - parH[i]->distX = ((real)getDistX().at(i) + 0.25f) * parH[i-1]->dx; - parH[i]->distY = ((real)getDistY().at(i) + 0.25f) * parH[i-1]->dx; - parH[i]->distZ = ((real)getDistZ().at(i) + 0.25f) * parH[i-1]->dx; - //parH[i]->distX = ((real)getDistX().at(i) + 0.25f) * parH[i-1]->dx + parH[i-1]->distX; - //parH[i]->distY = ((real)getDistY().at(i) + 0.25f) * parH[i-1]->dx + parH[i-1]->distY; - //parH[i]->distZ = ((real)getDistZ().at(i) + 0.25f) * parH[i-1]->dx + parH[i-1]->distZ; - parH[i]->mTtoWx = (real)pow(0.5f,i); - parH[i]->mTtoWy = (real)pow(0.5f,i); - parH[i]->mTtoWz = (real)pow(0.5f,i); - parH[i]->cTtoWx = (real)(STARTOFFX/2.f + (parH[i]->gridNX+1.f)/4.f); //funzt nur fuer zwei level - parH[i]->cTtoWy = (real)(STARTOFFY/2.f + (parH[i]->gridNY+1.f)/4.f); //funzt nur fuer zwei level - parH[i]->cTtoWz = (real)(STARTOFFZ/2.f + (parH[i]->gridNZ+1.f)/4.f); //funzt nur fuer zwei level + } else { + // Geller + parH[i]->distX = ((real)getDistX().at(i) + 0.25f) * parH[i - 1]->dx; + parH[i]->distY = ((real)getDistY().at(i) + 0.25f) * parH[i - 1]->dx; + parH[i]->distZ = ((real)getDistZ().at(i) + 0.25f) * parH[i - 1]->dx; + // parH[i]->distX = ((real)getDistX().at(i) + 0.25f) * parH[i-1]->dx + parH[i-1]->distX; + // parH[i]->distY = ((real)getDistY().at(i) + 0.25f) * parH[i-1]->dx + parH[i-1]->distY; + // parH[i]->distZ = ((real)getDistZ().at(i) + 0.25f) * parH[i-1]->dx + parH[i-1]->distZ; + parH[i]->mTtoWx = (real)pow(0.5f, i); + parH[i]->mTtoWy = (real)pow(0.5f, i); + parH[i]->mTtoWz = (real)pow(0.5f, i); + parH[i]->cTtoWx = (real)(STARTOFFX / 2.f + (parH[i]->gridNX + 1.f) / 4.f); // funzt nur fuer zwei level + parH[i]->cTtoWy = (real)(STARTOFFY / 2.f + (parH[i]->gridNY + 1.f) / 4.f); // funzt nur fuer zwei level + parH[i]->cTtoWz = (real)(STARTOFFZ / 2.f + (parH[i]->gridNZ + 1.f) / 4.f); // funzt nur fuer zwei level ////MGs Trafo/////////////////////////////////////////////////////////////// - //parH[i]->cStartx = (real)parH[i]->XdistKn; - //parH[i]->cStarty = (real)parH[i]->XdistKn; - //parH[i]->cStartz = (real)parH[i]->XdistKn; + // parH[i]->cStartx = (real)parH[i]->XdistKn; + // parH[i]->cStarty = (real)parH[i]->XdistKn; + // parH[i]->cStartz = (real)parH[i]->XdistKn; //////////////////////////////////////////////////////////////////////////// } } - //device - for (int i = coarse; i <= fine; i++) - { - parD[i] = std::make_shared<LBMSimulationParameter>(); - parD[i]->numberofthreads = parH[i]->numberofthreads; - parD[i]->gridNX = parH[i]->gridNX; - parD[i]->gridNY = parH[i]->gridNY; - parD[i]->gridNZ = parH[i]->gridNZ; - parD[i]->vis = parH[i]->vis; - parD[i]->diffusivity = parH[i]->diffusivity; - parD[i]->omega = parH[i]->omega; - parD[i]->nx = parH[i]->nx; - parD[i]->ny = parH[i]->ny; - parD[i]->nz = parH[i]->nz; - parD[i]->size_Mat = parH[i]->size_Mat; - parD[i]->sizePlaneXY = parH[i]->sizePlaneXY; - parD[i]->sizePlaneYZ = parH[i]->sizePlaneYZ; - parD[i]->sizePlaneXZ = parH[i]->sizePlaneXZ; - parD[i]->mem_size_real = sizeof(real ) * parD[i]->size_Mat; - parD[i]->mem_size_int = sizeof(unsigned int) * parD[i]->size_Mat; - parD[i]->mem_size_bool = sizeof(bool ) * parD[i]->size_Mat; - parD[i]->mem_size_real_yz = sizeof(real ) * parD[i]->ny * parD[i]->nz; - parD[i]->evenOrOdd = parH[i]->evenOrOdd; - parD[i]->startz = parH[i]->startz; - parD[i]->endz = parH[i]->endz; - parD[i]->Lx = parH[i]->Lx; - parD[i]->Ly = parH[i]->Ly; - parD[i]->Lz = parH[i]->Lz; - parD[i]->dx = parH[i]->dx; - parD[i]->XdistKn = parH[i]->XdistKn; - parD[i]->YdistKn = parH[i]->YdistKn; - parD[i]->ZdistKn = parH[i]->ZdistKn; - parD[i]->distX = parH[i]->distX; - parD[i]->distY = parH[i]->distY; - parD[i]->distZ = parH[i]->distZ; + // device + for (int i = coarse; i <= fine; i++) { + parD[i] = std::make_shared<LBMSimulationParameter>(); + parD[i]->numberofthreads = parH[i]->numberofthreads; + parD[i]->gridNX = parH[i]->gridNX; + parD[i]->gridNY = parH[i]->gridNY; + parD[i]->gridNZ = parH[i]->gridNZ; + parD[i]->vis = parH[i]->vis; + parD[i]->diffusivity = parH[i]->diffusivity; + parD[i]->omega = parH[i]->omega; + parD[i]->nx = parH[i]->nx; + parD[i]->ny = parH[i]->ny; + parD[i]->nz = parH[i]->nz; + parD[i]->size_Mat = parH[i]->size_Mat; + parD[i]->sizePlaneXY = parH[i]->sizePlaneXY; + parD[i]->sizePlaneYZ = parH[i]->sizePlaneYZ; + parD[i]->sizePlaneXZ = parH[i]->sizePlaneXZ; + parD[i]->mem_size_real = sizeof(real) * parD[i]->size_Mat; + parD[i]->mem_size_int = sizeof(unsigned int) * parD[i]->size_Mat; + parD[i]->mem_size_bool = sizeof(bool) * parD[i]->size_Mat; + parD[i]->mem_size_real_yz = sizeof(real) * parD[i]->ny * parD[i]->nz; + parD[i]->evenOrOdd = parH[i]->evenOrOdd; + parD[i]->startz = parH[i]->startz; + parD[i]->endz = parH[i]->endz; + parD[i]->Lx = parH[i]->Lx; + parD[i]->Ly = parH[i]->Ly; + parD[i]->Lz = parH[i]->Lz; + parD[i]->dx = parH[i]->dx; + parD[i]->XdistKn = parH[i]->XdistKn; + parD[i]->YdistKn = parH[i]->YdistKn; + parD[i]->ZdistKn = parH[i]->ZdistKn; + parD[i]->distX = parH[i]->distX; + parD[i]->distY = parH[i]->distY; + parD[i]->distZ = parH[i]->distZ; } } void Parameter::copyMeasurePointsArrayToVector(int lev) { - int valuesPerClockCycle = (int)(getclockCycleForMP()/getTimestepForMP()); - for(int i = 0; i < (int)parH[lev]->MP.size(); i++) - { - for(int j = 0; j < valuesPerClockCycle; j++) - { - int index = i*valuesPerClockCycle+j; + int valuesPerClockCycle = (int)(getclockCycleForMP() / getTimestepForMP()); + for (int i = 0; i < (int)parH[lev]->MP.size(); i++) { + for (int j = 0; j < valuesPerClockCycle; j++) { + int index = i * valuesPerClockCycle + j; parH[lev]->MP[i].Vx.push_back(parH[lev]->VxMP[index]); parH[lev]->MP[i].Vy.push_back(parH[lev]->VyMP[index]); parH[lev]->MP[i].Vz.push_back(parH[lev]->VzMP[index]); @@ -575,9 +567,8 @@ void Parameter::copyMeasurePointsArrayToVector(int lev) } } - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -//set-methods +// set-methods //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// void Parameter::setForcing(real forcingX, real forcingY, real forcingZ) { @@ -591,1982 +582,805 @@ void Parameter::setQuadricLimiters(real quadricLimiterP, real quadricLimiterM, r this->hostQuadricLimiters[1] = quadricLimiterM; this->hostQuadricLimiters[2] = quadricLimiterD; } -void Parameter::setPhi(real inPhi) -{ - Phi = inPhi; -} -void Parameter::setAngularVelocity(real inAngVel) -{ - angularVelocity = inAngVel; -} -void Parameter::setStepEnsight(unsigned int step) -{ - this->stepEnsight = step; -} -void Parameter::setOutputCount(unsigned int outputCount) -{ - this->outputCount = outputCount; -} +void Parameter::setPhi(real inPhi) { Phi = inPhi; } +void Parameter::setAngularVelocity(real inAngVel) { angularVelocity = inAngVel; } +void Parameter::setStepEnsight(unsigned int step) { this->stepEnsight = step; } +void Parameter::setOutputCount(unsigned int outputCount) { this->outputCount = outputCount; } void Parameter::setlimitOfNodesForVTK(unsigned int limitOfNodesForVTK) { this->limitOfNodesForVTK = limitOfNodesForVTK; } -void Parameter::setStartTurn(unsigned int inStartTurn) -{ - startTurn = inStartTurn; -} -void Parameter::setDiffOn(bool isDiff) -{ - diffOn = isDiff; -} -void Parameter::setCompOn(bool isComp) -{ - compOn = isComp; -} -void Parameter::setDiffMod(int DiffMod) -{ - diffMod = DiffMod; -} -void Parameter::setD3Qxx(int d3qxx) -{ - this->D3Qxx = d3qxx; -} +void Parameter::setStartTurn(unsigned int inStartTurn) { startTurn = inStartTurn; } +void Parameter::setDiffOn(bool isDiff) { diffOn = isDiff; } +void Parameter::setCompOn(bool isComp) { compOn = isComp; } +void Parameter::setDiffMod(int DiffMod) { diffMod = DiffMod; } +void Parameter::setD3Qxx(int d3qxx) { this->D3Qxx = d3qxx; } void Parameter::setMaxLevel(int maxlevel) { - this->maxlevel = maxlevel-1; + this->maxlevel = maxlevel - 1; this->fine = this->maxlevel; parH.resize(this->maxlevel + 1); parD.resize(this->maxlevel + 1); } -void Parameter::setParticleBasicLevel(int pbl) -{ - this->particleBasicLevel = pbl; -} -void Parameter::setParticleInitLevel(int pil) +void Parameter::setParticleBasicLevel(int pbl) { this->particleBasicLevel = pbl; } +void Parameter::setParticleInitLevel(int pil) { this->particleInitLevel = pil; } +void Parameter::setNumberOfParticles(int nop) { this->numberOfParticles = nop; } +void Parameter::setCalcParticles(bool calcParticles) { this->calcParticles = calcParticles; } +void Parameter::setStartXHotWall(real startXHotWall) { this->startXHotWall = startXHotWall; } +void Parameter::setEndXHotWall(real endXHotWall) { this->endXHotWall = endXHotWall; } +void Parameter::setTEnd(unsigned int tend) { ic.tend = tend; } +void Parameter::setTOut(unsigned int tout) { ic.tout = tout; } +void Parameter::setTStartOut(unsigned int tStartOut) { ic.tStartOut = tStartOut; } +void Parameter::setTimestepOfCoarseLevel(unsigned int timestep) { this->timestep = timestep; } +void Parameter::setCalcTurbulenceIntensity(bool calcVelocityAndFluctuations) { - this->particleInitLevel = pil; + this->calcVelocityAndFluctuations = calcVelocityAndFluctuations; } -void Parameter::setNumberOfParticles(int nop) +void Parameter::setCalcMedian(bool calcMedian) { ic.calcMedian = calcMedian; } +void Parameter::setCalcDragLift(bool calcDragLift) { this->calcDragLift = calcDragLift; } +void Parameter::setCalcCp(bool calcCp) { this->calcCp = calcCp; } +void Parameter::setWriteVeloASCIIfiles(bool writeVeloASCII) { this->writeVeloASCII = writeVeloASCII; } +void Parameter::setCalcPlaneConc(bool calcPlaneConc) { this->calcPlaneConc = calcPlaneConc; } +void Parameter::setTimeCalcMedStart(int CalcMedStart) { ic.tCalcMedStart = CalcMedStart; } +void Parameter::setTimeCalcMedEnd(int CalcMedEnd) { ic.tCalcMedEnd = CalcMedEnd; } +void Parameter::setOutputPath(std::string oPath) { ic.oPath = oPath; } +void Parameter::setOutputPrefix(std::string oPrefix) { - this->numberOfParticles = nop; + // std::string test = fname; + ic.oPrefix = oPrefix; } -void Parameter::setCalcParticles(bool calcParticles) +void Parameter::setFName(std::string fname) { - this->calcParticles = calcParticles; + // std::string test = fname; + ic.fname = fname; } -void Parameter::setStartXHotWall(real startXHotWall) +void Parameter::setPrintFiles(bool printfiles) { ic.printFiles = printfiles; } +void Parameter::setReadGeo(bool readGeo) { ic.readGeo = readGeo; } +void Parameter::setDiffusivity(real Diffusivity) { ic.Diffusivity = Diffusivity; } +void Parameter::setTemperatureInit(real Temp) { ic.Temp = Temp; } +void Parameter::setTemperatureBC(real TempBC) { ic.TempBC = TempBC; } +void Parameter::setViscosity(real Viscosity) { ic.vis = Viscosity; } +void Parameter::setVelocity(real Velocity) { ic.u0 = Velocity; } +void Parameter::setViscosityRatio(real ViscosityRatio) { ic.vis_ratio = ViscosityRatio; } +void Parameter::setVelocityRatio(real VelocityRatio) { ic.u0_ratio = VelocityRatio; } +void Parameter::setDensityRatio(real DensityRatio) { ic.delta_rho = DensityRatio; } +void Parameter::setPressRatio(real PressRatio) { ic.delta_press = PressRatio; } +void Parameter::setRealX(real RealX) { ic.RealX = RealX; } +void Parameter::setRealY(real RealY) { ic.RealY = RealY; } +void Parameter::setPressInID(unsigned int PressInID) { ic.PressInID = PressInID; } +void Parameter::setPressOutID(unsigned int PressOutID) { ic.PressOutID = PressOutID; } +void Parameter::setPressInZ(unsigned int PressInZ) { ic.PressInZ = PressInZ; } +void Parameter::setPressOutZ(unsigned int PressOutZ) { ic.PressOutZ = PressOutZ; } +void Parameter::setMaxDev(int maxdev) { ic.maxdev = maxdev; } +void Parameter::setMyID(int myid) { ic.myid = myid; } +void Parameter::setNumprocs(int numprocs) { ic.numprocs = numprocs; } +void Parameter::setDevices(std::vector<uint> devices) { ic.devices = devices; } +void Parameter::setGeometryFileC(std::string GeometryFileC) { ic.geometryFileC = GeometryFileC; } +void Parameter::setGeometryFileM(std::string GeometryFileM) { ic.geometryFileM = GeometryFileM; } +void Parameter::setGeometryFileF(std::string GeometryFileF) { ic.geometryFileF = GeometryFileF; } +void Parameter::setRe(real Re) { ic.Re = Re; } +void Parameter::setFactorPressBC(real factorPressBC) { ic.factorPressBC = factorPressBC; } +void Parameter::setIsGeo(bool isGeo) { ic.isGeo = isGeo; } +void Parameter::setIsGeoNormal(bool isGeoNormal) { ic.isGeoNormal = isGeoNormal; } +void Parameter::setIsInflowNormal(bool isInflowNormal) { ic.isInflowNormal = isInflowNormal; } +void Parameter::setIsOutflowNormal(bool isOutflowNormal) { ic.isOutflowNormal = isOutflowNormal; } +void Parameter::setIsProp(bool isProp) { ic.isProp = isProp; } +void Parameter::setIsCp(bool isCp) { ic.isCp = isCp; } +void Parameter::setConcFile(bool concFile) { ic.isConc = concFile; } +void Parameter::setStreetVelocityFile(bool streetVelocityFile) { ic.streetVelocityFile = streetVelocityFile; } +void Parameter::setUseMeasurePoints(bool useMeasurePoints) { ic.isMeasurePoints = useMeasurePoints; } +void Parameter::setUseWale(bool useWale) { ic.isWale = useWale; } +void Parameter::setUseInitNeq(bool useInitNeq) { ic.isInitNeq = useInitNeq; } +void Parameter::setSimulatePorousMedia(bool simulatePorousMedia) { ic.simulatePorousMedia = simulatePorousMedia; } + +void Parameter::setIsF3(bool isF3) { this->isF3 = isF3; } + +void Parameter::setIsBodyForce(bool isBodyForce) { this->isBodyForce = isBodyForce; } + +void Parameter::setGridX(std::vector<int> GridX) { ic.GridX = GridX; } +void Parameter::setGridY(std::vector<int> GridY) { ic.GridY = GridY; } +void Parameter::setGridZ(std::vector<int> GridZ) { ic.GridZ = GridZ; } +void Parameter::setDistX(std::vector<int> DistX) { ic.DistX = DistX; } +void Parameter::setDistY(std::vector<int> DistY) { ic.DistY = DistY; } +void Parameter::setDistZ(std::vector<int> DistZ) { ic.DistZ = DistZ; } +void Parameter::setScaleLBMtoSI(std::vector<real> scaleLBMtoSI) { ic.scaleLBMtoSI = scaleLBMtoSI; } +void Parameter::setTranslateLBMtoSI(std::vector<real> translateLBMtoSI) { ic.translateLBMtoSI = translateLBMtoSI; } +void Parameter::setMinCoordX(std::vector<real> MinCoordX) { ic.minCoordX = MinCoordX; } +void Parameter::setMinCoordY(std::vector<real> MinCoordY) { ic.minCoordY = MinCoordY; } +void Parameter::setMinCoordZ(std::vector<real> MinCoordZ) { ic.minCoordZ = MinCoordZ; } +void Parameter::setMaxCoordX(std::vector<real> MaxCoordX) { ic.maxCoordX = MaxCoordX; } +void Parameter::setMaxCoordY(std::vector<real> MaxCoordY) { ic.maxCoordY = MaxCoordY; } +void Parameter::setMaxCoordZ(std::vector<real> MaxCoordZ) { ic.maxCoordZ = MaxCoordZ; } +void Parameter::setTempH(TempforBoundaryConditions *TempH) { this->TempH = TempH; } +void Parameter::setTempD(TempforBoundaryConditions *TempD) { this->TempD = TempD; } +void Parameter::setTempVelH(TempVelforBoundaryConditions *TempVelH) { this->TempVelH = TempVelH; } +void Parameter::setTempVelD(TempVelforBoundaryConditions *TempVelD) { this->TempVelD = TempVelD; } +void Parameter::setTempPressH(TempPressforBoundaryConditions *TempPressH) { this->TempPressH = TempPressH; } +void Parameter::setTempPressD(TempPressforBoundaryConditions *TempPressD) { this->TempPressD = TempPressD; } +// void Parameter::setkInflowQ(unsigned int kInflowQ) +//{ +// this->kInflowQ = kInflowQ; +//} +// void Parameter::setkOutflowQ(unsigned int kOutflowQ) +//{ +// this->kOutflowQ = kOutflowQ; +//} +// void Parameter::setQinflowH(QforBoundaryConditions* QinflowH) +//{ +// this->QinflowH = QinflowH; +//} +// void Parameter::setQinflowD(QforBoundaryConditions* QinflowD) +//{ +// this->QinflowD = QinflowD; +//} +// void Parameter::setQoutflowH(QforBoundaryConditions* QoutflowH) +//{ +// this->QoutflowH = QoutflowH; +//} +// void Parameter::setQoutflowD(QforBoundaryConditions* QoutflowD) +//{ +// this->QoutflowD = QoutflowD; +//} +void Parameter::setkFull(std::string kFull) { ic.kFull = kFull; } +void Parameter::setgeoFull(std::string geoFull) { ic.geoFull = geoFull; } +void Parameter::setgeoVec(std::string geoVec) { ic.geoVec = geoVec; } +void Parameter::setcoordX(std::string coordX) { ic.coordX = coordX; } +void Parameter::setcoordY(std::string coordY) { ic.coordY = coordY; } +void Parameter::setcoordZ(std::string coordZ) { ic.coordZ = coordZ; } +void Parameter::setneighborX(std::string neighborX) { ic.neighborX = neighborX; } +void Parameter::setneighborY(std::string neighborY) { ic.neighborY = neighborY; } +void Parameter::setneighborZ(std::string neighborZ) { ic.neighborZ = neighborZ; } +void Parameter::setneighborWSB(std::string neighborWSB) { ic.neighborWSB = neighborWSB; } +void Parameter::setscaleCFC(std::string scaleCFC) { ic.scaleCFC = scaleCFC; } +void Parameter::setscaleCFF(std::string scaleCFF) { ic.scaleCFF = scaleCFF; } +void Parameter::setscaleFCC(std::string scaleFCC) { ic.scaleFCC = scaleFCC; } +void Parameter::setscaleFCF(std::string scaleFCF) { ic.scaleFCF = scaleFCF; } +void Parameter::setscaleOffsetCF(std::string scaleOffsetCF) { ic.scaleOffsetCF = scaleOffsetCF; } +void Parameter::setscaleOffsetFC(std::string scaleOffsetFC) { ic.scaleOffsetFC = scaleOffsetFC; } +void Parameter::setgeomBoundaryBcQs(std::string geomBoundaryBcQs) { ic.geomBoundaryBcQs = geomBoundaryBcQs; } +void Parameter::setgeomBoundaryBcValues(std::string geomBoundaryBcValues) { - this->startXHotWall = startXHotWall; + ic.geomBoundaryBcValues = geomBoundaryBcValues; } -void Parameter::setEndXHotWall(real endXHotWall) +void Parameter::setnoSlipBcPos(std::string noSlipBcPos) { ic.noSlipBcPos = noSlipBcPos; } +void Parameter::setnoSlipBcQs(std::string noSlipBcQs) { ic.noSlipBcQs = noSlipBcQs; } +void Parameter::setnoSlipBcValue(std::string noSlipBcValue) { ic.noSlipBcValue = noSlipBcValue; } +void Parameter::setnoSlipBcValues(std::string noSlipBcValues) { ic.noSlipBcValues = noSlipBcValues; } +void Parameter::setslipBcPos(std::string slipBcPos) { ic.slipBcPos = slipBcPos; } +void Parameter::setslipBcQs(std::string slipBcQs) { ic.slipBcQs = slipBcQs; } +void Parameter::setslipBcValue(std::string slipBcValue) { ic.slipBcValue = slipBcValue; } +void Parameter::setpressBcPos(std::string pressBcPos) { ic.pressBcPos = pressBcPos; } +void Parameter::setpressBcQs(std::string pressBcQs) { ic.pressBcQs = pressBcQs; } +void Parameter::setpressBcValue(std::string pressBcValue) { ic.pressBcValue = pressBcValue; } +void Parameter::setpressBcValues(std::string pressBcValues) { ic.pressBcValues = pressBcValues; } +void Parameter::setvelBcQs(std::string velBcQs) { ic.velBcQs = velBcQs; } +void Parameter::setvelBcValues(std::string velBcValues) { ic.velBcValues = velBcValues; } +void Parameter::setinletBcQs(std::string inletBcQs) { ic.inletBcQs = inletBcQs; } +void Parameter::setinletBcValues(std::string inletBcValues) { ic.inletBcValues = inletBcValues; } +void Parameter::setoutletBcQs(std::string outletBcQs) { ic.outletBcQs = outletBcQs; } +void Parameter::setoutletBcValues(std::string outletBcValues) { ic.outletBcValues = outletBcValues; } +void Parameter::settopBcQs(std::string topBcQs) { ic.topBcQs = topBcQs; } +void Parameter::settopBcValues(std::string topBcValues) { ic.topBcValues = topBcValues; } +void Parameter::setbottomBcQs(std::string bottomBcQs) { ic.bottomBcQs = bottomBcQs; } +void Parameter::setbottomBcValues(std::string bottomBcValues) { ic.bottomBcValues = bottomBcValues; } +void Parameter::setfrontBcQs(std::string frontBcQs) { ic.frontBcQs = frontBcQs; } +void Parameter::setfrontBcValues(std::string frontBcValues) { ic.frontBcValues = frontBcValues; } +void Parameter::setbackBcQs(std::string backBcQs) { ic.backBcQs = backBcQs; } +void Parameter::setbackBcValues(std::string backBcValues) { ic.backBcValues = backBcValues; } +void Parameter::setwallBcQs(std::string wallBcQs) { ic.wallBcQs = wallBcQs; } +void Parameter::setwallBcValues(std::string wallBcValues) { ic.wallBcValues = wallBcValues; } +void Parameter::setperiodicBcQs(std::string periodicBcQs) { ic.periodicBcQs = periodicBcQs; } +void Parameter::setperiodicBcValues(std::string periodicBcValues) { ic.periodicBcValues = periodicBcValues; } +void Parameter::setpropellerQs(std::string propellerQs) { ic.propellerQs = propellerQs; } +void Parameter::setpropellerValues(std::string propellerValues) { ic.propellerValues = propellerValues; } +void Parameter::setpropellerCylinder(std::string propellerCylinder) { ic.propellerCylinder = propellerCylinder; } +void Parameter::setmeasurePoints(std::string measurePoints) { ic.measurePoints = measurePoints; } +void Parameter::setnumberNodes(std::string numberNodes) { ic.numberNodes = numberNodes; } +void Parameter::setLBMvsSI(std::string LBMvsSI) { ic.LBMvsSI = LBMvsSI; } +void Parameter::setcpTop(std::string cpTop) { ic.cpTop = cpTop; } +void Parameter::setcpBottom(std::string cpBottom) { ic.cpBottom = cpBottom; } +void Parameter::setcpBottom2(std::string cpBottom2) { ic.cpBottom2 = cpBottom2; } +void Parameter::setConcentration(std::string concFile) { ic.concentration = concFile; } +void Parameter::setStreetVelocity(std::string streetVelocity) { ic.streetVelocity = streetVelocity; } +void Parameter::setclockCycleForMP(real clockCycleForMP) { ic.clockCycleForMP = clockCycleForMP; } +void Parameter::setTimeDoCheckPoint(unsigned int tDoCheckPoint) { ic.tDoCheckPoint = tDoCheckPoint; } +void Parameter::setTimeDoRestart(unsigned int tDoRestart) { ic.tDoRestart = tDoRestart; } +void Parameter::setDoCheckPoint(bool doCheckPoint) { ic.doCheckPoint = doCheckPoint; } +void Parameter::setDoRestart(bool doRestart) { ic.doRestart = doRestart; } +void Parameter::settimestepForMP(unsigned int timestepForMP) { ic.timeStepForMP = timestepForMP; } +void Parameter::setObj(std::string str, bool isObj) { - this->endXHotWall = endXHotWall; + if (str == "geo") { + this->setIsGeo(isObj); + } else if (str == "prop") { + this->setIsProp(isObj); + } else if (str == "cp") { + this->setIsCp(isObj); + } else if (str == "geoNormal") { + this->setIsGeoNormal(isObj); + } else if (str == "inflowNormal") { + this->setIsInflowNormal(isObj); + } else if (str == "outflowNormal") { + this->setIsOutflowNormal(isObj); + } } -void Parameter::setTEnd(unsigned int tend) +void Parameter::setGeometryValues(bool GeometryValues) { ic.GeometryValues = GeometryValues; } +void Parameter::setCalc2ndOrderMoments(bool is2ndOrderMoments) { ic.is2ndOrderMoments = is2ndOrderMoments; } +void Parameter::setCalc3rdOrderMoments(bool is3rdOrderMoments) { ic.is3rdOrderMoments = is3rdOrderMoments; } +void Parameter::setCalcHighOrderMoments(bool isHighOrderMoments) { ic.isHighOrderMoments = isHighOrderMoments; } +void Parameter::setMemsizeGPU(double admem, bool reset) { - ic.tend = tend; + if (reset == true) { + this->memsizeGPU = 0.; + } else { + this->memsizeGPU += admem; + } } -void Parameter::setTOut(unsigned int tout) +// 1D domain decomposition +void Parameter::setPossNeighborFiles(std::vector<std::string> possNeighborFiles, std::string sor) { - ic.tout = tout; + if (sor == "send") { + this->possNeighborFilesSend = possNeighborFiles; + } else if (sor == "recv") { + this->possNeighborFilesRecv = possNeighborFiles; + } } -void Parameter::setTStartOut(unsigned int tStartOut) +void Parameter::setNumberOfProcessNeighbors(unsigned int numberOfProcessNeighbors, int level, std::string sor) { - ic.tStartOut = tStartOut; + if (sor == "send") { + parH[level]->sendProcessNeighbor.resize(numberOfProcessNeighbors); + parD[level]->sendProcessNeighbor.resize(numberOfProcessNeighbors); + } else if (sor == "recv") { + parH[level]->recvProcessNeighbor.resize(numberOfProcessNeighbors); + parD[level]->recvProcessNeighbor.resize(numberOfProcessNeighbors); + } } -void Parameter::setTimestepOfCoarseLevel(unsigned int timestep) +void Parameter::setIsNeighbor(bool isNeigbor) { this->isNeigbor = isNeigbor; } +// 3D domain decomposition +void Parameter::setPossNeighborFilesX(std::vector<std::string> possNeighborFiles, std::string sor) { - this->timestep = timestep; + if (sor == "send") { + this->possNeighborFilesSendX = possNeighborFiles; + } else if (sor == "recv") { + this->possNeighborFilesRecvX = possNeighborFiles; + } } -void Parameter::setCalcTurbulenceIntensity(bool calcVelocityAndFluctuations) +void Parameter::setPossNeighborFilesY(std::vector<std::string> possNeighborFiles, std::string sor) { - this->calcVelocityAndFluctuations = calcVelocityAndFluctuations; + if (sor == "send") { + this->possNeighborFilesSendY = possNeighborFiles; + } else if (sor == "recv") { + this->possNeighborFilesRecvY = possNeighborFiles; + } } -void Parameter::setCalcMedian(bool calcMedian) +void Parameter::setPossNeighborFilesZ(std::vector<std::string> possNeighborFiles, std::string sor) { - ic.calcMedian = calcMedian; + if (sor == "send") { + this->possNeighborFilesSendZ = possNeighborFiles; + } else if (sor == "recv") { + this->possNeighborFilesRecvZ = possNeighborFiles; + } } -void Parameter::setCalcDragLift(bool calcDragLift) +void Parameter::setNumberOfProcessNeighborsX(unsigned int numberOfProcessNeighbors, int level, std::string sor) { - this->calcDragLift = calcDragLift; + if (sor == "send") { + parH[level]->sendProcessNeighborX.resize(numberOfProcessNeighbors); + parD[level]->sendProcessNeighborX.resize(numberOfProcessNeighbors); + ////////////////////////////////////////////////////////////////////////// + if (getDiffOn() == true) { + parH[level]->sendProcessNeighborADX.resize(numberOfProcessNeighbors); + parD[level]->sendProcessNeighborADX.resize(numberOfProcessNeighbors); + } + ////////////////////////////////////////////////////////////////////////// + } else if (sor == "recv") { + parH[level]->recvProcessNeighborX.resize(numberOfProcessNeighbors); + parD[level]->recvProcessNeighborX.resize(numberOfProcessNeighbors); + ////////////////////////////////////////////////////////////////////////// + if (getDiffOn() == true) { + parH[level]->recvProcessNeighborADX.resize(numberOfProcessNeighbors); + parD[level]->recvProcessNeighborADX.resize(numberOfProcessNeighbors); + } + ////////////////////////////////////////////////////////////////////////// + } } -void Parameter::setCalcCp(bool calcCp) +void Parameter::setNumberOfProcessNeighborsY(unsigned int numberOfProcessNeighbors, int level, std::string sor) { - this->calcCp = calcCp; + if (sor == "send") { + parH[level]->sendProcessNeighborY.resize(numberOfProcessNeighbors); + parD[level]->sendProcessNeighborY.resize(numberOfProcessNeighbors); + ////////////////////////////////////////////////////////////////////////// + if (getDiffOn() == true) { + parH[level]->sendProcessNeighborADY.resize(numberOfProcessNeighbors); + parD[level]->sendProcessNeighborADY.resize(numberOfProcessNeighbors); + } + ////////////////////////////////////////////////////////////////////////// + } else if (sor == "recv") { + parH[level]->recvProcessNeighborY.resize(numberOfProcessNeighbors); + parD[level]->recvProcessNeighborY.resize(numberOfProcessNeighbors); + ////////////////////////////////////////////////////////////////////////// + if (getDiffOn() == true) { + parH[level]->recvProcessNeighborADY.resize(numberOfProcessNeighbors); + parD[level]->recvProcessNeighborADY.resize(numberOfProcessNeighbors); + } + ////////////////////////////////////////////////////////////////////////// + } } -void Parameter::setWriteVeloASCIIfiles(bool writeVeloASCII) +void Parameter::setNumberOfProcessNeighborsZ(unsigned int numberOfProcessNeighbors, int level, std::string sor) { - this->writeVeloASCII = writeVeloASCII; + if (sor == "send") { + parH[level]->sendProcessNeighborZ.resize(numberOfProcessNeighbors); + parD[level]->sendProcessNeighborZ.resize(numberOfProcessNeighbors); + ////////////////////////////////////////////////////////////////////////// + if (getDiffOn() == true) { + parH[level]->sendProcessNeighborADZ.resize(numberOfProcessNeighbors); + parD[level]->sendProcessNeighborADZ.resize(numberOfProcessNeighbors); + } + ////////////////////////////////////////////////////////////////////////// + } else if (sor == "recv") { + parH[level]->recvProcessNeighborZ.resize(numberOfProcessNeighbors); + parD[level]->recvProcessNeighborZ.resize(numberOfProcessNeighbors); + ////////////////////////////////////////////////////////////////////////// + if (getDiffOn() == true) { + parH[level]->recvProcessNeighborADZ.resize(numberOfProcessNeighbors); + parD[level]->recvProcessNeighborADZ.resize(numberOfProcessNeighbors); + } + ////////////////////////////////////////////////////////////////////////// + } } -void Parameter::setCalcPlaneConc(bool calcPlaneConc) +void Parameter::setIsNeighborX(bool isNeigbor) { this->isNeigborX = isNeigbor; } +void Parameter::setIsNeighborY(bool isNeigbor) { this->isNeigborY = isNeigbor; } +void Parameter::setIsNeighborZ(bool isNeigbor) { this->isNeigborZ = isNeigbor; } +void Parameter::setSendProcessNeighborsAfterFtoCX(int numberOfNodes, int level, int arrayIndex) { - this->calcPlaneConc = calcPlaneConc; -} -void Parameter::setTimeCalcMedStart(int CalcMedStart) -{ - ic.tCalcMedStart = CalcMedStart; + this->getParH(level)->sendProcessNeighborsAfterFtoCX[arrayIndex].numberOfNodes = numberOfNodes; + this->getParD(level)->sendProcessNeighborsAfterFtoCX[arrayIndex].numberOfNodes = numberOfNodes; + this->getParH(level)->sendProcessNeighborsAfterFtoCX[arrayIndex].memsizeFs = sizeof(real) * numberOfNodes; + this->getParD(level)->sendProcessNeighborsAfterFtoCX[arrayIndex].memsizeFs = sizeof(real) * numberOfNodes; + this->getParH(level)->sendProcessNeighborsAfterFtoCX[arrayIndex].numberOfFs = this->D3Qxx * numberOfNodes; + this->getParD(level)->sendProcessNeighborsAfterFtoCX[arrayIndex].numberOfFs = this->D3Qxx * numberOfNodes; } -void Parameter::setTimeCalcMedEnd(int CalcMedEnd) +void Parameter::setSendProcessNeighborsAfterFtoCY(int numberOfNodes, int level, int arrayIndex) { - ic.tCalcMedEnd = CalcMedEnd; + this->getParH(level)->sendProcessNeighborsAfterFtoCY[arrayIndex].numberOfNodes = numberOfNodes; + this->getParD(level)->sendProcessNeighborsAfterFtoCY[arrayIndex].numberOfNodes = numberOfNodes; + this->getParH(level)->sendProcessNeighborsAfterFtoCY[arrayIndex].memsizeFs = sizeof(real) * numberOfNodes; + this->getParD(level)->sendProcessNeighborsAfterFtoCY[arrayIndex].memsizeFs = sizeof(real) * numberOfNodes; + this->getParH(level)->sendProcessNeighborsAfterFtoCY[arrayIndex].numberOfFs = this->D3Qxx * numberOfNodes; + this->getParD(level)->sendProcessNeighborsAfterFtoCY[arrayIndex].numberOfFs = this->D3Qxx * numberOfNodes; } -void Parameter::setOutputPath(std::string oPath) +void Parameter::setSendProcessNeighborsAfterFtoCZ(int numberOfNodes, int level, int arrayIndex) { - ic.oPath = oPath; + this->getParH(level)->sendProcessNeighborsAfterFtoCZ[arrayIndex].numberOfNodes = numberOfNodes; + this->getParD(level)->sendProcessNeighborsAfterFtoCZ[arrayIndex].numberOfNodes = numberOfNodes; + this->getParH(level)->sendProcessNeighborsAfterFtoCZ[arrayIndex].memsizeFs = sizeof(real) * numberOfNodes; + this->getParD(level)->sendProcessNeighborsAfterFtoCZ[arrayIndex].memsizeFs = sizeof(real) * numberOfNodes; + this->getParH(level)->sendProcessNeighborsAfterFtoCZ[arrayIndex].numberOfFs = this->D3Qxx * numberOfNodes; + this->getParD(level)->sendProcessNeighborsAfterFtoCZ[arrayIndex].numberOfFs = this->D3Qxx * numberOfNodes; } -void Parameter::setOutputPrefix(std::string oPrefix) +void Parameter::setRecvProcessNeighborsAfterFtoCX(int numberOfNodes, int level, int arrayIndex) { - //std::string test = fname; - ic.oPrefix = oPrefix; + this->getParH(level)->recvProcessNeighborsAfterFtoCX[arrayIndex].numberOfNodes = numberOfNodes; + this->getParD(level)->recvProcessNeighborsAfterFtoCX[arrayIndex].numberOfNodes = numberOfNodes; + this->getParH(level)->recvProcessNeighborsAfterFtoCX[arrayIndex].memsizeFs = sizeof(real) * numberOfNodes; + this->getParD(level)->recvProcessNeighborsAfterFtoCX[arrayIndex].memsizeFs = sizeof(real) * numberOfNodes; + this->getParH(level)->recvProcessNeighborsAfterFtoCX[arrayIndex].numberOfFs = this->D3Qxx * numberOfNodes; + this->getParD(level)->recvProcessNeighborsAfterFtoCX[arrayIndex].numberOfFs = this->D3Qxx * numberOfNodes; } -void Parameter::setFName(std::string fname) +void Parameter::setRecvProcessNeighborsAfterFtoCY(int numberOfNodes, int level, int arrayIndex) { - //std::string test = fname; - ic.fname = fname; + this->getParH(level)->recvProcessNeighborsAfterFtoCY[arrayIndex].numberOfNodes = numberOfNodes; + this->getParD(level)->recvProcessNeighborsAfterFtoCY[arrayIndex].numberOfNodes = numberOfNodes; + this->getParH(level)->recvProcessNeighborsAfterFtoCY[arrayIndex].memsizeFs = sizeof(real) * numberOfNodes; + this->getParD(level)->recvProcessNeighborsAfterFtoCY[arrayIndex].memsizeFs = sizeof(real) * numberOfNodes; + this->getParH(level)->recvProcessNeighborsAfterFtoCY[arrayIndex].numberOfFs = this->D3Qxx * numberOfNodes; + this->getParD(level)->recvProcessNeighborsAfterFtoCY[arrayIndex].numberOfFs = this->D3Qxx * numberOfNodes; } -void Parameter::setPrintFiles(bool printfiles) +void Parameter::setRecvProcessNeighborsAfterFtoCZ(int numberOfNodes, int level, int arrayIndex) { - ic.printFiles = printfiles; + this->getParH(level)->recvProcessNeighborsAfterFtoCZ[arrayIndex].numberOfNodes = numberOfNodes; + this->getParD(level)->recvProcessNeighborsAfterFtoCZ[arrayIndex].numberOfNodes = numberOfNodes; + this->getParH(level)->recvProcessNeighborsAfterFtoCZ[arrayIndex].memsizeFs = sizeof(real) * numberOfNodes; + this->getParD(level)->recvProcessNeighborsAfterFtoCZ[arrayIndex].memsizeFs = sizeof(real) * numberOfNodes; + this->getParH(level)->recvProcessNeighborsAfterFtoCZ[arrayIndex].numberOfFs = this->D3Qxx * numberOfNodes; + this->getParD(level)->recvProcessNeighborsAfterFtoCZ[arrayIndex].numberOfFs = this->D3Qxx * numberOfNodes; } -void Parameter::setReadGeo(bool readGeo) +void Parameter::setgeomBoundaryNormalX(std::string geomNormalX) { ic.geomNormalX = geomNormalX; } +void Parameter::setgeomBoundaryNormalY(std::string geomNormalY) { ic.geomNormalY = geomNormalY; } +void Parameter::setgeomBoundaryNormalZ(std::string geomNormalZ) { ic.geomNormalZ = geomNormalZ; } +void Parameter::setInflowBoundaryNormalX(std::string inflowNormalX) { ic.inflowNormalX = inflowNormalX; } +void Parameter::setInflowBoundaryNormalY(std::string inflowNormalY) { ic.inflowNormalY = inflowNormalY; } +void Parameter::setInflowBoundaryNormalZ(std::string inflowNormalZ) { ic.inflowNormalZ = inflowNormalZ; } +void Parameter::setOutflowBoundaryNormalX(std::string outflowNormalX) { ic.outflowNormalX = outflowNormalX; } +void Parameter::setOutflowBoundaryNormalY(std::string outflowNormalY) { ic.outflowNormalY = outflowNormalY; } +void Parameter::setOutflowBoundaryNormalZ(std::string outflowNormalZ) { ic.outflowNormalZ = outflowNormalZ; } +void Parameter::setMainKernel(std::string kernel) { - ic.readGeo = readGeo; + this->mainKernel = kernel; + if (kernel.find("Stream") != std::string::npos) + this->kernelNeedsFluidNodeIndicesToRun = true; } -void Parameter::setDiffusivity(real Diffusivity) +void Parameter::setMultiKernelOn(bool isOn) { this->multiKernelOn = isOn; } +void Parameter::setMultiKernelLevel(std::vector<int> kernelLevel) { this->multiKernelLevel = kernelLevel; } +void Parameter::setMultiKernel(std::vector<std::string> kernel) { this->multiKernel = kernel; } +void Parameter::setADKernel(std::string adKernel) { this->adKernel = adKernel; } +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// get-methods +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +double *Parameter::getForcesDouble() { return this->hostForcing; } +real *Parameter::getForcesHost() { return this->forcingH; } +real *Parameter::getForcesDev() { return this->forcingD; } +double *Parameter::getQuadricLimitersDouble() { return this->hostQuadricLimiters; } +real *Parameter::getQuadricLimitersHost() { return this->quadricLimitersH; } +real *Parameter::getQuadricLimitersDev() { return this->quadricLimitersD; } +real Parameter::getPhi() { return Phi; } +real Parameter::getAngularVelocity() { return angularVelocity; } +real Parameter::getStartXHotWall() { return this->startXHotWall; } +real Parameter::getEndXHotWall() { return this->endXHotWall; } +unsigned int Parameter::getStepEnsight() { return this->stepEnsight; } +unsigned int Parameter::getOutputCount() { return this->outputCount; } +unsigned int Parameter::getlimitOfNodesForVTK() { return this->limitOfNodesForVTK; } +unsigned int Parameter::getStartTurn() { return startTurn; } +std::shared_ptr<LBMSimulationParameter> Parameter::getParD(int level) { return parD[level]; } +std::shared_ptr<LBMSimulationParameter> Parameter::getParH(int level) { return parH[level]; } +unsigned int Parameter::getSizeMat(int level) { return parH[level]->size_Mat; } +unsigned int Parameter::getMemSizereal(int level) { return parH[level]->mem_size_real; } +unsigned int Parameter::getMemSizeInt(int level) { return parH[level]->mem_size_int; } +unsigned int Parameter::getMemSizeBool(int level) { return parH[level]->mem_size_bool; } +unsigned int Parameter::getMemSizerealYZ(int level) { return parH[level]->mem_size_real_yz; } +int Parameter::getFine() { return fine; } +int Parameter::getCoarse() { return coarse; } +int Parameter::getParticleBasicLevel() { return this->particleBasicLevel; } +int Parameter::getParticleInitLevel() { return this->particleInitLevel; } +int Parameter::getNumberOfParticles() { return this->numberOfParticles; } +bool Parameter::getEvenOrOdd(int level) { return parH[level]->evenOrOdd; } +bool Parameter::getDiffOn() { return diffOn; } +bool Parameter::getCompOn() { return compOn; } +int Parameter::getDiffMod() { return diffMod; } +int Parameter::getFactorNZ() { return factor_gridNZ; } +int Parameter::getD3Qxx() { return this->D3Qxx; } +int Parameter::getMaxLevel() { return this->maxlevel; } +unsigned int Parameter::getTStart() { - ic.Diffusivity = Diffusivity; + if (getDoRestart()) { + return getTimeDoRestart() + 1; + } else { + return 1; + } } -void Parameter::setTemperatureInit(real Temp) +unsigned int Parameter::getTInit() { - ic.Temp = Temp; + if (getDoRestart()) { + return getTimeDoRestart(); + } else { + return 0; + } } -void Parameter::setTemperatureBC(real TempBC) +unsigned int Parameter::getTEnd() { return ic.tend; } +unsigned int Parameter::getTOut() { return ic.tout; } +unsigned int Parameter::getTStartOut() { return ic.tStartOut; } +bool Parameter::getCalcMedian() { return ic.calcMedian; } +bool Parameter::getCalcDragLift() { return this->calcDragLift; } +bool Parameter::getCalcCp() { return this->calcCp; } +bool Parameter::getCalcParticle() { return this->calcParticles; } +bool Parameter::getWriteVeloASCIIfiles() { return this->writeVeloASCII; } +bool Parameter::getCalcPlaneConc() { return this->calcPlaneConc; } +int Parameter::getTimeCalcMedStart() { return ic.tCalcMedStart; } +int Parameter::getTimeCalcMedEnd() { return ic.tCalcMedEnd; } +std::string Parameter::getOutputPath() { return ic.oPath; } +std::string Parameter::getOutputPrefix() { return ic.oPrefix; } +std::string Parameter::getFName() { return ic.fname; } +bool Parameter::getPrintFiles() { return ic.printFiles; } +bool Parameter::getReadGeo() { return ic.readGeo; } +bool Parameter::getCalcTurbulenceIntensity() { return this->calcVelocityAndFluctuations; } +real Parameter::getDiffusivity() { return ic.Diffusivity; } +real Parameter::getTemperatureInit() { return ic.Temp; } +real Parameter::getTemperatureBC() { return ic.TempBC; } +real Parameter::getViscosity() { return ic.vis; } +real Parameter::getVelocity() { return ic.u0; } +real Parameter::getViscosityRatio() { return ic.vis_ratio; } +real Parameter::getVelocityRatio() { return ic.u0_ratio; } +real Parameter::getDensityRatio() { return ic.delta_rho; } +real Parameter::getPressRatio() { return ic.delta_press; } +real Parameter::getRealX() { return ic.RealX; } +real Parameter::getRealY() { return ic.RealY; } +unsigned int Parameter::getPressInID() { return ic.PressInID; } +unsigned int Parameter::getPressOutID() { return ic.PressOutID; } +unsigned int Parameter::getPressInZ() { return ic.PressInZ; } +unsigned int Parameter::getPressOutZ() { return ic.PressOutZ; } +int Parameter::getMaxDev() { return ic.maxdev; } +int Parameter::getMyID() { return ic.myid; } +int Parameter::getNumprocs() { return ic.numprocs; } +std::vector<uint> Parameter::getDevices() { return ic.devices; } +std::string Parameter::getGeometryFileC() { return ic.geometryFileC; } +std::string Parameter::getGeometryFileM() { return ic.geometryFileM; } +std::string Parameter::getGeometryFileF() { return ic.geometryFileF; } +real Parameter::getRe() { return ic.Re; } +real Parameter::getFactorPressBC() { return ic.factorPressBC; } +std::vector<int> Parameter::getGridX() { return ic.GridX; } +std::vector<int> Parameter::getGridY() { return ic.GridY; } +std::vector<int> Parameter::getGridZ() { return ic.GridZ; } +std::vector<int> Parameter::getDistX() { return ic.DistX; } +std::vector<int> Parameter::getDistY() { return ic.DistY; } +std::vector<int> Parameter::getDistZ() { return ic.DistZ; } +std::vector<real> Parameter::getScaleLBMtoSI() { return ic.scaleLBMtoSI; } +std::vector<real> Parameter::getTranslateLBMtoSI() { return ic.translateLBMtoSI; } +std::vector<real> Parameter::getMinCoordX() { return ic.minCoordX; } +std::vector<real> Parameter::getMinCoordY() { return ic.minCoordY; } +std::vector<real> Parameter::getMinCoordZ() { return ic.minCoordZ; } +std::vector<real> Parameter::getMaxCoordX() { return ic.maxCoordX; } +std::vector<real> Parameter::getMaxCoordY() { return ic.maxCoordY; } +std::vector<real> Parameter::getMaxCoordZ() { return ic.maxCoordZ; } +TempforBoundaryConditions *Parameter::getTempH() { return this->TempH; } +TempforBoundaryConditions *Parameter::getTempD() { return this->TempD; } +TempVelforBoundaryConditions *Parameter::getTempVelH() { return this->TempVelH; } +TempVelforBoundaryConditions *Parameter::getTempVelD() { return this->TempVelD; } +TempPressforBoundaryConditions *Parameter::getTempPressH() { return this->TempPressH; } +TempPressforBoundaryConditions *Parameter::getTempPressD() { return this->TempPressD; } +// unsigned int Parameter::getkInflowQ() +//{ +// return this->kInflowQ; +//} +// unsigned int Parameter::getkOutflowQ() +//{ +// return this->kOutflowQ; +//} +// QforBoundaryConditions* Parameter::getQinflowH() +//{ +// return this->QinflowH; +//} +// QforBoundaryConditions* Parameter::getQinflowD() +//{ +// return this->QinflowD; +//} +// QforBoundaryConditions* Parameter::getQoutflowH() +//{ +// return this->QoutflowH; +//} +// QforBoundaryConditions* Parameter::getQoutflowD() +//{ +// return this->QoutflowD; +//} +std::string Parameter::getkFull() { return ic.kFull; } +std::string Parameter::getgeoFull() { return ic.geoFull; } +std::string Parameter::getgeoVec() { return ic.geoVec; } +std::string Parameter::getcoordX() { return ic.coordX; } +std::string Parameter::getcoordY() { return ic.coordY; } +std::string Parameter::getcoordZ() { return ic.coordZ; } +std::string Parameter::getneighborX() { return ic.neighborX; } +std::string Parameter::getneighborY() { return ic.neighborY; } +std::string Parameter::getneighborZ() { return ic.neighborZ; } +std::string Parameter::getneighborWSB() { return ic.neighborWSB; } +std::string Parameter::getscaleCFC() { return ic.scaleCFC; } +std::string Parameter::getscaleCFF() { return ic.scaleCFF; } +std::string Parameter::getscaleFCC() { return ic.scaleFCC; } +std::string Parameter::getscaleFCF() { return ic.scaleFCF; } +std::string Parameter::getscaleOffsetCF() { return ic.scaleOffsetCF; } +std::string Parameter::getscaleOffsetFC() { return ic.scaleOffsetFC; } +std::string Parameter::getgeomBoundaryBcQs() { return ic.geomBoundaryBcQs; } +std::string Parameter::getgeomBoundaryBcValues() { return ic.geomBoundaryBcValues; } +std::string Parameter::getnoSlipBcPos() { return ic.noSlipBcPos; } +std::string Parameter::getnoSlipBcQs() { return ic.noSlipBcQs; } +std::string Parameter::getnoSlipBcValue() { return ic.noSlipBcValue; } +std::string Parameter::getnoSlipBcValues() { return ic.noSlipBcValues; } +std::string Parameter::getslipBcPos() { return ic.slipBcPos; } +std::string Parameter::getslipBcQs() { return ic.slipBcQs; } +std::string Parameter::getslipBcValue() { return ic.slipBcValue; } +std::string Parameter::getpressBcPos() { return ic.pressBcPos; } +std::string Parameter::getpressBcQs() { return ic.pressBcQs; } +std::string Parameter::getpressBcValue() { return ic.pressBcValue; } +std::string Parameter::getpressBcValues() { return ic.pressBcValues; } +std::string Parameter::getvelBcQs() { return ic.velBcQs; } +std::string Parameter::getvelBcValues() { return ic.velBcValues; } +std::string Parameter::getinletBcQs() { return ic.inletBcQs; } +std::string Parameter::getinletBcValues() { return ic.inletBcValues; } +std::string Parameter::getoutletBcQs() { return ic.outletBcQs; } +std::string Parameter::getoutletBcValues() { return ic.outletBcValues; } +std::string Parameter::gettopBcQs() { return ic.topBcQs; } +std::string Parameter::gettopBcValues() { return ic.topBcValues; } +std::string Parameter::getbottomBcQs() { return ic.bottomBcQs; } +std::string Parameter::getbottomBcValues() { return ic.bottomBcValues; } +std::string Parameter::getfrontBcQs() { return ic.frontBcQs; } +std::string Parameter::getfrontBcValues() { return ic.frontBcValues; } +std::string Parameter::getbackBcQs() { return ic.backBcQs; } +std::string Parameter::getbackBcValues() { return ic.backBcValues; } +std::string Parameter::getwallBcQs() { return ic.wallBcQs; } +std::string Parameter::getwallBcValues() { return ic.wallBcValues; } +std::string Parameter::getperiodicBcQs() { return ic.periodicBcQs; } +std::string Parameter::getperiodicBcValues() { return ic.periodicBcValues; } +std::string Parameter::getpropellerQs() { return ic.propellerQs; } +std::string Parameter::getpropellerValues() { return ic.propellerValues; } +std::string Parameter::getpropellerCylinder() { return ic.propellerCylinder; } +std::string Parameter::getmeasurePoints() { return ic.measurePoints; } +std::string Parameter::getLBMvsSI() { return ic.LBMvsSI; } +std::string Parameter::getnumberNodes() { return ic.numberNodes; } +std::string Parameter::getcpTop() { return ic.cpTop; } +std::string Parameter::getcpBottom() { return ic.cpBottom; } +std::string Parameter::getcpBottom2() { return ic.cpBottom2; } +std::string Parameter::getConcentration() { return ic.concentration; } +std::string Parameter::getStreetVelocityFilePath() { return ic.streetVelocity; } +real Parameter::getclockCycleForMP() { return ic.clockCycleForMP; } +unsigned int Parameter::getTimeDoCheckPoint() { return ic.tDoCheckPoint; } +unsigned int Parameter::getTimeDoRestart() { return ic.tDoRestart; } +bool Parameter::getDoCheckPoint() { return ic.doCheckPoint; } +bool Parameter::getDoRestart() { return ic.doRestart; } +bool Parameter::getIsGeo() { return ic.isGeo; } +bool Parameter::getIsGeoNormal() { return ic.isGeoNormal; } +bool Parameter::getIsInflowNormal() { return ic.isInflowNormal; } +bool Parameter::getIsOutflowNormal() { return ic.isOutflowNormal; } +bool Parameter::getIsCp() { return ic.isCp; } +bool Parameter::getConcFile() { return ic.isConc; } +bool Parameter::isStreetVelocityFile() { return ic.streetVelocityFile; } +bool Parameter::getUseMeasurePoints() { return ic.isMeasurePoints; } +bool Parameter::getUseWale() { return ic.isWale; } +bool Parameter::getUseInitNeq() { return ic.isInitNeq; } +bool Parameter::getSimulatePorousMedia() { return ic.simulatePorousMedia; } + +bool Parameter::getIsF3() { return this->isF3; } + +bool Parameter::getIsBodyForce() { return this->isBodyForce; } + +bool Parameter::getIsGeometryValues() { return ic.GeometryValues; } +bool Parameter::getCalc2ndOrderMoments() { return ic.is2ndOrderMoments; } +bool Parameter::getCalc3rdOrderMoments() { return ic.is3rdOrderMoments; } +bool Parameter::getCalcHighOrderMoments() { return ic.isHighOrderMoments; } +bool Parameter::getIsProp() { return ic.isProp; } +bool Parameter::overWritingRestart(uint t) { return t == getTimeDoRestart(); } +unsigned int Parameter::getTimestepForMP() { return ic.timeStepForMP; } +unsigned int Parameter::getTimestepOfCoarseLevel() { return this->timestep; } +double Parameter::getMemsizeGPU() { return this->memsizeGPU; } +// 1D domain decomposition +std::vector<std::string> Parameter::getPossNeighborFiles(std::string sor) { - ic.TempBC = TempBC; + if (sor == "send") { + return this->possNeighborFilesSend; + } else if (sor == "recv") { + return this->possNeighborFilesRecv; + } + throw std::runtime_error("Parameter string invalid."); } -void Parameter::setViscosity(real Viscosity) +unsigned int Parameter::getNumberOfProcessNeighbors(int level, std::string sor) { - ic.vis = Viscosity; + if (sor == "send") { + return (unsigned int)parH[level]->sendProcessNeighbor.size(); + } else if (sor == "recv") { + return (unsigned int)parH[level]->recvProcessNeighbor.size(); + } + throw std::runtime_error("Parameter string invalid."); } -void Parameter::setVelocity(real Velocity) +bool Parameter::getIsNeighbor() { return this->isNeigbor; } +// 3D domain decomposition +std::vector<std::string> Parameter::getPossNeighborFilesX(std::string sor) { - ic.u0 = Velocity; + if (sor == "send") { + return this->possNeighborFilesSendX; + } else if (sor == "recv") { + return this->possNeighborFilesRecvX; + } + throw std::runtime_error("Parameter string invalid."); } -void Parameter::setViscosityRatio(real ViscosityRatio) +std::vector<std::string> Parameter::getPossNeighborFilesY(std::string sor) { - ic.vis_ratio = ViscosityRatio; + if (sor == "send") { + return this->possNeighborFilesSendY; + } else if (sor == "recv") { + return this->possNeighborFilesRecvY; + } + throw std::runtime_error("Parameter string invalid."); } -void Parameter::setVelocityRatio(real VelocityRatio) +std::vector<std::string> Parameter::getPossNeighborFilesZ(std::string sor) { - ic.u0_ratio = VelocityRatio; + if (sor == "send") { + return this->possNeighborFilesSendZ; + } else if (sor == "recv") { + return this->possNeighborFilesRecvZ; + } + throw std::runtime_error("Parameter string invalid."); } -void Parameter::setDensityRatio(real DensityRatio) +unsigned int Parameter::getNumberOfProcessNeighborsX(int level, std::string sor) { - ic.delta_rho = DensityRatio; + if (sor == "send") { + return (unsigned int)parH[level]->sendProcessNeighborX.size(); + } else if (sor == "recv") { + return (unsigned int)parH[level]->recvProcessNeighborX.size(); + } + throw std::runtime_error("getNumberOfProcessNeighborsX: Parameter string invalid."); } -void Parameter::setPressRatio(real PressRatio) +unsigned int Parameter::getNumberOfProcessNeighborsY(int level, std::string sor) { - ic.delta_press = PressRatio; + if (sor == "send") { + return (unsigned int)parH[level]->sendProcessNeighborY.size(); + } else if (sor == "recv") { + return (unsigned int)parH[level]->recvProcessNeighborY.size(); + } + throw std::runtime_error("getNumberOfProcessNeighborsY: Parameter string invalid."); } -void Parameter::setRealX(real RealX) +unsigned int Parameter::getNumberOfProcessNeighborsZ(int level, std::string sor) { - ic.RealX = RealX; -} -void Parameter::setRealY(real RealY) -{ - ic.RealY = RealY; -} -void Parameter::setPressInID(unsigned int PressInID) -{ - ic.PressInID = PressInID; -} -void Parameter::setPressOutID(unsigned int PressOutID) -{ - ic.PressOutID = PressOutID; -} -void Parameter::setPressInZ(unsigned int PressInZ) -{ - ic.PressInZ = PressInZ; -} -void Parameter::setPressOutZ(unsigned int PressOutZ) -{ - ic.PressOutZ = PressOutZ; -} -void Parameter::setMaxDev(int maxdev) -{ - ic.maxdev = maxdev; -} -void Parameter::setMyID(int myid) -{ - ic.myid = myid; -} -void Parameter::setNumprocs(int numprocs) -{ - ic.numprocs = numprocs; -} -void Parameter::setDevices(std::vector<uint> devices) -{ - ic.devices = devices; -} -void Parameter::setGeometryFileC(std::string GeometryFileC) -{ - ic.geometryFileC = GeometryFileC; -} -void Parameter::setGeometryFileM(std::string GeometryFileM) -{ - ic.geometryFileM = GeometryFileM; -} -void Parameter::setGeometryFileF(std::string GeometryFileF) -{ - ic.geometryFileF = GeometryFileF; -} -void Parameter::setRe(real Re) -{ - ic.Re = Re; -} -void Parameter::setFactorPressBC(real factorPressBC) -{ - ic.factorPressBC = factorPressBC; -} -void Parameter::setIsGeo(bool isGeo) -{ - ic.isGeo = isGeo; -} -void Parameter::setIsGeoNormal(bool isGeoNormal) -{ - ic.isGeoNormal = isGeoNormal; -} -void Parameter::setIsInflowNormal(bool isInflowNormal) -{ - ic.isInflowNormal = isInflowNormal; -} -void Parameter::setIsOutflowNormal(bool isOutflowNormal) -{ - ic.isOutflowNormal = isOutflowNormal; -} -void Parameter::setIsProp(bool isProp) -{ - ic.isProp = isProp; -} -void Parameter::setIsCp(bool isCp) -{ - ic.isCp = isCp; -} -void Parameter::setConcFile(bool concFile) -{ - ic.isConc = concFile; -} -void Parameter::setStreetVelocityFile(bool streetVelocityFile) -{ - ic.streetVelocityFile = streetVelocityFile; -} -void Parameter::setUseMeasurePoints(bool useMeasurePoints) -{ - ic.isMeasurePoints = useMeasurePoints; -} -void Parameter::setUseWale(bool useWale) -{ - ic.isWale = useWale; -} -void Parameter::setUseInitNeq(bool useInitNeq) -{ - ic.isInitNeq = useInitNeq; -} -void Parameter::setSimulatePorousMedia(bool simulatePorousMedia) -{ - ic.simulatePorousMedia = simulatePorousMedia; -} - -void Parameter::setIsF3(bool isF3) -{ - this->isF3 = isF3; -} - -void Parameter::setIsBodyForce(bool isBodyForce) -{ - this->isBodyForce = isBodyForce; -} - -void Parameter::setGridX(std::vector<int> GridX) -{ - ic.GridX = GridX; -} -void Parameter::setGridY(std::vector<int> GridY) -{ - ic.GridY = GridY; -} -void Parameter::setGridZ(std::vector<int> GridZ) -{ - ic.GridZ = GridZ; -} -void Parameter::setDistX(std::vector<int> DistX) -{ - ic.DistX = DistX; -} -void Parameter::setDistY(std::vector<int> DistY) -{ - ic.DistY = DistY; -} -void Parameter::setDistZ(std::vector<int> DistZ) -{ - ic.DistZ = DistZ; -} -void Parameter::setScaleLBMtoSI(std::vector<real> scaleLBMtoSI) -{ - ic.scaleLBMtoSI = scaleLBMtoSI; -} -void Parameter::setTranslateLBMtoSI(std::vector<real> translateLBMtoSI) -{ - ic.translateLBMtoSI = translateLBMtoSI; -} -void Parameter::setMinCoordX(std::vector<real> MinCoordX) -{ - ic.minCoordX = MinCoordX; -} -void Parameter::setMinCoordY(std::vector<real> MinCoordY) -{ - ic.minCoordY = MinCoordY; -} -void Parameter::setMinCoordZ(std::vector<real> MinCoordZ) -{ - ic.minCoordZ = MinCoordZ; -} -void Parameter::setMaxCoordX(std::vector<real> MaxCoordX) -{ - ic.maxCoordX = MaxCoordX; -} -void Parameter::setMaxCoordY(std::vector<real> MaxCoordY) -{ - ic.maxCoordY = MaxCoordY; -} -void Parameter::setMaxCoordZ(std::vector<real> MaxCoordZ) -{ - ic.maxCoordZ = MaxCoordZ; -} -void Parameter::setTempH(TempforBoundaryConditions* TempH) -{ - this->TempH = TempH; -} -void Parameter::setTempD(TempforBoundaryConditions* TempD) -{ - this->TempD = TempD; -} -void Parameter::setTempVelH(TempVelforBoundaryConditions* TempVelH) -{ - this->TempVelH = TempVelH; -} -void Parameter::setTempVelD(TempVelforBoundaryConditions* TempVelD) -{ - this->TempVelD = TempVelD; -} -void Parameter::setTempPressH(TempPressforBoundaryConditions* TempPressH) -{ - this->TempPressH = TempPressH; -} -void Parameter::setTempPressD(TempPressforBoundaryConditions* TempPressD) -{ - this->TempPressD = TempPressD; -} -//void Parameter::setkInflowQ(unsigned int kInflowQ) -//{ -// this->kInflowQ = kInflowQ; -//} -//void Parameter::setkOutflowQ(unsigned int kOutflowQ) -//{ -// this->kOutflowQ = kOutflowQ; -//} -//void Parameter::setQinflowH(QforBoundaryConditions* QinflowH) -//{ -// this->QinflowH = QinflowH; -//} -//void Parameter::setQinflowD(QforBoundaryConditions* QinflowD) -//{ -// this->QinflowD = QinflowD; -//} -//void Parameter::setQoutflowH(QforBoundaryConditions* QoutflowH) -//{ -// this->QoutflowH = QoutflowH; -//} -//void Parameter::setQoutflowD(QforBoundaryConditions* QoutflowD) -//{ -// this->QoutflowD = QoutflowD; -//} -void Parameter::setkFull(std::string kFull) -{ - ic.kFull = kFull; -} -void Parameter::setgeoFull(std::string geoFull) -{ - ic.geoFull = geoFull; -} -void Parameter::setgeoVec(std::string geoVec) -{ - ic.geoVec = geoVec; -} -void Parameter::setcoordX(std::string coordX) -{ - ic.coordX = coordX; -} -void Parameter::setcoordY(std::string coordY) -{ - ic.coordY = coordY; -} -void Parameter::setcoordZ(std::string coordZ) -{ - ic.coordZ = coordZ; -} -void Parameter::setneighborX(std::string neighborX) -{ - ic.neighborX = neighborX; -} -void Parameter::setneighborY(std::string neighborY) -{ - ic.neighborY = neighborY; -} -void Parameter::setneighborZ(std::string neighborZ) -{ - ic.neighborZ = neighborZ; -} -void Parameter::setneighborWSB(std::string neighborWSB) -{ - ic.neighborWSB = neighborWSB; -} -void Parameter::setscaleCFC(std::string scaleCFC) -{ - ic.scaleCFC = scaleCFC; -} -void Parameter::setscaleCFF(std::string scaleCFF) -{ - ic.scaleCFF = scaleCFF; -} -void Parameter::setscaleFCC(std::string scaleFCC) -{ - ic.scaleFCC = scaleFCC; -} -void Parameter::setscaleFCF(std::string scaleFCF) -{ - ic.scaleFCF = scaleFCF; -} -void Parameter::setscaleOffsetCF(std::string scaleOffsetCF) -{ - ic.scaleOffsetCF = scaleOffsetCF; -} -void Parameter::setscaleOffsetFC(std::string scaleOffsetFC) -{ - ic.scaleOffsetFC = scaleOffsetFC; -} -void Parameter::setgeomBoundaryBcQs(std::string geomBoundaryBcQs) -{ - ic.geomBoundaryBcQs = geomBoundaryBcQs; -} -void Parameter::setgeomBoundaryBcValues(std::string geomBoundaryBcValues) -{ - ic.geomBoundaryBcValues = geomBoundaryBcValues; -} -void Parameter::setnoSlipBcPos(std::string noSlipBcPos) -{ - ic.noSlipBcPos = noSlipBcPos; -} -void Parameter::setnoSlipBcQs(std::string noSlipBcQs) -{ - ic.noSlipBcQs = noSlipBcQs; -} -void Parameter::setnoSlipBcValue(std::string noSlipBcValue) -{ - ic.noSlipBcValue = noSlipBcValue; -} -void Parameter::setnoSlipBcValues(std::string noSlipBcValues) -{ - ic.noSlipBcValues = noSlipBcValues; -} -void Parameter::setslipBcPos(std::string slipBcPos) -{ - ic.slipBcPos = slipBcPos; -} -void Parameter::setslipBcQs(std::string slipBcQs) -{ - ic.slipBcQs = slipBcQs; -} -void Parameter::setslipBcValue(std::string slipBcValue) -{ - ic.slipBcValue = slipBcValue; -} -void Parameter::setpressBcPos(std::string pressBcPos) -{ - ic.pressBcPos = pressBcPos; -} -void Parameter::setpressBcQs(std::string pressBcQs) -{ - ic.pressBcQs = pressBcQs; -} -void Parameter::setpressBcValue(std::string pressBcValue) -{ - ic.pressBcValue = pressBcValue; -} -void Parameter::setpressBcValues(std::string pressBcValues) -{ - ic.pressBcValues = pressBcValues; -} -void Parameter::setvelBcQs(std::string velBcQs) -{ - ic.velBcQs = velBcQs; -} -void Parameter::setvelBcValues(std::string velBcValues) -{ - ic.velBcValues = velBcValues; -} -void Parameter::setinletBcQs(std::string inletBcQs) -{ - ic.inletBcQs = inletBcQs; -} -void Parameter::setinletBcValues(std::string inletBcValues) -{ - ic.inletBcValues = inletBcValues; -} -void Parameter::setoutletBcQs(std::string outletBcQs) -{ - ic.outletBcQs = outletBcQs; -} -void Parameter::setoutletBcValues(std::string outletBcValues) -{ - ic.outletBcValues = outletBcValues; -} -void Parameter::settopBcQs(std::string topBcQs) -{ - ic.topBcQs = topBcQs; -} -void Parameter::settopBcValues(std::string topBcValues) -{ - ic.topBcValues = topBcValues; -} -void Parameter::setbottomBcQs(std::string bottomBcQs) -{ - ic.bottomBcQs = bottomBcQs; -} -void Parameter::setbottomBcValues(std::string bottomBcValues) -{ - ic.bottomBcValues = bottomBcValues; -} -void Parameter::setfrontBcQs(std::string frontBcQs) -{ - ic.frontBcQs = frontBcQs; -} -void Parameter::setfrontBcValues(std::string frontBcValues) -{ - ic.frontBcValues = frontBcValues; -} -void Parameter::setbackBcQs(std::string backBcQs) -{ - ic.backBcQs = backBcQs; -} -void Parameter::setbackBcValues(std::string backBcValues) -{ - ic.backBcValues = backBcValues; -} -void Parameter::setwallBcQs(std::string wallBcQs) -{ - ic.wallBcQs = wallBcQs; -} -void Parameter::setwallBcValues(std::string wallBcValues) -{ - ic.wallBcValues = wallBcValues; -} -void Parameter::setperiodicBcQs(std::string periodicBcQs) -{ - ic.periodicBcQs = periodicBcQs; -} -void Parameter::setperiodicBcValues(std::string periodicBcValues) -{ - ic.periodicBcValues = periodicBcValues; -} -void Parameter::setpropellerQs(std::string propellerQs) -{ - ic.propellerQs = propellerQs; -} -void Parameter::setpropellerValues(std::string propellerValues) -{ - ic.propellerValues = propellerValues; -} -void Parameter::setpropellerCylinder(std::string propellerCylinder) -{ - ic.propellerCylinder = propellerCylinder; -} -void Parameter::setmeasurePoints(std::string measurePoints) -{ - ic.measurePoints = measurePoints; -} -void Parameter::setnumberNodes(std::string numberNodes) -{ - ic.numberNodes = numberNodes; -} -void Parameter::setLBMvsSI(std::string LBMvsSI) -{ - ic.LBMvsSI = LBMvsSI; -} -void Parameter::setcpTop(std::string cpTop) -{ - ic.cpTop = cpTop; -} -void Parameter::setcpBottom(std::string cpBottom) -{ - ic.cpBottom = cpBottom; -} -void Parameter::setcpBottom2(std::string cpBottom2) -{ - ic.cpBottom2 = cpBottom2; -} -void Parameter::setConcentration(std::string concFile) -{ - ic.concentration = concFile; -} -void Parameter::setStreetVelocity(std::string streetVelocity) -{ - ic.streetVelocity = streetVelocity; -} -void Parameter::setclockCycleForMP(real clockCycleForMP) -{ - ic.clockCycleForMP = clockCycleForMP; -} -void Parameter::setTimeDoCheckPoint(unsigned int tDoCheckPoint) -{ - ic.tDoCheckPoint = tDoCheckPoint; -} -void Parameter::setTimeDoRestart(unsigned int tDoRestart) -{ - ic.tDoRestart = tDoRestart; -} -void Parameter::setDoCheckPoint(bool doCheckPoint) -{ - ic.doCheckPoint = doCheckPoint; -} -void Parameter::setDoRestart(bool doRestart) -{ - ic.doRestart = doRestart; -} -void Parameter::settimestepForMP(unsigned int timestepForMP) -{ - ic.timeStepForMP = timestepForMP; -} -void Parameter::setObj(std::string str, bool isObj) -{ - if (str == "geo") - { - this->setIsGeo(isObj); - } - else if (str == "prop") - { - this->setIsProp(isObj); - } - else if (str == "cp") - { - this->setIsCp(isObj); - } - else if (str == "geoNormal") - { - this->setIsGeoNormal(isObj); - } - else if (str == "inflowNormal") - { - this->setIsInflowNormal(isObj); - } - else if (str == "outflowNormal") - { - this->setIsOutflowNormal(isObj); - } -} -void Parameter::setGeometryValues(bool GeometryValues) -{ - ic.GeometryValues = GeometryValues; -} -void Parameter::setCalc2ndOrderMoments(bool is2ndOrderMoments) -{ - ic.is2ndOrderMoments = is2ndOrderMoments; -} -void Parameter::setCalc3rdOrderMoments(bool is3rdOrderMoments) -{ - ic.is3rdOrderMoments = is3rdOrderMoments; -} -void Parameter::setCalcHighOrderMoments(bool isHighOrderMoments) -{ - ic.isHighOrderMoments = isHighOrderMoments; -} -void Parameter::setMemsizeGPU(double admem, bool reset) -{ - if (reset == true) - { - this->memsizeGPU = 0.; - } - else - { - this->memsizeGPU += admem; - } -} -//1D domain decomposition -void Parameter::setPossNeighborFiles(std::vector<std::string> possNeighborFiles, std::string sor) -{ - if (sor=="send") - { - this->possNeighborFilesSend = possNeighborFiles; - } - else if (sor == "recv") - { - this->possNeighborFilesRecv = possNeighborFiles; - } -} -void Parameter::setNumberOfProcessNeighbors(unsigned int numberOfProcessNeighbors, int level, std::string sor) -{ - if (sor=="send") - { - parH[level]->sendProcessNeighbor.resize(numberOfProcessNeighbors); - parD[level]->sendProcessNeighbor.resize(numberOfProcessNeighbors); - } - else if (sor == "recv") - { - parH[level]->recvProcessNeighbor.resize(numberOfProcessNeighbors); - parD[level]->recvProcessNeighbor.resize(numberOfProcessNeighbors); - } -} -void Parameter::setIsNeighbor(bool isNeigbor) -{ - this->isNeigbor = isNeigbor; -} -//3D domain decomposition -void Parameter::setPossNeighborFilesX(std::vector<std::string> possNeighborFiles, std::string sor) -{ - if (sor=="send") - { - this->possNeighborFilesSendX = possNeighborFiles; - } - else if (sor == "recv") - { - this->possNeighborFilesRecvX = possNeighborFiles; - } -} -void Parameter::setPossNeighborFilesY(std::vector<std::string> possNeighborFiles, std::string sor) -{ - if (sor=="send") - { - this->possNeighborFilesSendY = possNeighborFiles; - } - else if (sor == "recv") - { - this->possNeighborFilesRecvY = possNeighborFiles; - } -} -void Parameter::setPossNeighborFilesZ(std::vector<std::string> possNeighborFiles, std::string sor) -{ - if (sor=="send") - { - this->possNeighborFilesSendZ = possNeighborFiles; - } - else if (sor == "recv") - { - this->possNeighborFilesRecvZ = possNeighborFiles; - } -} -void Parameter::setNumberOfProcessNeighborsX(unsigned int numberOfProcessNeighbors, int level, std::string sor) -{ - if (sor=="send") - { - parH[level]->sendProcessNeighborX.resize(numberOfProcessNeighbors); - parD[level]->sendProcessNeighborX.resize(numberOfProcessNeighbors); - ////////////////////////////////////////////////////////////////////////// - if (getDiffOn()==true){ - parH[level]->sendProcessNeighborADX.resize(numberOfProcessNeighbors); - parD[level]->sendProcessNeighborADX.resize(numberOfProcessNeighbors); - } - ////////////////////////////////////////////////////////////////////////// - } - else if (sor == "recv") - { - parH[level]->recvProcessNeighborX.resize(numberOfProcessNeighbors); - parD[level]->recvProcessNeighborX.resize(numberOfProcessNeighbors); - ////////////////////////////////////////////////////////////////////////// - if (getDiffOn()==true){ - parH[level]->recvProcessNeighborADX.resize(numberOfProcessNeighbors); - parD[level]->recvProcessNeighborADX.resize(numberOfProcessNeighbors); - } - ////////////////////////////////////////////////////////////////////////// - } -} -void Parameter::setNumberOfProcessNeighborsY(unsigned int numberOfProcessNeighbors, int level, std::string sor) -{ - if (sor=="send") - { - parH[level]->sendProcessNeighborY.resize(numberOfProcessNeighbors); - parD[level]->sendProcessNeighborY.resize(numberOfProcessNeighbors); - ////////////////////////////////////////////////////////////////////////// - if (getDiffOn()==true){ - parH[level]->sendProcessNeighborADY.resize(numberOfProcessNeighbors); - parD[level]->sendProcessNeighborADY.resize(numberOfProcessNeighbors); - } - ////////////////////////////////////////////////////////////////////////// - } - else if (sor == "recv") - { - parH[level]->recvProcessNeighborY.resize(numberOfProcessNeighbors); - parD[level]->recvProcessNeighborY.resize(numberOfProcessNeighbors); - ////////////////////////////////////////////////////////////////////////// - if (getDiffOn()==true){ - parH[level]->recvProcessNeighborADY.resize(numberOfProcessNeighbors); - parD[level]->recvProcessNeighborADY.resize(numberOfProcessNeighbors); - } - ////////////////////////////////////////////////////////////////////////// - } -} -void Parameter::setNumberOfProcessNeighborsZ(unsigned int numberOfProcessNeighbors, int level, std::string sor) -{ - if (sor=="send") - { - parH[level]->sendProcessNeighborZ.resize(numberOfProcessNeighbors); - parD[level]->sendProcessNeighborZ.resize(numberOfProcessNeighbors); - ////////////////////////////////////////////////////////////////////////// - if (getDiffOn()==true){ - parH[level]->sendProcessNeighborADZ.resize(numberOfProcessNeighbors); - parD[level]->sendProcessNeighborADZ.resize(numberOfProcessNeighbors); - } - ////////////////////////////////////////////////////////////////////////// - } - else if (sor == "recv") - { - parH[level]->recvProcessNeighborZ.resize(numberOfProcessNeighbors); - parD[level]->recvProcessNeighborZ.resize(numberOfProcessNeighbors); - ////////////////////////////////////////////////////////////////////////// - if (getDiffOn()==true){ - parH[level]->recvProcessNeighborADZ.resize(numberOfProcessNeighbors); - parD[level]->recvProcessNeighborADZ.resize(numberOfProcessNeighbors); - } - ////////////////////////////////////////////////////////////////////////// - } -} -void Parameter::setIsNeighborX(bool isNeigbor) -{ - this->isNeigborX = isNeigbor; -} -void Parameter::setIsNeighborY(bool isNeigbor) -{ - this->isNeigborY = isNeigbor; -} -void Parameter::setIsNeighborZ(bool isNeigbor) -{ - this->isNeigborZ = isNeigbor; } -void Parameter::setSendProcessNeighborsAfterFtoCX(int numberOfNodes, int level, int arrayIndex) { - this->getParH(level)->sendProcessNeighborsAfterFtoCX[arrayIndex].numberOfNodes = numberOfNodes; - this->getParD(level)->sendProcessNeighborsAfterFtoCX[arrayIndex].numberOfNodes = numberOfNodes; - this->getParH(level)->sendProcessNeighborsAfterFtoCX[arrayIndex].memsizeFs = sizeof(real) * numberOfNodes; - this->getParD(level)->sendProcessNeighborsAfterFtoCX[arrayIndex].memsizeFs = sizeof(real) * numberOfNodes; - this->getParH(level)->sendProcessNeighborsAfterFtoCX[arrayIndex].numberOfFs = this->D3Qxx * numberOfNodes; - this->getParD(level)->sendProcessNeighborsAfterFtoCX[arrayIndex].numberOfFs = this->D3Qxx * numberOfNodes; -} -void Parameter::setSendProcessNeighborsAfterFtoCY(int numberOfNodes, int level, int arrayIndex) -{ - this->getParH(level)->sendProcessNeighborsAfterFtoCY[arrayIndex].numberOfNodes = numberOfNodes; - this->getParD(level)->sendProcessNeighborsAfterFtoCY[arrayIndex].numberOfNodes = numberOfNodes; - this->getParH(level)->sendProcessNeighborsAfterFtoCY[arrayIndex].memsizeFs = sizeof(real) * numberOfNodes; - this->getParD(level)->sendProcessNeighborsAfterFtoCY[arrayIndex].memsizeFs = sizeof(real) * numberOfNodes; - this->getParH(level)->sendProcessNeighborsAfterFtoCY[arrayIndex].numberOfFs = this->D3Qxx * numberOfNodes; - this->getParD(level)->sendProcessNeighborsAfterFtoCY[arrayIndex].numberOfFs = this->D3Qxx * numberOfNodes; -} -void Parameter::setSendProcessNeighborsAfterFtoCZ(int numberOfNodes, int level, int arrayIndex) -{ - this->getParH(level)->sendProcessNeighborsAfterFtoCZ[arrayIndex].numberOfNodes = numberOfNodes; - this->getParD(level)->sendProcessNeighborsAfterFtoCZ[arrayIndex].numberOfNodes = numberOfNodes; - this->getParH(level)->sendProcessNeighborsAfterFtoCZ[arrayIndex].memsizeFs = sizeof(real) * numberOfNodes; - this->getParD(level)->sendProcessNeighborsAfterFtoCZ[arrayIndex].memsizeFs = sizeof(real) * numberOfNodes; - this->getParH(level)->sendProcessNeighborsAfterFtoCZ[arrayIndex].numberOfFs = this->D3Qxx * numberOfNodes; - this->getParD(level)->sendProcessNeighborsAfterFtoCZ[arrayIndex].numberOfFs = this->D3Qxx * numberOfNodes; -} -void Parameter::setRecvProcessNeighborsAfterFtoCX(int numberOfNodes, int level, int arrayIndex) -{ - this->getParH(level)->recvProcessNeighborsAfterFtoCX[arrayIndex].numberOfNodes = numberOfNodes; - this->getParD(level)->recvProcessNeighborsAfterFtoCX[arrayIndex].numberOfNodes = numberOfNodes; - this->getParH(level)->recvProcessNeighborsAfterFtoCX[arrayIndex].memsizeFs = sizeof(real) * numberOfNodes; - this->getParD(level)->recvProcessNeighborsAfterFtoCX[arrayIndex].memsizeFs = sizeof(real) * numberOfNodes; - this->getParH(level)->recvProcessNeighborsAfterFtoCX[arrayIndex].numberOfFs = this->D3Qxx * numberOfNodes; - this->getParD(level)->recvProcessNeighborsAfterFtoCX[arrayIndex].numberOfFs = this->D3Qxx * numberOfNodes; -} -void Parameter::setRecvProcessNeighborsAfterFtoCY(int numberOfNodes, int level, int arrayIndex) -{ - this->getParH(level)->recvProcessNeighborsAfterFtoCY[arrayIndex].numberOfNodes = numberOfNodes; - this->getParD(level)->recvProcessNeighborsAfterFtoCY[arrayIndex].numberOfNodes = numberOfNodes; - this->getParH(level)->recvProcessNeighborsAfterFtoCY[arrayIndex].memsizeFs = sizeof(real) * numberOfNodes; - this->getParD(level)->recvProcessNeighborsAfterFtoCY[arrayIndex].memsizeFs = sizeof(real) * numberOfNodes; - this->getParH(level)->recvProcessNeighborsAfterFtoCY[arrayIndex].numberOfFs = this->D3Qxx * numberOfNodes; - this->getParD(level)->recvProcessNeighborsAfterFtoCY[arrayIndex].numberOfFs = this->D3Qxx * numberOfNodes; -} -void Parameter::setRecvProcessNeighborsAfterFtoCZ(int numberOfNodes, int level, int arrayIndex) -{ - this->getParH(level)->recvProcessNeighborsAfterFtoCZ[arrayIndex].numberOfNodes = numberOfNodes; - this->getParD(level)->recvProcessNeighborsAfterFtoCZ[arrayIndex].numberOfNodes = numberOfNodes; - this->getParH(level)->recvProcessNeighborsAfterFtoCZ[arrayIndex].memsizeFs = sizeof(real) * numberOfNodes; - this->getParD(level)->recvProcessNeighborsAfterFtoCZ[arrayIndex].memsizeFs = sizeof(real) * numberOfNodes; - this->getParH(level)->recvProcessNeighborsAfterFtoCZ[arrayIndex].numberOfFs = this->D3Qxx * numberOfNodes; - this->getParD(level)->recvProcessNeighborsAfterFtoCZ[arrayIndex].numberOfFs = this->D3Qxx * numberOfNodes; -} -void Parameter::setgeomBoundaryNormalX(std::string geomNormalX) -{ - ic.geomNormalX = geomNormalX; -} -void Parameter::setgeomBoundaryNormalY(std::string geomNormalY) -{ - ic.geomNormalY = geomNormalY; -} -void Parameter::setgeomBoundaryNormalZ(std::string geomNormalZ) -{ - ic.geomNormalZ = geomNormalZ; -} -void Parameter::setInflowBoundaryNormalX(std::string inflowNormalX) -{ - ic.inflowNormalX = inflowNormalX; -} -void Parameter::setInflowBoundaryNormalY(std::string inflowNormalY) -{ - ic.inflowNormalY = inflowNormalY; -} -void Parameter::setInflowBoundaryNormalZ(std::string inflowNormalZ) -{ - ic.inflowNormalZ = inflowNormalZ; -} -void Parameter::setOutflowBoundaryNormalX(std::string outflowNormalX) -{ - ic.outflowNormalX = outflowNormalX; -} -void Parameter::setOutflowBoundaryNormalY(std::string outflowNormalY) -{ - ic.outflowNormalY = outflowNormalY; -} -void Parameter::setOutflowBoundaryNormalZ(std::string outflowNormalZ) -{ - ic.outflowNormalZ = outflowNormalZ; -} -void Parameter::setMainKernel(std::string kernel) -{ - this->mainKernel = kernel; - if (kernel.find("Stream") != std::string::npos) - this->kernelNeedsFluidNodeIndicesToRun = true; -} -void Parameter::setMultiKernelOn(bool isOn) -{ - this->multiKernelOn = isOn; -} -void Parameter::setMultiKernelLevel(std::vector< int> kernelLevel) -{ - this->multiKernelLevel = kernelLevel; -} -void Parameter::setMultiKernel(std::vector< std::string> kernel) -{ - this->multiKernel = kernel; -} -void Parameter::setADKernel(std::string adKernel) -{ - this->adKernel = adKernel; -} -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - - -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -//get-methods -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -double* Parameter::getForcesDouble() -{ - return this->hostForcing; -} -real* Parameter::getForcesHost() -{ - return this->forcingH; -} -real* Parameter::getForcesDev() -{ - return this->forcingD; -} -double * Parameter::getQuadricLimitersDouble() -{ - return this->hostQuadricLimiters; -} -real * Parameter::getQuadricLimitersHost() -{ - return this->quadricLimitersH; -} -real * Parameter::getQuadricLimitersDev() -{ - return this->quadricLimitersD; -} -real Parameter::getPhi() -{ - return Phi; -} -real Parameter::getAngularVelocity() -{ - return angularVelocity; -} -real Parameter::getStartXHotWall() -{ - return this->startXHotWall; -} -real Parameter::getEndXHotWall() -{ - return this->endXHotWall; -} -unsigned int Parameter::getStepEnsight() -{ - return this->stepEnsight; -} -unsigned int Parameter::getOutputCount() -{ - return this->outputCount; -} -unsigned int Parameter::getlimitOfNodesForVTK() -{ - return this->limitOfNodesForVTK; -} -unsigned int Parameter::getStartTurn() -{ - return startTurn; -} -std::shared_ptr<LBMSimulationParameter> Parameter::getParD(int level) -{ - return parD[level]; -} -std::shared_ptr<LBMSimulationParameter> Parameter::getParH(int level) -{ - return parH[level]; -} -unsigned int Parameter::getSizeMat(int level) -{ - return parH[level]->size_Mat; -} -unsigned int Parameter::getMemSizereal(int level) -{ - return parH[level]->mem_size_real; -} -unsigned int Parameter::getMemSizeInt(int level) -{ - return parH[level]->mem_size_int; -} -unsigned int Parameter::getMemSizeBool(int level) -{ - return parH[level]->mem_size_bool; -} -unsigned int Parameter::getMemSizerealYZ(int level) -{ - return parH[level]->mem_size_real_yz; -} -int Parameter::getFine() -{ - return fine; -} -int Parameter::getCoarse() -{ - return coarse; -} -int Parameter::getParticleBasicLevel() -{ - return this->particleBasicLevel; -} -int Parameter::getParticleInitLevel() -{ - return this->particleInitLevel; -} -int Parameter::getNumberOfParticles() -{ - return this->numberOfParticles; -} -bool Parameter::getEvenOrOdd(int level) -{ - return parH[level]->evenOrOdd; -} -bool Parameter::getDiffOn() -{ - return diffOn; -} -bool Parameter::getCompOn() -{ - return compOn; -} -int Parameter::getDiffMod() -{ - return diffMod; -} -int Parameter::getFactorNZ() -{ - return factor_gridNZ; -} -int Parameter::getD3Qxx() -{ - return this->D3Qxx; -} -int Parameter::getMaxLevel() -{ - return this->maxlevel; -} -unsigned int Parameter::getTStart() -{ - if (getDoRestart()) - { - return getTimeDoRestart() + 1; - } - else - { - return 1; - } -} -unsigned int Parameter::getTInit() -{ - if (getDoRestart()) - { - return getTimeDoRestart(); - } - else - { - return 0; - } -} -unsigned int Parameter::getTEnd() -{ - return ic.tend; -} -unsigned int Parameter::getTOut() -{ - return ic.tout; -} -unsigned int Parameter::getTStartOut() -{ - return ic.tStartOut; -} -bool Parameter::getCalcMedian() -{ - return ic.calcMedian; -} -bool Parameter::getCalcDragLift() -{ - return this->calcDragLift; -} -bool Parameter::getCalcCp() -{ - return this->calcCp; -} -bool Parameter::getCalcParticle() -{ - return this->calcParticles; -} -bool Parameter::getWriteVeloASCIIfiles() -{ - return this->writeVeloASCII; -} -bool Parameter::getCalcPlaneConc() -{ - return this->calcPlaneConc; -} -int Parameter::getTimeCalcMedStart() -{ - return ic.tCalcMedStart; -} -int Parameter::getTimeCalcMedEnd() -{ - return ic.tCalcMedEnd; -} -std::string Parameter::getOutputPath() -{ - return ic.oPath; -} -std::string Parameter::getOutputPrefix() -{ - return ic.oPrefix; -} -std::string Parameter::getFName() -{ - return ic.fname; -} -bool Parameter::getPrintFiles() -{ - return ic.printFiles; -} -bool Parameter::getReadGeo() -{ - return ic.readGeo; -} -bool Parameter::getCalcTurbulenceIntensity() -{ - return this->calcVelocityAndFluctuations; -} -real Parameter::getDiffusivity() -{ - return ic.Diffusivity; -} -real Parameter::getTemperatureInit() -{ - return ic.Temp; -} -real Parameter::getTemperatureBC() -{ - return ic.TempBC; -} -real Parameter::getViscosity() -{ - return ic.vis; -} -real Parameter::getVelocity() -{ - return ic.u0; -} -real Parameter::getViscosityRatio() -{ - return ic.vis_ratio; -} -real Parameter::getVelocityRatio() -{ - return ic.u0_ratio; -} -real Parameter::getDensityRatio() -{ - return ic.delta_rho; -} -real Parameter::getPressRatio() -{ - return ic.delta_press; -} -real Parameter::getRealX() -{ - return ic.RealX; -} -real Parameter::getRealY() -{ - return ic.RealY; -} -unsigned int Parameter::getPressInID() -{ - return ic.PressInID; -} -unsigned int Parameter::getPressOutID() -{ - return ic.PressOutID; -} -unsigned int Parameter::getPressInZ() -{ - return ic.PressInZ; -} -unsigned int Parameter::getPressOutZ() -{ - return ic.PressOutZ; -} -int Parameter::getMaxDev() -{ - return ic.maxdev; -} -int Parameter::getMyID() -{ - return ic.myid; -} -int Parameter::getNumprocs() -{ - return ic.numprocs; -} -std::vector<uint> Parameter::getDevices() -{ - return ic.devices; -} -std::string Parameter::getGeometryFileC() -{ - return ic.geometryFileC; -} -std::string Parameter::getGeometryFileM() -{ - return ic.geometryFileM; -} -std::string Parameter::getGeometryFileF() -{ - return ic.geometryFileF; -} -real Parameter::getRe() -{ - return ic.Re; -} -real Parameter::getFactorPressBC() -{ - return ic.factorPressBC; -} -std::vector<int> Parameter::getGridX() -{ - return ic.GridX; -} -std::vector<int> Parameter::getGridY() -{ - return ic.GridY; -} -std::vector<int> Parameter::getGridZ() -{ - return ic.GridZ; -} -std::vector<int> Parameter::getDistX() -{ - return ic.DistX; -} -std::vector<int> Parameter::getDistY() -{ - return ic.DistY; -} -std::vector<int> Parameter::getDistZ() -{ - return ic.DistZ; -} -std::vector<real> Parameter::getScaleLBMtoSI() -{ - return ic.scaleLBMtoSI; -} -std::vector<real> Parameter::getTranslateLBMtoSI() -{ - return ic.translateLBMtoSI; -} -std::vector<real> Parameter::getMinCoordX() -{ - return ic.minCoordX; -} -std::vector<real> Parameter::getMinCoordY() -{ - return ic.minCoordY; -} -std::vector<real> Parameter::getMinCoordZ() -{ - return ic.minCoordZ; -} -std::vector<real> Parameter::getMaxCoordX() -{ - return ic.maxCoordX; -} -std::vector<real> Parameter::getMaxCoordY() -{ - return ic.maxCoordY; -} -std::vector<real> Parameter::getMaxCoordZ() -{ - return ic.maxCoordZ; -} -TempforBoundaryConditions* Parameter::getTempH() -{ - return this->TempH; -} -TempforBoundaryConditions* Parameter::getTempD() -{ - return this->TempD; -} -TempVelforBoundaryConditions* Parameter::getTempVelH() -{ - return this->TempVelH; -} -TempVelforBoundaryConditions* Parameter::getTempVelD() -{ - return this->TempVelD; -} -TempPressforBoundaryConditions* Parameter::getTempPressH() -{ - return this->TempPressH; -} -TempPressforBoundaryConditions* Parameter::getTempPressD() -{ - return this->TempPressD; -} -//unsigned int Parameter::getkInflowQ() -//{ -// return this->kInflowQ; -//} -//unsigned int Parameter::getkOutflowQ() -//{ -// return this->kOutflowQ; -//} -//QforBoundaryConditions* Parameter::getQinflowH() -//{ -// return this->QinflowH; -//} -//QforBoundaryConditions* Parameter::getQinflowD() -//{ -// return this->QinflowD; -//} -//QforBoundaryConditions* Parameter::getQoutflowH() -//{ -// return this->QoutflowH; -//} -//QforBoundaryConditions* Parameter::getQoutflowD() -//{ -// return this->QoutflowD; -//} -std::string Parameter::getkFull() -{ - return ic.kFull; -} -std::string Parameter::getgeoFull() -{ - return ic.geoFull; -} -std::string Parameter::getgeoVec() -{ - return ic.geoVec; -} -std::string Parameter::getcoordX() -{ - return ic.coordX; -} -std::string Parameter::getcoordY() -{ - return ic.coordY; -} -std::string Parameter::getcoordZ() -{ - return ic.coordZ; -} -std::string Parameter::getneighborX() -{ - return ic.neighborX; -} -std::string Parameter::getneighborY() -{ - return ic.neighborY; -} -std::string Parameter::getneighborZ() -{ - return ic.neighborZ; -} -std::string Parameter::getneighborWSB() -{ - return ic.neighborWSB; -} -std::string Parameter::getscaleCFC() -{ - return ic.scaleCFC; -} -std::string Parameter::getscaleCFF() -{ - return ic.scaleCFF; -} -std::string Parameter::getscaleFCC() -{ - return ic.scaleFCC; -} -std::string Parameter::getscaleFCF() -{ - return ic.scaleFCF; -} -std::string Parameter::getscaleOffsetCF() -{ - return ic.scaleOffsetCF; -} -std::string Parameter::getscaleOffsetFC() -{ - return ic.scaleOffsetFC; -} -std::string Parameter::getgeomBoundaryBcQs() -{ - return ic.geomBoundaryBcQs; -} -std::string Parameter::getgeomBoundaryBcValues() -{ - return ic.geomBoundaryBcValues; -} -std::string Parameter::getnoSlipBcPos() -{ - return ic.noSlipBcPos; -} -std::string Parameter::getnoSlipBcQs() -{ - return ic.noSlipBcQs; -} -std::string Parameter::getnoSlipBcValue() -{ - return ic.noSlipBcValue; -} -std::string Parameter::getnoSlipBcValues() -{ - return ic.noSlipBcValues; -} -std::string Parameter::getslipBcPos() -{ - return ic.slipBcPos; -} -std::string Parameter::getslipBcQs() -{ - return ic.slipBcQs; -} -std::string Parameter::getslipBcValue() -{ - return ic.slipBcValue; -} -std::string Parameter::getpressBcPos() -{ - return ic.pressBcPos; -} -std::string Parameter::getpressBcQs() -{ - return ic.pressBcQs; -} -std::string Parameter::getpressBcValue() -{ - return ic.pressBcValue; -} -std::string Parameter::getpressBcValues() -{ - return ic.pressBcValues; -} -std::string Parameter::getvelBcQs() -{ - return ic.velBcQs; -} -std::string Parameter::getvelBcValues() -{ - return ic.velBcValues; -} -std::string Parameter::getinletBcQs() -{ - return ic.inletBcQs; -} -std::string Parameter::getinletBcValues() -{ - return ic.inletBcValues; -} -std::string Parameter::getoutletBcQs() -{ - return ic.outletBcQs; -} -std::string Parameter::getoutletBcValues() -{ - return ic.outletBcValues; -} -std::string Parameter::gettopBcQs() -{ - return ic.topBcQs; -} -std::string Parameter::gettopBcValues() -{ - return ic.topBcValues; -} -std::string Parameter::getbottomBcQs() -{ - return ic.bottomBcQs; -} -std::string Parameter::getbottomBcValues() -{ - return ic.bottomBcValues; -} -std::string Parameter::getfrontBcQs() -{ - return ic.frontBcQs; -} -std::string Parameter::getfrontBcValues() -{ - return ic.frontBcValues; -} -std::string Parameter::getbackBcQs() -{ - return ic.backBcQs; -} -std::string Parameter::getbackBcValues() -{ - return ic.backBcValues; -} -std::string Parameter::getwallBcQs() -{ - return ic.wallBcQs; -} -std::string Parameter::getwallBcValues() -{ - return ic.wallBcValues; -} -std::string Parameter::getperiodicBcQs() -{ - return ic.periodicBcQs; -} -std::string Parameter::getperiodicBcValues() -{ - return ic.periodicBcValues; -} -std::string Parameter::getpropellerQs() -{ - return ic.propellerQs; -} -std::string Parameter::getpropellerValues() -{ - return ic.propellerValues; -} -std::string Parameter::getpropellerCylinder() -{ - return ic.propellerCylinder; -} -std::string Parameter::getmeasurePoints() -{ - return ic.measurePoints; -} -std::string Parameter::getLBMvsSI() -{ - return ic.LBMvsSI; -} -std::string Parameter::getnumberNodes() -{ - return ic.numberNodes; -} -std::string Parameter::getcpTop() -{ - return ic.cpTop; -} -std::string Parameter::getcpBottom() -{ - return ic.cpBottom; -} -std::string Parameter::getcpBottom2() -{ - return ic.cpBottom2; -} -std::string Parameter::getConcentration() -{ - return ic.concentration; -} -std::string Parameter::getStreetVelocityFilePath() -{ - return ic.streetVelocity; -} -real Parameter::getclockCycleForMP() -{ - return ic.clockCycleForMP; -} -unsigned int Parameter::getTimeDoCheckPoint() -{ - return ic.tDoCheckPoint; -} -unsigned int Parameter::getTimeDoRestart() -{ - return ic.tDoRestart; -} -bool Parameter::getDoCheckPoint() -{ - return ic.doCheckPoint; -} -bool Parameter::getDoRestart() -{ - return ic.doRestart; -} -bool Parameter::getIsGeo() -{ - return ic.isGeo; -} -bool Parameter::getIsGeoNormal() -{ - return ic.isGeoNormal; -} -bool Parameter::getIsInflowNormal() -{ - return ic.isInflowNormal; -} -bool Parameter::getIsOutflowNormal() -{ - return ic.isOutflowNormal; -} -bool Parameter::getIsCp() -{ - return ic.isCp; -} -bool Parameter::getConcFile() -{ - return ic.isConc; -} -bool Parameter::isStreetVelocityFile() -{ - return ic.streetVelocityFile; -} -bool Parameter::getUseMeasurePoints() -{ - return ic.isMeasurePoints; -} -bool Parameter::getUseWale() -{ - return ic.isWale; -} -bool Parameter::getUseInitNeq() -{ - return ic.isInitNeq; -} -bool Parameter::getSimulatePorousMedia() -{ - return ic.simulatePorousMedia; -} - -bool Parameter::getIsF3() -{ - return this->isF3; + if (sor == "send") { + return (unsigned int)parH[level]->sendProcessNeighborZ.size(); + } else if (sor == "recv") { + return (unsigned int)parH[level]->recvProcessNeighborZ.size(); + } + throw std::runtime_error("getNumberOfProcessNeighborsZ: Parameter string invalid."); } -bool Parameter::getIsBodyForce() -{ - return this->isBodyForce; -} - -bool Parameter::getIsGeometryValues() -{ - return ic.GeometryValues; -} -bool Parameter::getCalc2ndOrderMoments() -{ - return ic.is2ndOrderMoments; -} -bool Parameter::getCalc3rdOrderMoments() -{ - return ic.is3rdOrderMoments; -} -bool Parameter::getCalcHighOrderMoments() -{ - return ic.isHighOrderMoments; -} -bool Parameter::getIsProp() -{ - return ic.isProp; -} -bool Parameter::overWritingRestart(uint t) -{ - return t == getTimeDoRestart(); -} -unsigned int Parameter::getTimestepForMP() -{ - return ic.timeStepForMP; -} -unsigned int Parameter::getTimestepOfCoarseLevel() -{ - return this->timestep; -} -double Parameter::getMemsizeGPU() -{ - return this->memsizeGPU; -} -//1D domain decomposition -std::vector<std::string> Parameter::getPossNeighborFiles(std::string sor) -{ - if (sor=="send") - { - return this->possNeighborFilesSend; - } - else if (sor == "recv") - { - return this->possNeighborFilesRecv; - } - throw std::runtime_error("Parameter string invalid."); -} -unsigned int Parameter::getNumberOfProcessNeighbors(int level, std::string sor) -{ - if (sor=="send") - { - return (unsigned int)parH[level]->sendProcessNeighbor.size(); - } - else if (sor == "recv") - { - return (unsigned int)parH[level]->recvProcessNeighbor.size(); - } - throw std::runtime_error("Parameter string invalid."); -} -bool Parameter::getIsNeighbor() -{ - return this->isNeigbor; -} -//3D domain decomposition -std::vector<std::string> Parameter::getPossNeighborFilesX(std::string sor) -{ - if (sor=="send") - { - return this->possNeighborFilesSendX; - } - else if (sor == "recv") - { - return this->possNeighborFilesRecvX; - } - throw std::runtime_error("Parameter string invalid."); -} -std::vector<std::string> Parameter::getPossNeighborFilesY(std::string sor) -{ - if (sor=="send") - { - return this->possNeighborFilesSendY; - } - else if (sor == "recv") - { - return this->possNeighborFilesRecvY; - } - throw std::runtime_error("Parameter string invalid."); -} -std::vector<std::string> Parameter::getPossNeighborFilesZ(std::string sor) -{ - if (sor=="send") - { - return this->possNeighborFilesSendZ; - } - else if (sor == "recv") - { - return this->possNeighborFilesRecvZ; - } - throw std::runtime_error("Parameter string invalid."); -} -unsigned int Parameter::getNumberOfProcessNeighborsX(int level, std::string sor) -{ - if (sor=="send") - { - return (unsigned int)parH[level]->sendProcessNeighborX.size(); - } - else if (sor == "recv") - { - return (unsigned int)parH[level]->recvProcessNeighborX.size(); - } - throw std::runtime_error("getNumberOfProcessNeighborsX: Parameter string invalid."); -} -unsigned int Parameter::getNumberOfProcessNeighborsY(int level, std::string sor) -{ - if (sor=="send") - { - return (unsigned int)parH[level]->sendProcessNeighborY.size(); - } - else if (sor == "recv") - { - return (unsigned int)parH[level]->recvProcessNeighborY.size(); - } - throw std::runtime_error("getNumberOfProcessNeighborsY: Parameter string invalid."); -} -unsigned int Parameter::getNumberOfProcessNeighborsZ(int level, std::string sor) -{ - if (sor=="send") - { - return (unsigned int)parH[level]->sendProcessNeighborZ.size(); - } - else if (sor == "recv") - { - return (unsigned int)parH[level]->recvProcessNeighborZ.size(); - } - throw std::runtime_error("getNumberOfProcessNeighborsZ: Parameter string invalid."); -} - -bool Parameter::getIsNeighborX() -{ - return this->isNeigborX; -} -bool Parameter::getIsNeighborY() -{ - return this->isNeigborY; -} -bool Parameter::getIsNeighborZ() -{ - return this->isNeigborZ; -} -std::string Parameter::getgeomBoundaryNormalX() -{ - return ic.geomNormalX; -} -std::string Parameter::getgeomBoundaryNormalY() -{ - return ic.geomNormalY; -} -std::string Parameter::getgeomBoundaryNormalZ() -{ - return ic.geomNormalZ; -} -std::string Parameter::getInflowBoundaryNormalX() -{ - return ic.inflowNormalX; -} -std::string Parameter::getInflowBoundaryNormalY() -{ - return ic.inflowNormalY; -} -std::string Parameter::getInflowBoundaryNormalZ() -{ - return ic.inflowNormalZ; -} -std::string Parameter::getOutflowBoundaryNormalX() -{ - return ic.outflowNormalX; -} -std::string Parameter::getOutflowBoundaryNormalY() -{ - return ic.outflowNormalY; -} -std::string Parameter::getOutflowBoundaryNormalZ() -{ - return ic.outflowNormalZ; -} -curandState* Parameter::getRandomState() -{ - return this->devState; -} - -std::string Parameter::getMainKernel() -{ - return mainKernel; -} -bool Parameter::getMultiKernelOn() -{ - return multiKernelOn; -} -std::vector< int> Parameter::getMultiKernelLevel() -{ - return multiKernelLevel; -} -std::vector<std::string> Parameter::getMultiKernel() -{ - return multiKernel; -} -std::string Parameter::getADKernel() -{ - return adKernel; -} +bool Parameter::getIsNeighborX() { return this->isNeigborX; } +bool Parameter::getIsNeighborY() { return this->isNeigborY; } +bool Parameter::getIsNeighborZ() { return this->isNeigborZ; } +std::string Parameter::getgeomBoundaryNormalX() { return ic.geomNormalX; } +std::string Parameter::getgeomBoundaryNormalY() { return ic.geomNormalY; } +std::string Parameter::getgeomBoundaryNormalZ() { return ic.geomNormalZ; } +std::string Parameter::getInflowBoundaryNormalX() { return ic.inflowNormalX; } +std::string Parameter::getInflowBoundaryNormalY() { return ic.inflowNormalY; } +std::string Parameter::getInflowBoundaryNormalZ() { return ic.inflowNormalZ; } +std::string Parameter::getOutflowBoundaryNormalX() { return ic.outflowNormalX; } +std::string Parameter::getOutflowBoundaryNormalY() { return ic.outflowNormalY; } +std::string Parameter::getOutflowBoundaryNormalZ() { return ic.outflowNormalZ; } +curandState *Parameter::getRandomState() { return this->devState; } + +std::string Parameter::getMainKernel() { return mainKernel; } +bool Parameter::getMultiKernelOn() { return multiKernelOn; } +std::vector<int> Parameter::getMultiKernelLevel() { return multiKernelLevel; } +std::vector<std::string> Parameter::getMultiKernel() { return multiKernel; } +std::string Parameter::getADKernel() { return adKernel; } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -void Parameter::setInitialCondition(std::function<void(real,real,real,real&,real&,real&,real&)> initialCondition) +void Parameter::setInitialCondition( + std::function<void(real, real, real, real &, real &, real &, real &)> initialCondition) { this->initialCondition = initialCondition; } -std::function<void(real,real,real,real&,real&,real&,real&)>& Parameter::getInitialCondition() +std::function<void(real, real, real, real &, real &, real &, real &)> &Parameter::getInitialCondition() { return this->initialCondition; } -real Parameter::TrafoXtoWorld(int CoordX, int level) -{ - return (parH[level]->mTtoWx*CoordX+parH[level]->cTtoWx); -} -real Parameter::TrafoYtoWorld(int CoordY, int level) -{ - return (parH[level]->mTtoWy*CoordY+parH[level]->cTtoWy); -} -real Parameter::TrafoZtoWorld(int CoordZ, int level) -{ - return (parH[level]->mTtoWz*CoordZ+parH[level]->cTtoWz); -} +real Parameter::TrafoXtoWorld(int CoordX, int level) { return (parH[level]->mTtoWx * CoordX + parH[level]->cTtoWx); } +real Parameter::TrafoYtoWorld(int CoordY, int level) { return (parH[level]->mTtoWy * CoordY + parH[level]->cTtoWy); } +real Parameter::TrafoZtoWorld(int CoordZ, int level) { return (parH[level]->mTtoWz * CoordZ + parH[level]->cTtoWz); } real Parameter::TrafoXtoMGsWorld(int CoordX, int level) { real temp = 0; - for (int i = 0; i <= level; i++) - { + for (int i = 0; i <= level; i++) { temp += (parH[i]->XdistKn + 0.25f) * 2.f * parH[i]->dx; } - temp += (real)((CoordX ) * parH[level]->dx); + temp += (real)((CoordX)*parH[level]->dx); return temp; } real Parameter::TrafoYtoMGsWorld(int CoordY, int level) { real temp = 0; - for (int i = 0; i <= level; i++) - { + for (int i = 0; i <= level; i++) { temp += (parH[i]->YdistKn + 0.25f) * 2.f * parH[i]->dx; } - temp += (real)((CoordY ) * parH[level]->dx); + temp += (real)((CoordY)*parH[level]->dx); return temp; } real Parameter::TrafoZtoMGsWorld(int CoordZ, int level) { real temp = 0; - for (int i = 0; i <= level; i++) - { + for (int i = 0; i <= level; i++) { temp += (parH[i]->ZdistKn + 0.25f) * 2.f * parH[i]->dx; } - temp += (real)((CoordZ) * parH[level]->dx); + temp += (real)((CoordZ)*parH[level]->dx); return temp; } -void Parameter::setUseStreams() { - this->useStreams = true; - this->cudaStreamManager = std::make_unique<CudaStreamManager>(); +void Parameter::setUseStreams(bool useStreams) +{ + if (useStreams) { + if (this->getNumprocs() != 1) { + this->useStreams = useStreams; + this->cudaStreamManager = std::make_unique<CudaStreamManager>(); + return; + } else { + std::cout << "Can't use streams with only one process!" << std::endl; + } + } + this->useStreams = false; } bool Parameter::getUseStreams() { return this->useStreams; } @@ -2575,7 +1389,8 @@ std::unique_ptr<CudaStreamManager> &Parameter::getStreamManager() { return this- bool Parameter::getKernelNeedsFluidNodeIndicesToRun() { return this->kernelNeedsFluidNodeIndicesToRun; } -void Parameter::findEdgeNodesCommMultiGPU() { +void Parameter::findEdgeNodesCommMultiGPU() +{ for (uint level = 0; level < parH.size(); level++) { findEdgeNodesXY(level); findEdgeNodesXZ(level); @@ -2587,25 +1402,23 @@ void Parameter::findEdgeNodesXY(int level) { int indexOfProcessNeighborSend; int indexInSendBuffer; - for (uint i = 0; i < (unsigned int)(this->getNumberOfProcessNeighborsX(level, "recv")); i++) - { + for (uint i = 0; i < (unsigned int)(this->getNumberOfProcessNeighborsX(level, "recv")); i++) { for (int j = 0; j < parH[level]->recvProcessNeighborX[i].numberOfNodes; j++) { - int index = parH[level]->recvProcessNeighborX[i].index[j]; + int index = parH[level]->recvProcessNeighborX[i].index[j]; bool foundIndex = findIndexInSendNodesXY(level, index, indexOfProcessNeighborSend, indexInSendBuffer); - if (foundIndex){ + if (foundIndex) { this->parH[level]->edgeNodesXtoY.emplace_back(i, j, indexOfProcessNeighborSend, indexInSendBuffer); } - } + } } } bool Parameter::findIndexInSendNodesXY(int level, int index, int &indexOfProcessNeighborSend, int &indexInSendBuffer) { - for (uint k = 0; k < (unsigned int)(this->getNumberOfProcessNeighborsY(level, "send")); k++) - { - for (int l = 0; l < parH[level]->sendProcessNeighborY[k].numberOfNodes; l++) - { - if (parH[level]->sendProcessNeighborY[k].index[l] == index) {; + for (uint k = 0; k < (unsigned int)(this->getNumberOfProcessNeighborsY(level, "send")); k++) { + for (int l = 0; l < parH[level]->sendProcessNeighborY[k].numberOfNodes; l++) { + if (parH[level]->sendProcessNeighborY[k].index[l] == index) { + ; indexOfProcessNeighborSend = k; indexInSendBuffer = l; return true; @@ -2619,12 +1432,11 @@ void Parameter::findEdgeNodesXZ(int level) { int indexOfProcessNeighborSend; int indexInSendBuffer; - for (uint i = 0; i < (unsigned int)(this->getNumberOfProcessNeighborsX(level, "recv")); i++) - { + for (uint i = 0; i < (unsigned int)(this->getNumberOfProcessNeighborsX(level, "recv")); i++) { for (int j = 0; j < parH[level]->recvProcessNeighborX[i].numberOfNodes; j++) { int index = parH[level]->recvProcessNeighborX[i].index[j]; bool foundIndex = findIndexInSendNodesXZ(level, index, indexOfProcessNeighborSend, indexInSendBuffer); - if (foundIndex){ + if (foundIndex) { this->parH[level]->edgeNodesXtoZ.emplace_back(i, j, indexOfProcessNeighborSend, indexInSendBuffer); } } @@ -2633,8 +1445,8 @@ void Parameter::findEdgeNodesXZ(int level) bool Parameter::findIndexInSendNodesXZ(int level, int index, int &indexOfProcessNeighborSend, int &indexInSendBuffer) { - for (uint k = 0; k < (unsigned int)(this->getNumberOfProcessNeighborsZ(level, "send")); k++){ - for (int l = 0; l < parH[level]->sendProcessNeighborZ[k].numberOfNodes; l++){ + for (uint k = 0; k < (unsigned int)(this->getNumberOfProcessNeighborsZ(level, "send")); k++) { + for (int l = 0; l < parH[level]->sendProcessNeighborZ[k].numberOfNodes; l++) { if (parH[level]->sendProcessNeighborZ[k].index[l] == index) { indexOfProcessNeighborSend = k; indexInSendBuffer = l; @@ -2645,15 +1457,15 @@ bool Parameter::findIndexInSendNodesXZ(int level, int index, int &indexOfProcess return false; } -void Parameter::findEdgeNodesYZ(int level) +void Parameter::findEdgeNodesYZ(int level) { int indexOfProcessNeighborSend; int indexInSendBuffer; - for (uint i = 0; i < (unsigned int)(this->getNumberOfProcessNeighborsY(level, "recv")); i++){ + for (uint i = 0; i < (unsigned int)(this->getNumberOfProcessNeighborsY(level, "recv")); i++) { for (int j = 0; j < parH[level]->recvProcessNeighborY[i].numberOfNodes; j++) { - int index = parH[level]->recvProcessNeighborY[i].index[j]; + int index = parH[level]->recvProcessNeighborY[i].index[j]; bool foundIndex = findIndexInSendNodesYZ(level, index, indexOfProcessNeighborSend, indexInSendBuffer); - if (foundIndex){ + if (foundIndex) { this->parH[level]->edgeNodesYtoZ.emplace_back(i, j, indexOfProcessNeighborSend, indexInSendBuffer); } } @@ -2662,8 +1474,8 @@ void Parameter::findEdgeNodesYZ(int level) bool Parameter::findIndexInSendNodesYZ(int level, int index, int &indexOfProcessNeighborSend, int &indexInSendBuffer) { - for (uint k = 0; k < (unsigned int)(this->getNumberOfProcessNeighborsZ(level, "send")); k++){ - for (int l = 0; l < parH[level]->sendProcessNeighborZ[k].numberOfNodes; l++){ + for (uint k = 0; k < (unsigned int)(this->getNumberOfProcessNeighborsZ(level, "send")); k++) { + for (int l = 0; l < parH[level]->sendProcessNeighborZ[k].numberOfNodes; l++) { if (parH[level]->sendProcessNeighborZ[k].index[l] == index) { indexOfProcessNeighborSend = k; indexInSendBuffer = l; @@ -2676,10 +1488,8 @@ bool Parameter::findIndexInSendNodesYZ(int level, int index, int &indexOfProcess void Parameter::initNumberOfProcessNeighborsAfterFtoCX(int level) { - this->getParH(level)->sendProcessNeighborsAfterFtoCX.resize( - this->getParH(level)->sendProcessNeighborX.size()); - this->getParH(level)->recvProcessNeighborsAfterFtoCX.resize( - this->getParH(level)->recvProcessNeighborX.size()); + this->getParH(level)->sendProcessNeighborsAfterFtoCX.resize(this->getParH(level)->sendProcessNeighborX.size()); + this->getParH(level)->recvProcessNeighborsAfterFtoCX.resize(this->getParH(level)->recvProcessNeighborX.size()); this->getParD(level)->sendProcessNeighborsAfterFtoCX.resize( this->getParH(level)->sendProcessNeighborsAfterFtoCX.size()); this->getParD(level)->recvProcessNeighborsAfterFtoCX.resize( @@ -2688,10 +1498,8 @@ void Parameter::initNumberOfProcessNeighborsAfterFtoCX(int level) void Parameter::initNumberOfProcessNeighborsAfterFtoCY(int level) { - this->getParH(level)->sendProcessNeighborsAfterFtoCY.resize( - this->getParH(level)->sendProcessNeighborY.size()); - this->getParH(level)->recvProcessNeighborsAfterFtoCY.resize( - this->getParH(level)->recvProcessNeighborY.size()); + this->getParH(level)->sendProcessNeighborsAfterFtoCY.resize(this->getParH(level)->sendProcessNeighborY.size()); + this->getParH(level)->recvProcessNeighborsAfterFtoCY.resize(this->getParH(level)->recvProcessNeighborY.size()); this->getParD(level)->sendProcessNeighborsAfterFtoCY.resize( this->getParH(level)->sendProcessNeighborsAfterFtoCY.size()); this->getParD(level)->recvProcessNeighborsAfterFtoCY.resize( @@ -2700,10 +1508,8 @@ void Parameter::initNumberOfProcessNeighborsAfterFtoCY(int level) void Parameter::initNumberOfProcessNeighborsAfterFtoCZ(int level) { - this->getParH(level)->sendProcessNeighborsAfterFtoCZ.resize( - this->getParH(level)->sendProcessNeighborZ.size()); - this->getParH(level)->recvProcessNeighborsAfterFtoCZ.resize( - this->getParH(level)->recvProcessNeighborZ.size()); + this->getParH(level)->sendProcessNeighborsAfterFtoCZ.resize(this->getParH(level)->sendProcessNeighborZ.size()); + this->getParH(level)->recvProcessNeighborsAfterFtoCZ.resize(this->getParH(level)->recvProcessNeighborZ.size()); this->getParD(level)->sendProcessNeighborsAfterFtoCZ.resize( this->getParH(level)->sendProcessNeighborsAfterFtoCZ.size()); this->getParD(level)->recvProcessNeighborsAfterFtoCZ.resize( diff --git a/src/gpu/VirtualFluids_GPU/Parameter/Parameter.h b/src/gpu/VirtualFluids_GPU/Parameter/Parameter.h index d351309b4..cdedfa1e2 100644 --- a/src/gpu/VirtualFluids_GPU/Parameter/Parameter.h +++ b/src/gpu/VirtualFluids_GPU/Parameter/Parameter.h @@ -890,12 +890,18 @@ private: // initial condition std::function<void(real, real, real, real &, real &, real &, real &)> initialCondition; + + //////////////////////////////////////////////////////////////////////////// // cuda streams + + //! determines whether streams and thus communication hiding should be used bool useStreams{ false }; std::unique_ptr<CudaStreamManager> cudaStreamManager; public: - void setUseStreams(); + //! sets whether streams and thus communication hiding should be used + /*! This function is only useful for simulations on multiple GPUs. If there is only one MPI process, the passed value is automatically overwritten with false. */ + void setUseStreams(bool useStreams); bool getUseStreams(); std::unique_ptr<CudaStreamManager> &getStreamManager(); bool getKernelNeedsFluidNodeIndicesToRun(); -- GitLab