diff --git a/source/Applications/AcousticPulse/ap.cpp b/source/Applications/AcousticPulse/ap.cpp index ea9b3c9a0b768fa039509072a46b13e9b5424832..ce4b07e7c6d487f44427e4a7579e873b94f1b3cf 100644 --- a/source/Applications/AcousticPulse/ap.cpp +++ b/source/Applications/AcousticPulse/ap.cpp @@ -42,8 +42,8 @@ void run() ////////////////////////////////////////////////////////////////////////// //DLR-F16 test - //dx_coarse = 0.003 mm - string pathname = "d:/temp/AcousticPulseXZ-0.003-omega"; + ////dx_coarse = 0.003 mm + string pathname = "d:/temp/AcousticPulseXZ-4th-0.003"; int endTime = 20; double outTime = 20; LBMReal dx = 0.003; @@ -51,15 +51,15 @@ void run() LBMReal nuLB = 8.66025e-6; ////////////////////////////////////////////////////////////////////////// ////dx_coarse = 0.0015 mm - //string pathname = "d:/temp/AcousticPulseXZ-0.0015"; + //string pathname = "d:/temp/AcousticPulseXZ-4th-0.0015"; //double endTime = 40; //double outTime = 40; //LBMReal dx = 0.0015; //LBMReal rhoLB = 0.0; //LBMReal nuLB = 8.66025e-6*2.0; //////////////////////////////////////////////////////////////////////////// - //dx_coarse = 0.00075 mm - //string pathname = "d:/temp/AcousticPulseXZ-0.00075"; + ////dx_coarse = 0.00075 mm + //string pathname = "d:/temp/AcousticPulseXZ-4th-0.00075"; //double endTime = 80; //double outTime = 80; //LBMReal dx = 0.00075; @@ -133,20 +133,6 @@ void run() ppblocks->process(0); ppblocks.reset(); - //set connectors - SPtr<InterpolationProcessor> iProcessor(new CompressibleOffsetInterpolationProcessor()); - //SPtr<InterpolationProcessor> iProcessor(new CompressibleOffsetMomentsInterpolationProcessor()); - //dynamicPointerCast<CompressibleOffsetMomentsInterpolationProcessor>(iProcessor)->setBulkOmegaToOmega(true); - SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor); - - UBLOG(logINFO, "SetConnectorsBlockVisitor:start"); - grid->accept(setConnsVisitor); - UBLOG(logINFO, "SetConnectorsBlockVisitor:end"); - - //domain decomposition for threads - PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads); - grid->accept(pqPartVisitor); - unsigned long long numberOfBlocks = (unsigned long long)grid->getNumberOfBlocks(); int ghostLayer = 3; @@ -173,9 +159,9 @@ void run() UBLOG(logINFO, "Available memory per process = " << availMem << " bytes"); } - + double bulckViscosity = 10.0*nuLB; SPtr<LBMKernel> kernel = SPtr<LBMKernel>(new CompressibleCumulant4thOrderViscosityLBMKernel()); - dynamicPointerCast<CompressibleCumulant4thOrderViscosityLBMKernel>(kernel)->setBulkViscosity(10.0*nuLB); + //dynamicPointerCast<CompressibleCumulant4thOrderViscosityLBMKernel>(kernel)->setBulkViscosity(bulckViscosity); //SPtr<LBMKernel> kernel = SPtr<LBMKernel>(new CompressibleCumulantLBMKernel()); //dynamicPointerCast<CompressibleCumulantLBMKernel>(kernel)->setBulkOmegaToOmega(true); // @@ -192,6 +178,16 @@ void run() grid->accept(undefNodesVisitor); } + //set connectors + //SPtr<InterpolationProcessor> iProcessor(new CompressibleOffsetInterpolationProcessor()); + SPtr<InterpolationProcessor> iProcessor(new CompressibleOffsetMomentsInterpolationProcessor()); + //dynamicPointerCast<CompressibleOffsetMomentsInterpolationProcessor>(iProcessor)->setBulkViscosity(nuLB, bulckViscosity); + SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor); + + UBLOG(logINFO, "SetConnectorsBlockVisitor:start"); + grid->accept(setConnsVisitor); + UBLOG(logINFO, "SetConnectorsBlockVisitor:end"); + mu::Parser fctRoh; //z //fctRoh.SetExpr("epsilon*exp(-alpha*(x1*x1+x2*x2))"); diff --git a/source/Applications/DLR-F16-Solid/f16-solid-coarse.cfg b/source/Applications/DLR-F16-Solid/f16-solid-coarse.cfg index 8634c015a5b69c1d7b3ca787c6abfbb1be972892..ef4dfc22d540e8f2f234e4cfa5d1cb0fcaad6e46 100644 --- a/source/Applications/DLR-F16-Solid/f16-solid-coarse.cfg +++ b/source/Applications/DLR-F16-Solid/f16-solid-coarse.cfg @@ -1,16 +1,16 @@ -pathOut = d:/temp/DLR-F16-Solid-L1-BV +pathOut = d:/temp/DLR-F16-Solid-L6 pathGeo = d:/Projects/SFB880/DLR-F16/Geometry fngFileWhole1 = F16_broad_Quad_noTape_full.stl fngFileWhole2 = F16_broad_Quad_thickTape_full.stl -accuracy = 1 +accuracy = 0 reinit = false pathReInit = /work/koskuche/DLR-F16_L1 stepReInit = 10000 -numOfThreads = 1 +numOfThreads = 8 availMem = 10e9 logToFile = false @@ -23,29 +23,29 @@ logToFile = false #boundingBox = -0.125 1.5 0.0 0.03 -1.1 0.3 #boundingBox = -0.90 1.5 0.0 0.03 -1.05 0.66 #boundingBox = -0.30 2.52 0.0 0.03 -2.08 2.08 -boundingBox = -0.3 1.17 0.0 0.03 -1.11 1.11 +boundingBox = -0.3 1.17 0.0 0.03 -1.17 1.17 blockNx = 10 10 10 -refineLevel = 1 +refineLevel = 6 #deltaXfine = 0.003 #level 0 -deltaXfine = 0.0015 #level 1 +#deltaXfine = 0.0015 #level 1 #deltaXfine = 0.00075 #level 2 #deltaXfine = 0.000375 #level 3 #deltaXfine = 0.0001875 #level 4 #deltaXfine = 0.00009375 #level 5 -#deltaXfine = 0.000046875 #level 6 +deltaXfine = 0.000046875 #level 6 #deltaXfine = 0.0000234375 #level 7 startDistance = -1.0e-3 -#refineDistance = 0.6e-3 -refineDistance = 30.0e-3 +refineDistance = 0.6e-3 +#refineDistance = 30.0e-3 -writeBlocks = false +writeBlocks = true -newStart = false -restartStep = 14000 +newStart = true +restartStep = 3000 cpStep = 1000 cpStart = 1000 @@ -53,14 +53,14 @@ cpStart = 1000 outTimeStep = 100 outTimeStart = 100 -endTime = 100000 +endTime = 3100 #Cp #pcpStart = 1000000 #pcpStop = 1000000 -timeAvStart = 100 -timeAvStop = 100 +timeAvStart = 3000 +timeAvStop = 5000 nupsStep = 100 100 10000000 diff --git a/source/Applications/DLR-F16-Solid/f16.cpp b/source/Applications/DLR-F16-Solid/f16.cpp index 83f7f1e12faaacb96cbf21a29783813969610916..c1020963ab9fcc71f177ee502a32de58927c081b 100644 --- a/source/Applications/DLR-F16-Solid/f16.cpp +++ b/source/Applications/DLR-F16-Solid/f16.cpp @@ -133,6 +133,7 @@ void run(string configname) //if (myid==0) GbSystem3D::writeGeoObject(spongeLayerX1max.get(), pathOut+"/geo/spongeLayerX1max", WbWriterVtkXmlASCII::getInstance()); //return; + //////////////////////////////////////////////////////////////////////// //Grid ////////////////////////////////////////////////////////////////////////// @@ -167,19 +168,13 @@ void run(string configname) SPtr<BCProcessor> bcProc; bcProc = SPtr<BCProcessor>(new BCProcessor()); - //SPtr<LBMKernel> kernel = SPtr<LBMKernel>(new CompressibleCumulantLBMKernel()); - //dynamicPointerCast<CompressibleCumulantLBMKernel>(kernel)->setRelaxationParameter(CompressibleCumulantLBMKernel::NORMAL); - SPtr<LBMKernel> kernel = SPtr<LBMKernel>(new CompressibleCumulant4thOrderViscosityLBMKernel()); - dynamicPointerCast<CompressibleCumulant4thOrderViscosityLBMKernel>(kernel)->setBulkViscosity(10.0*nuLB); - //dynamicPointerCast<CompressibleCumulant4thOrderViscosityLBMKernel>(kernel)->setBulkViscosity(nuLB*2.0e3); - - //SPtr<LBMKernel> kernel = SPtr<LBMKernel>(new IncompressibleCumulantLBMKernel()); + double bulckViscosity = 10.0*nuLB; + dynamicPointerCast<CompressibleCumulant4thOrderViscosityLBMKernel>(kernel)->setBulkViscosity(bulckViscosity); kernel->setBCProcessor(bcProc); SPtr<LBMKernel> spKernel = SPtr<LBMKernel>(new CompressibleCumulantLBMKernel()); - //SPtr<LBMKernel> spKernel = SPtr<LBMKernel>(new IncompressibleCumulantLBMKernel()); spKernel->setBCProcessor(bcProc); ////////////////////////////////////////////////////////////////////////// //restart @@ -458,6 +453,11 @@ void run(string configname) } grid->updateDistributedBlocks(comm); + if (writeBlocks) + { + migCoProcessor->writeBlocks(0); + } + std::vector<int> dirs; for (int i = D3Q27System::E; i<=D3Q27System::TS; i++) { @@ -520,6 +520,12 @@ void run(string configname) ppblocks.process(3); } + //SetSolidBlocksBlockVisitor fngSolidVisitor(fngIntrWhole2); + //grid->accept(fngSolidVisitor); + //SetBcBlocksBlockVisitor fngBcVisitor(fngIntrWhole2); + //grid->accept(fngBcVisitor); + + GbCuboid3DPtr mic6(new GbCuboid3D( 0.3, 0.015, -0.46+4.25*deltaXcoarse, 0.3+deltaXcoarse, 0.015+deltaXcoarse, -0.46+5.25*deltaXcoarse)); if (myid==0) GbSystem3D::writeGeoObject(mic6.get(), pathOut+"/geo/mic6", WbWriterVtkXmlBinary::getInstance()); GbCuboid3DPtr mic7(new GbCuboid3D(0.3, 0.015, -0.3+4.25*deltaXcoarse, 0.3+deltaXcoarse, 0.015+deltaXcoarse, -0.3+5.25*deltaXcoarse)); @@ -550,10 +556,7 @@ void run(string configname) UBLOG(logINFO, "Available memory per process = "<<availMem<<" bytes"); } - if (writeBlocks) - { - migCoProcessor->writeBlocks(0); - } + SetKernelBlockVisitor kernelVisitor(kernel, nuLB, availMem, needMem); grid->accept(kernelVisitor); @@ -576,6 +579,13 @@ void run(string configname) //BC intHelper.setBC(); + + //for (SPtr<Block3D> block : fngIntrWhole2->getSolidBlockSet()) + //{ + // fngIntrWhole2->setDifferencesToGbObject3D(block); + //} + //fngIntrWhole2->initInteractor(); + if (myid==0) UBLOG(logINFO, "intHelper.setBC():end"); if (myid==0) @@ -590,7 +600,9 @@ void run(string configname) grid->accept(initVisitor1); ////set connectors - SPtr<InterpolationProcessor> iProcessor(new CompressibleOffsetInterpolationProcessor()); + //SPtr<InterpolationProcessor> iProcessor(new CompressibleOffsetInterpolationProcessor()); + SPtr<InterpolationProcessor> iProcessor(new CompressibleOffsetMomentsInterpolationProcessor()); + dynamicPointerCast<CompressibleOffsetMomentsInterpolationProcessor>(iProcessor)->setBulkViscosity(nuLB, bulckViscosity); SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor); grid->accept(setConnsVisitor); @@ -615,10 +627,6 @@ void run(string configname) grid->accept(initVisitor); } - //domain decomposition for threads - //PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads); - //grid->accept(pqPartVisitor); - //bcVisitor should be accept after initialization!!!! grid->accept(bcVisitor); if (myid==0) UBLOG(logINFO, "grid->accept(bcVisitor):end"); @@ -642,40 +650,10 @@ void run(string configname) UBLOG(logINFO, "PID = "<<myid<<" Physical Memory currently used by current process: "<<Utilities::getPhysMemUsedByMe()/1073741824.0<<" GB"); } - ////sponge layer - //////////////////////////////////////////////////////////////////////////// - - //GbCuboid3DPtr spongeLayerX1max(new GbCuboid3D(g_maxX1-0.35, g_minX2-blockLength, g_minX3-blockLength, g_maxX1+blockLength, g_maxX2+blockLength, g_maxX3+blockLength)); - //if (myid==0) GbSystem3D::writeGeoObject(spongeLayerX1max.get(), pathOut+"/geo/spongeLayerX1max", WbWriterVtkXmlASCII::getInstance()); - //SpongeLayerBlockVisitor slVisitorX1max(spongeLayerX1max, spKernel, nuLB, D3Q27System::E); - //grid->accept(slVisitorX1max); - - //GbCuboid3DPtr spongeLayerX1min(new GbCuboid3D(g_minX1-blockLength, g_minX2-blockLength, g_minX3-blockLength, g_minX1+0.2, g_maxX2+blockLength, g_maxX3+blockLength)); - //if (myid==0) GbSystem3D::writeGeoObject(spongeLayerX1min.get(), pathOut+"/geo/spongeLayerX1min", WbWriterVtkXmlASCII::getInstance()); - //SpongeLayerBlockVisitor slVisitorX1min(spongeLayerX1min, spKernel, nuLB, D3Q27System::W); - //grid->accept(slVisitorX1min); - - //GbCuboid3DPtr spongeLayerX3min(new GbCuboid3D(g_minX1+0.2, g_minX2-blockLength, g_minX3-blockLength, g_maxX1-0.4, g_maxX2+blockLength, g_minX3+0.2)); - //if (myid==0) GbSystem3D::writeGeoObject(spongeLayerX3min.get(), pathOut+"/geo/spongeLayerX3min", WbWriterVtkXmlASCII::getInstance()); - //SpongeLayerBlockVisitor slVisitorX3min(spongeLayerX3min, spKernel, nuLB, D3Q27System::B); - //grid->accept(slVisitorX3min); - - //GbCuboid3DPtr spongeLayerX3max(new GbCuboid3D(g_minX1+0.2, g_minX2-blockLength, g_maxX3-0.2, g_maxX1-0.4, g_maxX2+blockLength, g_maxX3+blockLength)); - //if (myid==0) GbSystem3D::writeGeoObject(spongeLayerX3max.get(), pathOut+"/geo/spongeLayerX3max", WbWriterVtkXmlASCII::getInstance()); - //SpongeLayerBlockVisitor slVisitorX3max(spongeLayerX3max, spKernel, nuLB, D3Q27System::T); - //grid->accept(slVisitorX3max); - - ///////////////////////////////////////////////////////////////////////////// if (myid==0) UBLOG(logINFO, "Preprozess - end"); } else { - - //GbCuboid3DPtr mic5(new GbCuboid3D(0.3+deltaXfine, 0.015, 0.000517+0.00037+7.0*deltaXfine, 0.3+2.0*deltaXfine, 0.015+deltaXfine, 0.000517+0.00037+8.0*deltaXfine)); - //if (myid==0) GbSystem3D::writeGeoObject(mic5.get(), pathOut+"/geo/mic5", WbWriterVtkXmlBinary::getInstance()); - - //return; - restartCoProcessor->restart((int)restartStep); //migCoProcessor->restart((int)restartStep); grid->setTimeStep(restartStep); @@ -684,45 +662,10 @@ void run(string configname) SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor); grid->accept(setConnsVisitor); -/////////////////////////////////////////////////////////////////////////////////////////////// - //SPtr<GbTriFaceMesh3D> fngMeshWhole2; - //if (myid==0) UBLOG(logINFO, "Read fngFileWhole2:start"); - //fngMeshWhole2 = SPtr<GbTriFaceMesh3D>(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile2(pathGeo+"/"+fngFileWhole2, "fngMeshWhole2", GbTriFaceMesh3D::KDTREE_SAHPLIT, false)); - //if (myid==0) UBLOG(logINFO, "Read fngFileWhole2:end"); - //fngMeshWhole2->rotate(0.0, 0.5, 0.0); - //if (myid==0) GbSystem3D::writeGeoObject(fngMeshWhole2.get(), pathOut+"/geo/fngMeshWhole3", WbWriterVtkXmlBinary::getInstance()); - //SPtr<Interactor3D> fngIntrWhole2 = SPtr<D3Q27TriFaceMeshInteractor>(new D3Q27TriFaceMeshInteractor(fngMeshWhole2, grid, noSlipBCAdapter, Interactor3D::SOLID, (Interactor3D::Accuracy)accuracy)); - //SetBcBlocksBlockVisitor v(fngIntrWhole2); - //grid->accept(v); - //fngIntrWhole2->initInteractor(); -/////////////////////////////////////////////////////////////////////////////////////////////// - grid->accept(bcVisitor); - - ////sponge layer - //////////////////////////////////////////////////////////////////////////// - - //GbCuboid3DPtr spongeLayerX1max(new GbCuboid3D(g_maxX1-0.35, g_minX2-blockLength, g_minX3-blockLength, g_maxX1+blockLength, g_maxX2+blockLength, g_maxX3+blockLength)); - //if (myid==0) GbSystem3D::writeGeoObject(spongeLayerX1max.get(), pathOut+"/geo/spongeLayerX1max", WbWriterVtkXmlASCII::getInstance()); - //SpongeLayerBlockVisitor slVisitorX1max(spongeLayerX1max, spKernel, nuLB, D3Q27System::E); - //grid->accept(slVisitorX1max); - - //GbCuboid3DPtr spongeLayerX1min(new GbCuboid3D(g_minX1-blockLength, g_minX2-blockLength, g_minX3-blockLength, g_minX1+0.2, g_maxX2+blockLength, g_maxX3+blockLength)); - //if (myid==0) GbSystem3D::writeGeoObject(spongeLayerX1min.get(), pathOut+"/geo/spongeLayerX1min", WbWriterVtkXmlASCII::getInstance()); - //SpongeLayerBlockVisitor slVisitorX1min(spongeLayerX1min, spKernel, nuLB, D3Q27System::W); - //grid->accept(slVisitorX1min); - - //GbCuboid3DPtr spongeLayerX3min(new GbCuboid3D(g_minX1+0.2, g_minX2-blockLength, g_minX3-blockLength, g_maxX1-0.4, g_maxX2+blockLength, g_minX3+0.2)); - //if (myid==0) GbSystem3D::writeGeoObject(spongeLayerX3min.get(), pathOut+"/geo/spongeLayerX3min", WbWriterVtkXmlASCII::getInstance()); - //SpongeLayerBlockVisitor slVisitorX3min(spongeLayerX3min, spKernel, nuLB, D3Q27System::B); - //grid->accept(slVisitorX3min); - - //GbCuboid3DPtr spongeLayerX3max(new GbCuboid3D(g_minX1+0.2, g_minX2-blockLength, g_maxX3-0.2, g_maxX1-0.4, g_maxX2+blockLength, g_maxX3+blockLength)); - //if (myid==0) GbSystem3D::writeGeoObject(spongeLayerX3max.get(), pathOut+"/geo/spongeLayerX3max", WbWriterVtkXmlASCII::getInstance()); - //SpongeLayerBlockVisitor slVisitorX3max(spongeLayerX3max, spKernel, nuLB, D3Q27System::T); - //grid->accept(slVisitorX3max); } + ////sponge layer GbCuboid3DPtr spongeLayerX1max(new GbCuboid3D(g_maxX1-0.35, g_minX2-blockLength, g_minX3-blockLength, g_maxX1+blockLength, g_maxX2+blockLength, g_maxX3+blockLength)); if (myid==0) GbSystem3D::writeGeoObject(spongeLayerX1max.get(), pathOut+"/geo/spongeLayerX1max", WbWriterVtkXmlASCII::getInstance()); SpongeLayerBlockVisitor slVisitorX1max(spongeLayerX1max, spKernel, nuLB, D3Q27System::E); @@ -745,113 +688,39 @@ void run(string configname) if (myid==0) GbSystem3D::writeGeoObject(bbBox.get(), pathOut+"/geo/bbBox", WbWriterVtkXmlASCII::getInstance()); SPtr<WriteMQFromSelectionCoProcessor> writeMQSelectCoProcessor(new WriteMQFromSelectionCoProcessor(grid, stepSch, bbBox, pathOut, WbWriterVtkXmlBinary::getInstance(), conv, comm)); - //SPtr<UbScheduler> tavSch(new UbScheduler(1, timeAvStart, timeAvStop)); - //SPtr<TimeAveragedValuesCoProcessor> tav(new TimeAveragedValuesCoProcessor(grid, pathOut, WbWriterVtkXmlBinary::getInstance(), tavSch, comm, - // TimeAveragedValuesCoProcessor::Density | TimeAveragedValuesCoProcessor::Velocity | TimeAveragedValuesCoProcessor::Fluctuations)); - //tav->setWithGhostLayer(true); - - //SPtr<IntegrateValuesHelper> mic1(new IntegrateValuesHelper(grid, comm, 0.3-deltaXfine, 0.015, 0.0005, 0.3, 0.015+deltaXfine, 0.0005+deltaXfine)); - //if (myid==0) GbSystem3D::writeGeoObject(mic1->getBoundingBox().get(), pathOut+"/geo/mic1", WbWriterVtkXmlBinary::getInstance()); - //SPtr<UbScheduler> stepMV(new UbScheduler(1, 0, 1000000)); - //SPtr<TimeseriesCoProcessor> tsp1(new TimeseriesCoProcessor(grid, stepMV, mic1, pathOut+"/mic/mic1", comm)); - - //SPtr<IntegrateValuesHelper> mic2(new IntegrateValuesHelper(grid, comm, 0.3+deltaXfine, 0.015, 0.001685, 0.3, 0.015+deltaXfine, 0.001685+deltaXfine)); - //if (myid==0) GbSystem3D::writeGeoObject(mic2->getBoundingBox().get(), pathOut+"/geo/mic2", WbWriterVtkXmlBinary::getInstance()); - //SPtr<TimeseriesCoProcessor> tsp2(new TimeseriesCoProcessor(grid, stepMV, mic2, pathOut+"/mic/mic2", comm)); - - //SPtr<IntegrateValuesHelper> mic3(new IntegrateValuesHelper(grid, comm, 0.3-deltaXcoarse, 0.015, -0.46+4.25*deltaXcoarse, 0.3, 0.015+deltaXcoarse, -0.46+5.25*deltaXcoarse)); - //if (myid==0) GbSystem3D::writeGeoObject(mic3->getBoundingBox().get(), pathOut+"/geo/mic3", WbWriterVtkXmlBinary::getInstance()); - //SPtr<TimeseriesCoProcessor> tsp3(new TimeseriesCoProcessor(grid, stepMV, mic3, pathOut+"/mic/mic3", comm)); + SPtr<UbScheduler> tavSch(new UbScheduler(1, timeAvStart, timeAvStop)); + SPtr<TimeAveragedValuesCoProcessor> tav(new TimeAveragedValuesCoProcessor(grid, pathOut, WbWriterVtkXmlBinary::getInstance(), tavSch, comm, + TimeAveragedValuesCoProcessor::Density | TimeAveragedValuesCoProcessor::Velocity | TimeAveragedValuesCoProcessor::Fluctuations)); + tav->setWithGhostLayer(true); - //SPtr<IntegrateValuesHelper> mic4(new IntegrateValuesHelper(grid, comm, 0.3-deltaXcoarse, 0.015, 0.46-5.25*deltaXcoarse, 0.3, 0.015+deltaXcoarse, 0.46-4.25*deltaXcoarse)); - //if (myid==0) GbSystem3D::writeGeoObject(mic4->getBoundingBox().get(), pathOut+"/geo/mic4", WbWriterVtkXmlBinary::getInstance()); - //SPtr<TimeseriesCoProcessor> tsp4(new TimeseriesCoProcessor(grid, stepMV, mic4, pathOut+"/mic/mic4", comm)); - - //SPtr<IntegrateValuesHelper> mic5(new IntegrateValuesHelper(grid, comm, 0.3+deltaXfine, 0.015, 0.000517+0.00037+7.0*deltaXfine, 0.3+2.0*deltaXfine, 0.015+deltaXfine, 0.000517+0.00037+8.0*deltaXfine)); - //if (myid==0) GbSystem3D::writeGeoObject(mic5->getBoundingBox().get(), pathOut+"/geo/mic5", WbWriterVtkXmlBinary::getInstance()); - //SPtr<TimeseriesCoProcessor> tsp5(new TimeseriesCoProcessor(grid, stepMV, mic5, pathOut+"/mic/mic5", comm)); - - ////0.46 m / 1.5c - //SPtr<IntegrateValuesHelper> mic6(new IntegrateValuesHelper(grid, comm, 0.3, 0.015, -0.4599-deltaXcoarse, 0.3+deltaXcoarse, 0.015+deltaXcoarse, -0.4599)); - //if (myid==0) GbSystem3D::writeGeoObject(mic6->getBoundingBox().get(), pathOut+"/geo/mic6", WbWriterVtkXmlBinary::getInstance()); - //SPtr<TimeseriesCoProcessor> tsp6(new TimeseriesCoProcessor(grid, stepMV, mic6, pathOut+"/mic/mic6", comm)); - - ////0.3 m / 1.0c - //SPtr<IntegrateValuesHelper> mic7(new IntegrateValuesHelper(grid, comm, 0.3, 0.015, -0.299, 0.3+deltaXcoarse, 0.015+deltaXcoarse, -0.299+deltaXcoarse)); - //if (myid==0) GbSystem3D::writeGeoObject(mic7->getBoundingBox().get(), pathOut+"/geo/mic7", WbWriterVtkXmlBinary::getInstance()); - //SPtr<TimeseriesCoProcessor> tsp7(new TimeseriesCoProcessor(grid, stepMV, mic7, pathOut+"/mic/mic7", comm)); - - ////0.075 m / 0.25c - //SPtr<IntegrateValuesHelper> mic8(new IntegrateValuesHelper(grid, comm, 0.3, 0.015, -0.0744-deltaXcoarse, 0.3+deltaXcoarse, 0.015+deltaXcoarse, -0.0744)); - //if (myid==0) GbSystem3D::writeGeoObject(mic8->getBoundingBox().get(), pathOut+"/geo/mic8", WbWriterVtkXmlBinary::getInstance()); - //SPtr<TimeseriesCoProcessor> tsp8(new TimeseriesCoProcessor(grid, stepMV, mic8, pathOut+"/mic/mic8", comm)); - - double dist = 0.0744; //0.25c SPtr<UbScheduler> stepMV(new UbScheduler(1, 0, 1000000)); - //0.0 - //SPtr<IntegrateValuesHelper> mic0new(new IntegrateValuesHelper(grid, comm, 0.3+deltaXfine, 0.015, 0.000517+0.00037+7.0*deltaXfine, 0.3+2.0*deltaXfine, 0.015+deltaXfine, 0.000517+0.00037+8.0*deltaXfine)); - //if (myid==0) GbSystem3D::writeGeoObject(mic0new->getBoundingBox().get(), pathOut+"/geo/mic0new", WbWriterVtkXmlBinary::getInstance()); - //SPtr<TimeseriesCoProcessor> tsp0(new TimeseriesCoProcessor(grid, stepMV, mic0new, pathOut+"/mic/mic0new", comm)); - ////0.25c - //SPtr<IntegrateValuesHelper> mic1new(new IntegrateValuesHelper(grid, comm, 0.3, 0.015, -dist-deltaXcoarse, 0.3+deltaXcoarse, 0.015+deltaXcoarse, -dist)); - //if (myid==0) GbSystem3D::writeGeoObject(mic1new->getBoundingBox().get(), pathOut+"/geo/mic1new", WbWriterVtkXmlBinary::getInstance()); - //SPtr<TimeseriesCoProcessor> tsp1(new TimeseriesCoProcessor(grid, stepMV, mic1new, pathOut+"/mic/mic1new", comm)); - ////0.5c - //SPtr<IntegrateValuesHelper> mic2new(new IntegrateValuesHelper(grid, comm, 0.3, 0.015, -dist*2.0-deltaXcoarse, 0.3+deltaXcoarse, 0.015+deltaXcoarse, -dist*2.0)); - //if (myid==0) GbSystem3D::writeGeoObject(mic2new->getBoundingBox().get(), pathOut+"/geo/mic2new", WbWriterVtkXmlBinary::getInstance()); - //SPtr<TimeseriesCoProcessor> tsp2(new TimeseriesCoProcessor(grid, stepMV, mic2new, pathOut+"/mic/mic2new", comm)); - ////0.75c - //SPtr<IntegrateValuesHelper> mic3new(new IntegrateValuesHelper(grid, comm, 0.3, 0.015, -dist*3.0-deltaXcoarse, 0.3+deltaXcoarse, 0.015+deltaXcoarse, -dist*3.0)); - //if (myid==0) GbSystem3D::writeGeoObject(mic3new->getBoundingBox().get(), pathOut+"/geo/mic3new", WbWriterVtkXmlBinary::getInstance()); - //SPtr<TimeseriesCoProcessor> tsp3(new TimeseriesCoProcessor(grid, stepMV, mic3new, pathOut+"/mic/mic3new", comm)); - ////1.0c - //SPtr<IntegrateValuesHelper> mic4new(new IntegrateValuesHelper(grid, comm, 0.3, 0.015, -dist*4.0-deltaXcoarse, 0.3+deltaXcoarse, 0.015+deltaXcoarse, -dist*4.0)); - //if (myid==0) GbSystem3D::writeGeoObject(mic4new->getBoundingBox().get(), pathOut+"/geo/mic4new", WbWriterVtkXmlBinary::getInstance()); - //SPtr<TimeseriesCoProcessor> tsp4(new TimeseriesCoProcessor(grid, stepMV, mic4new, pathOut+"/mic/mic4new", comm)); - ////1.25c - //SPtr<IntegrateValuesHelper> mic5new(new IntegrateValuesHelper(grid, comm, 0.3, 0.015, -dist*5.0-deltaXcoarse, 0.3+deltaXcoarse, 0.015+deltaXcoarse, -dist*5.0)); - //if (myid==0) GbSystem3D::writeGeoObject(mic5new->getBoundingBox().get(), pathOut+"/geo/mic5new", WbWriterVtkXmlBinary::getInstance()); - //SPtr<TimeseriesCoProcessor> tsp5(new TimeseriesCoProcessor(grid, stepMV, mic5new, pathOut+"/mic/mic5new", comm)); - ////1.5c - //SPtr<IntegrateValuesHelper> mic6new(new IntegrateValuesHelper(grid, comm, 0.3, 0.015, -dist*6.0-deltaXcoarse, 0.3+deltaXcoarse, 0.015+deltaXcoarse, -dist*6.0)); - //if (myid==0) GbSystem3D::writeGeoObject(mic6new->getBoundingBox().get(), pathOut+"/geo/mic6new", WbWriterVtkXmlBinary::getInstance()); - //SPtr<TimeseriesCoProcessor> tsp6(new TimeseriesCoProcessor(grid, stepMV, mic6new, pathOut+"/mic/mic6new", comm)); - ////1.75c - //SPtr<IntegrateValuesHelper> mic7new(new IntegrateValuesHelper(grid, comm, 0.3, 0.015, -dist*7.0-deltaXcoarse, 0.3+deltaXcoarse, 0.015+deltaXcoarse, -dist*7.0)); - //if (myid==0) GbSystem3D::writeGeoObject(mic7new->getBoundingBox().get(), pathOut+"/geo/mic7new", WbWriterVtkXmlBinary::getInstance()); - //SPtr<TimeseriesCoProcessor> tsp7(new TimeseriesCoProcessor(grid, stepMV, mic7new, pathOut+"/mic/mic7new", comm)); - ////2.0c - //SPtr<IntegrateValuesHelper> mic8new(new IntegrateValuesHelper(grid, comm, 0.3, 0.015, -dist*8.0-deltaXcoarse, 0.3+deltaXcoarse, 0.015+deltaXcoarse, -dist*8.0)); - //if (myid==0) GbSystem3D::writeGeoObject(mic8new->getBoundingBox().get(), pathOut+"/geo/mic8new", WbWriterVtkXmlBinary::getInstance()); - //SPtr<TimeseriesCoProcessor> tsp8(new TimeseriesCoProcessor(grid, stepMV, mic8new, pathOut+"/mic/mic8new", comm)); - SPtr<MicrophoneArrayCoProcessor> micCoProcessor(new MicrophoneArrayCoProcessor(grid, stepSch, pathOut, comm) ); - micCoProcessor->addMicrophone(Vector3D(0.47, 0.015, -1.0)); - micCoProcessor->addMicrophone(Vector3D(0.47, 0.015, -0.5)); - micCoProcessor->addMicrophone(Vector3D(0.47, 0.015, 0.0)); - micCoProcessor->addMicrophone(Vector3D(0.47, 0.015, 0.5)); - micCoProcessor->addMicrophone(Vector3D(0.47, 0.015, 1.0)); - - + double offsetX1 = 0.017; + double offsetZ1 = 0.11375; + std::vector<UbTupleFloat3> nodes; + for (int i = 0; i <= 10; i++) + { + micCoProcessor->addMicrophone(Vector3D(0.31+offsetX1*double(i), 0.015, 0.0-offsetZ1*double(i))); + nodes.push_back(UbTupleFloat3(float(0.31+offsetX1*float(i)), float(0.015), float(0.0-offsetZ1*float(i)))); + } + double offsetX2 = 0.1; + for (int i = 0; i <= 6; i++) + { + micCoProcessor->addMicrophone(Vector3D(0.17+offsetX2*double(i), 0.015, -1.1375)); + nodes.push_back(UbTupleFloat3(float(0.17+offsetX2*float(i)), float(0.015), float(-1.1375))); + } + + if (myid==0) WbWriterVtkXmlBinary::getInstance()->writeNodes(pathOut+"/geo/mic", nodes); omp_set_num_threads(numOfThreads); SPtr<UbScheduler> stepGhostLayer(new UbScheduler(1)); SPtr<Calculator> calculator(new BasicCalculator(grid, stepGhostLayer, endTime)); calculator->addCoProcessor(nupsCoProcessor); - //calculator->addCoProcessor(tsp0); - //calculator->addCoProcessor(tsp1); - //calculator->addCoProcessor(tsp2); - //calculator->addCoProcessor(tsp3); - //calculator->addCoProcessor(tsp4); - //calculator->addCoProcessor(tsp5); - //calculator->addCoProcessor(tsp6); - //calculator->addCoProcessor(tsp7); - //calculator->addCoProcessor(tsp8); calculator->addCoProcessor(micCoProcessor); - //calculator->addCoProcessor(restartCoProcessor); - //calculator->addCoProcessor(writeMQSelectCoProcessor); - //calculator->addCoProcessor(writeMQCoProcessor); - //calculator->addCoProcessor(tav); + calculator->addCoProcessor(restartCoProcessor); + calculator->addCoProcessor(writeMQSelectCoProcessor); + calculator->addCoProcessor(writeMQCoProcessor); + calculator->addCoProcessor(tav); if (myid==0) UBLOG(logINFO, "Simulation-start"); diff --git a/source/Applications/OrganPipe/OrganPipe.cpp b/source/Applications/OrganPipe/OrganPipe.cpp index 25382959f4ab0f08e46fc4779f3435d9f13588be..970ad1ac668aed56cc471e4848e0e594233a8cde 100644 --- a/source/Applications/OrganPipe/OrganPipe.cpp +++ b/source/Applications/OrganPipe/OrganPipe.cpp @@ -71,8 +71,15 @@ void run(string configname) double nu_LB = nuReal * unitConverter.getFactorViscosityWToLb(); double u_LB = uReal * unitConverter.getFactorVelocityWToLb(); + vector<int> blocknx ={ 25, 25, 25 }; + if (myid == 0) UBLOG(logINFO, "Read organ pipe geometry:start"); + SPtr<GbTriFaceMesh3D> organPipeGeo = SPtr<GbTriFaceMesh3D>(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile2(pathGeo + opipeGeoFile, "opipeGeo", GbTriFaceMesh3D::KDTREE_SAHPLIT, false)); + organPipeGeo->translate(1.37, 0.0, 0.0); + if (myid == 0) UBLOG(logINFO, "Read organ pipe geometry:end"); + if (myid == 0) GbSystem3D::writeGeoObject(organPipeGeo.get(), pathOut + "/geo/organPipeGeo", WbWriterVtkXmlBinary::getInstance()); + SPtr<Grid3D> grid(new Grid3D(comm)); //bounding box @@ -149,7 +156,8 @@ void run(string configname) //SPtr<LBMKernel> kernel = SPtr<LBMKernel>(new CompressibleCumulantLBMKernel()); SPtr<LBMKernel> kernel = SPtr<LBMKernel>(new CompressibleCumulant4thOrderViscosityLBMKernel()); - + double bulckViscosity = 10.0*nu_LB; + dynamicPointerCast<CompressibleCumulant4thOrderViscosityLBMKernel>(kernel)->setBulkViscosity(bulckViscosity); kernel->setBCProcessor(bcProc); ////////////////////////////////////////////////////////////////////////// //restart @@ -175,12 +183,6 @@ void run(string configname) grid->accept(genBlocks); //geometry - if (myid == 0) UBLOG(logINFO, "Read organ pipe geometry:start"); - SPtr<GbTriFaceMesh3D> organPipeGeo = SPtr<GbTriFaceMesh3D>(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile2(pathGeo + opipeGeoFile, "opipeGeo", GbTriFaceMesh3D::KDTREE_SAHPLIT, false)); - organPipeGeo->translate(1.37, 0.0, 0.0); - if (myid == 0) UBLOG(logINFO, "Read organ pipe geometry:end"); - if (myid == 0) GbSystem3D::writeGeoObject(organPipeGeo.get(), pathOut + "/geo/organPipeGeo", WbWriterVtkXmlBinary::getInstance()); - if (myid == 0) UBLOG(logINFO, "Read inlet pipe geometry:start"); SPtr<GbTriFaceMesh3D> inletTubeGeo = SPtr<GbTriFaceMesh3D>(GbTriFaceMesh3DCreator::getInstance()->readMeshFromSTLFile2(pathGeo + inletTubeGeoFile, "inPipeGeo", GbTriFaceMesh3D::KDTREE_SAHPLIT, false)); inletTubeGeo->translate(1.37, 0.0, 0.0); @@ -359,7 +361,9 @@ void run(string configname) grid->setTimeStep(restartStep); } ////set connectors - InterpolationProcessorPtr iProcessor(new CompressibleOffsetInterpolationProcessor()); + //InterpolationProcessorPtr iProcessor(new CompressibleOffsetInterpolationProcessor()); + SPtr<InterpolationProcessor> iProcessor(new CompressibleOffsetMomentsInterpolationProcessor()); + dynamicPointerCast<CompressibleOffsetMomentsInterpolationProcessor>(iProcessor)->setBulkViscosity(nu_LB, bulckViscosity); SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nu_LB, iProcessor); grid->accept(setConnsVisitor); @@ -413,9 +417,19 @@ void run(string configname) SPtr<WriteMacroscopicQuantitiesCoProcessor> writeMQCoProcessor(new WriteMacroscopicQuantitiesCoProcessor(grid, stepSch, pathOut, WbWriterVtkXmlBinary::getInstance(), conv, comm)); + SPtr<UbScheduler> stepMV(new UbScheduler(1, 0, 1000000)); + SPtr<MicrophoneArrayCoProcessor> micCoProcessor(new MicrophoneArrayCoProcessor(grid, stepSch, pathOut, comm)); + std::vector<UbTupleFloat3> nodes; + micCoProcessor->addMicrophone(Vector3D(1.43865003014, 0.0, organPipeGeo->getX3Maximum()+0.05)); + nodes.push_back(UbTupleFloat3(float(1.43865003014), float(0.0), float(organPipeGeo->getX3Maximum()+0.05))); + micCoProcessor->addMicrophone(Vector3D(organPipeGeo->getX1Maximum()+0.05, 0.0, organPipeGeo->getX3Centroid())); + nodes.push_back(UbTupleFloat3(float(organPipeGeo->getX1Maximum()+0.05), float(0.0), float(organPipeGeo->getX3Centroid()))); + if (myid==0) WbWriterVtkXmlBinary::getInstance()->writeNodes(pathOut+"/geo/mic", nodes); + SPtr<UbScheduler> stepGhostLayer(new UbScheduler(1)); SPtr<Calculator> calculator(new BasicCalculator(grid, stepGhostLayer, endTime)); calculator->addCoProcessor(nupsCoProcessor); + calculator->addCoProcessor(micCoProcessor); calculator->addCoProcessor(migCoProcessor); calculator->addCoProcessor(writeMQCoProcessor); ///////////////////////////////////////////////////////////////////////////////////// diff --git a/source/VirtualFluidsBasic/basics/utilities/UbLogger.h b/source/VirtualFluidsBasic/basics/utilities/UbLogger.h index 0f6cbd37b4db4a2b298d0fbcb5b023e51fa22802..baaf8e5e47c421846f9da423da635dac16de9261 100644 --- a/source/VirtualFluidsBasic/basics/utilities/UbLogger.h +++ b/source/VirtualFluidsBasic/basics/utilities/UbLogger.h @@ -12,7 +12,6 @@ #include <iostream> #include <fstream> #include <iomanip> -#include <PointerDefinitions.h> #if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(_WIN64) || defined(__WIN64__) #include <windows.h> diff --git a/source/VirtualFluidsBasic/basics/writer/WbWriterVtkXmlBinary.cpp b/source/VirtualFluidsBasic/basics/writer/WbWriterVtkXmlBinary.cpp index a6a0bcbaed4341d2070534805f2516b82c9047df..e10ef65395d0ddfa6724b4a30dc66a6b2f35ed99 100644 --- a/source/VirtualFluidsBasic/basics/writer/WbWriterVtkXmlBinary.cpp +++ b/source/VirtualFluidsBasic/basics/writer/WbWriterVtkXmlBinary.cpp @@ -1494,7 +1494,7 @@ std::string WbWriterVtkXmlBinary::writeNodesWithNodeData(const std::string& file int bytesCellConnectivty = 1 /*nodes per cell */ * nofNodes * sizeof(int ); int bytesCellOffsets = 1 /*offset per cell*/ * nofNodes * sizeof(int ); int bytesCellTypes = 1 /*type of oct */ * nofNodes * sizeof(unsigned char); - int bytesScalarData = 1 /*scalar */ * nofNodes * sizeof(float); + int bytesScalarData = 1 /*scalar */ * nofNodes * sizeof(double); int offset = 0; //VTK FILE @@ -1523,7 +1523,7 @@ std::string WbWriterVtkXmlBinary::writeNodesWithNodeData(const std::string& file out<<" <PointData>\n"; for(size_t s=0; s<datanames.size(); ++s) { - out<< " <DataArray type=\"Float32\" Name=\""<< datanames[s] <<"\" format=\"appended\" offset=\""<< offset <<"\" /> \n"; + out<< " <DataArray type=\"Float64\" Name=\""<< datanames[s] <<"\" format=\"appended\" offset=\""<< offset <<"\" /> \n"; offset += (bytesPerByteVal + bytesScalarData); } out<<" </PointData>\n"; @@ -1569,8 +1569,10 @@ std::string WbWriterVtkXmlBinary::writeNodesWithNodeData(const std::string& file for(size_t d=0; d<nodedata[s].size(); ++d) { //loake kopie machen, da in nodedata "doubles" sind - float tmp = (float)nodedata[s][d]; - out.write((char*)&tmp,sizeof(float)); + //float tmp = (float)nodedata[s][d]; + //out.write((char*)&tmp,sizeof(float)); + double tmp = nodedata[s][d]; + out.write((char*)&tmp, sizeof(double)); } } out<<"\n</AppendedData>\n"; diff --git a/source/VirtualFluidsCore/CoProcessors/MicrophoneArrayCoProcessor.cpp b/source/VirtualFluidsCore/CoProcessors/MicrophoneArrayCoProcessor.cpp index e9acb40fb0eb4eb62ca0b52b8b0dcb210995aab4..86bc2b7a35c816442a6135b394696c888ccd9001 100644 --- a/source/VirtualFluidsCore/CoProcessors/MicrophoneArrayCoProcessor.cpp +++ b/source/VirtualFluidsCore/CoProcessors/MicrophoneArrayCoProcessor.cpp @@ -8,6 +8,8 @@ #include "DataSet3D.h" #include "D3Q27System.h" #include "UbScheduler.h" +#include "BCProcessor.h" +#include "BCArray3D.h" MicrophoneArrayCoProcessor::MicrophoneArrayCoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string & path, SPtr<Communicator> comm) : CoProcessor(grid, s), path(path), comm(comm) { @@ -48,32 +50,38 @@ void MicrophoneArrayCoProcessor::addMicrophone(Vector3D coords) SPtr<ILBMKernel> kernel = block->getKernel(); if (kernel) { - if (kernel->getCompressible()) + SPtr<BCArray3D> bcarray = kernel->getBCProcessor()->getBCArray(); + UbTupleInt3 nodes = grid->getNodeIndexes(block, coords[0], coords[1], coords[2]); + if (!bcarray->isUndefined(val<1>(nodes), val<2>(nodes), val<3>(nodes))) { - calcMacros = &D3Q27System::calcCompMacroscopicValues; - } - else - { - calcMacros = &D3Q27System::calcIncompMacroscopicValues; - } - SPtr<Mic> mic(new Mic); - mic->distridution = kernel->getDataSet()->getFdistributions(); - mic->nodeIndexes = grid->getNodeIndexes(block, coords[0], coords[1], coords[2]); - microphones.push_back(mic); - values.resize((microphones.size()+1)*static_cast<int>(scheduler->getMinStep())); - std::string fname = path+"/mic/mic_"+UbSystem::toString(comm->getProcessID())+".csv"; - std::ofstream ostr; - ostr.open(fname.c_str(), std::ios_base::out | std::ios_base::app); - if (!ostr) - { - ostr.clear(); - std::string path = UbSystem::getPathFromString(fname); - if (path.size()>0) { UbSystem::makeDirectory(path); ostr.open(fname.c_str(), std::ios_base::out | std::ios_base::app); } - if (!ostr) throw UbException(UB_EXARGS, "couldn't open file "+fname); + if (kernel->getCompressible()) + { + calcMacros = &D3Q27System::calcCompMacroscopicValues; + } + else + { + calcMacros = &D3Q27System::calcIncompMacroscopicValues; + } + SPtr<Mic> mic(new Mic); + mic->distridution = kernel->getDataSet()->getFdistributions(); + mic->nodeIndexes = grid->getNodeIndexes(block, coords[0], coords[1], coords[2]); + microphones.push_back(mic); + values.resize((microphones.size()+1)*static_cast<int>(scheduler->getMinStep())); + + std::string fname = path+"/mic/mic_"+UbSystem::toString(comm->getProcessID())+".csv"; + std::ofstream ostr; + ostr.open(fname.c_str(), std::ios_base::out | std::ios_base::app); + if (!ostr) + { + ostr.clear(); + std::string path = UbSystem::getPathFromString(fname); + if (path.size()>0) { UbSystem::makeDirectory(path); ostr.open(fname.c_str(), std::ios_base::out | std::ios_base::app); } + if (!ostr) throw UbException(UB_EXARGS, "couldn't open file "+fname); + } + ostr << "#microphone position: " << coords[0] << "; " << coords[1] << "; " << coords[2] << "; " << "\n"; + return; } - ostr << "#microphone position: " << coords[0] << "; " << coords[1] << "; " << coords[2] << "; " << "\n"; - return; } } } diff --git a/source/VirtualFluidsCore/LBM/CompressibleOffsetMomentsInterpolationProcessor.cpp b/source/VirtualFluidsCore/LBM/CompressibleOffsetMomentsInterpolationProcessor.cpp index e548ca9ac4f0771ebc37572803cc2d32e8be98f9..c5e12a68b45a3e09f8433dd7c541c7e2debd01b2 100644 --- a/source/VirtualFluidsCore/LBM/CompressibleOffsetMomentsInterpolationProcessor.cpp +++ b/source/VirtualFluidsCore/LBM/CompressibleOffsetMomentsInterpolationProcessor.cpp @@ -6,7 +6,8 @@ CompressibleOffsetMomentsInterpolationProcessor::CompressibleOffsetMomentsInterpolationProcessor() : omegaC(0.0), omegaF(0.0) { - this->bulkOmegaToOmega = false; + this->bulkViscosity = 0.0; + this->shearViscosity = 0.0; this->OxxPyyPzzC = one; this->OxxPyyPzzF = one; } @@ -14,7 +15,8 @@ CompressibleOffsetMomentsInterpolationProcessor::CompressibleOffsetMomentsInterp CompressibleOffsetMomentsInterpolationProcessor::CompressibleOffsetMomentsInterpolationProcessor(LBMReal omegaC, LBMReal omegaF) : omegaC(omegaC), omegaF(omegaF) { - this->bulkOmegaToOmega = false; + this->bulkViscosity = 0.0; + this->shearViscosity = 0.0; this->OxxPyyPzzC = one; this->OxxPyyPzzF = one; } @@ -27,16 +29,10 @@ CompressibleOffsetMomentsInterpolationProcessor::~CompressibleOffsetMomentsInter InterpolationProcessorPtr CompressibleOffsetMomentsInterpolationProcessor::clone() { InterpolationProcessorPtr iproc = InterpolationProcessorPtr (new CompressibleOffsetMomentsInterpolationProcessor(this->omegaC, this->omegaF)); - if (bulkOmegaToOmega) - { - dynamicPointerCast<CompressibleOffsetMomentsInterpolationProcessor>(iproc)->OxxPyyPzzC = omegaC; - dynamicPointerCast<CompressibleOffsetMomentsInterpolationProcessor>(iproc)->OxxPyyPzzF = omegaF; - } - else - { - dynamicPointerCast<CompressibleOffsetMomentsInterpolationProcessor>(iproc)->OxxPyyPzzC = one; - dynamicPointerCast<CompressibleOffsetMomentsInterpolationProcessor>(iproc)->OxxPyyPzzF = one; - } + + dynamicPointerCast<CompressibleOffsetMomentsInterpolationProcessor>(iproc)->OxxPyyPzzC = this->OxxPyyPzzC; + dynamicPointerCast<CompressibleOffsetMomentsInterpolationProcessor>(iproc)->OxxPyyPzzF = this->OxxPyyPzzF; + return iproc; } ////////////////////////////////////////////////////////////////////////// @@ -44,6 +40,20 @@ void CompressibleOffsetMomentsInterpolationProcessor::setOmegas( LBMReal omegaC, { this->omegaC = omegaC; this->omegaF = omegaF; + + LBMReal dtC = (3.0*shearViscosity)/((1/omegaC)-0.5); + LBMReal dtF = (3.0*shearViscosity)/((1/omegaF)-0.5); + + if (bulkViscosity != 0) + { + this->OxxPyyPzzC = 1.0/(3.0*bulkViscosity/dtC+0.5); + this->OxxPyyPzzF = 1.0/(3.0*bulkViscosity/dtF+0.5); + } + else + { + this->OxxPyyPzzC = one; + this->OxxPyyPzzF = one; + } } ////////////////////////////////////////////////////////////////////////// void CompressibleOffsetMomentsInterpolationProcessor::setOffsets(LBMReal xoff, LBMReal yoff, LBMReal zoff) @@ -1271,8 +1281,9 @@ void CompressibleOffsetMomentsInterpolationProcessor::calcInterpolatedShearStres tauyz=0.5*((bz+2.0*bzz*z+bxz*x+byz*y+bxyz*x*y)+(cy+2.0*cyy*y+cxy*x+cyz*z+cxyz*x*z)); } ////////////////////////////////////////////////////////////////////////// -void CompressibleOffsetMomentsInterpolationProcessor::setBulkOmegaToOmega(bool value) +void CompressibleOffsetMomentsInterpolationProcessor::setBulkViscosity(LBMReal shearViscosity, LBMReal bulkViscosity) { - bulkOmegaToOmega = value; + this->shearViscosity = shearViscosity; + this->bulkViscosity = bulkViscosity; } diff --git a/source/VirtualFluidsCore/LBM/CompressibleOffsetMomentsInterpolationProcessor.h b/source/VirtualFluidsCore/LBM/CompressibleOffsetMomentsInterpolationProcessor.h index f9876cf542400da94a15651ffed1ce22ee90c83e..8b40c00d2b957428fc19c09a26cdbf3bca74dd20 100644 --- a/source/VirtualFluidsCore/LBM/CompressibleOffsetMomentsInterpolationProcessor.h +++ b/source/VirtualFluidsCore/LBM/CompressibleOffsetMomentsInterpolationProcessor.h @@ -23,7 +23,7 @@ public: void interpolateCoarseToFine(D3Q27ICell& icellC, D3Q27ICell& icellF, LBMReal xoff, LBMReal yoff, LBMReal zoff); void interpolateFineToCoarse(D3Q27ICell& icellF, LBMReal* icellC); void interpolateFineToCoarse(D3Q27ICell& icellF, LBMReal* icellC, LBMReal xoff, LBMReal yoff, LBMReal zoff); - void setBulkOmegaToOmega(bool value); + void setBulkViscosity(LBMReal shearViscosity, LBMReal bulkViscosity); protected: private: LBMReal omegaC, omegaF; @@ -45,7 +45,8 @@ private: LBMReal a,b,c; // bulk viscosity - bool bulkOmegaToOmega; + LBMReal shearViscosity; + LBMReal bulkViscosity; LBMReal OxxPyyPzzC; LBMReal OxxPyyPzzF;