diff --git a/VirtualFluidsCore/CoProcessors/WriteMacroscopicQuantitiesCoProcessor.cpp b/VirtualFluidsCore/CoProcessors/WriteMacroscopicQuantitiesCoProcessor.cpp index ed7f1552bbf43982881a1b168e38e2f82f9e3bd4..e7a3788850684f533960a7eebfb57ad1a6208efa 100644 --- a/VirtualFluidsCore/CoProcessors/WriteMacroscopicQuantitiesCoProcessor.cpp +++ b/VirtualFluidsCore/CoProcessors/WriteMacroscopicQuantitiesCoProcessor.cpp @@ -149,16 +149,15 @@ void WriteMacroscopicQuantitiesCoProcessor::clearData() ////////////////////////////////////////////////////////////////////////// void WriteMacroscopicQuantitiesCoProcessor::addDataMQ(SPtr<Block3D> block) { - double level = (double)block->getLevel(); double blockID = (double)block->getGlobalID(); //This data is written: datanames.resize(0); - datanames.push_back("Rho"); + datanames.push_back("DRho"); + datanames.push_back("Press"); datanames.push_back("Vx"); datanames.push_back("Vy"); datanames.push_back("Vz"); - datanames.push_back("Level"); data.resize(datanames.size()); @@ -166,7 +165,7 @@ void WriteMacroscopicQuantitiesCoProcessor::addDataMQ(SPtr<Block3D> block) SPtr<BCArray3D> bcArray = kernel->getBCProcessor()->getBCArray(); SPtr<DistributionArray3D> distributions = kernel->getDataSet()->getFdistributions(); LBMReal f[D3Q27System::ENDF+1]; - LBMReal vx1,vx2,vx3,rho; + LBMReal vx1,vx2,vx3,drho,press; //node numbering always starts at 0! int SWB,SEB,NEB,NWB,SWT,SET,NET,NWT; @@ -212,10 +211,14 @@ void WriteMacroscopicQuantitiesCoProcessor::addDataMQ(SPtr<Block3D> block) float(worldCoordinates[2]) )); distributions->getDistribution(f, ix1, ix2, ix3); - calcMacros(f,rho,vx1,vx2,vx3); + calcMacros(f,drho,vx1,vx2,vx3); + press = D3Q27System::calcPress(f,drho,vx1,vx2,vx3); - if (UbMath::isNaN(rho) || UbMath::isInfinity(rho)) - UB_THROW( UbException(UB_EXARGS,"rho is not a number (nan or -1.#IND) or infinity number -1.#INF in block="+block->toString()+ + if (UbMath::isNaN(drho) || UbMath::isInfinity(drho)) + UB_THROW( UbException(UB_EXARGS,"drho is not a number (nan or -1.#IND) or infinity number -1.#INF in block="+block->toString()+ + ", node="+UbSystem::toString(ix1)+","+UbSystem::toString(ix2)+","+UbSystem::toString(ix3))); + if (UbMath::isNaN(press) || UbMath::isInfinity(press)) + UB_THROW( UbException(UB_EXARGS,"press is not a number (nan or -1.#IND) or infinity number -1.#INF in block="+block->toString()+ ", node="+UbSystem::toString(ix1)+","+UbSystem::toString(ix2)+","+UbSystem::toString(ix3))); if (UbMath::isNaN(vx1) || UbMath::isInfinity(vx1)) UB_THROW( UbException(UB_EXARGS,"vx1 is not a number (nan or -1.#IND) or infinity number -1.#INF in block="+block->toString()+ @@ -227,11 +230,11 @@ void WriteMacroscopicQuantitiesCoProcessor::addDataMQ(SPtr<Block3D> block) UB_THROW( UbException(UB_EXARGS,"vx3 is not a number (nan or -1.#IND) or infinity number -1.#INF in block="+block->toString()+ ", node="+UbSystem::toString(ix1)+","+UbSystem::toString(ix2)+","+UbSystem::toString(ix3))); - data[index++].push_back(rho * conv->getFactorDensityLbToW() ); + data[index++].push_back(drho * conv->getFactorDensityLbToW()); + data[index++].push_back(press * conv->getFactorPressureLbToW()); data[index++].push_back(vx1 * conv->getFactorVelocityLbToW()); data[index++].push_back(vx2 * conv->getFactorVelocityLbToW()); data[index++].push_back(vx3 * conv->getFactorVelocityLbToW()); - data[index++].push_back(level); } } } diff --git a/VirtualFluidsCore/LBM/CumulantK17LBMKernel.cpp b/VirtualFluidsCore/LBM/CumulantK17LBMKernel.cpp index a51e0db1483c32689a8c1f9577ff69a2d6b9caf1..79f0a586ad946cdf1624b8d915318006a0a7d24c 100644 --- a/VirtualFluidsCore/LBM/CumulantK17LBMKernel.cpp +++ b/VirtualFluidsCore/LBM/CumulantK17LBMKernel.cpp @@ -1,3 +1,36 @@ +//======================================================================================= +// ____ ____ __ ______ __________ __ __ __ __ +// \ \ | | | | | _ \ |___ ___| | | | | / \ | | +// \ \ | | | | | |_) | | | | | | | / \ | | +// \ \ | | | | | _ / | | | | | | / /\ \ | | +// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ +// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| +// \ \ | | ________________________________________________________________ +// \ \ | | | ______________________________________________________________| +// \ \| | | | __ __ __ __ ______ _______ +// \ | | |_____ | | | | | | | | | _ \ / _____) +// \ | | _____| | | | | | | | | | | \ \ \_______ +// \ | | | | |_____ | \_/ | | | | |_/ / _____ \ +// \ _____| |__| |________| \_______/ |__| |______/ (_______/ +// +// This file is part of VirtualFluids. VirtualFluids is free software: you can +// redistribute it and/or modify it under the terms of the GNU General Public +// License as published by the Free Software Foundation, either version 3 of +// the License, or (at your option) any later version. +// +// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. +// +//! \file CumulantK17LBMKernel.cpp +//! \ingroup LBM +//! \author Konstantin Kutscher, Martin Geier +//======================================================================================= + #include "CumulantK17LBMKernel.h" #include "D3Q27System.h" #include "D3Q27EsoTwist3DSplittedVector.h" diff --git a/VirtualFluidsCore/LBM/D3Q27System.h b/VirtualFluidsCore/LBM/D3Q27System.h index d58cc46349ed8be9833315adf9866f062062aba5..9e1426a06eb14bd59f8b4d9fe86e4df63ecb16a4 100644 --- a/VirtualFluidsCore/LBM/D3Q27System.h +++ b/VirtualFluidsCore/LBM/D3Q27System.h @@ -582,10 +582,9 @@ namespace D3Q27System static inline LBMReal calcPress(const LBMReal* const f, LBMReal rho, LBMReal vx1, LBMReal vx2, LBMReal vx3) { using namespace UbMath; - LBMReal op=1.0; - return ((f[E]+f[W]+f[N]+f[S]+f[T]+f[B]+2.*(f[NE]+f[SW]+f[SE]+f[NW]+f[TE]+f[BW]+f[BE]+f[TW]+f[TN]+f[BS]+f[BN]+f[TS])+ - 3.*(f[TNE]+f[TSW]+f[TSE]+f[TNW]+f[BNE]+f[BSW]+f[BSE]+f[BNW])-(vx1*vx1+vx2*vx2+vx3*vx3))*(1-0.5*op)+op*0.5*(rho))*c1o3; - + LBMReal OxxPyyPzz = c1; + return ((f[E]+f[W]+f[N]+f[S]+f[T]+f[B]+c2*(f[NE]+f[SW]+f[SE]+f[NW]+f[TE]+f[BW]+f[BE]+f[TW]+f[TN]+f[BS]+f[BN]+f[TS])+ + c3*(f[TNE]+f[TSW]+f[TSE]+f[TNW]+f[BNE]+f[BSW]+f[BSE]+f[BNW])-(vx1*vx1+vx2*vx2+vx3*vx3))*(c1-c1o2*OxxPyyPzz)+OxxPyyPzz*c1o2*(rho))*c1o3; } }