Skip to content
Snippets Groups Projects
Commit 3c79503f authored by Konstantin Kutscher's avatar Konstantin Kutscher
Browse files

create MicrophoneArrayCoProcessor

parent 924d233d
No related branches found
No related tags found
No related merge requests found
......@@ -21,12 +21,13 @@ void run()
//////////////////////////////////////////////////////////////////////////
//DLR-F16 test
//dx_coarse = 0.003 mm
//string pathname = "d:/temp/ConvectionOfVortex_0.003";
//int endTime = 20;
//double outTime = 10;
//LBMReal dx = 0.003;
//LBMReal rhoLB = 0.0;
//LBMReal nuLB = 8.66025e-6;
string pathname = "d:/temp/ConvectionOfVortex_0.003_4th";
int endTime = 10000;
double outTime = 10;
LBMReal dx = 0.003;
LBMReal rhoLB = 0.0;
LBMReal nuLB = 8.66025e-6;
double yFactor = 1.0;
//////////////////////////////////////////////////////////////////////////
////dx_coarse = 0.0015 mm
//string pathname = "d:/temp/ConvectionOfVortex_0.0015";
......@@ -37,12 +38,13 @@ void run()
//LBMReal nuLB = 8.66025e-6*2.0;
////////////////////////////////////////////////////////////////////////////
//dx_coarse = 0.00075 mm
string pathname = "d:/temp/ConvectionOfVortex_0.00075_moments";
double endTime = 80;
double outTime = 80;
LBMReal dx = 0.00075;
LBMReal rhoLB = 0.0;
LBMReal nuLB = 8.66025e-6*4.0;
//string pathname = "d:/temp/ConvectionOfVortex_0.00075_4th_moments";
//double endTime = 2000;
//double outTime = 10;
//LBMReal dx = 0.00075;
//LBMReal rhoLB = 0.0;
//LBMReal nuLB = 8.66025e-6*4.0;
//double yFactor = 4.0;
//////////////////////////////////////////////////////////////////////////
////dx_coarse = 0.000375 mm
//string pathname = "d:/temp/ConvectionOfVortex_0.000375";
......@@ -60,11 +62,11 @@ void run()
//bounding box
double g_minX1 = -0.045;
double g_minX2 = -0.015;
double g_minX2 = -0.015/yFactor;
double g_minX3 = -0.06;
double g_maxX1 = 0.045;
double g_maxX2 = 0.015;
double g_maxX2 = 0.015/yFactor;
double g_maxX3 = 0.06;
vector<int> blocknx(3);
......@@ -90,6 +92,15 @@ void run()
GenBlocksGridVisitor genBlocks(gridCube);
grid->accept(genBlocks);
SPtr<BCAdapter> outflowBCAdapter(new DensityBCAdapter(rhoLB));
outflowBCAdapter->setBcAlgorithm(SPtr<BCAlgorithm>(new NonReflectingOutflowBCAlgorithm()));
BoundaryConditionsBlockVisitor bcVisitor;
bcVisitor.addBC(outflowBCAdapter);
SPtr<BCProcessor> bcProc;
bcProc = SPtr<BCProcessor>(new BCProcessor());
SPtr<GbObject3D> refCube(new GbCuboid3D(g_minX1-blockLength,-0.02,-0.02,g_maxX1+blockLength,0.02,0.02));
if (myid==0) GbSystem3D::writeGeoObject(refCube.get(), pathname+"/geo/refCube", WbWriterVtkXmlBinary::getInstance());
......@@ -104,8 +115,29 @@ void run()
SPtr<CoProcessor> ppblocks(new WriteBlocksCoProcessor(grid, SPtr<UbScheduler>(new UbScheduler(1)), pathname, WbWriterVtkXmlBinary::getInstance(), comm));
//outflow
GbCuboid3DPtr geoOutflow1(new GbCuboid3D(g_minX1-blockLength, g_minX2-blockLength, g_minX3-blockLength, g_minX1, g_maxX2+blockLength, g_maxX3+blockLength));
if (myid==0) GbSystem3D::writeGeoObject(geoOutflow1.get(), pathname+"/geo/geoOutflow1", WbWriterVtkXmlASCII::getInstance());
SPtr<D3Q27Interactor> outflowIntr1 = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoOutflow1, grid, outflowBCAdapter, Interactor3D::SOLID));
GbCuboid3DPtr geoOutflow2(new GbCuboid3D(g_maxX1, g_minX2-blockLength, g_minX3-blockLength, g_maxX1+blockLength, g_maxX2+blockLength, g_maxX3+blockLength));
if (myid==0) GbSystem3D::writeGeoObject(geoOutflow2.get(), pathname+"/geo/geoOutflow2", WbWriterVtkXmlASCII::getInstance());
SPtr<D3Q27Interactor> outflowIntr2 = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoOutflow2, grid, outflowBCAdapter, Interactor3D::SOLID));
GbCuboid3DPtr geoOutflow3(new GbCuboid3D(g_minX1-blockLength, g_minX2-blockLength, g_minX3-blockLength, g_maxX1+blockLength, g_maxX2+blockLength, g_minX3));
if (myid==0) GbSystem3D::writeGeoObject(geoOutflow3.get(), pathname+"/geo/geoOutflow3", WbWriterVtkXmlASCII::getInstance());
SPtr<D3Q27Interactor> outflowIntr3 = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoOutflow3, grid, outflowBCAdapter, Interactor3D::SOLID));
GbCuboid3DPtr geoOutflow4(new GbCuboid3D(g_minX1-blockLength, g_minX2-blockLength, g_maxX3, g_maxX1+blockLength, g_maxX2+blockLength, g_maxX3+blockLength));
if (myid==0) GbSystem3D::writeGeoObject(geoOutflow4.get(), pathname+"/geo/geoOutflow4", WbWriterVtkXmlASCII::getInstance());
SPtr<D3Q27Interactor> outflowIntr4 = SPtr<D3Q27Interactor>(new D3Q27Interactor(geoOutflow4, grid, outflowBCAdapter, Interactor3D::SOLID));
SPtr<Grid3DVisitor> metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::B));
InteractorsHelper intHelper(grid, metisVisitor);
//intHelper.addInteractor(outflowIntr1);
//intHelper.addInteractor(outflowIntr2);
//intHelper.addInteractor(outflowIntr3);
//intHelper.addInteractor(outflowIntr4);
intHelper.selectBlocks();
ppblocks->process(0);
......@@ -121,11 +153,6 @@ void run()
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;
unsigned long long numberOfNodesPerBlock = (unsigned long long)(blocknx[0])* (unsigned long long)(blocknx[1])* (unsigned long long)(blocknx[2]);
......@@ -170,7 +197,9 @@ void run()
grid->accept(undefNodesVisitor);
}
double Ma = 0.15;
intHelper.setBC();
double Ma = 0.005;
mu::Parser initRho, initVx1, initVx2;
initRho.SetExpr("rhoLB + (-(rho0*epsilon^2)/2) * exp(1-(scaleFactor*(x1^2+x3^2))/R^2) + (1/(2*gamma*rho0)) * ((-(rho0*epsilon^2)/2) * exp(1-(scaleFactor*(x1^2+x3^2))/R^2))^2");
......@@ -204,6 +233,8 @@ void run()
initVisitor.setVx3(initVx2);
grid->accept(initVisitor);
grid->accept(bcVisitor);
//Postrozess
SPtr<UbScheduler> geoSch(new UbScheduler(1));
SPtr<CoProcessor> ppgeo(new WriteBoundaryConditionsCoProcessor(grid, geoSch, pathname, WbWriterVtkXmlBinary::getInstance(), comm));
......
pathOut = d:/temp/DLR-F16-Solid-2
pathOut = d:/temp/DLR-F16-Solid-L1-BV
pathGeo = d:/Projects/SFB880/DLR-F16/Geometry
fngFileWhole1 = F16_broad_Quad_noTape_full.stl
fngFileWhole2 = F16_broad_Quad_thickTape_full.stl
accuracy = 0
accuracy = 1
reinit = false
pathReInit = /work/koskuche/DLR-F16_L7
pathReInit = /work/koskuche/DLR-F16_L1
stepReInit = 10000
numOfThreads = 4
numOfThreads = 1
availMem = 10e9
logToFile = false
......@@ -27,32 +27,33 @@ boundingBox = -0.3 1.17 0.0 0.03 -1.11 1.11
blockNx = 10 10 10
refineLevel = 6
refineLevel = 1
#deltaXfine = 0.003
#deltaXfine = 0.0015
#deltaXfine = 0.00075 #level 0
#deltaXfine = 0.000375 #level 1
#deltaXfine = 0.0001875 #level 2
#deltaXfine = 0.00009375 #level 3
deltaXfine = 0.000046875 #level 4
#deltaXfine = 0.0000234375 #level 5
#deltaXfine = 0.003 #level 0
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.0000234375 #level 7
startDistance = -1.0e-3
refineDistance = 0.6e-3
#refineDistance = 0.6e-3
refineDistance = 30.0e-3
writeBlocks = true
writeBlocks = false
newStart = true
restartStep = 2000
cpStep = 1000
cpStart = 3000
cpStart = 1000
outTimeStep = 100
outTimeStart = 100
endTime = 10000
endTime = 100000
#Cp
......@@ -60,6 +61,6 @@ endTime = 10000
#pcpStop = 1000000
timeAvStart = 100
timeAvStop = 40000
timeAvStop = 100
nupsStep = 1000 1000 10000000
nupsStep = 100 100 10000000
......@@ -171,6 +171,7 @@ void run(string configname)
//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());
......@@ -493,7 +494,7 @@ void run(string configname)
////////////////////////////////////////////
//METIS
SPtr<Grid3DVisitor> metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::B, MetisPartitioner::RECURSIVE));
std::dynamic_pointer_cast<MetisPartitioningGridVisitor>(metisVisitor)->setNumberOfProcesses(4000);
//std::dynamic_pointer_cast<MetisPartitioningGridVisitor>(metisVisitor)->setNumberOfProcesses(4000);
////////////////////////////////////////////
/////delete solid blocks
if (myid==0) UBLOG(logINFO, "deleteSolidBlocks - start");
......@@ -744,10 +745,10 @@ 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<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());
......@@ -788,43 +789,43 @@ void run(string configname)
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));
//omp_set_num_threads(numOfThreads);
//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));
omp_set_num_threads(numOfThreads);
SPtr<UbScheduler> stepGhostLayer(new UbScheduler(1));
SPtr<Calculator> calculator(new BasicCalculator(grid, stepGhostLayer, endTime));
calculator->addCoProcessor(nupsCoProcessor);
......
#include "MicrophoneArrayCoProcessor.h"
#include "Vector3D.h"
#include "Grid3D.h"
#include "ILBMKernel.h"
#include "Communicator.h"
#include "Block3D.h"
#include "DistributionArray3D.h"
#include "DataSet3D.h"
#include "D3Q27System.h"
#include "UbScheduler.h"
MicrophoneArrayCoProcessor::MicrophoneArrayCoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string & path, SPtr<Communicator> comm) : CoProcessor(grid, s), path(path), comm(comm)
{
count = 0;
}
MicrophoneArrayCoProcessor::~MicrophoneArrayCoProcessor()
{
}
void MicrophoneArrayCoProcessor::process(double step)
{
collectData(step);
if (scheduler->isDue(step))
writeFile(step);
UBLOG(logDEBUG3, "MicrophoneArrayCoProcessor::process:" << step);
}
void MicrophoneArrayCoProcessor::addMicrophone(Vector3D coords)
{
UbTupleInt3 blockIndexes = grid->getBlockIndexes(coords[0], coords[1], coords[2]);
//int gridRank = comm->getProcessID();
int minInitLevel = this->grid->getCoarsestInitializedLevel();
int maxInitLevel = this->grid->getFinestInitializedLevel();
for (int level = minInitLevel; level<=maxInitLevel; level++)
{
UbTupleInt3 blockIndexes = grid->getBlockIndexes(coords[0], coords[1], coords[2], level);
SPtr<Block3D> block = grid->getBlock(val<1>(blockIndexes), val<2>(blockIndexes), val<3>(blockIndexes), level);
if (block)
{
SPtr<ILBMKernel> kernel = block->getKernel();
if (kernel)
{
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()));
return;
}
}
}
}
void MicrophoneArrayCoProcessor::collectData(double step)
{
values[count++] = step;
for (SPtr<Mic> mic : microphones)
{
LBMReal f[D3Q27System::ENDF+1];
mic->distridution->getDistribution(f, val<1>(mic->nodeIndexes), val<2>(mic->nodeIndexes), val<3>(mic->nodeIndexes));
LBMReal vx1, vx2, vx3, rho;
calcMacros(f, rho, vx1, vx2, vx3);
values[count++] = rho;
}
}
void MicrophoneArrayCoProcessor::writeFile(double step)
{
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);
}
int line_size = static_cast<int>(microphones.size()+1);
int total_size = static_cast<int>(values.size());
for (int i = 0; i < total_size; i+=line_size)
{
int index = 0;
for (int j = 0; j < line_size; j++)
{
ostr << values[i+j] << ";";
}
}
ostr << "\n";
ostr.close();
}
#ifndef MicrophoneArrayCoProcessor_h__
#define MicrophoneArrayCoProcessor_h__
#include "CoProcessor.h"
#include <string>
#include <vector>
#include <array>
#include "UbTuple.h"
#include "LBMSystem.h"
class Communicator;
class Grid3D;
class UbScheduler;
class Vector3D;
class DistributionArray3D;
//! \brief Class implements microphone array.
//! \details It samples pressure (LBM rho value) and stores to .csv file.
//! \author Konstantin Kutscher
//! \date February 2019
class MicrophoneArrayCoProcessor : CoProcessor
{
public:
MicrophoneArrayCoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> s, const std::string& path, SPtr<Communicator> comm);
virtual ~MicrophoneArrayCoProcessor();
//! calls collectData.
void process(double step) override;
//! add microphone
void addMicrophone(Vector3D coords);
protected:
void collectData(double step);
void writeFile(double step);
private:
std::string path; //! output filename, e.g. pathname + "/steps/timeseries"
SPtr<Communicator> comm;
struct Mic
{
SPtr<DistributionArray3D> distridution;
UbTupleInt3 nodeIndexes;
};
std::vector< SPtr<Mic> > microphones;
std::vector< double > values;
int count;
typedef void(*CalcMacrosFct)(const LBMReal* const& /*feq[27]*/, LBMReal& /*(d)rho*/, LBMReal& /*vx1*/, LBMReal& /*vx2*/, LBMReal& /*vx3*/);
CalcMacrosFct calcMacros;
};
#endif // MicrophoneArrayCoProcessor_h__
......@@ -608,7 +608,11 @@ void CompressibleCumulant4thOrderViscosityLBMKernel::calculate(int step)
//relax
mxxPyyPzz += OxxPyyPzz*(mfaaa-mxxPyyPzz)-three * (one-c1o2 * OxxPyyPzz) * (vx2 * dxux+vy2 * dyuy+vz2 * dzuz);//-magicBulk*OxxPyyPzz;
wadjust = OxxPyyPzz+(one-OxxPyyPzz)*fabs((mfaaa-mxxPyyPzz))/(fabs((mfaaa-mxxPyyPzz))+qudricLimitD);
mxxPyyPzz += wadjust*(mfaaa-mxxPyyPzz)-three * (one-c1o2 * OxxPyyPzz) * (vx2 * dxux+vy2 * dyuy+vz2 * dzuz);
// mxxPyyPzz += OxxPyyPzz*(mfaaa-mxxPyyPzz)-three * (one-c1o2 * OxxPyyPzz) * (vx2 * dxux+vy2 * dyuy+vz2 * dzuz);//-magicBulk*OxxPyyPzz;
mxxMyy += omega * (-mxxMyy)-three * (one+c1o2 * (-omega)) * (vx2 * dxux-vy2 * dyuy);
mxxMzz += omega * (-mxxMzz)-three * (one+c1o2 * (-omega)) * (vx2 * dxux-vz2 * dzuz);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment