diff --git a/source/Applications.cmake b/source/Applications.cmake index 891ca0b1a663b67a19dd06573b0e4852c70451ec..a3e52074631748c9e9ee02ee4769cbd06d73d0f2 100644 --- a/source/Applications.cmake +++ b/source/Applications.cmake @@ -41,4 +41,5 @@ add_subdirectory(Applications/LaminarTubeFlow) # add_subdirectory(Applications/town) # add_subdirectory(Applications/perm) add_subdirectory(Applications/pChannel) -#add_subdirectory(Applications/pDisk) \ No newline at end of file +#add_subdirectory(Applications/pDisk) +add_subdirectory(Applications/BoxBenchmark) \ No newline at end of file diff --git a/source/Applications/BoxBenchmark/CMakeLists.txt b/source/Applications/BoxBenchmark/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..e54279829a7ff3d44893f355ad10968259fca79a --- /dev/null +++ b/source/Applications/BoxBenchmark/CMakeLists.txt @@ -0,0 +1,25 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 2.8) + +######################################################## +## C++ PROJECT ### +######################################################## +PROJECT(BoxBenchmark) + +INCLUDE(${SOURCE_ROOT}/IncludsList.cmake) + +################################################################# +### LOCAL FILES ### +################################################################# +FILE(GLOB SPECIFIC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.h + ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/*.hpp ) + +SET(ALL_SOURCES ${ALL_SOURCES} ${SPECIFIC_FILES}) +SOURCE_GROUP(src FILES ${SPECIFIC_FILES}) + +SET(CAB_ADDITIONAL_LINK_LIBRARIES VirtualFluids) + +################################################################# +### CREATE PROJECT ### +################################################################# +CREATE_CAB_PROJECT(bb BINARY) diff --git a/source/Applications/BoxBenchmark/bb.cfg b/source/Applications/BoxBenchmark/bb.cfg new file mode 100644 index 0000000000000000000000000000000000000000..4b69ea2a4f7e165c8899396114b5d3208e4be7ce --- /dev/null +++ b/source/Applications/BoxBenchmark/bb.cfg @@ -0,0 +1,20 @@ +pathname = d:/temp/BoxBenchmark +numOfThreads = 1 +availMem = 11e9 + +#Grid +length = 128 128 128 +blocknx = 16 16 16 + +dx = 1 +refineLevel = 0 + +#Simulation +uLB = 0.001 +Re = 10 + + +outTime = 100 +endTime = 100 + +logToFile = false \ No newline at end of file diff --git a/source/Applications/BoxBenchmark/bb.cpp b/source/Applications/BoxBenchmark/bb.cpp new file mode 100644 index 0000000000000000000000000000000000000000..1fe25c83642a1cd466d47956233cd7d392bd560c --- /dev/null +++ b/source/Applications/BoxBenchmark/bb.cpp @@ -0,0 +1,234 @@ +#include <iostream> +#include <string> + +#include "VirtualFluids.h" + +using namespace std; + + +void run(string configname) +{ + try + { + ConfigurationFile config; + config.load(configname); + + string pathname = config.getString("pathname"); + int numOfThreads = config.getInt("numOfThreads"); + vector<int> blocknx = config.getVector<int>("blocknx"); + double uLB = config.getDouble("uLB"); + double endTime = config.getDouble("endTime"); + double outTime = config.getDouble("outTime"); + double availMem = config.getDouble("availMem"); + int refineLevel = config.getInt("refineLevel"); + double Re = config.getDouble("Re"); + double dx = config.getDouble("dx"); + vector<double> length = config.getVector<double>("length"); + bool logToFile = config.getBool("logToFile"); + + CommunicatorPtr comm = MPICommunicator::getInstance(); + int myid = comm->getProcessID(); + + if (logToFile) + { +#if defined(__unix__) + if (myid == 0) + { + const char* str = pathname.c_str(); + mkdir(str, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH); + } +#endif + + if (myid == 0) + { + stringstream logFilename; + logFilename << pathname + "/logfile" + UbSystem::toString(UbSystem::getTimeStamp()) + ".txt"; + UbLog::output_policy::setStream(logFilename.str()); + } + } + + LBMReal dLB = length[1] / dx; + LBMReal rhoLB = 0.0; + LBMReal nuLB = (uLB*dLB) / Re; + + LBMUnitConverterPtr conv = LBMUnitConverterPtr(new LBMUnitConverter()); + + const int baseLevel = 0; + + //bounding box + double g_minX1 = 0.0; + double g_minX2 = 0.0; + double g_minX3 = 0.0; + + double g_maxX1 = length[0]; + double g_maxX2 = length[1]; + double g_maxX3 = length[2]; + + //geometry + GbObject3DPtr box(new GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3)); + //if (myid == 0) GbSystem3D::writeGeoObject(box.get(), pathname + "/geo/box", WbWriterVtkXmlBinary::getInstance()); + + GbObject3DPtr gridCube(new GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3)); + //if (myid == 0) GbSystem3D::writeGeoObject(gridCube.get(), pathname + "/geo/gridCube", WbWriterVtkXmlBinary::getInstance()); + + + double blockLength = blocknx[0] * dx; + + Grid3DPtr grid(new Grid3D(comm)); + + if (myid == 0) + { + UBLOG(logINFO, "uLb = " << uLB); + UBLOG(logINFO, "rho = " << rhoLB); + UBLOG(logINFO, "nuLb = " << nuLB); + UBLOG(logINFO, "Re = " << Re); + UBLOG(logINFO, "dx = " << dx); + UBLOG(logINFO, "length = " << length[0] << " " << length[1] << " " << length[2]); + UBLOG(logINFO, "blocknx = " << blocknx[0] << " " << blocknx[1] << " " << blocknx[2]); + UBLOG(logINFO, "number of levels = " << refineLevel + 1); + UBLOG(logINFO, "number of processes = " << comm->getNumberOfProcesses()); + UBLOG(logINFO, "number of threads = " << numOfThreads); + UBLOG(logINFO, "Preprocess - start"); + } + + grid->setDeltaX(dx); + grid->setBlockNX(blocknx[0], blocknx[1], blocknx[2]); + + //if (myid == 0) GbSystem3D::writeGeoObject(gridCube.get(), pathname + "/geo/gridCube", WbWriterVtkXmlBinary::getInstance()); + + GenBlocksGridVisitor genBlocks(gridCube); + grid->accept(genBlocks); + + //WriteBlocksCoProcessorPtr ppblocks(new WriteBlocksCoProcessor(grid, UbSchedulerPtr(new UbScheduler(1)), pathname, WbWriterVtkXmlBinary::getInstance(), comm)); + + //int bbOption = 1; //0=simple Bounce Back, 1=quadr. BB + //D3Q27BoundaryConditionAdapterPtr bcObst(new D3Q27NoSlipBCAdapter(bbOption)); + //D3Q27InteractorPtr boxInt(new D3Q27Interactor(box, grid, bcObst, Interactor3D::INVERSESOLID)); + + Grid3DVisitorPtr metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::B)); + InteractorsHelper intHelper(grid, metisVisitor); + //intHelper.addInteractor(boxInt); + intHelper.selectBlocks(); + + //set connectors + D3Q27InterpolationProcessorPtr iProcessor(new D3Q27IncompressibleOffsetInterpolationProcessor()); + D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor); + //ConnectorFactoryPtr factory(new Block3DConnectorFactory()); + //ConnectorBlockVisitor setConnsVisitor(comm, nuLB, iProcessor, factory); + grid->accept(setConnsVisitor); + + //domain decomposition for threads + PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads); + grid->accept(pqPartVisitor); + + //ppblocks->process(0); + //ppblocks.reset(); + + unsigned long long numberOfBlocks = (unsigned long long)grid->getNumberOfBlocks(); + int ghostLayer = 3; + unsigned long long numberOfNodesPerBlock = (unsigned long long)(blocknx[0])* (unsigned long long)(blocknx[1])* (unsigned long long)(blocknx[2]); + unsigned long long numberOfNodes = numberOfBlocks * numberOfNodesPerBlock; + unsigned long long numberOfNodesPerBlockWithGhostLayer = numberOfBlocks * (blocknx[0] + ghostLayer) * (blocknx[1] + ghostLayer) * (blocknx[2] + ghostLayer); + double needMemAll = double(numberOfNodesPerBlockWithGhostLayer*(27 * sizeof(double) + sizeof(int) + sizeof(float) * 4)); + double needMem = needMemAll / double(comm->getNumberOfProcesses()); + + if (myid == 0) + { + UBLOG(logINFO, "Number of blocks = " << numberOfBlocks); + UBLOG(logINFO, "Number of nodes = " << numberOfNodes); + int minInitLevel = grid->getCoarsestInitializedLevel(); + int maxInitLevel = grid->getFinestInitializedLevel(); + for (int level = minInitLevel; level <= maxInitLevel; level++) + { + int nobl = grid->getNumberOfBlocks(level); + UBLOG(logINFO, "Number of blocks for level " << level << " = " << nobl); + UBLOG(logINFO, "Number of nodes for level " << level << " = " << nobl*numberOfNodesPerBlock); + } + UBLOG(logINFO, "Necessary memory = " << needMemAll << " bytes"); + UBLOG(logINFO, "Necessary memory per process = " << needMem << " bytes"); + UBLOG(logINFO, "Available memory per process = " << availMem << " bytes"); + } + + LBMKernel3DPtr kernel; + + kernel = LBMKernel3DPtr(new LBMKernelETD3Q27CCLB(blocknx[0], blocknx[1], blocknx[2], LBMKernelETD3Q27CCLB::NORMAL)); + + // + BCProcessorPtr bcProc(new D3Q27ETBCProcessor()); + //BCProcessorPtr bcProc(new D3Q27ETForThinWallBCProcessor()); + BoundaryConditionPtr noSlipBC; + //noSlipBC = BoundaryConditionPtr(new NoSlipBoundaryCondition()); + //noSlipBC = BoundaryConditionPtr(new ThinWallNoSlipBoundaryCondition()); + //bcProc->addBC(noSlipBC); + + kernel->setBCProcessor(bcProc); + + SetKernelBlockVisitor kernelVisitor(kernel, nuLB, availMem, needMem); + grid->accept(kernelVisitor); + + if (refineLevel > 0) + { + D3Q27SetUndefinedNodesBlockVisitor undefNodesVisitor; + grid->accept(undefNodesVisitor); + } + + intHelper.setBC(); + + //BoundaryConditionBlockVisitor bcVisitor; + //grid->accept(bcVisitor); + + //initialization of distributions + D3Q27ETInitDistributionsBlockVisitor initVisitor(nuLB, rhoLB, uLB); + grid->accept(initVisitor); + + //boundary conditions grid + //{ + // UbSchedulerPtr geoSch(new UbScheduler(1)); + // MacroscopicQuantitiesCoProcessorPtr ppgeo( + // new MacroscopicQuantitiesCoProcessor(grid, geoSch, pathname, WbWriterVtkXmlBinary::getInstance(), conv, true)); + // grid->coProcess(0); + //} + + if (myid == 0) UBLOG(logINFO, "Preprocess - end"); + + UbSchedulerPtr visSch(new UbScheduler(outTime)); + //MacroscopicQuantitiesCoProcessor pp(grid, visSch, pathname, WbWriterVtkXmlASCII::getInstance(), conv); + + UbSchedulerPtr nupsSch(new UbScheduler(10, 30, 100)); + NUPSCounterCoProcessor npr(grid, nupsSch, numOfThreads, comm); + + CalculationManagerPtr calculation(new CalculationManager(grid, numOfThreads, endTime, visSch)); + if (myid == 0) UBLOG(logINFO, "Simulation-start"); + calculation->calculate(); + if (myid == 0) UBLOG(logINFO, "Simulation-end"); + } + catch (std::exception& e) + { + cerr << e.what() << endl << flush; + } + catch (std::string& s) + { + cerr << s << endl; + } + catch (...) + { + cerr << "unknown exception" << endl; + } + +} +int main(int argc, char* argv[]) +{ + if (argv != NULL) + { + if (argv[1] != NULL) + { + run(string(argv[1])); + } + else + { + cout << "Configuration file is missing!" << endl; + } + } + +} + diff --git a/source/Applications/LaminarTubeFlow/ltf.cfg b/source/Applications/LaminarTubeFlow/ltf.cfg index c2e66c9307cfba61671d01188f656285afb7dd36..9f3e79821ec20f2f0c9e1df01f16ff068a662687 100644 --- a/source/Applications/LaminarTubeFlow/ltf.cfg +++ b/source/Applications/LaminarTubeFlow/ltf.cfg @@ -1,10 +1,10 @@ -pathname = d:/temp/LaminarTubeFlow +pathname = d:/temp/LaminarTubeFlow1 numOfThreads = 1 -availMem = 1e9 +availMem = 10e9 #Grid length = 64 32 32 -blocknx = 64 32 32 +blocknx = 32 32 32 dx = 1 refineLevel = 0 @@ -13,5 +13,9 @@ uLB = 0.001 Re = 10 -outTime = 100 -endTime = 1000 +outTime = 1000 +endTime = 5000 + +logToFile = false + +restartStep = 10000 \ No newline at end of file diff --git a/source/Applications/LaminarTubeFlow/ltf.cpp b/source/Applications/LaminarTubeFlow/ltf.cpp index b3c3f842cde0b3bf68a8b371f7348fcaa9236876..081e3fdded34fe52e07c97be5a6a4743d1deb5ee 100644 --- a/source/Applications/LaminarTubeFlow/ltf.cpp +++ b/source/Applications/LaminarTubeFlow/ltf.cpp @@ -24,73 +24,103 @@ void run(string configname) double Re = config.getDouble("Re"); double dx = config.getDouble("dx"); vector<double> length = config.getVector<double>("length"); + bool logToFile = config.getBool("logToFile"); + double restartStep = config.getDouble("restartStep"); CommunicatorPtr comm = MPICommunicator::getInstance(); int myid = comm->getProcessID(); + if (logToFile) + { +#if defined(__unix__) + if (myid == 0) + { + const char* str = pathname.c_str(); + mkdir(str, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH); + } +#endif + + if (myid == 0) + { + stringstream logFilename; + logFilename << pathname + "/logfile" + UbSystem::toString(UbSystem::getTimeStamp()) + ".txt"; + UbLog::output_policy::setStream(logFilename.str()); + } + } LBMReal dLB = length[1] / dx; LBMReal rhoLB = 0.0; - LBMReal nuLB = (uLB*dLB)/Re; + LBMReal nuLB = (uLB*dLB) / Re; LBMUnitConverterPtr conv = LBMUnitConverterPtr(new LBMUnitConverter()); const int baseLevel = 0; - //bounding box - double g_minX1 = 0.0; - double g_minX2 = -length[1] / 2.0; - double g_minX3 = -length[2] / 2.0; + Grid3DPtr grid(new Grid3D(comm)); + + ////////////////////////////////////////////////////////////////////////// + //restart + UbSchedulerPtr rSch(new UbScheduler(restartStep, restartStep)); + RestartCoProcessor rp(grid, rSch, comm, pathname, RestartCoProcessor::TXT); + ////////////////////////////////////////////////////////////////////////// - double g_maxX1 = length[0]; - double g_maxX2 = length[1] / 2.0; - double g_maxX3 = length[2] / 2.0; + if (grid->getTimeStep() == 0) + { - //geometry - GbObject3DPtr cylinder(new GbCylinder3D(g_minX1-2.0*dx, 0.0, 0.0, g_maxX1+2.0*dx, 0.0, 0.0, dLB/2.0)); - GbSystem3D::writeGeoObject(cylinder.get(),pathname + "/geo/cylinder", WbWriterVtkXmlBinary::getInstance()); + //bounding box + double g_minX1 = 0.0; + double g_minX2 = -length[1] / 2.0; + double g_minX3 = -length[2] / 2.0; - GbObject3DPtr gridCube(new GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3)); - if (myid == 0) GbSystem3D::writeGeoObject(gridCube.get(), pathname + "/geo/gridCube", WbWriterVtkXmlBinary::getInstance()); + double g_maxX1 = length[0]; + double g_maxX2 = length[1] / 2.0; + double g_maxX3 = length[2] / 2.0; + + //geometry + GbObject3DPtr cylinder(new GbCylinder3D(g_minX1 - 2.0*dx, 0.0, 0.0, g_maxX1 + 2.0*dx, 0.0, 0.0, dLB / 2.0)); + GbSystem3D::writeGeoObject(cylinder.get(), pathname + "/geo/cylinder", WbWriterVtkXmlBinary::getInstance()); + + GbObject3DPtr gridCube(new GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3)); + if (myid == 0) GbSystem3D::writeGeoObject(gridCube.get(), pathname + "/geo/gridCube", WbWriterVtkXmlBinary::getInstance()); + + + double blockLength = blocknx[0] * dx; - - double blockLength = blocknx[0]*dx; - Grid3DPtr grid(new Grid3D(comm)); - if(myid ==0) + if (myid == 0) { - UBLOG(logINFO,"uLb = " << uLB ); - UBLOG(logINFO,"rho = " << rhoLB ); - UBLOG(logINFO,"nuLb = " << nuLB ); - UBLOG(logINFO,"Re = " << Re ); - UBLOG(logINFO,"dx = " << dx ); - UBLOG(logINFO,"Preprocess - start"); + UBLOG(logINFO, "uLb = " << uLB); + UBLOG(logINFO, "rho = " << rhoLB); + UBLOG(logINFO, "nuLb = " << nuLB); + UBLOG(logINFO, "Re = " << Re); + UBLOG(logINFO, "dx = " << dx); + UBLOG(logINFO, "Preprocess - start"); } grid->setDeltaX(dx); grid->setBlockNX(blocknx[0], blocknx[1], blocknx[2]); - if(myid ==0) GbSystem3D::writeGeoObject(gridCube.get(),pathname + "/geo/gridCube", WbWriterVtkXmlBinary::getInstance()); - + if (myid == 0) GbSystem3D::writeGeoObject(gridCube.get(), pathname + "/geo/gridCube", WbWriterVtkXmlBinary::getInstance()); + GenBlocksGridVisitor genBlocks(gridCube); grid->accept(genBlocks); //inflow GbCuboid3DPtr geoInflow(new GbCuboid3D(g_minX1 - 2.0*dx, g_minX2 - dx, g_minX3 - dx, g_minX1, g_maxX2, g_maxX3 + dx)); - if(myid == 0) GbSystem3D::writeGeoObject(geoInflow.get(), pathname+"/geo/geoInflow", WbWriterVtkXmlASCII::getInstance()); + if (myid == 0) GbSystem3D::writeGeoObject(geoInflow.get(), pathname + "/geo/geoInflow", WbWriterVtkXmlASCII::getInstance()); //outflow - GbCuboid3DPtr geoOutflow (new GbCuboid3D(g_maxX1, g_minX2, g_minX3-dx, g_maxX1+2.0*dx, g_maxX2+dx, g_maxX3+dx)); - if(myid == 0) GbSystem3D::writeGeoObject(geoOutflow.get(), pathname+"/geo/geoOutflow", WbWriterVtkXmlASCII::getInstance()); + GbCuboid3DPtr geoOutflow(new GbCuboid3D(g_maxX1, g_minX2, g_minX3 - dx, g_maxX1 + 2.0*dx, g_maxX2 + dx, g_maxX3 + dx)); + if (myid == 0) GbSystem3D::writeGeoObject(geoOutflow.get(), pathname + "/geo/geoOutflow", WbWriterVtkXmlASCII::getInstance()); - WriteBlocksCoProcessorPtr ppblocks(new WriteBlocksCoProcessor(grid, UbSchedulerPtr(new UbScheduler(1)), pathname, WbWriterVtkXmlBinary::getInstance(), comm)); + WriteBlocksCoProcessorPtr ppblocks(new WriteBlocksCoProcessor(grid, UbSchedulerPtr(new UbScheduler(1)), pathname, WbWriterVtkXmlBinary::getInstance(), comm)); ppblocks->process(0); - + int bbOption = 1; //0=simple Bounce Back, 1=quadr. BB D3Q27BoundaryConditionAdapterPtr bcObst(new D3Q27NoSlipBCAdapter(bbOption)); - D3Q27InteractorPtr cylinderInt( new D3Q27Interactor(cylinder, grid, bcObst,Interactor3D::INVERSESOLID)); + D3Q27InteractorPtr cylinderInt(new D3Q27Interactor(cylinder, grid, bcObst, Interactor3D::INVERSESOLID)); double r = boost::dynamic_pointer_cast<GbCylinder3D>(cylinder)->getRadius(); double cx1 = g_minX1; @@ -126,7 +156,7 @@ void run(string configname) D3Q27InterpolationProcessorPtr iProcessor(new D3Q27IncompressibleOffsetInterpolationProcessor()); //D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor); ConnectorFactoryPtr factory(new Block3DConnectorFactory()); - ConnectorBlockVisitor setConnsVisitor(comm, nuLB, iProcessor,factory); + ConnectorBlockVisitor setConnsVisitor(comm, nuLB, iProcessor, factory); grid->accept(setConnsVisitor); //domain decomposition for threads @@ -191,41 +221,69 @@ void run(string configname) } intHelper.setBC(); - + BoundaryConditionBlockVisitor bcVisitor; grid->accept(bcVisitor); - + //initialization of distributions D3Q27ETInitDistributionsBlockVisitor initVisitor(nuLB, rhoLB); grid->accept(initVisitor); //boundary conditions grid + //{ + // UbSchedulerPtr geoSch(new UbScheduler(1)); + // MacroscopicQuantitiesCoProcessorPtr ppgeo( + // new MacroscopicQuantitiesCoProcessor(grid, geoSch, pathname, WbWriterVtkXmlBinary::getInstance(), conv, true)); + // grid->coProcess(0); + //} + + if (myid == 0) UBLOG(logINFO, "Preprocess - end"); + } + else + { + if (myid == 0) { - UbSchedulerPtr geoSch(new UbScheduler(1)); - MacroscopicQuantitiesCoProcessorPtr ppgeo( - new MacroscopicQuantitiesCoProcessor(grid, geoSch, pathname, WbWriterVtkXmlBinary::getInstance(), conv, true)); - grid->coProcess(0); + UBLOG(logINFO, "Parameters:"); + UBLOG(logINFO, "uLb = " << uLB); + UBLOG(logINFO, "rho = " << rhoLB); + UBLOG(logINFO, "nuLb = " << nuLB); + UBLOG(logINFO, "Re = " << Re); + UBLOG(logINFO, "dx = " << dx); + UBLOG(logINFO, "number of levels = " << refineLevel + 1); + UBLOG(logINFO, "numOfThreads = " << numOfThreads); + UBLOG(logINFO, "path = " << pathname); } - if (myid == 0) UBLOG(logINFO, "Preprocess - end"); + //BoundaryConditionBlockVisitor bcVisitor; + //grid->accept(bcVisitor); + + //set connectors + D3Q27InterpolationProcessorPtr iProcessor(new D3Q27IncompressibleOffsetInterpolationProcessor()); + D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor); + grid->accept(setConnsVisitor); + if (myid == 0) UBLOG(logINFO, "Restart - end"); + } UbSchedulerPtr visSch(new UbScheduler(outTime)); MacroscopicQuantitiesCoProcessor pp(grid, visSch, pathname, WbWriterVtkXmlASCII::getInstance(), conv); + UbSchedulerPtr nupsSch(new UbScheduler(10, 30, 100)); + NUPSCounterCoProcessor npr(grid, nupsSch, numOfThreads, comm); + CalculationManagerPtr calculation(new CalculationManager(grid, numOfThreads, endTime, visSch)); - if(myid == 0) UBLOG(logINFO,"Simulation-start"); + if (myid == 0) UBLOG(logINFO, "Simulation-start"); calculation->calculate(); - if(myid == 0) UBLOG(logINFO,"Simulation-end"); + if (myid == 0) UBLOG(logINFO, "Simulation-end"); } - catch(std::exception& e) + catch (std::exception& e) { cerr << e.what() << endl << flush; } - catch(std::string& s) + catch (std::string& s) { cerr << s << endl; } - catch(...) + catch (...) { cerr << "unknown exception" << endl; } diff --git a/source/Applications/pChannel/configBombadilpChannel.cfg b/source/Applications/pChannel/configBombadilpChannel.cfg index 31bb2040c8a303e8700fb0fcff6bfa4b8d148df7..447ff3508fe432aa9d4e633bdf06c9bf0dcc55ff 100644 --- a/source/Applications/pChannel/configBombadilpChannel.cfg +++ b/source/Applications/pChannel/configBombadilpChannel.cfg @@ -4,7 +4,7 @@ pathname = d:/temp/pChannel pathGeo = d:/Projects/SFB880/GeometrienPoroeseMedien/PA80-110 -numOfThreads = 4 +numOfThreads = 1 availMem = 4e9 logToFile = false @@ -65,7 +65,7 @@ deltaXfine = 20e-6 blocknx = 10 10 10 #blocknx = 32 40 20 lengthFactor = 4 -thinWall = true +thinWall = false forcing = 1e-6 changeQs = false @@ -84,13 +84,13 @@ Re = 51000 #real velocity is 54.95 m/s u_LB = 0.1 -restartStep = 200000 -restartStepStart=200000 +restartStep = 3 +restartStepStart=3 -timeAvStart = 1 -timeAvStop = 3 +timeAvStart = 100 +timeAvStop = 300 -endTime = 200000 -outTime = 100 +endTime = 3 +outTime = 3 diff --git a/source/Applications/pChannel/pChannel.cpp b/source/Applications/pChannel/pChannel.cpp index 2e202ca04efd98ef8cb3269cb73de5e5ac48f114..95b37065baab2871b2537e24891ac8f9ab870f12 100644 --- a/source/Applications/pChannel/pChannel.cpp +++ b/source/Applications/pChannel/pChannel.cpp @@ -95,7 +95,7 @@ void run(string configname) ////////////////////////////////////////////////////////////////////////// //restart UbSchedulerPtr rSch(new UbScheduler(restartStep, restartStepStart)); - RestartCoProcessor rp(grid, rSch, comm, pathname, RestartCoProcessor::TXT); + RestartCoProcessor rp(grid, rSch, comm, pathname, RestartCoProcessor::BINARY); ////////////////////////////////////////////////////////////////////////// if (grid->getTimeStep() == 0) diff --git a/source/Applications/sphere/sphere.cpp b/source/Applications/sphere/sphere.cpp index 4d03c01f2e66269818555f32dc77037c00fbb3bb..85e33ed1563e578c7d1a4f073290cf8596f71245 100644 --- a/source/Applications/sphere/sphere.cpp +++ b/source/Applications/sphere/sphere.cpp @@ -88,8 +88,6 @@ void run(string configname) grid->setDeltaX(dx); grid->setBlockNX(blocknx1, blocknx2, blocknx3); - BoundaryConditionProcessorPtr bcProcessor(new BoundaryConditionProcessor()); - ////////////////////////////////////////////////////////////////////////// //restart UbSchedulerPtr restartSch(new UbScheduler(100000, 100000, 100000)); diff --git a/source/CMake/compilerflags/icc150.cmake b/source/CMake/compilerflags/icc150.cmake new file mode 100644 index 0000000000000000000000000000000000000000..7c5abc3a0fe053af90fd171a12432130afe34eef --- /dev/null +++ b/source/CMake/compilerflags/icc150.cmake @@ -0,0 +1,38 @@ +############################################################################################################### +## +## intel150 +## +############################################################################################################### + +MACRO(SET_COMPILER_SPECIFIC_FLAGS_INTERN build_type use64BitOptions) + + #~ IF( ${use64BitOptions} ) + #~ LIST(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "-D__amd64" ) + #~ ENDIF() + + LIST(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "-O") + #~ LIST(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "-wd654") + #~ LIST(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "-wd1125") #virtual function override intended + #~ LIST(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "-wd1224") #warning directive: This file includes at least one deprecated or antiquated header + #~ LIST(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "-wd377") #class "std::auto_ptr<RCF::I_ClientTransport>" has no suitable copy constructor + #~ LIST(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "-wd327") #class "std::auto_ptr<RCF::I_ClientTransport>" has no suitable copy constructor + #~ LIST(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "-wd327") #class "std::auto_ptr<RCF::I_ClientTransport>" has no suitable copy constructor +#~ + #~ LIST(APPEND CAB_COMPILER_ADDTIONAL_C_COMPILER_FLAGS "-wd266") #function "__GKfree" declared implicitly + #~ LIST(APPEND CAB_COMPILER_ADDTIONAL_C_COMPILER_FLAGS "-O3 -fomit-frame-pointer -finline-functions -funroll-all-loops") + + ############################################################################################################### + ## OpenMP support + ############################################################################################################### + IF(USE_OPENMP) + LIST(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "-openmp") + ENDIF() + + + ############################################################################################################### + ## mt support + ############################################################################################################### + LIST(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "-pthread") + LIST(APPEND CAB_COMPILER_ADDTIONAL_C_COMPILER_FLAGS "-pthread") + +ENDMACRO(SET_COMPILER_SPECIFIC_FLAGS_INTERN build_type use64BitOptions) diff --git a/source/VirtualFluidsCore/BoundaryCondition/BoundaryCondition.h b/source/VirtualFluidsCore/BoundaryCondition/BoundaryCondition.h index aa46db7f62f776f0da1539008abce5c39b73347c..ae8b5442f0422ecb063bdd81710aff83f9c467b5 100644 --- a/source/VirtualFluidsCore/BoundaryCondition/BoundaryCondition.h +++ b/source/VirtualFluidsCore/BoundaryCondition/BoundaryCondition.h @@ -50,7 +50,7 @@ protected: D3Q27BoundaryConditionPtr bcPtr; DistributionArray3DPtr distributions; - DistributionArray3DPtr distributionsTemp; + LBMReal collFactor; int x1, x2, x3; @@ -67,6 +67,12 @@ private: template<class Archive> void serialize(Archive & ar, const unsigned int version) { + ar & nodeVector; + ar & bcVector; + ar & compressible; + ar & type; + ar & distributions; + ar & collFactor; } }; diff --git a/source/VirtualFluidsCore/BoundaryCondition/D3Q27ETForThinWallBCProcessor.h b/source/VirtualFluidsCore/BoundaryCondition/D3Q27ETForThinWallBCProcessor.h index e0ff10c514664d8cda4d893870b123b02259ff46..6815c2079ac14c6282b96d7cf824f38128325c78 100644 --- a/source/VirtualFluidsCore/BoundaryCondition/D3Q27ETForThinWallBCProcessor.h +++ b/source/VirtualFluidsCore/BoundaryCondition/D3Q27ETForThinWallBCProcessor.h @@ -22,14 +22,12 @@ public: virtual BCProcessorPtr clone(LBMKernel3DPtr kernel); void applyPostCollisionBC(); protected: - //EsoTwist3DPtr distributionsTemp; private: friend class boost::serialization::access; template<class Archive> void serialize(Archive & ar, const unsigned int version) { ar & boost::serialization::base_object<D3Q27ETBCProcessor>(*this); - //ar & distributionsTemp; } }; diff --git a/source/VirtualFluidsCore/BoundaryCondition/ThinWallNoSlipBoundaryCondition.h b/source/VirtualFluidsCore/BoundaryCondition/ThinWallNoSlipBoundaryCondition.h index 82f4f46d45995533754646948dfb92f4f8fcf665..567634cd8654ac66f1fb503641ab12dcfadcd8af 100644 --- a/source/VirtualFluidsCore/BoundaryCondition/ThinWallNoSlipBoundaryCondition.h +++ b/source/VirtualFluidsCore/BoundaryCondition/ThinWallNoSlipBoundaryCondition.h @@ -16,6 +16,7 @@ public: void setPass(int pass); protected: void applyBC(); + DistributionArray3DPtr distributionsTemp; private: int pass; friend class boost::serialization::access; @@ -23,6 +24,7 @@ private: void serialize(Archive & ar, const unsigned int version) { ar & boost::serialization::base_object<BoundaryCondition>(*this); + ar & distributionsTemp; } }; #endif // ThinWallNoSlipBoundaryCondition_h__ diff --git a/source/VirtualFluidsCore/CoProcessors/MacroscopicQuantitiesCoProcessor.cpp b/source/VirtualFluidsCore/CoProcessors/MacroscopicQuantitiesCoProcessor.cpp index f854a0cc71b8826a3abf89c41e611db1505a66e0..8ae2dc789f7c88b22c405ab37f1c57b2d8c443c5 100644 --- a/source/VirtualFluidsCore/CoProcessors/MacroscopicQuantitiesCoProcessor.cpp +++ b/source/VirtualFluidsCore/CoProcessors/MacroscopicQuantitiesCoProcessor.cpp @@ -152,8 +152,8 @@ void MacroscopicQuantitiesCoProcessor::addDataMQ(Block3DPtr block) datanames.push_back("Vy"); datanames.push_back("Vz"); //datanames.push_back("Press"); - datanames.push_back("Level"); - datanames.push_back("BlockID"); + //datanames.push_back("Level"); + //datanames.push_back("BlockID"); @@ -255,8 +255,8 @@ void MacroscopicQuantitiesCoProcessor::addDataMQ(Block3DPtr block) //data[index++].push_back(vx2 * conv->getFactorVelocityLbToW2()); //data[index++].push_back(vx3 * conv->getFactorVelocityLbToW2()); //data[index++].push_back(press * conv->getFactorPressureLbToW2()); - data[index++].push_back(level); - data[index++].push_back(blockID); + //data[index++].push_back(level); + //data[index++].push_back(blockID); } } } diff --git a/source/VirtualFluidsCore/CoProcessors/NUPSCounterCoProcessor.cpp b/source/VirtualFluidsCore/CoProcessors/NUPSCounterCoProcessor.cpp index 96cd9f083c34503c7e9f791e374c814c20ae6c8c..73bfac4cbb0a4db07fbcf9f9cc637b1f2b0f1fcd 100644 --- a/source/VirtualFluidsCore/CoProcessors/NUPSCounterCoProcessor.cpp +++ b/source/VirtualFluidsCore/CoProcessors/NUPSCounterCoProcessor.cpp @@ -18,7 +18,7 @@ NUPSCounterCoProcessor::NUPSCounterCoProcessor(Grid3DPtr grid, UbSchedulerPtr s, int maxInitLevel = grid->getFinestInitializedLevel(); int gl = 2; UbTupleInt3 blocknx = grid->getBlockNX(); - //int nod = (val<1>(blocknx)+gl) * (val<2>(blocknx)+gl) * (val<3>(blocknx)+gl); + //double nod = (val<1>(blocknx)+gl) * (val<2>(blocknx)+gl) * (val<3>(blocknx)+gl); double nod = (double)(val<1>(blocknx)) * (double)(val<2>(blocknx)) * (double)(val<3>(blocknx)); nup = 0; @@ -67,8 +67,8 @@ void NUPSCounterCoProcessor::collectData(double step) UBLOG(logINFO, "Performance per process = "<<nups<<" NUPS"); UBLOG(logINFO, "Performance per thread = "<<tnups<<" NUPS"); UBLOG(logINFO, "Time for " << step-nupsStep <<" steps = "<< time <<" s"); - //timer.resetAndStart(); //timer.restart(); nupsStep = step; + timer.resetAndStart(); } } diff --git a/source/VirtualFluidsCore/CoProcessors/RestartCoProcessor.cpp b/source/VirtualFluidsCore/CoProcessors/RestartCoProcessor.cpp index 373c62fca0689e39a4f333692d8ce0c450f77e87..5165f778ff4fa65e6df99e912e8cfaf5df2d92b8 100644 --- a/source/VirtualFluidsCore/CoProcessors/RestartCoProcessor.cpp +++ b/source/VirtualFluidsCore/CoProcessors/RestartCoProcessor.cpp @@ -189,6 +189,7 @@ void RestartCoProcessor::saveTxtArchive(std::string filename) { oa << pp; } + file.close(); } ////////////////////////////////////////////////////////////////////////// void RestartCoProcessor::loadTxtArchive( std::string filename ) @@ -210,6 +211,7 @@ void RestartCoProcessor::loadTxtArchive( std::string filename ) pp->reconnect(grid); CoProcessors.push_back(pp); } + file.close(); } ////////////////////////////////////////////////////////////////////////// void RestartCoProcessor::saveBinArchive( std::string filename ) @@ -235,6 +237,7 @@ void RestartCoProcessor::saveBinArchive( std::string filename ) { oa << pp; } + file.close(); } ////////////////////////////////////////////////////////////////////////// void RestartCoProcessor::loadBinArchive( std::string filename ) @@ -257,6 +260,7 @@ void RestartCoProcessor::loadBinArchive( std::string filename ) pp->reconnect(grid); CoProcessors.push_back(pp); } + file.close(); } ////////////////////////////////////////////////////////////////////////// void RestartCoProcessor::writeMetafile(int step ) diff --git a/source/VirtualFluidsCore/Grid/BoostSerializationClassExportHelper.h b/source/VirtualFluidsCore/Grid/BoostSerializationClassExportHelper.h index 854b52b7615677b0ca5b882ca4c58252e2db5943..52061479fc1fe4b7607b1e5faf2be4e3804c5f8c 100644 --- a/source/VirtualFluidsCore/Grid/BoostSerializationClassExportHelper.h +++ b/source/VirtualFluidsCore/Grid/BoostSerializationClassExportHelper.h @@ -4,6 +4,7 @@ #include <LBMKernelETD3Q27.h> #include <LBMKernelETD3Q27Cascaded.h> #include <D3Q27EsoTwist3DSplittedVector.h> +#include <BCProcessor.h> #include <D3Q27ETBCProcessor.h> #include <LBMKernelETD3Q27CascadedTI.h> #include <DataSet3D.h> @@ -38,7 +39,8 @@ #include <D3Q27NoSlipBCAdapter.h> #include <D3Q27SlipBCAdapter.h> #include <D3Q27VelocityBCAdapter.h> - +#include "ThinWallNoSlipBoundaryCondition.h" +#include "D3Q27ETForThinWallBCProcessor.h" #include <boost/serialization/export.hpp> @@ -49,7 +51,9 @@ BOOST_CLASS_EXPORT(LBMKernelETD3Q27BGK) BOOST_CLASS_EXPORT(LBMKernelETD3Q27CCLB) BOOST_CLASS_EXPORT(LBMKernelETD3Q27CCLBWithSpongeLayer) BOOST_CLASS_EXPORT(D3Q27EsoTwist3DSplittedVector) +BOOST_CLASS_EXPORT(BCProcessor) BOOST_CLASS_EXPORT(D3Q27ETBCProcessor) +BOOST_CLASS_EXPORT(D3Q27ETForThinWallBCProcessor) BOOST_CLASS_EXPORT(DataSet3D) BOOST_CLASS_EXPORT(Interactor3D) BOOST_CLASS_EXPORT(D3Q27Interactor) @@ -69,6 +73,7 @@ BOOST_CLASS_EXPORT(HighViscosityNoSlipBoundaryCondition) BOOST_CLASS_EXPORT(SlipBoundaryCondition) BOOST_CLASS_EXPORT(NonReflectingDensityBoundaryCondition) BOOST_CLASS_EXPORT(NonReflectingVelocityBoundaryCondition) +BOOST_CLASS_EXPORT(ThinWallNoSlipBoundaryCondition) BOOST_CLASS_EXPORT(D3Q27BoundaryConditionAdapter) BOOST_CLASS_EXPORT(D3Q27DensityBCAdapter) diff --git a/source/VirtualFluidsCore/Visitors/BoundaryConditionBlockVisitor.cpp b/source/VirtualFluidsCore/Visitors/BoundaryConditionBlockVisitor.cpp index b2ae5725b34d5d6a9b73902b609f1dd1c2b3565e..c2fcaa55d7261cba09e63477266ff1feb928d352 100644 --- a/source/VirtualFluidsCore/Visitors/BoundaryConditionBlockVisitor.cpp +++ b/source/VirtualFluidsCore/Visitors/BoundaryConditionBlockVisitor.cpp @@ -29,11 +29,6 @@ void BoundaryConditionBlockVisitor::visit(Grid3DPtr grid, Block3DPtr block) double collFactor = kernel->getCollisionFactor(); int level = block->getLevel(); - if (velocity) velocity->setCompressible(compressible); - if (density) density->setCompressible(compressible); - if (noSlip) noSlip->setCompressible(compressible); - if (slip) slip->setCompressible(compressible); - int minX1 = 0; int minX2 = 0; int minX3 = 0; @@ -96,21 +91,25 @@ void BoundaryConditionBlockVisitor::visit(Grid3DPtr grid, Block3DPtr block) { velocity->addDistributions(distributions); velocity->setCollFactor(collFactor); + velocity->setCompressible(compressible); } if (dCount > 0) { density->addDistributions(distributions); density->setCollFactor(collFactor); + density->setCompressible(compressible); } if (nsCount > 0) { noSlip->addDistributions(distributions); noSlip->setCollFactor(collFactor); + noSlip->setCompressible(compressible); } if (sCount > 0) { slip->addDistributions(distributions); slip->setCollFactor(collFactor); + slip->setCompressible(compressible); } } }