diff --git a/src/Traffic/TrafficMovementFactory.cpp b/src/Traffic/TrafficMovementFactory.cpp index 1b8879cfec6990b7c8a25eb24871b0b52701b576..dbdeb163765b2497e600a44fb0c1a0c0f8f2ef4d 100644 --- a/src/Traffic/TrafficMovementFactory.cpp +++ b/src/Traffic/TrafficMovementFactory.cpp @@ -33,18 +33,23 @@ void TrafficMovementFactory::initTrafficMovement(real * pconcArrayStart) uint vehicleLength = 7; - //StreetPointFinder - finder.readStreets("C:/Users/hiwi/BaselDokumente/VirtualFluidsGPU/git/targets/apps/LBM/streetTest/resources/ExampleStreets.txt"); - finder.writeVTK("C:/Users/hiwi/BaselDokumente/Basel_Ergebnisse/ExampleStreets.vtk"); + //StreetPointFinder M:\Basel2019 C:\Users\schoen\Desktop\git\MS2 + finder.readStreets("C:/Users/schoen/Desktop/git/MS2/git/targets/apps/LBM/streetTest/resources/ExampleStreets.txt"); + finder.writeVTK("M:/Basel2019/results/ExampleStreets.vtk"); + //finder.readStreets("C:/Users/hiwi/BaselDokumente/VirtualFluidsGPU/git/targets/apps/LBM/streetTest/resources/ExampleStreets.txt"); + //finder.writeVTK("C:/Users/hiwi/BaselDokumente/Basel_Ergebnisse/ExampleStreets.vtk"); JunctionReader junctionReader; - junctionReader.readJunctions("C:/Users/hiwi/BaselDokumente/VirtualFluidsGPU/git/targets/apps/LBM/Basel/resources/Junctions.txt", finder); + junctionReader.readJunctions("C:/Users/schoen/Desktop/git/MS2/git/targets/apps/LBM/Basel/resources/Junctions.txt", finder); + //junctionReader.readJunctions("C:/Users/hiwi/BaselDokumente/VirtualFluidsGPU/git/targets/apps/LBM/Basel/resources/Junctions.txt", finder); SinkReader sinkReader; - sinkReader.readSinks("C:/Users/hiwi/BaselDokumente/VirtualFluidsGPU/git/targets/apps/LBM/Basel/resources/Sinks.txt", finder); + sinkReader.readSinks("C:/Users/schoen/Desktop/git/MS2/git/targets/apps/LBM/Basel/resources/Sinks.txt", finder); + //sinkReader.readSinks("C:/Users/hiwi/BaselDokumente/VirtualFluidsGPU/git/targets/apps/LBM/Basel/resources/Sinks.txt", finder); SourceReader sourceReader; - sourceReader.readSources("C:/Users/hiwi/BaselDokumente/VirtualFluidsGPU/git/targets/apps/LBM/Basel/resources/Sources.txt", finder); + sourceReader.readSources("C:/Users/schoen/Desktop/git/MS2/git/targets/apps/LBM/Basel/resources/Sources.txt", finder); + //sourceReader.readSources("C:/Users/hiwi/BaselDokumente/VirtualFluidsGPU/git/targets/apps/LBM/Basel/resources/Sources.txt", finder); //calculate RoadLength uint roadLength = 0; @@ -92,7 +97,8 @@ void TrafficMovementFactory::initTrafficMovement(real * pconcArrayStart) simulator->setConcentrationOutwriter(move(writer)); //prepare writing to vtk - this->outputPath = "C:/Users/hiwi/BaselDokumente/Basel_Ergebnisse/"; + this->outputPath = "M:/Basel2019/results/"; + //this->outputPath = "C:/Users/hiwi/BaselDokumente/Basel_Ergebnisse/"; this->outputFilename = "ExampleStreets"; this->cars = &(simulator->getVehiclesForVTK()); diff --git a/src/VirtualFluids_GPU/DataStructureInitializer/GridReaderFiles/GridReader.cpp b/src/VirtualFluids_GPU/DataStructureInitializer/GridReaderFiles/GridReader.cpp index 71fac9174ed04e219f317715227ef2fff1e0db32..4ae86aead450250b696435db0c8b22bb0fef1f35 100644 --- a/src/VirtualFluids_GPU/DataStructureInitializer/GridReaderFiles/GridReader.cpp +++ b/src/VirtualFluids_GPU/DataStructureInitializer/GridReaderFiles/GridReader.cpp @@ -696,6 +696,10 @@ void GridReader::allocArrays_BoundaryValues() //Indexarray obj_Conc->initIndex(para->getParH(i)->concIndex, i); //////////////////////////////////////////////////////////////////////////// + //concentration + for (int j = 0; j < temp; j++) + para->getParH(i)->concentration[j] = (real)0.0; + //////////////////////////////////////////////////////////////////////////// para->cudaCopyConcFile(i); //////////////////////////////////////////////////////////////////////////// } diff --git a/src/VirtualFluids_GPU/GPU/AdvecDiffBCs27.cu b/src/VirtualFluids_GPU/GPU/AdvecDiffBCs27.cu index a66fd44a3b4a40b41815fbbc465bd3284a0ac9fa..a65e493be32ee73cc77355badca1ee593726f1cf 100644 --- a/src/VirtualFluids_GPU/GPU/AdvecDiffBCs27.cu +++ b/src/VirtualFluids_GPU/GPU/AdvecDiffBCs27.cu @@ -2781,7 +2781,7 @@ extern "C" __global__ void QADDirichlet27( int inx, real feq27_BSE = c1over216*ConcD*(one+three*( vx1-vx2-vx3)+c9over2*( vx1-vx2-vx3)*( vx1-vx2-vx3)-cu_sq); real feq27_TNW = c1over216*ConcD*(one+three*(-vx1+vx2+vx3)+c9over2*(-vx1+vx2+vx3)*(-vx1+vx2+vx3)-cu_sq); //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - real TempD = one;//temp[k]; + real TempD = temp[k];//one;//temp[k]; //real feqW27_ZERO = c8over27* TempD*(one-cu_sq); real feqW27_E = c2over27* TempD*(one+three*( vx1 )+c9over2*( vx1 )*( vx1 )-cu_sq); diff --git a/src/VirtualFluids_GPU/LBM/Simulation.cpp b/src/VirtualFluids_GPU/LBM/Simulation.cpp index 85de964767a3d2e436556ed79054e771ceaacff7..35ffe8fed3122c299d0131bb10726eceef2e4962 100644 --- a/src/VirtualFluids_GPU/LBM/Simulation.cpp +++ b/src/VirtualFluids_GPU/LBM/Simulation.cpp @@ -178,7 +178,7 @@ void Simulation::init(SPtr<Parameter> para, SPtr<GridProvider> gridProvider, std //Init Traffic by Anna ////////////////////////////////////////////////////////////////////////// factory = new TrafficMovementFactory(); - factory->initTrafficMovement(/*para->getParH(0)->c*/); + factory->initTrafficMovement(para->getParH(0)->concentration); ////////////////////////////////////////////////////////////////////////// @@ -1067,7 +1067,10 @@ void Simulation::run() //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //Calculate Traffic by Anna if (t % 100 == 0) - factory->calculateTimestep(t/100, t); + { + factory->calculateTimestep(t / 100, t); + para->cudaCopyConcFile(0); + } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -1096,7 +1099,7 @@ void Simulation::run() //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //Street Manhattan - never use again, please QADDirichletDev27( para->getParD(0)->numberofthreads, para->getParD(0)->nx, para->getParD(0)->ny, - para->getParD(0)->d0SP.f[0], para->getParD(0)->d27.f[0], para->getParD(0)->TempVel.tempPulse, + para->getParD(0)->d0SP.f[0], para->getParD(0)->d27.f[0], para->getParD(0)->concentration, //para->getParD(0)->TempVel.tempPulse, para->getParD(0)->diffusivity, para->getParD(0)->concIndex, para->getParD(0)->QGeom.q27[0], para->getParD(0)->QGeom.kQ, para->getParD(0)->numberOfPointsConc, para->getParD(0)->omega, para->getParD(0)->neighborX_SP, para->getParD(0)->neighborY_SP, para->getParD(0)->neighborZ_SP, diff --git a/src/VirtualFluids_GPU/Parameter/Parameter.cpp b/src/VirtualFluids_GPU/Parameter/Parameter.cpp index 6826c53690477f54c233e260d8cf0d260bbb9a8e..8be84ea0e0b13d146a5e47b5985714f58740cb7e 100644 --- a/src/VirtualFluids_GPU/Parameter/Parameter.cpp +++ b/src/VirtualFluids_GPU/Parameter/Parameter.cpp @@ -2765,28 +2765,33 @@ void Parameter::cudaFreePlaneConc(int lev) //concentration file void Parameter::cudaAllocConcFile(int lev) { - unsigned int mem_size_int = sizeof(unsigned int) * parH[lev]->numberOfPointsConc; + unsigned int mem_size_int = sizeof(unsigned int) * parH[lev]->numberOfPointsConc; + unsigned int mem_size_real = sizeof(real) * parH[lev]->numberOfPointsConc; - printf("numberOfPointsConc = %d \n", mem_size_int); //Host - checkCudaErrors( cudaMallocHost((void**) &(parH[lev]->concIndex), mem_size_int )); + checkCudaErrors( cudaMallocHost((void**) &(parH[lev]->concIndex), mem_size_int )); + checkCudaErrors( cudaMallocHost((void**) &(parH[lev]->concentration), mem_size_real )); //Device - checkCudaErrors( cudaMalloc((void**) &(parD[lev]->concIndex), mem_size_int )); + checkCudaErrors( cudaMalloc((void**) &(parD[lev]->concIndex), mem_size_int )); + checkCudaErrors( cudaMalloc((void**) &(parD[lev]->concentration), mem_size_real )); ////////////////////////////////////////////////////////////////////////// - double tmp = (double)mem_size_int; + double tmp = (double)mem_size_int + (double)mem_size_real; setMemsizeGPU(tmp, false); } void Parameter::cudaCopyConcFile(int lev) { - unsigned int mem_size_int = sizeof(unsigned int) * parH[lev]->numberOfPointsConc; + unsigned int mem_size_int = sizeof(unsigned int) * parH[lev]->numberOfPointsConc; + unsigned int mem_size_real = sizeof(real) * parH[lev]->numberOfPointsConc; - checkCudaErrors( cudaMemcpy(parD[lev]->concIndex, parH[lev]->concIndex, mem_size_int, cudaMemcpyHostToDevice)); + checkCudaErrors( cudaMemcpy(parD[lev]->concIndex, parH[lev]->concIndex, mem_size_int, cudaMemcpyHostToDevice)); + checkCudaErrors( cudaMemcpy(parD[lev]->concentration, parH[lev]->concentration, mem_size_real, cudaMemcpyHostToDevice)); } void Parameter::cudaFreeConcFile(int lev) { - checkCudaErrors( cudaFreeHost(parH[lev]->concIndex)); + checkCudaErrors( cudaFreeHost(parH[lev]->concIndex )); + checkCudaErrors( cudaFreeHost(parH[lev]->concentration )); } ////////////////////////////////////////////////////////////////////////// diff --git a/src/VirtualFluids_GPU/Parameter/Parameter.h b/src/VirtualFluids_GPU/Parameter/Parameter.h index d9949443474eea8f4e3c016857871bb895fc97be..3808ebb41183f0f5625694eeb7b4b4174349be13 100644 --- a/src/VirtualFluids_GPU/Parameter/Parameter.h +++ b/src/VirtualFluids_GPU/Parameter/Parameter.h @@ -216,6 +216,7 @@ struct ParameterStruct{ //Concentration//////// int *concIndex; + real *concentration; unsigned int numberOfPointsConc; //deltaPhi diff --git a/targets/apps/LBM/Basel/main.cpp b/targets/apps/LBM/Basel/main.cpp index 3cfd589393a4c8523de27f62111a8ffc7016276c..db7877e21f86069c1a9804192da786a7483eaf77 100644 --- a/targets/apps/LBM/Basel/main.cpp +++ b/targets/apps/LBM/Basel/main.cpp @@ -95,7 +95,7 @@ void multipleLevel(const std::string& configPath) real dx = 1.2; real vx = 0.05; - TriangularMesh* BaselSTL = TriangularMesh::make("C:/Users/hiwi/BaselDokumente/VirtualFluidsGPU/stl/BaselUrbanProfile_066_deg_bridge_All_CLOSED.stl"); + TriangularMesh* BaselSTL = TriangularMesh::make("E:/temp/Basel2019/stl/BaselUrbanProfile_066_deg_bridge_All_CLOSED.stl"); gridBuilder->addCoarseGrid(-256.0, -256.0, - 8.0, 256.0, 256.0, 160.0, dx); @@ -115,23 +115,23 @@ void multipleLevel(const std::string& configPath) ////////////////////////////////////////////////////////////////////////// - gridBuilder->writeGridsToVtk("C:/Users/hiwi/BaselDokumente/Basel_Ergebnisse/grids/BaselUni/Basel_Grid"); + gridBuilder->writeGridsToVtk("E:/temp/Basel2019/grids/BaselUni/Basel_Grid"); - SimulationFileWriter::write("C:/Users/hiwi/BaselDokumente/Basel_Ergebnisse/grids/BaselUni/", gridBuilder, FILEFORMAT::BINARY); + SimulationFileWriter::write("E:/temp/Basel2019/grids/BaselUni/", gridBuilder, FILEFORMAT::BINARY); //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// StreetPointFinder finder; - finder.readStreets("C:/Users/hiwi/BaselDokumente/VirtualFluidsGPU/targets/apps/LBM/streetTest/resources/ExampleStreets.txt"); + finder.readStreets("C:/Users/schoen/Desktop/git/MS/git/targets/apps/LBM/streetTest/resources/ExampleStreets.txt"); - finder.writeVTK("C:/Users/hiwi/BaselDokumente/Basel_Ergebnisse/ExampleStreets.vtk"); + finder.writeVTK("E:/temp/Basel2019/results/ExampleStreets.vtk"); finder.findIndicesLB(gridBuilder->getGrid(0)); - finder.writeConnectionVTK("C:/Users/hiwi/BaselDokumente//Basel_Ergebnisse/grids/BaselUni/Basel_Grid/ExampleStreetsConnection.vtk", gridBuilder->getGrid(0)); + finder.writeConnectionVTK("E:/temp/Basel2019/grids/BaselUni/Basel_Grid/ExampleStreetsConnection.vtk", gridBuilder->getGrid(0)); - finder.writeSimulationFile("C:/Users/hiwi/BaselDokumente/Basel_Ergebnisse/grids/BaselUni/", 1.0, gridBuilder->getNumberOfLevels(), 0); + finder.writeSimulationFile("E:/temp/Basel2019/grids/BaselUni/", 1.0, gridBuilder->getNumberOfLevels(), 0); //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -157,7 +157,7 @@ void multipleLevel(const std::string& configPath) //std::ifstream stream; //stream.open(configPath.c_str(), std::ios::in); - ////if (stream.fail()) + //if (stream.fail()) // throw std::runtime_error("can not open config file!"); //UPtr<input::Input> input = input::Input::makeInput(stream, "config"); @@ -166,6 +166,7 @@ void multipleLevel(const std::string& configPath) SPtr<FileWriter> fileWriter = SPtr<FileWriter>(new FileWriter()); sim.init(para, gridGenerator, fileWriter); sim.run(); + sim.free(); } @@ -197,7 +198,8 @@ int main( int argc, char* argv[]) { try { - multipleLevel("C:/Users/hiwi/Desktop/configBasel.txt"); + //multipleLevel("E:/temp/Basel2019/config/configBasel.txt"); //Tesla03 + multipleLevel("C:/Users/schoen/Desktop/bin/ReleaseBasel/configBasel.txt"); //Baumbart //multipleLevel("F:/Work/Computations/gridGenerator/inp/configTest.txt"); } catch (const std::exception& e) @@ -220,7 +222,7 @@ int main( int argc, char* argv[]) //std::cout << "unknown exeption" << std::endl; } - //std::cout << "\nConfiguration file must be set!: lbmgm <config file>" << std::endl << std::flush; + std::cout << "\nConfiguration file must be set!: lbmgm <config file>" << std::endl << std::flush; //MPI_Abort(MPI_COMM_WORLD, -1); } }