61 channelDirections.resize(6);
62 channelBoundaryConditions.resize(6);
65 channelDirections[0] =
"inlet";
66 channelDirections[1] =
"outlet";
67 channelDirections[2] =
"front";
68 channelDirections[3] =
"back";
69 channelDirections[4] =
"top";
70 channelDirections[5] =
"bottom";
80 VF_LOG_TRACE(
"-----Config Arrays Coord, Neighbor, Geo------");
85 neighX = std::shared_ptr<CoordNeighborGeoV>(
new CoordNeighborGeoV(
para->getneighborX(), binaer,
false));
86 neighY = std::shared_ptr<CoordNeighborGeoV>(
new CoordNeighborGeoV(
para->getneighborY(), binaer,
false));
87 neighZ = std::shared_ptr<CoordNeighborGeoV>(
new CoordNeighborGeoV(
para->getneighborZ(), binaer,
false));
88 neighWSB = std::shared_ptr<CoordNeighborGeoV>(
new CoordNeighborGeoV(
para->getneighborWSB(), binaer,
false));
96 for (
uint level = 0; level <= maxLevel; level++)
98 const uint numberOfNodesPerLevel = coordX.
getSize(level) + 1;
100 VF_LOG_INFO(
"Level {} = {} Nodes", level, numberOfNodesPerLevel);
112 neighX->initalNeighbors(
para->getParH(level)->neighborX, level);
113 neighY->initalNeighbors(
para->getParH(level)->neighborY, level);
114 neighZ->initalNeighbors(
para->getParH(level)->neighborZ, level);
115 neighWSB->initalNeighbors(
para->getParH(level)->neighborInverse, level);
116 geoV.initalNeighbors(
para->getParH(level)->typeOfGridNode, level);
124 VF_LOG_TRACE(
"-----finish Config Arrays Coord, Neighbor, Geo------");
132 this->makeReader(
para);
134 int level = BC_Values[0]->getLevel();
136 for (
int i = 0;
i <= level;
i++) {
137 velocityX_BCvalues.push_back(std::vector<real>());
138 velocityY_BCvalues.push_back(std::vector<real>());
139 velocityZ_BCvalues.push_back(std::vector<real>());
140 velocityQs.push_back(std::vector<std::vector<real>>());
141 velocityIndex.push_back(std::vector<int>());
142 for (
int j = 0;
j <
para->getD3Qxx();
j++) {
143 velocityQs[
i].push_back(std::vector<real>());
147 for (
uint i = 0;
i < channelBoundaryConditions.size();
i++)
149 if ( this->channelBoundaryConditions[
i] ==
"velocity") { fillVelocityVectors(
i); }
150 else if (this->channelBoundaryConditions[
i] ==
"pressure") { setPressureValues(
i); }
151 else if (this->channelBoundaryConditions[
i] ==
"outflow") { setOutflowValues(
i); }
174 for (
int i = 0;
i<level;
i++) {
185 para->getParH(
i)->coarseToFine.numberOfCells =
tempCF;
186 para->getParD(
i)->coarseToFine.numberOfCells =
para->getParH(
i)->coarseToFine.numberOfCells;
189 para->getParH(
i)->fineToCoarse.numberOfCells =
tempFC;
190 para->getParD(
i)->fineToCoarse.numberOfCells =
para->getParH(
i)->fineToCoarse.numberOfCells;
199 obj_offCF->initArrayOffset(
para->getParH(
i)->neighborCoarseToFine.x,
para->getParH(
i)->neighborCoarseToFine.y,
para->getParH(
i)->neighborCoarseToFine.z,
i);
200 obj_offFC->initArrayOffset(
para->getParH(
i)->neighborFineToCoarse.x,
para->getParH(
i)->neighborFineToCoarse.y,
para->getParH(
i)->neighborFineToCoarse.z,
i);
226 VF_LOG_WARNING(
"GridReader::allocArrays_fluidNodeIndices not implemented");
231 VF_LOG_WARNING(
"GridReader::tagFluidNodeIndices not implemented");
240void GridReader::setPressureValues(
int channelSide)
const
242 for (
unsigned int level = 0; level <= BC_Values[
channelSide]->getLevel(); level++)
261 BC_Values[
channelSide]->setPressValues(
para->getParH(level)->pressureBC.RhoBC,
para->getParH(level)->pressureBC.kN, level);
263 para->getParH(level)->pressureBC.RhoBC[
m] = (
para->getParH(level)->pressureBC.RhoBC[
m] /
para->getFactorPressBC());
267void GridReader::fillVelocityVectors(
int channelSide)
269 for (
unsigned int level = 0; level <= BC_Values[
channelSide]->getLevel(); level++)
298void GridReader::setVelocityValues() {
299 for (
int level = 0; level < (
int)(velocityX_BCvalues.size()); level++) {
313void GridReader::setVelocity(
int level,
int sizePerLevel)
const
317 para->getParH(level)->velocityBC.Vx[index] = this->velocityX_BCvalues[level][index] /
para->getVelocityRatio();
318 para->getParH(level)->velocityBC.Vy[index] = this->velocityY_BCvalues[level][index] /
para->getVelocityRatio();
319 para->getParH(level)->velocityBC.Vz[index] = this->velocityZ_BCvalues[level][index] /
para->getVelocityRatio();
324void GridReader::setOutflowValues(
int channelSide)
const
326 for (
unsigned int level = 0; level <= BC_Values[
channelSide]->getLevel(); level++)
346 BC_Values[
channelSide]->setOutflowValues(
para->getParH(level)->outflowBC.RhoBC,
para->getParH(level)->outflowBC.kN, level);
348 para->getParH(level)->outflowBC.RhoBC[index] = (
para->getParH(level)->outflowBC.RhoBC[index] /
para->getFactorPressBC()) * (
real)0.0;
360 if (
para->getNumprocs() > 1)
370 if (
para->getIsNeighborX())
375 std::cout <<
"MyID: " <<
para->getMyProcessID() <<
", neighborRankX: " <<
process << std::endl;
377 if (
para->getIsNeighborY())
382 std::cout <<
"MyID: " <<
para->getMyProcessID() <<
", neighborRankY: " <<
process << std::endl;
384 if (
para->getIsNeighborZ())
389 std::cout <<
"MyID: " <<
para->getMyProcessID() <<
", neighborRankZ: " <<
process << std::endl;
392 std::cout <<
"MyID: " <<
para->getMyProcessID() <<
", size of neighborRankX: " <<
neighborRankX.size() <<
", size of neighborRankY: " <<
neighborRankY.size() <<
", size of neighborRankZ: " <<
neighborRankZ.size() << std::endl;
400 for (
int i = 0;
i <= level;
i++) {
408 auto& parH =
para->getParHostAsReference(
i);
409 auto& parD =
para->getParDeviceAsReference(
i);
431 for (
int i = 0;
i <= level;
i++) {
440 auto& parH =
para->getParHostAsReference(
i);
441 auto& parD =
para->getParDeviceAsReference(
i);
464 for (
int i = 0;
i <= level;
i++) {
473 auto& parH =
para->getParHostAsReference(
i);
474 auto& parD =
para->getParDeviceAsReference(
i);
497 std::vector<std::shared_ptr<BoundaryQs> >
BC_Qs(channelDirections.size());
500 for (std::size_t
i = 0;
i < channelBoundaryConditions.size();
i++)
502 if ( this->channelBoundaryConditions[
i] ==
"noSlip" ) { setNoSlipQs(
BC_Qs[
i]); }
503 else if (this->channelBoundaryConditions[
i] ==
"velocity") { setVelocityQs(
BC_Qs[
i]); }
504 else if (this->channelBoundaryConditions[
i] ==
"pressure") { setPressQs(
BC_Qs[
i]); }
505 else if (this->channelBoundaryConditions[
i] ==
"outflow" ) { setOutflowQs(
BC_Qs[
i]); }
508 for (
int lev = 0;
lev < (
int)(velocityIndex.size());
lev++) {
509 if (velocityIndex[
lev].size() > 1) {
510 copyVectorsToQStruct(velocityQs[
lev], velocityIndex[
lev],
para->getParH(
lev)->velocityBC);
515 std::shared_ptr<BoundaryQs>
obj_geomQ = std::shared_ptr<BoundaryQs>(
new BoundaryQs(
para->getgeomBoundaryBcQs(),
para,
"geo",
false));
516 if (
para->getIsGeo())
526void GridReader::setPressQs(std::shared_ptr<BoundaryQs>
boundaryQ)
const
528 for (
unsigned int level = 0; level <=
boundaryQ->getLevel(); level++)
532 this->printQSize(
"pressure",
boundaryQ, level);
533 this->initalQStruct(
para->getParH(level)->pressureBC,
boundaryQ, level);
539void GridReader::setVelocityQs(std::shared_ptr<BoundaryQs>
boundaryQ)
541 for (
unsigned int level = 0; level <=
boundaryQ->getLevel(); level++)
545 this->printQSize(
"velocity",
boundaryQ, level);
546 this->initalVectorForQStruct(velocityQs, velocityIndex,
boundaryQ, level);
551void GridReader::setOutflowQs(std::shared_ptr<BoundaryQs>
boundaryQ)
const
553 for (
unsigned int level = 0; level <=
boundaryQ->getLevel(); level++)
557 this->printQSize(
"outflow",
boundaryQ, level);
558 this->initalQStruct(
para->getParH(level)->outflowBC,
boundaryQ, level);
564void GridReader::setNoSlipQs(std::shared_ptr<BoundaryQs>
boundaryQ)
const
566 for (
unsigned int level = 0; level <=
boundaryQ->getLevel(); level++)
570 this->printQSize(
"no slip",
boundaryQ, level);
572 this->initalQStruct(
para->getParH(level)->noSlipBC,
boundaryQ, level);
578void GridReader::setGeoQs(std::shared_ptr<BoundaryQs>
boundaryQ)
const
580 for (
unsigned int level = 0; level <=
boundaryQ->getLevel(); level++)
584 this->printQSize(
"geo Qs",
boundaryQ, level);
586 this->initalQStruct(
para->getParH(level)->geometryBC,
boundaryQ, level);
595void GridReader::modifyQElement(std::shared_ptr<BoundaryQs>
boundaryQ,
unsigned int level)
const
597 QforBoundaryConditions
Q;
598 real*
QQ =
para->getParH(level)->geometryBC.q27[0];
599 Q.q27[vf::lbm::dir::d000] = &
QQ[vf::lbm::dir::d000 *
para->getParH(level)->geometryBC.numberOfBCnodes];
600 for (
unsigned int i = 0;
i <
boundaryQ->getSize(level);
i++)
601 Q.q27[vf::lbm::dir::d000][
i] = 0.0f;
607void GridReader::initalVectorForQStruct(std::vector<std::vector<std::vector<real>>> &
Qs, std::vector<std::vector<int>> &index,
608 std::shared_ptr<BoundaryQs>
boundaryQ,
unsigned int level)
const
611 boundaryQ->setIndexInVector(index, level);
614void GridReader::copyVectorsToQStruct(std::vector<std::vector<real>> &
Qs,
615 std::vector<int> &index, QforBoundaryConditions &
Q)
const
617 QforBoundaryConditions
qTemp;
618 this->setQ27Size(
qTemp,
Q.q27[0],
Q.numberOfBCnodes);
622 for (
int direction = 0; direction <
para->getD3Qxx(); direction++) {
633void GridReader::initalQStruct(QforBoundaryConditions &
Q, std::shared_ptr<BoundaryQs>
boundaryQ,
634 unsigned int level)
const
636 QforBoundaryConditions
qTemp;
637 this->setQ27Size(
qTemp,
Q.q27[0],
Q.numberOfBCnodes);
642bool GridReader::hasQs(std::shared_ptr<BoundaryQs>
boundaryQ,
unsigned int level)
const
649 int maxLevel =
para->getMaxLevel();
653 for (
int i = 0;
i <= maxLevel;
i++) {
669 Q.q27[dP00] = &
QQ[dP00 *sizeQ];
670 Q.q27[dM00] = &
QQ[dM00 *sizeQ];
671 Q.q27[d0P0] = &
QQ[d0P0 *sizeQ];
672 Q.q27[d0M0] = &
QQ[d0M0 *sizeQ];
673 Q.q27[d00P] = &
QQ[d00P *sizeQ];
674 Q.q27[d00M] = &
QQ[d00M *sizeQ];
675 Q.q27[dPP0] = &
QQ[dPP0 *sizeQ];
676 Q.q27[dMM0] = &
QQ[dMM0 *sizeQ];
677 Q.q27[dPM0] = &
QQ[dPM0 *sizeQ];
678 Q.q27[dMP0] = &
QQ[dMP0 *sizeQ];
679 Q.q27[dP0P] = &
QQ[dP0P *sizeQ];
680 Q.q27[dM0M] = &
QQ[dM0M *sizeQ];
681 Q.q27[dP0M] = &
QQ[dP0M *sizeQ];
682 Q.q27[dM0P] = &
QQ[dM0P *sizeQ];
683 Q.q27[d0PP] = &
QQ[d0PP *sizeQ];
684 Q.q27[d0MM] = &
QQ[d0MM *sizeQ];
685 Q.q27[d0PM] = &
QQ[d0PM *sizeQ];
686 Q.q27[d0MP] = &
QQ[d0MP *sizeQ];
687 Q.q27[d000] = &
QQ[d000*sizeQ];
688 Q.q27[dPPP] = &
QQ[dPPP *sizeQ];
689 Q.q27[dMMP] = &
QQ[dMMP *sizeQ];
690 Q.q27[dPMP] = &
QQ[dPMP *sizeQ];
691 Q.q27[dMPP] = &
QQ[dMPP *sizeQ];
692 Q.q27[dPPM] = &
QQ[dPPM *sizeQ];
693 Q.q27[dMMM] = &
QQ[dMMM *sizeQ];
694 Q.q27[dPMM] = &
QQ[dPMM *sizeQ];
695 Q.q27[dMPM] = &
QQ[dMPM *sizeQ];
698void GridReader::setSizeNoSlip(std::shared_ptr<BoundaryQs>
boundaryQ,
unsigned int level)
const
700 para->getParH(level)->noSlipBC.numberOfBCnodes =
boundaryQ->getSize(level);
701 para->getParD(level)->noSlipBC.numberOfBCnodes =
para->getParH(level)->noSlipBC.numberOfBCnodes;
705void GridReader::setSizeGeoQs(std::shared_ptr<BoundaryQs>
boundaryQ,
unsigned int level)
const
707 para->getParH(level)->geometryBC.numberOfBCnodes =
boundaryQ->getSize(level);
708 para->getParD(level)->geometryBC.numberOfBCnodes =
para->getParH(level)->geometryBC.numberOfBCnodes;
713void GridReader::printQSize(std::string bc, std::shared_ptr<BoundaryQs>
boundaryQ,
unsigned int level)
const
715 std::cout <<
"level " << level <<
", " << bc <<
"-size: " <<
boundaryQ->getSize(level) << std::endl;
721 std::ifstream numberNodes;
722 numberNodes.open(
para->getnumberNodes().c_str(), std::ios::in);
724 std::cerr <<
"can't open file NumberNodes: " <<
para->getnumberNodes() << std::endl;
734 for (
int i = 0;
i <=
para->getMaxLevel();
i++) {
750 std::ifstream numberNodes;
751 numberNodes.open(
para->getLBMvsSI().c_str(), std::ios::in);
753 std::cerr <<
"can't open file LBMvsSI" << std::endl;
757 std::vector<real> minX, maxX, minY, maxY, minZ, maxZ;
759 for (
int i = 0;
i <=
para->getMaxLevel();
i++) {
773 para->setMinCoordX(minX);
774 para->setMinCoordY(minY);
775 para->setMinCoordZ(minZ);
776 para->setMaxCoordX(maxX);
777 para->setMaxCoordY(maxY);
778 para->setMaxCoordZ(maxZ);
788 for(
unsigned int i=0;
i<neighX->getLevel();
i++) {
789 if(boundaryCondition ==
"periodic_y"){
792 else if(boundaryCondition ==
"periodic_x"){
795 else if(boundaryCondition ==
"periodic_z"){
799 std::cout <<
"wrong String in periodicValue" << std::endl;
812 if(boundaryCondition ==
"periodic_y"){
815 else if(boundaryCondition ==
"periodic_x"){
818 else if(boundaryCondition ==
"periodic_z"){
825void GridReader::makeReader(std::shared_ptr<Parameter> para)
827 for (std::size_t
i = 0;
i < BC_Values.size();
i++)
829 if (channelDirections[
i].
compare(
"inlet") == 0){ BC_Values[
i] = std::shared_ptr<BoundaryValues>(
new BoundaryValues(
para->getinletBcValues())); }
830 if (channelDirections[
i].
compare(
"outlet") == 0){ BC_Values[
i] = std::shared_ptr<BoundaryValues>(
new BoundaryValues(
para->getoutletBcValues())); }
831 if (channelDirections[
i].
compare(
"back") == 0){ BC_Values[
i] = std::shared_ptr<BoundaryValues>(
new BoundaryValues(
para->getbackBcValues())); }
832 if (channelDirections[
i].
compare(
"front") == 0){ BC_Values[
i] = std::shared_ptr<BoundaryValues>(
new BoundaryValues(
para->getfrontBcValues())); }
833 if (channelDirections[
i].
compare(
"top") == 0){ BC_Values[
i] = std::shared_ptr<BoundaryValues>(
new BoundaryValues(
para->gettopBcValues())); }
834 if (channelDirections[
i].
compare(
"bottom") == 0){ BC_Values[
i] = std::shared_ptr<BoundaryValues>(
new BoundaryValues(
para->getbottomBcValues()));}
838void GridReader::makeReader(std::vector<std::shared_ptr<BoundaryQs> > &
BC_Qs, std::shared_ptr<Parameter> para)
840 for (std::size_t
i = 0;
i <
BC_Qs.size();
i++)
842 if (channelDirections[
i].
compare(
"inlet") == 0){
BC_Qs[
i] = std::shared_ptr<BoundaryQs>(
new BoundaryQs(
para->getinletBcQs(),
false)); }
843 if (channelDirections[
i].
compare(
"outlet") == 0){
BC_Qs[
i] = std::shared_ptr<BoundaryQs>(
new BoundaryQs(
para->getoutletBcQs(),
false)); }
844 if (channelDirections[
i].
compare(
"back") == 0){
BC_Qs[
i] = std::shared_ptr<BoundaryQs>(
new BoundaryQs(
para->getbackBcQs(),
false)); }
845 if (channelDirections[
i].
compare(
"front") == 0){
BC_Qs[
i] = std::shared_ptr<BoundaryQs>(
new BoundaryQs(
para->getfrontBcQs(),
false)); }
846 if (channelDirections[
i].
compare(
"top") == 0){
BC_Qs[
i] = std::shared_ptr<BoundaryQs>(
new BoundaryQs(
para->gettopBcQs(),
false)); }
847 if (channelDirections[
i].
compare(
"bottom") == 0){
BC_Qs[
i] = std::shared_ptr<BoundaryQs>(
new BoundaryQs(
para->getbottomBcQs(),
false)); }
853 for (std::size_t
i = 0;
i < channelDirections.size();
i++)
855 this->channelBoundaryConditions[
i] = BC_Values[
i]->getBoundaryCondition();
856 VF_LOG_INFO(
"{} Boundary: {}", this->channelDirections[
i], channelBoundaryConditions[
i]);
#define VF_LOG_TRACE(...)
#define VF_LOG_WARNING(...)
void initalCoords(real *int_ptr, unsigned int level) const
unsigned int getSize(unsigned int level)
std::shared_ptr< Parameter > para
void setOutflowSizePerLevel(int level, int sizePerLevel) const
void setVelocitySizePerLevel(int level, int sizePerLevel) const
void setPressSizePerLevel(int level, int sizePerLevel) const
virtual void setInitialNodeValues(uint numberOfNodes, int level) const
std::shared_ptr< CudaMemoryManager > cudaMemoryManager
void setNumberOfNodes(uint numberOfNodes, int level) const
void allocArrays_BoundaryQs() override
void setDimensions() override
void allocArrays_taggedFluidNodes() override
void setBoundingBox() override
GridReader(FILEFORMAT format, std::shared_ptr< Parameter > para, std::shared_ptr< CudaMemoryManager > cudaMemoryManager)
void setChannelBoundaryCondition()
void allocArrays_BoundaryValues(const BoundaryConditionFactory *bcFactory) override
void tagFluidNodeIndices(const std::vector< uint > &taggedFluidNodeIndices, CollisionTemplate tag, uint level) override
void allocArrays_CoordNeighborGeo() override
void sortFluidNodeTags() override
void initPeriodicNeigh(std::vector< std::vector< std::vector< unsigned int > > > periodV, std::vector< std::vector< unsigned int > > periodIndex, std::string way) override
void initalValuesDomainDecompostion(int level)
void allocArrays_OffsetScale() override
void initalGridInformations() override
std::shared_ptr< T > SPtr
CollisionTemplate
An enumeration for selecting a template of the collision kernel (CumulantK17)