diff --git a/src/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/GridGenerator.cpp b/src/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/GridGenerator.cpp index 5d2a6391e865aad757b6ace8b54f1289624ab005..36fcb3170bf6bcb6f774383836504dc0c92e97bf 100644 --- a/src/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/GridGenerator.cpp +++ b/src/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/GridGenerator.cpp @@ -8,6 +8,7 @@ #include <iostream> #include "utilities/math/Math.h" #include "LBM/LB.h" +#include "Output/QDebugWriter.hpp" std::shared_ptr<GridProvider> GridGenerator::make(std::shared_ptr<GridBuilder> builder, std::shared_ptr<Parameter> para) @@ -445,7 +446,7 @@ void GridGenerator::allocArrays_BoundaryQs() ////////////////////////////////////////////////////////////////// builder->getGeometryQs(Q.q27, i); - + //QDebugWriter::writeQValues(Q, para->getParH(i)->QGeom.k, para->getParH(i)->QGeom.kQ, "M:/TestGridGeneration/results/GeomGPU.dat"); ////////////////////////////////////////////////////////////////// for (int i = 0; i < numberOfGeometryNodes; i++) { diff --git a/src/VirtualFluids_GPU/Output/FileWriter.cpp b/src/VirtualFluids_GPU/Output/FileWriter.cpp index 51d3170793522a5c1429a6880ac272d0f28d376c..b3d7f7bad6559bd1289601be32f6236babc0ae56 100644 --- a/src/VirtualFluids_GPU/Output/FileWriter.cpp +++ b/src/VirtualFluids_GPU/Output/FileWriter.cpp @@ -91,15 +91,15 @@ void FileWriter::writeInit(std::shared_ptr<Parameter> para) } //Debug - InterfaceDebugWriter::writeInterfaceLinesDebugCF(para.get()); - InterfaceDebugWriter::writeInterfaceLinesDebugFC(para.get()); - InterfaceDebugWriter::writeInterfaceLinesDebugCFCneighbor(para.get()); - InterfaceDebugWriter::writeInterfaceLinesDebugCFFneighbor(para.get()); - InterfaceDebugWriter::writeInterfaceLinesDebugFCCneighbor(para.get()); - InterfaceDebugWriter::writeInterfaceLinesDebugFCFneighbor(para.get()); - InterfaceDebugWriter::writeNeighborXLinesDebug(para.get()); - InterfaceDebugWriter::writeNeighborYLinesDebug(para.get()); - InterfaceDebugWriter::writeNeighborZLinesDebug(para.get()); + //InterfaceDebugWriter::writeInterfaceLinesDebugCF(para.get()); + //InterfaceDebugWriter::writeInterfaceLinesDebugFC(para.get()); + //InterfaceDebugWriter::writeInterfaceLinesDebugCFCneighbor(para.get()); + //InterfaceDebugWriter::writeInterfaceLinesDebugCFFneighbor(para.get()); + //InterfaceDebugWriter::writeInterfaceLinesDebugFCCneighbor(para.get()); + //InterfaceDebugWriter::writeInterfaceLinesDebugFCFneighbor(para.get()); + //InterfaceDebugWriter::writeNeighborXLinesDebug(para.get()); + //InterfaceDebugWriter::writeNeighborYLinesDebug(para.get()); + //InterfaceDebugWriter::writeNeighborZLinesDebug(para.get()); //if (para->getParH(lev)->QGeom.kQ > 0) //{ diff --git a/src/VirtualFluids_GPU/Output/QDebugWriter.hpp b/src/VirtualFluids_GPU/Output/QDebugWriter.hpp new file mode 100644 index 0000000000000000000000000000000000000000..81a7979c446267d5871f718d4a212810bd387c69 --- /dev/null +++ b/src/VirtualFluids_GPU/Output/QDebugWriter.hpp @@ -0,0 +1,72 @@ +#ifndef QDEBUG_HPP +#define QDEBUG_HPP + +#include <stdio.h> +#include <fstream> +#include <sstream> +// #include <math.h> +#include <cmath> +#include "LBM/LB.h" +#include "LBM/D3Q27.h" +#include "Parameter/Parameter.h" +#include "basics/utilities/UbSystem.h" +#include "Utilities/StringUtil.hpp" +#include <basics/writer/WbWriterVtkXmlBinary.h> + + +using namespace std; + +namespace QDebugWriter +{ + void writeQValues(QforBoundaryConditions &Q, int* k, int kq, const std::string &name) + { + + std::vector< std::vector<real> > qs; + for (size_t j = 0; j < kq; j++) + { + uint32_t qKey = 0; + std::vector<real> qNode; + + for (int i = 26; i >= 0; i--) + { + real q = Q.q27[i][j]; + if (q > 0) { + qKey += (uint32_t)pow(2, 26 - i); + qNode.push_back(q); + } + } + if (qKey > 0) { + real transportKey = *((real*)&qKey); + qNode.push_back(transportKey); + qNode.push_back((real)k[j]); + qs.push_back(qNode); + } + qNode.clear(); + + } + + SPtr<std::ofstream> outQ(new std::ofstream); + outQ->open(name.c_str(), std::ios::out | std::ios::binary); + + + + for (int index = 0; index < qs.size(); index++) { + std::vector<real> bcs = qs[index]; + uint32_t key = *((uint32_t*)&bcs[bcs.size() - 2]); + int qIndex = (int)bcs[bcs.size() - 1]; + + *outQ << qIndex << " " << key; + + for (int i = 0; i < bcs.size() - 2; i++) { + *outQ << " " << std::fixed << std::setprecision(16) << bcs[i]; + } + + *outQ << "\n"; + } + + outQ->close(); + + } +} + +#endif