Skip to content
Snippets Groups Projects
Commit 82c21746 authored by Sören Peters's avatar Sören Peters
Browse files

Merge branch 'feature/clean-cpu-core' into 'develop'

[CPU] Clean CPU core

See merge request irmb/VirtualFluids_dev!298
parents 188b4f0d 429f57a3
No related branches found
No related tags found
1 merge request!298[CPU] Clean CPU core
Showing
with 10 additions and 8816 deletions
...@@ -160,10 +160,10 @@ void run() ...@@ -160,10 +160,10 @@ void run()
} }
double bulckViscosity = 10.0*nuLB; double bulckViscosity = 10.0*nuLB;
SPtr<LBMKernel> kernel = SPtr<LBMKernel>(new CompressibleCumulant4thOrderViscosityLBMKernel()); SPtr<LBMKernel> kernel = SPtr<LBMKernel>(new K17CompressibleNavierStokes());
//dynamicPointerCast<CompressibleCumulant4thOrderViscosityLBMKernel>(kernel)->setBulkViscosity(bulckViscosity); //dynamicPointerCast<K17CompressibleNavierStokes>(kernel)->setBulkViscosity(bulckViscosity);
//SPtr<LBMKernel> kernel = SPtr<LBMKernel>(new CompressibleCumulantLBMKernel()); //SPtr<LBMKernel> kernel = SPtr<LBMKernel>(new K15CompressibleNavierStokes());
//dynamicPointerCast<CompressibleCumulantLBMKernel>(kernel)->setBulkOmegaToOmega(true); //dynamicPointerCast<K15CompressibleNavierStokes>(kernel)->setBulkOmegaToOmega(true);
// //
SPtr<BCProcessor> bcProcessor(new BCProcessor()); SPtr<BCProcessor> bcProcessor(new BCProcessor());
......
add_subdirectory(${APPS_ROOT_CPU}/PoiseuilleFlow) add_subdirectory(${APPS_ROOT_CPU}/PoiseuilleFlow)
add_subdirectory(${APPS_ROOT_CPU}/CouetteFlow)
add_subdirectory(${APPS_ROOT_CPU}/sphere) add_subdirectory(${APPS_ROOT_CPU}/sphere)
add_subdirectory(${APPS_ROOT_CPU}/FlowAroundCylinder) add_subdirectory(${APPS_ROOT_CPU}/FlowAroundCylinder)
add_subdirectory(${APPS_ROOT_CPU}/LaminarTubeFlow) add_subdirectory(${APPS_ROOT_CPU}/LaminarTubeFlow)
add_subdirectory(${APPS_ROOT_CPU}/ConvectionOfVortex) add_subdirectory(${APPS_ROOT_CPU}/ConvectionOfVortex)
IF(${VFCPU_ENABLE_LiggghtsCoupling})
add_subdirectory(${APPS_ROOT_CPU}/LiggghtsApp)
add_subdirectory(${APPS_ROOT_CPU}/FallingSphere)
ENDIF()
IF(${VFCPU_ENABLE_NonNewtonianFluids})
add_subdirectory(${APPS_ROOT_CPU}/HerschelBulkleySphere)
add_subdirectory(${APPS_ROOT_CPU}/HerschelBulkleyModel)
add_subdirectory(${APPS_ROOT_CPU}/rheometer)
add_subdirectory(${APPS_ROOT_CPU}/ViskomatXL)
ENDIF()
IF(${VFCPU_ENABLE_MultiphaseFlow})
add_subdirectory(${APPS_ROOT_CPU}/Multiphase)
add_subdirectory(${APPS_ROOT_CPU}/MultiphaseDropletTest)
add_subdirectory(${APPS_ROOT_CPU}/RisingBubble2D)
add_subdirectory(${APPS_ROOT_CPU}/JetBreakup)
add_subdirectory(${APPS_ROOT_CPU}/ShotcreteJet)
add_subdirectory(${APPS_ROOT_CPU}/ConcreteExtrusion)
ENDIF()
IF(${VFCPU_ENABLE_LiggghtsCoupling} AND ${VFCPU_ENABLE_MultiphaseFlow})
add_subdirectory(${APPS_ROOT_CPU}/Nozzle)
add_subdirectory(${APPS_ROOT_CPU}/NozzleMultiphase)
ENDIF()
#add_subdirectory(tests) #add_subdirectory(tests)
#add_subdirectory(Applications/gridRf) #add_subdirectory(Applications/gridRf)
......
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
########################################################
## C++ PROJECT ###
########################################################
PROJECT(beadpack)
INCLUDE(${SOURCE_ROOT}/lib/IncludsList.txt)
#################################################################
### LOCAL FILES ###
#################################################################
FILE(GLOB SPECIFIC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.h
${CMAKE_CURRENT_SOURCE_DIR}/*.cpp
${CMAKE_CURRENT_SOURCE_DIR}/*.hpp )
SET(ALL_SOURCES ${ALL_SOURCES} ${SPECIFIC_FILES})
SOURCE_GROUP(src FILES ${SPECIFIC_FILES})
SET(CAB_ADDITIONAL_LINK_LIBRARIES vfluids)
#################################################################
### CREATE PROJECT ###
#################################################################
CREATE_CAB_PROJECT(beadpack BINARY)
#include <iostream>
#include <string>
#include <vfluids.h>
using namespace std;
void sbonepd(const char *configname)
{
try
{
string machine = QUOTEME(CAB_MACHINE);
string pathname, pathGeo;
int numOfThreads;
double availMem;
ConfigFileReader cf(configname);
if (!cf.read())
{
std::string exceptionText = "Unable to read configuration file\n";
throw exceptionText;
}
CommunicatorPtr comm = vf::parallel::MPICommunicator::getInstance();
int myid = comm->getProcessID();
if (machine == "BOMBADIL")
{
numOfThreads = 4;
pathname = "d:/temp/bbone";
pathGeo = "d:/Data/Bone/BigBone";
availMem = 15.0e9;
}
else if (machine == "M01" || machine == "M02")
{
numOfThreads = 8;
pathname = cf.getValue("pathname");
pathGeo = cf.getValue("pathGeo");
availMem = 12.0e9;
#if defined(__unix__)
if (myid == 0)
{
const char* str = pathname.c_str();
int status = mkdir(str, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
}
#endif
if (myid == 0)
{
stringstream logFilename;
logFilename << pathname + "/logfile" + UbSystem::toString(UbSystem::getTimeStamp()) + ".txt";
UbLog::output_policy::setStream(logFilename.str());
}
}
else throw UbException(UB_EXARGS, "unknown CAB_MACHINE");
if (myid == 0) UBLOG(logINFO, "Testcase big bone");
Grid3DPtr grid(new Grid3D(comm));
double deltaVoxel = 11.658e-6;
double dx = deltaVoxel;
const int blocknx1 = 64;
const int blocknx2 = 64;
const int blocknx3 = 64;
LBMReal rho_LB = 0.0;
//nueWasser = 1e-6 m^2/s
double nu_real = 1e-6;
LBMReal dt = 5e-8; // s (frei gew�hlt)
//dx - frei gew�hlt
//
LBMReal nu_LB = nu_real / (dx*dx / dt);
//dp = 50000 Pa - 0 Pa = 50000 Pa
double dp_real = UbSystem::stringTo<double>(cf.getValue("pressure")); //5000;
//rho wasser = 1000 kg*m^-3
double rho_real = 1000;
//dp/rho = 50000/1000 = 50 m^2/s^2
double dp_div_rho_real = dp_real / rho_real;
double dp_LB = dp_div_rho_real / ((dx / dt)*(dx / dt));
bool with_forcing = true;
double rhoLBinflow;
if (with_forcing)
{
rhoLBinflow = 0.0;
}
else
{
rhoLBinflow = dp_LB*3.0;
}
double deltax = dx;
LBMUnitConverterPtr conv = LBMUnitConverterPtr(new LBMUnitConverter());
const int baseLevel = 0;
const int refineLevel = 0;
double coord[6];
//////////////////////////////////////////////////////////////////////////
//restart
UbSchedulerPtr rSch(new UbScheduler(50000, 50000, 10000000));
RestartPostprocessor rp(grid, rSch, comm, pathname, RestartPostprocessor::BINARY);
//////////////////////////////////////////////////////////////////////////
if (grid->getTimeStep() == 0)
{
if (myid == 0) UBLOG(logINFO, "Neustart..");
string boneFilename = pathGeo + "/cyl_bone2.raw";
int pmNX1 = 1164; //abmessung einzelbild in x-richtung
int pmNX2 = 972; //abmessung einzelbild in y richtung
int pmNX3 = 900; //anzahl der bilder
//int pmNX3 = 10; //anzahl der bilder
float lthreshold = 109.0;
float uthreshold = 255.0;
GbVoxelMatrix3DPtr bone(new GbVoxelMatrix3D(pmNX1, pmNX2, pmNX3, 0, lthreshold, uthreshold));
bone->readMatrixFromRawFile<unsigned char>(boneFilename, GbVoxelMatrix3D::BigEndian);
bone->setVoxelMatrixDelta(deltaVoxel, deltaVoxel, deltaVoxel);
bone->setVoxelMatrixMininum(0.0, 0.0, 0.0);
if (myid == 0) bone->writeToVTKImageDataASCII(pathname + "/geo/bone");
///////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
double offset = 0.5e-3;
//bounding box
double g_minX1 = bone->getX1Minimum();
double g_minX2 = bone->getX2Minimum();
double g_minX3 = bone->getX3Minimum() - offset;
double g_maxX1 = bone->getX1Maximum();
double g_maxX2 = bone->getX2Maximum();
double g_maxX3 = bone->getX3Maximum() + offset;
double blockLength = (double)blocknx1*deltax;
grid->setPeriodicX1(false);
grid->setPeriodicX2(false);
grid->setPeriodicX3(true);
grid->setDeltaX(deltax);
grid->setBlockNX(blocknx1, blocknx2, blocknx3);
GbObject3DPtr gridCube(new GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3));
if (myid == 0) GbSystem3D::writeGeoObject(gridCube.get(), pathname + "/geo/gridCube", WbWriterVtkXmlBinary::getInstance());
GenBlocksGridVisitor genBlocks(gridCube);
grid->accept(genBlocks);
double forcing = 0;
if (with_forcing)
{
forcing = dp_LB / (blocknx3*grid->getNX3());
}
if (myid == 0)
{
UBLOG(logINFO, "Parameters:");
UBLOG(logINFO, "with forcing = " << with_forcing);
UBLOG(logINFO, "rho_LB = " << rho_LB);
UBLOG(logINFO, "nu_LB = " << nu_LB);
UBLOG(logINFO, "dp_LB = " << dp_LB);
UBLOG(logINFO, "forcing = " << forcing);
UBLOG(logINFO, "dx = " << dx << " m");
UBLOG(logINFO, "dt = " << dt << " s");
UBLOG(logINFO, "rho_real = " << rho_real << " kg*m^-3");
UBLOG(logINFO, "nu_real = " << nu_real << " m^2/s");
UBLOG(logINFO, "dp_real = " << dp_real << " Pa");
UBLOG(logINFO, "number of levels = " << refineLevel + 1);
UBLOG(logINFO, "numOfThreads = " << numOfThreads);
UBLOG(logINFO, "path = " << pathname);
UBLOG(logINFO, "Preprozess - start");
}
//cylinder
double radius = 0.0036;
double cx1 = 0.007;
double cx2 = 0.0046;
GbObject3DPtr cylinder(new GbCylinder3D(cx1, cx2, g_minX3 - offset, cx1, cx2, g_maxX3 + offset, radius));
GbSystem3D::writeGeoObject(cylinder.get(), pathname + "/geo/cylinder", WbWriterVtkXmlBinary::getInstance());
//inflow
GbCuboid3DPtr geoInflow(new GbCuboid3D(g_minX1 - blockLength, g_minX2 - blockLength, g_minX3 - blockLength, g_maxX1 + blockLength, g_maxX2 + blockLength, g_minX3));
if (myid == 0) GbSystem3D::writeGeoObject(geoInflow.get(), pathname + "/geo/geoInflow", WbWriterVtkXmlASCII::getInstance());
//outflow
GbCuboid3DPtr geoOutflow(new GbCuboid3D(g_minX1 - blockLength, g_minX2 - blockLength, g_maxX3, g_maxX1 + blockLength, g_maxX2 + blockLength, g_maxX3 + blockLength));
if (myid == 0) GbSystem3D::writeGeoObject(geoOutflow.get(), pathname + "/geo/geoOutflow", WbWriterVtkXmlASCII::getInstance());
BlocksPostprocessorPtr ppblocks(new BlocksPostprocessor(grid, UbSchedulerPtr(new UbScheduler(1)), pathname, WbWriterVtkXmlBinary::getInstance(), comm));
//bone interactor
int bcOptionBone = 0; //0=simple Bounce Back, 1=quadr. BB, 2=thin wall
D3Q27BoundaryConditionAdapterPtr bcBone(new D3Q27NoSlipBCAdapter(bcOptionBone));
D3Q27InteractorPtr boneInt(new D3Q27Interactor(bone, grid, bcBone, Interactor3D::SOLID));
//wall interactors
int bcOptionWall = 0; //0=simple Bounce Back, 1=quadr. BB, 2=thin wall
D3Q27BoundaryConditionAdapterPtr bcWall(new D3Q27NoSlipBCAdapter(bcOptionWall));
D3Q27InteractorPtr cylInt(new D3Q27Interactor(cylinder, grid, bcWall, Interactor3D::INVERSESOLID));
D3Q27BoundaryConditionAdapterPtr denBCAdapterInflow(new D3Q27DensityBCAdapter(rhoLBinflow));
denBCAdapterInflow->setSecondaryBcOption(0);
D3Q27InteractorPtr inflowInt = D3Q27InteractorPtr(new D3Q27Interactor(geoInflow, grid, denBCAdapterInflow, Interactor3D::SOLID));
//outflow
D3Q27BoundaryConditionAdapterPtr denBCAdapterOutflow(new D3Q27DensityBCAdapter(rho_LB));
denBCAdapterOutflow->setSecondaryBcOption(0);
D3Q27InteractorPtr outflowInt = D3Q27InteractorPtr(new D3Q27Interactor(geoOutflow, grid, denBCAdapterOutflow, Interactor3D::SOLID));
////////////////////////////////////////////
//METIS
Grid3DVisitorPtr metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::BSW));
////////////////////////////////////////////
/////delete solid blocks
if (myid == 0) UBLOG(logINFO, "deleteSolidBlocks - start");
InteractorsHelper intHelper(grid, metisVisitor);
intHelper.addInteractor(boneInt);
intHelper.addInteractor(cylInt);
intHelper.addInteractor(inflowInt);
intHelper.addInteractor(outflowInt);
intHelper.selectBlocks();
if (myid == 0) UBLOG(logINFO, "deleteSolidBlocks - end");
//////////////////////////////////////
//set connectors
D3Q27InterpolationProcessorPtr iProcessor(new D3Q27IncompressibleOffsetInterpolationProcessor());
D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nu_LB, iProcessor);
grid->accept(setConnsVisitor);
//domain decomposition for threads
PQueuePartitioningGridVisitor pqPartVisitor(numOfThreads);
grid->accept(pqPartVisitor);
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());
if (myid == 0)
{
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 << " = " << nobl);
UBLOG(logINFO, "Number of nodes for level " << level << " = " << nobl*nodb);
}
UBLOG(logINFO, "Necessary memory = " << needMemAll << " bytes");
UBLOG(logINFO, "Necessary memory per process = " << needMem << " bytes");
UBLOG(logINFO, "Available memory per process = " << availMem << " bytes");
}
LBMKernel3DPtr kernel = LBMKernel3DPtr(new LBMKernelETD3Q27CCLB(blocknx1, blocknx2, blocknx3, LBMKernelETD3Q27CCLB::NORMAL));
mu::Parser fctForcingX3;
fctForcingX3.SetExpr("Fx3");
fctForcingX3.DefineConst("Fx3", forcing);
kernel->setForcingX3(fctForcingX3);
kernel->setWithForcing(true);
//BCProcessorPtr bcProc(new D3Q27ETForThinWallBCProcessor());
BCProcessorPtr bcProc(new D3Q27ETBCProcessor());
kernel->setBCProcessor(bcProc);
SetKernelBlockVisitor kernelVisitor(kernel, nu_LB, availMem, needMem);
grid->accept(kernelVisitor);
//BC
intHelper.setBC();
//Press*1.6e8+(14.76-coordsX)/3.5*5000
//initialization of distributions
//mu::Parser fct;
//fct.SetExpr("(x1max-x1)/l*dp*3.0");
//fct.DefineConst("dp", dp_LB);
//fct.DefineConst("x3max", g_maxX3);
//fct.DefineConst("l", g_maxX3-g_minX3);
D3Q27ETInitDistributionsBlockVisitor initVisitor(nu_LB, rho_LB);
//initVisitor.setRho(fct);
//initVisitor.setVx1(fct);
initVisitor.setVx1(0.0);
grid->accept(initVisitor);
//Postrozess
UbSchedulerPtr geoSch(new UbScheduler(1));
D3Q27MacroscopicQuantitiesPostprocessorPtr ppgeo(
new D3Q27MacroscopicQuantitiesPostprocessor(grid, geoSch, pathname, WbWriterVtkXmlBinary::getInstance(), conv, true));
ppgeo->update(0);
ppgeo.reset();
coord[0] = bone->getX1Minimum();
coord[1] = bone->getX2Minimum();
coord[2] = cylinder->getX3Centroid();
coord[3] = bone->getX1Maximum();
coord[4] = bone->getX2Maximum();
coord[5] = cylinder->getX3Centroid();
////////////////////////////////////////////////////////
FILE * pFile;
string str = pathname + "/checkpoints/coord.txt";
pFile = fopen(str.c_str(), "w");
fprintf(pFile, "%f\n", coord[0]);
fprintf(pFile, "%f\n", coord[1]);
fprintf(pFile, "%f\n", coord[2]);
fprintf(pFile, "%f\n", coord[3]);
fprintf(pFile, "%f\n", coord[4]);
fprintf(pFile, "%f\n", coord[5]);
fclose(pFile);
////////////////////////////////////////////////////////
if (myid == 0) UBLOG(logINFO, "Preprozess - end");
}
else
{
//set connectors
D3Q27InterpolationProcessorPtr iProcessor(new D3Q27IncompressibleOffsetInterpolationProcessor());
D3Q27SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nu_LB, iProcessor);
grid->accept(setConnsVisitor);
////////////////////////////////////////////////////////
FILE * pFile;
string str = pathname + "/checkpoints/coord.txt";
pFile = fopen(str.c_str(), "r");
fscanf(pFile, "%f\n", &coord[0]);
fscanf(pFile, "%f\n", &coord[1]);
fscanf(pFile, "%f\n", &coord[2]);
fscanf(pFile, "%f\n", &coord[3]);
fscanf(pFile, "%f\n", &coord[4]);
fscanf(pFile, "%f\n", &coord[5]);
fclose(pFile);
////////////////////////////////////////////////////////
if (myid == 0) UBLOG(logINFO, "Restart - end");
}
UbSchedulerPtr nupsSch(new UbScheduler(10, 30, 100));
NUPSCounterPostprocessor npr(grid, nupsSch, numOfThreads, comm);
double outTime = 30000;
UbSchedulerPtr stepSch(new UbScheduler(outTime));
stepSch->addSchedule(10, 10, 10);
stepSch->addSchedule(100, 100, 100);
stepSch->addSchedule(1000, 1000, 1000);
stepSch->addSchedule(100, 1500, 2000);
stepSch->addSchedule(10000, 10000, 10000);
D3Q27MacroscopicQuantitiesPostprocessor pp(grid, stepSch, pathname, WbWriterVtkXmlBinary::getInstance(), conv);
double dxd2 = deltax / 2.0;
D3Q27IntegrateValuesHelperPtr ih1(new D3Q27IntegrateValuesHelper(grid, comm, coord[0] - dxd2, coord[1] - dxd2, coord[2] - dxd2,
coord[3] + dxd2, coord[4] + dxd2, coord[5] + dxd2));
if (myid == 0) GbSystem3D::writeGeoObject(ih1->getBoundingBox().get(), pathname + "/geo/ih1", WbWriterVtkXmlBinary::getInstance());
double factorp = dp_real / dp_LB;
double factorv = dx / dt;
UbSchedulerPtr stepMV(new UbScheduler(100));
D3Q27MeanValuesPostprocessor mvp1(grid, stepMV, pathname + "/mv/mv1.txt", comm, ih1, factorp, factorv);
//D3Q27IntegrateValuesHelperPtr ih2(new D3Q27IntegrateValuesHelper(grid, comm, g_maxX1-2.0*deltax, g_minX2, g_minX3,
// g_maxX1 - deltax, g_maxX2, g_maxX3));
//if (myid == 0) GbSystem3D::writeGeoObject(ih2->getBoundingBox().get(), pathname + "/geo/ih2", WbWriterVtkXmlBinary::getInstance());
//D3Q27MeanValuesPostprocessor mvp2(grid, stepSch, pathname + "/mv/mv2.txt", comm, ih2, factorp, factorv);
if (myid == 0)
{
UBLOG(logINFO, "PID = " << myid << " Total Physical Memory (RAM): " << Utilities::getTotalPhysMem());
UBLOG(logINFO, "PID = " << myid << " Physical Memory currently used: " << Utilities::getPhysMemUsed());
UBLOG(logINFO, "PID = " << myid << " Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe());
}
double endTime = UbSystem::stringTo<double>(cf.getValue("endTime")); //100001;//10001.0;
CalculationManagerPtr calculation(new CalculationManager(grid, numOfThreads, endTime, stepMV));
if (myid == 0) UBLOG(logINFO, "Simulation-start");
calculation->calculate();
if (myid == 0) UBLOG(logINFO, "Simulation-end");
}
catch (exception& e)
{
cerr << e.what() << endl << flush;
}
catch (string& s)
{
cerr << s << endl;
}
catch (...)
{
cerr << "unknown exception" << endl;
}
}
//////////////////////////////////////////////////////////////////////////
int main(int argc, char* argv[])
{
if (argv != NULL)
{
sbonepd(argv[1]);
}
return 0;
}
This diff is collapsed.
File deleted
...@@ -160,8 +160,8 @@ void run(string configname) ...@@ -160,8 +160,8 @@ void run(string configname)
} }
SPtr<LBMKernel> kernel; SPtr<LBMKernel> kernel;
//kernel = SPtr<LBMKernel>(new IncompressibleCumulantLBMKernel()); //kernel = SPtr<LBMKernel>(new InK15CompressibleNavierStokes());
kernel = SPtr<LBMKernel>(new CompressibleCumulant4thOrderViscosityLBMKernel()); kernel = SPtr<LBMKernel>(new K17CompressibleNavierStokes());
SPtr<BCProcessor> bcProc(new BCProcessor()); SPtr<BCProcessor> bcProc(new BCProcessor());
kernel->setBCProcessor(bcProc); kernel->setBCProcessor(bcProc);
kernel->setForcingX1(0.1); kernel->setForcingX1(0.1);
......
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
########################################################
## C++ PROJECT ###
########################################################
PROJECT(CheckpointConverter)
INCLUDE(${APPS_ROOT}/IncludsList.cmake)
#################################################################
### LOCAL FILES ###
#################################################################
FILE(GLOB SPECIFIC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.h
${CMAKE_CURRENT_SOURCE_DIR}/*.cpp
${CMAKE_CURRENT_SOURCE_DIR}/*.hpp )
SET(ALL_SOURCES ${ALL_SOURCES} ${SPECIFIC_FILES})
SOURCE_GROUP(src FILES ${SPECIFIC_FILES})
SET(CAB_ADDITIONAL_LINK_LIBRARIES VirtualFluids)
#################################################################
### CREATE PROJECT ###
#################################################################
CREATE_CAB_PROJECT(cpc BINARY)
path = d:/temp/BreugemChannelAnisotrop
step = 100
numberOfProcesses = 4
\ No newline at end of file
#include <iostream>
#include <string>
#include "VirtualFluids.h"
using namespace std;
void run(string configname)
{
try
{
vf::basics::ConfigurationFile config;
config.load(configname);
string path = config.getString("path");
int step = config.getValue<int>("step");
int numberOfProcesses = config.getValue<int>("numberOfProcesses");
SPtr<vf::parallel::Communicator> comm = vf::parallel::MPICommunicator::getInstance();
int myid = comm->getProcessID();
SPtr<Grid3D> grid(new Grid3D(comm));
CheckpointConverter converter(grid, path, comm);
converter.convert(step, numberOfProcesses);
}
catch (std::exception& e)
{
cerr << e.what() << endl << flush;
}
catch (std::string& s)
{
cerr << s << endl;
}
catch (...)
{
cerr << "unknown exception" << endl;
}
}
int main(int argc, char* argv[])
{
if (argv != NULL)
{
if (argv[1] != NULL)
{
run(string(argv[1]));
}
else
{
cout << "Configuration file is missing!" << endl;
}
}
}
########################################################
## C++ PROJECT ###
########################################################
PROJECT(ConcreteExtrusion)
vf_add_library(BUILDTYPE binary PRIVATE_LINK cpu_core basics ${MPI_CXX_LIBRARIES} MultiphaseFlow NonNewtonianFluids FILES ConcreteExtrusion.cpp )
\ No newline at end of file
pathname = D:/temp/JetBreakupSharpInterfaceShortTest3
pathGeo = d:/Projects/TRR277/Project/WP2/JetBreakup
numOfThreads = 18
availMem = 10e9
#Grid
blocknx = 25 25 25
factorLx = 2.0
factorLy = 2.5
factorLz = 2.5
#Simulation
case = 3
U_LB = 0.003 #inlet velocity
interfaceWidth = 3
D = 10 #0.0001 # m
D_LB = 50
contactAngle = 110.0
phi_L = 0.0
phi_H = 1.0
Phase-field Relaxation = 0.6
Mobility = 0.02 # 0.01 ./. 0.08, fine correction of Phase-field Relaxation parameter, to activate it need to change in kernel tauH to tauH1
logToFile = false
newStart = true
restartStep = 10000
cpStart = 10000
cpStep = 10000
outTime = 100
endTime = 100000#36000
\ No newline at end of file
This diff is collapsed.
...@@ -112,11 +112,10 @@ void run() ...@@ -112,11 +112,10 @@ void run()
GenBlocksGridVisitor genBlocks(gridCube); GenBlocksGridVisitor genBlocks(gridCube);
grid->accept(genBlocks); grid->accept(genBlocks);
SPtr<BC> outflowBC(new DensityBC(rhoLB)); SPtr<BC> outflowBC(new PressureBC(rhoLB));
outflowBC->setBCStrategy(SPtr<BCStrategy>(new NonReflectingOutflowBCStrategy())); outflowBC->setBCStrategy(SPtr<BCStrategy>(new OutflowNonReflecting()));
BoundaryConditionsBlockVisitor bcVisitor; BoundaryConditionsBlockVisitor bcVisitor;
bcVisitor.addBC(outflowBC);
SPtr<BCSet> bcProc; SPtr<BCSet> bcProc;
bcProc = SPtr<BCSet>(new BCSet()); bcProc = SPtr<BCSet>(new BCSet());
...@@ -206,10 +205,8 @@ void run() ...@@ -206,10 +205,8 @@ void run()
} }
SPtr<LBMKernel> kernel = SPtr<LBMKernel>(new CompressibleCumulant4thOrderViscosityLBMKernel()); SPtr<LBMKernel> kernel = SPtr<LBMKernel>(new K15CompressibleNavierStokes());
//dynamicPointerCast<CompressibleCumulant4thOrderViscosityLBMKernel>(kernel)->setBulkViscosity(10.0*nuLB); //dynamicPointerCast<K15CompressibleNavierStokes>(kernel)->setBulkOmegaToOmega(true);
//SPtr<LBMKernel> kernel = SPtr<LBMKernel>(new CompressibleCumulantLBMKernel());
//dynamicPointerCast<CompressibleCumulantLBMKernel>(kernel)->setBulkOmegaToOmega(true);
// //
SPtr<BCSet> bcSet(new BCSet()); SPtr<BCSet> bcSet(new BCSet());
......
########################################################
## C++ PROJECT ###
########################################################
PROJECT(CouetteFlow)
vf_add_library(BUILDTYPE binary PRIVATE_LINK cpu_core basics ${MPI_CXX_LIBRARIES} NonNewtonianFluids FILES cflow.cpp )
\ No newline at end of file
pathname = d:/temp/BinghamNewTest2
numOfThreads = 4
availMem = 8e9
logToFile = false
# blocknx = 2 32 32
# boundingBox = 0.25 32 32
# deltax = 0.125 #0.25 #0.5 #1
# nuLB = 0.05
# forcing = 1e-7 #2e-7 #4e-7 #8e-7
# outTime = 10000
# endTime = 1920000 #480000 #120000 #30000
blocknx = 2 32 2
boundingBox = 2 32 2
deltax = 1
#nuLB = 0.05
forcing = 8e-7
#n = 0.8
#tau0 = 3e-6
velocity = 1e-3
n = 0.4
Re = 1
Bn = 0.01
outTime = 1000
endTime = 50000000
\ No newline at end of file
#include <iostream>
#include <string>
#include "VirtualFluids.h"
#include "NonNewtonianFluids/NonNewtonianFluids.h"
using namespace std;
void bflow(string configname)
{
using namespace vf::lbm::dir;
try
{
vf::basics::ConfigurationFile config;
config.load(configname);
string pathname = config.getValue<string>("pathname");
int numOfThreads = config.getValue<int>("numOfThreads");
vector<int> blocknx = config.getVector<int>("blocknx");
vector<real> boundingBox = config.getVector<real>("boundingBox");
//double nuLB = config.getValue<double>("nuLB");
real endTime = config.getValue<real>("endTime");
real outTime = config.getValue<real>("outTime");
real availMem = config.getValue<real>("availMem");
//int refineLevel = config.getValue<int>("refineLevel");
bool logToFile = config.getValue<bool>("logToFile");
//double restartStep = config.getValue<double>("restartStep");
real deltax = config.getValue<real>("deltax");
//double cpStep = config.getValue<double>("cpStep");
//double cpStepStart = config.getValue<double>("cpStepStart");
//bool newStart = config.getValue<bool>("newStart");
real forcing = config.getValue<real>("forcing");
//double n = config.getValue<double>("n");
//double k = config.getValue<double>("k");
//double tau0 = config.getValue<double>("tau0");
real velocity = config.getValue<real>("velocity");
real n = config.getValue<real>("n");
// double Re = config.getValue<double>("Re");
// double Bn = config.getValue<double>("Bn");
SPtr<vf::parallel::Communicator> comm = vf::parallel::MPICommunicator::getInstance();
int myid = comm->getProcessID();
if (logToFile)
{
#if defined(__unix__)
if (myid == 0)
{
const char* str = pathname.c_str();
mkdir(str, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
}
#endif
if (myid == 0)
{
stringstream logFilename;
logFilename << pathname + "/logfile" + UbSystem::toString(UbSystem::getTimeStamp()) + ".txt";
UbLog::output_policy::setStream(logFilename.str());
}
}
real rhoLB = 0.0;
SPtr<LBMUnitConverter> conv = SPtr<LBMUnitConverter>(new LBMUnitConverter());
//bounding box
//double g_minX1 = 0;
//double g_minX2 = 0;
//double g_minX3 = 0;
//double g_maxX1 = boundingBox[0];
//double g_maxX2 = boundingBox[1];
//double g_maxX3 = boundingBox[2];
real g_minX1 = 0.0;
real g_minX2 = -boundingBox[1]/2.0;
real g_minX3 = -boundingBox[2]/2.0;
real g_maxX1 = boundingBox[0];
real g_maxX2 = boundingBox[1]/2.0;
real g_maxX3 = boundingBox[2]/2.0;
real blockLength = 3.0 * deltax;
// double h = (g_maxX2) / 2.0;
// double dex = g_maxX1;
//LBMReal tau0 = 1.2e-7;
//LBMReal k = nuLB;
//LBMReal n = 0.4;
real d = boundingBox[1];
real U = velocity;
real Gamma = U / d;
real k = 0.05; // (U * d) / (Re * std::pow(Gamma, n - 1));
real tau0 = 1e-6;// Bn* k* std::pow(Gamma, n);
real beta = 14;
real c = 10; // 1.0 / 6.0;
real mu0 = 1e-4;
SPtr<Rheology> thix = Rheology::getInstance();
//Herschel-Bulkley
thix->setPowerIndex(n);
thix->setViscosityParameter(k);
thix->setYieldStress(tau0);
//Powell-Eyring
thix->setBeta(beta);
thix->setC(c);
thix->setMu0(mu0);
SPtr<BC> noSlipBC(new NoSlipBC());
//noSlipBC->setBCStrategy(SPtr<BCStrategy>(new RheologyHerschelBulkleyModelNoSlipBCStrategy()));
//noSlipBC->setBCStrategy(SPtr<BCStrategy>(new RheologyPowellEyringModelNoSlipBCStrategy()));
noSlipBC->setBCStrategy(SPtr<BCStrategy>(new RheologyBinghamModelNoSlipBCStrategy()));
//BS visitor
BoundaryConditionsBlockVisitor bcVisitor;
bcVisitor.addBC(noSlipBC);
SPtr<BCSet> bcProc;
bcProc = SPtr<BCSet>(new BCSet());
//SPtr<LBMKernel> kernel = SPtr<LBMKernel>(new PowellEyringModelLBMKernel());
//SPtr<LBMKernel> kernel = SPtr<LBMKernel>(new HerschelBulkleyModelLBMKernel());
//SPtr<LBMKernel> kernel = SPtr<LBMKernel>(new RheologyK17LBMKernel());
SPtr<LBMKernel> kernel = SPtr<LBMKernel>(new RheologyBinghamModelLBMKernel());
kernel->setForcingX1(forcing);
kernel->setWithForcing(true);
kernel->setBCSet(bcProc);
SPtr<Grid3D> grid(new Grid3D(comm));
grid->setPeriodicX1(true);
grid->setPeriodicX2(false);
grid->setPeriodicX3(true);
grid->setDeltaX(deltax);
grid->setBlockNX(blocknx[0], blocknx[1], blocknx[2]);
SPtr<GbObject3D> gridCube(new GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3));
if (myid == 0) GbSystem3D::writeGeoObject(gridCube.get(), pathname + "/geo/gridCube", WbWriterVtkXmlBinary::getInstance());
GenBlocksGridVisitor genBlocks(gridCube);
grid->accept(genBlocks);
if (myid == 0)
{
UBLOG(logINFO, "Parameters:");
UBLOG(logINFO, "forcing = " << forcing);
UBLOG(logINFO, "rho = " << rhoLB);
//UBLOG(logINFO, "nu = " << nuLB);
UBLOG(logINFO, "U = " << U);
UBLOG(logINFO, "Re = " << (U * d) / (k * std::pow(Gamma, n - 1)));
UBLOG(logINFO, "Bn = " << tau0 / (k * std::pow(Gamma, n)));
UBLOG(logINFO, "k = " << k);
UBLOG(logINFO, "n = " << n);
UBLOG(logINFO, "tau0 = " << tau0);
UBLOG(logINFO, "deltax = " << deltax);
//UBLOG(logINFO, "number of levels = " << refineLevel + 1);
UBLOG(logINFO, "numOfThreads = " << numOfThreads);
UBLOG(logINFO, "Preprozess - start");
}
//walls
//GbCuboid3DPtr addWallZmin(new GbCuboid3D(g_minX1 - blockLength, g_minX2 - blockLength, g_minX3 - blockLength, g_maxX1 + blockLength, g_maxX2 + blockLength, g_minX3));
//if (myid == 0) GbSystem3D::writeGeoObject(addWallZmin.get(), pathname + "/geo/addWallZmin", WbWriterVtkXmlASCII::getInstance());
//GbCuboid3DPtr addWallZmax(new GbCuboid3D(g_minX1 - blockLength, g_minX2 - blockLength, g_maxX3, g_maxX1 + blockLength, g_maxX2 + blockLength, g_maxX3 + blockLength));
//if (myid == 0) GbSystem3D::writeGeoObject(addWallZmax.get(), pathname + "/geo/addWallZmax", WbWriterVtkXmlASCII::getInstance());
GbCuboid3DPtr addWallYmin(new GbCuboid3D(g_minX1 - blockLength, g_minX2 - blockLength, g_minX3 - blockLength, g_maxX1 + blockLength, g_minX2, g_maxX3 + blockLength));
if (myid == 0) GbSystem3D::writeGeoObject(addWallYmin.get(), pathname + "/geo/addWallYmin", WbWriterVtkXmlASCII::getInstance());
GbCuboid3DPtr addWallYmax(new GbCuboid3D(g_minX1 - blockLength, g_maxX2, g_minX3 - blockLength, g_maxX1 + blockLength, g_maxX2 + blockLength, g_maxX3 + blockLength));
if (myid == 0) GbSystem3D::writeGeoObject(addWallYmax.get(), pathname + "/geo/addWallYmax", WbWriterVtkXmlASCII::getInstance());
//wall interactors
//SPtr<D3Q27Interactor> addWallZminInt(new D3Q27Interactor(addWallZmin, grid, noSlipBC, Interactor3D::SOLID));
//SPtr<D3Q27Interactor> addWallZmaxInt(new D3Q27Interactor(addWallZmax, grid, noSlipBC, Interactor3D::SOLID));
SPtr<D3Q27Interactor> addWallYminInt(new D3Q27Interactor(addWallYmin, grid, noSlipBC, Interactor3D::SOLID));
SPtr<D3Q27Interactor> addWallYmaxInt(new D3Q27Interactor(addWallYmax, grid, noSlipBC, Interactor3D::SOLID));
////////////////////////////////////////////
//METIS
SPtr<Grid3DVisitor> metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, dMMM, MetisPartitioner::KWAY));
////////////////////////////////////////////
/////delete solid blocks
if (myid == 0) UBLOG(logINFO, "deleteSolidBlocks - start");
InteractorsHelper intHelper(grid, metisVisitor);
//intHelper.addInteractor(addWallZminInt);
//intHelper.addInteractor(addWallZmaxInt);
intHelper.addInteractor(addWallYminInt);
intHelper.addInteractor(addWallYmaxInt);
intHelper.selectBlocks();
if (myid == 0) UBLOG(logINFO, "deleteSolidBlocks - end");
//////////////////////////////////////
SPtr<SimulationObserver> ppblocks(new WriteBlocksSimulationObserver(grid, SPtr<UbScheduler>(new UbScheduler(1)), pathname, WbWriterVtkXmlBinary::getInstance(), comm));
ppblocks->update(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[1] + gl);
real needMemAll = real(nodg * (27 * sizeof(real) + sizeof(int) + sizeof(float) * 4));
real needMem = needMemAll / real(comm->getNumberOfProcesses());
if (myid == 0)
{
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 << " = " << nobl);
UBLOG(logINFO, "Number of nodes for level " << level << " = " << nobl * nodb);
}
UBLOG(logINFO, "Necessary memory = " << needMemAll << " bytes");
UBLOG(logINFO, "Necessary memory per process = " << needMem << " bytes");
UBLOG(logINFO, "Available memory per process = " << availMem << " bytes");
}
SetKernelBlockVisitor kernelVisitor(kernel, k, availMem, needMem);
grid->accept(kernelVisitor);
//BC
intHelper.setBC();
//initialization of distributions
InitDistributionsBlockVisitor initVisitor;
grid->accept(initVisitor);
if (myid == 0) UBLOG(logINFO, "Preprozess - end");
//set connectors
//InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolator());
//SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, k, iProcessor);
//grid->accept(setConnsVisitor);
OneDistributionSetConnectorsBlockVisitor setConnsVisitor(comm);
grid->accept(setConnsVisitor);
grid->accept(bcVisitor);
SPtr<UbScheduler> geoSch(new UbScheduler(1));
WriteBoundaryConditionsSimulationObserver ppgeo = WriteBoundaryConditionsSimulationObserver(grid, geoSch, pathname, WbWriterVtkXmlBinary::getInstance(), comm);
ppgeo.update(1);
SPtr<UbScheduler> nupsSch(new UbScheduler(10, 30, 100));
SPtr<SimulationObserver> npr(new NUPSCounterSimulationObserver(grid, nupsSch, numOfThreads, comm));
//write data for visualization of macroscopic quantities
SPtr<UbScheduler> visSch(new UbScheduler(outTime));
SPtr<WriteMacroscopicQuantitiesSimulationObserver> writeMQSimulationObserver(new WriteMacroscopicQuantitiesSimulationObserver(grid, visSch, pathname,
WbWriterVtkXmlASCII::getInstance(), SPtr<LBMUnitConverter>(new LBMUnitConverter()), comm));
SPtr<WriteThixotropyQuantitiesSimulationObserver> writeThixotropicMQSimulationObserver(new WriteThixotropyQuantitiesSimulationObserver(grid, visSch, pathname, WbWriterVtkXmlBinary::getInstance(), SPtr<LBMUnitConverter>(new LBMUnitConverter()), comm));
SPtr<UbScheduler> stepGhostLayer(new UbScheduler(outTime));
SPtr<Simulation> simulation(new Simulation(grid, stepGhostLayer, endTime));
simulation->addSimulationObserver(npr);
simulation->addSimulationObserver(writeMQSimulationObserver);
simulation->addSimulationObserver(writeThixotropicMQSimulationObserver);
//simulation->addSimulationObserver(migSimulationObserver);
//simulation->addSimulationObserver(restartSimulationObserver);
if (myid == 0) UBLOG(logINFO, "Simulation-start");
simulation->run();
if (myid == 0) UBLOG(logINFO, "Simulation-end");
}
catch (std::exception& e)
{
cerr << e.what() << endl << flush;
}
catch (std::string& s)
{
cerr << s << endl;
}
catch (...)
{
cerr << "unknown exception" << endl;
}
}
//////////////////////////////////////////////////////////////////////////
int main(int argc, char* argv[])
{
if (argv != NULL)
{
if (argv[1] != NULL)
{
//pflowForcing(string(argv[1]));
bflow(string(argv[1]));
}
else
{
cout << "Configuration file is missing!" << endl;
}
}
return 0;
}
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
########################################################
## C++ PROJECT ###
########################################################
PROJECT(dhit)
INCLUDE(${APPS_ROOT}/IncludsList.cmake)
#################################################################
### LOCAL FILES ###
#################################################################
FILE(GLOB SPECIFIC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.h
${CMAKE_CURRENT_SOURCE_DIR}/*.cpp
${CMAKE_CURRENT_SOURCE_DIR}/*.hpp )
SET(ALL_SOURCES ${ALL_SOURCES} ${SPECIFIC_FILES})
SOURCE_GROUP(src FILES ${SPECIFIC_FILES})
SET(CAB_ADDITIONAL_LINK_LIBRARIES VirtualFluids)
#################################################################
### CREATE PROJECT ###
#################################################################
CREATE_CAB_PROJECT(dhit BINARY)
pathname = d:/temp/DHIT_Green
numOfThreads = 4
availMem = 11e9
#Grid
length = 128 128 128
blocknx = 32 32 32
initTime = 10
outTime = 1
endTime = 10
logToFile = false
#Simulation
initFile = d:/Projects/DHIT/Velocities.txt
nuLB = 1.2395e-2
uRMS = 0.0234
lambda = 0.1
#include <iostream>
#include <string>
#include "VirtualFluids.h"
using namespace std;
void run(string configname)
{
try
{
//Sleep(30000);
vf::basics::ConfigurationFile config;
config.load(configname);
string pathname = config.getString("pathname");
int numOfThreads = config.getInt("numOfThreads");
vector<int> blocknx = config.getVector<int>("blocknx");
double endTime = config.getDouble("endTime");
double outTime = config.getDouble("outTime");
double availMem = config.getDouble("availMem");
vector<double> length = config.getVector<double>("length");
bool logToFile = config.getBool("logToFile");
string initFile = config.getString("initFile");
double nuLB = config.getDouble("nuLB");
double uRMS = config.getDouble("uRMS");
double lambda = config.getDouble("lambda");
double initTime = config.getDouble("initTime");
SPtr<vf::parallel::Communicator> comm = vf::parallel::MPICommunicator::getInstance();
int myid = comm->getProcessID();
if (logToFile)
{
#if defined(__unix__)
if (myid == 0)
{
const char* str = pathname.c_str();
mkdir(str, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
}
#endif
if (myid == 0)
{
stringstream logFilename;
logFilename << pathname + "/logfile" + UbSystem::toString(UbSystem::getTimeStamp()) + ".txt";
UbLog::output_policy::setStream(logFilename.str());
}
}
//LBMReal uLB = 0.032;
LBMReal dx = 1.0;
LBMReal rhoLB = 0.0;
SPtr<LBMUnitConverter> conv = SPtr<LBMUnitConverter>(new LBMUnitConverter());
//bounding box
double g_minX1 = 0.0;
double g_minX2 = 0.0;
double g_minX3 = 0.0;
double g_maxX1 = length[0];//-1.0;
double g_maxX2 = length[1];//-1.0;
double g_maxX3 = length[2];//-1.0;
//geometry
SPtr<GbObject3D> box(new GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3));
if (myid == 0) GbSystem3D::writeGeoObject(box.get(), pathname + "/geo/box", WbWriterVtkXmlBinary::getInstance());
SPtr<GbObject3D> gridCube(new GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3));
if (myid == 0) GbSystem3D::writeGeoObject(gridCube.get(), pathname + "/geo/gridCube", WbWriterVtkXmlBinary::getInstance());
double blockLength = blocknx[0] * dx;
SPtr<Grid3D> grid(new Grid3D(comm));
if (myid == 0)
{
//UBLOG(logINFO, "uLb = " << uLB);
UBLOG(logINFO, "rho = " << rhoLB);
UBLOG(logINFO, "nuLb = " << nuLB);
UBLOG(logINFO, "uRMS = " << uRMS);
UBLOG(logINFO, "lambda = " << lambda);
UBLOG(logINFO, "Re = " << (uRMS*lambda)/nuLB);
UBLOG(logINFO, "dx = " << dx);
UBLOG(logINFO, "length = " << length[0] << " " << length[1] << " " << length[2]);
UBLOG(logINFO, "blocknx = " << blocknx[0] << " " << blocknx[1] << " " << blocknx[2]);
UBLOG(logINFO, "number of processes = " << comm->getNumberOfProcesses());
UBLOG(logINFO, "number of threads = " << numOfThreads);
UBLOG(logINFO, "Preprocess - start");
}
grid->setDeltaX(dx);
grid->setBlockNX(blocknx[0], blocknx[1], blocknx[2]);
grid->setPeriodicX1(true);
grid->setPeriodicX2(true);
grid->setPeriodicX3(true);
if (myid == 0) GbSystem3D::writeGeoObject(gridCube.get(), pathname + "/geo/gridCube", WbWriterVtkXmlBinary::getInstance());
GenBlocksGridVisitor genBlocks(gridCube);
grid->accept(genBlocks);
WriteBlocksSPtr<CoProcessor> ppblocks(new WriteBlocksCoProcessor(grid, SPtr<UbScheduler>(new UbScheduler(1)), pathname, WbWriterVtkXmlBinary::getInstance(), comm));
SPtr<Grid3DVisitor> metisVisitor(new MetisPartitioningGridVisitor(comm, MetisPartitioningGridVisitor::LevelBased, D3Q27System::BSW));
InteractorsHelper intHelper(grid, metisVisitor);
//intHelper.addInteractor(boxInt);
intHelper.selectBlocks();
ppblocks->process(0);
ppblocks.reset();
//set connectors
InterpolationProcessorPtr iProcessor(new IncompressibleOffsetInterpolator());
SetConnectorsBlockVisitor setConnsVisitor(comm, true, D3Q27System::ENDDIR, nuLB, iProcessor);
grid->accept(setConnsVisitor);
//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]);
unsigned long long numberOfNodes = numberOfBlocks * numberOfNodesPerBlock;
unsigned long long numberOfNodesPerBlockWithGhostLayer = numberOfBlocks * (blocknx[0] + ghostLayer) * (blocknx[1] + ghostLayer) * (blocknx[2] + ghostLayer);
double needMemAll = double(numberOfNodesPerBlockWithGhostLayer*(27 * sizeof(double) + sizeof(int) + sizeof(float) * 4));
double needMem = needMemAll / double(comm->getNumberOfProcesses());
if (myid == 0)
{
UBLOG(logINFO, "Number of blocks = " << numberOfBlocks);
UBLOG(logINFO, "Number of nodes = " << numberOfNodes);
int minInitLevel = grid->getCoarsestInitializedLevel();
int maxInitLevel = grid->getFinestInitializedLevel();
for (int level = minInitLevel; level <= maxInitLevel; level++)
{
int nobl = grid->getNumberOfBlocks(level);
UBLOG(logINFO, "Number of blocks for level " << level << " = " << nobl);
UBLOG(logINFO, "Number of nodes for level " << level << " = " << nobl*numberOfNodesPerBlock);
}
UBLOG(logINFO, "Necessary memory = " << needMemAll << " bytes");
UBLOG(logINFO, "Necessary memory per process = " << needMem << " bytes");
UBLOG(logINFO, "Available memory per process = " << availMem << " bytes");
}
SPtr<LBMKernel> kernel;
//kernel = LBMKernel3DPtr(new LBMKernelETD3Q27CCLB(blocknx[0], blocknx[1], blocknx[2], LBMKernelETD3Q27CCLB::NORMAL));
kernel = SPtr<LBMKernel>(new InitDensityLBMKernel(blocknx[0], blocknx[1], blocknx[2]));
SPtr<BCProcessor> bcProc(new BCProcessor());
kernel->setBCProcessor(bcProc);
SetKernelBlockVisitor kernelVisitor(kernel, nuLB, availMem, needMem);
grid->accept(kernelVisitor);
intHelper.setBC();
//initialization of distributions
InitDistributionsBlockVisitor initVisitor(nuLB, rhoLB);
double u_LB = 0.01;
mu::Parser inflowProfileVx1, inflowProfileVx2, inflowProfileVx3;
inflowProfileVx1.DefineConst("U", u_LB);
inflowProfileVx1.DefineConst("PI", PI);
inflowProfileVx1.DefineConst("L1", g_maxX1-g_minX1);
inflowProfileVx1.DefineConst("L2", g_maxX2-g_minX2);
inflowProfileVx1.DefineConst("L3", g_maxX3-g_minX3);
inflowProfileVx1.SetExpr("U*cos(2.0*PI*x1/L1)*sin(2.0*PI*x2/L2)*sin(2.0*PI*x3/L3)");
inflowProfileVx2.DefineConst("U", u_LB);
inflowProfileVx2.DefineConst("PI", PI);
inflowProfileVx2.DefineConst("L1", g_maxX1-g_minX1);
inflowProfileVx2.DefineConst("L2", g_maxX2-g_minX2);
inflowProfileVx2.DefineConst("L3", g_maxX3-g_minX3);
inflowProfileVx2.SetExpr("-U*cos(2.0*PI*x1/L1)*sin(2.0*PI*x2/L2)*cos(2.0*PI*x3/L3)");
inflowProfileVx3.DefineConst("U", u_LB);
inflowProfileVx3.DefineConst("PI", PI);
inflowProfileVx3.DefineConst("L1", g_maxX1-g_minX1);
inflowProfileVx3.DefineConst("L2", g_maxX2-g_minX2);
inflowProfileVx3.DefineConst("L3", g_maxX3-g_minX3);
inflowProfileVx3.SetExpr("-U/2.0*sin(8.0*PI*(x1)/(L1))*cos(8.0*PI*(x3)/L3)");
initVisitor.setVx1(inflowProfileVx1);
initVisitor.setVx2(inflowProfileVx2);
initVisitor.setVx3(inflowProfileVx3);
//InitDistributionsFromFileBlockVisitor initVisitor(nuLB, rhoLB, initFile);
grid->accept(initVisitor);
//boundary conditions grid
{
SPtr<UbScheduler> geoSch(new UbScheduler(1));
WriteBoundaryConditionsSPtr<CoProcessor> ppgeo(
new WriteBoundaryConditionsCoProcessor(grid, geoSch, pathname, WbWriterVtkXmlBinary::getInstance(), conv, comm));
grid->coProcess(0);
}
if (myid == 0) UBLOG(logINFO, "Preprocess - end");
if (myid == 0)
{
UBLOG(logINFO, "PID = " << myid << " Total Physical Memory (RAM): " << Utilities::getTotalPhysMem());
UBLOG(logINFO, "PID = " << myid << " Physical Memory currently used: " << Utilities::getPhysMemUsed());
UBLOG(logINFO, "PID = " << myid << " Physical Memory currently used by current process: " << Utilities::getPhysMemUsedByMe());
}
SPtr<UbScheduler> outputSch(new UbScheduler(outTime));
WriteMacroscopicQuantitiesCoProcessor pp(grid, outputSch, pathname, WbWriterVtkXmlBinary::getInstance(), conv, comm);
SPtr<UbScheduler> nupsSch(new UbScheduler(10, 30, 100));
NUPSCounterCoProcessor npr(grid, nupsSch, numOfThreads, comm);
const SPtr<ConcreteCalculatorFactory> calculatorFactory = std::make_shared<ConcreteCalculatorFactory>(outputSch);
CalculationManagerPtr initialisation(new CalculationManager(grid, numOfThreads, endTime, calculatorFactory, CalculatorType::HYBRID));
if (myid == 0) UBLOG(logINFO, "Initialisation-start");
initialisation->calculate();
if (myid == 0) UBLOG(logINFO, "Initialisation-end");
kernel = SPtr<LBMKernel>(new IncompressibleCumulantLBMKernel(blocknx[0], blocknx[1], blocknx[2], IncompressibleCumulantLBMKernel::NORMAL));
kernel->setBCProcessor(bcProc);
SetKernelBlockVisitor kernelVisitor2(kernel, nuLB, availMem, needMem, SetKernelBlockVisitor::ChangeKernel);
grid->accept(kernelVisitor2);
SPtr<UbScheduler> visSch(new UbScheduler(outTime));
if (myid==0) UBLOG(logINFO, "Simulation-start");
grid->setTimeStep(initTime+1.0);
const SPtr<ConcreteCalculatorFactory> calculatorFactory2 = std::make_shared<ConcreteCalculatorFactory>(visSch);
CalculationManagerPtr calculation(new CalculationManager(grid, numOfThreads, endTime, calculatorFactory2, CalculatorType::HYBRID));
calculation->calculate();
if (myid==0) UBLOG(logINFO, "Simulation-end");
}
catch (std::exception& e)
{
cerr << e.what() << endl << flush;
}
catch (std::string& s)
{
cerr << s << endl;
}
catch (...)
{
cerr << "unknown exception" << endl;
}
}
int main(int argc, char* argv[])
{
if (argv != NULL)
{
if (argv[1] != NULL)
{
run(string(argv[1]));
}
else
{
cout << "Configuration file is missing!" << endl;
}
}
}
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