diff --git a/source/Applications.cmake b/source/Applications.cmake index 9ac63493201c0f5e7154b3c05d71076f5fd01b6f..4bc288816d6214f44f20eb28561f9b910d228457 100644 --- a/source/Applications.cmake +++ b/source/Applications.cmake @@ -21,7 +21,7 @@ add_subdirectory(Applications/LaminarTubeFlow) # add_subdirectory(Applications/bond_benchmark) # add_subdirectory(Applications/musis) add_subdirectory(Applications/Hagen_Poiseuille_flow) -# add_subdirectory(Applications/mpi_benchmark) +add_subdirectory(Applications/mpi_benchmark) # add_subdirectory(Applications/shear) # add_subdirectory(Applications/wing) # add_subdirectory(Applications/bKanal) diff --git a/source/Applications/DLR-F16/DLR-F16-Phoenix.cfg b/source/Applications/DLR-F16/DLR-F16-Phoenix.cfg new file mode 100644 index 0000000000000000000000000000000000000000..3cf6b61b3f2fbafe3c99bec79d2668c5db5b7833 --- /dev/null +++ b/source/Applications/DLR-F16/DLR-F16-Phoenix.cfg @@ -0,0 +1,54 @@ +pathOut = /home/koskuche/work/DLR-F16 +pathGeo = /home/koskuche/data/DLR-F16 +fngFileWhole = f16-ascii.stl +#fngFileWhole = grundgeometrie-direkter-export.stl +#fngFileWhole = grundgeometrie-mittel.stl + +#fngFileWhole = cylinder.ASCII.stl + +fngFileBodyPart = f16-body-part-ascii.stl +fngFileTrailingEdge = f16-trailing-edge-ascii.stl +zigZagTape = 2zackenbaender0.stl + +numOfThreads = 20 +availMem = 64e9 +refineLevel = 8 +blockNx = 7 6 7 +#blockNx = 21 6 13 +#blockNx = 294 12 247 +uLB = 0.1 + +#x1min x1max x2min x2max x3min x3max [m] +boundingBox = -0.90 1.20 0.035 0.065 -0.65 0.65 +#boundingBox = -0.1 0.60 0.035 0.065 -0.3 0.3 +#boundingBox = -10e-3 310e-3 0.035 0.065 -21e-3 21e-3 + +#boundingBox = -0.255 0.27 0.035 0.065 -0.17 0.155 +#boundingBox = -0.255 0.27 0.035 0.185 -0.17 0.155 + +#deltaXfine = 0.005 #level 0 +#deltaXfine = 0.0025 #level 1 +#deltaXfine = 0.00125 #level 2 +#deltaXfine = 0.000625 #level 3 +#deltaXfine = 0.0003125 #level 4 +#deltaXfine = 0.00015625 #level 5 +#deltaXfine = 0.000078125 #level 6 +#deltaXfine = 0.0000390625 #level 7 +deltaXfine = 0.00001953125 #level 8 + + +refineDistance = 0.1 + +restartStep = 100 +restartStepStart = 100 + +outTime = 100 +endTime = 100 + +logToFile = true + +porousTralingEdge = false + +thinWall = false + +nupsStep = 10 10 10000000 diff --git a/source/Applications/DLR-F16/F16BombadilTest10e-6.cfg b/source/Applications/DLR-F16/F16BombadilTest10e-6.cfg index de3da9c7645d2a36d169db772e9b11ef08d5d83b..d94fc953bde419f8ad552c9f6d7aa608a66624ec 100644 --- a/source/Applications/DLR-F16/F16BombadilTest10e-6.cfg +++ b/source/Applications/DLR-F16/F16BombadilTest10e-6.cfg @@ -1,27 +1,29 @@ -pathOut = d:/temp/f16Grid +pathOut = d:/temp/DLR-F16 pathGeo = d:/Projects/SFB880/DLR-F16/A1_Forschungsdaten_Profilgeometrie_STL_CATIA_Rossian -#fngFileWhole = f16-ascii.stl -fngFileWhole = grundgeometrie-direkter-export.stl +fngFileWhole = f16-ascii.stl +#fngFileWhole = grundgeometrie-direkter-export.stl #fngFileWhole = grundgeometrie-mittel.stl fngFileBodyPart = f16-body-part-ascii.stl fngFileTrailingEdge = f16-trailing-edge-ascii.stl zigZagTape = 2zackenbaender0.stl numOfThreads = 4 -availMem = 10e9 +availMem = 13e9 refineLevel = 8 #10 -#blockNx = 8 8 8 -blockNx = 6 6 6 -#blockNx = 294 12 247 +#blockNx = 7 8 8 +#blockNx = 7 6 7 +blockNx = 21 6 13 uLB = 0.1 #x1min x1max x2min x2max x3min x3max [m] boundingBox = -0.90 1.20 0.035 0.065 -0.65 0.65 #boundingBox = -0.90 1.1992 0.035 0.065 -0.65 0.65 -#boundingBox = -0.1 0.60 0.035 0.065 -0.3 0.3 +#boundingBox = -0.1 0.635 0.035 0.065 -0.3 0.3 #boundingBox = -10e-3 310e-3 0.035 0.065 -21e-3 25e-3 +#boundingBox = 0 65.6e-3 35e-3 75e-3 -30e-3 0 + #deltaXfine = 5120e-6 #level 0 #deltaXfine = 2560e-6 #level 1 @@ -31,19 +33,30 @@ boundingBox = -0.90 1.20 0.035 0.065 -0.65 0.65 #deltaXfine = 160e-6 #level 5 #deltaXfine = 80e-6 #level 6 #deltaXfine = 40e-6 #level 7 -deltaXfine = 20e-6 #level 8 +#deltaXfine = 20e-6 #level 8 #deltaXfine = 10e-6 #level 9 #deltaXfine = 0.000009765625 +#deltaXfine = 0.005 #level 0 +#deltaXfine = 0.0025 #level 1 +#deltaXfine = 0.00125 #level 2 +#deltaXfine = 0.000625 #level 3 +#deltaXfine = 0.0003125 #level 4 +#deltaXfine = 0.00015625 #level 5 +#deltaXfine = 0.000078125 #level 6 +#deltaXfine = 0.0000390625 #level 7 +deltaXfine = 0.00001953125 #level 8 + #deltaXfine = 6.5e-6 -refineDistance = 0.1 #0.3 +startDistance = -1.0 +refineDistance = 0.3 -restartStep = 100000 -restartStepStart = 100000 +restartStep = 500000 +restartStepStart = 500000 -outTime = 1000 -endTime = 200000 +outTime = 1 +endTime = 15000 logToFile = false diff --git a/source/Applications/DLR-F16/f16.cpp b/source/Applications/DLR-F16/f16.cpp index c4a1afff9167bd5a13dd8397328df13042e9f6f9..adf9597c5dbfe440fa02360e5522cbf04b5158e2 100644 --- a/source/Applications/DLR-F16/f16.cpp +++ b/source/Applications/DLR-F16/f16.cpp @@ -16,13 +16,6 @@ void run(string configname) { try { -#pragma omp parallel //num_threads(3) -#pragma omp master - { - printf_s("%d\n", omp_get_num_threads()); - } -printf_s("num_threads=%d\n", omp_get_num_threads( )); - ConfigurationFile config; config.load(configname); @@ -47,6 +40,7 @@ printf_s("num_threads=%d\n", omp_get_num_threads( )); double deltaXfine = config.getDouble("deltaXfine")*1000.0; bool thinWall = config.getBool("thinWall"); double refineDistance = config.getDouble("refineDistance"); + double startDistance = config.getDouble("startDistance"); vector<double> nupsStep = config.getVector<double>("nupsStep"); CommunicatorPtr comm = MPICommunicator::getInstance(); @@ -97,10 +91,11 @@ printf_s("num_threads=%d\n", omp_get_num_threads( )); double rhoLB = 0.0; double rhoReal = 1.2041; //(kg/m3) - double nueReal = 153.5e-7; //m^2/s - + //double nueReal = 153.5e-7; //m^2/s + double uReal = 55; //m/s double lReal = 0.3;//m - double uReal = Re*nueReal / lReal; + //double uReal = Re*nueReal / lReal; + double nuReal = (uReal*lReal)/Re; //m^2/s //##Machzahl: //#Ma = uReal/csReal @@ -112,8 +107,8 @@ printf_s("num_threads=%d\n", omp_get_num_threads( )); //double u_LB = uReal * unitConverter.getFactorVelocityWToLb(); //double nu_LB = nueReal * unitConverter.getFactorViscosityWToLb(); - double l_LB = lReal*1000.0 / deltaXcoarse; - double nuLB = (uLB*l_LB) / Re; //0.005; + double lLB = lReal*1000.0 / deltaXcoarse; + double nuLB = (uLB*lLB)/Re; //0.005; //double nuLB = 0.005; LBMUnitConverterPtr conv = LBMUnitConverterPtr(new LBMUnitConverter()); @@ -169,7 +164,7 @@ printf_s("num_threads=%d\n", omp_get_num_threads( )); ////////////////////////////////////////////////////////////////////////// //restart UbSchedulerPtr rSch(new UbScheduler(restartStep, restartStep)); - RestartCoProcessor rp(grid, rSch, comm, pathOut, RestartCoProcessor::BINARY); + RestartCoProcessor rp(grid, rSch, comm, pathOut, RestartCoProcessor::TXT); ////////////////////////////////////////////////////////////////////////// @@ -181,14 +176,18 @@ printf_s("num_threads=%d\n", omp_get_num_threads( )); UBLOG(logINFO, "* Re = "<<Re); UBLOG(logINFO, "* Ma = "<<Ma); UBLOG(logINFO, "* velocity (uReal) = "<<uReal<<" m/s"); - UBLOG(logINFO, "* viscosity (nuReal) = "<<nueReal<<" m^2/s"); + UBLOG(logINFO, "* viscosity (nuReal) = "<<nuReal<<" m^2/s"); + UBLOG(logINFO, "* chord length (lReal)= "<<lReal<<" m"); UBLOG(logINFO, "* velocity LB (uLB) = "<<uLB); UBLOG(logINFO, "* viscosity LB (nuLB) = "<<nuLB); + UBLOG(logINFO, "* chord length (l_LB) = "<<lLB<<" dx_base"); UBLOG(logINFO, "* dx_base = "<<deltaXcoarse/1000<<" m"); UBLOG(logINFO, "* dx_refine = "<<deltaXfine/1000<<" m"); - UBLOG(logINFO, "* number of levels = " << refineLevel + 1); - UBLOG(logINFO, "* number of threads = " << numOfThreads); - UBLOG(logINFO, "* number of processes = " << comm->getNumberOfProcesses()); + UBLOG(logINFO, "* blocknx = "<<blockNx[0]<<"x"<<blockNx[1]<<"x"<<blockNx[2] ); + UBLOG(logINFO, "* refineDistance = "<<refineDistance); + UBLOG(logINFO, "* number of levels = "<<refineLevel + 1); + UBLOG(logINFO, "* number of threads = "<<numOfThreads); + UBLOG(logINFO, "* number of processes = "<<comm->getNumberOfProcesses()); UBLOG(logINFO, "Preprozess - start"); } @@ -258,7 +257,7 @@ printf_s("num_threads=%d\n", omp_get_num_threads( )); meshBand6->rotate(0.0, -1, 0.0); meshBand6->rotate(0.0, 0.0, 180.0); //meshBand6->translate(30, 5, -37.3); - meshBand6->translate(30, 5, -37.0); + meshBand6->translate(30, 5, -37.2); if (myid==0) GbSystem3D::writeGeoObject(meshBand6.get(), pathOut+"/geo/zigZagTape6", WbWriterVtkXmlASCII::getInstance()); //// Zackenband7 //GbTriFaceMesh3DPtr meshBand7(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile(ZckbndFilename, "zigZagTape7")); @@ -272,7 +271,7 @@ printf_s("num_threads=%d\n", omp_get_num_threads( )); //if (myid==0) GbSystem3D::writeGeoObject(meshBan8.get(), pathOut+"/geo/zigZagTape8", WbWriterVtkXmlASCII::getInstance()); if (myid==0) UBLOG(logINFO, "Read zigZagTape:end"); - return; + ////////////////////////////////////////////////////////////////////////// @@ -309,34 +308,51 @@ printf_s("num_threads=%d\n", omp_get_num_threads( )); int rank = grid->getRank(); grid->setRank(0); - boost::dynamic_pointer_cast<D3Q27TriFaceMeshInteractor>(triBand1Interactor)->refineBlockGridToLevel(refineLevel, 0.0, refineDistance); - boost::dynamic_pointer_cast<D3Q27TriFaceMeshInteractor>(triBand2Interactor)->refineBlockGridToLevel(refineLevel, 0.0, refineDistance); - boost::dynamic_pointer_cast<D3Q27TriFaceMeshInteractor>(triBand3Interactor)->refineBlockGridToLevel(refineLevel, 0.0, refineDistance); - boost::dynamic_pointer_cast<D3Q27TriFaceMeshInteractor>(triBand4Interactor)->refineBlockGridToLevel(refineLevel, 0.0, refineDistance); - grid->setRank(rank); if (porousTralingEdge) { - int rank = grid->getRank(); - grid->setRank(0); - boost::dynamic_pointer_cast<D3Q27TriFaceMeshInteractor>(fngIntrBodyPart)->refineBlockGridToLevel(refineLevel, 0.0, refineDistance); - grid->setRank(rank); - } - else - { - int rank = grid->getRank(); - grid->setRank(0); - boost::dynamic_pointer_cast<D3Q27TriFaceMeshInteractor>(fngIntrWhole)->refineBlockGridToLevel(refineLevel, 0.0, refineDistance); - grid->setRank(rank); + boost::dynamic_pointer_cast<D3Q27TriFaceMeshInteractor>(fngIntrBodyPart)->refineBlockGridToLevel(refineLevel, startDistance, refineDistance); } + //else + //{ + // boost::dynamic_pointer_cast<D3Q27TriFaceMeshInteractor>(fngIntrWhole)->refineBlockGridToLevel(refineLevel, startDistance, refineDistance); + //} + + //boost::dynamic_pointer_cast<D3Q27TriFaceMeshInteractor>(triBand1Interactor)->refineBlockGridToLevel(refineLevel, 0.0, refineDistance); + //boost::dynamic_pointer_cast<D3Q27TriFaceMeshInteractor>(triBand2Interactor)->refineBlockGridToLevel(refineLevel, 0.0, refineDistance); + //boost::dynamic_pointer_cast<D3Q27TriFaceMeshInteractor>(triBand3Interactor)->refineBlockGridToLevel(refineLevel, 0.0, refineDistance); + //boost::dynamic_pointer_cast<D3Q27TriFaceMeshInteractor>(triBand4Interactor)->refineBlockGridToLevel(refineLevel, 0.0, refineDistance); + GbObject3DPtr fngBox(new GbCuboid3D(fngMeshWhole->getX1Minimum(), fngMeshWhole->getX2Minimum(), fngMeshWhole->getX3Minimum(), + fngMeshWhole->getX1Maximum(), fngMeshWhole->getX2Maximum(), fngMeshWhole->getX3Maximum())); + if (myid==0) GbSystem3D::writeGeoObject(fngBox.get(), pathOut+"/geo/fngBox", WbWriterVtkXmlASCII::getInstance()); + + RefineCrossAndInsideGbObjectBlockVisitor refVisitor0(fngBox, refineLevel); + grid->accept(refVisitor0); + + + GbObject3DPtr bandTopBox(new GbCuboid3D(meshBand1->getX1Minimum(), meshBand1->getX2Minimum(), meshBand1->getX3Minimum(), + meshBand1->getX1Maximum(), meshBand1->getX2Maximum(), meshBand1->getX3Maximum())); + if (myid==0) GbSystem3D::writeGeoObject(bandTopBox.get(), pathOut+"/geo/bandTopBox", WbWriterVtkXmlASCII::getInstance()); + + RefineCrossAndInsideGbObjectBlockVisitor refVisitor1(bandTopBox, refineLevel); + grid->accept(refVisitor1); + + GbObject3DPtr bandBottomBox(new GbCuboid3D(meshBand5->getX1Minimum(), meshBand5->getX2Minimum(), meshBand5->getX3Minimum(), + meshBand5->getX1Maximum(), meshBand5->getX2Maximum(), meshBand5->getX3Maximum())); + if (myid==0) GbSystem3D::writeGeoObject(bandBottomBox.get(), pathOut+"/geo/bandBottomBox", WbWriterVtkXmlASCII::getInstance()); + + RefineCrossAndInsideGbObjectBlockVisitor refVisitor2(bandBottomBox, refineLevel); + grid->accept(refVisitor2); + + grid->setRank(rank); + { WriteBlocksCoProcessor ppblocks(grid, UbSchedulerPtr(new UbScheduler(1)), pathOut, WbWriterVtkXmlBinary::getInstance(), comm); ppblocks.process(0); } - //////////////////////////////////////////// //METIS //Grid3DVisitorPtr metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::BSW, MetisPartitioner::KWAY)); @@ -482,20 +498,20 @@ printf_s("num_threads=%d\n", omp_get_num_threads( )); intHelper.addInteractor(outflowIntr); intHelper.addInteractor(addWallZminInt); intHelper.addInteractor(addWallZmaxInt); - intHelper.addInteractor(triBand1Interactor); - intHelper.addInteractor(triBand2Interactor); - intHelper.addInteractor(triBand3Interactor); - intHelper.addInteractor(triBand4Interactor); - - if (porousTralingEdge) - { - intHelper.addInteractor(fngIntrBodyPart); - //intHelper.addInteractor(fngIntrTrailingEdge); - } - else - { - intHelper.addInteractor(fngIntrWhole); - } + //intHelper.addInteractor(triBand1Interactor); + //intHelper.addInteractor(triBand2Interactor); + //intHelper.addInteractor(triBand3Interactor); + //intHelper.addInteractor(triBand4Interactor); + // + //if (porousTralingEdge) + //{ + // intHelper.addInteractor(fngIntrBodyPart); + // //intHelper.addInteractor(fngIntrTrailingEdge); + //} + //else + //{ + // intHelper.addInteractor(fngIntrWhole); + //} ////////////////////////////////////////////////////////////////////////// intHelper.selectBlocks(); @@ -534,6 +550,7 @@ printf_s("num_threads=%d\n", omp_get_num_threads( )); } LBMKernelPtr kernel = LBMKernelPtr(new CompressibleCumulantLBMKernel(blockNx[0], blockNx[1], blockNx[2], CompressibleCumulantLBMKernel::NORMAL)); + //LBMKernelPtr kernel = LBMKernelPtr(new IncompressibleCumulantLBMKernel(blockNx[0], blockNx[1], blockNx[2], IncompressibleCumulantLBMKernel::NORMAL)); BCProcessorPtr bcProc; @@ -579,11 +596,12 @@ printf_s("num_threads=%d\n", omp_get_num_threads( )); //initVisitor.setVx1(inflowProfileVx1); //initVisitor.setVx2(inflowProfileVx2); //initVisitor.setVx3(inflowProfileVx3); - initVisitor.setNu(nuLB); + //initVisitor.setNu(nuLB); grid->accept(initVisitor); ////set connectors InterpolationProcessorPtr iProcessor(new CompressibleOffsetInterpolationProcessor()); + //InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolationProcessor()); SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor); grid->accept(setConnsVisitor); diff --git a/source/Applications/DLR-F16/startJobPhoenix.slrm b/source/Applications/DLR-F16/startJobPhoenix.slrm new file mode 100644 index 0000000000000000000000000000000000000000..666fa2a97efae9416875987448185890692bc632 --- /dev/null +++ b/source/Applications/DLR-F16/startJobPhoenix.slrm @@ -0,0 +1,14 @@ +#!/bin/bash +#SBATCH -J f16 +#SBATCH --ntasks=300 +#SBATCH --ntasks-per-node=1 +#SBATCH --time=08:00:00 + +module load lib/boost/1.63.0/intel +module load mpi/intelmpi/2017.2.174 +module load intel-studio-2017 + +APP=./f16 +CONF=./DLR-F16-Phoenix.cfg + +mpiexec $APP $CONF \ No newline at end of file diff --git a/source/Applications/LaminarTubeFlow/ltf.cfg b/source/Applications/LaminarTubeFlow/ltf.cfg index b44b01feba8ae7122b42fbe60e0cec5758b981d3..f2f887b039fd8e7f066e80774f7bd00825bfd987 100644 --- a/source/Applications/LaminarTubeFlow/ltf.cfg +++ b/source/Applications/LaminarTubeFlow/ltf.cfg @@ -1,9 +1,9 @@ -pathname = d:/temp/LaminarTubeFlow1 -numOfThreads = 4 +pathname = d:/temp/LaminarTubeFlow2 +numOfThreads = 1 availMem = 10e9 #Grid -length = 64 32 32 +length = 71 16 32 blocknx = 8 8 8 dx = 1 refineLevel = 0 @@ -14,7 +14,7 @@ Re = 10 outTime = 1 -endTime = 5000 +endTime = 1000 logToFile = false diff --git a/source/Applications/LaminarTubeFlow/ltf.cpp b/source/Applications/LaminarTubeFlow/ltf.cpp index 67284b5b004de5cd762f1f1cc4515a1f99dc94cc..479af1565f51f86bd132a4337172a60496fcaefc 100644 --- a/source/Applications/LaminarTubeFlow/ltf.cpp +++ b/source/Applications/LaminarTubeFlow/ltf.cpp @@ -68,13 +68,20 @@ void run(string configname) BCAdapterPtr denBCAdapter(new DensityBCAdapter(rhoLB)); denBCAdapter->setBcAlgorithm(BCAlgorithmPtr(new NonReflectingDensityBCAlgorithm())); + mu::Parser fct; + fct.SetExpr("U"); + fct.DefineConst("U", uLB); + BCAdapterPtr velBCAdapter(new VelocityBCAdapter(true, false, false, fct, 0, BCFunction::INFCONST)); + velBCAdapter->setBcAlgorithm(BCAlgorithmPtr(new NonReflectingVelocityBCAlgorithm())); + ////////////////////////////////////////////////////////////////////////////////// //BS visitor BoundaryConditionsBlockVisitor bcVisitor; bcVisitor.addBC(noSlipBCAdapter); bcVisitor.addBC(denBCAdapter); - + bcVisitor.addBC(velBCAdapter); + Grid3DPtr grid(new Grid3D(comm)); ////////////////////////////////////////////////////////////////////////// @@ -123,18 +130,30 @@ void run(string configname) grid->setDeltaX(dx); grid->setBlockNX(blocknx[0], blocknx[1], blocknx[2]); + grid->setPeriodicX1(false); + grid->setPeriodicX2(true); + grid->setPeriodicX3(true); + 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()); + + ////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()); + //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()); + GbCuboid3DPtr geoInflow(new GbCuboid3D(g_minX1-blockLength, g_minX2-blockLength, g_minX3-blockLength, g_minX1, g_maxX2+blockLength, g_maxX3+blockLength)); + 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-blockLength, g_minX3-blockLength, g_maxX1+blockLength, g_maxX2+blockLength, g_maxX3+blockLength)); + 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)); @@ -147,19 +166,20 @@ void run(string configname) double cx2 = cylinder->getX2Centroid(); double cx3 = cylinder->getX3Centroid(); - mu::Parser fct; - fct.SetExpr("vx1*(1-((x2-y0)^2+(x3-z0)^2)/(R^2))"); - fct.DefineConst("x2Vmax", 0.0); //x2-Pos fuer vmax - fct.DefineConst("x3Vmax", 0.0); //x3-Pos fuer vmax - fct.DefineConst("R", r); - fct.DefineConst("vx1", uLB); - fct.DefineConst("x0", cx1); - fct.DefineConst("y0", cx2); - fct.DefineConst("z0", cx3); - fct.DefineConst("nue", nuLB); - BCAdapterPtr velBCAdapter(new VelocityBCAdapter(true, false, false, fct, 0, BCFunction::INFCONST)); - //velBCAdapter->setBcAlgorithm(BCAlgorithmPtr(new VelocityBCAlgorithm())); - velBCAdapter->setBcAlgorithm(BCAlgorithmPtr(new NonReflectingVelocityBCAlgorithm())); + //mu::Parser fct; + //fct.SetExpr("vx1*(1-((x2-y0)^2+(x3-z0)^2)/(R^2))"); + //fct.DefineConst("x2Vmax", 0.0); //x2-Pos fuer vmax + //fct.DefineConst("x3Vmax", 0.0); //x3-Pos fuer vmax + //fct.DefineConst("R", r); + //fct.DefineConst("vx1", uLB); + //fct.DefineConst("x0", cx1); + //fct.DefineConst("y0", cx2); + //fct.DefineConst("z0", cx3); + //fct.DefineConst("nue", nuLB); + //BCAdapterPtr velBCAdapter(new VelocityBCAdapter(true, false, false, fct, 0, BCFunction::INFCONST)); + ////velBCAdapter->setBcAlgorithm(BCAlgorithmPtr(new VelocityBCAlgorithm())); + //velBCAdapter->setBcAlgorithm(BCAlgorithmPtr(new NonReflectingVelocityBCAlgorithm())); + D3Q27InteractorPtr inflowInt = D3Q27InteractorPtr(new D3Q27Interactor(geoInflow, grid, velBCAdapter, Interactor3D::SOLID)); @@ -169,22 +189,11 @@ void run(string configname) Grid3DVisitorPtr metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::B)); InteractorsHelper intHelper(grid, metisVisitor); - intHelper.addInteractor(cylinderInt); + //intHelper.addInteractor(cylinderInt); intHelper.addInteractor(inflowInt); intHelper.addInteractor(outflowInt); intHelper.selectBlocks(); - //set connectors - //InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolationProcessor()); - InterpolationProcessorPtr iProcessor(new CompressibleOffsetInterpolationProcessor()); - SetConnectorsBlockVisitor 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(); @@ -216,8 +225,8 @@ void run(string configname) LBMKernelPtr kernel; - //kernel = LBMKernelPtr(new IncompressibleCumulantLBMKernel(blocknx[0], blocknx[1], blocknx[2], IncompressibleCumulantLBMKernel::NORMAL)); - kernel = LBMKernelPtr(new CompressibleCumulantLBMKernel(blocknx[0], blocknx[1], blocknx[2], CompressibleCumulantLBMKernel::NORMAL)); + kernel = LBMKernelPtr(new IncompressibleCumulantLBMKernel(blocknx[0], blocknx[1], blocknx[2], IncompressibleCumulantLBMKernel::NORMAL)); + //kernel = LBMKernelPtr(new CompressibleCumulantLBMKernel(blocknx[0], blocknx[1], blocknx[2], CompressibleCumulantLBMKernel::NORMAL)); // BCProcessorPtr bcProc(new BCProcessor()); @@ -236,18 +245,34 @@ void run(string configname) intHelper.setBC(); - bcVisitor.addBC(velBCAdapter); + //bcVisitor.addBC(velBCAdapter); grid->accept(bcVisitor); //initialization of distributions InitDistributionsBlockVisitor initVisitor(nuLB, rhoLB); + initVisitor.setVx1(fct); + //initVisitor.setVx1(uLB); grid->accept(initVisitor); + //set connectors + InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolationProcessor()); + //InterpolationProcessorPtr iProcessor(new CompressibleOffsetInterpolationProcessor()); + SetConnectorsBlockVisitor 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); + //boundary conditions grid { UbSchedulerPtr geoSch(new UbScheduler(1)); - WriteBoundaryConditionsCoProcessor(grid, geoSch, pathname, WbWriterVtkXmlBinary::getInstance(), conv, comm); - grid->coProcess(0); + WriteBoundaryConditionsCoProcessorPtr ppgeo( + new WriteBoundaryConditionsCoProcessor(grid, geoSch, pathname, WbWriterVtkXmlBinary::getInstance(), conv, comm)); + ppgeo->process(0); + ppgeo.reset(); } if (myid == 0) UBLOG(logINFO, "Preprocess - end"); diff --git a/source/Applications/aperm/PA80-110+120-150_MPI.cfg b/source/Applications/aperm/PA80-110+120-150_MPI.cfg index 5439c48c6940e56115804a3e4d9f4fd0cb2103c3..9d836a0a4aa44b3fa652f1ca70e930da963fc099 100644 --- a/source/Applications/aperm/PA80-110+120-150_MPI.cfg +++ b/source/Applications/aperm/PA80-110+120-150_MPI.cfg @@ -24,15 +24,6 @@ pmL1 = 16e-3 pmL2 = 16e-3 pmL3 = 16e-3 -pmDeltas = true - -#deltas [m] -pmDeltaX1 = 0.01e-3 -pmDeltaX2 = 0.01e-3 -pmDeltaX3 = 0.01e-3 - -yDir = false -zDir = false #grid blocknx = 32 diff --git a/source/Applications/f16Test/f16test.cpp b/source/Applications/f16Test/f16test.cpp index e325384d03fb5b57f5025b2319d0f58bb3e5bc63..d44234fb26a569b5c044845abcb58e495fbc1265 100644 --- a/source/Applications/f16Test/f16test.cpp +++ b/source/Applications/f16Test/f16test.cpp @@ -39,7 +39,6 @@ void run(string configname) bool porousTralingEdge = config.getBool("porousTralingEdge"); double deltaXfine = config.getDouble("deltaXfine")*1000.0; bool thinWall = config.getBool("thinWall"); - bool testBox = config.getBool("testBox"); double refineDistance = config.getDouble("refineDistance"); vector<double> nupsStep = config.getVector<double>("nupsStep"); @@ -86,7 +85,7 @@ void run(string configname) //########################################################################## //## physical parameters //########################################################################## - double Re = 1e6; + double Re = 1;//e6; double rhoLB = 0.0; double rhoReal = 1.2041; //(kg/m3) @@ -162,7 +161,7 @@ void run(string configname) ////////////////////////////////////////////////////////////////////////// //restart UbSchedulerPtr rSch(new UbScheduler(restartStep, restartStep)); - RestartCoProcessor rp(grid, rSch, comm, pathOut, RestartCoProcessor::BINARY); + RestartCoProcessor rp(grid, rSch, comm, pathOut, RestartCoProcessor::TXT); ////////////////////////////////////////////////////////////////////////// @@ -263,12 +262,6 @@ void run(string configname) ////if (myid==0) GbSystem3D::writeGeoObject(meshBan8.get(), pathOut+"/geo/zigZagTape8", WbWriterVtkXmlASCII::getInstance()); //if (myid==0) UBLOG(logINFO, "Read zigZagTape:end"); - GbObject3DPtr testBoxOb; - if (testBox) - { - testBoxOb=GbObject3DPtr(new GbCuboid3D(15.0, 0, 5.0, 30.0, 100, 35.0)); - if (myid==0) GbSystem3D::writeGeoObject(testBoxOb.get(), pathOut+"/geo/gridCube", WbWriterVtkXmlASCII::getInstance()); - } ////////////////////////////////////////////////////////////////////////// Interactor3DPtr fngIntrWhole; @@ -289,11 +282,7 @@ void run(string configname) //D3Q27TriFaceMeshInteractorPtr triBand3Interactor(new D3Q27TriFaceMeshInteractor(meshBand3, grid, noSlipBCAdapter, Interactor3D::SOLID));//, Interactor3D::EDGES)); //D3Q27TriFaceMeshInteractorPtr triBand4Interactor(new D3Q27TriFaceMeshInteractor(meshBand4, grid, noSlipBCAdapter, Interactor3D::SOLID));//, Interactor3D::EDGES)); - D3Q27InteractorPtr testBoxInt; - if (testBox) - { - testBoxInt=D3Q27InteractorPtr(new D3Q27Interactor(testBoxOb, grid, noSlipBCAdapter, Interactor3D::SOLID)); - } + if (refineLevel > 0 && myid == 0) { @@ -453,6 +442,8 @@ void run(string configname) //wall interactors D3Q27InteractorPtr addWallZminInt(new D3Q27Interactor(addWallZmin, grid, slipBCAdapter, Interactor3D::SOLID)); D3Q27InteractorPtr addWallZmaxInt(new D3Q27Interactor(addWallZmax, grid, slipBCAdapter, Interactor3D::SOLID)); + //D3Q27InteractorPtr addWallZminInt(new D3Q27Interactor(addWallZmin, grid, noSlipBCAdapter, Interactor3D::SOLID)); + //D3Q27InteractorPtr addWallZmaxInt(new D3Q27Interactor(addWallZmax, grid, noSlipBCAdapter, Interactor3D::SOLID)); //inflow GbCuboid3DPtr geoInflow(new GbCuboid3D(g_minX1-blockLength, g_minX2-blockLength, g_minX3-blockLength, g_minX1, g_maxX2+blockLength, g_maxX3+blockLength)); @@ -483,10 +474,6 @@ void run(string configname) //intHelper.addInteractor(triBand2Interactor); //intHelper.addInteractor(triBand3Interactor); //intHelper.addInteractor(triBand4Interactor); - if (testBox) - { - intHelper.addInteractor(testBoxInt); - } if (porousTralingEdge) { @@ -534,6 +521,7 @@ void run(string configname) } LBMKernelPtr kernel = LBMKernelPtr(new CompressibleCumulantLBMKernel(blockNx[0], blockNx[1], blockNx[2], CompressibleCumulantLBMKernel::NORMAL)); + //LBMKernelPtr kernel = LBMKernelPtr(new IncompressibleCumulantLBMKernel(blockNx[0], blockNx[1], blockNx[2], IncompressibleCumulantLBMKernel::NORMAL)); BCProcessorPtr bcProc; @@ -575,15 +563,16 @@ void run(string configname) inflowProfileVx3.DefineFun("rangeRandom1", rangeRandom1); InitDistributionsBlockVisitor initVisitor(nuLB, rhoLB); - initVisitor.setVx1(fct); + //initVisitor.setVx1(fct); //initVisitor.setVx1(inflowProfileVx1); //initVisitor.setVx2(inflowProfileVx2); //initVisitor.setVx3(inflowProfileVx3); - initVisitor.setNu(nuLB); + //initVisitor.setNu(nuLB); grid->accept(initVisitor); ////set connectors InterpolationProcessorPtr iProcessor(new CompressibleOffsetInterpolationProcessor()); + //InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolationProcessor()); SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor); grid->accept(setConnsVisitor); @@ -627,8 +616,8 @@ void run(string configname) UBLOG(logINFO, "PID = " << myid << " Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe()); } - //CalculationManagerPtr calculation(new CalculationManager(grid, numOfThreads, endTime, stepSch)); - CalculationManagerPtr calculation(new CalculationManager(grid, numOfThreads, endTime, stepSch, CalculationManager::PrePostBc)); + CalculationManagerPtr calculation(new CalculationManager(grid, numOfThreads, endTime, stepSch)); + //CalculationManagerPtr calculation(new CalculationManager(grid, numOfThreads, endTime, stepSch, CalculationManager::PrePostBc)); //calculation->setTimeAveragedValuesCoProcessor(tav); if (myid == 0) UBLOG(logINFO, "Simulation-start"); calculation->calculate(); diff --git a/source/Applications/mirror/mirror.cfg b/source/Applications/mirror/mirror.cfg index 4620a2e7d6e56a0775e81bb57769655d08ce684a..29ebcb3218cef3c70d6eab92f94dd975fe346618 100644 --- a/source/Applications/mirror/mirror.cfg +++ b/source/Applications/mirror/mirror.cfg @@ -21,7 +21,7 @@ numOfThreads = 4 availMem = 10e9 refineLevel = 11 #blockNx = 9 8 9 -blockNx = 6 6 6 +blockNx = 14 8 10 #x1min x1max x2min x2max x3min x3max [m] #bounding box @@ -49,12 +49,6 @@ restartStepStart = 100 outTime = 1 endTime = 10 -logToFile = true - -porousTralingEdge = false - -thinWall = false - -testBox=false +logToFile = flase nupsStep = 1 1 10000000 \ No newline at end of file diff --git a/source/Applications/mirror/mirror.cpp b/source/Applications/mirror/mirror.cpp index 9db898a951ff5d6528144c3d7f29f3f738865b4a..c9830e019031caade0b69aee3c0fcfb1ad1dcf68 100644 --- a/source/Applications/mirror/mirror.cpp +++ b/source/Applications/mirror/mirror.cpp @@ -95,7 +95,7 @@ void run(string configname) double nueReal = 153.5e-7; //m^2/s double lReal = 2.048;//m - double uReal = 140.0*3.6; + double uReal = 140.0/3.6; double Re = uReal*lReal/nueReal; diff --git a/source/Applications/mpi_benchmark/CMakeLists.txt b/source/Applications/mpi_benchmark/CMakeLists.txt index 7869ef7ee5cbb89cda184225b1b2005fbec727ea..51933653f9ed6866d6f514a12f5863e4fb5167e1 100644 --- a/source/Applications/mpi_benchmark/CMakeLists.txt +++ b/source/Applications/mpi_benchmark/CMakeLists.txt @@ -3,9 +3,9 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8) ######################################################## ## C++ PROJECT ### ######################################################## -PROJECT(sscaling) +PROJECT(mpib) -INCLUDE(${SOURCE_ROOT}/lib/IncludsList.txt) +INCLUDE(${SOURCE_ROOT}/IncludsList.cmake) ################################################################# ### LOCAL FILES ### @@ -17,9 +17,9 @@ FILE(GLOB SPECIFIC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.h SET(ALL_SOURCES ${ALL_SOURCES} ${SPECIFIC_FILES}) SOURCE_GROUP(src FILES ${SPECIFIC_FILES}) -SET(CAB_ADDITIONAL_LINK_LIBRARIES vfluids) +SET(CAB_ADDITIONAL_LINK_LIBRARIES VirtualFluids) ################################################################# ### CREATE PROJECT ### ################################################################# -CREATE_CAB_PROJECT(sscaling BINARY) +CREATE_CAB_PROJECT(mpib BINARY) diff --git a/source/Applications/mpi_benchmark/mpib.cfg b/source/Applications/mpi_benchmark/mpib.cfg new file mode 100644 index 0000000000000000000000000000000000000000..da53366e9d172fd7d1b84a71ef3aa739d16cee49 --- /dev/null +++ b/source/Applications/mpi_benchmark/mpib.cfg @@ -0,0 +1,10 @@ +pathOut = d:/temp/mpib +output = true +numOfThreads = 4 +availMem = 3e9 +blockNx = 8 8 8 +logToFile = false +oneD = true +priorityQueue = false +nupsStep = 10 10 100 +endTime = 100 \ No newline at end of file diff --git a/source/Applications/mpi_benchmark/mpib.cpp b/source/Applications/mpi_benchmark/mpib.cpp new file mode 100644 index 0000000000000000000000000000000000000000..9292bc0a1e35e98782f67210f75cc613a0596d4f --- /dev/null +++ b/source/Applications/mpi_benchmark/mpib.cpp @@ -0,0 +1,267 @@ +#include <iostream> +#include <string> + +#include "VirtualFluids.h" + +using namespace std; + + +void run(string configname) +{ + CommunicatorPtr comm = MPICommunicator::getInstance(); + int myid = comm->getProcessID(); + + // Get the name of the processor + char machinename[MPI_MAX_PROCESSOR_NAME]; + int name_len; + MPI_Get_processor_name(machinename, &name_len); + + try + { + //UbLog::reportingLevel() = UbLog::logLevelFromString("DEBUG5"); + + ConfigurationFile config; + config.load(configname); + + string pathOut = config.getString("pathOut"); + double endTime = config.getDouble("endTime"); + int numOfThreads = config.getInt("numOfThreads"); + vector<int> blockNx = config.getVector<int>("blockNx"); + double availMem = config.getDouble("availMem"); + bool logToFile = config.getBool("logToFile"); + bool oneD = config.getBool("oneD"); + bool output = config.getBool("output"); + vector<double> nupsStep = config.getVector<double>("nupsStep"); + bool priorityQueue = config.getBool("priorityQueue"); + + if (logToFile) + { +#if defined(__unix__) + if (myid==0) + { + const char* str = pathOut.c_str(); + mkdir(str, S_IRWXU|S_IRWXG|S_IROTH|S_IXOTH); + } +#endif + + if (myid==0) + { + stringstream logFilename; + logFilename<<pathOut+"/logfile"+UbSystem::toString(UbSystem::getTimeStamp())+".txt"; + UbLog::output_policy::setStream(logFilename.str()); + } + } + + if (myid==0) + { + UBLOG(logINFO, "MPI benchmark"); + UBLOG(logINFO, "1. PID = "<<myid<<" host name: "<<machinename); + UBLOG(logINFO, "1. PID = "<<myid<<" Number of processes = "<<comm->getNumberOfProcesses()); + UBLOG(logINFO, "1. PID = "<<myid<<" Number of threads = "<<numOfThreads); + UBLOG(logINFO, "1. PID = "<<myid<<" Total Physical Memory (RAM): "<<Utilities::getTotalPhysMem()/1073741824.0<<" GB"); + UBLOG(logINFO, "1. PID = "<<myid<<" Physical Memory currently used: "<<Utilities::getPhysMemUsed()/1073741824.0<<" GB"); + UBLOG(logINFO, "1. PID = "<<myid<<" Physical Memory currently used by current process: "<<Utilities::getPhysMemUsedByMe()/1073741824.0<<" GB"); + + } + + double dx = 1; + double g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3; + double factor = 1.0; + + if (oneD) + { + factor = comm->getNumberOfProcesses() * numOfThreads; + g_minX1 = 0; + g_minX2 = 0; + g_minX3 = 0; + + g_maxX1 = blockNx[0]*2.0 * factor; + g_maxX2 = blockNx[1]*2.0; + g_maxX3 = blockNx[2]*2.0; + } + else + { + factor = pow(comm->getNumberOfProcesses() * numOfThreads, 1.0/3.0); + g_minX1 = 0; + g_minX2 = 0; + g_minX3 = 0; + + g_maxX1 = blockNx[0]*2.0 * factor; + g_maxX2 = blockNx[1]*2.0 * factor; + g_maxX3 = blockNx[2]*2.0 * factor; + } + + LBMReal uLB = 0.05; + LBMReal Re = 20.0; + LBMReal rhoLB = 0.0; + LBMReal nueLB = 0.05842; + + LBMUnitConverterPtr conv = LBMUnitConverterPtr(new LBMUnitConverter()); + + Grid3DPtr grid(new Grid3D(comm)); + grid->setDeltaX(dx); + grid->setBlockNX(blockNx[0], blockNx[1], blockNx[2]); + + GbObject3DPtr gridCube(new GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3)); + if (myid==0&&output) GbSystem3D::writeGeoObject(gridCube.get(), pathOut+"/geo/gridCube", WbWriterVtkXmlASCII::getInstance()); + GenBlocksGridVisitor genBlocks(gridCube); + grid->accept(genBlocks); + + //grid->setPeriodicX1(true); + //grid->setPeriodicX2(true); + //grid->setPeriodicX3(true); + + if (myid==0) + { + UBLOG(logINFO, "//////////////////////////////////////////////////////////////////////////"); + UBLOG(logINFO, "2. PID = "<<myid<<" Total Physical Memory (RAM): "<<Utilities::getTotalPhysMem()/1073741824.0<<" GB"); + UBLOG(logINFO, "2. PID = "<<myid<<" Physical Memory currently used: "<<Utilities::getPhysMemUsed()/1073741824.0<<" GB"); + UBLOG(logINFO, "2. PID = "<<myid<<" Physical Memory currently used by current process: "<<Utilities::getPhysMemUsedByMe()/1073741824.0<<" GB"); + UBLOG(logINFO, "//////////////////////////////////////////////////////////////////////////"); + } + + if (priorityQueue) + { + if (myid==0) UBLOG(logINFO, "MetisPartitioningGridVisitor:start"); + MetisPartitioningGridVisitor metisVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::BSW); + grid->accept(metisVisitor); + if (myid==0) UBLOG(logINFO, "MetisPartitioningGridVisitor:end"); + + //set connectors + if (myid==0) UBLOG(logINFO, "SetConnectorsBlockVisitor:start"); + InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolationProcessor()); + SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nueLB, iProcessor); + grid->accept(setConnsVisitor); + if (myid==0) UBLOG(logINFO, "SetConnectorsBlockVisitor:end"); + + //domain decomposition for threads + if (myid==0) UBLOG(logINFO, "PQueuePartitioningGridVisitor:start"); + PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads); + grid->accept(pqPartVisitor); + if (myid==0) UBLOG(logINFO, "PQueuePartitioningGridVisitor:end"); + } + else + { + if (myid==0) UBLOG(logINFO, "MetisPartitioningGridVisitor:start"); + MetisPartitioningGridVisitor metisVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::BSW, MetisPartitioner::KWAY, true, numOfThreads); + grid->accept(metisVisitor); + if (myid==0) UBLOG(logINFO, "MetisPartitioningGridVisitor:end"); + + //set connectors + if (myid==0) UBLOG(logINFO, "SetConnectorsBlockVisitor:start"); + InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolationProcessor()); + SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nueLB, iProcessor); + grid->accept(setConnsVisitor); + if (myid==0) UBLOG(logINFO, "SetConnectorsBlockVisitor:end"); + } + + + if (output) + { + WriteBlocksCoProcessor ppblocks(grid, UbSchedulerPtr(new UbScheduler(1)), pathOut, WbWriterVtkXmlBinary::getInstance(), comm); + ppblocks.process(0); + } + + unsigned long nob = grid->getNumberOfBlocks(); + int gl = 3; + unsigned long nodb = (blockNx[0])* (blockNx[1])* (blockNx[2]); + unsigned long nod = nob * (blockNx[0])* (blockNx[1])* (blockNx[2]); + unsigned long nodg = nob * (blockNx[0]+gl) * (blockNx[1]+gl) * (blockNx[2]+gl); + double needMemAll = double(nodg*(27*sizeof(double)+sizeof(int)+sizeof(float)*4)); + double needMem = needMemAll/double(comm->getNumberOfProcesses()); + + if (myid==0) + { + UBLOG(logINFO, "//////////////////////////////////////////////////////////////////////////"); + UBLOG(logINFO, "Setup information:"); + UBLOG(logINFO, "Size of block = "<<blockNx[0]<<" x "<<blockNx[1]<<" x "<<blockNx[2] <<" nodes"); + UBLOG(logINFO, "Size of domain = "<<g_maxX1<<" x "<<g_maxX2<<" x "<<g_maxX3<<" dx "); + UBLOG(logINFO, "Number of blocks = "<<nob); + UBLOG(logINFO, "Number of nodes = "<<nod); + 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<<" = "<<nob); + UBLOG(logINFO, "Number of nodes for level "<<level<<" = "<<nob*nodb); + } + UBLOG(logINFO, "//////////////////////////////////////////////////////////////////////////"); + UBLOG(logINFO, "Necessary memory = "<<needMemAll/1073741824.0<<" GB"); + UBLOG(logINFO, "Necessary memory per process = "<<needMem/1073741824.0<<" GB"); + UBLOG(logINFO, "Available memory per process = "<<availMem/1073741824.0<<" GB"); + UBLOG(logINFO, "//////////////////////////////////////////////////////////////////////////"); + } + + LBMKernelPtr kernel; + kernel = LBMKernelPtr(new IncompressibleCumulantLBMKernel(blockNx[0], blockNx[1], blockNx[2], IncompressibleCumulantLBMKernel::NORMAL)); + + BCProcessorPtr bcProc(new BCProcessor()); + kernel->setBCProcessor(bcProc); + + SetKernelBlockVisitor kernelVisitor(kernel, nueLB, availMem, needMem); + grid->accept(kernelVisitor); + + //initialization of distributions + InitDistributionsBlockVisitor initVisitor(nueLB, rhoLB); + initVisitor.setVx1(uLB); + grid->accept(initVisitor); + + + UbSchedulerPtr nupsSch(new UbScheduler(nupsStep[0], nupsStep[1], nupsStep[2])); + NUPSCounterCoProcessor npr(grid, nupsSch, numOfThreads, comm); + + UbSchedulerPtr visSch(new UbScheduler(500, 500)); + + if (myid==0) + { + UBLOG(logINFO, "//////////////////////////////////////////////////////////////////////////"); + UBLOG(logINFO, "System information:"); + UBLOG(logINFO, "Total Physical Memory (RAM): "<<Utilities::getTotalPhysMem()/1073741824.0<<" GB"); + UBLOG(logINFO, "Physical Memory currently used: "<<Utilities::getPhysMemUsed()/1073741824.0<<" GB"); + UBLOG(logINFO, "Physical Memory currently used by current process: "<<Utilities::getPhysMemUsedByMe()/1073741824.0<<" GB"); + UBLOG(logINFO, "//////////////////////////////////////////////////////////////////////////"); + } + + 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<<"PID = "<<myid<<" host name: "<<machinename<<endl<<flush; + cerr<<e.what()<<endl<<flush<< + boost::current_exception_diagnostic_information(); + } + catch (std::string& s) + { + cerr<<s<<endl<<boost::current_exception_diagnostic_information(); + } + catch (...) + { + cerr<<"unknown exception"<<endl<< + boost::current_exception_diagnostic_information(); + } +} + +int main(int argc, char* argv[]) +{ + + if (argv!=NULL) + { + if (argv[1]!=NULL) + { + run(string(argv[1])); + } + else + { + cout<<"Configuration file must be set!: "<<argv[0]<<" <config file>"<<endl<<std::flush; + } + } + + return 0; +} + + + diff --git a/source/Applications/mpi_benchmark/sscaling.cpp b/source/Applications/mpi_benchmark/sscaling.cpp deleted file mode 100644 index 7780ad75a6a50af98647dafb0148e820731ab73c..0000000000000000000000000000000000000000 --- a/source/Applications/mpi_benchmark/sscaling.cpp +++ /dev/null @@ -1,207 +0,0 @@ -#include <iostream> -#include <string> - -#include "vfluids.h" - -using namespace std; - -int main(int argc, char* argv[]) -{ - //// Initialize the MPI environment - //MPI_Init(NULL, NULL); - - //// Get the number of processes - //int world_size; - //MPI_Comm_size(MPI_COMM_WORLD, &world_size); - - //// Get the rank of the process - //int world_rank; - //MPI_Comm_rank(MPI_COMM_WORLD, &world_rank); - - //// Get the name of the processor - //char processor_name[MPI_MAX_PROCESSOR_NAME]; - //int name_len; - //MPI_Get_processor_name(processor_name, &name_len); - - //// Print off a hello world message - //printf("Hello world from processor %s, rank %d" - // " out of %d processors\n", - // processor_name, world_rank, world_size); - - //// Finalize the MPI environment. - //MPI_Finalize(); - - //Sleep(30000); - - CommunicatorPtr comm = MPICommunicator::getInstance(); - int myid = comm->getProcessID(); - - // Get the name of the processor - char machinename[MPI_MAX_PROCESSOR_NAME]; - int name_len; - MPI_Get_processor_name(machinename, &name_len); - - try - { - double availMem = 1.2e9; - int numOfThreads = 1; - - //UbLog::reportingLevel() = UbLog::logLevelFromString("DEBUG5"); - - stringstream logFilename; - logFilename << "logfile_"+UbSystem::toString(machinename)+"_PID_"+UbSystem::toString(myid)+".txt"; - UbLog::output_policy::setStream(logFilename.str()); - - UBLOG(logINFO, "MPI benchmark"); - UBLOG(logINFO, "1. PID = " << myid << " host name: " << machinename); - UBLOG(logINFO, "1. PID = " << myid << " Number of processes = " << comm->getNumberOfProcesses()); - UBLOG(logINFO, "1. PID = " << myid << " Total Physical Memory (RAM): " << Utilities::getTotalPhysMem()/1073741824.0<< " GB"); - UBLOG(logINFO, "1. PID = " << myid << " Physical Memory currently used: " << Utilities::getPhysMemUsed()/1073741824.0<< " GB"); - UBLOG(logINFO, "1. PID = " << myid << " Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe()/1073741824.0<< " GB"); - - double dx = 1; - - const int blocknx1 = 64; - const int blocknx2 = 64; - const int blocknx3 = 64; - - int gs = 60; // 30; - const int gridNx1 = gs; // *comm->getNumberOfProcesses(); - const int gridNx2 = gs; - const int gridNx3 = gs; - - - double L1 = gridNx1*blocknx1; - double L2, L3, H; - L2 = L3 = H = gridNx2*blocknx1; - - LBMReal uLB = 0.05; - LBMReal Re = 20.0; - LBMReal rhoLB = 0.0; - LBMReal l = L2 / dx; - - LBMReal nueLB = 0.05842; - - LBMUnitConverterPtr conv = LBMUnitConverterPtr(new LBMUnitConverter()); - - double blockLength = blocknx1*dx; - - Grid3DPtr grid(new Grid3D(comm, blocknx1, blocknx2, blocknx3, gridNx1, gridNx2, gridNx3)); - grid->setPeriodicX1(true); - grid->setPeriodicX2(true); - grid->setPeriodicX3(true); - - UBLOG(logINFO, "//////////////////////////////////////////////////////////////////////////"); - UBLOG(logINFO, "2. PID = " << myid << " Total Physical Memory (RAM): " << Utilities::getTotalPhysMem()/1073741824.0<< " GB"); - UBLOG(logINFO, "2. PID = " << myid << " Physical Memory currently used: " << Utilities::getPhysMemUsed()/1073741824.0<< " GB"); - UBLOG(logINFO, "2. PID = " << myid << " Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe()/1073741824.0<< " GB"); - UBLOG(logINFO, "//////////////////////////////////////////////////////////////////////////"); - - UBLOG(logINFO, "MetisPartitioningGridVisitor:start"); - MetisPartitioningGridVisitor metisVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::BSW); - grid->accept(metisVisitor); - UBLOG(logINFO, "MetisPartitioningGridVisitor:end"); - - //set connectors - UBLOG(logINFO, "D3Q27SetConnectorsBlockVisitor:start"); - D3Q27InterpolationProcessorPtr iProcessor(new D3Q27IncompressibleOffsetInterpolationProcessor()); - D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nueLB, iProcessor); - grid->accept(setConnsVisitor); - UBLOG(logINFO, "D3Q27SetConnectorsBlockVisitor:end"); - - //domain decomposition for threads - UBLOG(logINFO, "PQueuePartitioningGridVisitor:start"); - PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads); - grid->accept(pqPartVisitor); - UBLOG(logINFO, "PQueuePartitioningGridVisitor:end"); - - BlocksPostprocessorPtr ppblocks(new BlocksPostprocessor(grid, UbSchedulerPtr(new UbScheduler(1)), ".", WbWriterVtkXmlBinary::getInstance(), comm)); - ppblocks->update(0); - ppblocks.reset(); - - unsigned long nob = grid->getNumberOfBlocks(); - int gl = 3; - unsigned long nodb = (blocknx1)* (blocknx2)* (blocknx3); - unsigned long nod = nob * (blocknx1)* (blocknx2)* (blocknx3); - unsigned long nodg = nob * (blocknx1+gl) * (blocknx2+gl) * (blocknx3+gl); - double needMemAll = double(nodg*(27*sizeof(double) + sizeof(int) + sizeof(float)*4)); - double needMem = needMemAll / double(comm->getNumberOfProcesses()); - - - UBLOG(logINFO, "//////////////////////////////////////////////////////////////////////////"); - UBLOG(logINFO, "Setup information:"); - UBLOG(logINFO, "Number of blocks = " << nob); - UBLOG(logINFO, "Number of nodes = " << nod); - 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 <<" = " << nob); - UBLOG(logINFO, "Number of nodes for level " << level <<" = " << nob*nodb); - } - UBLOG(logINFO, "//////////////////////////////////////////////////////////////////////////"); - UBLOG(logINFO, "Necessary memory = " << needMemAll/1073741824.0 << " GB"); - UBLOG(logINFO, "Necessary memory per process = " << needMem/1073741824.0 << " GB"); - UBLOG(logINFO, "Available memory per process = " << availMem/1073741824.0 << " GB"); - UBLOG(logINFO, "//////////////////////////////////////////////////////////////////////////"); - - - LBMKernel3DPtr kernel; - kernel = LBMKernel3DPtr(new LBMKernelETD3Q27CCLB(blocknx1, blocknx2, blocknx3, LBMKernelETD3Q27CCLB::NORMAL)); - //rhoLB = 1.0; - //kernel = LBMKernel3DPtr(new LBMKernelETD3Q27BGK(blocknx1, blocknx2, blocknx3, true)); - - BCProcessorPtr bcProc(new D3Q27ETBCProcessor()); - kernel->setBCProcessor(bcProc); - - SetKernelBlockVisitor kernelVisitor(kernel, nueLB, availMem, needMem); - grid->accept(kernelVisitor); - - - //initialization of distributions - D3Q27ETInitDistributionsBlockVisitor initVisitor(nueLB, rhoLB); - initVisitor.setVx1(0.0); - grid->accept(initVisitor); - - - UbSchedulerPtr nupsSch(new UbScheduler(10, 30, 100)); - NUPSCounterPostprocessor npr(grid, nupsSch, numOfThreads, comm); - - UbSchedulerPtr visSch(new UbScheduler(500, 500)); - - double endTime = 100; - - UBLOG(logINFO, "//////////////////////////////////////////////////////////////////////////"); - UBLOG(logINFO, "System information:"); - UBLOG(logINFO, "Total Physical Memory (RAM): " << Utilities::getTotalPhysMem()/1073741824.0<< " GB"); - UBLOG(logINFO, "Physical Memory currently used: " << Utilities::getPhysMemUsed()/1073741824.0<<" GB"); - UBLOG(logINFO, "Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe()/1073741824.0<<" GB"); - UBLOG(logINFO, "//////////////////////////////////////////////////////////////////////////"); - - CalculationManagerPtr calculation(new CalculationManager(grid, numOfThreads, endTime, visSch)); - UBLOG(logINFO, "Simulation-start"); - calculation->calculate(); - UBLOG(logINFO, "Simulation-end"); - } - catch (std::exception& e) - { - cerr << "PID = " << myid << " host name: " << machinename << endl << flush; - cerr << e.what() << endl << flush<< - boost::current_exception_diagnostic_information(); - } - catch (std::string& s) - { - cerr << s << endl<<boost::current_exception_diagnostic_information(); - } - catch (...) - { - cerr << "unknown exception" << endl<< - boost::current_exception_diagnostic_information(); - } - - return 0; -} - - - diff --git a/source/Applications/mpi_benchmark/startJobPhoenix.slrm b/source/Applications/mpi_benchmark/startJobPhoenix.slrm new file mode 100644 index 0000000000000000000000000000000000000000..b93a2c1006cc49fbcf1667d62d2255766d257c14 --- /dev/null +++ b/source/Applications/mpi_benchmark/startJobPhoenix.slrm @@ -0,0 +1,19 @@ +#!/bin/bash +#SBATCH -J vfb +#SBATCH --ntasks=1 +##SBATCH --ntasks-per-node=10 +##SBATCH --threads-per-core=1 +##SBATCH --mem-per-cpu=3000 +#SBATCH --time=20:00:00 + +module load lib/boost/1.63.0/intel +module load mpi/intelmpi/2017.2.174 +module load intel-studio-2017 + +#set OMP_NUM_THREADS=20 + +APP=./sscaling +THREADS=1 + +mpiexec $APP $THREADS +#mpiexec hostname diff --git a/source/Applications/mpi_benchmark/startMPIB.pbs b/source/Applications/mpi_benchmark/startMPIB.pbs new file mode 100644 index 0000000000000000000000000000000000000000..534f63f200059a4ef3e04598df1527adcf2b0c12 --- /dev/null +++ b/source/Applications/mpi_benchmark/startMPIB.pbs @@ -0,0 +1,18 @@ +#!/bin/sh + +#PBS -A nii00092 +#PBS -N mpib +#PBS -j oe +#PBS -l nodes=1:ppn=20 +#PBS -l walltime=0:30:00 +##PBS -l feature=mpp2 +#PBS -l feature=mpp2:test + +cd $PBS_O_WORKDIR + +APP=./sscaling +THREADS=1 + +#aprun -n 6000 -N 20 -d 1 -j 1 -cc none $APP $THREADS +aprun -n 20 -N 20 -d 1 -j 1 -cc none $APP $THREADS + diff --git a/source/VirtualFluids.h b/source/VirtualFluids.h index 43c809702fbad0dd6f9a62bfc49d1b696c45a325..1a33e44b0e5ee971140cc0e40a91b6707d900228 100644 --- a/source/VirtualFluids.h +++ b/source/VirtualFluids.h @@ -103,6 +103,7 @@ #include <BoundaryConditions/SlipBCAlgorithm.h> #include <BoundaryConditions/NonReflectingDensityBCAlgorithm.h> #include <BoundaryConditions/NonReflectingVelocityBCAlgorithm.h> +#include <BoundaryConditions/NonReflectingSlipBCAlgorithm.h> #include <Connectors/Block3DConnector.h> #include <Connectors/D3Q27ETCFOffVectorConnector.h> diff --git a/source/VirtualFluidsCore/BoundaryConditions/BCAlgorithm.h b/source/VirtualFluidsCore/BoundaryConditions/BCAlgorithm.h index 7306dab2e3f7288af5f6c5e85b72f5e37fb23447..0427d27835954b7e34752f5ca0ef0d292357f4bd 100644 --- a/source/VirtualFluidsCore/BoundaryConditions/BCAlgorithm.h +++ b/source/VirtualFluidsCore/BoundaryConditions/BCAlgorithm.h @@ -30,6 +30,7 @@ public: static const char ThinWallNoSlipBCAlgorithm = 6; static const char NonReflectingVelocityBCAlgorithm = 7; static const char NonReflectingDensityBCAlgorithm = 8; + static const char NonReflectingSlipBCAlgorithm = 9; public: BCAlgorithm(); virtual ~BCAlgorithm() {} diff --git a/source/VirtualFluidsCore/BoundaryConditions/NonReflectingSlipBCAlgorithm.cpp b/source/VirtualFluidsCore/BoundaryConditions/NonReflectingSlipBCAlgorithm.cpp new file mode 100644 index 0000000000000000000000000000000000000000..cf6a30d159869470ae54a3afa263a64c67cfeeb1 --- /dev/null +++ b/source/VirtualFluidsCore/BoundaryConditions/NonReflectingSlipBCAlgorithm.cpp @@ -0,0 +1,86 @@ +#include "NonReflectingSlipBCAlgorithm.h" + +NonReflectingSlipBCAlgorithm::NonReflectingSlipBCAlgorithm() +{ + BCAlgorithm::type = BCAlgorithm::NonReflectingSlipBCAlgorithm; + BCAlgorithm::preCollision = false; +} +////////////////////////////////////////////////////////////////////////// +NonReflectingSlipBCAlgorithm::~NonReflectingSlipBCAlgorithm() +{ + +} +////////////////////////////////////////////////////////////////////////// +BCAlgorithmPtr NonReflectingSlipBCAlgorithm::clone() +{ + BCAlgorithmPtr bc(new NonReflectingSlipBCAlgorithm()); + return bc; +} +////////////////////////////////////////////////////////////////////////// +void NonReflectingSlipBCAlgorithm::addDistributions(DistributionArray3DPtr distributions) +{ + this->distributions = distributions; +} +////////////////////////////////////////////////////////////////////////// +void NonReflectingSlipBCAlgorithm::applyBC() +{ + LBMReal f[D3Q27System::ENDF+1]; + LBMReal feq[D3Q27System::ENDF+1]; + distributions->getDistributionInv(f, x1, x2, x3); + LBMReal rho, vx1, vx2, vx3, drho; + calcMacrosFct(f, drho, vx1, vx2, vx3); + calcFeqFct(feq, drho, vx1, vx2, vx3); + + UbTupleFloat3 normale = bcPtr->getNormalVector(); + LBMReal amp = vx1*val<1>(normale)+vx2*val<2>(normale)+vx3*val<3>(normale); + + vx1 = vx1-amp * val<1>(normale); //normale zeigt von struktur weg! + vx2 = vx2-amp * val<2>(normale); //normale zeigt von struktur weg! + vx3 = vx3-amp * val<3>(normale); //normale zeigt von struktur weg! + + rho = 1.0+drho*compressibleFactor; + + for (int fdir = D3Q27System::FSTARTDIR; fdir<=D3Q27System::FENDDIR; fdir++) + { + if (bcPtr->hasSlipBoundaryFlag(fdir)) + { + //quadratic bounce back + const int invDir = D3Q27System::INVDIR[fdir]; + LBMReal q = 1.0;//bcPtr->getQ(invDir);// m+m q=0 stabiler + //vx3=0; + LBMReal velocity = 0.0; + switch (invDir) + { + case D3Q27System::E: velocity = (UbMath::c4o9*(+vx1)); break; //(2/cs^2)(=6)*rho_0(=1 bei imkompr)*wi*u*ei mit cs=1/sqrt(3) + case D3Q27System::W: velocity = (UbMath::c4o9*(-vx1)); break; //z.B. aus paper manfred MRT LB models in three dimensions (2002) + case D3Q27System::N: velocity = (UbMath::c4o9*(+vx2)); break; + case D3Q27System::S: velocity = (UbMath::c4o9*(-vx2)); break; + case D3Q27System::T: velocity = (UbMath::c4o9*(+vx3)); break; + case D3Q27System::B: velocity = (UbMath::c4o9*(-vx3)); break; + case D3Q27System::NE: velocity = (UbMath::c1o9*(+vx1+vx2)); break; + case D3Q27System::SW: velocity = (UbMath::c1o9*(-vx1-vx2)); break; + case D3Q27System::SE: velocity = (UbMath::c1o9*(+vx1-vx2)); break; + case D3Q27System::NW: velocity = (UbMath::c1o9*(-vx1+vx2)); break; + case D3Q27System::TE: velocity = (UbMath::c1o9*(+vx1+vx3)); break; + case D3Q27System::BW: velocity = (UbMath::c1o9*(-vx1-vx3)); break; + case D3Q27System::BE: velocity = (UbMath::c1o9*(+vx1-vx3)); break; + case D3Q27System::TW: velocity = (UbMath::c1o9*(-vx1+vx3)); break; + case D3Q27System::TN: velocity = (UbMath::c1o9*(+vx2+vx3)); break; + case D3Q27System::BS: velocity = (UbMath::c1o9*(-vx2-vx3)); break; + case D3Q27System::BN: velocity = (UbMath::c1o9*(+vx2-vx3)); break; + case D3Q27System::TS: velocity = (UbMath::c1o9*(-vx2+vx3)); break; + case D3Q27System::TNE: velocity = (UbMath::c1o36*(+vx1+vx2+vx3)); break; + case D3Q27System::BSW: velocity = (UbMath::c1o36*(-vx1-vx2-vx3)); break; + case D3Q27System::BNE: velocity = (UbMath::c1o36*(+vx1+vx2-vx3)); break; + case D3Q27System::TSW: velocity = (UbMath::c1o36*(-vx1-vx2+vx3)); break; + case D3Q27System::TSE: velocity = (UbMath::c1o36*(+vx1-vx2+vx3)); break; + case D3Q27System::BNW: velocity = (UbMath::c1o36*(-vx1+vx2-vx3)); break; + case D3Q27System::BSE: velocity = (UbMath::c1o36*(+vx1-vx2-vx3)); break; + case D3Q27System::TNW: velocity = (UbMath::c1o36*(-vx1+vx2+vx3)); break; + default: throw UbException(UB_EXARGS, "unknown error"); + } + LBMReal fReturn = ((1.0 - q) / (1.0 + q))*((f[invDir] - feq[invDir]) / (1.0 - collFactor) + feq[invDir]) + ((q*(f[invDir] + f[fdir]) - velocity*rho) / (1.0 + q))-drho*D3Q27System::WEIGTH[invDir]; + distributions->setDistributionForDirection(fReturn, x1+D3Q27System::DX1[invDir], x2+D3Q27System::DX2[invDir], x3+D3Q27System::DX3[invDir], fdir); + } + } +} \ No newline at end of file diff --git a/source/VirtualFluidsCore/BoundaryConditions/NonReflectingSlipBCAlgorithm.h b/source/VirtualFluidsCore/BoundaryConditions/NonReflectingSlipBCAlgorithm.h new file mode 100644 index 0000000000000000000000000000000000000000..597f9e2eae8d949f33f7897835150865587b949f --- /dev/null +++ b/source/VirtualFluidsCore/BoundaryConditions/NonReflectingSlipBCAlgorithm.h @@ -0,0 +1,27 @@ +#ifndef NonReflectingSlipBCAlgorithm_h__ +#define NonReflectingSlipBCAlgorithm_h__ + +#include "BCAlgorithm.h" + +class NonReflectingSlipBCAlgorithm; +typedef boost::shared_ptr<NonReflectingSlipBCAlgorithm> NonReflectingSlipBCAlgorithmPtr; + +class NonReflectingSlipBCAlgorithm : public BCAlgorithm +{ +public: + NonReflectingSlipBCAlgorithm(); + virtual ~NonReflectingSlipBCAlgorithm(); + BCAlgorithmPtr clone(); + void addDistributions(DistributionArray3DPtr distributions); +protected: + void applyBC(); +private: + //friend class boost::serialization::access; + //template<class Archive> + //void serialize(Archive & ar, const unsigned int version) + //{ + // ar & boost::serialization::base_object<BCAlgorithm>(*this); + //} +}; +#endif // NonReflectingSlipBCAlgorithm_h__ + diff --git a/source/VirtualFluidsCore/BoundaryConditions/SlipBCAlgorithm.cpp b/source/VirtualFluidsCore/BoundaryConditions/SlipBCAlgorithm.cpp index e60abfdd758ec1b012a60e35f1d2fcb4b7d431c2..118dcba5fb8438259527ac13a5cf929ad53eafba 100644 --- a/source/VirtualFluidsCore/BoundaryConditions/SlipBCAlgorithm.cpp +++ b/source/VirtualFluidsCore/BoundaryConditions/SlipBCAlgorithm.cpp @@ -27,9 +27,9 @@ void SlipBCAlgorithm::applyBC() LBMReal f[D3Q27System::ENDF+1]; LBMReal feq[D3Q27System::ENDF+1]; distributions->getDistributionInv(f, x1, x2, x3); - LBMReal rho, vx1, vx2, vx3; - calcMacrosFct(f, rho, vx1, vx2, vx3); - calcFeqFct(feq, rho, vx1, vx2, vx3); + LBMReal rho, vx1, vx2, vx3, drho; + calcMacrosFct(f, drho, vx1, vx2, vx3); + calcFeqFct(feq, drho, vx1, vx2, vx3); UbTupleFloat3 normale = bcPtr->getNormalVector(); LBMReal amp = vx1*val<1>(normale)+vx2*val<2>(normale)+vx3*val<3>(normale); @@ -38,6 +38,8 @@ void SlipBCAlgorithm::applyBC() vx2 = vx2 - amp * val<2>(normale); //normale zeigt von struktur weg! vx3 = vx3 - amp * val<3>(normale); //normale zeigt von struktur weg! + rho = 1.0+drho*compressibleFactor; + for (int fdir = D3Q27System::FSTARTDIR; fdir<=D3Q27System::FENDDIR; fdir++) { if (bcPtr->hasSlipBoundaryFlag(fdir)) @@ -77,7 +79,7 @@ void SlipBCAlgorithm::applyBC() case D3Q27System::TNW: velocity = (UbMath::c1o36*(-vx1+vx2+vx3)); break; default: throw UbException(UB_EXARGS, "unknown error"); } - LBMReal fReturn = ((1.0-q)/(1.0+q))*((f[invDir]-feq[invDir])/(1.0-collFactor)+feq[invDir])+((q*(f[invDir]+f[fdir])-velocity)/(1.0+q)); + LBMReal fReturn = ((1.0-q)/(1.0+q))*((f[invDir]-feq[invDir])/(1.0-collFactor)+feq[invDir])+((q*(f[invDir]+f[fdir])-velocity*rho)/(1.0+q)); distributions->setDistributionForDirection(fReturn, x1+D3Q27System::DX1[invDir], x2+D3Q27System::DX2[invDir], x3+D3Q27System::DX3[invDir], fdir); } } diff --git a/source/VirtualFluidsCore/CoProcessors/RestartCoProcessor.cpp b/source/VirtualFluidsCore/CoProcessors/RestartCoProcessor.cpp index c2866958cece78596c1965e6f4f2e78ad5adc242..c65602e3a7cf656567125b1403427a0f65a2dec5 100644 --- a/source/VirtualFluidsCore/CoProcessors/RestartCoProcessor.cpp +++ b/source/VirtualFluidsCore/CoProcessors/RestartCoProcessor.cpp @@ -355,7 +355,15 @@ void RestartCoProcessor::writeDistributedGrid(Grid3DPtr sgrid, int numberOfProce } writeMetafile(1); } - - +////////////////////////////////////////////////////////////////////////// +void RestartCoProcessor::setArchiveType(ArchiveType type) +{ + archiveType = type; +} +////////////////////////////////////////////////////////////////////////// +RestartCoProcessor::ArchiveType RestartCoProcessor::getArchiveType() +{ + return archiveType; +} diff --git a/source/VirtualFluidsCore/CoProcessors/RestartCoProcessor.h b/source/VirtualFluidsCore/CoProcessors/RestartCoProcessor.h index d8c2f5a4c447ed294af81fd7f035ad5b56576245..ba0c25335811cc1dd9c548737bde6fceb7a27257 100644 --- a/source/VirtualFluidsCore/CoProcessors/RestartCoProcessor.h +++ b/source/VirtualFluidsCore/CoProcessors/RestartCoProcessor.h @@ -15,8 +15,8 @@ class RestartCoProcessor : public CoProcessor public: enum ArchiveType {TXT, BINARY}; public: - RestartCoProcessor(Grid3DPtr& grid, UbSchedulerPtr s, CommunicatorPtr comm, const std::string& path, ArchiveType typetype = BINARY); - RestartCoProcessor(Grid3DPtr& grid, UbSchedulerPtr s, CommunicatorPtr comm, const std::string& path, int restartStep, ArchiveType typetype = BINARY); + RestartCoProcessor(Grid3DPtr& grid, UbSchedulerPtr s, CommunicatorPtr comm, const std::string& path, ArchiveType type = BINARY); + RestartCoProcessor(Grid3DPtr& grid, UbSchedulerPtr s, CommunicatorPtr comm, const std::string& path, int restartStep, ArchiveType type = BINARY); ~RestartCoProcessor(); void process(double step); void addCoProcessor(CoProcessorPtr p); @@ -27,6 +27,8 @@ public: void doCheckPoint(int step); Grid3DPtr restart(); void writeDistributedGrid(Grid3DPtr grid, int numberOfProcesses); + void setArchiveType(ArchiveType type); + ArchiveType getArchiveType(); protected: void acceptGridVisitors(); void acceptBlockVisitors(); diff --git a/source/VirtualFluidsCore/Connectors/D3Q27ETCFOffVectorConnector.h b/source/VirtualFluidsCore/Connectors/D3Q27ETCFOffVectorConnector.h index 8ced3dd3321f100e560bf296ad8fc3b0ac750336..40cd0993191e5a7578496bfb375ab7f416fb9de9 100644 --- a/source/VirtualFluidsCore/Connectors/D3Q27ETCFOffVectorConnector.h +++ b/source/VirtualFluidsCore/Connectors/D3Q27ETCFOffVectorConnector.h @@ -1908,8 +1908,8 @@ void D3Q27ETCFOffVectorConnector< VectorTransmitter>::findCFnodes(DistributionAr " interpolation is not implemented for other direction" + " by using in: " + (std::string)typeid(*this).name() + " or maybe you have a solid on the block boundary"; - UBLOG(logINFO, err); - //UB_THROW(UbException(UB_EXARGS, err)); + //UBLOG(logINFO, err); + UB_THROW(UbException(UB_EXARGS, err)); } } diff --git a/source/VirtualFluidsCore/Connectors/D3Q27ETFCOffVectorConnector.h b/source/VirtualFluidsCore/Connectors/D3Q27ETFCOffVectorConnector.h index a5408d6582255f0336037300a1a6a5a1fd55d579..6d3eafe7f6623f5a4d20ca2256108884012fee58 100644 --- a/source/VirtualFluidsCore/Connectors/D3Q27ETFCOffVectorConnector.h +++ b/source/VirtualFluidsCore/Connectors/D3Q27ETFCOffVectorConnector.h @@ -759,8 +759,8 @@ void D3Q27ETFCOffVectorConnector< VectorTransmitter>::fillSendVector(Distributio " interpolation is not implemented for other direction"+ " by using in: "+(std::string)typeid(*this).name()+ " or maybe you have a solid on the block boundary"; - UBLOG(logINFO, err); - //UB_THROW(UbException(UB_EXARGS, err)); + //UBLOG(logINFO, err); + UB_THROW(UbException(UB_EXARGS, err)); } } diff --git a/source/VirtualFluidsCore/Grid/Calculator.cpp b/source/VirtualFluidsCore/Grid/Calculator.cpp index ddd87a83d921b147a68f8e219c7836d71252c79c..895b1dd644e69d40ad926905d1f86893a59dd282 100644 --- a/source/VirtualFluidsCore/Grid/Calculator.cpp +++ b/source/VirtualFluidsCore/Grid/Calculator.cpp @@ -81,7 +81,7 @@ void Calculator::calculate(const double& endTime, CalculationManagerPtr cm, boos ////////////////////////////////////////////////////////////////////////// #ifdef TIMING - //UBLOG(logINFO, "calcStep = " <<calcStep); + UBLOG(logINFO, "calcStep = " <<calcStep); #endif ////////////////////////////////////////////////////////////////////////// @@ -109,7 +109,7 @@ void Calculator::calculate(const double& endTime, CalculationManagerPtr cm, boos ////////////////////////////////////////////////////////////////////////// #ifdef TIMING time[0] = timer.stop(); - //UBLOG(logINFO, "calculateBlocks time = " <<time); + UBLOG(logINFO, "calculateBlocks time = " <<time[0]); #endif ////////////////////////////////////////////////////////////////////////// @@ -119,7 +119,7 @@ void Calculator::calculate(const double& endTime, CalculationManagerPtr cm, boos ////////////////////////////////////////////////////////////////////////// #ifdef TIMING time[1] = timer.stop(); - //UBLOG(logINFO, "exchangeBlockData time = " <<time); + UBLOG(logINFO, "exchangeBlockData time = " <<time[1]); #endif ////////////////////////////////////////////////////////////////////////// //applyBCs(straightStartLevel, maxInitLevel); @@ -128,7 +128,7 @@ void Calculator::calculate(const double& endTime, CalculationManagerPtr cm, boos ////////////////////////////////////////////////////////////////////////// #ifdef TIMING time[2] = timer.stop(); - //UBLOG(logINFO, "applyBCs time = " <<time); + UBLOG(logINFO, "applyBCs time = " <<time[2]); #endif ////////////////////////////////////////////////////////////////////////// @@ -144,7 +144,7 @@ void Calculator::calculate(const double& endTime, CalculationManagerPtr cm, boos ////////////////////////////////////////////////////////////////////////// #ifdef TIMING time[3] = timer.stop(); - //UBLOG(logINFO, "swapDistributions time = " <<time); + UBLOG(logINFO, "swapDistributions time = " <<time[3]); #endif ////////////////////////////////////////////////////////////////////////// @@ -159,7 +159,7 @@ void Calculator::calculate(const double& endTime, CalculationManagerPtr cm, boos ////////////////////////////////////////////////////////////////////////// #ifdef TIMING time[4] = timer.stop(); - UBLOG(logINFO, "refinement exchangeBlockData time = " <<time); + UBLOG(logINFO, "refinement exchangeBlockData time = " <<time[4]); #endif ////////////////////////////////////////////////////////////////////////// //now ghost nodes have actual values @@ -168,7 +168,7 @@ void Calculator::calculate(const double& endTime, CalculationManagerPtr cm, boos ////////////////////////////////////////////////////////////////////////// #ifdef TIMING time[5] = timer.stop(); - UBLOG(logINFO, "refinement interpolation time = " <<time); + UBLOG(logINFO, "refinement interpolation time = " <<time[5]); #endif ////////////////////////////////////////////////////////////////////////// }