From 958063aedb7664c2fec7db8ab228bbc4d3d0affa Mon Sep 17 00:00:00 2001 From: Vanja Skuric Date: Sun, 5 Jun 2016 00:37:20 +0200 Subject: [PATCH 1/8] Modified backport for SolverPerformance and SolutionControl (removed data.C(H) and lduSolverPerformance is now typedef from BlockSolverPerformance) --- .../laplace/laplaceTetMotionSolver.H | 4 +- .../pimpleControl/pimpleControl.C | 10 +- .../simpleControl/simpleControl.C | 2 +- .../fvMatrices/fvMatrix/fvMatrix.C | 12 +- .../fvMatrices/fvMatrix/fvMatrix.H | 2 +- .../fvMatrices/fvMatrix/fvMatrixSolve.C | 8 +- .../fvScalarMatrix/fvScalarMatrix.C | 4 +- .../fvScalarMatrix/fvScalarMatrix.H | 2 +- src/finiteVolume/fvMesh/fvMesh.C | 4 - src/finiteVolume/fvMesh/fvMesh.H | 4 +- src/foam/Make/files | 5 +- .../GeometricField/GeometricField.C | 1 - .../BlockLduSolver/BlockSolverPerformance.C | 65 ++++++- .../BlockLduSolver/BlockSolverPerformance.H | 51 +++++ .../BlockSolverPerformanceVectorN.C | 53 +++++ .../BlockSolverPerformanceVectorN.H | 66 +++++++ .../BlockLduSolver/BlockSolverPerformances.C | 52 +++++ .../BlockLduSolver/BlockSolverPerformances.H | 64 ++++++ .../matrices/lduMatrix/lduMatrix/lduMatrix.H | 184 +----------------- .../lduMatrix/lduMatrix/lduMatrixSolver.C | 4 +- .../lduMatrix/lduMatrix/lduMatrixTests.C | 165 ---------------- .../lduMatrix/lduSolverPerformance.H | 49 +++++ .../lduMatrix/solvers/AMG/GAMGSolverSolve.C | 2 +- .../solvers/diagonalSolver/diagonalSolver.C | 2 +- src/foam/matrices/solution/solution.C | 46 ++++- src/foam/matrices/solution/solution.H | 22 +++ src/foam/meshes/data/data.C | 99 ---------- src/foam/meshes/data/data.H | 116 ----------- 28 files changed, 498 insertions(+), 600 deletions(-) create mode 100644 src/foam/matrices/blockLduMatrix/BlockLduSolvers/BlockLduSolver/BlockSolverPerformanceVectorN.C create mode 100644 src/foam/matrices/blockLduMatrix/BlockLduSolvers/BlockLduSolver/BlockSolverPerformanceVectorN.H create mode 100644 src/foam/matrices/blockLduMatrix/BlockLduSolvers/BlockLduSolver/BlockSolverPerformances.C create mode 100644 src/foam/matrices/blockLduMatrix/BlockLduSolvers/BlockLduSolver/BlockSolverPerformances.H delete mode 100644 src/foam/matrices/lduMatrix/lduMatrix/lduMatrixTests.C create mode 100644 src/foam/matrices/lduMatrix/lduMatrix/lduSolverPerformance.H delete mode 100644 src/foam/meshes/data/data.C delete mode 100644 src/foam/meshes/data/data.H diff --git a/src/dynamicMesh/meshMotion/tetMotionSolver/tetMotionSolver/laplace/laplaceTetMotionSolver.H b/src/dynamicMesh/meshMotion/tetMotionSolver/tetMotionSolver/laplace/laplaceTetMotionSolver.H index 1b26d899d..0827bac29 100644 --- a/src/dynamicMesh/meshMotion/tetMotionSolver/tetMotionSolver/laplace/laplaceTetMotionSolver.H +++ b/src/dynamicMesh/meshMotion/tetMotionSolver/tetMotionSolver/laplace/laplaceTetMotionSolver.H @@ -93,7 +93,7 @@ protected: } // Holds recent solver performance - lduMatrix::solverPerformance solverPerf_; + lduSolverPerformance solverPerf_; public: @@ -125,7 +125,7 @@ public: virtual void updateMesh(const mapPolyMesh&); //- Return recent solver performance - const lduMatrix::solverPerformance& solverPerformance() const + const lduSolverPerformance& solverPerformance() const { return solverPerf_; } diff --git a/src/finiteVolume/cfdTools/general/solutionControl/pimpleControl/pimpleControl.C b/src/finiteVolume/cfdTools/general/solutionControl/pimpleControl/pimpleControl.C index 94ef2a965..c094f3278 100644 --- a/src/finiteVolume/cfdTools/general/solutionControl/pimpleControl/pimpleControl.C +++ b/src/finiteVolume/cfdTools/general/solutionControl/pimpleControl/pimpleControl.C @@ -63,7 +63,7 @@ bool Foam::pimpleControl::criteriaSatisfied() bool achieved = true; bool checked = false; // safety that some checks were indeed performed - const dictionary& solverDict = mesh_.solverPerformanceDict(); + const dictionary& solverDict = mesh_.solutionDict().solverPerformanceDict(); forAllConstIter(dictionary, solverDict, iter) { const word& variableName = iter().keyword(); @@ -190,7 +190,7 @@ bool Foam::pimpleControl::loop() } corr_ = 0; - mesh_.data::remove("finalIteration"); + mesh_.solutionDict().remove("finalIteration"); return false; } @@ -202,7 +202,7 @@ bool Foam::pimpleControl::loop() Info<< algorithmName_ << ": converged in " << corr_ - 1 << " iterations" << endl; - mesh_.data::remove("finalIteration"); + mesh_.solutionDict().remove("finalIteration"); corr_ = 0; converged_ = false; @@ -213,7 +213,7 @@ bool Foam::pimpleControl::loop() Info<< algorithmName_ << ": iteration " << corr_ << endl; storePrevIterFields(); - mesh_.data::add("finalIteration", true); + mesh_.solutionDict().add("finalIteration", true); converged_ = true; } } @@ -221,7 +221,7 @@ bool Foam::pimpleControl::loop() { if (finalIter()) { - mesh_.data::add("finalIteration", true); + mesh_.solutionDict().add("finalIteration", true); } if (corr_ <= nCorrPIMPLE_) diff --git a/src/finiteVolume/cfdTools/general/solutionControl/simpleControl/simpleControl.C b/src/finiteVolume/cfdTools/general/solutionControl/simpleControl/simpleControl.C index fc710bc24..d91d12111 100644 --- a/src/finiteVolume/cfdTools/general/solutionControl/simpleControl/simpleControl.C +++ b/src/finiteVolume/cfdTools/general/solutionControl/simpleControl/simpleControl.C @@ -52,7 +52,7 @@ bool Foam::simpleControl::criteriaSatisfied() bool achieved = true; bool checked = false; // safety that some checks were indeed performed - const dictionary& solverDict = mesh_.solverPerformanceDict(); + const dictionary& solverDict = mesh_.solutionDict().solverPerformanceDict(); forAllConstIter(dictionary, solverDict, iter) { const word& variableName = iter().keyword(); diff --git a/src/finiteVolume/fvMatrices/fvMatrix/fvMatrix.C b/src/finiteVolume/fvMatrices/fvMatrix/fvMatrix.C index 79802028a..34774eee6 100644 --- a/src/finiteVolume/fvMatrices/fvMatrix/fvMatrix.C +++ b/src/finiteVolume/fvMatrices/fvMatrix/fvMatrix.C @@ -1390,7 +1390,7 @@ Foam::tmp > Foam::relax(const fvMatrix& m) template -Foam::lduMatrix::solverPerformance Foam::solve +Foam::lduSolverPerformance Foam::solve ( fvMatrix& fvm, const dictionary& solverControls @@ -1400,13 +1400,13 @@ Foam::lduMatrix::solverPerformance Foam::solve } template -Foam::lduMatrix::solverPerformance Foam::solve +Foam::lduSolverPerformance Foam::solve ( const tmp >& tfvm, const dictionary& solverControls ) { - lduMatrix::solverPerformance solverPerf = + lduSolverPerformance solverPerf = const_cast&>(tfvm()).solve(solverControls); tfvm.clear(); @@ -1416,18 +1416,18 @@ Foam::lduMatrix::solverPerformance Foam::solve template -Foam::lduMatrix::solverPerformance Foam::solve(fvMatrix& fvm) +Foam::lduSolverPerformance Foam::solve(fvMatrix& fvm) { return fvm.solve(); } template -Foam::lduMatrix::solverPerformance Foam::solve +Foam::lduSolverPerformance Foam::solve ( const tmp >& tfvm ) { - lduMatrix::solverPerformance solverPerf = + lduSolverPerformance solverPerf = const_cast&>(tfvm()).solve(); tfvm.clear(); diff --git a/src/finiteVolume/fvMatrices/fvMatrix/fvMatrix.H b/src/finiteVolume/fvMatrices/fvMatrix/fvMatrix.H index fb3b23394..d0976f860 100644 --- a/src/finiteVolume/fvMatrices/fvMatrix/fvMatrix.H +++ b/src/finiteVolume/fvMatrices/fvMatrix/fvMatrix.H @@ -363,7 +363,7 @@ public: //- Solve returning the solution statistics. // Use the given solver controls - lduMatrix::solverPerformance solve(const dictionary&); + lduSolverPerformance solve(const dictionary&); //- Solve returning the solution statistics. // Solver controls read from fvSolution diff --git a/src/finiteVolume/fvMatrices/fvMatrix/fvMatrixSolve.C b/src/finiteVolume/fvMatrices/fvMatrix/fvMatrixSolve.C index a37678fb4..d0560d1d5 100644 --- a/src/finiteVolume/fvMatrices/fvMatrix/fvMatrixSolve.C +++ b/src/finiteVolume/fvMatrices/fvMatrix/fvMatrixSolve.C @@ -52,7 +52,7 @@ void Foam::fvMatrix::setComponentReference template -Foam::lduMatrix::solverPerformance Foam::fvMatrix::solve +Foam::lduSolverPerformance Foam::fvMatrix::solve ( const dictionary& solverControls ) @@ -140,7 +140,7 @@ Foam::lduMatrix::solverPerformance Foam::fvMatrix::solve cmpt ); - lduMatrix::solverPerformance solverPerf; + lduSolverPerformance solverPerf; // Solver call solverPerf = lduMatrix::solver::New @@ -170,14 +170,14 @@ Foam::lduMatrix::solverPerformance Foam::fvMatrix::solve psi.correctBoundaryConditions(); - psi_.mesh().setSolverPerformance(psi_.name(), solverPerfVec); + psi_.mesh().solutionDict().setSolverPerformance(psi_.name(), solverPerfVec); return solverPerfVec; } template -Foam::lduMatrix::solverPerformance Foam::fvMatrix::solve() +Foam::lduSolverPerformance Foam::fvMatrix::solve() { return solve(psi_.mesh().solutionDict().solverDict(psi_.name())); } diff --git a/src/finiteVolume/fvMatrices/fvScalarMatrix/fvScalarMatrix.C b/src/finiteVolume/fvMatrices/fvScalarMatrix/fvScalarMatrix.C index c618525a4..e96824aa4 100644 --- a/src/finiteVolume/fvMatrices/fvScalarMatrix/fvScalarMatrix.C +++ b/src/finiteVolume/fvMatrices/fvScalarMatrix/fvScalarMatrix.C @@ -55,7 +55,7 @@ void Foam::fvMatrix::setComponentReference template<> -Foam::lduMatrix::solverPerformance Foam::fvMatrix::solve +Foam::lduSolverPerformance Foam::fvMatrix::solve ( const dictionary& solverControls ) @@ -104,7 +104,7 @@ Foam::lduMatrix::solverPerformance Foam::fvMatrix::solve psi.correctBoundaryConditions(); - psi_.mesh().setSolverPerformance(psi_.name(), solverPerf); + psi_.mesh().solutionDict().setSolverPerformance(psi_.name(), solverPerf); return solverPerf; } diff --git a/src/finiteVolume/fvMatrices/fvScalarMatrix/fvScalarMatrix.H b/src/finiteVolume/fvMatrices/fvScalarMatrix/fvScalarMatrix.H index fbaa535d2..700173b10 100644 --- a/src/finiteVolume/fvMatrices/fvScalarMatrix/fvScalarMatrix.H +++ b/src/finiteVolume/fvMatrices/fvScalarMatrix/fvScalarMatrix.H @@ -56,7 +56,7 @@ void fvMatrix::setComponentReference ); template<> -lduMatrix::solverPerformance fvMatrix::solve +lduSolverPerformance fvMatrix::solve ( const dictionary& ); diff --git a/src/finiteVolume/fvMesh/fvMesh.C b/src/finiteVolume/fvMesh/fvMesh.C index 75568127d..c422c8128 100644 --- a/src/finiteVolume/fvMesh/fvMesh.C +++ b/src/finiteVolume/fvMesh/fvMesh.C @@ -103,7 +103,6 @@ Foam::fvMesh::fvMesh(const IOobject& io) : polyMesh(io), surfaceInterpolation(*this), - data(static_cast(*this)), boundary_(*this, boundaryMesh()), lduPtr_(NULL), curTimeIndex_(time().timeIndex()), @@ -206,7 +205,6 @@ Foam::fvMesh::fvMesh : polyMesh(io, points, faces, allOwner, allNeighbour, syncPar), surfaceInterpolation(*this), - data(static_cast(*this)), boundary_(*this), lduPtr_(NULL), curTimeIndex_(time().timeIndex()), @@ -237,7 +235,6 @@ Foam::fvMesh::fvMesh : polyMesh(io, points, faces, cells, syncPar), surfaceInterpolation(*this), - data(static_cast(*this)), boundary_(*this), lduPtr_(NULL), curTimeIndex_(time().timeIndex()), @@ -285,7 +282,6 @@ Foam::fvMesh::fvMesh syncPar ), surfaceInterpolation(*this), - data(static_cast(*this)), boundary_(*this), lduPtr_(NULL), curTimeIndex_(time().timeIndex()), diff --git a/src/finiteVolume/fvMesh/fvMesh.H b/src/finiteVolume/fvMesh/fvMesh.H index ed3d8a7b0..3bb3a115f 100644 --- a/src/finiteVolume/fvMesh/fvMesh.H +++ b/src/finiteVolume/fvMesh/fvMesh.H @@ -52,7 +52,6 @@ SourceFiles #include "primitiveMesh.H" #include "fvBoundaryMesh.H" #include "surfaceInterpolation.H" -#include "data.H" #include "DimensionedField.H" #include "volFieldsFwd.H" #include "surfaceFieldsFwd.H" @@ -77,8 +76,7 @@ class fvMesh : public polyMesh, public lduMesh, - public surfaceInterpolation, - public data + public surfaceInterpolation { // Private data diff --git a/src/foam/Make/files b/src/foam/Make/files index 473cd61d7..d10fc07a0 100644 --- a/src/foam/Make/files +++ b/src/foam/Make/files @@ -242,7 +242,6 @@ lduMatrix = matrices/lduMatrix $(lduMatrix)/lduMatrix/lduMatrix.C $(lduMatrix)/lduMatrix/lduMatrixOperations.C $(lduMatrix)/lduMatrix/lduMatrixATmul.C -$(lduMatrix)/lduMatrix/lduMatrixTests.C $(lduMatrix)/lduMatrix/lduMatrixUpdateMatrixInterfaces.C $(lduMatrix)/lduMatrix/lduMatrixSolver.C $(lduMatrix)/lduMatrix/lduMatrixSmoother.C @@ -641,8 +640,6 @@ $(writers)/gnuplotGraph/gnuplotGraph.C $(writers)/xmgrGraph/xmgrGraph.C $(writers)/jplotGraph/jplotGraph.C -meshes/data/data.C - primitives/BlockCoeff/blockCoeffBase.C primitives/BlockCoeff/scalarBlockCoeff.C primitives/BlockCoeff/sphericalTensorBlockCoeff.C @@ -733,6 +730,8 @@ $(BlockLduSmoothers)/BlockILUCpSmoother/blockILUCpSmoothers.C BlockLduSolvers = matrices/blockLduMatrix/BlockLduSolvers $(BlockLduSolvers)/blockVectorNSolvers.C $(BlockLduSolvers)/BlockLduSolver/blockLduSolvers.C +$(BlockLduSolvers)/BlockLduSolver/BlockSolverPerformances.C +$(BlockLduSolvers)/BlockLduSolver/BlockSolverPerformanceVectorN.C $(BlockLduSolvers)/BlockDiagonal/blockDiagonalSolvers.C $(BlockLduSolvers)/BlockGaussSeidel/blockGaussSeidelSolvers.C $(BlockLduSolvers)/BlockCG/blockCGSolvers.C diff --git a/src/foam/fields/GeometricFields/GeometricField/GeometricField.C b/src/foam/fields/GeometricFields/GeometricField/GeometricField.C index 92c511d64..d576c5a48 100644 --- a/src/foam/fields/GeometricFields/GeometricField/GeometricField.C +++ b/src/foam/fields/GeometricFields/GeometricField/GeometricField.C @@ -27,7 +27,6 @@ License #include "foamTime.H" #include "demandDrivenData.H" #include "dictionary.H" -#include "data.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/foam/matrices/blockLduMatrix/BlockLduSolvers/BlockLduSolver/BlockSolverPerformance.C b/src/foam/matrices/blockLduMatrix/BlockLduSolvers/BlockLduSolver/BlockSolverPerformance.C index a01d55572..fb781ee89 100644 --- a/src/foam/matrices/blockLduMatrix/BlockLduSolvers/BlockLduSolver/BlockSolverPerformance.C +++ b/src/foam/matrices/blockLduMatrix/BlockLduSolvers/BlockLduSolver/BlockSolverPerformance.C @@ -34,7 +34,7 @@ bool Foam::BlockSolverPerformance::checkConvergence const scalar RelTolerance ) { - if (BlockLduMatrix::debug >= 2) + if (debug >= 2) { Info<< solverName_ << ": Iteration " << nIterations_ @@ -92,7 +92,7 @@ bool Foam::BlockSolverPerformance::checkSingularity template void Foam::BlockSolverPerformance::print() const { - if (BlockLduMatrix::debug) + if (debug) { Info<< solverName_ << ": Solving for " << fieldName_; @@ -111,4 +111,65 @@ void Foam::BlockSolverPerformance::print() const } +template +bool Foam::BlockSolverPerformance::operator!= +( + const BlockSolverPerformance& bsp +) const +{ + return + ( + solverName() != bsp.solverName() + || fieldName() != bsp.fieldName() + || initialResidual() != bsp.initialResidual() + || finalResidual() != bsp.finalResidual() + || nIterations() != bsp.nIterations() + || converged() != bsp.converged() + || singular() != bsp.singular() + ); +} + + +template +Foam::Istream& Foam::operator>> +( + Istream& is, + typename Foam::BlockSolverPerformance& bsp +) +{ + is.readBeginList("BlockSolverPerformance"); + is >> bsp.solverName_ + >> bsp.fieldName_ + >> bsp.initialResidual_ + >> bsp.finalResidual_ + >> bsp.nIterations_ + >> bsp.converged_ + >> bsp.singular_; + is.readEndList("BlockSolverPerformance"); + + return is; +} + + +template +Foam::Ostream& Foam::operator<< +( + Ostream& os, + const typename Foam::BlockSolverPerformance& bsp +) +{ + os << token::BEGIN_LIST + << bsp.solverName_ << token::SPACE + << bsp.fieldName_ << token::SPACE + << bsp.initialResidual_ << token::SPACE + << bsp.finalResidual_ << token::SPACE + << bsp.nIterations_ << token::SPACE + << bsp.converged_ << token::SPACE + << bsp.singular_ << token::SPACE + << token::END_LIST; + + return os; +} + + // ************************************************************************* // diff --git a/src/foam/matrices/blockLduMatrix/BlockLduSolvers/BlockLduSolver/BlockSolverPerformance.H b/src/foam/matrices/blockLduMatrix/BlockLduSolvers/BlockLduSolver/BlockSolverPerformance.H index d1bcf4524..035ec35f9 100644 --- a/src/foam/matrices/blockLduMatrix/BlockLduSolvers/BlockLduSolver/BlockSolverPerformance.H +++ b/src/foam/matrices/blockLduMatrix/BlockLduSolvers/BlockLduSolver/BlockSolverPerformance.H @@ -51,6 +51,9 @@ namespace Foam template class BlockSolverPerformance; +template +Istream& operator>>(Istream&, BlockSolverPerformance&); + template Ostream& operator<<(Ostream&, const BlockSolverPerformance&); @@ -88,8 +91,24 @@ class BlockSolverPerformance public: + // Static data + + // Declare name of the class and its debug switch + ClassName("BlockSolverPerformance"); + + // Constructors + //- Construct without solver and field name + BlockSolverPerformance() + : + initialResidual_(pTraits::zero), + finalResidual_(pTraits::zero), + nIterations_(0), + converged_(false), + singular_(false) + {} + //- Construct with solver and field name BlockSolverPerformance ( @@ -120,6 +139,18 @@ public: return solverName_; } + //- Return solver name + word& solverName() + { + return solverName_; + } + + //- Return field name + const word& fieldName() const + { + return fieldName_; + } + //- Return initial residual const Type& initialResidual() const { @@ -192,6 +223,26 @@ public: //- Print summary of solver performance void print() const; + + + // Member Operators + + bool operator!=(const BlockSolverPerformance&) const; + + + // Friend functions + + friend Istream& operator>> + ( + Istream&, + BlockSolverPerformance& + ); + + friend Ostream& operator<< + ( + Ostream&, + const BlockSolverPerformance& + ); }; diff --git a/src/foam/matrices/blockLduMatrix/BlockLduSolvers/BlockLduSolver/BlockSolverPerformanceVectorN.C b/src/foam/matrices/blockLduMatrix/BlockLduSolvers/BlockLduSolver/BlockSolverPerformanceVectorN.C new file mode 100644 index 000000000..a646ade89 --- /dev/null +++ b/src/foam/matrices/blockLduMatrix/BlockLduSolvers/BlockLduSolver/BlockSolverPerformanceVectorN.C @@ -0,0 +1,53 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | foam-extend: Open Source CFD + \\ / O peration | + \\ / A nd | For copyright notice see file Copyright + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of foam-extend. + + foam-extend 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. + + foam-extend 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 foam-extend. If not, see . + +Description + BlockSolverPerformance static data members + +Author + Vanja Skuric, FMENA Zagreb. All rights reserved. + +\*---------------------------------------------------------------------------*/ + +#include "coeffFields.H" +#include "BlockSolverPerformanceVectorN.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +#define makeNamedTemplateTypeNameAndDebug(type, Type, args...) \ + defineNamedTemplateTypeNameAndDebug(BlockSolverPerformance##Type, 1); + +forAllVectorNTypes(makeNamedTemplateTypeNameAndDebug); + +#undef makeNamedTemplateTypeNameAndDebug + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/foam/matrices/blockLduMatrix/BlockLduSolvers/BlockLduSolver/BlockSolverPerformanceVectorN.H b/src/foam/matrices/blockLduMatrix/BlockLduSolvers/BlockLduSolver/BlockSolverPerformanceVectorN.H new file mode 100644 index 000000000..bbdc15e45 --- /dev/null +++ b/src/foam/matrices/blockLduMatrix/BlockLduSolvers/BlockLduSolver/BlockSolverPerformanceVectorN.H @@ -0,0 +1,66 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | foam-extend: Open Source CFD + \\ / O peration | + \\ / A nd | For copyright notice see file Copyright + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of foam-extend. + + foam-extend 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. + + foam-extend 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 foam-extend. If not, see . + +Class + BlockSolverPerformance + +Description + Typedefs for BlockSolverPerformance + +Author + Vanja Skuric, FMENA Zagreb. All rights reserved. + +\*---------------------------------------------------------------------------*/ + +#ifndef BlockSolverPerformanceVectorN_H +#define BlockSolverPerformanceVectorN_H + +#include "BlockSolverPerformances.H" +#include "VectorTensorNFieldsFwd.H" +#include "ExpandTensorNField.H" +#include "VectorNFieldTypes.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#define makeTypedef(type, Type, args...) \ + typedef BlockSolverPerformance BlockSolverPerformance##Type; + +forAllVectorNTypes(makeTypedef) + +#undef makeTypedef + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/foam/matrices/blockLduMatrix/BlockLduSolvers/BlockLduSolver/BlockSolverPerformances.C b/src/foam/matrices/blockLduMatrix/BlockLduSolvers/BlockLduSolver/BlockSolverPerformances.C new file mode 100644 index 000000000..4bd330a83 --- /dev/null +++ b/src/foam/matrices/blockLduMatrix/BlockLduSolvers/BlockLduSolver/BlockSolverPerformances.C @@ -0,0 +1,52 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | foam-extend: Open Source CFD + \\ / O peration | + \\ / A nd | For copyright notice see file Copyright + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of foam-extend. + + foam-extend 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. + + foam-extend 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 foam-extend. If not, see . + +Description + BlockSolverPerformance static data members + +Author + Vanja Skuric, FMENA Zagreb. All rights reserved. + +\*---------------------------------------------------------------------------*/ + +#include "BlockSolverPerformances.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +defineNamedTemplateTypeNameAndDebug(BlockSolverPerformanceScalar, 1); +defineNamedTemplateTypeNameAndDebug(BlockSolverPerformanceVector, 1); +defineNamedTemplateTypeNameAndDebug(BlockSolverPerformanceSphericalTensor, 1); +defineNamedTemplateTypeNameAndDebug(BlockSolverPerformanceSymmTensor, 1); +defineNamedTemplateTypeNameAndDebug(BlockSolverPerformanceTensor, 1); + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/foam/matrices/blockLduMatrix/BlockLduSolvers/BlockLduSolver/BlockSolverPerformances.H b/src/foam/matrices/blockLduMatrix/BlockLduSolvers/BlockLduSolver/BlockSolverPerformances.H new file mode 100644 index 000000000..2377cca62 --- /dev/null +++ b/src/foam/matrices/blockLduMatrix/BlockLduSolvers/BlockLduSolver/BlockSolverPerformances.H @@ -0,0 +1,64 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | foam-extend: Open Source CFD + \\ / O peration | + \\ / A nd | For copyright notice see file Copyright + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of foam-extend. + + foam-extend 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. + + foam-extend 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 foam-extend. If not, see . + +Class + BlockSolverPerformance + +Description + Typedefs for BlockSolverPerformance + +Author + Vanja Skuric, FMENA Zagreb. All rights reserved. + +\*---------------------------------------------------------------------------*/ + +#ifndef BlockSolverPerformances_H +#define BlockSolverPerformances_H + +#include "BlockSolverPerformance.H" +#include "fieldTypes.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +typedef BlockSolverPerformance BlockSolverPerformanceScalar; +typedef BlockSolverPerformance BlockSolverPerformanceVector; +typedef BlockSolverPerformance + BlockSolverPerformanceSphericalTensor; +typedef BlockSolverPerformance BlockSolverPerformanceSymmTensor; +typedef BlockSolverPerformance BlockSolverPerformanceTensor; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/foam/matrices/lduMatrix/lduMatrix/lduMatrix.H b/src/foam/matrices/lduMatrix/lduMatrix/lduMatrix.H index cab85f082..7c13b2e4c 100644 --- a/src/foam/matrices/lduMatrix/lduMatrix/lduMatrix.H +++ b/src/foam/matrices/lduMatrix/lduMatrix/lduMatrix.H @@ -42,7 +42,6 @@ SourceFiles lduMatrixOperations.C lduMatrixSolver.C lduMatrixPreconditioner.C - lduMatrixTests.C lduMatrixUpdateMatrixInterfaces.C lduMatrixBufferedUpdateMatrixInterfaces.C @@ -60,6 +59,7 @@ SourceFiles #include "autoPtr.H" #include "runTimeSelectionTables.H" #include "profilingTrigger.H" +#include "lduSolverPerformance.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -93,181 +93,6 @@ class lduMatrix public: - //- Class returned by the solver, containing performance statistics - class solverPerformance - { - // Private Data - - //- Name of solver - word solverName_; - - //- Name of field - word fieldName_; - - //- Initial residual - scalar initialResidual_; - - //- Final residual - scalar finalResidual_; - - //- Number of iterations - label noIterations_; - - //- Has the solver converged? - bool converged_; - - //- Has the solver indicated a singular matrix? - bool singular_; - - - public: - - // Constructors - - //- Construct null - solverPerformance() - : - initialResidual_(0), - finalResidual_(0), - noIterations_(0), - converged_(false), - singular_(false) - {} - - - //- Construct from components - solverPerformance - ( - const word& solverName, - const word& fieldName, - const scalar iRes = 0, - const scalar fRes = 0, - const label nIter = 0, - const bool converged = false, - const bool singular = false - ) - : - solverName_(solverName), - fieldName_(fieldName), - initialResidual_(iRes), - finalResidual_(fRes), - noIterations_(nIter), - converged_(converged), - singular_(singular) - {} - - - // Member functions - - //- Return solver name - const word& solverName() const - { - return solverName_; - } - - //- Return access to solver name - word& solverName() - { - return solverName_; - } - - //- Return field name - const word& fieldName() const - { - return fieldName_; - } - - //- Return access to field name - word& fieldName() - { - return fieldName_; - } - - //- Return initial residual - scalar initialResidual() const - { - return initialResidual_; - } - - //- Return initial residual - scalar& initialResidual() - { - return initialResidual_; - } - - - //- Return final residual - scalar finalResidual() const - { - return finalResidual_; - } - - //- Return final residual - scalar& finalResidual() - { - return finalResidual_; - } - - - //- Return number of iterations - label nIterations() const - { - return noIterations_; - } - - //- Return number of iterations - label& nIterations() - { - return noIterations_; - } - - - //- Has the solver converged? - bool converged() const - { - return converged_; - } - - //- Is the matrix singular? - bool singular() const - { - return singular_; - } - - //- Convergence test - bool checkConvergence - ( - const scalar tolerance, - const scalar relTolerance - ); - - //- Singularity test - bool checkSingularity(const scalar residual); - - //- Print summary of solver performance - void print() const; - - // Member Operators - - bool operator!=(const solverPerformance&) const; - - // Ostream Operator - - friend Istream& operator>> - ( - Istream&, - solverPerformance& - ); - - friend Ostream& operator<< - ( - Ostream&, - const solverPerformance& - ); - - }; - - //- Abstract base-class for lduMatrix solvers class solver { @@ -322,10 +147,10 @@ public: } //- Is the stop criterion reached - bool stop(lduMatrix::solverPerformance& solverPerf) const; + bool stop(lduSolverPerformance& solverPerf) const; //- Is the converrgence criterion reached - bool converged(lduMatrix::solverPerformance& solverPerf) const; + bool converged(lduSolverPerformance& solverPerf) const; //- Read the control parameters from the dictionary virtual void readControls(); @@ -491,7 +316,7 @@ public: //- Read and reset the solver parameters from the given stream virtual void read(const dictionary&); - virtual solverPerformance solve + virtual lduSolverPerformance solve ( scalarField& x, const scalarField& b, @@ -1048,7 +873,6 @@ public: // Helper typedefs typedef lduMatrix::solver lduSolver; -typedef lduMatrix::solverPerformance lduSolverPerformance; typedef lduMatrix::preconditioner lduPreconditioner; typedef lduMatrix::smoother lduSmoother; diff --git a/src/foam/matrices/lduMatrix/lduMatrix/lduMatrixSolver.C b/src/foam/matrices/lduMatrix/lduMatrix/lduMatrixSolver.C index f2fe81c8d..4ac0433eb 100644 --- a/src/foam/matrices/lduMatrix/lduMatrix/lduMatrixSolver.C +++ b/src/foam/matrices/lduMatrix/lduMatrix/lduMatrixSolver.C @@ -207,7 +207,7 @@ Foam::scalar Foam::lduMatrix::solver::normFactor bool Foam::lduMatrix::solver::stop ( - lduMatrix::solverPerformance& solverPerf + lduSolverPerformance& solverPerf ) const { if (solverPerf.nIterations() < minIter_) @@ -221,7 +221,7 @@ bool Foam::lduMatrix::solver::stop bool Foam::lduMatrix::solver::converged ( - lduMatrix::solverPerformance& solverPerf + lduSolverPerformance& solverPerf ) const { if diff --git a/src/foam/matrices/lduMatrix/lduMatrix/lduMatrixTests.C b/src/foam/matrices/lduMatrix/lduMatrix/lduMatrixTests.C deleted file mode 100644 index ca4641b57..000000000 --- a/src/foam/matrices/lduMatrix/lduMatrix/lduMatrixTests.C +++ /dev/null @@ -1,165 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | foam-extend: Open Source CFD - \\ / O peration | Version: 3.2 - \\ / A nd | Web: http://www.foam-extend.org - \\/ M anipulation | For copyright notice see file Copyright -------------------------------------------------------------------------------- -License - This file is part of foam-extend. - - foam-extend 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. - - foam-extend 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 foam-extend. If not, see . - -Description - Convergence and singularity tests for solvers. - -\*---------------------------------------------------------------------------*/ - -#include "lduMatrix.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -bool Foam::lduMatrix::solverPerformance::checkConvergence -( - const scalar Tolerance, - const scalar RelTolerance -) -{ - if (debug >= 2) - { - Info<< solverName_ - << ": Iteration " << noIterations_ - << " residual = " << finalResidual_ - << endl; - } - - if - ( - finalResidual_ < Tolerance // Abs. tolerance - || ( - RelTolerance > SMALL - && finalResidual_ <= RelTolerance*initialResidual_ // Rel. tolerance - ) - // || (solverName == "symSolve" && iter == 0) - ) - { - converged_ = true; - } - else - { - converged_ = false; - } - - return converged_; -} - - -bool Foam::lduMatrix::solverPerformance::checkSingularity -( - const scalar residual -) -{ - if (residual > VSMALL) - { - singular_ = false; - } - else - { - singular_ = true; - } - - return singular_; -} - - -void Foam::lduMatrix::solverPerformance::print() const -{ - if (debug) - { - Info<< solverName_ << ": Solving for " << fieldName_; - - if (singular()) - { - Info<< ": solution singularity" << endl; - } - else - { - Info<< ", Initial residual = " << initialResidual_ - << ", Final residual = " << finalResidual_ - << ", No Iterations " << noIterations_ - << endl; - } - } -} - - -bool Foam::lduSolverPerformance::operator!= -( - const lduSolverPerformance& sp -) const -{ - return - ( - solverName() != sp.solverName() - || fieldName() != sp.fieldName() - || initialResidual() != sp.initialResidual() - || finalResidual() != sp.finalResidual() - || nIterations() != sp.nIterations() - || converged() != sp.converged() - || singular() != sp.singular() - ); -} - - -Foam::Istream& Foam::operator>> -( - Istream& is, - lduSolverPerformance& sp -) -{ - is.readBeginList("SolverPerformance"); - is >> sp.solverName_ - >> sp.fieldName_ - >> sp.initialResidual_ - >> sp.finalResidual_ - >> sp.noIterations_ - >> sp.converged_ - >> sp.singular_; - is.readEndList("SolverPerformance"); - - return is; -} - - -Foam::Ostream& Foam::operator<< -( - Ostream& os, - const lduSolverPerformance& sp -) -{ - os << token::BEGIN_LIST - << sp.solverName_ << token::SPACE - << sp.fieldName_ << token::SPACE - << sp.initialResidual_ << token::SPACE - << sp.finalResidual_ << token::SPACE - << sp.noIterations_ << token::SPACE - << sp.converged_ << token::SPACE - << sp.singular_ << token::SPACE - << token::END_LIST; - - return os; -} - - -// ************************************************************************* // diff --git a/src/foam/matrices/lduMatrix/lduMatrix/lduSolverPerformance.H b/src/foam/matrices/lduMatrix/lduMatrix/lduSolverPerformance.H new file mode 100644 index 000000000..f736d159a --- /dev/null +++ b/src/foam/matrices/lduMatrix/lduMatrix/lduSolverPerformance.H @@ -0,0 +1,49 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | foam-extend: Open Source CFD + \\ / O peration | Version: 3.2 + \\ / A nd | Web: http://www.foam-extend.org + \\/ M anipulation | For copyright notice see file Copyright +------------------------------------------------------------------------------- +License + This file is part of foam-extend. + + foam-extend 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. + + foam-extend 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 foam-extend. If not, see . + +Typedef + Foam::lduSolverPerformance + +Description + BlockSolverPerformance instantiated for a scalar and lduMatrix + +\*---------------------------------------------------------------------------*/ + +#ifndef lduSolverPerformance_H +#define lduSolverPerformance_H + +#include "BlockSolverPerformance.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + typedef BlockSolverPerformance lduSolverPerformance; +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/foam/matrices/lduMatrix/solvers/AMG/GAMGSolverSolve.C b/src/foam/matrices/lduMatrix/solvers/AMG/GAMGSolverSolve.C index a1749714d..8a9e49994 100644 --- a/src/foam/matrices/lduMatrix/solvers/AMG/GAMGSolverSolve.C +++ b/src/foam/matrices/lduMatrix/solvers/AMG/GAMGSolverSolve.C @@ -30,7 +30,7 @@ License // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -Foam::lduMatrix::solverPerformance Foam::GAMGSolver::solve +Foam::lduSolverPerformance Foam::GAMGSolver::solve ( scalarField& x, const scalarField& b, diff --git a/src/foam/matrices/lduMatrix/solvers/diagonalSolver/diagonalSolver.C b/src/foam/matrices/lduMatrix/solvers/diagonalSolver/diagonalSolver.C index 4e0f70b98..2801fa9b0 100644 --- a/src/foam/matrices/lduMatrix/solvers/diagonalSolver/diagonalSolver.C +++ b/src/foam/matrices/lduMatrix/solvers/diagonalSolver/diagonalSolver.C @@ -59,7 +59,7 @@ Foam::diagonalSolver::diagonalSolver // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -Foam::lduMatrix::solverPerformance Foam::diagonalSolver::solve +Foam::lduSolverPerformance Foam::diagonalSolver::solve ( scalarField& x, const scalarField& b, diff --git a/src/foam/matrices/solution/solution.C b/src/foam/matrices/solution/solution.C index 5a91b6d2c..d81ecb152 100644 --- a/src/foam/matrices/solution/solution.C +++ b/src/foam/matrices/solution/solution.C @@ -146,7 +146,8 @@ Foam::solution::solution(const objectRegistry& obr, const fileName& dictName) eqnRelaxDict_(dictionary::null), fieldRelaxDefault_(0), eqnRelaxDefault_(0), - solvers_(dictionary::null) + solvers_(dictionary::null), + prevTimeIndex_(0) { if (!headerOk()) { @@ -162,6 +163,8 @@ Foam::solution::solution(const objectRegistry& obr, const fileName& dictName) } read(solutionDict()); + + set("solverPerformance", dictionary()); } @@ -408,5 +411,46 @@ bool Foam::solution::writeData(Ostream& os) const return true; } +const Foam::dictionary& Foam::solution::solverPerformanceDict() const +{ + return subDict("solverPerformance"); +} + + +void Foam::solution::setSolverPerformance +( + const word& name, + const lduSolverPerformance& sp +) const +{ + dictionary& dict = const_cast(solverPerformanceDict()); + + List perfs; + + if (prevTimeIndex_ != this->time().timeIndex()) + { + // Reset solver performance between iterations + prevTimeIndex_ = this->time().timeIndex(); + dict.clear(); + } + else + { + dict.readIfPresent(name, perfs); + } + + // Append to list + perfs.setSize(perfs.size()+1, sp); + + dict.set(name, perfs); +} + + +void Foam::solution::setSolverPerformance +( + const lduSolverPerformance& sp +) const +{ + setSolverPerformance(sp.fieldName(), sp); +} // ************************************************************************* // diff --git a/src/foam/matrices/solution/solution.H b/src/foam/matrices/solution/solution.H index 310e288e0..f05380b0f 100644 --- a/src/foam/matrices/solution/solution.H +++ b/src/foam/matrices/solution/solution.H @@ -37,6 +37,7 @@ SourceFiles #include "IOdictionary.H" #include "debugSwitch.H" +#include "lduSolverPerformance.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -74,6 +75,9 @@ class solution //- Dictionary of solver parameters for all the fields dictionary solvers_; + //- Previously used time-index, used for reset between iterations + mutable label prevTimeIndex_; + // Private Member Functions @@ -144,6 +148,24 @@ public: //- Return the solver controls dictionary for the given field const dictionary& solver(const word& name) const; + //- Return the dictionary of solver performance data + // which includes initial and final residuals for convergence + // checking + const dictionary& solverPerformanceDict() const; + + //- Add/set the solverPerformance entry for the named field + void setSolverPerformance + ( + const word& name, + const lduSolverPerformance& + ) const; + + //- Add/set the solverPerformance entry, using its fieldName + void setSolverPerformance + ( + const lduSolverPerformance& + ) const; + // Edit diff --git a/src/foam/meshes/data/data.C b/src/foam/meshes/data/data.C deleted file mode 100644 index 37365a516..000000000 --- a/src/foam/meshes/data/data.C +++ /dev/null @@ -1,99 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | foam-extend: Open Source CFD - \\ / O peration | Version: 3.2 - \\ / A nd | Web: http://www.foam-extend.org - \\/ M anipulation | For copyright notice see file Copyright -------------------------------------------------------------------------------- -License - This file is part of foam-extend. - - foam-extend 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. - - foam-extend 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 foam-extend. If not, see . - -\*---------------------------------------------------------------------------*/ - -#include "data.H" -#include "foamTime.H" - -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - -int Foam::data::debug(Foam::debug::debugSwitchFromDict("data", false)); - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -Foam::data::data(const objectRegistry& obr) -: - IOdictionary - ( - IOobject - ( - "data", - obr.time().system(), - obr, - IOobject::NO_READ, - IOobject::NO_WRITE - ) - ), - prevTimeIndex_(0) -{ - set("solverPerformance", dictionary()); -} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -const Foam::dictionary& Foam::data::solverPerformanceDict() const -{ - return subDict("solverPerformance"); -} - - -void Foam::data::setSolverPerformance -( - const word& name, - const lduSolverPerformance& sp -) const -{ - dictionary& dict = const_cast(solverPerformanceDict()); - - List perfs; - - if (prevTimeIndex_ != this->time().timeIndex()) - { - // Reset solver performance between iterations - prevTimeIndex_ = this->time().timeIndex(); - dict.clear(); - } - else - { - dict.readIfPresent(name, perfs); - } - - // Append to list - perfs.setSize(perfs.size()+1, sp); - - dict.set(name, perfs); -} - - -void Foam::data::setSolverPerformance -( - const lduSolverPerformance& sp -) const -{ - setSolverPerformance(sp.fieldName(), sp); -} - - -// ************************************************************************* // diff --git a/src/foam/meshes/data/data.H b/src/foam/meshes/data/data.H deleted file mode 100644 index a6cb98b99..000000000 --- a/src/foam/meshes/data/data.H +++ /dev/null @@ -1,116 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | foam-extend: Open Source CFD - \\ / O peration | Version: 3.2 - \\ / A nd | Web: http://www.foam-extend.org - \\/ M anipulation | For copyright notice see file Copyright -------------------------------------------------------------------------------- -License - This file is part of foam-extend. - - foam-extend 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. - - foam-extend 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 foam-extend. If not, see . - -Class - Foam::data - -Description - Database for solution data, solver performance and other reduced data. - - fvMesh is derived from data so that all fields have access to the data from - the mesh reference they hold. - -SourceFiles - data.C - -\*---------------------------------------------------------------------------*/ - -#ifndef data_H -#define data_H - -#include "IOdictionary.H" -#include "lduMatrix.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -/*---------------------------------------------------------------------------*\ - Class data Declaration -\*---------------------------------------------------------------------------*/ - -class data -: - public IOdictionary -{ - // Private data - - //- Previously used time-index, used for reset between iterations - mutable label prevTimeIndex_; - - - // Private Member Functions - - //- Disallow default bitwise copy construct - data(const data&); - - //- Disallow default bitwise assignment - void operator=(const data&); - - -public: - - //- Debug switch - static int debug; - - - // Constructors - - //- Construct for objectRegistry - data(const objectRegistry& obr); - - - // Member Functions - - // Access - - //- Return the dictionary of solver performance data - // which includes initial and final residuals for convergence - // checking - const dictionary& solverPerformanceDict() const; - - //- Add/set the solverPerformance entry for the named field - void setSolverPerformance - ( - const word& name, - const lduSolverPerformance& - ) const; - - //- Add/set the solverPerformance entry, using its fieldName - void setSolverPerformance - ( - const lduSolverPerformance& - ) const; -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // From a6e53dc3f15244d19ca2b60f887887d2c847e551 Mon Sep 17 00:00:00 2001 From: Vanja Skuric Date: Sun, 5 Jun 2016 00:39:27 +0200 Subject: [PATCH 2/8] Changed lduMatrix::solverPerformance to lduSolverPerformance inside corresponding solvers --- .../solidMechanics/elasticAcpSolidFoam/elasticAcpSolidFoam.C | 2 +- .../elasticIncrAcpSolidFoam/elasticIncrAcpSolidFoam.C | 2 +- .../elasticIncrSolidFoam/elasticIncrSolidFoam.C | 2 +- .../elasticNonLinIncrTLSolidFoam.C | 2 +- .../elasticNonLinTLSolidFoam/elasticNonLinTLSolidFoam.C | 2 +- .../elasticNonLinULSolidFoam/elasticNonLinULSolidFoam.C | 2 +- .../elasticOrthoAcpSolidFoam/elasticOrthoAcpSolidFoam.C | 2 +- .../elasticOrthoNonLinULSolidFoam.C | 2 +- .../elasticOrthoSolidFoam/elasticOrthoSolidFoam.C | 2 +- .../elasticPlasticNonLinTLSolidFoam.C | 2 +- .../elasticPlasticNonLinULSolidFoam.C | 2 +- .../elasticPlasticSolidFoam/elasticPlasticSolidFoam.C | 2 +- .../solidMechanics/elasticSolidFoam/elasticSolidFoam.C | 2 +- .../elasticThermalSolidFoam/elasticThermalSolidFoam.C | 4 ++-- .../icoFsiElasticNonLinULSolidFoam/solveSolidBackward.H | 2 +- .../icoFsiElasticNonLinULSolidFoam/solveSolidEuler.H | 2 +- .../solidMechanics/viscoElasticSolidFoam/calcInitialState.H | 2 +- .../viscoElasticSolidFoam/viscoElasticSolidFoam.C | 2 +- 18 files changed, 19 insertions(+), 19 deletions(-) diff --git a/applications/solvers/solidMechanics/elasticAcpSolidFoam/elasticAcpSolidFoam.C b/applications/solvers/solidMechanics/elasticAcpSolidFoam/elasticAcpSolidFoam.C index 513a5bb1f..f70c5c16a 100644 --- a/applications/solvers/solidMechanics/elasticAcpSolidFoam/elasticAcpSolidFoam.C +++ b/applications/solvers/solidMechanics/elasticAcpSolidFoam/elasticAcpSolidFoam.C @@ -102,7 +102,7 @@ int main(int argc, char *argv[]) //# include "waveCourantNo.H" int iCorr = 0; - lduMatrix::solverPerformance solverPerf; + lduSolverPerformance solverPerf; scalar initialResidual = 0; scalar relativeResidual = 1; //scalar forceResidual = 1; diff --git a/applications/solvers/solidMechanics/elasticIncrAcpSolidFoam/elasticIncrAcpSolidFoam.C b/applications/solvers/solidMechanics/elasticIncrAcpSolidFoam/elasticIncrAcpSolidFoam.C index 0ab81dd0b..aa46e5eb9 100644 --- a/applications/solvers/solidMechanics/elasticIncrAcpSolidFoam/elasticIncrAcpSolidFoam.C +++ b/applications/solvers/solidMechanics/elasticIncrAcpSolidFoam/elasticIncrAcpSolidFoam.C @@ -86,7 +86,7 @@ int main(int argc, char *argv[]) //# include "waveCourantNo.H" int iCorr = 0; - lduMatrix::solverPerformance solverPerf; + lduSolverPerformance solverPerf; scalar initialResidual = 0; scalar relativeResidual = 1; //scalar forceResidual = 1; diff --git a/applications/solvers/solidMechanics/elasticIncrSolidFoam/elasticIncrSolidFoam.C b/applications/solvers/solidMechanics/elasticIncrSolidFoam/elasticIncrSolidFoam.C index 47ead7d6c..675fa9b6d 100644 --- a/applications/solvers/solidMechanics/elasticIncrSolidFoam/elasticIncrSolidFoam.C +++ b/applications/solvers/solidMechanics/elasticIncrSolidFoam/elasticIncrSolidFoam.C @@ -70,7 +70,7 @@ int main(int argc, char *argv[]) int iCorr = 0; scalar initialResidual = 0; scalar relativeResidual = 1.0; - lduMatrix::solverPerformance solverPerf; + lduSolverPerformance solverPerf; lduMatrix::debug = 0; do diff --git a/applications/solvers/solidMechanics/elasticNonLinIncrTLSolidFoam/elasticNonLinIncrTLSolidFoam.C b/applications/solvers/solidMechanics/elasticNonLinIncrTLSolidFoam/elasticNonLinIncrTLSolidFoam.C index 7b59c9a2e..7cf29be10 100644 --- a/applications/solvers/solidMechanics/elasticNonLinIncrTLSolidFoam/elasticNonLinIncrTLSolidFoam.C +++ b/applications/solvers/solidMechanics/elasticNonLinIncrTLSolidFoam/elasticNonLinIncrTLSolidFoam.C @@ -60,7 +60,7 @@ int main(int argc, char *argv[]) int iCorr = 0; scalar initialResidual = 0; - lduMatrix::solverPerformance solverPerf; + lduSolverPerformance solverPerf; scalar relativeResidual = 1.0; lduMatrix::debug=0; diff --git a/applications/solvers/solidMechanics/elasticNonLinTLSolidFoam/elasticNonLinTLSolidFoam.C b/applications/solvers/solidMechanics/elasticNonLinTLSolidFoam/elasticNonLinTLSolidFoam.C index 57f30e0d5..02a6c6390 100644 --- a/applications/solvers/solidMechanics/elasticNonLinTLSolidFoam/elasticNonLinTLSolidFoam.C +++ b/applications/solvers/solidMechanics/elasticNonLinTLSolidFoam/elasticNonLinTLSolidFoam.C @@ -62,7 +62,7 @@ int main(int argc, char *argv[]) int iCorr = 0; scalar initialResidual = 0; - lduMatrix::solverPerformance solverPerf; + lduSolverPerformance solverPerf; scalar relativeResidual = 1.0; lduMatrix::debug = 0; diff --git a/applications/solvers/solidMechanics/elasticNonLinULSolidFoam/elasticNonLinULSolidFoam.C b/applications/solvers/solidMechanics/elasticNonLinULSolidFoam/elasticNonLinULSolidFoam.C index 4852c9a3e..0d9be49d6 100644 --- a/applications/solvers/solidMechanics/elasticNonLinULSolidFoam/elasticNonLinULSolidFoam.C +++ b/applications/solvers/solidMechanics/elasticNonLinULSolidFoam/elasticNonLinULSolidFoam.C @@ -73,7 +73,7 @@ int main(int argc, char *argv[]) # include "readSolidMechanicsControls.H" int iCorr = 0; - lduMatrix::solverPerformance solverPerf; + lduSolverPerformance solverPerf; scalar initialResidual = 1.0; scalar relativeResidual = 1.0; lduMatrix::debug = 0; diff --git a/applications/solvers/solidMechanics/elasticOrthoAcpSolidFoam/elasticOrthoAcpSolidFoam.C b/applications/solvers/solidMechanics/elasticOrthoAcpSolidFoam/elasticOrthoAcpSolidFoam.C index 8ed7f0d9e..52503310f 100644 --- a/applications/solvers/solidMechanics/elasticOrthoAcpSolidFoam/elasticOrthoAcpSolidFoam.C +++ b/applications/solvers/solidMechanics/elasticOrthoAcpSolidFoam/elasticOrthoAcpSolidFoam.C @@ -103,7 +103,7 @@ int main(int argc, char *argv[]) //# include "waveCourantNo.H" int iCorr = 0; - lduMatrix::solverPerformance solverPerf; + lduSolverPerformance solverPerf; scalar initialResidual = 0; scalar relativeResidual = 1; //scalar forceResidual = 1; diff --git a/applications/solvers/solidMechanics/elasticOrthoNonLinULSolidFoam/elasticOrthoNonLinULSolidFoam.C b/applications/solvers/solidMechanics/elasticOrthoNonLinULSolidFoam/elasticOrthoNonLinULSolidFoam.C index 45ab55e53..f320b4fe9 100644 --- a/applications/solvers/solidMechanics/elasticOrthoNonLinULSolidFoam/elasticOrthoNonLinULSolidFoam.C +++ b/applications/solvers/solidMechanics/elasticOrthoNonLinULSolidFoam/elasticOrthoNonLinULSolidFoam.C @@ -78,7 +78,7 @@ int main(int argc, char *argv[]) # include "readSolidMechanicsControls.H" int iCorr = 0; - lduMatrix::solverPerformance solverPerf; + lduSolverPerformance solverPerf; scalar initialResidual = 1.0; lduMatrix::debug = 0; diff --git a/applications/solvers/solidMechanics/elasticOrthoSolidFoam/elasticOrthoSolidFoam.C b/applications/solvers/solidMechanics/elasticOrthoSolidFoam/elasticOrthoSolidFoam.C index a1443ed35..8489a5d23 100644 --- a/applications/solvers/solidMechanics/elasticOrthoSolidFoam/elasticOrthoSolidFoam.C +++ b/applications/solvers/solidMechanics/elasticOrthoSolidFoam/elasticOrthoSolidFoam.C @@ -67,7 +67,7 @@ int main(int argc, char *argv[]) # include "readSolidMechanicsControls.H" int iCorr = 0; - lduMatrix::solverPerformance solverPerf; + lduSolverPerformance solverPerf; scalar initialResidual = 1.0; scalar relativeResidual = 1.0; lduMatrix::debug = 0; diff --git a/applications/solvers/solidMechanics/elasticPlasticNonLinTLSolidFoam/elasticPlasticNonLinTLSolidFoam.C b/applications/solvers/solidMechanics/elasticPlasticNonLinTLSolidFoam/elasticPlasticNonLinTLSolidFoam.C index 6aa3b49f8..884a0035e 100644 --- a/applications/solvers/solidMechanics/elasticPlasticNonLinTLSolidFoam/elasticPlasticNonLinTLSolidFoam.C +++ b/applications/solvers/solidMechanics/elasticPlasticNonLinTLSolidFoam/elasticPlasticNonLinTLSolidFoam.C @@ -64,7 +64,7 @@ int main(int argc, char *argv[]) int iCorr = 0; scalar initialResidual = 0; - lduMatrix::solverPerformance solverPerf; + lduSolverPerformance solverPerf; scalar relativeResidual = GREAT; lduMatrix::debug = 0; diff --git a/applications/solvers/solidMechanics/elasticPlasticNonLinULSolidFoam/elasticPlasticNonLinULSolidFoam.C b/applications/solvers/solidMechanics/elasticPlasticNonLinULSolidFoam/elasticPlasticNonLinULSolidFoam.C index 4679c1dc3..b6d8be603 100644 --- a/applications/solvers/solidMechanics/elasticPlasticNonLinULSolidFoam/elasticPlasticNonLinULSolidFoam.C +++ b/applications/solvers/solidMechanics/elasticPlasticNonLinULSolidFoam/elasticPlasticNonLinULSolidFoam.C @@ -80,7 +80,7 @@ int main(int argc, char *argv[]) # include "readSolidMechanicsControls.H" int iCorr = 0; - lduMatrix::solverPerformance solverPerf; + lduSolverPerformance solverPerf; scalar initialResidual = 0; scalar relativeResidual = 1.0; lduMatrix::debug = 0; diff --git a/applications/solvers/solidMechanics/elasticPlasticSolidFoam/elasticPlasticSolidFoam.C b/applications/solvers/solidMechanics/elasticPlasticSolidFoam/elasticPlasticSolidFoam.C index cda9f25ef..0809ff2e3 100644 --- a/applications/solvers/solidMechanics/elasticPlasticSolidFoam/elasticPlasticSolidFoam.C +++ b/applications/solvers/solidMechanics/elasticPlasticSolidFoam/elasticPlasticSolidFoam.C @@ -65,7 +65,7 @@ int main(int argc, char *argv[]) # include "readSolidMechanicsControls.H" int iCorr = 0; - lduMatrix::solverPerformance solverPerf; + lduSolverPerformance solverPerf; scalar initialResidual = 1.0; scalar relativeResidual = 1.0; scalar plasticResidual = 1.0; diff --git a/applications/solvers/solidMechanics/elasticSolidFoam/elasticSolidFoam.C b/applications/solvers/solidMechanics/elasticSolidFoam/elasticSolidFoam.C index 57a29688d..370d7b0c6 100644 --- a/applications/solvers/solidMechanics/elasticSolidFoam/elasticSolidFoam.C +++ b/applications/solvers/solidMechanics/elasticSolidFoam/elasticSolidFoam.C @@ -69,7 +69,7 @@ int main(int argc, char *argv[]) # include "readSolidMechanicsControls.H" int iCorr = 0; - lduMatrix::solverPerformance solverPerf; + lduSolverPerformance solverPerf; scalar initialResidual = 1.0; scalar relativeResidual = 1.0; // lduMatrix::debug = 0; diff --git a/applications/solvers/solidMechanics/elasticThermalSolidFoam/elasticThermalSolidFoam.C b/applications/solvers/solidMechanics/elasticThermalSolidFoam/elasticThermalSolidFoam.C index 62607cdc2..a49446cb2 100644 --- a/applications/solvers/solidMechanics/elasticThermalSolidFoam/elasticThermalSolidFoam.C +++ b/applications/solvers/solidMechanics/elasticThermalSolidFoam/elasticThermalSolidFoam.C @@ -66,8 +66,8 @@ int main(int argc, char *argv[]) scalar initialResidual = 1.0; scalar relResT = 1.0; scalar relResU = 1.0; - lduMatrix::solverPerformance solverPerfU; - lduMatrix::solverPerformance solverPerfT; + lduSolverPerformance solverPerfU; + lduSolverPerformance solverPerfT; lduMatrix::debug = 0; // solve energy equation for temperature diff --git a/applications/solvers/solidMechanics/icoFsiElasticNonLinULSolidFoam/solveSolidBackward.H b/applications/solvers/solidMechanics/icoFsiElasticNonLinULSolidFoam/solveSolidBackward.H index 7f3e411df..2600fe264 100644 --- a/applications/solvers/solidMechanics/icoFsiElasticNonLinULSolidFoam/solveSolidBackward.H +++ b/applications/solvers/solidMechanics/icoFsiElasticNonLinULSolidFoam/solveSolidBackward.H @@ -2,7 +2,7 @@ # include "readSolidMechanicsControls.H" int iCorr = 0; - lduMatrix::solverPerformance solverPerf; + lduSolverPerformance solverPerf; scalar initialResidual = 0; lduMatrix::debug = 0; diff --git a/applications/solvers/solidMechanics/icoFsiElasticNonLinULSolidFoam/solveSolidEuler.H b/applications/solvers/solidMechanics/icoFsiElasticNonLinULSolidFoam/solveSolidEuler.H index 32fcb0e16..a66fc40da 100644 --- a/applications/solvers/solidMechanics/icoFsiElasticNonLinULSolidFoam/solveSolidEuler.H +++ b/applications/solvers/solidMechanics/icoFsiElasticNonLinULSolidFoam/solveSolidEuler.H @@ -2,7 +2,7 @@ # include "readSolidMechanicsControls.H" int iCorr = 0; - lduMatrix::solverPerformance solverPerf; + lduSolverPerformance solverPerf; scalar initialResidual = 0; lduMatrix::debug = 0; diff --git a/applications/solvers/solidMechanics/viscoElasticSolidFoam/calcInitialState.H b/applications/solvers/solidMechanics/viscoElasticSolidFoam/calcInitialState.H index 07338ae35..cbdf87211 100644 --- a/applications/solvers/solidMechanics/viscoElasticSolidFoam/calcInitialState.H +++ b/applications/solvers/solidMechanics/viscoElasticSolidFoam/calcInitialState.H @@ -11,7 +11,7 @@ Info << "lambda = " << average(lambda.internalField()) << endl; int iCorr = 0; - lduMatrix::solverPerformance solverPerf; + lduSolverPerformance solverPerf; scalar initialResidual = 0; scalar err = GREAT; diff --git a/applications/solvers/solidMechanics/viscoElasticSolidFoam/viscoElasticSolidFoam.C b/applications/solvers/solidMechanics/viscoElasticSolidFoam/viscoElasticSolidFoam.C index b11c3273d..5a302d227 100644 --- a/applications/solvers/solidMechanics/viscoElasticSolidFoam/viscoElasticSolidFoam.C +++ b/applications/solvers/solidMechanics/viscoElasticSolidFoam/viscoElasticSolidFoam.C @@ -73,7 +73,7 @@ int main(int argc, char *argv[]) Info << "average lambda = " << average(lambdaf.internalField()) << endl; int iCorr = 0; - lduMatrix::solverPerformance solverPerf; + lduSolverPerformance solverPerf; scalar initialResidual = 1.0; scalar residual = 1.0; surfaceSymmTensorField DSigmaCorrf = fvc::interpolate(DSigmaCorr); From 406346f1b975758cc94379ef71820562b7c73532 Mon Sep 17 00:00:00 2001 From: Vanja Skuric Date: Sun, 5 Jun 2016 00:58:40 +0200 Subject: [PATCH 3/8] Removed unnecessary fluxRequired from tutorials --- .../compressible/dbnsFoam/forwardStep/system/fvSchemes | 4 ---- .../conjugateHeatedSolid/system/fvSchemes | 7 ------- .../conjugateHeatedSolid/system/solid/fvSchemes | 5 ----- .../liquidFilmFoam/dropsSpreading/system/faSchemes | 5 ----- .../surfactantFoam/planeTransport/system/faSchemes | 5 ----- .../sphereTransport/sphereTransport/system/faSchemes | 5 ----- tutorials/immersedBoundary/pitchingPlate/system/fvSchemes | 5 ----- .../MRFSimpleFoam/mixerGgiMRF/system/fvSchemes | 7 ------- .../bubbleInterTrackFoam/bubble2D_r0.75mm/system/faSchemes | 5 ----- .../interTrackFoam/hydrofoil/system/faSchemes | 4 ---- .../surfaceTracking/interTrackFoam/ramp/system/faSchemes | 4 ---- .../interTrackFoam/sloshing2D/system/faSchemes | 4 ---- .../surfaceTracking/interTrackFoam/tank3D/system/faSchemes | 4 ---- 13 files changed, 64 deletions(-) diff --git a/tutorials/compressible/dbnsFoam/forwardStep/system/fvSchemes b/tutorials/compressible/dbnsFoam/forwardStep/system/fvSchemes index 7508cca8e..6b2b62d55 100644 --- a/tutorials/compressible/dbnsFoam/forwardStep/system/fvSchemes +++ b/tutorials/compressible/dbnsFoam/forwardStep/system/fvSchemes @@ -45,8 +45,4 @@ interpolationSchemes snGradSchemes {} -fluxRequired -{} - - // ************************************************************************* // diff --git a/tutorials/coupled/conjugateHeatSimpleFoam/conjugateHeatedSolid/system/fvSchemes b/tutorials/coupled/conjugateHeatSimpleFoam/conjugateHeatedSolid/system/fvSchemes index 798793df1..63c7e8343 100644 --- a/tutorials/coupled/conjugateHeatSimpleFoam/conjugateHeatedSolid/system/fvSchemes +++ b/tutorials/coupled/conjugateHeatSimpleFoam/conjugateHeatedSolid/system/fvSchemes @@ -52,11 +52,4 @@ snGradSchemes default corrected; } -fluxRequired -{ - default no; - p_rgh; - p; -} - // ************************************************************************* // diff --git a/tutorials/coupled/conjugateHeatSimpleFoam/conjugateHeatedSolid/system/solid/fvSchemes b/tutorials/coupled/conjugateHeatSimpleFoam/conjugateHeatedSolid/system/solid/fvSchemes index 8ae0a8c2d..fa14cec57 100644 --- a/tutorials/coupled/conjugateHeatSimpleFoam/conjugateHeatedSolid/system/solid/fvSchemes +++ b/tutorials/coupled/conjugateHeatSimpleFoam/conjugateHeatedSolid/system/solid/fvSchemes @@ -46,9 +46,4 @@ snGradSchemes default uncorrected; } -fluxRequired -{ - default no; -} - // ************************************************************************* // diff --git a/tutorials/finiteArea/liquidFilmFoam/dropsSpreading/system/faSchemes b/tutorials/finiteArea/liquidFilmFoam/dropsSpreading/system/faSchemes index 89ef64939..2c3012e89 100644 --- a/tutorials/finiteArea/liquidFilmFoam/dropsSpreading/system/faSchemes +++ b/tutorials/finiteArea/liquidFilmFoam/dropsSpreading/system/faSchemes @@ -50,9 +50,4 @@ snGradSchemes default corrected; } -fluxRequired -{ - h; -} - // ************************************************************************* // diff --git a/tutorials/finiteArea/surfactantFoam/planeTransport/system/faSchemes b/tutorials/finiteArea/surfactantFoam/planeTransport/system/faSchemes index 9d0f33946..306ed227e 100644 --- a/tutorials/finiteArea/surfactantFoam/planeTransport/system/faSchemes +++ b/tutorials/finiteArea/surfactantFoam/planeTransport/system/faSchemes @@ -48,9 +48,4 @@ snGradSchemes default corrected; } -fluxRequired -{ - p; -} - // ************************************************************************* // diff --git a/tutorials/finiteArea/surfactantFoam/sphereTransport/sphereTransport/system/faSchemes b/tutorials/finiteArea/surfactantFoam/sphereTransport/sphereTransport/system/faSchemes index 9d0f33946..306ed227e 100644 --- a/tutorials/finiteArea/surfactantFoam/sphereTransport/sphereTransport/system/faSchemes +++ b/tutorials/finiteArea/surfactantFoam/sphereTransport/sphereTransport/system/faSchemes @@ -48,9 +48,4 @@ snGradSchemes default corrected; } -fluxRequired -{ - p; -} - // ************************************************************************* // diff --git a/tutorials/immersedBoundary/pitchingPlate/system/fvSchemes b/tutorials/immersedBoundary/pitchingPlate/system/fvSchemes index 3efa40442..c0aa3b232 100644 --- a/tutorials/immersedBoundary/pitchingPlate/system/fvSchemes +++ b/tutorials/immersedBoundary/pitchingPlate/system/fvSchemes @@ -51,9 +51,4 @@ snGradSchemes default corrected; } -fluxRequired -{ - p; -} - // ************************************************************************* // diff --git a/tutorials/incompressible/MRFSimpleFoam/mixerGgiMRF/system/fvSchemes b/tutorials/incompressible/MRFSimpleFoam/mixerGgiMRF/system/fvSchemes index d5089661b..558c81b27 100644 --- a/tutorials/incompressible/MRFSimpleFoam/mixerGgiMRF/system/fvSchemes +++ b/tutorials/incompressible/MRFSimpleFoam/mixerGgiMRF/system/fvSchemes @@ -50,11 +50,4 @@ snGradSchemes default corrected; } -fluxRequired -{ - default no; - pcorr; - p; -} - // ************************************************************************* // diff --git a/tutorials/surfaceTracking/bubbleInterTrackFoam/bubble2D_r0.75mm/system/faSchemes b/tutorials/surfaceTracking/bubbleInterTrackFoam/bubble2D_r0.75mm/system/faSchemes index fc6758a1c..702b9852d 100644 --- a/tutorials/surfaceTracking/bubbleInterTrackFoam/bubble2D_r0.75mm/system/faSchemes +++ b/tutorials/surfaceTracking/bubbleInterTrackFoam/bubble2D_r0.75mm/system/faSchemes @@ -47,9 +47,4 @@ snGradSchemes default none; } -fluxRequired -{ - p; -} - // ************************************************************************* // diff --git a/tutorials/surfaceTracking/interTrackFoam/hydrofoil/system/faSchemes b/tutorials/surfaceTracking/interTrackFoam/hydrofoil/system/faSchemes index c8ec64df8..58537f01c 100644 --- a/tutorials/surfaceTracking/interTrackFoam/hydrofoil/system/faSchemes +++ b/tutorials/surfaceTracking/interTrackFoam/hydrofoil/system/faSchemes @@ -44,8 +44,4 @@ snGradSchemes { } -fluxRequired -{ -} - // ************************************************************************* // diff --git a/tutorials/surfaceTracking/interTrackFoam/ramp/system/faSchemes b/tutorials/surfaceTracking/interTrackFoam/ramp/system/faSchemes index 6142b59ba..19c1c5a57 100644 --- a/tutorials/surfaceTracking/interTrackFoam/ramp/system/faSchemes +++ b/tutorials/surfaceTracking/interTrackFoam/ramp/system/faSchemes @@ -43,8 +43,4 @@ snGradSchemes { } -fluxRequired -{ -} - // ************************************************************************* // diff --git a/tutorials/surfaceTracking/interTrackFoam/sloshing2D/system/faSchemes b/tutorials/surfaceTracking/interTrackFoam/sloshing2D/system/faSchemes index 4025f8cd5..026337628 100644 --- a/tutorials/surfaceTracking/interTrackFoam/sloshing2D/system/faSchemes +++ b/tutorials/surfaceTracking/interTrackFoam/sloshing2D/system/faSchemes @@ -48,8 +48,4 @@ snGradSchemes default none; } -fluxRequired -{ -} - // ************************************************************************* // diff --git a/tutorials/surfaceTracking/interTrackFoam/tank3D/system/faSchemes b/tutorials/surfaceTracking/interTrackFoam/tank3D/system/faSchemes index 6142b59ba..19c1c5a57 100644 --- a/tutorials/surfaceTracking/interTrackFoam/tank3D/system/faSchemes +++ b/tutorials/surfaceTracking/interTrackFoam/tank3D/system/faSchemes @@ -43,8 +43,4 @@ snGradSchemes { } -fluxRequired -{ -} - // ************************************************************************* // From bc0dc681ad3d02ce0184b18fc438b6d723eeee00 Mon Sep 17 00:00:00 2001 From: Vanja Skuric Date: Sun, 5 Jun 2016 01:28:13 +0200 Subject: [PATCH 4/8] Backported steadyUniversalFoam, steadyUniversalMRFFoam and tutorials (vanilla OF 3.0.1) --- .../compressible/steadyUniversalFoam/UEqn.H | 7 +----- .../steadyUniversalFoam/convergenceCheck.H | 9 ------- .../steadyUniversalFoam/createFields.H | 2 ++ .../compressible/steadyUniversalFoam/hEqn.H | 3 +-- .../initConvergenceCheck.H | 7 ------ .../compressible/steadyUniversalFoam/pEqn.H | 14 ++++------- .../steadyUniversalFoam/steadyUniversalFoam.C | 10 ++++---- .../steadyUniversalMRFFoam/UEqn.H | 7 +----- .../steadyUniversalMRFFoam/convergenceCheck.H | 9 ------- .../steadyUniversalMRFFoam/createFields.H | 2 ++ .../steadyUniversalMRFFoam/iEqn.H | 5 ++-- .../initConvergenceCheck.H | 7 ------ .../steadyUniversalMRFFoam/pEqn.H | 14 ++++------- .../steadyUniversalMRFFoam.C | 10 ++++---- .../axialTurbineGgiJump/system/fvSchemes | 24 ------------------- .../axialTurbineMixingPlane/system/fvSchemes | 6 ----- 16 files changed, 25 insertions(+), 111 deletions(-) delete mode 100644 applications/solvers/compressible/steadyUniversalFoam/convergenceCheck.H delete mode 100644 applications/solvers/compressible/steadyUniversalFoam/initConvergenceCheck.H delete mode 100644 applications/solvers/compressible/steadyUniversalMRFFoam/convergenceCheck.H delete mode 100644 applications/solvers/compressible/steadyUniversalMRFFoam/initConvergenceCheck.H diff --git a/applications/solvers/compressible/steadyUniversalFoam/UEqn.H b/applications/solvers/compressible/steadyUniversalFoam/UEqn.H index 4e2e22af0..204c349fb 100644 --- a/applications/solvers/compressible/steadyUniversalFoam/UEqn.H +++ b/applications/solvers/compressible/steadyUniversalFoam/UEqn.H @@ -10,9 +10,4 @@ UEqn.relax(); - eqnResidual = solve - ( - UEqn == -fvc::grad(p) - ).initialResidual(); - - maxResidual = max(eqnResidual, maxResidual); + solve(UEqn == -fvc::grad(p)); diff --git a/applications/solvers/compressible/steadyUniversalFoam/convergenceCheck.H b/applications/solvers/compressible/steadyUniversalFoam/convergenceCheck.H deleted file mode 100644 index 895806319..000000000 --- a/applications/solvers/compressible/steadyUniversalFoam/convergenceCheck.H +++ /dev/null @@ -1,9 +0,0 @@ -// check convergence - -if (maxResidual < convergenceCriterion) -{ - Info<< "reached convergence criterion: " << convergenceCriterion << endl; - runTime.writeAndEnd(); - Info<< "latestTime = " << runTime.timeName() << endl; -} - diff --git a/applications/solvers/compressible/steadyUniversalFoam/createFields.H b/applications/solvers/compressible/steadyUniversalFoam/createFields.H index fed1a01c7..5bc4417ad 100644 --- a/applications/solvers/compressible/steadyUniversalFoam/createFields.H +++ b/applications/solvers/compressible/steadyUniversalFoam/createFields.H @@ -39,3 +39,5 @@ thermo ) ); + + mesh.schemesDict().setFluxRequired(p.name()); diff --git a/applications/solvers/compressible/steadyUniversalFoam/hEqn.H b/applications/solvers/compressible/steadyUniversalFoam/hEqn.H index c379926a8..0a5c1e1db 100644 --- a/applications/solvers/compressible/steadyUniversalFoam/hEqn.H +++ b/applications/solvers/compressible/steadyUniversalFoam/hEqn.H @@ -23,8 +23,7 @@ hEqn.relax(); - eqnResidual = hEqn.solve().initialResidual(); - maxResidual = max(eqnResidual, maxResidual); + hEqn.solve(); // Bounding of enthalpy taken out thermo.correct(); diff --git a/applications/solvers/compressible/steadyUniversalFoam/initConvergenceCheck.H b/applications/solvers/compressible/steadyUniversalFoam/initConvergenceCheck.H deleted file mode 100644 index 47a1852f0..000000000 --- a/applications/solvers/compressible/steadyUniversalFoam/initConvergenceCheck.H +++ /dev/null @@ -1,7 +0,0 @@ -// initialize values for convergence checks - - scalar eqnResidual = 1, maxResidual = 0; - scalar convergenceCriterion = 0; - - pimple.readIfPresent("convergence", convergenceCriterion); - diff --git a/applications/solvers/compressible/steadyUniversalFoam/pEqn.H b/applications/solvers/compressible/steadyUniversalFoam/pEqn.H index 636de243d..8eec3318e 100644 --- a/applications/solvers/compressible/steadyUniversalFoam/pEqn.H +++ b/applications/solvers/compressible/steadyUniversalFoam/pEqn.H @@ -7,7 +7,7 @@ // Needs to be outside of loop since p is changing, but psi and rho are not surfaceScalarField rhoReff = rhof - psisf*fvc::interpolate(p); - for (int corr = 0; corr < nCorr; corr++) + while (pimple.correct()) { U = rUA*UEqn.H(); @@ -20,7 +20,7 @@ p.storePrevIter(); - for (int nonOrth = 0; nonOrth <= nNonOrthCorr; nonOrth++) + while (pimple.correctNonOrthogonal()) { fvScalarMatrix pEqn ( @@ -30,16 +30,10 @@ - fvm::laplacian(rho*rUA, p) ); - // Retain the residual from the first pressure solution - eqnResidual = pEqn.solve().initialResidual(); - - if (corr == 0 && nonOrth == 0) - { - maxResidual = max(eqnResidual, maxResidual); - } + pEqn.solve(); // Calculate the flux - if (nonOrth == nNonOrthCorr) + if (pimple.finalNonOrthogonalIter()) { phi = phid2 + pEqn.flux(); } diff --git a/applications/solvers/compressible/steadyUniversalFoam/steadyUniversalFoam.C b/applications/solvers/compressible/steadyUniversalFoam/steadyUniversalFoam.C index 42fab40e4..633440a2c 100644 --- a/applications/solvers/compressible/steadyUniversalFoam/steadyUniversalFoam.C +++ b/applications/solvers/compressible/steadyUniversalFoam/steadyUniversalFoam.C @@ -36,6 +36,7 @@ Author #include "basicPsiThermo.H" #include "basicRhoThermo.H" #include "RASModel.H" +#include "pimpleControl.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -46,9 +47,11 @@ int main(int argc, char *argv[]) # include "createTime.H" # include "createMesh.H" + + pimpleControl pimple(mesh); + # include "createThermo.H" # include "createFields.H" -# include "readPIMPLEControls.H" # include "initContinuityErrs.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -59,11 +62,8 @@ int main(int argc, char *argv[]) { Info<< "Time = " << runTime.timeName() << nl << endl; -# include "readPIMPLEControls.H" # include "readFieldBounds.H" -# include "initConvergenceCheck.H" - # include "UEqn.H" # include "pEqn.H" @@ -79,8 +79,6 @@ int main(int argc, char *argv[]) Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" << " ClockTime = " << runTime.elapsedClockTime() << " s" << nl << endl; - -# include "convergenceCheck.H" } # include "clearThermo.H" diff --git a/applications/solvers/compressible/steadyUniversalMRFFoam/UEqn.H b/applications/solvers/compressible/steadyUniversalMRFFoam/UEqn.H index 1c39c948b..f1c57b01d 100644 --- a/applications/solvers/compressible/steadyUniversalMRFFoam/UEqn.H +++ b/applications/solvers/compressible/steadyUniversalMRFFoam/UEqn.H @@ -13,9 +13,4 @@ UEqn.relax(); - eqnResidual = solve - ( - UEqn == -fvc::grad(p) - ).initialResidual(); - - maxResidual = max(eqnResidual, maxResidual); + solve(UEqn == -fvc::grad(p)); diff --git a/applications/solvers/compressible/steadyUniversalMRFFoam/convergenceCheck.H b/applications/solvers/compressible/steadyUniversalMRFFoam/convergenceCheck.H deleted file mode 100644 index 895806319..000000000 --- a/applications/solvers/compressible/steadyUniversalMRFFoam/convergenceCheck.H +++ /dev/null @@ -1,9 +0,0 @@ -// check convergence - -if (maxResidual < convergenceCriterion) -{ - Info<< "reached convergence criterion: " << convergenceCriterion << endl; - runTime.writeAndEnd(); - Info<< "latestTime = " << runTime.timeName() << endl; -} - diff --git a/applications/solvers/compressible/steadyUniversalMRFFoam/createFields.H b/applications/solvers/compressible/steadyUniversalMRFFoam/createFields.H index 5a432a884..42753a251 100644 --- a/applications/solvers/compressible/steadyUniversalMRFFoam/createFields.H +++ b/applications/solvers/compressible/steadyUniversalMRFFoam/createFields.H @@ -80,3 +80,5 @@ mesh ); i == h - 0.5*(magSqr(Urot) - magSqr(Urel)); + + mesh.schemesDict().setFluxRequired(p.name()); diff --git a/applications/solvers/compressible/steadyUniversalMRFFoam/iEqn.H b/applications/solvers/compressible/steadyUniversalMRFFoam/iEqn.H index 861099c75..5a59595f4 100644 --- a/applications/solvers/compressible/steadyUniversalMRFFoam/iEqn.H +++ b/applications/solvers/compressible/steadyUniversalMRFFoam/iEqn.H @@ -7,7 +7,7 @@ Urot == U - Urel; fvScalarMatrix iEqn - ( + ( fvm::ddt(rho, i) + fvm::div(phi, i) - fvm::laplacian(turbulence->alphaEff(), i) @@ -18,8 +18,7 @@ iEqn.relax(); - eqnResidual = iEqn.solve().initialResidual(); - maxResidual = max(eqnResidual, maxResidual); + iEqn.solve(); // From rothalpy, calculate enthalpy after solution of rothalpy equation h = i + 0.5*(magSqr(Urot) - magSqr(Urel)); diff --git a/applications/solvers/compressible/steadyUniversalMRFFoam/initConvergenceCheck.H b/applications/solvers/compressible/steadyUniversalMRFFoam/initConvergenceCheck.H deleted file mode 100644 index 47a1852f0..000000000 --- a/applications/solvers/compressible/steadyUniversalMRFFoam/initConvergenceCheck.H +++ /dev/null @@ -1,7 +0,0 @@ -// initialize values for convergence checks - - scalar eqnResidual = 1, maxResidual = 0; - scalar convergenceCriterion = 0; - - pimple.readIfPresent("convergence", convergenceCriterion); - diff --git a/applications/solvers/compressible/steadyUniversalMRFFoam/pEqn.H b/applications/solvers/compressible/steadyUniversalMRFFoam/pEqn.H index 636de243d..8eec3318e 100644 --- a/applications/solvers/compressible/steadyUniversalMRFFoam/pEqn.H +++ b/applications/solvers/compressible/steadyUniversalMRFFoam/pEqn.H @@ -7,7 +7,7 @@ // Needs to be outside of loop since p is changing, but psi and rho are not surfaceScalarField rhoReff = rhof - psisf*fvc::interpolate(p); - for (int corr = 0; corr < nCorr; corr++) + while (pimple.correct()) { U = rUA*UEqn.H(); @@ -20,7 +20,7 @@ p.storePrevIter(); - for (int nonOrth = 0; nonOrth <= nNonOrthCorr; nonOrth++) + while (pimple.correctNonOrthogonal()) { fvScalarMatrix pEqn ( @@ -30,16 +30,10 @@ - fvm::laplacian(rho*rUA, p) ); - // Retain the residual from the first pressure solution - eqnResidual = pEqn.solve().initialResidual(); - - if (corr == 0 && nonOrth == 0) - { - maxResidual = max(eqnResidual, maxResidual); - } + pEqn.solve(); // Calculate the flux - if (nonOrth == nNonOrthCorr) + if (pimple.finalNonOrthogonalIter()) { phi = phid2 + pEqn.flux(); } diff --git a/applications/solvers/compressible/steadyUniversalMRFFoam/steadyUniversalMRFFoam.C b/applications/solvers/compressible/steadyUniversalMRFFoam/steadyUniversalMRFFoam.C index 757afc5ee..cbfecbeeb 100644 --- a/applications/solvers/compressible/steadyUniversalMRFFoam/steadyUniversalMRFFoam.C +++ b/applications/solvers/compressible/steadyUniversalMRFFoam/steadyUniversalMRFFoam.C @@ -43,6 +43,7 @@ GE CONFIDENTIAL INFORMATION 2016 General Electric Company. All Rights Reserved #include "basicRhoThermo.H" #include "RASModel.H" #include "MRFZones.H" +#include "pimpleControl.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -53,9 +54,11 @@ int main(int argc, char *argv[]) # include "createTime.H" # include "createMesh.H" + + pimpleControl pimple(mesh); + # include "createThermo.H" # include "createFields.H" -# include "readPIMPLEControls.H" # include "initContinuityErrs.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -66,11 +69,8 @@ int main(int argc, char *argv[]) { Info<< "Time = " << runTime.timeName() << nl << endl; -# include "readPIMPLEControls.H" # include "readFieldBounds.H" -# include "initConvergenceCheck.H" - # include "UEqn.H" # include "pEqn.H" @@ -86,8 +86,6 @@ int main(int argc, char *argv[]) Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" << " ClockTime = " << runTime.elapsedClockTime() << " s" << nl << endl; - -# include "convergenceCheck.H" } # include "clearThermo.H" diff --git a/tutorials/compressible/steadyUniversalMRFFoam/axialTurbineGgiJump/system/fvSchemes b/tutorials/compressible/steadyUniversalMRFFoam/axialTurbineGgiJump/system/fvSchemes index f2a536827..ea3d83e12 100755 --- a/tutorials/compressible/steadyUniversalMRFFoam/axialTurbineGgiJump/system/fvSchemes +++ b/tutorials/compressible/steadyUniversalMRFFoam/axialTurbineGgiJump/system/fvSchemes @@ -72,12 +72,6 @@ snGradSchemes default limited 0.5; } -fluxRequired -{ - default no; - p; -} - mixingPlane { default areaAveraging; @@ -86,22 +80,4 @@ mixingPlane omega areaAveraging; } - - - - - - - - - - - - - - - - - - // ************************************************************************* // diff --git a/tutorials/compressible/steadyUniversalMRFFoam/axialTurbineMixingPlane/system/fvSchemes b/tutorials/compressible/steadyUniversalMRFFoam/axialTurbineMixingPlane/system/fvSchemes index 268ba8029..49b4c21d3 100644 --- a/tutorials/compressible/steadyUniversalMRFFoam/axialTurbineMixingPlane/system/fvSchemes +++ b/tutorials/compressible/steadyUniversalMRFFoam/axialTurbineMixingPlane/system/fvSchemes @@ -72,12 +72,6 @@ snGradSchemes default limited 0.5; } -fluxRequired -{ - default no; - p; -} - mixingPlane { default areaAveraging; From c5dfd0efb6511495b41db6d881c5ddeece93caee Mon Sep 17 00:00:00 2001 From: Vanja Skuric Date: Sun, 5 Jun 2016 01:40:44 +0200 Subject: [PATCH 5/8] Fixed faMeshDecomposition for globalFaceZone faces; added fam::laplacian with specified name --- .../decomposePar/faMeshDecomposition.C | 98 +++++++++++++++---- src/finiteArea/finiteArea/fam/famLaplacian.C | 34 +++++++ src/finiteArea/finiteArea/fam/famLaplacian.H | 17 ++++ 3 files changed, 130 insertions(+), 19 deletions(-) diff --git a/applications/utilities/parallelProcessing/decomposePar/faMeshDecomposition.C b/applications/utilities/parallelProcessing/decomposePar/faMeshDecomposition.C index e198573c1..36d7ed30b 100644 --- a/applications/utilities/parallelProcessing/decomposePar/faMeshDecomposition.C +++ b/applications/utilities/parallelProcessing/decomposePar/faMeshDecomposition.C @@ -61,27 +61,87 @@ void faMeshDecomposition::distributeFaces() ) ); - labelHashSet faceProcAddressingHash - ( - labelIOList - ( - IOobject - ( - "faceProcAddressing", - "constant", - procMesh.meshSubDir, - procMesh, - IOobject::MUST_READ, - IOobject::NO_WRITE - ) - ) - ); - - forAll (faceLabels(), faceI) + // If faMesh's fvPatch is a part of the global face zones, faces of that + // patch will be present on all processors. Because of that, looping + // through faceProcAddressing will decompose global faMesh faces to the + // very last processor regardless of where fvPatch is really decomposed. + // Since global faces which do not belong to specific processor are + // located at the end of the faceProcAddressing, cutting it at + // i = owner.size() will correctly decompose faMesh faces. + // Vanja Skuric, 2016-04-21 + if (decompositionDict_.found("globalFaceZones")) { - if (faceProcAddressingHash.found(faceLabels()[faceI] + 1)) + labelList faceProcAddressing + ( + labelIOList + ( + IOobject + ( + "faceProcAddressing", + "constant", + procMesh.meshSubDir, + procMesh, + IOobject::MUST_READ, + IOobject::NO_WRITE + ) + ) + ); + + const label ownerSize = + ( + labelIOList + ( + IOobject + ( + "owner", + "constant", + procMesh.meshSubDir, + procMesh, + IOobject::MUST_READ, + IOobject::NO_WRITE + ) + ) + ).size(); + + labelHashSet faceProcAddressingHash(ownerSize); + + for (int i = 0; i < ownerSize; ++i) { - faceToProc_[faceI] = procI; + faceProcAddressingHash.insert(faceProcAddressing[i]); + } + + forAll (faceLabels(), faceI) + { + if (faceProcAddressingHash.found(faceLabels()[faceI] + 1)) + { + faceToProc_[faceI] = procI; + } + } + } + else + { + labelHashSet faceProcAddressingHash + ( + labelIOList + ( + IOobject + ( + "faceProcAddressing", + "constant", + procMesh.meshSubDir, + procMesh, + IOobject::MUST_READ, + IOobject::NO_WRITE + ) + ) + ); + + forAll (faceLabels(), faceI) + { + if (faceProcAddressingHash.found(faceLabels()[faceI] + 1)) + { + faceToProc_[faceI] = procI; + } } } } diff --git a/src/finiteArea/finiteArea/fam/famLaplacian.C b/src/finiteArea/finiteArea/fam/famLaplacian.C index 05fddf196..b7c6f982d 100644 --- a/src/finiteArea/finiteArea/fam/famLaplacian.C +++ b/src/finiteArea/finiteArea/fam/famLaplacian.C @@ -329,6 +329,40 @@ laplacian } +template +tmp > +laplacian +( + const edgeTensorField& gamma, + const GeometricField& vf, + const word& name +) +{ + const faMesh& mesh = vf.mesh(); + + return fam::laplacian + ( + (mesh.Le() & gamma & mesh.Le())/sqr(mesh.magLe()), + vf, + name + ); +} + +template +tmp > +laplacian +( + const tmp& tgamma, + const GeometricField& vf, + const word& name +) +{ + tmp > Laplacian = fam::laplacian(tgamma(), vf, name); + tgamma.clear(); + return Laplacian; +} + + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace fam diff --git a/src/finiteArea/finiteArea/fam/famLaplacian.H b/src/finiteArea/finiteArea/fam/famLaplacian.H index 4eb78e09f..a719ce09a 100644 --- a/src/finiteArea/finiteArea/fam/famLaplacian.H +++ b/src/finiteArea/finiteArea/fam/famLaplacian.H @@ -180,6 +180,23 @@ namespace fam const tmp&, const GeometricField& ); + + + template + tmp > laplacian + ( + const edgeTensorField&, + const GeometricField&, + const word& name + ); + + template + tmp > laplacian + ( + const tmp&, + const GeometricField&, + const word& name + ); } From d73e93637f605d5ba680f104d199f92a8cecfdb3 Mon Sep 17 00:00:00 2001 From: Henrik Rusche Date: Sun, 5 Jun 2016 20:46:41 +0200 Subject: [PATCH 6/8] FEAT: fluxRequired rolled out into FA --- .../liquidFilmFoam/createFaFields.H | 2 + .../finiteArea/faSchemes/faSchemes.C | 357 ++++++++++++------ .../finiteArea/faSchemes/faSchemes.H | 14 +- .../finiteVolume/fvSchemes/fvSchemes.C | 31 +- .../finiteVolume/fvSchemes/fvSchemes.H | 8 +- .../liquidFilmFoam/cylinder/system/faSchemes | 5 - .../dropsSpreading/system/faSchemes | 1 + 7 files changed, 302 insertions(+), 116 deletions(-) diff --git a/applications/solvers/finiteArea/liquidFilmFoam/createFaFields.H b/applications/solvers/finiteArea/liquidFilmFoam/createFaFields.H index 5ade57175..6aaf31acd 100644 --- a/applications/solvers/finiteArea/liquidFilmFoam/createFaFields.H +++ b/applications/solvers/finiteArea/liquidFilmFoam/createFaFields.H @@ -154,3 +154,5 @@ aMesh, dimensionedScalar("one", dimless, 0.01) ); + + aMesh.schemesDict().setFluxRequired("h"); diff --git a/src/finiteArea/finiteArea/faSchemes/faSchemes.C b/src/finiteArea/finiteArea/faSchemes/faSchemes.C index 12e81e0df..82268dd53 100644 --- a/src/finiteArea/finiteArea/faSchemes/faSchemes.C +++ b/src/finiteArea/finiteArea/faSchemes/faSchemes.C @@ -21,31 +21,45 @@ License You should have received a copy of the GNU General Public License along with foam-extend. If not, see . -Description - \*---------------------------------------------------------------------------*/ -#include "error.H" -#include "objectRegistry.H" -#include "foamTime.H" #include "faSchemes.H" +#include "objectRegistry.H" -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // Foam::debug::debugSwitch -faSchemes::debug +Foam::faSchemes::debug ( "faSchemes", false ); +// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * // + +void Foam::faSchemes::clear() +{ + ddtSchemes_.clear(); + defaultDdtScheme_.clear(); + d2dt2Schemes_.clear(); + defaultD2dt2Scheme_.clear(); + interpolationSchemes_.clear(); + defaultInterpolationScheme_.clear(); + divSchemes_.clear(); // optional + defaultDivScheme_.clear(); + gradSchemes_.clear(); // optional + defaultGradScheme_.clear(); + lnGradSchemes_.clear(); + defaultLnGradScheme_.clear(); + laplacianSchemes_.clear(); // optional + defaultLaplacianScheme_.clear(); + fluxRequired_.clear(); + defaultFluxRequired_ = false; +} // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -faSchemes::faSchemes(const objectRegistry& obr) +Foam::faSchemes::faSchemes(const objectRegistry& obr) : IOdictionary ( @@ -59,21 +73,106 @@ faSchemes::faSchemes(const objectRegistry& obr) IOobject::NO_WRITE ) ), - ddtSchemes_(ITstream("ddtSchemes", tokenList())()), - defaultDdtScheme_("default", tokenList()), - d2dt2Schemes_(ITstream("d2dt2Schemes", tokenList())()), - defaultD2dt2Scheme_("default", tokenList()), - interpolationSchemes_(ITstream("interpolationSchemes", tokenList())()), - defaultInterpolationScheme_("default", tokenList()), - divSchemes_(ITstream("divSchemes", tokenList())()), - defaultDivScheme_("default", tokenList()), - gradSchemes_(ITstream("gradSchemes", tokenList())()), - defaultGradScheme_("default", tokenList()), - lnGradSchemes_(ITstream("lnGradSchemes", tokenList())()), - defaultLnGradScheme_("default", tokenList()), - laplacianSchemes_(ITstream("laplacianSchemes", tokenList())()), - defaultLaplacianScheme_("default", tokenList()), - fluxRequired_(ITstream("fluxRequired", tokenList())()) + ddtSchemes_ + ( + ITstream + ( + objectPath() + "::ddtSchemes", + tokenList() + )() + ), + defaultDdtScheme_ + ( + ddtSchemes_.name() + "::default", + tokenList() + ), + d2dt2Schemes_ + ( + ITstream + ( + objectPath() + "::d2dt2Schemes", + tokenList() + )() + ), + defaultD2dt2Scheme_ + ( + d2dt2Schemes_.name() + "::default", + tokenList() + ), + interpolationSchemes_ + ( + ITstream + ( + objectPath() + "::interpolationSchemes", + tokenList() + )() + ), + defaultInterpolationScheme_ + ( + interpolationSchemes_.name() + "::default", + tokenList() + ), + divSchemes_ + ( + ITstream + ( + objectPath() + "::divSchemes", + tokenList() + )() + ), + defaultDivScheme_ + ( + divSchemes_.name() + "::default", + tokenList() + ), + gradSchemes_ + ( + ITstream + ( + objectPath() + "::gradSchemes", + tokenList() + )() + ), + defaultGradScheme_ + ( + gradSchemes_.name() + "::default", + tokenList() + ), + lnGradSchemes_ + ( + ITstream + ( + objectPath() + "::snGradSchemes", + tokenList() + )() + ), + defaultLnGradScheme_ + ( + lnGradSchemes_.name() + "::default", + tokenList() + ), + laplacianSchemes_ + ( + ITstream + ( + objectPath() + "::laplacianSchemes", + tokenList() + )() + ), + defaultLaplacianScheme_ + ( + laplacianSchemes_.name() + "::default", + tokenList() + ), + fluxRequired_ + ( + ITstream + ( + objectPath() + "::fluxRequired", + tokenList() + )() + ), + defaultFluxRequired_(false) { if (!headerOk()) { @@ -85,6 +184,8 @@ faSchemes::faSchemes(const objectRegistry& obr) ) << "faSchemes dictionary not found. Creating default." << endl; } + + regIOobject::write(); } read(); @@ -93,27 +194,58 @@ faSchemes::faSchemes(const objectRegistry& obr) // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -bool faSchemes::read() +bool Foam::faSchemes::read() { - bool readOk = false; - - if (headerOk()) - { - readOk = regIOobject::read(); - } - - if (readOk) + if (regIOobject::read()) { const dictionary& dict = schemesDict(); - // ddt Schemes + // persistent settings across reads is incorrect + clear(); + if (dict.found("ddtSchemes")) { ddtSchemes_ = dict.subDict("ddtSchemes"); } + else if (dict.found("timeScheme")) + { + // For backward compatibility. + // The timeScheme will be deprecated with warning or removed + WarningIn("fvSchemes::read()") + << "Using deprecated 'timeScheme' instead of 'ddtSchemes'" + << nl << endl; + + word schemeName(dict.lookup("timeScheme")); + + if (schemeName == "EulerImplicit") + { + schemeName = "Euler"; + } + else if (schemeName == "BackwardDifferencing") + { + schemeName = "backward"; + } + else if (schemeName == "SteadyState") + { + schemeName = "steadyState"; + } + else + { + FatalIOErrorIn("fvSchemes::read()", dict.lookup("timeScheme")) + << "\n Only EulerImplicit, BackwardDifferencing and " + "SteadyState\n are supported by the old timeScheme " + "specification.\n Please use ddtSchemes instead." + << exit(FatalIOError); + } + + ddtSchemes_.set("default", schemeName); + + ddtSchemes_.lookup("default")[0].lineNumber() = + dict.lookup("timeScheme").lineNumber(); + } else { - ddtSchemes_.add("default", "none"); + ddtSchemes_.set("default", "none"); } if @@ -126,7 +258,6 @@ bool faSchemes::read() } - // d2dt2 schemes if (dict.found("d2dt2Schemes")) { d2dt2Schemes_ = dict.subDict("d2dt2Schemes"); @@ -134,29 +265,30 @@ bool faSchemes::read() else if (dict.found("timeScheme")) { // For backward compatibility. - // The timeScheme will be deprecated with warning or removed in 2.4. + // The timeScheme will be deprecated with warning or removed + WarningIn("fvSchemes::read()") + << "Using deprecated 'timeScheme' instead of 'd2dt2Schemes'" + << nl << endl; - word timeSchemeName(dict.lookup("timeScheme")); + word schemeName(dict.lookup("timeScheme")); - if (timeSchemeName == "EulerImplicit") + if (schemeName == "EulerImplicit") { - timeSchemeName = "Euler"; + schemeName = "Euler"; } - else if (timeSchemeName == "SteadyState") + else if (schemeName == "SteadyState") { - timeSchemeName = "steadyState"; + schemeName = "steadyState"; } - if (d2dt2Schemes_.found("default")) - { - d2dt2Schemes_.remove("default"); - } + d2dt2Schemes_.set("default", schemeName); - d2dt2Schemes_.add("default", timeSchemeName); + d2dt2Schemes_.lookup("default")[0].lineNumber() = + dict.lookup("timeScheme").lineNumber(); } else { - d2dt2Schemes_.add("default", "none"); + d2dt2Schemes_.set("default", "none"); } if @@ -169,7 +301,6 @@ bool faSchemes::read() } - // Interpolation schemes if (dict.found("interpolationSchemes")) { interpolationSchemes_ = dict.subDict("interpolationSchemes"); @@ -190,15 +321,9 @@ bool faSchemes::read() } - // Div schemes if (dict.found("divSchemes")) { divSchemes_ = dict.subDict("divSchemes"); - - } - else - { - divSchemes_.add("default", "none"); } if @@ -210,16 +335,9 @@ bool faSchemes::read() defaultDivScheme_ = divSchemes_.lookup("default"); } - - // Grad schemes if (dict.found("gradSchemes")) { gradSchemes_ = dict.subDict("gradSchemes"); - - } - else - { - gradSchemes_.add("default", "none"); } if @@ -232,12 +350,11 @@ bool faSchemes::read() } - // lnGrad schemes if (dict.found("lnGradSchemes")) { lnGradSchemes_ = dict.subDict("lnGradSchemes"); } - else + else if (!lnGradSchemes_.found("default")) { lnGradSchemes_.add("default", "corrected"); } @@ -252,15 +369,9 @@ bool faSchemes::read() } - // laplacian schemes if (dict.found("laplacianSchemes")) { laplacianSchemes_ = dict.subDict("laplacianSchemes"); - - } - else - { - laplacianSchemes_.add("default", "none"); } if @@ -273,18 +384,30 @@ bool faSchemes::read() } - // Flux required if (dict.found("fluxRequired")) { fluxRequired_ = dict.subDict("fluxRequired"); - } - } - return readOk; + if + ( + fluxRequired_.found("default") + && word(fluxRequired_.lookup("default")) != "none" + ) + { + defaultFluxRequired_ = Switch(fluxRequired_.lookup("default")); + } + } + + return true; + } + else + { + return false; + } } -const dictionary& faSchemes::schemesDict() const +const Foam::dictionary& Foam::faSchemes::schemesDict() const { if (found("select")) { @@ -297,18 +420,14 @@ const dictionary& faSchemes::schemesDict() const } -ITstream& faSchemes::ddtScheme(const word& name) const +Foam::ITstream& Foam::faSchemes::ddtScheme(const word& name) const { if (debug) { Info<< "Lookup ddtScheme for " << name << endl; } - if - ( - ddtSchemes_.found(name) - || !defaultDdtScheme_.size() - ) + if (ddtSchemes_.found(name) || defaultDdtScheme_.empty()) { return ddtSchemes_.lookup(name); } @@ -320,18 +439,14 @@ ITstream& faSchemes::ddtScheme(const word& name) const } -ITstream& faSchemes::d2dt2Scheme(const word& name) const +Foam::ITstream& Foam::faSchemes::d2dt2Scheme(const word& name) const { if (debug) { Info<< "Lookup d2dt2Scheme for " << name << endl; } - if - ( - d2dt2Schemes_.found(name) - || !defaultD2dt2Scheme_.size() - ) + if (d2dt2Schemes_.found(name) || defaultD2dt2Scheme_.empty()) { return d2dt2Schemes_.lookup(name); } @@ -343,12 +458,17 @@ ITstream& faSchemes::d2dt2Scheme(const word& name) const } -ITstream& faSchemes::interpolationScheme(const word& name) const +Foam::ITstream& Foam::faSchemes::interpolationScheme(const word& name) const { + if (debug) + { + Info<< "Lookup interpolationScheme for " << name << endl; + } + if ( interpolationSchemes_.found(name) - || !defaultInterpolationScheme_.size() + || defaultInterpolationScheme_.empty() ) { return interpolationSchemes_.lookup(name); @@ -361,9 +481,14 @@ ITstream& faSchemes::interpolationScheme(const word& name) const } -ITstream& faSchemes::divScheme(const word& name) const +Foam::ITstream& Foam::faSchemes::divScheme(const word& name) const { - if (divSchemes_.found(name) || !defaultDivScheme_.size()) + if (debug) + { + Info<< "Lookup divScheme for " << name << endl; + } + + if (divSchemes_.found(name) || defaultDivScheme_.empty()) { return divSchemes_.lookup(name); } @@ -375,9 +500,14 @@ ITstream& faSchemes::divScheme(const word& name) const } -ITstream& faSchemes::gradScheme(const word& name) const +Foam::ITstream& Foam::faSchemes::gradScheme(const word& name) const { - if (gradSchemes_.found(name) || !defaultGradScheme_.size()) + if (debug) + { + Info<< "Lookup gradScheme for " << name << endl; + } + + if (gradSchemes_.found(name) || defaultGradScheme_.empty()) { return gradSchemes_.lookup(name); } @@ -389,9 +519,14 @@ ITstream& faSchemes::gradScheme(const word& name) const } -ITstream& faSchemes::lnGradScheme(const word& name) const +Foam::ITstream& Foam::faSchemes::lnGradScheme(const word& name) const { - if (lnGradSchemes_.found(name) || !defaultLnGradScheme_.size()) + if (debug) + { + Info<< "Lookup snGradScheme for " << name << endl; + } + + if (lnGradSchemes_.found(name) || defaultLnGradScheme_.empty()) { return lnGradSchemes_.lookup(name); } @@ -403,9 +538,14 @@ ITstream& faSchemes::lnGradScheme(const word& name) const } -ITstream& faSchemes::laplacianScheme(const word& name) const +Foam::ITstream& Foam::faSchemes::laplacianScheme(const word& name) const { - if (laplacianSchemes_.found(name) || !defaultLaplacianScheme_.size()) + if (debug) + { + Info<< "Lookup laplacianScheme for " << name << endl; + } + + if (laplacianSchemes_.found(name) || defaultLaplacianScheme_.empty()) { return laplacianSchemes_.lookup(name); } @@ -417,13 +557,24 @@ ITstream& faSchemes::laplacianScheme(const word& name) const } -bool faSchemes::fluxRequired(const word& name) const +void Foam::faSchemes::setFluxRequired(const word& name) const +{ + if (debug) + { + Info<< "Setting fluxRequired for " << name << endl; + } + + fluxRequired_.add(name, true, true); +} + + +bool Foam::faSchemes::fluxRequired(const word& name) const { return fluxRequired_.found(name); } -bool faSchemes::writeData(Ostream& os) const +bool Foam::faSchemes::writeData(Ostream& os) const { // Write dictionaries os << nl << "ddtSchemes"; @@ -454,8 +605,4 @@ bool faSchemes::writeData(Ostream& os) const } -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - // ************************************************************************* // diff --git a/src/finiteArea/finiteArea/faSchemes/faSchemes.H b/src/finiteArea/finiteArea/faSchemes/faSchemes.H index 0a2dba49f..e30e45d30 100644 --- a/src/finiteArea/finiteArea/faSchemes/faSchemes.H +++ b/src/finiteArea/finiteArea/faSchemes/faSchemes.H @@ -53,8 +53,6 @@ class faSchemes : public IOdictionary { -private: - // Private data dictionary ddtSchemes_; @@ -78,13 +76,19 @@ private: dictionary laplacianSchemes_; ITstream defaultLaplacianScheme_; - dictionary fluxRequired_; + mutable dictionary fluxRequired_; + bool defaultFluxRequired_; // Private Member Functions - //- Disallow default bitwise copy construct and assignment + //- Clear the dictionaries and streams before reading + void clear(); + + //- Disallow default bitwise copy construct faSchemes(const faSchemes&); + + //- Disallow default bitwise assignment void operator=(const faSchemes&); @@ -120,6 +124,8 @@ public: ITstream& laplacianScheme(const word& name) const; + void setFluxRequired(const word& name) const; + bool fluxRequired(const word& name) const; diff --git a/src/finiteVolume/finiteVolume/fvSchemes/fvSchemes.C b/src/finiteVolume/finiteVolume/fvSchemes/fvSchemes.C index b299f7b89..9358c8fd5 100644 --- a/src/finiteVolume/finiteVolume/fvSchemes/fvSchemes.C +++ b/src/finiteVolume/finiteVolume/fvSchemes/fvSchemes.C @@ -28,7 +28,6 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - Foam::debug::debugSwitch Foam::fvSchemes::debug ( @@ -586,5 +585,35 @@ bool Foam::fvSchemes::fluxRequired(const word& name) const } } +bool Foam::fvSchemes::writeData(Ostream& os) const +{ + // Write dictionaries + os << nl << "ddtSchemes"; + ddtSchemes_.write(os, true); + + os << nl << "d2dt2Schemes"; + d2dt2Schemes_.write(os, true); + + os << nl << "interpolationSchemes"; + interpolationSchemes_.write(os, true); + + os << nl << "divSchemes"; + divSchemes_.write(os, true); + + os << nl << "gradSchemes"; + gradSchemes_.write(os, true); + + os << nl << "snGradSchemes"; + snGradSchemes_.write(os, true); + + os << nl << "laplacianSchemes"; + laplacianSchemes_.write(os, true); + + os << nl << "fluxRequired"; + fluxRequired_.write(os, true); + + return true; +} + // ************************************************************************* // diff --git a/src/finiteVolume/finiteVolume/fvSchemes/fvSchemes.H b/src/finiteVolume/finiteVolume/fvSchemes/fvSchemes.H index b9ff4d583..724b8e57d 100644 --- a/src/finiteVolume/finiteVolume/fvSchemes/fvSchemes.H +++ b/src/finiteVolume/finiteVolume/fvSchemes/fvSchemes.H @@ -95,7 +95,7 @@ class fvSchemes public: //- Debug switch - static debug::debugSwitch debug; + static debug::debugSwitch debug; // Constructors @@ -184,6 +184,12 @@ public: //- Read the fvSchemes bool read(); + + + // Write + + //- WriteData function required for regIOobject write operation + virtual bool writeData(Ostream&) const; }; diff --git a/tutorials/finiteArea/liquidFilmFoam/cylinder/system/faSchemes b/tutorials/finiteArea/liquidFilmFoam/cylinder/system/faSchemes index 553c3a708..9faa6a6fb 100755 --- a/tutorials/finiteArea/liquidFilmFoam/cylinder/system/faSchemes +++ b/tutorials/finiteArea/liquidFilmFoam/cylinder/system/faSchemes @@ -49,10 +49,5 @@ snGradSchemes default corrected; } -fluxRequired -{ - h; -} - // ************************************************************************* // diff --git a/tutorials/finiteArea/liquidFilmFoam/dropsSpreading/system/faSchemes b/tutorials/finiteArea/liquidFilmFoam/dropsSpreading/system/faSchemes index 2c3012e89..c0e057c77 100644 --- a/tutorials/finiteArea/liquidFilmFoam/dropsSpreading/system/faSchemes +++ b/tutorials/finiteArea/liquidFilmFoam/dropsSpreading/system/faSchemes @@ -50,4 +50,5 @@ snGradSchemes default corrected; } + // ************************************************************************* // From b120c4041ce8289a36f0f93a3f1432085efdc8b1 Mon Sep 17 00:00:00 2001 From: Henrik Rusche Date: Sun, 5 Jun 2016 21:36:30 +0200 Subject: [PATCH 7/8] FEAT: fluxRequired support in multiphaseInterFoam --- .../multiphaseInterFoam/multiphaseMixture/multiphaseMixture.C | 1 + .../laminar/damBreak4phase/system/fvSchemes | 4 ---- .../laminar/damBreak4phaseFine/system/fvSchemes | 4 ---- 3 files changed, 1 insertion(+), 8 deletions(-) diff --git a/applications/solvers/multiphase/multiphaseInterFoam/multiphaseMixture/multiphaseMixture.C b/applications/solvers/multiphase/multiphaseInterFoam/multiphaseMixture/multiphaseMixture.C index 952853472..11b454f06 100644 --- a/applications/solvers/multiphase/multiphaseInterFoam/multiphaseMixture/multiphaseMixture.C +++ b/applications/solvers/multiphase/multiphaseInterFoam/multiphaseMixture/multiphaseMixture.C @@ -125,6 +125,7 @@ Foam::multiphaseMixture::multiphaseMixture forAllIter(PtrDictionary, phases_, iter) { alphaTable_.add(iter()); + mesh_.schemesDict().setFluxRequired(iter().volScalarField::name()); } } diff --git a/tutorials/multiphase/multiphaseInterFoam/laminar/damBreak4phase/system/fvSchemes b/tutorials/multiphase/multiphaseInterFoam/laminar/damBreak4phase/system/fvSchemes index f20f40589..019dfdb4f 100644 --- a/tutorials/multiphase/multiphaseInterFoam/laminar/damBreak4phase/system/fvSchemes +++ b/tutorials/multiphase/multiphaseInterFoam/laminar/damBreak4phase/system/fvSchemes @@ -49,9 +49,5 @@ snGradSchemes default corrected; } -fluxRequired -{ - default yes; -} // ************************************************************************* // diff --git a/tutorials/multiphase/multiphaseInterFoam/laminar/damBreak4phaseFine/system/fvSchemes b/tutorials/multiphase/multiphaseInterFoam/laminar/damBreak4phaseFine/system/fvSchemes index f20f40589..019dfdb4f 100644 --- a/tutorials/multiphase/multiphaseInterFoam/laminar/damBreak4phaseFine/system/fvSchemes +++ b/tutorials/multiphase/multiphaseInterFoam/laminar/damBreak4phaseFine/system/fvSchemes @@ -49,9 +49,5 @@ snGradSchemes default corrected; } -fluxRequired -{ - default yes; -} // ************************************************************************* // From 2ed6525fecd040d904c415a1cec37c8565d5713c Mon Sep 17 00:00:00 2001 From: Henrik Rusche Date: Sun, 5 Jun 2016 22:00:23 +0200 Subject: [PATCH 8/8] Remove fluxRequired from Alltest script --- tutorials/Alltest | 1 - 1 file changed, 1 deletion(-) diff --git a/tutorials/Alltest b/tutorials/Alltest index a96651997..b139be30b 100755 --- a/tutorials/Alltest +++ b/tutorials/Alltest @@ -66,7 +66,6 @@ divSchemes laplacianSchemes { default Gauss linear corrected; } interpolationSchemes { default linear; } snGradSchemes { default corrected; } -fluxRequired { default yes; } EOF } #