From 5dd277cdd62a45c6ad2d5878c77d5c8f4ceb2e53 Mon Sep 17 00:00:00 2001 From: andy Date: Tue, 16 Oct 2012 14:34:37 +0100 Subject: [PATCH 01/25] ENH: Updated BC header information/description --- ...emperatureThermoBaffleFvPatchScalarField.H | 121 ++++++++++-------- 1 file changed, 67 insertions(+), 54 deletions(-) diff --git a/src/regionModels/thermoBaffleModels/derivedFvPatchFields/temperatureThermoBaffle/temperatureThermoBaffleFvPatchScalarField.H b/src/regionModels/thermoBaffleModels/derivedFvPatchFields/temperatureThermoBaffle/temperatureThermoBaffleFvPatchScalarField.H index 8d58f73aa5..b32a0127c4 100644 --- a/src/regionModels/thermoBaffleModels/derivedFvPatchFields/temperatureThermoBaffle/temperatureThermoBaffleFvPatchScalarField.H +++ b/src/regionModels/thermoBaffleModels/derivedFvPatchFields/temperatureThermoBaffle/temperatureThermoBaffleFvPatchScalarField.H @@ -28,78 +28,91 @@ Group grpThermoBoundaryConditions Description - This boundary condition provides a coupled condition between the primary - baffle mesh regions. + This boundary condition provides a coupled temperature condition between + multiple mesh regions. The regions are generally referred to as the: + - primary region, and + - baffle region - The primary region creates it and evolves the thermal baffle heat transfer - equation. + The primary region creates the baffle region and evolves its energy + equation either: + - 1-D, normal to each patch face + - 2-D, normal and tangential components - The solid thermo and baffle dictionaries are located on the - primary region. + The thermodynamic properties of the baffle material are specified via + dictionary entries. - type compressible::temperatureThermoBaffle; + \heading Patch usage - // Coupled BC. - neighbourFieldName T; - kappa fluidThermo; - KName none; - - - // Thermo baffle model - thermoBaffleModel thermoBaffle2D; - regionName baffleRegion; - infoOutput yes; - active yes; - thermoBaffle2DCoeffs + Example of the boundary condition specification: + \verbatim + myPatch { - } + type compressible::temperatureThermoBaffle; + + // Coupled boundary condition + neighbourFieldName T; + kappa fluidThermo; + KName none; - // Solid thermo - thermoType - heSolidThermo - ,sensibleEnthalpy> - > - > - > - >; - - mixture - { - specie + // Thermo baffle model + thermoBaffleModel thermoBaffle2D; + regionName baffleRegion; + infoOutput yes; + active yes; + thermoBaffle2DCoeffs { - nMoles 1; - molWeight 20; } - transport + + + // Solid thermo + thermoType { - kappa 0.01; + type heSolidThermo; + mixture pureSolidMixture; + transport constIso; + thermo hConst; + equationOfState rhoConst; + specie specie; + energy sensibleEnthalpy; } + + mixture + { + specie + { + nMoles 1; + molWeight 20; + } + transport + { + kappa 0.01; + } + thermodynamics + { + Hf 0; + Cp 15; + } + density + { + rho 80; + } + } + radiation { - sigmaS 0; - kappaRad 0; - emissivity 1; + radiationModel opaqueSolid; + absorptionEmissionModel none; + scatterModel none; } - thermodynamics - { - Hf 0; - Cp 15; - } - density - { - rho 80; - } - } - value uniform 300; + value uniform 300; + } + \endverbatim SeeAlso Foam::turbulentTemperatureCoupledBaffleMixedFvPatchScalarField + Foam::regionModels::thermoBaffleModels::thermoBaffleModel SourceFiles temperatureThermoBaffleFvPatchScalarField.C From 7918ca13f16a16b831db234fd6fdb7120a4b1622 Mon Sep 17 00:00:00 2001 From: andy Date: Tue, 16 Oct 2012 18:28:07 +0100 Subject: [PATCH 02/25] ENH: Updates to nastran surface writer --- .../writers/nastran/nastranSurfaceWriter.C | 92 +++++++++++++------ .../writers/nastran/nastranSurfaceWriter.H | 11 +-- .../nastran/nastranSurfaceWriterTemplates.C | 44 +++++++-- 3 files changed, 104 insertions(+), 43 deletions(-) diff --git a/src/sampling/sampledSurface/writers/nastran/nastranSurfaceWriter.C b/src/sampling/sampledSurface/writers/nastran/nastranSurfaceWriter.C index 3a67a8dd23..436457c469 100644 --- a/src/sampling/sampledSurface/writers/nastran/nastranSurfaceWriter.C +++ b/src/sampling/sampledSurface/writers/nastran/nastranSurfaceWriter.C @@ -87,14 +87,13 @@ void Foam::nastranSurfaceWriter::formatOS(OFstream& os) const void Foam::nastranSurfaceWriter::writeCoord ( const point& p, - label& nPoint, - label& continuation, - Ostream& os + const label pointI, + OFstream& os ) const { // Fixed short/long formats: // 1 GRID - // 2 ID : point ID + // 2 ID : point ID - requires starting index of 1 // 3 CP : co-ordinate system ID (blank) // 4 X1 : point x cp-ordinate // 5 X2 : point x cp-ordinate @@ -107,35 +106,46 @@ void Foam::nastranSurfaceWriter::writeCoord { case wfShort: { - os << setw(8) << "GRID" - << setw(8) << ++nPoint + os.setf(ios_base::left); + os << setw(8) << "GRID"; + os.unsetf(ios_base::left); + os.setf(ios_base::right); + os << setw(8) << pointI + 1 << " " << setw(8) << p.x() << setw(8) << p.y() << setw(8) << p.z() << nl; + os.unsetf(ios_base::right); break; } case wfLong: { - os << setw(8) << "GRID*" - << setw(16) << ++nPoint + os.setf(ios_base::left); + os << setw(8) << "GRID*"; + os.unsetf(ios_base::left); + os.setf(ios_base::right); + os << setw(16) << pointI + 1 << " " << setw(16) << p.x() << setw(16) << p.y() - << setw(8) << ++continuation - << nl - << setw(8) << continuation - << setw(16) << p.z() << nl; + os.unsetf(ios_base::right); + os.setf(ios_base::left); + os << setw(8) << "*"; + os.unsetf(ios_base::left); + os.setf(ios_base::right); + os << setw(16) << p.z() + << nl; + os.unsetf(ios_base::right); break; } case wfFree: { os << "GRID" - << ',' << ++nPoint + << ',' << pointI + 1 << ',' << ',' << p.x() << ',' << p.y() @@ -163,7 +173,7 @@ void Foam::nastranSurfaceWriter::writeFace const word& faceType, const labelList& facePts, label& nFace, - Ostream& os + OFstream& os ) const { // Only valid surface elements are CTRIA3 and CQUAD4 @@ -172,7 +182,7 @@ void Foam::nastranSurfaceWriter::writeFace // 1 CQUAD4 // 2 EID : element ID // 3 PID : property element ID; default = EID (blank) - // 4 G1 : grid point index + // 4 G1 : grid point index - requires starting index of 1 // 5 G2 : grid point index // 6 G3 : grid point index // 7 G4 : grid point index @@ -183,18 +193,49 @@ void Foam::nastranSurfaceWriter::writeFace switch (writeFormat_) { case wfShort: - case wfLong: { - os << setw(8) << faceType - << setw(8) << ++nFace + os.setf(ios_base::left); + os << setw(8) << faceType; + os.unsetf(ios_base::left); + os.setf(ios_base::right); + os << setw(8) << nFace++ << " "; forAll(facePts, i) { - os << setw(8) << facePts[i]; + os << setw(8) << facePts[i] + 1; } os << nl; + os.unsetf(ios_base::right); + + break; + } + case wfLong: + { + os.setf(ios_base::left); + os << setw(8) << word(faceType + "*"); + os.unsetf(ios_base::left); + os.setf(ios_base::right); + os << setw(16) << nFace++ + << " "; + + forAll(facePts, i) + { + os << setw(16) << facePts[i] + 1; + if (i == 1) + { + os << nl; + os.unsetf(ios_base::right); + os.setf(ios_base::left); + os << setw(8) << "*"; + os.unsetf(ios_base::left); + os.setf(ios_base::right); + } + } + + os << nl; + os.unsetf(ios_base::right); break; } @@ -205,7 +246,7 @@ void Foam::nastranSurfaceWriter::writeFace forAll(facePts, i) { - os << ',' << facePts[i]; + os << ',' << facePts[i] + 1; } os << nl; @@ -235,7 +276,7 @@ void Foam::nastranSurfaceWriter::writeGeometry const pointField& points, const faceList& faces, List >& decomposedFaces, - Ostream& os + OFstream& os ) const { // write points @@ -244,12 +285,9 @@ void Foam::nastranSurfaceWriter::writeGeometry << "$ Points" << nl << "$" << nl; - label nPoint = 0; - label continuation = 0; - forAll(points, pointI) { - writeCoord(points[pointI], nPoint, continuation, os); + writeCoord(points[pointI], pointI, os); } @@ -259,7 +297,7 @@ void Foam::nastranSurfaceWriter::writeGeometry << "$ Faces" << nl << "$" << nl; - label nFace = 0; + label nFace = 1; forAll(faces, faceI) { @@ -352,7 +390,7 @@ void Foam::nastranSurfaceWriter::write Info<< "Writing nastran file to " << os.name() << endl; } - os << "TITLE=OpeNFOAM " << surfaceName.c_str() << " mesh" << nl + os << "TITLE=OpenFOAM " << surfaceName.c_str() << " mesh" << nl << "$" << nl << "BEGIN BULK" << nl; diff --git a/src/sampling/sampledSurface/writers/nastran/nastranSurfaceWriter.H b/src/sampling/sampledSurface/writers/nastran/nastranSurfaceWriter.H index 3667173d65..4e968ee55f 100644 --- a/src/sampling/sampledSurface/writers/nastran/nastranSurfaceWriter.H +++ b/src/sampling/sampledSurface/writers/nastran/nastranSurfaceWriter.H @@ -85,9 +85,8 @@ private: void writeCoord ( const point& p, - label& nPoint, - label& continuation, - Ostream& os + const label pointI, + OFstream& os ) const; //- Write a face element (CTRIA3 or CQUAD4) @@ -96,7 +95,7 @@ private: const word& faceType, const labelList& facePts, label& nFace, - Ostream& os + OFstream& os ) const; //- Main driver to write the surface mesh geometry @@ -105,7 +104,7 @@ private: const pointField& points, const faceList& faces, List >& decomposedFaces, - Ostream& os + OFstream& os ) const; //- Write a face-based value @@ -115,7 +114,7 @@ private: const word& nasFieldName, const Type& value, const label EID, - Ostream& os + OFstream& os ) const; //- Templated write operation diff --git a/src/sampling/sampledSurface/writers/nastran/nastranSurfaceWriterTemplates.C b/src/sampling/sampledSurface/writers/nastran/nastranSurfaceWriterTemplates.C index a393a5968b..e01429fc88 100644 --- a/src/sampling/sampledSurface/writers/nastran/nastranSurfaceWriterTemplates.C +++ b/src/sampling/sampledSurface/writers/nastran/nastranSurfaceWriterTemplates.C @@ -34,7 +34,7 @@ void Foam::nastranSurfaceWriter::writeFaceValue const word& nasFieldName, const Type& value, const label EID, - Ostream& os + OFstream& os ) const { // Fixed short/long formats: @@ -43,26 +43,50 @@ void Foam::nastranSurfaceWriter::writeFaceValue // 3 EID : element ID // 4 onwards: load values - label SID = 0; + label SID = 1; - label w = 16; switch (writeFormat_) { case wfShort: { - w = 8; - } - case wfLong: - { - os << setw(8) << nasFieldName - << setw(8) << SID + os.setf(ios_base::left); + os << setw(8) << nasFieldName; + os.unsetf(ios_base::left); + os.setf(ios_base::right); + os << setw(8) << SID << setw(8) << EID; for (direction dirI = 0; dirI < pTraits::nComponents; dirI++) { - os << setw(w) << component(value, dirI); + os << setw(8) << component(value, dirI); } + os.unsetf(ios_base::right); + + break; + } + case wfLong: + { + os.setf(ios_base::left); + os << setw(8) << word(nasFieldName + "*"); + os.unsetf(ios_base::left); + os.setf(ios_base::right); + os << setw(16) << SID + << setw(16) << EID; + + for (direction dirI = 0; dirI < pTraits::nComponents; dirI++) + { + os << setw(16) << component(value, dirI); + } + + os.unsetf(ios_base::right); + + os << nl; + + os.setf(ios_base::left); + os << '*'; + os.unsetf(ios_base::left); + break; } case wfFree: From e4ea3f4d07e87bf08cfb6914de6c4289c7a5bed0 Mon Sep 17 00:00:00 2001 From: andy Date: Thu, 18 Oct 2012 13:58:10 +0100 Subject: [PATCH 03/25] STYLE: Updated header-file comment --- src/fieldSources/basicSource/basicSource/basicSourceList.H | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/fieldSources/basicSource/basicSource/basicSourceList.H b/src/fieldSources/basicSource/basicSource/basicSourceList.H index 6a7a0126ed..5f5e053a94 100644 --- a/src/fieldSources/basicSource/basicSource/basicSourceList.H +++ b/src/fieldSources/basicSource/basicSource/basicSourceList.H @@ -157,7 +157,7 @@ public: //- Read dictionary virtual bool read(const dictionary& dict); - //- Write data to Istream + //- Write data to Ostream virtual bool writeData(Ostream& os) const; //- Ostream operator From 6e3ff88494a335d8ad17071f854263848083d78f Mon Sep 17 00:00:00 2001 From: andy Date: Thu, 18 Oct 2012 15:42:19 +0100 Subject: [PATCH 04/25] ENH: Removed old porous media implementation --- .../general/porousMedia/PorousZones.C | 223 -------- .../general/porousMedia/PorousZones.H | 170 ------ .../cfdTools/general/porousMedia/porousZone.C | 512 ------------------ .../cfdTools/general/porousMedia/porousZone.H | 389 ------------- .../general/porousMedia/porousZoneTemplates.C | 156 ------ .../general/porousMedia/porousZones.C | 35 -- .../general/porousMedia/porousZones.H | 46 -- 7 files changed, 1531 deletions(-) delete mode 100644 src/finiteVolume/cfdTools/general/porousMedia/PorousZones.C delete mode 100644 src/finiteVolume/cfdTools/general/porousMedia/PorousZones.H delete mode 100644 src/finiteVolume/cfdTools/general/porousMedia/porousZone.C delete mode 100644 src/finiteVolume/cfdTools/general/porousMedia/porousZone.H delete mode 100644 src/finiteVolume/cfdTools/general/porousMedia/porousZoneTemplates.C delete mode 100644 src/finiteVolume/cfdTools/general/porousMedia/porousZones.C delete mode 100644 src/finiteVolume/cfdTools/general/porousMedia/porousZones.H diff --git a/src/finiteVolume/cfdTools/general/porousMedia/PorousZones.C b/src/finiteVolume/cfdTools/general/porousMedia/PorousZones.C deleted file mode 100644 index b219da6c00..0000000000 --- a/src/finiteVolume/cfdTools/general/porousMedia/PorousZones.C +++ /dev/null @@ -1,223 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM 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. - - OpenFOAM 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 OpenFOAM. If not, see . - -\*---------------------------------------------------------------------------*/ - -#include "PorousZones.H" -#include "Time.H" -#include "volFields.H" -#include "fvm.H" - -// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // - -template -template -void Foam::PorousZones::modifyDdt(fvMatrix& m) const -{ - forAll(*this, i) - { - this->operator[](i).modifyDdt(m); - } -} - - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -template -Foam::PorousZones::PorousZones -( - const fvMesh& mesh -) -: - IOPtrList - ( - IOobject - ( - "porousZones", - mesh.time().constant(), - mesh, - IOobject::READ_IF_PRESENT, - IOobject::NO_WRITE - ), - typename ZoneType::iNew(mesh) - ), - mesh_(mesh) -{} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -template -template -Foam::tmp > -Foam::PorousZones::ddt -( - GeometricField& vf -) -{ - tmp > tres = fvm::ddt(vf); - modifyDdt(tres()); - return tres; -} - - -template -template -Foam::tmp > -Foam::PorousZones::ddt -( - const geometricOneField&, - GeometricField& vf -) -{ - tmp > tres = fvm::ddt(vf); - modifyDdt(tres()); - return tres; -} - - -template -template -Foam::tmp > -Foam::PorousZones::ddt -( - const dimensionedScalar& rho, - GeometricField& vf -) -{ - tmp > tres = fvm::ddt(rho,vf); - modifyDdt(tres()); - return tres; -} - - -template -template -Foam::tmp > -Foam::PorousZones::ddt -( - const volScalarField& rho, - GeometricField& vf -) -{ - tmp > tres = fvm::ddt(rho,vf); - modifyDdt(tres()); - return tres; -} - -template -void Foam::PorousZones::addResistance(fvVectorMatrix& UEqn) const -{ - forAll(*this, i) - { - this->operator[](i).addResistance(UEqn); - } -} - - -template -void Foam::PorousZones::addResistance -( - fvVectorMatrix& UEqn, - const volScalarField& rho, - const volScalarField& mu -) const -{ - forAll(*this, i) - { - this->operator[](i).addResistance(UEqn, rho, mu); - } -} - - -template -void Foam::PorousZones::addResistance -( - const fvVectorMatrix& UEqn, - volTensorField& AU -) const -{ - // addResistance for each zone, delaying the correction of the - // processor BCs of AU - forAll(*this, i) - { - this->operator[](i).addResistance(UEqn, AU, false); - } - - // Correct the boundary conditions of the tensorial diagonal to ensure - // processor bounaries are correctly handled when AU^-1 is interpolated - // for the pressure equation. - AU.correctBoundaryConditions(); -} - - -template -bool Foam::PorousZones::readData(Istream& is) -{ - this->clear(); - - IOPtrList newLst - ( - IOobject - ( - "porousZones", - mesh_.time().constant(), - mesh_, - IOobject::MUST_READ, - IOobject::NO_WRITE, - false // Don't re-register new zones with objectRegistry - ), - typename ZoneType::iNew(mesh_) - ); - - this->transfer(newLst); - - return is.good(); -} - - -template -bool Foam::PorousZones::writeData(Ostream& os, bool subDict) const -{ - // Write size of list - os << nl << this->size(); - - // Write beginning of contents - os << nl << token::BEGIN_LIST; - - // Write list contents - forAll(*this, i) - { - os << nl; - this->operator[](i).writeDict(os, subDict); - } - - // Write end of contents - os << token::END_LIST << nl; - - // Check state of IOstream - return os.good(); -} - - -// ************************************************************************* // diff --git a/src/finiteVolume/cfdTools/general/porousMedia/PorousZones.H b/src/finiteVolume/cfdTools/general/porousMedia/PorousZones.H deleted file mode 100644 index 2e1624c4e6..0000000000 --- a/src/finiteVolume/cfdTools/general/porousMedia/PorousZones.H +++ /dev/null @@ -1,170 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM 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. - - OpenFOAM 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 OpenFOAM. If not, see . - -Class - Foam::PorousZones - -Description - A centralized ZoneType collection. - - Container class for a set of ZoneType with the ZoneType member - functions implemented to loop over the functions for each ZoneType. - -SourceFiles - PorousZones.C - -\*---------------------------------------------------------------------------*/ - -#ifndef PorousZones_H -#define PorousZones_H - -#include "IOPtrList.H" - -#include "volFieldsFwd.H" -#include "fvMatricesFwd.H" -#include "dimensionedScalarFwd.H" -#include "geometricOneField.H" - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -// Forward declaration of friend functions and operators -class fvMesh; - - -/*---------------------------------------------------------------------------*\ - Class PorousZones Declaration -\*---------------------------------------------------------------------------*/ - -template -class PorousZones -: - public IOPtrList -{ - // Private data - - //- Reference to the finite volume mesh this zone is part of - const fvMesh& mesh_; - - // Private Member Functions - - //- Disallow default bitwise copy construct - PorousZones(const PorousZones&); - - //- Disallow default bitwise assignment - void operator=(const PorousZones&); - - - //- modify time derivative elements - template - void modifyDdt(fvMatrix&) const; - -public: - - // Constructors - - //- Construct from fvMesh - // with automatically constructed coordinate systems list - PorousZones(const fvMesh&); - - - // Member Functions - - //- mirror fvm::ddt with porosity - template - tmp > ddt - ( - GeometricField& - ); - - //- mirror fvm::ddt with porosity - template - tmp > ddt - ( - const geometricOneField&, - GeometricField& - ); - - //- mirror fvm::ddt with porosity - template - tmp > ddt - ( - const dimensionedScalar&, - GeometricField& - ); - - //- mirror fvm::ddt with porosity - template - tmp > ddt - ( - const volScalarField&, - GeometricField& - ); - - //- Add the viscous and inertial resistance force contribution - // to the momentum equation - void addResistance(fvVectorMatrix& UEqn) const; - - //- Add the viscous and inertial resistance force contribution - // to the momentum equation using rho and mu provided - void addResistance - ( - fvVectorMatrix& UEqn, - const volScalarField& rho, - const volScalarField& mu - ) const; - - //- Add the viscous and inertial resistance force contribution - // to the tensorial diagonal - void addResistance - ( - const fvVectorMatrix& UEqn, - volTensorField& AU - ) const; - - //- read modified data - virtual bool readData(Istream&); - - //- write data - bool writeData(Ostream&, bool subDict = true) const; -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#ifdef NoRepository -# include "PorousZones.C" -#endif - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/src/finiteVolume/cfdTools/general/porousMedia/porousZone.C b/src/finiteVolume/cfdTools/general/porousMedia/porousZone.C deleted file mode 100644 index edb0940cc7..0000000000 --- a/src/finiteVolume/cfdTools/general/porousMedia/porousZone.C +++ /dev/null @@ -1,512 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM 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. - - OpenFOAM 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 OpenFOAM. If not, see . - -\*----------------------------------------------------------------------------*/ - -#include "porousZone.H" -#include "fvMesh.H" -#include "fvMatrices.H" -#include "geometricOneField.H" - -// * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * * // - -// adjust negative resistance values to be multiplier of max value -void Foam::porousZone::adjustNegativeResistance(dimensionedVector& resist) -{ - scalar maxCmpt = max(0, cmptMax(resist.value())); - - if (maxCmpt < 0) - { - FatalErrorIn - ( - "Foam::porousZone::porousZone::adjustNegativeResistance" - "(dimensionedVector&)" - ) << "negative resistances! " << resist - << exit(FatalError); - } - else - { - vector& val = resist.value(); - for (label cmpt=0; cmpt < vector::nComponents; ++cmpt) - { - if (val[cmpt] < 0) - { - val[cmpt] *= -maxCmpt; - } - } - } -} - - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -Foam::porousZone::porousZone -( - const keyType& key, - const fvMesh& mesh, - const dictionary& dict -) -: - key_(key), - mesh_(mesh), - dict_(dict), - cellZoneIds_(mesh_.cellZones().findIndices(key_)), - coordSys_(dict, mesh), - porosity_(1), - intensity_(0), - mixingLength_(0), - C0_(0), - C1_(0), - D_("D", dimensionSet(0, -2, 0, 0, 0), tensor::zero), - F_("F", dimensionSet(0, -1, 0, 0, 0), tensor::zero) -{ - Info<< "Creating porous zone: " << key_ << endl; - - bool foundZone = !cellZoneIds_.empty(); - reduce(foundZone, orOp()); - - if (!foundZone && Pstream::master()) - { - FatalErrorIn - ( - "Foam::porousZone::porousZone" - "(const keyType&, const fvMesh&, const dictionary&)" - ) << "cannot find porous cellZone " << key_ - << exit(FatalError); - } - - - // porosity - if - ( - dict_.readIfPresent("porosity", porosity_) - && (porosity_ <= 0.0 || porosity_ > 1.0) - ) - { - FatalIOErrorIn - ( - "Foam::porousZone::porousZone" - "(const keyType&, const fvMesh&, const dictionary&)", - dict_ - ) - << "out-of-range porosity value " << porosity_ - << exit(FatalIOError); - } - - // turbulent intensity - if - ( - dict_.readIfPresent("intensity", intensity_) - && (intensity_ <= 0.0 || intensity_ > 1.0) - ) - { - FatalIOErrorIn - ( - "Foam::porousZone::porousZone" - "(const keyType&, const fvMesh&, const dictionary&)", - dict_ - ) - << "out-of-range turbulent intensity value " << intensity_ - << exit(FatalIOError); - } - - // turbulent length scale - if - ( - dict_.readIfPresent("mixingLength", mixingLength_) - && (mixingLength_ <= 0.0) - ) - { - FatalIOErrorIn - ( - "Foam::porousZone::porousZone" - "(const keyType&, const fvMesh&, const dictionary&)", - dict_ - ) - << "out-of-range turbulent length scale " << mixingLength_ - << exit(FatalIOError); - } - - - // powerLaw coefficients - if (const dictionary* dictPtr = dict_.subDictPtr("powerLaw")) - { - dictPtr->readIfPresent("C0", C0_); - dictPtr->readIfPresent("C1", C1_); - } - - // Darcy-Forchheimer coefficients - if (const dictionary* dictPtr = dict_.subDictPtr("Darcy")) - { - // local-to-global transformation tensor - const tensor& E = coordSys_.R(); - - dimensionedVector d(vector::zero); - if (dictPtr->readIfPresent("d", d)) - { - if (D_.dimensions() != d.dimensions()) - { - FatalIOErrorIn - ( - "Foam::porousZone::porousZone" - "(const keyType&, const fvMesh&, const dictionary&)", - dict_ - ) << "incorrect dimensions for d: " << d.dimensions() - << " should be " << D_.dimensions() - << exit(FatalIOError); - } - - adjustNegativeResistance(d); - - D_.value().xx() = d.value().x(); - D_.value().yy() = d.value().y(); - D_.value().zz() = d.value().z(); - D_.value() = (E & D_ & E.T()).value(); - } - - dimensionedVector f(vector::zero); - if (dictPtr->readIfPresent("f", f)) - { - if (F_.dimensions() != f.dimensions()) - { - FatalIOErrorIn - ( - "Foam::porousZone::porousZone" - "(const keyType&, const fvMesh&, const dictionary&)", - dict_ - ) << "incorrect dimensions for f: " << f.dimensions() - << " should be " << F_.dimensions() - << exit(FatalIOError); - } - - adjustNegativeResistance(f); - - // leading 0.5 is from 1/2 * rho - F_.value().xx() = 0.5*f.value().x(); - F_.value().yy() = 0.5*f.value().y(); - F_.value().zz() = 0.5*f.value().z(); - F_.value() = (E & F_ & E.T()).value(); - } - } - - // it is an error not to define anything - if - ( - C0_ <= VSMALL - && magSqr(D_.value()) <= VSMALL - && magSqr(F_.value()) <= VSMALL - ) - { - FatalIOErrorIn - ( - "Foam::porousZone::porousZone" - "(const keyType&, const fvMesh&, const dictionary&)", - dict_ - ) << "neither powerLaw (C0/C1) " - "nor Darcy-Forchheimer law (d/f) specified" - << exit(FatalIOError); - } - - // feedback for the user - if (dict.lookupOrDefault("printCoeffs", false)) - { - writeDict(Info, false); - } -} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -void Foam::porousZone::addResistance(fvVectorMatrix& UEqn) const -{ - if (cellZoneIds_.empty()) - { - return; - } - - bool compressible = false; - if (UEqn.dimensions() == dimensionSet(1, 1, -2, 0, 0)) - { - compressible = true; - } - - const scalarField& V = mesh_.V(); - scalarField& Udiag = UEqn.diag(); - vectorField& Usource = UEqn.source(); - const vectorField& U = UEqn.psi(); - - if (C0_ > VSMALL) - { - if (compressible) - { - addPowerLawResistance - ( - Udiag, - V, - mesh_.lookupObject("rho"), - U - ); - } - else - { - addPowerLawResistance - ( - Udiag, - V, - geometricOneField(), - U - ); - } - } - - const tensor& D = D_.value(); - const tensor& F = F_.value(); - - if (magSqr(D) > VSMALL || magSqr(F) > VSMALL) - { - if (compressible) - { - addViscousInertialResistance - ( - Udiag, - Usource, - V, - mesh_.lookupObject("rho"), - mesh_.lookupObject("mu"), - U - ); - } - else - { - addViscousInertialResistance - ( - Udiag, - Usource, - V, - geometricOneField(), - mesh_.lookupObject("nu"), - U - ); - } - } -} - - -void Foam::porousZone::addResistance -( - fvVectorMatrix& UEqn, - const volScalarField& rho, - const volScalarField& mu -) const -{ - if (cellZoneIds_.empty()) - { - return; - } - - const scalarField& V = mesh_.V(); - scalarField& Udiag = UEqn.diag(); - vectorField& Usource = UEqn.source(); - const vectorField& U = UEqn.psi(); - - if (C0_ > VSMALL) - { - addPowerLawResistance - ( - Udiag, - V, - rho, - U - ); - } - - const tensor& D = D_.value(); - const tensor& F = F_.value(); - - if (magSqr(D) > VSMALL || magSqr(F) > VSMALL) - { - addViscousInertialResistance - ( - Udiag, - Usource, - V, - rho, - mu, - U - ); - } -} - -void Foam::porousZone::addResistance -( - const fvVectorMatrix& UEqn, - volTensorField& AU, - bool correctAUprocBC -) const -{ - if (cellZoneIds_.empty()) - { - return; - } - - bool compressible = false; - if (UEqn.dimensions() == dimensionSet(1, 1, -2, 0, 0)) - { - compressible = true; - } - - const vectorField& U = UEqn.psi(); - - if (C0_ > VSMALL) - { - if (compressible) - { - addPowerLawResistance - ( - AU, - mesh_.lookupObject("rho"), - U - ); - } - else - { - addPowerLawResistance - ( - AU, - geometricOneField(), - U - ); - } - } - - const tensor& D = D_.value(); - const tensor& F = F_.value(); - - if (magSqr(D) > VSMALL || magSqr(F) > VSMALL) - { - if (compressible) - { - addViscousInertialResistance - ( - AU, - mesh_.lookupObject("rho"), - mesh_.lookupObject("mu"), - U - ); - } - else - { - addViscousInertialResistance - ( - AU, - geometricOneField(), - mesh_.lookupObject("nu"), - U - ); - } - } - - if (correctAUprocBC) - { - // Correct the boundary conditions of the tensorial diagonal to ensure - // processor boundaries are correctly handled when AU^-1 is interpolated - // for the pressure equation. - AU.correctBoundaryConditions(); - } -} - - -void Foam::porousZone::writeDict(Ostream& os, bool subDict) const -{ - if (subDict) - { - os << indent << token::BEGIN_BLOCK << incrIndent << nl; - os.writeKeyword("name") - << zoneName() << token::END_STATEMENT << nl; - } - else - { - os << indent << zoneName() << nl - << indent << token::BEGIN_BLOCK << incrIndent << nl; - } - - if (dict_.found("note")) - { - os.writeKeyword("note") - << string(dict_.lookup("note")) << token::END_STATEMENT << nl; - } - - coordSys_.writeDict(os, true); - - if (dict_.found("porosity")) - { - os.writeKeyword("porosity") - << porosity() << token::END_STATEMENT << nl; - } - - if (dict_.found("intensity")) - { - os.writeKeyword("intensity") - << intensity() << token::END_STATEMENT << nl; - } - - if (dict_.found("mixingLength")) - { - os.writeKeyword("mixingLength") - << mixingLength() << token::END_STATEMENT << nl; - } - - // powerLaw coefficients - if (const dictionary* dictPtr = dict_.subDictPtr("powerLaw")) - { - os << indent << "powerLaw"; - dictPtr->write(os); - } - - // Darcy-Forchheimer coefficients - if (const dictionary* dictPtr = dict_.subDictPtr("Darcy")) - { - os << indent << "Darcy"; - dictPtr->write(os); - } - - // thermalModel - if (const dictionary* dictPtr = dict_.subDictPtr("thermalModel")) - { - os << indent << "thermalModel"; - dictPtr->write(os); - } - - os << decrIndent << indent << token::END_BLOCK << endl; -} - - -// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * // - -Foam::Ostream& Foam::operator<<(Ostream& os, const porousZone& pz) -{ - pz.writeDict(os); - return os; -} - -// ************************************************************************* // diff --git a/src/finiteVolume/cfdTools/general/porousMedia/porousZone.H b/src/finiteVolume/cfdTools/general/porousMedia/porousZone.H deleted file mode 100644 index 431b36fe25..0000000000 --- a/src/finiteVolume/cfdTools/general/porousMedia/porousZone.H +++ /dev/null @@ -1,389 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM 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. - - OpenFOAM 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 OpenFOAM. If not, see . - -Namespace - Foam::porousMedia - -Description - Namespace for models related to porous media - -Class - Foam::porousZone - -Description - Porous zone definition based on cell zones. - - Porous zone definition based on cell zones and parameters obtained from a - control dictionary constructed from the given stream. The orientation of - the porous region is defined with the same notation as a coordinateSystem, - but only a Cartesian coordinate system is valid. - - Implemented porosity models: - - powerLaw (\e C0 and \e C1 parameters) - \f[ - S = - \rho C_0 |U|^{(C_1 - 1)} U - \f] - - Darcy-Forchheimer (@e d and \e f parameters) - \f[ - S = - (\mu \, d + \frac{\rho |U|}{2} \, f) U - \f] - - - Since negative Darcy/Forchheimer parameters are invalid, they can be used - to specify a multiplier (of the max component). - - The porousZones method porousZones::ddt() mirrors the normal fvm::ddt() - method, but accounts for the effective volume of the cells. - - An example dictionary entry: - \verbatim - cat1 - { - note "some catalyst"; - coordinateSystem system_10; - porosity 0.809; - intensity 0.001; // optional - mixingLength 0.0001; // optional - printCoeffs yes; // optional: feedback for the user - - Darcy - { - d d [0 -2 0 0 0] (-1000 -1000 5.3756e+07); - f f [0 -1 0 0 0] (-1000 -1000 15.83); - } - } - \endverbatim - -See Also - porousZones and coordinateSystems - -SourceFiles - porousZone.C - porousZoneTemplates.C - -\*---------------------------------------------------------------------------*/ - -#ifndef porousZone_H -#define porousZone_H - -#include "dictionary.H" -#include "coordinateSystem.H" -#include "coordinateSystems.H" -#include "wordList.H" -#include "labelList.H" -#include "dimensionedScalar.H" -#include "dimensionedTensor.H" -#include "primitiveFieldsFwd.H" -#include "volFieldsFwd.H" -#include "fvMatricesFwd.H" - -#include "fvMesh.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -class fvMesh; - -/*---------------------------------------------------------------------------*\ - Class porousZone Declaration -\*---------------------------------------------------------------------------*/ - -class porousZone -{ - // Private data - - //- Name of this zone, or a regular expression - keyType key_; - - //- Reference to the finite volume mesh this zone is part of - const fvMesh& mesh_; - - //- Dictionary containing the parameters - dictionary dict_; - - //- Cell zone Ids - labelList cellZoneIds_; - - //- Coordinate system used for the zone (Cartesian) - coordinateSystem coordSys_; - - //- porosity of the zone (0 < porosity <= 1) - // Placeholder for treatment of temporal terms. - // Currently unused. - scalar porosity_; - - //- Turbulent intensity as fraction of the velocity - scalar intensity_; - - //- Turbulent length scale - scalar mixingLength_; - - //- powerLaw coefficient C0 - scalar C0_; - - //- powerLaw coefficient C1 - scalar C1_; - - //- Darcy coefficient - dimensionedTensor D_; - - //- Forchheimer coefficient - dimensionedTensor F_; - - - // Private Member Functions - - //- adjust negative resistance values to be multiplier of max value - static void adjustNegativeResistance(dimensionedVector& resist); - - //- Power-law resistance - template - void addPowerLawResistance - ( - scalarField& Udiag, - const scalarField& V, - const RhoFieldType& rho, - const vectorField& U - ) const; - - //- Viscous and inertial resistance - template - void addViscousInertialResistance - ( - scalarField& Udiag, - vectorField& Usource, - const scalarField& V, - const RhoFieldType& rho, - const scalarField& mu, - const vectorField& U - ) const; - - - //- Power-law resistance - template - void addPowerLawResistance - ( - tensorField& AU, - const RhoFieldType& rho, - const vectorField& U - ) const; - - //- Viscous and inertial resistance - template - void addViscousInertialResistance - ( - tensorField& AU, - const RhoFieldType& rho, - const scalarField& mu, - const vectorField& U - ) const; - - - //- Disallow default bitwise copy construct - porousZone(const porousZone&); - - //- Disallow default bitwise assignment - void operator=(const porousZone&); - - -public: - - // Constructors - - //- Construct from components - porousZone(const keyType& key, const fvMesh&, const dictionary&); - - //- Return clone - autoPtr clone() const - { - notImplemented("autoPtr clone() const"); - return autoPtr(NULL); - } - - //- Return pointer to new porousZone created on freestore from Istream - class iNew - { - //- Reference to the finite volume mesh this zone is part of - const fvMesh& mesh_; - - public: - - iNew(const fvMesh& mesh) - : - mesh_(mesh) - {} - - autoPtr operator()(Istream& is) const - { - keyType key(is); - dictionary dict(is); - - return autoPtr(new porousZone(key, mesh_, dict)); - } - }; - - - //- Destructor - virtual ~porousZone() - {} - - - // Member Functions - - // Access - - //- cellZone name - const keyType& zoneName() const - { - return key_; - } - - //- Return mesh - const fvMesh& mesh() const - { - return mesh_; - } - - //- cellZone numbers - const labelList& zoneIds() const - { - return cellZoneIds_; - } - - //- dictionary values used for the porousZone - const dictionary& dict() const - { - return dict_; - } - - //- Return coordinate system - const coordinateSystem& coordSys() const - { - return coordSys_; - } - - //- Return origin - const point& origin() const - { - return coordSys_.origin(); - } - - //- Return axis - vector axis() const - { - return coordSys_.axis(); - } - - //- Return porosity - scalar porosity() const - { - return porosity_; - } - - //- Edit access to porosity - scalar& porosity() - { - return porosity_; - } - - //- Return turbulent intensity - scalar intensity() const - { - return intensity_; - } - - //- Edit access to turbulent intensity - scalar& intensity() - { - return intensity_; - } - - //- Return turbulent length scale - scalar mixingLength() const - { - return mixingLength_; - } - - //- Edit access to turbulent length scale - scalar& mixingLength() - { - return mixingLength_; - } - - - //- Modify time derivative elements according to porosity - template - void modifyDdt(fvMatrix&) const; - - //- Add the viscous and inertial resistance force contribution - // to the momentum equation - void addResistance(fvVectorMatrix& UEqn) const; - - //- Add the viscous and inertial resistance force contribution - // to the momentum equation giving rho and mu. - void addResistance - ( - fvVectorMatrix& UEqn, - const volScalarField& rho, - const volScalarField& mu - ) const; - - //- Add the viscous and inertial resistance force contribution - // to the tensorial diagonal. - // Optionally correct the processor BCs of AU. - void addResistance - ( - const fvVectorMatrix& UEqn, - volTensorField& AU, - bool correctAUprocBC = true - ) const; - - //- Write the porousZone dictionary - virtual void writeDict(Ostream&, bool subDict = true) const; - - - // Ostream Operator - - friend Ostream& operator<<(Ostream&, const porousZone&); -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#ifdef NoRepository -# include "porousZoneTemplates.C" -#endif - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/src/finiteVolume/cfdTools/general/porousMedia/porousZoneTemplates.C b/src/finiteVolume/cfdTools/general/porousMedia/porousZoneTemplates.C deleted file mode 100644 index 0e737c00bd..0000000000 --- a/src/finiteVolume/cfdTools/general/porousMedia/porousZoneTemplates.C +++ /dev/null @@ -1,156 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM 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. - - OpenFOAM 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 OpenFOAM. If not, see . - -\*----------------------------------------------------------------------------*/ - -#include "porousZone.H" -#include "fvMesh.H" - -// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // - -template -void Foam::porousZone::modifyDdt(fvMatrix& m) const -{ - if (porosity_ < 1) - { - forAll(cellZoneIds_, zoneI) - { - const labelList& cells = mesh_.cellZones()[cellZoneIds_[zoneI]]; - - forAll(cells, i) - { - m.diag()[cells[i]] *= porosity_; - m.source()[cells[i]] *= porosity_; - } - } - } -} - - -template -void Foam::porousZone::addPowerLawResistance -( - scalarField& Udiag, - const scalarField& V, - const RhoFieldType& rho, - const vectorField& U -) const -{ - const scalar C0 = C0_; - const scalar C1m1b2 = (C1_ - 1.0)/2.0; - - forAll(cellZoneIds_, zoneI) - { - const labelList& cells = mesh_.cellZones()[cellZoneIds_[zoneI]]; - - forAll(cells, i) - { - Udiag[cells[i]] += - V[cells[i]]*rho[cells[i]]*C0*pow(magSqr(U[cells[i]]), C1m1b2); - } - } -} - - -template -void Foam::porousZone::addViscousInertialResistance -( - scalarField& Udiag, - vectorField& Usource, - const scalarField& V, - const RhoFieldType& rho, - const scalarField& mu, - const vectorField& U -) const -{ - const tensor& D = D_.value(); - const tensor& F = F_.value(); - - forAll(cellZoneIds_, zoneI) - { - const labelList& cells = mesh_.cellZones()[cellZoneIds_[zoneI]]; - - forAll(cells, i) - { - const tensor dragCoeff = mu[cells[i]]*D - + (rho[cells[i]]*mag(U[cells[i]]))*F; - - const scalar isoDragCoeff = tr(dragCoeff); - - Udiag[cells[i]] += V[cells[i]]*isoDragCoeff; - Usource[cells[i]] -= - V[cells[i]]*((dragCoeff - I*isoDragCoeff) & U[cells[i]]); - } - } -} - - -template -void Foam::porousZone::addPowerLawResistance -( - tensorField& AU, - const RhoFieldType& rho, - const vectorField& U -) const -{ - const scalar C0 = C0_; - const scalar C1m1b2 = (C1_ - 1.0)/2.0; - - forAll(cellZoneIds_, zoneI) - { - const labelList& cells = mesh_.cellZones()[cellZoneIds_[zoneI]]; - - forAll(cells, i) - { - AU[cells[i]] = AU[cells[i]] - + I*(rho[cells[i]]*C0*pow(magSqr(U[cells[i]]), C1m1b2)); - } - } -} - - -template -void Foam::porousZone::addViscousInertialResistance -( - tensorField& AU, - const RhoFieldType& rho, - const scalarField& mu, - const vectorField& U -) const -{ - const tensor& D = D_.value(); - const tensor& F = F_.value(); - - forAll(cellZoneIds_, zoneI) - { - const labelList& cells = mesh_.cellZones()[cellZoneIds_[zoneI]]; - - forAll(cells, i) - { - AU[cells[i]] += mu[cells[i]]*D + (rho[cells[i]]*mag(U[cells[i]]))*F; - } - } -} - - -// ************************************************************************* // diff --git a/src/finiteVolume/cfdTools/general/porousMedia/porousZones.C b/src/finiteVolume/cfdTools/general/porousMedia/porousZones.C deleted file mode 100644 index 5130ca90e9..0000000000 --- a/src/finiteVolume/cfdTools/general/porousMedia/porousZones.C +++ /dev/null @@ -1,35 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM 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. - - OpenFOAM 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 OpenFOAM. If not, see . - -\*---------------------------------------------------------------------------*/ - -#include "porousZones.H" - -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - -namespace Foam -{ - defineTemplateTypeNameAndDebug(IOPtrList, 0); -} - -// ************************************************************************* // diff --git a/src/finiteVolume/cfdTools/general/porousMedia/porousZones.H b/src/finiteVolume/cfdTools/general/porousMedia/porousZones.H deleted file mode 100644 index 17c439d174..0000000000 --- a/src/finiteVolume/cfdTools/general/porousMedia/porousZones.H +++ /dev/null @@ -1,46 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM 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. - - OpenFOAM 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 OpenFOAM. If not, see . - -Typedef - Foam::porousZones - -\*---------------------------------------------------------------------------*/ - -#ifndef porousZones_H -#define porousZones_H - -#include "PorousZones.H" -#include "porousZone.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - typedef PorousZones porousZones; -} - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // From 1b421e65010965d1f3dd48e7308a79bcbc3bb4de Mon Sep 17 00:00:00 2001 From: andy Date: Thu, 18 Oct 2012 15:43:06 +0100 Subject: [PATCH 05/25] ENH: Added new refactored porosity models functionality --- src/finiteVolume/Make/files | 8 +- .../DarcyForchheimer/DarcyForchheimer.C | 202 +++++++++++++++ .../DarcyForchheimer/DarcyForchheimer.H | 187 ++++++++++++++ .../DarcyForchheimerTemplates.C | 86 +++++++ .../porosityModel/IOporosityModelList.C | 90 +++++++ .../porosityModel/IOporosityModelList.H | 96 +++++++ .../porosityModel/porosityModel.C | 182 +++++++++++++ .../porosityModel/porosityModel.H | 241 ++++++++++++++++++ .../porosityModel/porosityModelI.H | 38 +++ .../porosityModel/porosityModelList.C | 183 +++++++++++++ .../porosityModel/porosityModelList.H | 140 ++++++++++ .../porosityModel/porosityModelNew.C | 66 +++++ .../general/porosityModel/powerLaw/powerLaw.C | 135 ++++++++++ .../general/porosityModel/powerLaw/powerLaw.H | 168 ++++++++++++ .../powerLaw/powerLawTemplates.C | 81 ++++++ 15 files changed, 1901 insertions(+), 2 deletions(-) create mode 100644 src/finiteVolume/cfdTools/general/porosityModel/DarcyForchheimer/DarcyForchheimer.C create mode 100644 src/finiteVolume/cfdTools/general/porosityModel/DarcyForchheimer/DarcyForchheimer.H create mode 100644 src/finiteVolume/cfdTools/general/porosityModel/DarcyForchheimer/DarcyForchheimerTemplates.C create mode 100644 src/finiteVolume/cfdTools/general/porosityModel/porosityModel/IOporosityModelList.C create mode 100644 src/finiteVolume/cfdTools/general/porosityModel/porosityModel/IOporosityModelList.H create mode 100644 src/finiteVolume/cfdTools/general/porosityModel/porosityModel/porosityModel.C create mode 100644 src/finiteVolume/cfdTools/general/porosityModel/porosityModel/porosityModel.H create mode 100644 src/finiteVolume/cfdTools/general/porosityModel/porosityModel/porosityModelI.H create mode 100644 src/finiteVolume/cfdTools/general/porosityModel/porosityModel/porosityModelList.C create mode 100644 src/finiteVolume/cfdTools/general/porosityModel/porosityModel/porosityModelList.H create mode 100644 src/finiteVolume/cfdTools/general/porosityModel/porosityModel/porosityModelNew.C create mode 100644 src/finiteVolume/cfdTools/general/porosityModel/powerLaw/powerLaw.C create mode 100644 src/finiteVolume/cfdTools/general/porosityModel/powerLaw/powerLaw.H create mode 100644 src/finiteVolume/cfdTools/general/porosityModel/powerLaw/powerLawTemplates.C diff --git a/src/finiteVolume/Make/files b/src/finiteVolume/Make/files index 58c0b57673..b8b7e2f1d4 100644 --- a/src/finiteVolume/Make/files +++ b/src/finiteVolume/Make/files @@ -365,8 +365,12 @@ $(solutionControl)/simpleControl/simpleControl.C $(solutionControl)/pimpleControl/pimpleControl.C porousMedia = $(general)/porousMedia -$(porousMedia)/porousZone.C -$(porousMedia)/porousZones.C +$(porousMedia)/porosityModel/porosityModel/porosityModel.C +$(porousMedia)/porosityModel/porosityModel/porosityModelNew.C +$(porousMedia)/porosityModel/porosityModel/porosityModelList.C +$(porousMedia)/porosityModel/porosityModel/IOporosityModelList.C +$(porousMedia)/porosityModel/DarcyForchheimer/DarcyForchheimer.C +$(porousMedia)/porosityModel/powerLaw/powerLaw.C MRF = $(general)/MRF $(MRF)/MRFZone.C diff --git a/src/finiteVolume/cfdTools/general/porosityModel/DarcyForchheimer/DarcyForchheimer.C b/src/finiteVolume/cfdTools/general/porosityModel/DarcyForchheimer/DarcyForchheimer.C new file mode 100644 index 0000000000..f292cb63c8 --- /dev/null +++ b/src/finiteVolume/cfdTools/general/porosityModel/DarcyForchheimer/DarcyForchheimer.C @@ -0,0 +1,202 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM 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. + + OpenFOAM 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 OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "addToRunTimeSelectionTable.H" +#include "DarcyForchheimer.H" +#include "geometricOneField.H" +#include "fvMatrices.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + namespace porosityModels + { + defineTypeNameAndDebug(DarcyForchheimer, 0); + addToRunTimeSelectionTable(porosityModel, DarcyForchheimer, mesh); + } +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::porosityModels::DarcyForchheimer::DarcyForchheimer +( + const word& name, + const word& modelType, + const fvMesh& mesh, + const dictionary& dict +) +: + porosityModel(name, modelType, mesh, dict), + coordSys_(coeffs_, mesh), + D_("D", dimless/sqr(dimLength), tensor::zero), + F_("F", dimless/dimLength, tensor::zero), + rhoName_(coeffs_.lookupOrDefault("rho", "rho")), + muName_(coeffs_.lookupOrDefault("mu", "mu")), + nuName_(coeffs_.lookupOrDefault("nu", "nu")) +{ + // local-to-global transformation tensor + const tensor& E = coordSys_.R(); + + dimensionedVector d(coeffs_.lookup("d")); + if (D_.dimensions() != d.dimensions()) + { + FatalIOErrorIn + ( + "Foam::porosityModels::DarcyForchheimer::DarcyForchheimer" + "(" + "const dictionary&, " + "const coordinateSystem&, " + "const keyType&" + ")", + coeffs_ + ) << "incorrect dimensions for d: " << d.dimensions() + << " should be " << D_.dimensions() + << exit(FatalIOError); + } + + adjustNegativeResistance(d); + + D_.value().xx() = d.value().x(); + D_.value().yy() = d.value().y(); + D_.value().zz() = d.value().z(); + D_.value() = (E & D_ & E.T()).value(); + + dimensionedVector f(coeffs_.lookup("f")); + if (F_.dimensions() != f.dimensions()) + { + FatalIOErrorIn + ( + "Foam::porosityModels::DarcyForchheimer::DarcyForchheimer" + "(" + "const dictionary&, " + "const coordinateSystem&, " + "const keyType&" + ")", + coeffs_ + ) << "incorrect dimensions for f: " << f.dimensions() + << " should be " << F_.dimensions() + << exit(FatalIOError); + } + + adjustNegativeResistance(f); + + // leading 0.5 is from 1/2*rho + F_.value().xx() = 0.5*f.value().x(); + F_.value().yy() = 0.5*f.value().y(); + F_.value().zz() = 0.5*f.value().z(); + F_.value() = (E & F_ & E.T()).value(); +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::porosityModels::DarcyForchheimer::~DarcyForchheimer() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::porosityModels::DarcyForchheimer::correct +( + fvVectorMatrix& UEqn +) const +{ + const vectorField& U = UEqn.psi(); + const scalarField& V = mesh_.V(); + scalarField& Udiag = UEqn.diag(); + vectorField& Usource = UEqn.source(); + + if (UEqn.dimensions() == dimForce) + { + const volScalarField& rho = + mesh_.lookupObject(rhoName_); + const volScalarField& mu = + mesh_.lookupObject(muName_); + + apply(Udiag, Usource, V, rho, mu, U); + } + else + { + const volScalarField& nu = + mesh_.lookupObject(nuName_); + + apply(Udiag, Usource, V, geometricOneField(), nu, U); + } +} + + +void Foam::porosityModels::DarcyForchheimer::correct +( + fvVectorMatrix& UEqn, + const volScalarField& rho, + const volScalarField& mu +) const +{ + const vectorField& U = UEqn.psi(); + const scalarField& V = mesh_.V(); + scalarField& Udiag = UEqn.diag(); + vectorField& Usource = UEqn.source(); + + apply(Udiag, Usource, V, rho, mu, U); +} + + +void Foam::porosityModels::DarcyForchheimer::correct +( + const fvVectorMatrix& UEqn, + volTensorField& AU +) const +{ + const vectorField& U = UEqn.psi(); + + if (UEqn.dimensions() == dimForce) + { + const volScalarField& rho = + mesh_.lookupObject(rhoName_); + const volScalarField& mu = + mesh_.lookupObject(muName_); + + apply(AU, rho, mu, U); + } + else + { + const volScalarField& nu = + mesh_.lookupObject(nuName_); + + apply(AU, geometricOneField(), nu, U); + } +} + + +void Foam::porosityModels::DarcyForchheimer::writeData(Ostream& os) const +{ + os << indent << name_ << endl; + dict_.write(os); +} + + +// ************************************************************************* // diff --git a/src/finiteVolume/cfdTools/general/porosityModel/DarcyForchheimer/DarcyForchheimer.H b/src/finiteVolume/cfdTools/general/porosityModel/DarcyForchheimer/DarcyForchheimer.H new file mode 100644 index 0000000000..928422938a --- /dev/null +++ b/src/finiteVolume/cfdTools/general/porosityModel/DarcyForchheimer/DarcyForchheimer.H @@ -0,0 +1,187 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM 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. + + OpenFOAM 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 OpenFOAM. If not, see . + +Class + Foam::DarcyForchheimer + +Description + Darcy-Forchheimer law porosity model, given by: + + \f[ + S = - (\mu d + \frac{\rho |U|}{2} f) U + \f] + + where + \vartable + d | Darcy coefficient [1/m2] + f | Forchheimer coefficient [1/m] + \endvartable + + Since negative Darcy/Forchheimer parameters are invalid, they can be used + to specify a multiplier (of the max component). + + The orientation of the porous region is defined with the same notation as + a co-ordinate system, but only a Cartesian co-ordinate system is valid. + +SourceFiles + DarcyForchheimer.C + +\*---------------------------------------------------------------------------*/ + +#ifndef DarcyForchheimer_H +#define DarcyForchheimer_H + +#include "porosityModel.H" +#include "coordinateSystem.H" +#include "dimensionedTensor.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace porosityModels +{ + +/*---------------------------------------------------------------------------*\ + Class DarcyForchheimer Declaration +\*---------------------------------------------------------------------------*/ + +class DarcyForchheimer +: + public porosityModel +{ +private: + + // Private data + + //- Local co-ordinate system + coordinateSystem coordSys_; + + //- Darcy coefficient [1/m2] + dimensionedTensor D_; + + //- Forchheimer coefficient [1/m] + dimensionedTensor F_; + + //- Name of density field + word rhoName_; + + //- Name of dynamic viscosity field + word muName_; + + //- Name of kinematic viscosity field + word nuName_; + + + // Private Member Functions + + //- Apply + template + void apply + ( + scalarField& Udiag, + vectorField& Usource, + const scalarField& V, + const RhoFieldType& rho, + const scalarField& mu, + const vectorField& U + ) const; + + //- Apply + template + void apply + ( + tensorField& AU, + const RhoFieldType& rho, + const scalarField& mu, + const vectorField& U + ) const; + + //- Disallow default bitwise copy construct + DarcyForchheimer(const DarcyForchheimer&); + + //- Disallow default bitwise assignment + void operator=(const DarcyForchheimer&); + + +public: + + //- Runtime type information + TypeName("DarcyForchheimer"); + + //- Constructor + DarcyForchheimer + ( + const word& name, + const word& modelType, + const fvMesh& mesh, + const dictionary& dict + ); + + //- Destructor + virtual ~DarcyForchheimer(); + + + // Member Functions + + //- Add resistance + virtual void correct(fvVectorMatrix& UEqn) const; + + //- Add resistance + virtual void correct + ( + fvVectorMatrix& UEqn, + const volScalarField& rho, + const volScalarField& mu + ) const; + + //- Add resistance + virtual void correct + ( + const fvVectorMatrix& UEqn, + volTensorField& AU + ) const; + + + // I-O + + //- Write + void writeData(Ostream& os) const; +}; + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace porosityModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository + #include "DarcyForchheimerTemplates.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/finiteVolume/cfdTools/general/porosityModel/DarcyForchheimer/DarcyForchheimerTemplates.C b/src/finiteVolume/cfdTools/general/porosityModel/DarcyForchheimer/DarcyForchheimerTemplates.C new file mode 100644 index 0000000000..184206a010 --- /dev/null +++ b/src/finiteVolume/cfdTools/general/porosityModel/DarcyForchheimer/DarcyForchheimerTemplates.C @@ -0,0 +1,86 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM 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. + + OpenFOAM 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 OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +template +void Foam::porosityModels::DarcyForchheimer::apply +( + scalarField& Udiag, + vectorField& Usource, + const scalarField& V, + const RhoFieldType& rho, + const scalarField& mu, + const vectorField& U +) const +{ + const tensor& D = D_.value(); + const tensor& F = F_.value(); + + forAll(cellZoneIds_, zoneI) + { + const labelList& cells = mesh_.cellZones()[cellZoneIds_[zoneI]]; + + forAll(cells, i) + { + const label cellI = cells[i]; + + const tensor Cd = mu[cellI]*D + (rho[cellI]*mag(U[cellI]))*F; + + const scalar isoCd = tr(Cd); + + Udiag[cellI] += V[cellI]*isoCd; + Usource[cellI] -= V[cellI]*((Cd - I*isoCd) & U[cellI]); + } + } +} + + +template +void Foam::porosityModels::DarcyForchheimer::apply +( + tensorField& AU, + const RhoFieldType& rho, + const scalarField& mu, + const vectorField& U +) const +{ + const tensor& D = D_.value(); + const tensor& F = F_.value(); + + forAll(cellZoneIds_, zoneI) + { + const labelList& cells = mesh_.cellZones()[cellZoneIds_[zoneI]]; + + forAll(cells, i) + { + const label cellI = cells[i]; + AU[cellI] += mu[cellI]*D + (rho[cellI]*mag(U[cellI]))*F; + } + } +} + + +// ************************************************************************* // diff --git a/src/finiteVolume/cfdTools/general/porosityModel/porosityModel/IOporosityModelList.C b/src/finiteVolume/cfdTools/general/porosityModel/porosityModel/IOporosityModelList.C new file mode 100644 index 0000000000..2a655eefdd --- /dev/null +++ b/src/finiteVolume/cfdTools/general/porosityModel/porosityModel/IOporosityModelList.C @@ -0,0 +1,90 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM 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. + + OpenFOAM 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 OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "IOporosityModelList.H" +#include "fvMesh.H" +#include "Time.H" + +// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * // + +Foam::IOobject Foam::IOporosityModelList::createIOobject +( + const fvMesh& mesh +) const +{ + IOobject io + ( + "porosityProperties", + mesh.time().constant(), + mesh, + IOobject::MUST_READ, + IOobject::NO_WRITE + ); + + if (io.headerOk()) + { + Info<< "Creating porosity model list from " << io.name() << nl << endl; + + io.readOpt() = IOobject::MUST_READ_IF_MODIFIED; + return io; + } + else + { + Info<< "No porosity models present" << nl << endl; + + io.readOpt() = IOobject::NO_READ; + return io; + } +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::IOporosityModelList::IOporosityModelList +( + const fvMesh& mesh +) +: + IOdictionary(createIOobject(mesh)), + porosityModelList(mesh, *this) +{} + + +bool Foam::IOporosityModelList::read() +{ + if (regIOobject::read()) + { + porosityModelList::read(*this); + return true; + } + else + { + return false; + } +} + + +// ************************************************************************* // + diff --git a/src/finiteVolume/cfdTools/general/porosityModel/porosityModel/IOporosityModelList.H b/src/finiteVolume/cfdTools/general/porosityModel/porosityModel/IOporosityModelList.H new file mode 100644 index 0000000000..e9e534926a --- /dev/null +++ b/src/finiteVolume/cfdTools/general/porosityModel/porosityModel/IOporosityModelList.H @@ -0,0 +1,96 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM 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. + + OpenFOAM 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 OpenFOAM. If not, see . + +Class + Foam::IOporosityModelList + +Description + List of porosity models with IO functionality + +SourceFiles + IOporosityModelList.C + +\*---------------------------------------------------------------------------*/ + +#ifndef IOporosityModelList_H +#define IOporosityModelList_H + +#include "IOdictionary.H" +#include "porosityModelList.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class IOporosityModelList Declaration +\*---------------------------------------------------------------------------*/ + +class IOporosityModelList +: + public IOdictionary, + public porosityModelList +{ +private: + + // Private Member Functions + + //- Create IO object if dictionary is present + IOobject createIOobject(const fvMesh& mesh) const; + + //- Disallow default bitwise copy construct + IOporosityModelList(const IOporosityModelList&); + + //- Disallow default bitwise assignment + void operator=(const IOporosityModelList&); + + +public: + + // Constructors + + //- Construct from mesh + IOporosityModelList(const fvMesh& mesh); + + + //- Destructor + virtual ~IOporosityModelList() + {} + + + // Member Functions + + //- Read dictionary + virtual bool read(); +}; + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/finiteVolume/cfdTools/general/porosityModel/porosityModel/porosityModel.C b/src/finiteVolume/cfdTools/general/porosityModel/porosityModel/porosityModel.C new file mode 100644 index 0000000000..f0997c8222 --- /dev/null +++ b/src/finiteVolume/cfdTools/general/porosityModel/porosityModel/porosityModel.C @@ -0,0 +1,182 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM 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. + + OpenFOAM 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 OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "porosityModel.H" +#include "volFields.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(porosityModel, 0); + defineRunTimeSelectionTable(porosityModel, mesh); +} + + +// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * // + +void Foam::porosityModel::adjustNegativeResistance(dimensionedVector& resist) +{ + scalar maxCmpt = max(0, cmptMax(resist.value())); + + if (maxCmpt < 0) + { + FatalErrorIn + ( + "void Foam::porosityModel::adjustNegativeResistance" + "(" + "dimensionedVector&" + ")" + ) << "Negative resistances are invalid, resistance = " << resist + << exit(FatalError); + } + else + { + vector& val = resist.value(); + for (label cmpt = 0; cmpt < vector::nComponents; cmpt++) + { + if (val[cmpt] < 0) + { + val[cmpt] *= -maxCmpt; + } + } + } +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::porosityModel::porosityModel +( + const word& name, + const word& modelType, + const fvMesh& mesh, + const dictionary& dict +) +: + name_(name), + mesh_(mesh), + dict_(dict), + coeffs_(dict.subDict(modelType + "Coeffs")), + active_(readBool(dict_.lookup("active"))), + zoneName_(dict_.lookup("cellZone")), + cellZoneIds_(mesh_.cellZones().findIndices(zoneName_)) +{ + Info<< " creating porous zone: " << zoneName_ << endl; + + bool foundZone = !cellZoneIds_.empty(); + reduce(foundZone, orOp()); + + if (!foundZone && Pstream::master()) + { + FatalErrorIn + ( + "Foam::porosityModel::porosityModel" + "(" + "const word&, " + "const word&, " + "const fvMesh&, " + "const dictionary&" + ")" + ) << "cannot find porous cellZone " << zoneName_ + << exit(FatalError); + } +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::porosityModel::~porosityModel() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::porosityModel::porosityModel::addResistance +( + fvVectorMatrix& UEqn +) const +{ + if (cellZoneIds_.empty()) + { + return; + } + + this->correct(UEqn); +} + + +void Foam::porosityModel::porosityModel::addResistance +( + fvVectorMatrix& UEqn, + const volScalarField& rho, + const volScalarField& mu +) const +{ + if (cellZoneIds_.empty()) + { + return; + } + + this->correct(UEqn, rho, mu); +} + + +void Foam::porosityModel::porosityModel::addResistance +( + const fvVectorMatrix& UEqn, + volTensorField& AU, + bool correctAUprocBC +) const +{ + if (cellZoneIds_.empty()) + { + return; + } + + this->correct(UEqn, AU); + + if (correctAUprocBC) + { + // Correct the boundary conditions of the tensorial diagonal to ensure + // processor boundaries are correctly handled when AU^-1 is interpolated + // for the pressure equation. + AU.correctBoundaryConditions(); + } +} + + +bool Foam::porosityModel::read(const dictionary& dict) +{ + active_ = readBool(dict.lookup("active")); + coeffs_ = dict.subDict(type() + "Coeffs"); + dict.lookup("cellZone") >> zoneName_; + cellZoneIds_ = mesh_.cellZones().findIndices(zoneName_); + + return true; +} + + +// ************************************************************************* // diff --git a/src/finiteVolume/cfdTools/general/porosityModel/porosityModel/porosityModel.H b/src/finiteVolume/cfdTools/general/porosityModel/porosityModel/porosityModel.H new file mode 100644 index 0000000000..56131ba3dd --- /dev/null +++ b/src/finiteVolume/cfdTools/general/porosityModel/porosityModel/porosityModel.H @@ -0,0 +1,241 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM 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. + + OpenFOAM 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 OpenFOAM. If not, see . + +Class + Foam::porosityModel + +Description + Top level model for porosity models + +SourceFiles + porosityModel.C + porosityModelNew.C + +\*---------------------------------------------------------------------------*/ + +#ifndef porosityModel_H +#define porosityModel_H + +#include "fvMesh.H" +#include "dictionary.H" +#include "fvMatricesFwd.H" +#include "runTimeSelectionTables.H" +#include "dimensionedVector.H" +#include "keyType.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class porosityModel Declaration +\*---------------------------------------------------------------------------*/ + +class porosityModel +{ +private: + + // Private Member Functions + + //- Disallow default bitwise copy construct + porosityModel(const porosityModel&); + + //- Disallow default bitwise assignment + void operator=(const porosityModel&); + + +protected: + + // Protected data + + //- Porosity name + word name_; + + //- Reference to the mesh database + const fvMesh& mesh_; + + //- Dictionary used for model construction + const dictionary dict_; + + //- Model coefficients dictionary + dictionary coeffs_; + + //- Porosity active flag + bool active_; + + //- Name(s) of cell-zone + keyType zoneName_; + + //- Cell zone Ids + labelList cellZoneIds_; + + + // Protected Member Functions + + //- Adjust negative resistance values to be multiplier of max value + void adjustNegativeResistance(dimensionedVector& resist); + + virtual void correct(fvVectorMatrix& UEqn) const = 0; + + virtual void correct + ( + fvVectorMatrix& UEqn, + const volScalarField& rho, + const volScalarField& mu + ) const = 0; + + virtual void correct + ( + const fvVectorMatrix& UEqn, + volTensorField& AU + ) const = 0; + + +public: + + //- Runtime type information + TypeName("porosityModel"); + + //- Selection table + declareRunTimeSelectionTable + ( + autoPtr, + porosityModel, + mesh, + ( + const word& modelName, + const word& name, + const fvMesh& mesh, + const dictionary& dict + ), + (modelName, name, mesh, dict) + ); + + //- Constructor + porosityModel + ( + const word& name, + const word& modelType, + const fvMesh& mesh, + const dictionary& dict + ); + + //- Return pointer to new porosityModel object created on the freestore + // from an Istream + class iNew + { + //- Reference to the mesh database + const fvMesh& mesh_; + const word& name_; + + public: + + iNew + ( + const fvMesh& mesh, + const word& name + ) + : + mesh_(mesh), + name_(name) + {} + + autoPtr operator()(Istream& is) const + { + const dictionary dict(is); + + return autoPtr + ( + porosityModel::New + ( + name_, + mesh_, + dict + ) + ); + } + }; + + //- Selector + static autoPtr New + ( + const word& name, + const fvMesh& mesh, + const dictionary& dict + ); + + //- Destructor + virtual ~porosityModel(); + + + // Member Functions + + //- Return const access to the porosity model name + inline const word& name() const; + + //- Return const access to the porosity active flag + inline bool active() const; + + //- Add resistance + virtual void addResistance(fvVectorMatrix& UEqn) const; + + //- Add resistance + virtual void addResistance + ( + fvVectorMatrix& UEqn, + const volScalarField& rho, + const volScalarField& mu + ) const; + + //- Add resistance + virtual void addResistance + ( + const fvVectorMatrix& UEqn, + volTensorField& AU, + bool correctAUprocBC + ) const; + + + // I-O + + //- Write + virtual void writeData(Ostream& os) const = 0; + + //- Read porosity dictionary + virtual bool read(const dictionary& dict); +}; + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "porosityModelI.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/finiteVolume/cfdTools/general/porosityModel/porosityModel/porosityModelI.H b/src/finiteVolume/cfdTools/general/porosityModel/porosityModel/porosityModelI.H new file mode 100644 index 0000000000..1df2d11972 --- /dev/null +++ b/src/finiteVolume/cfdTools/general/porosityModel/porosityModel/porosityModelI.H @@ -0,0 +1,38 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM 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. + + OpenFOAM 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 OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +inline const Foam::word& Foam::porosityModel::name() const +{ + return name_; +} + + +inline bool Foam::porosityModel::active() const +{ + return active_; +} + + +// ************************************************************************* // diff --git a/src/finiteVolume/cfdTools/general/porosityModel/porosityModel/porosityModelList.C b/src/finiteVolume/cfdTools/general/porosityModel/porosityModel/porosityModelList.C new file mode 100644 index 0000000000..14ab39d964 --- /dev/null +++ b/src/finiteVolume/cfdTools/general/porosityModel/porosityModel/porosityModelList.C @@ -0,0 +1,183 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM 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. + + OpenFOAM 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 OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "porosityModelList.H" +#include "volFields.H" + +// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * // +/* +void Foam::porosityModelList::XXX() +{} +*/ + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::porosityModelList::porosityModelList +( + const fvMesh& mesh, + const dictionary& dict +) +: + PtrList(), + mesh_(mesh) +{ + reset(dict); +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::porosityModelList::~porosityModelList() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +bool Foam::porosityModelList::active() const +{ + bool a = false; + forAll(*this, i) + { + a = a || this->operator[](i).active(); + } + + if (!a) + { + Info<< "No porosity models active" << endl; + } + + return a; +} + + +void Foam::porosityModelList::reset(const dictionary& dict) +{ + label count = 0; + forAllConstIter(dictionary, dict, iter) + { + if (iter().isDict()) + { + count++; + } + } + + this->setSize(count); + label i = 0; + forAllConstIter(dictionary, dict, iter) + { + if (iter().isDict()) + { + const word& name = iter().keyword(); + const dictionary& modelDict = iter().dict(); + + this->set + ( + i++, + porosityModel::New(name, mesh_, modelDict) + ); + } + } +} + + +bool Foam::porosityModelList::read(const dictionary& dict) +{ + bool allOk = true; + forAll(*this, i) + { + porosityModel& pm = this->operator[](i); + bool ok = pm.read(dict.subDict(pm.name())); + allOk = (allOk && ok); + } + return allOk; +} + + +bool Foam::porosityModelList::writeData(Ostream& os) const +{ + forAll(*this, i) + { + os << nl; + this->operator[](i).writeData(os); + } + + return os.good(); +} + + +void Foam::porosityModelList::addResistance +( + fvVectorMatrix& UEqn +) const +{ + forAll(*this, i) + { + this->operator[](i).addResistance(UEqn); + } +} + + +void Foam::porosityModelList::addResistance +( + fvVectorMatrix& UEqn, + const volScalarField& rho, + const volScalarField& mu +) const +{ + forAll(*this, i) + { + this->operator[](i).addResistance(UEqn, rho, mu); + } +} + + +void Foam::porosityModelList::addResistance +( + const fvVectorMatrix& UEqn, + volTensorField& AU, + bool correctAUprocBC +) const +{ + forAll(*this, i) + { + this->operator[](i).addResistance(UEqn, AU, correctAUprocBC); + } +} + + +// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * // + +Foam::Ostream& Foam::operator<< +( + Ostream& os, + const porosityModelList& models +) +{ + models.writeData(os); + return os; +} + + +// ************************************************************************* // diff --git a/src/finiteVolume/cfdTools/general/porosityModel/porosityModel/porosityModelList.H b/src/finiteVolume/cfdTools/general/porosityModel/porosityModel/porosityModelList.H new file mode 100644 index 0000000000..e580a2d0fa --- /dev/null +++ b/src/finiteVolume/cfdTools/general/porosityModel/porosityModel/porosityModelList.H @@ -0,0 +1,140 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM 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. + + OpenFOAM 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 OpenFOAM. If not, see . + +Class + Foam::porosityModelList + +Description + List container for porosity models + +SourceFiles + porosityModelList.C + +\*---------------------------------------------------------------------------*/ + +#ifndef porosityModelList_H +#define porosityModelList_H + +#include "fvMesh.H" +#include "dictionary.H" +#include "fvMatricesFwd.H" +#include "porosityModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// Forward declaration of friend functions and operators +class porosityModelList; +Ostream& operator<<(Ostream& os, const porosityModelList& models); + +/*---------------------------------------------------------------------------*\ + Class porosityModelList Declaration +\*---------------------------------------------------------------------------*/ + +class porosityModelList +: + PtrList +{ +private: + + // Private Member Functions + + //- Disallow default bitwise copy construct + porosityModelList(const porosityModelList&); + + //- Disallow default bitwise assignment + void operator=(const porosityModelList&); + + +protected: + + // Protected data + + //- Reference to the mesh database + const fvMesh& mesh_; + + +public: + + //- Constructor + porosityModelList(const fvMesh& mesh, const dictionary& dict); + + //- Destructor + ~porosityModelList(); + + + // Member Functions + + //- Return active status + bool active() const; + + //- Reset the source list + void reset(const dictionary& dict); + + //- Add resistance + void addResistance(fvVectorMatrix& UEqn) const; + + //- Add resistance + void addResistance + ( + fvVectorMatrix& UEqn, + const volScalarField& rho, + const volScalarField& mu + ) const; + + //- Add resistance + void addResistance + ( + const fvVectorMatrix& UEqn, + volTensorField& AU, + bool correctAUprocBC = true + ) const; + + + // I-O + + //- Read dictionary + bool read(const dictionary& dict); + + //- Write data to Ostream + bool writeData(Ostream& os) const; + + //- Ostream operator + friend Ostream& operator<< + ( + Ostream& os, + const porosityModelList& models + ); +}; + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/finiteVolume/cfdTools/general/porosityModel/porosityModel/porosityModelNew.C b/src/finiteVolume/cfdTools/general/porosityModel/porosityModel/porosityModelNew.C new file mode 100644 index 0000000000..1da8c91c4d --- /dev/null +++ b/src/finiteVolume/cfdTools/general/porosityModel/porosityModel/porosityModelNew.C @@ -0,0 +1,66 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM 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. + + OpenFOAM 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 OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "porosityModel.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::autoPtr Foam::porosityModel::New +( + const word& name, + const fvMesh& mesh, + const dictionary& dict +) +{ + const word modelType(dict.lookup("type")); + + Info<< "Porosity region " << name << ":" << nl + << " selecting model: " << modelType << endl; + + meshConstructorTable::iterator cstrIter = + meshConstructorTablePtr_->find(modelType); + + if (cstrIter == meshConstructorTablePtr_->end()) + { + FatalErrorIn + ( + "porosityModel::New" + "(" + "const word& name," + "const fvMesh&, " + "const dictionary&" + ")" + ) + << "Unknown " << typeName << " type " << modelType << nl << nl + << "Valid " << typeName << " types are:" << nl + << meshConstructorTablePtr_->sortedToc() + << exit(FatalError); + } + + return autoPtr(cstrIter()(name, modelType, mesh, dict)); +} + + +// ************************************************************************* // diff --git a/src/finiteVolume/cfdTools/general/porosityModel/powerLaw/powerLaw.C b/src/finiteVolume/cfdTools/general/porosityModel/powerLaw/powerLaw.C new file mode 100644 index 0000000000..15fbae39df --- /dev/null +++ b/src/finiteVolume/cfdTools/general/porosityModel/powerLaw/powerLaw.C @@ -0,0 +1,135 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM 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. + + OpenFOAM 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 OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "addToRunTimeSelectionTable.H" +#include "powerLaw.H" +#include "geometricOneField.H" +#include "fvMatrices.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + namespace porosityModels + { + defineTypeNameAndDebug(powerLaw, 0); + addToRunTimeSelectionTable(porosityModel, powerLaw, mesh); + } +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::porosityModels::powerLaw::powerLaw +( + const word& name, + const word& modelType, + const fvMesh& mesh, + const dictionary& dict +) +: + porosityModel(name, modelType, mesh, dict), + C0_(readScalar(coeffs_.lookup("C0"))), + C1_(readScalar(coeffs_.lookup("C1"))), + rhoName_(coeffs_.lookupOrDefault("rho", "rho")) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::porosityModels::powerLaw::~powerLaw() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::porosityModels::powerLaw::correct +( + fvVectorMatrix& UEqn +) const +{ + const vectorField& U = UEqn.psi(); + const scalarField& V = mesh_.V(); + scalarField& Udiag = UEqn.diag(); + + if (UEqn.dimensions() == dimForce) + { + const volScalarField& rho = + mesh_.lookupObject(rhoName_); + + apply(Udiag, V, rho, U); + } + else + { + apply(Udiag, V, geometricOneField(), U); + } +} + + +void Foam::porosityModels::powerLaw::correct +( + fvVectorMatrix& UEqn, + const volScalarField& rho, + const volScalarField& mu +) const +{ + const vectorField& U = UEqn.psi(); + const scalarField& V = mesh_.V(); + scalarField& Udiag = UEqn.diag(); + + apply(Udiag, V, rho, U); +} + + +void Foam::porosityModels::powerLaw::correct +( + const fvVectorMatrix& UEqn, + volTensorField& AU +) const +{ + const vectorField& U = UEqn.psi(); + + if (UEqn.dimensions() == dimForce) + { + const volScalarField& rho = + mesh_.lookupObject(rhoName_); + + apply(AU, rho, U); + } + else + { + apply(AU, geometricOneField(), U); + } +} + + +void Foam::porosityModels::powerLaw::writeData(Ostream& os) const +{ + os << indent << name_ << endl; + dict_.write(os); +} + + +// ************************************************************************* // diff --git a/src/finiteVolume/cfdTools/general/porosityModel/powerLaw/powerLaw.H b/src/finiteVolume/cfdTools/general/porosityModel/powerLaw/powerLaw.H new file mode 100644 index 0000000000..070a00e9a0 --- /dev/null +++ b/src/finiteVolume/cfdTools/general/porosityModel/powerLaw/powerLaw.H @@ -0,0 +1,168 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM 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. + + OpenFOAM 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 OpenFOAM. If not, see . + +Class + Foam::powerLaw + +Description + Power law porosity model, given by: + + \f[ + S = - \rho C_0 |U|^{(C_1 - 1)} U + \f] + + where + \vartable + C_0 | model coefficient + C_1 | model coefficient + \endvartable + + +SourceFiles + powerLaw.C + +\*---------------------------------------------------------------------------*/ + +#ifndef powerLaw_H +#define powerLaw_H + +#include "porosityModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace porosityModels +{ + +/*---------------------------------------------------------------------------*\ + Class powerLaw Declaration +\*---------------------------------------------------------------------------*/ + +class powerLaw +: + public porosityModel +{ +private: + + // Private data + + //- C0 coefficient + scalar C0_; + + //- C1 coefficient + scalar C1_; + + //- Name of density field + word rhoName_; + + + // Private Member Functions + + //- Apply resistance + template + void apply + ( + scalarField& Udiag, + const scalarField& V, + const RhoFieldType& rho, + const vectorField& U + ) const; + + //- Apply resistance + template + void apply + ( + tensorField& AU, + const RhoFieldType& rho, + const vectorField& U + ) const; + + //- Disallow default bitwise copy construct + powerLaw(const powerLaw&); + + //- Disallow default bitwise assignment + void operator=(const powerLaw&); + + +public: + + //- Runtime type information + TypeName("powerLaw"); + + //- Constructor + powerLaw + ( + const word& name, + const word& modelType, + const fvMesh& mesh, + const dictionary& dict + ); + + //- Destructor + virtual ~powerLaw(); + + + // Member Functions + + //- Add resistance + virtual void correct(fvVectorMatrix& UEqn) const; + + //- Add resistance + virtual void correct + ( + fvVectorMatrix& UEqn, + const volScalarField& rho, + const volScalarField& mu + ) const; + + //- Add resistance + virtual void correct + ( + const fvVectorMatrix& UEqn, + volTensorField& AU + ) const; + + + // I-O + + //- Write + void writeData(Ostream& os) const; +}; + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace porosityModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository + #include "powerLawTemplates.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/finiteVolume/cfdTools/general/porosityModel/powerLaw/powerLawTemplates.C b/src/finiteVolume/cfdTools/general/porosityModel/powerLaw/powerLawTemplates.C new file mode 100644 index 0000000000..0e1d7d2343 --- /dev/null +++ b/src/finiteVolume/cfdTools/general/porosityModel/powerLaw/powerLawTemplates.C @@ -0,0 +1,81 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM 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. + + OpenFOAM 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 OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +template +void Foam::porosityModels::powerLaw::apply +( + scalarField& Udiag, + const scalarField& V, + const RhoFieldType& rho, + const vectorField& U +) const +{ + const scalar C0 = C0_; + const scalar C1m1b2 = (C1_ - 1.0)/2.0; + + forAll(cellZoneIds_, zoneI) + { + const labelList& cells = mesh_.cellZones()[cellZoneIds_[zoneI]]; + + forAll(cells, i) + { + const label cellI = cells[i]; + + Udiag[cellI] += + V[cellI]*rho[cellI]*C0*pow(magSqr(U[cellI]), C1m1b2); + } + } +} + + +template +void Foam::porosityModels::powerLaw::apply +( + tensorField& AU, + const RhoFieldType& rho, + const vectorField& U +) const +{ + const scalar C0 = C0_; + const scalar C1m1b2 = (C1_ - 1.0)/2.0; + + forAll(cellZoneIds_, zoneI) + { + const labelList& cells = mesh_.cellZones()[cellZoneIds_[zoneI]]; + + forAll(cells, i) + { + const label cellI = cells[i]; + + AU[cellI] = + AU[cellI] + I*(rho[cellI]*C0*pow(magSqr(U[cellI]), C1m1b2)); + } + } +} + + +// ************************************************************************* // From 4cc5aa152e34e675c80e24e56a495b0ffaae40f7 Mon Sep 17 00:00:00 2001 From: andy Date: Thu, 18 Oct 2012 15:43:56 +0100 Subject: [PATCH 06/25] ENH: Updated porousSimpleFoam after porosity model updates --- .../simpleFoam/porousSimpleFoam/createPorousZones.H | 4 ++-- .../simpleFoam/porousSimpleFoam/porousSimpleFoam.C | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/applications/solvers/incompressible/simpleFoam/porousSimpleFoam/createPorousZones.H b/applications/solvers/incompressible/simpleFoam/porousSimpleFoam/createPorousZones.H index e4614b7063..5c6dbea19c 100644 --- a/applications/solvers/incompressible/simpleFoam/porousSimpleFoam/createPorousZones.H +++ b/applications/solvers/incompressible/simpleFoam/porousSimpleFoam/createPorousZones.H @@ -1,9 +1,9 @@ - porousZones pZones(mesh); + IOporosityModelList pZones(mesh); Switch pressureImplicitPorosity(false); // nUCorrectors used for pressureImplicitPorosity int nUCorr = 0; - if (pZones.size()) + if (pZones.active()) { // nUCorrectors for pressureImplicitPorosity nUCorr = simple.dict().lookupOrDefault("nUCorrectors", 0); diff --git a/applications/solvers/incompressible/simpleFoam/porousSimpleFoam/porousSimpleFoam.C b/applications/solvers/incompressible/simpleFoam/porousSimpleFoam/porousSimpleFoam.C index ef10119a9e..bde78bcbe1 100644 --- a/applications/solvers/incompressible/simpleFoam/porousSimpleFoam/porousSimpleFoam.C +++ b/applications/solvers/incompressible/simpleFoam/porousSimpleFoam/porousSimpleFoam.C @@ -33,7 +33,7 @@ Description #include "fvCFD.H" #include "singlePhaseTransportModel.H" #include "RASModel.H" -#include "porousZones.H" +#include "IOporosityModelList.H" #include "simpleControl.H" #include "IObasicSourceList.H" From af8f5ed606f4efed742b3f05f69404531f81f4ec Mon Sep 17 00:00:00 2001 From: andy Date: Thu, 18 Oct 2012 16:39:06 +0100 Subject: [PATCH 07/25] ENH: Updates to porosity solvers --- .../rhoPorousMRFLTSPimpleFoam/rhoPorousMRFLTSPimpleFoam.C | 2 +- .../rhoPimpleFoam/rhoPorousMRFPimpleFoam/createZones.H | 2 +- .../rhoPorousMRFPimpleFoam/rhoPorousMRFPimpleFoam.C | 2 +- .../rhoSimpleFoam/rhoPorousMRFSimpleFoam/createZones.H | 2 +- .../heatTransfer/chtMultiRegionFoam/chtMultiRegionFoam.C | 2 +- .../chtMultiRegionSimpleFoam/chtMultiRegionSimpleFoam.C | 2 +- .../chtMultiRegionSimpleFoam/fluid/createFluidFields.H | 4 ++-- .../chtMultiRegionSimpleFoam/fluid/setRegionFluidFields.H | 2 +- .../heatTransfer/chtMultiRegionFoam/fluid/createFluidFields.H | 4 ++-- .../chtMultiRegionFoam/fluid/setRegionFluidFields.H | 2 +- .../LTSReactingParcelFoam/LTSReactingParcelFoam.C | 2 +- .../solvers/lagrangian/reactingParcelFoam/createPorousZones.H | 2 +- applications/solvers/lagrangian/reactingParcelFoam/pEqn.H | 2 +- .../lagrangian/reactingParcelFoam/reactingParcelFoam.C | 2 +- .../multiphase/interFoam/porousInterFoam/createPorousZones.H | 2 +- .../multiphase/interFoam/porousInterFoam/porousInterFoam.C | 4 ++-- 16 files changed, 19 insertions(+), 19 deletions(-) diff --git a/applications/solvers/compressible/rhoPimpleFoam/rhoPorousMRFLTSPimpleFoam/rhoPorousMRFLTSPimpleFoam.C b/applications/solvers/compressible/rhoPimpleFoam/rhoPorousMRFLTSPimpleFoam/rhoPorousMRFLTSPimpleFoam.C index 3a8eb884ba..d729b46c37 100644 --- a/applications/solvers/compressible/rhoPimpleFoam/rhoPorousMRFLTSPimpleFoam/rhoPorousMRFLTSPimpleFoam.C +++ b/applications/solvers/compressible/rhoPimpleFoam/rhoPorousMRFLTSPimpleFoam/rhoPorousMRFLTSPimpleFoam.C @@ -38,7 +38,7 @@ Description #include "psiThermo.H" #include "turbulenceModel.H" #include "MRFZones.H" -#include "porousZones.H" +#include "IOporosityModelList.H" #include "fvcSmooth.H" #include "pimpleControl.H" #include "bound.H" diff --git a/applications/solvers/compressible/rhoPimpleFoam/rhoPorousMRFPimpleFoam/createZones.H b/applications/solvers/compressible/rhoPimpleFoam/rhoPorousMRFPimpleFoam/createZones.H index 487a55d8ed..d2522b8c75 100644 --- a/applications/solvers/compressible/rhoPimpleFoam/rhoPorousMRFPimpleFoam/createZones.H +++ b/applications/solvers/compressible/rhoPimpleFoam/rhoPorousMRFPimpleFoam/createZones.H @@ -1,5 +1,5 @@ MRFZones mrfZones(mesh); mrfZones.correctBoundaryVelocity(U); - porousZones pZones(mesh); + IOporosityModelList pZones(mesh); Switch pressureImplicitPorosity(false); diff --git a/applications/solvers/compressible/rhoPimpleFoam/rhoPorousMRFPimpleFoam/rhoPorousMRFPimpleFoam.C b/applications/solvers/compressible/rhoPimpleFoam/rhoPorousMRFPimpleFoam/rhoPorousMRFPimpleFoam.C index 16e6c0ad74..47b3d6c35a 100644 --- a/applications/solvers/compressible/rhoPimpleFoam/rhoPorousMRFPimpleFoam/rhoPorousMRFPimpleFoam.C +++ b/applications/solvers/compressible/rhoPimpleFoam/rhoPorousMRFPimpleFoam/rhoPorousMRFPimpleFoam.C @@ -38,7 +38,7 @@ Description #include "turbulenceModel.H" #include "bound.H" #include "MRFZones.H" -#include "porousZones.H" +#include "IOporosityModelList.H" #include "pimpleControl.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/applications/solvers/compressible/rhoSimpleFoam/rhoPorousMRFSimpleFoam/createZones.H b/applications/solvers/compressible/rhoSimpleFoam/rhoPorousMRFSimpleFoam/createZones.H index 0ed5afa274..e3cfd61f43 100644 --- a/applications/solvers/compressible/rhoSimpleFoam/rhoPorousMRFSimpleFoam/createZones.H +++ b/applications/solvers/compressible/rhoSimpleFoam/rhoPorousMRFSimpleFoam/createZones.H @@ -6,7 +6,7 @@ // nUCorrectors used for pressureImplicitPorosity int nUCorr = 0; - if (pZones.size()) + if (pZones.active()) { // nUCorrectors for pressureImplicitPorosity simple.dict().readIfPresent("nUCorrectors", nUCorr); diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionFoam.C b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionFoam.C index 25e661dfc3..557017ccad 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionFoam.C +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionFoam.C @@ -45,7 +45,7 @@ Description #include "solidRegionDiffNo.H" #include "solidThermo.H" #include "radiationModel.H" -#include "porousZones.H" +#include "IOporosityModelList.H" #include "IObasicSourceList.H" diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/chtMultiRegionSimpleFoam.C b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/chtMultiRegionSimpleFoam.C index c875d850cd..2f4b801cb3 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/chtMultiRegionSimpleFoam.C +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/chtMultiRegionSimpleFoam.C @@ -36,7 +36,7 @@ Description #include "regionProperties.H" #include "solidThermo.H" #include "radiationModel.H" -#include "porousZones.H" +#include "IOporosityModelList.H" #include "IObasicSourceList.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/fluid/createFluidFields.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/fluid/createFluidFields.H index c34b547350..3d66fa798b 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/fluid/createFluidFields.H +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/fluid/createFluidFields.H @@ -18,7 +18,7 @@ PtrList rhoMin(fluidRegions.size()); PtrList heatSources(fluidRegions.size()); - PtrList porousZonesFluid(fluidRegions.size()); + PtrList porousZonesFluid(fluidRegions.size()); // Populate fluid field pointer lists forAll(fluidRegions, i) @@ -205,7 +205,7 @@ porousZonesFluid.set ( i, - new porousZones(fluidRegions[i]) + new IOporosityModelList(fluidRegions[i]) ); } diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/fluid/setRegionFluidFields.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/fluid/setRegionFluidFields.H index 3abad39417..4f15d8c619 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/fluid/setRegionFluidFields.H +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/fluid/setRegionFluidFields.H @@ -14,7 +14,7 @@ IObasicSourceList& sources = heatSources[i]; - const porousZones& pZones = porousZonesFluid[i]; + const IOporosityModelList& pZones = porousZonesFluid[i]; const dimensionedScalar initialMass ( diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/createFluidFields.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/createFluidFields.H index 81cb541ea4..a2021a5edc 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/createFluidFields.H +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/createFluidFields.H @@ -15,7 +15,7 @@ List initialMassFluid(fluidRegions.size()); PtrList heatSources(fluidRegions.size()); - PtrList porousZonesFluid(fluidRegions.size()); + PtrList porousZonesFluid(fluidRegions.size()); // Populate fluid field pointer lists forAll(fluidRegions, i) @@ -202,6 +202,6 @@ porousZonesFluid.set ( i, - new porousZones(fluidRegions[i]) + new IOporosityModelList(fluidRegions[i]) ); } diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/setRegionFluidFields.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/setRegionFluidFields.H index 04986d1289..28f0ea9683 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/setRegionFluidFields.H +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/setRegionFluidFields.H @@ -22,7 +22,7 @@ IObasicSourceList& sources = heatSources[i]; - const porousZones& pZones = porousZonesFluid[i]; + const IOporosityModelList& pZones = porousZonesFluid[i]; const dimensionedScalar initialMass ( diff --git a/applications/solvers/lagrangian/reactingParcelFoam/LTSReactingParcelFoam/LTSReactingParcelFoam.C b/applications/solvers/lagrangian/reactingParcelFoam/LTSReactingParcelFoam/LTSReactingParcelFoam.C index fabb0bba60..4ea17727d9 100644 --- a/applications/solvers/lagrangian/reactingParcelFoam/LTSReactingParcelFoam/LTSReactingParcelFoam.C +++ b/applications/solvers/lagrangian/reactingParcelFoam/LTSReactingParcelFoam/LTSReactingParcelFoam.C @@ -40,7 +40,7 @@ Description #include "basicReactingMultiphaseCloud.H" #include "rhoCombustionModel.H" #include "radiationModel.H" -#include "porousZones.H" +#include "IOporosityModelList.H" #include "IObasicSourceList.H" #include "SLGThermo.H" #include "fvcSmooth.H" diff --git a/applications/solvers/lagrangian/reactingParcelFoam/createPorousZones.H b/applications/solvers/lagrangian/reactingParcelFoam/createPorousZones.H index 90506856d2..05f0f044ce 100644 --- a/applications/solvers/lagrangian/reactingParcelFoam/createPorousZones.H +++ b/applications/solvers/lagrangian/reactingParcelFoam/createPorousZones.H @@ -1,3 +1,3 @@ Info<< "Creating porous zones" << nl << endl; - porousZones pZones(mesh); + IOporosityModelList pZones(mesh); diff --git a/applications/solvers/lagrangian/reactingParcelFoam/pEqn.H b/applications/solvers/lagrangian/reactingParcelFoam/pEqn.H index 5b90227323..1bcdf7c92f 100644 --- a/applications/solvers/lagrangian/reactingParcelFoam/pEqn.H +++ b/applications/solvers/lagrangian/reactingParcelFoam/pEqn.H @@ -10,7 +10,7 @@ HbyA = rAU*(UEqn == sources(rho, U))().H(); surfaceScalarField phiHbyA("phiHbyA", fvc::interpolate(HbyA) & mesh.Sf()); - if (pZones.size() == 0) + if (!pZones.active()) { // ddtPhiCorr only used without porosity phiHbyA += fvc::ddtPhiCorr(rAU, rho, U, phi); diff --git a/applications/solvers/lagrangian/reactingParcelFoam/reactingParcelFoam.C b/applications/solvers/lagrangian/reactingParcelFoam/reactingParcelFoam.C index 8ef6838c59..a8f4328543 100644 --- a/applications/solvers/lagrangian/reactingParcelFoam/reactingParcelFoam.C +++ b/applications/solvers/lagrangian/reactingParcelFoam/reactingParcelFoam.C @@ -44,7 +44,7 @@ Description #include "basicReactingMultiphaseCloud.H" #include "rhoCombustionModel.H" #include "radiationModel.H" -#include "porousZones.H" +#include "IOporosityModelList.H" #include "IObasicSourceList.H" #include "SLGThermo.H" #include "pimpleControl.H" diff --git a/applications/solvers/multiphase/interFoam/porousInterFoam/createPorousZones.H b/applications/solvers/multiphase/interFoam/porousInterFoam/createPorousZones.H index 430b466aac..983906074a 100644 --- a/applications/solvers/multiphase/interFoam/porousInterFoam/createPorousZones.H +++ b/applications/solvers/multiphase/interFoam/porousInterFoam/createPorousZones.H @@ -1 +1 @@ - porousZones pZones(mesh); + IOporosityModelList pZones(mesh); diff --git a/applications/solvers/multiphase/interFoam/porousInterFoam/porousInterFoam.C b/applications/solvers/multiphase/interFoam/porousInterFoam/porousInterFoam.C index 891736c77f..244ea75fae 100644 --- a/applications/solvers/multiphase/interFoam/porousInterFoam/porousInterFoam.C +++ b/applications/solvers/multiphase/interFoam/porousInterFoam/porousInterFoam.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -44,7 +44,7 @@ Description #include "interfaceProperties.H" #include "twoPhaseMixture.H" #include "turbulenceModel.H" -#include "porousZones.H" +#include "IOporosityModelList.H" #include "pimpleControl.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // From 97ac66ad9e02352464e6bcbd4acad8b1641f2b48 Mon Sep 17 00:00:00 2001 From: andy Date: Thu, 18 Oct 2012 17:31:11 +0100 Subject: [PATCH 08/25] ENH: Updated porosity-based tutorials --- .../angledDuct/constant/porosityProperties} | 24 ++++++----- .../angledDuct/constant/porosityProperties} | 23 ++++++----- .../angledDuct/constant/porosityProperties} | 23 ++++++----- .../constant/porosityProperties} | 23 ++++++----- .../mixerVessel2D/constant/porousZones | 36 ----------------- .../{porousZones => porosityProperties} | 40 ++++++++++--------- .../angledDuctImplicit/constant/porousZones | 36 ----------------- .../filter/constant/porosityProperties} | 27 +++++++------ .../parcelInBox/constant/porousZones | 38 ------------------ .../verticalChannel/constant/porousZones | 38 ------------------ 10 files changed, 85 insertions(+), 223 deletions(-) rename tutorials/compressible/{rhoPorousMRFLTSPimpleFoam/angledDuct/constant/porousZones => rhoPimpleFoam/ras/angledDuct/constant/porosityProperties} (78%) rename tutorials/compressible/{rhoPimpleFoam/ras/angledDuct/constant/porousZones => rhoPimplecFoam/angledDuct/constant/porosityProperties} (78%) rename tutorials/compressible/{rhoPimplecFoam/angledDuct/constant/porousZones => rhoPorousMRFLTSPimpleFoam/angledDuct/constant/porosityProperties} (78%) rename tutorials/{lagrangian/reactingParcelFoam/filter/constant/porousZones => compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/constant/porosityProperties} (78%) delete mode 100644 tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/constant/porousZones rename tutorials/compressible/rhoPorousMRFSimpleFoam/angledDuctImplicit/constant/{porousZones => porosityProperties} (70%) delete mode 100644 tutorials/incompressible/porousSimpleFoam/angledDuctImplicit/constant/porousZones rename tutorials/lagrangian/{LTSReactingParcelFoam/verticalChannel/constant/porousZones => reactingParcelFoam/filter/constant/porosityProperties} (86%) delete mode 100644 tutorials/lagrangian/reactingParcelFoam/parcelInBox/constant/porousZones delete mode 100644 tutorials/lagrangian/reactingParcelFoam/verticalChannel/constant/porousZones diff --git a/tutorials/compressible/rhoPorousMRFLTSPimpleFoam/angledDuct/constant/porousZones b/tutorials/compressible/rhoPimpleFoam/ras/angledDuct/constant/porosityProperties similarity index 78% rename from tutorials/compressible/rhoPorousMRFLTSPimpleFoam/angledDuct/constant/porousZones rename to tutorials/compressible/rhoPimpleFoam/ras/angledDuct/constant/porosityProperties index afeb6461e1..650f01268c 100644 --- a/tutorials/compressible/rhoPorousMRFLTSPimpleFoam/angledDuct/constant/porousZones +++ b/tutorials/compressible/rhoPimpleFoam/ras/angledDuct/constant/porosityProperties @@ -11,26 +11,28 @@ FoamFile format ascii; class dictionary; location "constant"; - object porousZones; + object porosityProperties; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -1 -( - porosity +porosity1 +{ + type DarcyForchheimer; + active yes; + cellZone porosity; + + DarcyForchheimerCoeffs { + d d [0 -2 0 0 0 0 0] (5e7 -1000 -1000); + f f [0 -1 0 0 0 0 0] (0 0 0); + coordinateSystem { e1 (0.70710678 0.70710678 0); e2 (0 0 1); } - - Darcy - { - d d [0 -2 0 0 0 0 0] (5e7 -1000 -1000); - f f [0 -1 0 0 0 0 0] (0 0 0); - } } -) +} + // ************************************************************************* // diff --git a/tutorials/compressible/rhoPimpleFoam/ras/angledDuct/constant/porousZones b/tutorials/compressible/rhoPimplecFoam/angledDuct/constant/porosityProperties similarity index 78% rename from tutorials/compressible/rhoPimpleFoam/ras/angledDuct/constant/porousZones rename to tutorials/compressible/rhoPimplecFoam/angledDuct/constant/porosityProperties index afeb6461e1..22add8ff29 100644 --- a/tutorials/compressible/rhoPimpleFoam/ras/angledDuct/constant/porousZones +++ b/tutorials/compressible/rhoPimplecFoam/angledDuct/constant/porosityProperties @@ -11,26 +11,27 @@ FoamFile format ascii; class dictionary; location "constant"; - object porousZones; + object porosityProperties; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -1 -( - porosity +porosity1 +{ + type DarcyForchheimer; + active yes; + cellZone porosity; + + DarcyForchheimerCoeffs { + d d [0 -2 0 0 0 0 0] (5e7 -1000 -1000); + f f [0 -1 0 0 0 0 0] (0 0 0); + coordinateSystem { e1 (0.70710678 0.70710678 0); e2 (0 0 1); } - - Darcy - { - d d [0 -2 0 0 0 0 0] (5e7 -1000 -1000); - f f [0 -1 0 0 0 0 0] (0 0 0); - } } -) +} // ************************************************************************* // diff --git a/tutorials/compressible/rhoPimplecFoam/angledDuct/constant/porousZones b/tutorials/compressible/rhoPorousMRFLTSPimpleFoam/angledDuct/constant/porosityProperties similarity index 78% rename from tutorials/compressible/rhoPimplecFoam/angledDuct/constant/porousZones rename to tutorials/compressible/rhoPorousMRFLTSPimpleFoam/angledDuct/constant/porosityProperties index afeb6461e1..22add8ff29 100644 --- a/tutorials/compressible/rhoPimplecFoam/angledDuct/constant/porousZones +++ b/tutorials/compressible/rhoPorousMRFLTSPimpleFoam/angledDuct/constant/porosityProperties @@ -11,26 +11,27 @@ FoamFile format ascii; class dictionary; location "constant"; - object porousZones; + object porosityProperties; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -1 -( - porosity +porosity1 +{ + type DarcyForchheimer; + active yes; + cellZone porosity; + + DarcyForchheimerCoeffs { + d d [0 -2 0 0 0 0 0] (5e7 -1000 -1000); + f f [0 -1 0 0 0 0 0] (0 0 0); + coordinateSystem { e1 (0.70710678 0.70710678 0); e2 (0 0 1); } - - Darcy - { - d d [0 -2 0 0 0 0 0] (5e7 -1000 -1000); - f f [0 -1 0 0 0 0 0] (0 0 0); - } } -) +} // ************************************************************************* // diff --git a/tutorials/lagrangian/reactingParcelFoam/filter/constant/porousZones b/tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/constant/porosityProperties similarity index 78% rename from tutorials/lagrangian/reactingParcelFoam/filter/constant/porousZones rename to tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/constant/porosityProperties index 32d3aca74f..1a76ef1d80 100644 --- a/tutorials/lagrangian/reactingParcelFoam/filter/constant/porousZones +++ b/tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/constant/porosityProperties @@ -11,26 +11,27 @@ FoamFile format ascii; class dictionary; location "constant"; - object porousZones; + object porosityProperties; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -( - filter // name of cell zone +porosity1 +{ + type DarcyForchheimer; + active yes; + cellZone stator; + + DarcyForchheimerCoeffs { + d d [0 -2 0 0 0 0 0] (1e5 -1000 -1000); + f f [0 -1 0 0 0 0 0] (0 0 0); + coordinateSystem { e1 (1 0 0); e2 (0 1 0); } - - Darcy - { - d d [0 -2 0 0 0 0 0] (500000 -1000 -1000); - f f [0 -1 0 0 0 0 0] (0 0 0); - } } -) - +} // ************************************************************************* // diff --git a/tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/constant/porousZones b/tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/constant/porousZones deleted file mode 100644 index 11a47989c7..0000000000 --- a/tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/constant/porousZones +++ /dev/null @@ -1,36 +0,0 @@ -/*--------------------------------*- C++ -*----------------------------------*\ -| ========= | | -| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: dev | -| \\ / A nd | Web: www.OpenFOAM.org | -| \\/ M anipulation | | -\*---------------------------------------------------------------------------*/ -FoamFile -{ - version 2.0; - format ascii; - class dictionary; - location "constant"; - object porousZones; -} -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -1 -( - stator - { - coordinateSystem - { - e1 (1 0 0); - e2 (0 1 0); - } - - Darcy - { - d d [0 -2 0 0 0 0 0] (1e5 -1000 -1000); - f f [0 -1 0 0 0 0 0] (0 0 0); - } - } -) - -// ************************************************************************* // diff --git a/tutorials/compressible/rhoPorousMRFSimpleFoam/angledDuctImplicit/constant/porousZones b/tutorials/compressible/rhoPorousMRFSimpleFoam/angledDuctImplicit/constant/porosityProperties similarity index 70% rename from tutorials/compressible/rhoPorousMRFSimpleFoam/angledDuctImplicit/constant/porousZones rename to tutorials/compressible/rhoPorousMRFSimpleFoam/angledDuctImplicit/constant/porosityProperties index fe11354202..fe001b7bea 100644 --- a/tutorials/compressible/rhoPorousMRFSimpleFoam/angledDuctImplicit/constant/porousZones +++ b/tutorials/compressible/rhoPorousMRFSimpleFoam/angledDuctImplicit/constant/porosityProperties @@ -11,34 +11,36 @@ FoamFile format ascii; class dictionary; location "constant"; - object porousZones; + object porosityProperties; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -1 -( - porosity +porosity1 +{ + type DarcyForchheimer; + active yes; + cellZone porosity; + + DarcyForchheimerCoeffs { + d d [0 -2 0 0 0 0 0] (5e7 -1000 -1000); + f f [0 -1 0 0 0 0 0] (0 0 0); + coordinateSystem { e1 (0.70710678 0.70710678 0); e2 (0 0 1); } - - Darcy - { - d d [0 -2 0 0 0 0 0] (5e7 -1000 -1000); - f f [0 -1 0 0 0 0 0] (0 0 0); - } - - thermalModel - { - type none; // fixedTemperature; - - // fixedTemperature coefficients - T 350; - } } -) + + thermalModel + { + type none; // fixedTemperature; + + // fixedTemperature coefficients + T 350; + } +} + // ************************************************************************* // diff --git a/tutorials/incompressible/porousSimpleFoam/angledDuctImplicit/constant/porousZones b/tutorials/incompressible/porousSimpleFoam/angledDuctImplicit/constant/porousZones deleted file mode 100644 index afeb6461e1..0000000000 --- a/tutorials/incompressible/porousSimpleFoam/angledDuctImplicit/constant/porousZones +++ /dev/null @@ -1,36 +0,0 @@ -/*--------------------------------*- C++ -*----------------------------------*\ -| ========= | | -| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: dev | -| \\ / A nd | Web: www.OpenFOAM.org | -| \\/ M anipulation | | -\*---------------------------------------------------------------------------*/ -FoamFile -{ - version 2.0; - format ascii; - class dictionary; - location "constant"; - object porousZones; -} -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -1 -( - porosity - { - coordinateSystem - { - e1 (0.70710678 0.70710678 0); - e2 (0 0 1); - } - - Darcy - { - d d [0 -2 0 0 0 0 0] (5e7 -1000 -1000); - f f [0 -1 0 0 0 0 0] (0 0 0); - } - } -) - -// ************************************************************************* // diff --git a/tutorials/lagrangian/LTSReactingParcelFoam/verticalChannel/constant/porousZones b/tutorials/lagrangian/reactingParcelFoam/filter/constant/porosityProperties similarity index 86% rename from tutorials/lagrangian/LTSReactingParcelFoam/verticalChannel/constant/porousZones rename to tutorials/lagrangian/reactingParcelFoam/filter/constant/porosityProperties index d3de954c17..fcd5c5d3f1 100644 --- a/tutorials/lagrangian/LTSReactingParcelFoam/verticalChannel/constant/porousZones +++ b/tutorials/lagrangian/reactingParcelFoam/filter/constant/porosityProperties @@ -11,28 +11,31 @@ FoamFile format ascii; class dictionary; location "constant"; - object porousZones; + object porosityProperties; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -( -/* - porousRegion // name of cell zone - { - coordinateSystem - { - e1 (1 0 0); - e2 (0 1 0); - } +filter1 +{ + cellZone filter; + active true; + type DarcyForchheimer; + DarcyForchheimerCoeffs + { Darcy { d d [0 -2 0 0 0 0 0] (500000 -1000 -1000); f f [0 -1 0 0 0 0 0] (0 0 0); } + + coordinateSystem + { + e1 (1 0 0); + e2 (0 1 0); + } } -*/ -); +} // ************************************************************************* // diff --git a/tutorials/lagrangian/reactingParcelFoam/parcelInBox/constant/porousZones b/tutorials/lagrangian/reactingParcelFoam/parcelInBox/constant/porousZones deleted file mode 100644 index d3de954c17..0000000000 --- a/tutorials/lagrangian/reactingParcelFoam/parcelInBox/constant/porousZones +++ /dev/null @@ -1,38 +0,0 @@ -/*--------------------------------*- C++ -*----------------------------------*\ -| ========= | | -| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: dev | -| \\ / A nd | Web: www.OpenFOAM.org | -| \\/ M anipulation | | -\*---------------------------------------------------------------------------*/ -FoamFile -{ - version 2.0; - format ascii; - class dictionary; - location "constant"; - object porousZones; -} -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -( -/* - porousRegion // name of cell zone - { - coordinateSystem - { - e1 (1 0 0); - e2 (0 1 0); - } - - Darcy - { - d d [0 -2 0 0 0 0 0] (500000 -1000 -1000); - f f [0 -1 0 0 0 0 0] (0 0 0); - } - } -*/ -); - - -// ************************************************************************* // diff --git a/tutorials/lagrangian/reactingParcelFoam/verticalChannel/constant/porousZones b/tutorials/lagrangian/reactingParcelFoam/verticalChannel/constant/porousZones deleted file mode 100644 index d3de954c17..0000000000 --- a/tutorials/lagrangian/reactingParcelFoam/verticalChannel/constant/porousZones +++ /dev/null @@ -1,38 +0,0 @@ -/*--------------------------------*- C++ -*----------------------------------*\ -| ========= | | -| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: dev | -| \\ / A nd | Web: www.OpenFOAM.org | -| \\/ M anipulation | | -\*---------------------------------------------------------------------------*/ -FoamFile -{ - version 2.0; - format ascii; - class dictionary; - location "constant"; - object porousZones; -} -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -( -/* - porousRegion // name of cell zone - { - coordinateSystem - { - e1 (1 0 0); - e2 (0 1 0); - } - - Darcy - { - d d [0 -2 0 0 0 0 0] (500000 -1000 -1000); - f f [0 -1 0 0 0 0 0] (0 0 0); - } - } -*/ -); - - -// ************************************************************************* // From 597cb46b1aafb7535b60431f542aba8582124262 Mon Sep 17 00:00:00 2001 From: andy Date: Fri, 19 Oct 2012 10:56:36 +0100 Subject: [PATCH 09/25] ENH: Restructured field sources --- .../basicSource/{basicSource => }/IObasicSourceList.C | 0 .../basicSource/{basicSource => }/IObasicSourceList.H | 0 src/fieldSources/basicSource/{basicSource => }/basicSource.C | 0 src/fieldSources/basicSource/{basicSource => }/basicSource.H | 0 src/fieldSources/basicSource/{basicSource => }/basicSourceI.H | 0 src/fieldSources/basicSource/{basicSource => }/basicSourceIO.C | 0 src/fieldSources/basicSource/{basicSource => }/basicSourceList.C | 0 src/fieldSources/basicSource/{basicSource => }/basicSourceList.H | 0 .../basicSource/{basicSource => }/basicSourceListTemplates.C | 0 src/fieldSources/basicSource/{basicSource => }/makeBasicSource.H | 0 .../actuationDiskSource/actuationDiskSource.C | 0 .../actuationDiskSource/actuationDiskSource.H | 0 .../actuationDiskSource/actuationDiskSourceTemplates.C | 0 .../constantHeatTransfer/constantHeatTransfer.C | 0 .../constantHeatTransfer/constantHeatTransfer.H | 0 .../interRegionHeatTransferModel/interRegionHeatTransferModel.C | 0 .../interRegionHeatTransferModel/interRegionHeatTransferModel.H | 0 .../tabulatedHeatTransfer/tabulatedHeatTransfer.C | 0 .../tabulatedHeatTransfer/tabulatedHeatTransfer.H | 0 .../variableHeatTransfer/variableHeatTransfer.C | 0 .../variableHeatTransfer/variableHeatTransfer.H | 0 .../pressureGradientExplicitSource.C | 0 .../pressureGradientExplicitSource.H | 0 .../pressureGradientExplicitSourceIO.C | 0 .../radialActuationDiskSource/radialActuationDiskSource.C | 0 .../radialActuationDiskSource/radialActuationDiskSource.H | 0 .../radialActuationDiskSourceTemplates.C | 0 .../rotorDiskSource/bladeModel/bladeModel.C | 0 .../rotorDiskSource/bladeModel/bladeModel.H | 0 .../rotorDiskSource/profileModel/lookup/lookupProfile.C | 0 .../rotorDiskSource/profileModel/lookup/lookupProfile.H | 0 .../rotorDiskSource/profileModel/profileModel.C | 0 .../rotorDiskSource/profileModel/profileModel.H | 0 .../rotorDiskSource/profileModel/profileModelList.C | 0 .../rotorDiskSource/profileModel/profileModelList.H | 0 .../rotorDiskSource/profileModel/series/seriesProfile.C | 0 .../rotorDiskSource/profileModel/series/seriesProfile.H | 0 .../{basicSource => derived}/rotorDiskSource/rotorDiskSource.C | 0 .../{basicSource => derived}/rotorDiskSource/rotorDiskSource.H | 0 .../{basicSource => derived}/rotorDiskSource/rotorDiskSourceI.H | 0 .../rotorDiskSource/rotorDiskSourceTemplates.C | 0 .../rotorDiskSource/trimModel/fixed/fixedTrim.C | 0 .../rotorDiskSource/trimModel/fixed/fixedTrim.H | 0 .../rotorDiskSource/trimModel/targetCoeff/targetCoeffTrim.C | 0 .../rotorDiskSource/trimModel/targetCoeff/targetCoeffTrim.H | 0 .../rotorDiskSource/trimModel/trimModel/trimModel.C | 0 .../rotorDiskSource/trimModel/trimModel/trimModel.H | 0 .../rotorDiskSource/trimModel/trimModel/trimModelNew.C | 0 .../{basicSource => general}/codedSource/CodedSource.C | 0 .../{basicSource => general}/codedSource/CodedSource.H | 0 .../{basicSource => general}/codedSource/CodedSourceIO.C | 0 .../{basicSource => general}/codedSource/codedSource.C | 0 .../{basicSource => general}/explicitSetValue/ExplicitSetValue.C | 0 .../{basicSource => general}/explicitSetValue/ExplicitSetValue.H | 0 .../explicitSetValue/ExplicitSetValueIO.C | 0 .../{basicSource => general}/explicitSetValue/explicitSetValue.C | 0 .../{basicSource => general}/explicitSource/ExplicitSource.C | 0 .../{basicSource => general}/explicitSource/ExplicitSource.H | 0 .../{basicSource => general}/explicitSource/ExplicitSourceI.H | 0 .../{basicSource => general}/explicitSource/ExplicitSourceIO.C | 0 .../{basicSource => general}/explicitSource/explicitSource.C | 0 61 files changed, 0 insertions(+), 0 deletions(-) rename src/fieldSources/basicSource/{basicSource => }/IObasicSourceList.C (100%) rename src/fieldSources/basicSource/{basicSource => }/IObasicSourceList.H (100%) rename src/fieldSources/basicSource/{basicSource => }/basicSource.C (100%) rename src/fieldSources/basicSource/{basicSource => }/basicSource.H (100%) rename src/fieldSources/basicSource/{basicSource => }/basicSourceI.H (100%) rename src/fieldSources/basicSource/{basicSource => }/basicSourceIO.C (100%) rename src/fieldSources/basicSource/{basicSource => }/basicSourceList.C (100%) rename src/fieldSources/basicSource/{basicSource => }/basicSourceList.H (100%) rename src/fieldSources/basicSource/{basicSource => }/basicSourceListTemplates.C (100%) rename src/fieldSources/basicSource/{basicSource => }/makeBasicSource.H (100%) rename src/fieldSources/{basicSource => derived}/actuationDiskSource/actuationDiskSource.C (100%) rename src/fieldSources/{basicSource => derived}/actuationDiskSource/actuationDiskSource.H (100%) rename src/fieldSources/{basicSource => derived}/actuationDiskSource/actuationDiskSourceTemplates.C (100%) rename src/fieldSources/{basicSource => derived}/interRegionHeatTransferModel/constantHeatTransfer/constantHeatTransfer.C (100%) rename src/fieldSources/{basicSource => derived}/interRegionHeatTransferModel/constantHeatTransfer/constantHeatTransfer.H (100%) rename src/fieldSources/{basicSource => derived}/interRegionHeatTransferModel/interRegionHeatTransferModel/interRegionHeatTransferModel.C (100%) rename src/fieldSources/{basicSource => derived}/interRegionHeatTransferModel/interRegionHeatTransferModel/interRegionHeatTransferModel.H (100%) rename src/fieldSources/{basicSource => derived}/interRegionHeatTransferModel/tabulatedHeatTransfer/tabulatedHeatTransfer.C (100%) rename src/fieldSources/{basicSource => derived}/interRegionHeatTransferModel/tabulatedHeatTransfer/tabulatedHeatTransfer.H (100%) rename src/fieldSources/{basicSource => derived}/interRegionHeatTransferModel/variableHeatTransfer/variableHeatTransfer.C (100%) rename src/fieldSources/{basicSource => derived}/interRegionHeatTransferModel/variableHeatTransfer/variableHeatTransfer.H (100%) rename src/fieldSources/{basicSource => derived}/pressureGradientExplicitSource/pressureGradientExplicitSource.C (100%) rename src/fieldSources/{basicSource => derived}/pressureGradientExplicitSource/pressureGradientExplicitSource.H (100%) rename src/fieldSources/{basicSource => derived}/pressureGradientExplicitSource/pressureGradientExplicitSourceIO.C (100%) rename src/fieldSources/{basicSource => derived}/radialActuationDiskSource/radialActuationDiskSource.C (100%) rename src/fieldSources/{basicSource => derived}/radialActuationDiskSource/radialActuationDiskSource.H (100%) rename src/fieldSources/{basicSource => derived}/radialActuationDiskSource/radialActuationDiskSourceTemplates.C (100%) rename src/fieldSources/{basicSource => derived}/rotorDiskSource/bladeModel/bladeModel.C (100%) rename src/fieldSources/{basicSource => derived}/rotorDiskSource/bladeModel/bladeModel.H (100%) rename src/fieldSources/{basicSource => derived}/rotorDiskSource/profileModel/lookup/lookupProfile.C (100%) rename src/fieldSources/{basicSource => derived}/rotorDiskSource/profileModel/lookup/lookupProfile.H (100%) rename src/fieldSources/{basicSource => derived}/rotorDiskSource/profileModel/profileModel.C (100%) rename src/fieldSources/{basicSource => derived}/rotorDiskSource/profileModel/profileModel.H (100%) rename src/fieldSources/{basicSource => derived}/rotorDiskSource/profileModel/profileModelList.C (100%) rename src/fieldSources/{basicSource => derived}/rotorDiskSource/profileModel/profileModelList.H (100%) rename src/fieldSources/{basicSource => derived}/rotorDiskSource/profileModel/series/seriesProfile.C (100%) rename src/fieldSources/{basicSource => derived}/rotorDiskSource/profileModel/series/seriesProfile.H (100%) rename src/fieldSources/{basicSource => derived}/rotorDiskSource/rotorDiskSource.C (100%) rename src/fieldSources/{basicSource => derived}/rotorDiskSource/rotorDiskSource.H (100%) rename src/fieldSources/{basicSource => derived}/rotorDiskSource/rotorDiskSourceI.H (100%) rename src/fieldSources/{basicSource => derived}/rotorDiskSource/rotorDiskSourceTemplates.C (100%) rename src/fieldSources/{basicSource => derived}/rotorDiskSource/trimModel/fixed/fixedTrim.C (100%) rename src/fieldSources/{basicSource => derived}/rotorDiskSource/trimModel/fixed/fixedTrim.H (100%) rename src/fieldSources/{basicSource => derived}/rotorDiskSource/trimModel/targetCoeff/targetCoeffTrim.C (100%) rename src/fieldSources/{basicSource => derived}/rotorDiskSource/trimModel/targetCoeff/targetCoeffTrim.H (100%) rename src/fieldSources/{basicSource => derived}/rotorDiskSource/trimModel/trimModel/trimModel.C (100%) rename src/fieldSources/{basicSource => derived}/rotorDiskSource/trimModel/trimModel/trimModel.H (100%) rename src/fieldSources/{basicSource => derived}/rotorDiskSource/trimModel/trimModel/trimModelNew.C (100%) rename src/fieldSources/{basicSource => general}/codedSource/CodedSource.C (100%) rename src/fieldSources/{basicSource => general}/codedSource/CodedSource.H (100%) rename src/fieldSources/{basicSource => general}/codedSource/CodedSourceIO.C (100%) rename src/fieldSources/{basicSource => general}/codedSource/codedSource.C (100%) rename src/fieldSources/{basicSource => general}/explicitSetValue/ExplicitSetValue.C (100%) rename src/fieldSources/{basicSource => general}/explicitSetValue/ExplicitSetValue.H (100%) rename src/fieldSources/{basicSource => general}/explicitSetValue/ExplicitSetValueIO.C (100%) rename src/fieldSources/{basicSource => general}/explicitSetValue/explicitSetValue.C (100%) rename src/fieldSources/{basicSource => general}/explicitSource/ExplicitSource.C (100%) rename src/fieldSources/{basicSource => general}/explicitSource/ExplicitSource.H (100%) rename src/fieldSources/{basicSource => general}/explicitSource/ExplicitSourceI.H (100%) rename src/fieldSources/{basicSource => general}/explicitSource/ExplicitSourceIO.C (100%) rename src/fieldSources/{basicSource => general}/explicitSource/explicitSource.C (100%) diff --git a/src/fieldSources/basicSource/basicSource/IObasicSourceList.C b/src/fieldSources/basicSource/IObasicSourceList.C similarity index 100% rename from src/fieldSources/basicSource/basicSource/IObasicSourceList.C rename to src/fieldSources/basicSource/IObasicSourceList.C diff --git a/src/fieldSources/basicSource/basicSource/IObasicSourceList.H b/src/fieldSources/basicSource/IObasicSourceList.H similarity index 100% rename from src/fieldSources/basicSource/basicSource/IObasicSourceList.H rename to src/fieldSources/basicSource/IObasicSourceList.H diff --git a/src/fieldSources/basicSource/basicSource/basicSource.C b/src/fieldSources/basicSource/basicSource.C similarity index 100% rename from src/fieldSources/basicSource/basicSource/basicSource.C rename to src/fieldSources/basicSource/basicSource.C diff --git a/src/fieldSources/basicSource/basicSource/basicSource.H b/src/fieldSources/basicSource/basicSource.H similarity index 100% rename from src/fieldSources/basicSource/basicSource/basicSource.H rename to src/fieldSources/basicSource/basicSource.H diff --git a/src/fieldSources/basicSource/basicSource/basicSourceI.H b/src/fieldSources/basicSource/basicSourceI.H similarity index 100% rename from src/fieldSources/basicSource/basicSource/basicSourceI.H rename to src/fieldSources/basicSource/basicSourceI.H diff --git a/src/fieldSources/basicSource/basicSource/basicSourceIO.C b/src/fieldSources/basicSource/basicSourceIO.C similarity index 100% rename from src/fieldSources/basicSource/basicSource/basicSourceIO.C rename to src/fieldSources/basicSource/basicSourceIO.C diff --git a/src/fieldSources/basicSource/basicSource/basicSourceList.C b/src/fieldSources/basicSource/basicSourceList.C similarity index 100% rename from src/fieldSources/basicSource/basicSource/basicSourceList.C rename to src/fieldSources/basicSource/basicSourceList.C diff --git a/src/fieldSources/basicSource/basicSource/basicSourceList.H b/src/fieldSources/basicSource/basicSourceList.H similarity index 100% rename from src/fieldSources/basicSource/basicSource/basicSourceList.H rename to src/fieldSources/basicSource/basicSourceList.H diff --git a/src/fieldSources/basicSource/basicSource/basicSourceListTemplates.C b/src/fieldSources/basicSource/basicSourceListTemplates.C similarity index 100% rename from src/fieldSources/basicSource/basicSource/basicSourceListTemplates.C rename to src/fieldSources/basicSource/basicSourceListTemplates.C diff --git a/src/fieldSources/basicSource/basicSource/makeBasicSource.H b/src/fieldSources/basicSource/makeBasicSource.H similarity index 100% rename from src/fieldSources/basicSource/basicSource/makeBasicSource.H rename to src/fieldSources/basicSource/makeBasicSource.H diff --git a/src/fieldSources/basicSource/actuationDiskSource/actuationDiskSource.C b/src/fieldSources/derived/actuationDiskSource/actuationDiskSource.C similarity index 100% rename from src/fieldSources/basicSource/actuationDiskSource/actuationDiskSource.C rename to src/fieldSources/derived/actuationDiskSource/actuationDiskSource.C diff --git a/src/fieldSources/basicSource/actuationDiskSource/actuationDiskSource.H b/src/fieldSources/derived/actuationDiskSource/actuationDiskSource.H similarity index 100% rename from src/fieldSources/basicSource/actuationDiskSource/actuationDiskSource.H rename to src/fieldSources/derived/actuationDiskSource/actuationDiskSource.H diff --git a/src/fieldSources/basicSource/actuationDiskSource/actuationDiskSourceTemplates.C b/src/fieldSources/derived/actuationDiskSource/actuationDiskSourceTemplates.C similarity index 100% rename from src/fieldSources/basicSource/actuationDiskSource/actuationDiskSourceTemplates.C rename to src/fieldSources/derived/actuationDiskSource/actuationDiskSourceTemplates.C diff --git a/src/fieldSources/basicSource/interRegionHeatTransferModel/constantHeatTransfer/constantHeatTransfer.C b/src/fieldSources/derived/interRegionHeatTransferModel/constantHeatTransfer/constantHeatTransfer.C similarity index 100% rename from src/fieldSources/basicSource/interRegionHeatTransferModel/constantHeatTransfer/constantHeatTransfer.C rename to src/fieldSources/derived/interRegionHeatTransferModel/constantHeatTransfer/constantHeatTransfer.C diff --git a/src/fieldSources/basicSource/interRegionHeatTransferModel/constantHeatTransfer/constantHeatTransfer.H b/src/fieldSources/derived/interRegionHeatTransferModel/constantHeatTransfer/constantHeatTransfer.H similarity index 100% rename from src/fieldSources/basicSource/interRegionHeatTransferModel/constantHeatTransfer/constantHeatTransfer.H rename to src/fieldSources/derived/interRegionHeatTransferModel/constantHeatTransfer/constantHeatTransfer.H diff --git a/src/fieldSources/basicSource/interRegionHeatTransferModel/interRegionHeatTransferModel/interRegionHeatTransferModel.C b/src/fieldSources/derived/interRegionHeatTransferModel/interRegionHeatTransferModel/interRegionHeatTransferModel.C similarity index 100% rename from src/fieldSources/basicSource/interRegionHeatTransferModel/interRegionHeatTransferModel/interRegionHeatTransferModel.C rename to src/fieldSources/derived/interRegionHeatTransferModel/interRegionHeatTransferModel/interRegionHeatTransferModel.C diff --git a/src/fieldSources/basicSource/interRegionHeatTransferModel/interRegionHeatTransferModel/interRegionHeatTransferModel.H b/src/fieldSources/derived/interRegionHeatTransferModel/interRegionHeatTransferModel/interRegionHeatTransferModel.H similarity index 100% rename from src/fieldSources/basicSource/interRegionHeatTransferModel/interRegionHeatTransferModel/interRegionHeatTransferModel.H rename to src/fieldSources/derived/interRegionHeatTransferModel/interRegionHeatTransferModel/interRegionHeatTransferModel.H diff --git a/src/fieldSources/basicSource/interRegionHeatTransferModel/tabulatedHeatTransfer/tabulatedHeatTransfer.C b/src/fieldSources/derived/interRegionHeatTransferModel/tabulatedHeatTransfer/tabulatedHeatTransfer.C similarity index 100% rename from src/fieldSources/basicSource/interRegionHeatTransferModel/tabulatedHeatTransfer/tabulatedHeatTransfer.C rename to src/fieldSources/derived/interRegionHeatTransferModel/tabulatedHeatTransfer/tabulatedHeatTransfer.C diff --git a/src/fieldSources/basicSource/interRegionHeatTransferModel/tabulatedHeatTransfer/tabulatedHeatTransfer.H b/src/fieldSources/derived/interRegionHeatTransferModel/tabulatedHeatTransfer/tabulatedHeatTransfer.H similarity index 100% rename from src/fieldSources/basicSource/interRegionHeatTransferModel/tabulatedHeatTransfer/tabulatedHeatTransfer.H rename to src/fieldSources/derived/interRegionHeatTransferModel/tabulatedHeatTransfer/tabulatedHeatTransfer.H diff --git a/src/fieldSources/basicSource/interRegionHeatTransferModel/variableHeatTransfer/variableHeatTransfer.C b/src/fieldSources/derived/interRegionHeatTransferModel/variableHeatTransfer/variableHeatTransfer.C similarity index 100% rename from src/fieldSources/basicSource/interRegionHeatTransferModel/variableHeatTransfer/variableHeatTransfer.C rename to src/fieldSources/derived/interRegionHeatTransferModel/variableHeatTransfer/variableHeatTransfer.C diff --git a/src/fieldSources/basicSource/interRegionHeatTransferModel/variableHeatTransfer/variableHeatTransfer.H b/src/fieldSources/derived/interRegionHeatTransferModel/variableHeatTransfer/variableHeatTransfer.H similarity index 100% rename from src/fieldSources/basicSource/interRegionHeatTransferModel/variableHeatTransfer/variableHeatTransfer.H rename to src/fieldSources/derived/interRegionHeatTransferModel/variableHeatTransfer/variableHeatTransfer.H diff --git a/src/fieldSources/basicSource/pressureGradientExplicitSource/pressureGradientExplicitSource.C b/src/fieldSources/derived/pressureGradientExplicitSource/pressureGradientExplicitSource.C similarity index 100% rename from src/fieldSources/basicSource/pressureGradientExplicitSource/pressureGradientExplicitSource.C rename to src/fieldSources/derived/pressureGradientExplicitSource/pressureGradientExplicitSource.C diff --git a/src/fieldSources/basicSource/pressureGradientExplicitSource/pressureGradientExplicitSource.H b/src/fieldSources/derived/pressureGradientExplicitSource/pressureGradientExplicitSource.H similarity index 100% rename from src/fieldSources/basicSource/pressureGradientExplicitSource/pressureGradientExplicitSource.H rename to src/fieldSources/derived/pressureGradientExplicitSource/pressureGradientExplicitSource.H diff --git a/src/fieldSources/basicSource/pressureGradientExplicitSource/pressureGradientExplicitSourceIO.C b/src/fieldSources/derived/pressureGradientExplicitSource/pressureGradientExplicitSourceIO.C similarity index 100% rename from src/fieldSources/basicSource/pressureGradientExplicitSource/pressureGradientExplicitSourceIO.C rename to src/fieldSources/derived/pressureGradientExplicitSource/pressureGradientExplicitSourceIO.C diff --git a/src/fieldSources/basicSource/radialActuationDiskSource/radialActuationDiskSource.C b/src/fieldSources/derived/radialActuationDiskSource/radialActuationDiskSource.C similarity index 100% rename from src/fieldSources/basicSource/radialActuationDiskSource/radialActuationDiskSource.C rename to src/fieldSources/derived/radialActuationDiskSource/radialActuationDiskSource.C diff --git a/src/fieldSources/basicSource/radialActuationDiskSource/radialActuationDiskSource.H b/src/fieldSources/derived/radialActuationDiskSource/radialActuationDiskSource.H similarity index 100% rename from src/fieldSources/basicSource/radialActuationDiskSource/radialActuationDiskSource.H rename to src/fieldSources/derived/radialActuationDiskSource/radialActuationDiskSource.H diff --git a/src/fieldSources/basicSource/radialActuationDiskSource/radialActuationDiskSourceTemplates.C b/src/fieldSources/derived/radialActuationDiskSource/radialActuationDiskSourceTemplates.C similarity index 100% rename from src/fieldSources/basicSource/radialActuationDiskSource/radialActuationDiskSourceTemplates.C rename to src/fieldSources/derived/radialActuationDiskSource/radialActuationDiskSourceTemplates.C diff --git a/src/fieldSources/basicSource/rotorDiskSource/bladeModel/bladeModel.C b/src/fieldSources/derived/rotorDiskSource/bladeModel/bladeModel.C similarity index 100% rename from src/fieldSources/basicSource/rotorDiskSource/bladeModel/bladeModel.C rename to src/fieldSources/derived/rotorDiskSource/bladeModel/bladeModel.C diff --git a/src/fieldSources/basicSource/rotorDiskSource/bladeModel/bladeModel.H b/src/fieldSources/derived/rotorDiskSource/bladeModel/bladeModel.H similarity index 100% rename from src/fieldSources/basicSource/rotorDiskSource/bladeModel/bladeModel.H rename to src/fieldSources/derived/rotorDiskSource/bladeModel/bladeModel.H diff --git a/src/fieldSources/basicSource/rotorDiskSource/profileModel/lookup/lookupProfile.C b/src/fieldSources/derived/rotorDiskSource/profileModel/lookup/lookupProfile.C similarity index 100% rename from src/fieldSources/basicSource/rotorDiskSource/profileModel/lookup/lookupProfile.C rename to src/fieldSources/derived/rotorDiskSource/profileModel/lookup/lookupProfile.C diff --git a/src/fieldSources/basicSource/rotorDiskSource/profileModel/lookup/lookupProfile.H b/src/fieldSources/derived/rotorDiskSource/profileModel/lookup/lookupProfile.H similarity index 100% rename from src/fieldSources/basicSource/rotorDiskSource/profileModel/lookup/lookupProfile.H rename to src/fieldSources/derived/rotorDiskSource/profileModel/lookup/lookupProfile.H diff --git a/src/fieldSources/basicSource/rotorDiskSource/profileModel/profileModel.C b/src/fieldSources/derived/rotorDiskSource/profileModel/profileModel.C similarity index 100% rename from src/fieldSources/basicSource/rotorDiskSource/profileModel/profileModel.C rename to src/fieldSources/derived/rotorDiskSource/profileModel/profileModel.C diff --git a/src/fieldSources/basicSource/rotorDiskSource/profileModel/profileModel.H b/src/fieldSources/derived/rotorDiskSource/profileModel/profileModel.H similarity index 100% rename from src/fieldSources/basicSource/rotorDiskSource/profileModel/profileModel.H rename to src/fieldSources/derived/rotorDiskSource/profileModel/profileModel.H diff --git a/src/fieldSources/basicSource/rotorDiskSource/profileModel/profileModelList.C b/src/fieldSources/derived/rotorDiskSource/profileModel/profileModelList.C similarity index 100% rename from src/fieldSources/basicSource/rotorDiskSource/profileModel/profileModelList.C rename to src/fieldSources/derived/rotorDiskSource/profileModel/profileModelList.C diff --git a/src/fieldSources/basicSource/rotorDiskSource/profileModel/profileModelList.H b/src/fieldSources/derived/rotorDiskSource/profileModel/profileModelList.H similarity index 100% rename from src/fieldSources/basicSource/rotorDiskSource/profileModel/profileModelList.H rename to src/fieldSources/derived/rotorDiskSource/profileModel/profileModelList.H diff --git a/src/fieldSources/basicSource/rotorDiskSource/profileModel/series/seriesProfile.C b/src/fieldSources/derived/rotorDiskSource/profileModel/series/seriesProfile.C similarity index 100% rename from src/fieldSources/basicSource/rotorDiskSource/profileModel/series/seriesProfile.C rename to src/fieldSources/derived/rotorDiskSource/profileModel/series/seriesProfile.C diff --git a/src/fieldSources/basicSource/rotorDiskSource/profileModel/series/seriesProfile.H b/src/fieldSources/derived/rotorDiskSource/profileModel/series/seriesProfile.H similarity index 100% rename from src/fieldSources/basicSource/rotorDiskSource/profileModel/series/seriesProfile.H rename to src/fieldSources/derived/rotorDiskSource/profileModel/series/seriesProfile.H diff --git a/src/fieldSources/basicSource/rotorDiskSource/rotorDiskSource.C b/src/fieldSources/derived/rotorDiskSource/rotorDiskSource.C similarity index 100% rename from src/fieldSources/basicSource/rotorDiskSource/rotorDiskSource.C rename to src/fieldSources/derived/rotorDiskSource/rotorDiskSource.C diff --git a/src/fieldSources/basicSource/rotorDiskSource/rotorDiskSource.H b/src/fieldSources/derived/rotorDiskSource/rotorDiskSource.H similarity index 100% rename from src/fieldSources/basicSource/rotorDiskSource/rotorDiskSource.H rename to src/fieldSources/derived/rotorDiskSource/rotorDiskSource.H diff --git a/src/fieldSources/basicSource/rotorDiskSource/rotorDiskSourceI.H b/src/fieldSources/derived/rotorDiskSource/rotorDiskSourceI.H similarity index 100% rename from src/fieldSources/basicSource/rotorDiskSource/rotorDiskSourceI.H rename to src/fieldSources/derived/rotorDiskSource/rotorDiskSourceI.H diff --git a/src/fieldSources/basicSource/rotorDiskSource/rotorDiskSourceTemplates.C b/src/fieldSources/derived/rotorDiskSource/rotorDiskSourceTemplates.C similarity index 100% rename from src/fieldSources/basicSource/rotorDiskSource/rotorDiskSourceTemplates.C rename to src/fieldSources/derived/rotorDiskSource/rotorDiskSourceTemplates.C diff --git a/src/fieldSources/basicSource/rotorDiskSource/trimModel/fixed/fixedTrim.C b/src/fieldSources/derived/rotorDiskSource/trimModel/fixed/fixedTrim.C similarity index 100% rename from src/fieldSources/basicSource/rotorDiskSource/trimModel/fixed/fixedTrim.C rename to src/fieldSources/derived/rotorDiskSource/trimModel/fixed/fixedTrim.C diff --git a/src/fieldSources/basicSource/rotorDiskSource/trimModel/fixed/fixedTrim.H b/src/fieldSources/derived/rotorDiskSource/trimModel/fixed/fixedTrim.H similarity index 100% rename from src/fieldSources/basicSource/rotorDiskSource/trimModel/fixed/fixedTrim.H rename to src/fieldSources/derived/rotorDiskSource/trimModel/fixed/fixedTrim.H diff --git a/src/fieldSources/basicSource/rotorDiskSource/trimModel/targetCoeff/targetCoeffTrim.C b/src/fieldSources/derived/rotorDiskSource/trimModel/targetCoeff/targetCoeffTrim.C similarity index 100% rename from src/fieldSources/basicSource/rotorDiskSource/trimModel/targetCoeff/targetCoeffTrim.C rename to src/fieldSources/derived/rotorDiskSource/trimModel/targetCoeff/targetCoeffTrim.C diff --git a/src/fieldSources/basicSource/rotorDiskSource/trimModel/targetCoeff/targetCoeffTrim.H b/src/fieldSources/derived/rotorDiskSource/trimModel/targetCoeff/targetCoeffTrim.H similarity index 100% rename from src/fieldSources/basicSource/rotorDiskSource/trimModel/targetCoeff/targetCoeffTrim.H rename to src/fieldSources/derived/rotorDiskSource/trimModel/targetCoeff/targetCoeffTrim.H diff --git a/src/fieldSources/basicSource/rotorDiskSource/trimModel/trimModel/trimModel.C b/src/fieldSources/derived/rotorDiskSource/trimModel/trimModel/trimModel.C similarity index 100% rename from src/fieldSources/basicSource/rotorDiskSource/trimModel/trimModel/trimModel.C rename to src/fieldSources/derived/rotorDiskSource/trimModel/trimModel/trimModel.C diff --git a/src/fieldSources/basicSource/rotorDiskSource/trimModel/trimModel/trimModel.H b/src/fieldSources/derived/rotorDiskSource/trimModel/trimModel/trimModel.H similarity index 100% rename from src/fieldSources/basicSource/rotorDiskSource/trimModel/trimModel/trimModel.H rename to src/fieldSources/derived/rotorDiskSource/trimModel/trimModel/trimModel.H diff --git a/src/fieldSources/basicSource/rotorDiskSource/trimModel/trimModel/trimModelNew.C b/src/fieldSources/derived/rotorDiskSource/trimModel/trimModel/trimModelNew.C similarity index 100% rename from src/fieldSources/basicSource/rotorDiskSource/trimModel/trimModel/trimModelNew.C rename to src/fieldSources/derived/rotorDiskSource/trimModel/trimModel/trimModelNew.C diff --git a/src/fieldSources/basicSource/codedSource/CodedSource.C b/src/fieldSources/general/codedSource/CodedSource.C similarity index 100% rename from src/fieldSources/basicSource/codedSource/CodedSource.C rename to src/fieldSources/general/codedSource/CodedSource.C diff --git a/src/fieldSources/basicSource/codedSource/CodedSource.H b/src/fieldSources/general/codedSource/CodedSource.H similarity index 100% rename from src/fieldSources/basicSource/codedSource/CodedSource.H rename to src/fieldSources/general/codedSource/CodedSource.H diff --git a/src/fieldSources/basicSource/codedSource/CodedSourceIO.C b/src/fieldSources/general/codedSource/CodedSourceIO.C similarity index 100% rename from src/fieldSources/basicSource/codedSource/CodedSourceIO.C rename to src/fieldSources/general/codedSource/CodedSourceIO.C diff --git a/src/fieldSources/basicSource/codedSource/codedSource.C b/src/fieldSources/general/codedSource/codedSource.C similarity index 100% rename from src/fieldSources/basicSource/codedSource/codedSource.C rename to src/fieldSources/general/codedSource/codedSource.C diff --git a/src/fieldSources/basicSource/explicitSetValue/ExplicitSetValue.C b/src/fieldSources/general/explicitSetValue/ExplicitSetValue.C similarity index 100% rename from src/fieldSources/basicSource/explicitSetValue/ExplicitSetValue.C rename to src/fieldSources/general/explicitSetValue/ExplicitSetValue.C diff --git a/src/fieldSources/basicSource/explicitSetValue/ExplicitSetValue.H b/src/fieldSources/general/explicitSetValue/ExplicitSetValue.H similarity index 100% rename from src/fieldSources/basicSource/explicitSetValue/ExplicitSetValue.H rename to src/fieldSources/general/explicitSetValue/ExplicitSetValue.H diff --git a/src/fieldSources/basicSource/explicitSetValue/ExplicitSetValueIO.C b/src/fieldSources/general/explicitSetValue/ExplicitSetValueIO.C similarity index 100% rename from src/fieldSources/basicSource/explicitSetValue/ExplicitSetValueIO.C rename to src/fieldSources/general/explicitSetValue/ExplicitSetValueIO.C diff --git a/src/fieldSources/basicSource/explicitSetValue/explicitSetValue.C b/src/fieldSources/general/explicitSetValue/explicitSetValue.C similarity index 100% rename from src/fieldSources/basicSource/explicitSetValue/explicitSetValue.C rename to src/fieldSources/general/explicitSetValue/explicitSetValue.C diff --git a/src/fieldSources/basicSource/explicitSource/ExplicitSource.C b/src/fieldSources/general/explicitSource/ExplicitSource.C similarity index 100% rename from src/fieldSources/basicSource/explicitSource/ExplicitSource.C rename to src/fieldSources/general/explicitSource/ExplicitSource.C diff --git a/src/fieldSources/basicSource/explicitSource/ExplicitSource.H b/src/fieldSources/general/explicitSource/ExplicitSource.H similarity index 100% rename from src/fieldSources/basicSource/explicitSource/ExplicitSource.H rename to src/fieldSources/general/explicitSource/ExplicitSource.H diff --git a/src/fieldSources/basicSource/explicitSource/ExplicitSourceI.H b/src/fieldSources/general/explicitSource/ExplicitSourceI.H similarity index 100% rename from src/fieldSources/basicSource/explicitSource/ExplicitSourceI.H rename to src/fieldSources/general/explicitSource/ExplicitSourceI.H diff --git a/src/fieldSources/basicSource/explicitSource/ExplicitSourceIO.C b/src/fieldSources/general/explicitSource/ExplicitSourceIO.C similarity index 100% rename from src/fieldSources/basicSource/explicitSource/ExplicitSourceIO.C rename to src/fieldSources/general/explicitSource/ExplicitSourceIO.C diff --git a/src/fieldSources/basicSource/explicitSource/explicitSource.C b/src/fieldSources/general/explicitSource/explicitSource.C similarity index 100% rename from src/fieldSources/basicSource/explicitSource/explicitSource.C rename to src/fieldSources/general/explicitSource/explicitSource.C From c0f5897c3b1b242a90524f1a3891727c9ff8e089 Mon Sep 17 00:00:00 2001 From: andy Date: Fri, 19 Oct 2012 10:57:12 +0100 Subject: [PATCH 10/25] STYLE: corrected header file comment --- src/fieldSources/general/explicitSetValue/ExplicitSetValue.H | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/fieldSources/general/explicitSetValue/ExplicitSetValue.H b/src/fieldSources/general/explicitSetValue/ExplicitSetValue.H index 1c3adcb279..653029340b 100644 --- a/src/fieldSources/general/explicitSetValue/ExplicitSetValue.H +++ b/src/fieldSources/general/explicitSetValue/ExplicitSetValue.H @@ -105,7 +105,7 @@ public: // Evaluation - //- Set value on vector field + //- Set value on field virtual void setValue(fvMatrix& eqn, const label fieldI); From f3467d4d03c5dc7469f0fe863d0414b87df9538b Mon Sep 17 00:00:00 2001 From: andy Date: Fri, 19 Oct 2012 10:58:05 +0100 Subject: [PATCH 11/25] ENH: Added fixed temperature field constraint --- src/fieldSources/Make/files | 45 +++--- .../fixedTemperatureSource.C | 104 ++++++++++++++ .../fixedTemperatureSource.H | 132 ++++++++++++++++++ 3 files changed, 259 insertions(+), 22 deletions(-) create mode 100644 src/fieldSources/derived/fixedTemperatureSource/fixedTemperatureSource.C create mode 100644 src/fieldSources/derived/fixedTemperatureSource/fixedTemperatureSource.H diff --git a/src/fieldSources/Make/files b/src/fieldSources/Make/files index eced302bfd..41fecea800 100644 --- a/src/fieldSources/Make/files +++ b/src/fieldSources/Make/files @@ -1,34 +1,35 @@ -basicSource/basicSource/basicSource.C -basicSource/basicSource/basicSourceIO.C -basicSource/basicSource/basicSourceList.C -basicSource/basicSource/IObasicSourceList.C +basicSource/basicSource.C +basicSource/basicSourceIO.C +basicSource/basicSourceList.C +basicSource/IObasicSourceList.C -basicSource/pressureGradientExplicitSource/pressureGradientExplicitSource.C -basicSource/pressureGradientExplicitSource/pressureGradientExplicitSourceIO.C +general/explicitSource/explicitSource.C +general/explicitSetValue/explicitSetValue.C +general/codedSource/codedSource.C -basicSource/explicitSource/explicitSource.C -basicSource/explicitSetValue/explicitSetValue.C +derived/pressureGradientExplicitSource/pressureGradientExplicitSource.C +derived/pressureGradientExplicitSource/pressureGradientExplicitSourceIO.C -basicSource/rotorDiskSource/rotorDiskSource.C -basicSource/rotorDiskSource/bladeModel/bladeModel.C -basicSource/rotorDiskSource/profileModel/profileModel.C -basicSource/rotorDiskSource/profileModel/profileModelList.C -basicSource/rotorDiskSource/profileModel/lookup/lookupProfile.C -basicSource/rotorDiskSource/profileModel/series/seriesProfile.C -basicSource/rotorDiskSource/trimModel/trimModel/trimModel.C -basicSource/rotorDiskSource/trimModel/trimModel/trimModelNew.C -basicSource/rotorDiskSource/trimModel/fixed/fixedTrim.C -basicSource/rotorDiskSource/trimModel/targetCoeff/targetCoeffTrim.C +derived/rotorDiskSource/rotorDiskSource.C +derived/rotorDiskSource/bladeModel/bladeModel.C +derived/rotorDiskSource/profileModel/profileModel.C +derived/rotorDiskSource/profileModel/profileModelList.C +derived/rotorDiskSource/profileModel/lookup/lookupProfile.C +derived/rotorDiskSource/profileModel/series/seriesProfile.C +derived/rotorDiskSource/trimModel/trimModel/trimModel.C +derived/rotorDiskSource/trimModel/trimModel/trimModelNew.C +derived/rotorDiskSource/trimModel/fixed/fixedTrim.C +derived/rotorDiskSource/trimModel/targetCoeff/targetCoeffTrim.C -basicSource/actuationDiskSource/actuationDiskSource.C -basicSource/radialActuationDiskSource/radialActuationDiskSource.C +derived/actuationDiskSource/actuationDiskSource.C +derived/radialActuationDiskSource/radialActuationDiskSource.C -interRegion = basicSource/interRegionHeatTransferModel +interRegion = derived/interRegionHeatTransferModel $(interRegion)/interRegionHeatTransferModel/interRegionHeatTransferModel.C $(interRegion)/constantHeatTransfer/constantHeatTransfer.C $(interRegion)/tabulatedHeatTransfer/tabulatedHeatTransfer.C $(interRegion)/variableHeatTransfer/variableHeatTransfer.C -basicSource/codedSource/codedSource.C +derived/fixedTemperatureSource/fixedTemperatureSource.C LIB = $(FOAM_LIBBIN)/libfieldSources diff --git a/src/fieldSources/derived/fixedTemperatureSource/fixedTemperatureSource.C b/src/fieldSources/derived/fixedTemperatureSource/fixedTemperatureSource.C new file mode 100644 index 0000000000..7795aef879 --- /dev/null +++ b/src/fieldSources/derived/fixedTemperatureSource/fixedTemperatureSource.C @@ -0,0 +1,104 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM 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. + + OpenFOAM 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 OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*----------------------------------------------------------------------------*/ + +#include "fixedTemperatureSource.H" +#include "fvMesh.H" +#include "fvMatrices.H" +#include "basicThermo.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(fixedTemperatureSource, 0); + addToRunTimeSelectionTable + ( + basicSource, + fixedTemperatureSource, + dictionary + ); +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::fixedTemperatureSource::fixedTemperatureSource +( + const word& name, + const word& modelType, + const dictionary& dict, + const fvMesh& mesh +) +: + ExplicitSetValue(name, modelType, dict, mesh), + T_(readScalar(coeffs_.lookup("temperature"))) +{ + coeffs_.lookup("fieldNames") >> fieldNames_; + applied_.setSize(fieldNames_.size(), false); +} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::fixedTemperatureSource::setValue +( + fvMatrix& eqn, + const label fieldI +) +{ + const basicThermo& thermo = + mesh_.lookupObject("thermophsicalProperties"); + + const scalarField Tfield(cells_.size(), T_); + + eqn.setValues(cells_, thermo.he(thermo.p(), Tfield, cells_)); +} + + +void Foam::fixedTemperatureSource::writeData(Ostream& os) const +{ + os << indent << name_ << endl; + dict_.write(os); +} + + +bool Foam::fixedTemperatureSource::read(const dictionary& dict) +{ + if (basicSource::read(dict)) + { + coeffs_.readIfPresent("T", T_); + + return true; + } + else + { + return false; + } +} + + +// ************************************************************************* // diff --git a/src/fieldSources/derived/fixedTemperatureSource/fixedTemperatureSource.H b/src/fieldSources/derived/fixedTemperatureSource/fixedTemperatureSource.H new file mode 100644 index 0000000000..3e5f77d3d5 --- /dev/null +++ b/src/fieldSources/derived/fixedTemperatureSource/fixedTemperatureSource.H @@ -0,0 +1,132 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM 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. + + OpenFOAM 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 OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Class + Foam::fixedTemperatureSource + +Description + Fixed temperature equation constraint + + Sources described by: + + fixedTemperatureSourceCoeffs + { + fieldNames (h e hs); // names of fields to apply source + temperature 500; // fixed temperature [K] + } + + +SourceFiles + fixedTemperatureSource.C + +\*---------------------------------------------------------------------------*/ + +#ifndef fixedTemperatureSource_H +#define fixedTemperatureSource_H + +#include "ExplicitSetValue.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class fixedTemperatureSource Declaration +\*---------------------------------------------------------------------------*/ + +class fixedTemperatureSource +: + public ExplicitSetValue +{ + +protected: + + // Protected data + + //- Fixed temperature [K] + scalar T_; + + +private: + + // Private Member Functions + + //- Disallow default bitwise copy construct + fixedTemperatureSource(const fixedTemperatureSource&); + + //- Disallow default bitwise assignment + void operator=(const fixedTemperatureSource&); + + +public: + + //- Runtime type information + TypeName("fixedTemperatureSource"); + + + // Constructors + + //- Construct from components + fixedTemperatureSource + ( + const word& name, + const word& modelType, + const dictionary& dict, + const fvMesh& mesh + ); + + + //- Destructor + virtual ~fixedTemperatureSource() + {} + + + // Member Functions + + // Set values directly + + //- Scalar + virtual void setValue(fvMatrix& eqn, const label fieldI); + + + // I-O + + //- Write data + virtual void writeData(Ostream&) const; + + //- Read dictionary + virtual bool read(const dictionary& dict); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // From 62e5412802053ce6595f2e7be7a707e3262c28e2 Mon Sep 17 00:00:00 2001 From: andy Date: Fri, 19 Oct 2012 11:29:38 +0100 Subject: [PATCH 12/25] ENH: Added 'alwaysApply' function to bypass the apply checking --- src/fieldSources/basicSource/basicSource.C | 12 ++++++++++++ src/fieldSources/basicSource/basicSource.H | 3 +++ 2 files changed, 15 insertions(+) diff --git a/src/fieldSources/basicSource/basicSource.C b/src/fieldSources/basicSource/basicSource.C index 2d218de752..9ebcdc5834 100644 --- a/src/fieldSources/basicSource/basicSource.C +++ b/src/fieldSources/basicSource/basicSource.C @@ -56,6 +56,12 @@ namespace Foam // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // +bool Foam::basicSource::alwaysApply() const +{ + return false; +} + + void Foam::basicSource::setSelection(const dictionary& dict) { switch (selectionMode_) @@ -314,6 +320,7 @@ Foam::basicSource::~basicSource() } } + // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // bool Foam::basicSource::isActive() @@ -341,6 +348,11 @@ bool Foam::basicSource::isActive() Foam::label Foam::basicSource::applyToField(const word& fieldName) const { + if (alwaysApply()) + { + return 0; + } + forAll(fieldNames_, i) { if (fieldNames_[i] == fieldName) diff --git a/src/fieldSources/basicSource/basicSource.H b/src/fieldSources/basicSource/basicSource.H index ca105f90b1..69e9dcf408 100644 --- a/src/fieldSources/basicSource/basicSource.H +++ b/src/fieldSources/basicSource/basicSource.H @@ -150,6 +150,9 @@ protected: // Protected functions + //- Flag to bypass the apply flag list checking + virtual bool alwaysApply() const; + //- Set the cellSet or points selection void setSelection(const dictionary& dict); From a5a641cea4e8ebc40551a31531f4a411bacb3567 Mon Sep 17 00:00:00 2001 From: andy Date: Fri, 19 Oct 2012 11:30:18 +0100 Subject: [PATCH 13/25] ENH: Updated fixedTemperature field source (constraint) --- .../fixedTemperatureSource.C | 20 +++++++++++++------ .../fixedTemperatureSource.H | 3 +++ 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/src/fieldSources/derived/fixedTemperatureSource/fixedTemperatureSource.C b/src/fieldSources/derived/fixedTemperatureSource/fixedTemperatureSource.C index 7795aef879..09a92bb193 100644 --- a/src/fieldSources/derived/fixedTemperatureSource/fixedTemperatureSource.C +++ b/src/fieldSources/derived/fixedTemperatureSource/fixedTemperatureSource.C @@ -57,25 +57,33 @@ Foam::fixedTemperatureSource::fixedTemperatureSource ExplicitSetValue(name, modelType, dict, mesh), T_(readScalar(coeffs_.lookup("temperature"))) { - coeffs_.lookup("fieldNames") >> fieldNames_; - applied_.setSize(fieldNames_.size(), false); + fieldNames_.setSize(1, "energy"); + applied_.setSize(1, false); } // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // +bool Foam::fixedTemperatureSource::alwaysApply() const +{ + return true; +} + + void Foam::fixedTemperatureSource::setValue ( fvMatrix& eqn, - const label fieldI + const label ) { const basicThermo& thermo = mesh_.lookupObject("thermophsicalProperties"); - const scalarField Tfield(cells_.size(), T_); - - eqn.setValues(cells_, thermo.he(thermo.p(), Tfield, cells_)); + if (eqn.psi().name() == thermo.he().name()) + { + const scalarField Tfield(cells_.size(), T_); + eqn.setValues(cells_, thermo.he(thermo.p(), Tfield, cells_)); + } } diff --git a/src/fieldSources/derived/fixedTemperatureSource/fixedTemperatureSource.H b/src/fieldSources/derived/fixedTemperatureSource/fixedTemperatureSource.H index 3e5f77d3d5..6c56d6c762 100644 --- a/src/fieldSources/derived/fixedTemperatureSource/fixedTemperatureSource.H +++ b/src/fieldSources/derived/fixedTemperatureSource/fixedTemperatureSource.H @@ -105,6 +105,9 @@ public: // Member Functions + virtual bool alwaysApply() const; + + // Set values directly //- Scalar From 61596a17da76657578b43175468f70d66d334ddd Mon Sep 17 00:00:00 2001 From: andy Date: Fri, 19 Oct 2012 11:32:05 +0100 Subject: [PATCH 14/25] ENH: Updated finiteVolume Make/files --- src/finiteVolume/Make/files | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/finiteVolume/Make/files b/src/finiteVolume/Make/files index b8b7e2f1d4..8f83ea99b9 100644 --- a/src/finiteVolume/Make/files +++ b/src/finiteVolume/Make/files @@ -364,13 +364,13 @@ $(solutionControl)/solutionControl/solutionControl.C $(solutionControl)/simpleControl/simpleControl.C $(solutionControl)/pimpleControl/pimpleControl.C -porousMedia = $(general)/porousMedia -$(porousMedia)/porosityModel/porosityModel/porosityModel.C -$(porousMedia)/porosityModel/porosityModel/porosityModelNew.C -$(porousMedia)/porosityModel/porosityModel/porosityModelList.C -$(porousMedia)/porosityModel/porosityModel/IOporosityModelList.C -$(porousMedia)/porosityModel/DarcyForchheimer/DarcyForchheimer.C -$(porousMedia)/porosityModel/powerLaw/powerLaw.C +porosity = $(general)/porosityModel +$(porosity)/porosityModel/porosityModel.C +$(porosity)/porosityModel/porosityModelNew.C +$(porosity)/porosityModel/porosityModelList.C +$(porosity)/porosityModel/IOporosityModelList.C +$(porosity)/DarcyForchheimer/DarcyForchheimer.C +$(porosity)/powerLaw/powerLaw.C MRF = $(general)/MRF $(MRF)/MRFZone.C From 84c7b02fc4d650b3d9530f396ba9b5ce9bce9679 Mon Sep 17 00:00:00 2001 From: andy Date: Fri, 19 Oct 2012 11:50:22 +0100 Subject: [PATCH 15/25] ENH: Updated fixedTemperature field source (constraint) --- .../derived/fixedTemperatureSource/fixedTemperatureSource.C | 4 ++-- .../derived/fixedTemperatureSource/fixedTemperatureSource.H | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/fieldSources/derived/fixedTemperatureSource/fixedTemperatureSource.C b/src/fieldSources/derived/fixedTemperatureSource/fixedTemperatureSource.C index 09a92bb193..bef68f3c4e 100644 --- a/src/fieldSources/derived/fixedTemperatureSource/fixedTemperatureSource.C +++ b/src/fieldSources/derived/fixedTemperatureSource/fixedTemperatureSource.C @@ -54,7 +54,7 @@ Foam::fixedTemperatureSource::fixedTemperatureSource const fvMesh& mesh ) : - ExplicitSetValue(name, modelType, dict, mesh), + basicSource(name, modelType, dict, mesh), T_(readScalar(coeffs_.lookup("temperature"))) { fieldNames_.setSize(1, "energy"); @@ -77,7 +77,7 @@ void Foam::fixedTemperatureSource::setValue ) { const basicThermo& thermo = - mesh_.lookupObject("thermophsicalProperties"); + mesh_.lookupObject("thermophysicalProperties"); if (eqn.psi().name() == thermo.he().name()) { diff --git a/src/fieldSources/derived/fixedTemperatureSource/fixedTemperatureSource.H b/src/fieldSources/derived/fixedTemperatureSource/fixedTemperatureSource.H index 6c56d6c762..4281a38e2c 100644 --- a/src/fieldSources/derived/fixedTemperatureSource/fixedTemperatureSource.H +++ b/src/fieldSources/derived/fixedTemperatureSource/fixedTemperatureSource.H @@ -38,14 +38,14 @@ Description SourceFiles - fixedTemperatureSource.C + basicSource.C \*---------------------------------------------------------------------------*/ #ifndef fixedTemperatureSource_H #define fixedTemperatureSource_H -#include "ExplicitSetValue.H" +#include "basicSource.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -58,7 +58,7 @@ namespace Foam class fixedTemperatureSource : - public ExplicitSetValue + public basicSource { protected: From 2166a032455caa6537a1710a373e1682910f7948 Mon Sep 17 00:00:00 2001 From: andy Date: Fri, 19 Oct 2012 11:50:51 +0100 Subject: [PATCH 16/25] ENH: Updated simplifiedSiwek tutorial case --- .../simplifiedSiwek/constant/sourcesProperties | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/tutorials/lagrangian/coalChemistryFoam/simplifiedSiwek/constant/sourcesProperties b/tutorials/lagrangian/coalChemistryFoam/simplifiedSiwek/constant/sourcesProperties index bcbbcceba0..715f0ebdd9 100644 --- a/tutorials/lagrangian/coalChemistryFoam/simplifiedSiwek/constant/sourcesProperties +++ b/tutorials/lagrangian/coalChemistryFoam/simplifiedSiwek/constant/sourcesProperties @@ -17,20 +17,16 @@ FoamFile source1 { - type scalarExplicitSource; + type fixedTemperatureSource; active true; timeStart 0.1; duration 0.4; selectionMode cellSet; cellSet ignitionCells; - scalarExplicitSourceCoeffs + fixedTemperatureSourceCoeffs { - volumeMode absolute; - injectionRate - { - h 12000; - } + temperature 2000; } } From 8d85caee1d52a18cbf0b0467b22a0c59a1cd0449 Mon Sep 17 00:00:00 2001 From: andy Date: Fri, 19 Oct 2012 13:52:41 +0100 Subject: [PATCH 17/25] ENH: Added run-time selectable sources to compressible solvers --- .../solvers/compressible/rhoPimpleFoam/EEqn.H | 3 +++ .../compressible/rhoPimpleFoam/Make/options | 9 +++++-- .../solvers/compressible/rhoPimpleFoam/UEqn.H | 4 ++- .../compressible/rhoPimpleFoam/createFields.H | 3 +++ .../solvers/compressible/rhoPimpleFoam/pEqn.H | 11 +++++++- .../rhoPimpleFoam/rhoPimpleFoam.C | 1 + .../rhoPimpleFoam/rhoPimplecFoam/Make/options | 9 +++++-- .../rhoPimpleFoam/rhoPimplecFoam/pEqn.H | 11 +++++++- .../rhoPimplecFoam/rhoPimplecFoam.C | 1 + .../rhoPorousMRFLTSPimpleFoam/Make/options | 8 ++++-- .../rhoPorousMRFLTSPimpleFoam.C | 1 + .../rhoPorousMRFPimpleFoam/Make/options | 8 ++++-- .../rhoPorousMRFPimpleFoam/UEqn.H | 5 +++- .../rhoPorousMRFPimpleFoam/pEqn.H | 11 +++++++- .../rhoPorousMRFPimpleFoam.C | 1 + .../solvers/compressible/rhoSimpleFoam/EEqn.H | 3 +++ .../compressible/rhoSimpleFoam/Make/options | 9 +++++-- .../compressible/rhoSimpleFoam/createFields.H | 3 +++ .../solvers/compressible/rhoSimpleFoam/pEqn.H | 15 ++++++++--- .../rhoPorousMRFSimpleFoam/EEqn.H | 5 ++-- .../rhoPorousMRFSimpleFoam/Make/options | 10 ++++--- .../rhoPorousMRFSimpleFoam/UEqn.H | 8 ++++-- .../rhoPorousMRFSimpleFoam/createFields.H | 3 +++ .../rhoPorousMRFSimpleFoam/createZones.H | 2 +- .../rhoPorousMRFSimpleFoam/pEqn.H | 26 +++++++++++++++---- .../rhoPorousMRFSimpleFoam.C | 3 ++- .../rhoSimpleFoam/rhoSimpleFoam.C | 1 + .../rhoSimpleFoam/rhoSimplecFoam/Make/options | 9 +++++-- .../rhoSimpleFoam/rhoSimplecFoam/pEqn.H | 11 +++++++- .../rhoSimplecFoam/rhoSimplecFoam.C | 1 + 30 files changed, 159 insertions(+), 36 deletions(-) diff --git a/applications/solvers/compressible/rhoPimpleFoam/EEqn.H b/applications/solvers/compressible/rhoPimpleFoam/EEqn.H index 6288b8a0af..1cc6ed584c 100644 --- a/applications/solvers/compressible/rhoPimpleFoam/EEqn.H +++ b/applications/solvers/compressible/rhoPimpleFoam/EEqn.H @@ -16,9 +16,12 @@ : -dpdt ) - fvm::laplacian(turbulence->alphaEff(), he) + == + sources(rho, he) ); EEqn.relax(); + sources.constrain(EEqn); EEqn.solve(); thermo.correct(); diff --git a/applications/solvers/compressible/rhoPimpleFoam/Make/options b/applications/solvers/compressible/rhoPimpleFoam/Make/options index f21e7394e4..c96a146eca 100644 --- a/applications/solvers/compressible/rhoPimpleFoam/Make/options +++ b/applications/solvers/compressible/rhoPimpleFoam/Make/options @@ -2,7 +2,10 @@ EXE_INC = \ -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ -I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel \ -I$(LIB_SRC)/finiteVolume/cfdTools \ - -I$(LIB_SRC)/finiteVolume/lnInclude + -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/meshTools/lnInclude \ + -I$(LIB_SRC)/sampling/lnInclude \ + -I$(LIB_SRC)/fieldSources/lnInclude EXE_LIBS = \ -lfluidThermophysicalModels \ @@ -11,4 +14,6 @@ EXE_LIBS = \ -lcompressibleRASModels \ -lcompressibleLESModels \ -lfiniteVolume \ - -lmeshTools + -lmeshTools \ + -lsampling \ + -lfieldSources diff --git a/applications/solvers/compressible/rhoPimpleFoam/UEqn.H b/applications/solvers/compressible/rhoPimpleFoam/UEqn.H index 0f5ec2487b..397e893035 100644 --- a/applications/solvers/compressible/rhoPimpleFoam/UEqn.H +++ b/applications/solvers/compressible/rhoPimpleFoam/UEqn.H @@ -9,8 +9,10 @@ tmp UEqn UEqn().relax(); +sources.constrain(UEqn()); + if (pimple.momentumPredictor()) { - solve(UEqn() == -fvc::grad(p)); + solve(UEqn() == -fvc::grad(p) + sources(rho, U)); K = 0.5*magSqr(U); } diff --git a/applications/solvers/compressible/rhoPimpleFoam/createFields.H b/applications/solvers/compressible/rhoPimpleFoam/createFields.H index 67cc0c3e45..8b3cfd10b9 100644 --- a/applications/solvers/compressible/rhoPimpleFoam/createFields.H +++ b/applications/solvers/compressible/rhoPimpleFoam/createFields.H @@ -69,3 +69,6 @@ Info<< "Creating field kinetic energy K\n" << endl; volScalarField K("K", 0.5*magSqr(U)); + + Info<< "Creating sources\n" << endl; + IObasicSourceList sources(mesh); diff --git a/applications/solvers/compressible/rhoPimpleFoam/pEqn.H b/applications/solvers/compressible/rhoPimpleFoam/pEqn.H index d40c66d402..5f28a3456d 100644 --- a/applications/solvers/compressible/rhoPimpleFoam/pEqn.H +++ b/applications/solvers/compressible/rhoPimpleFoam/pEqn.H @@ -5,7 +5,7 @@ rho.relax(); volScalarField rAU(1.0/UEqn().A()); volVectorField HbyA("HbyA", U); -HbyA = rAU*UEqn().H(); +HbyA = rAU*(UEqn() == sources(rho, U))().H(); if (pimple.nCorrPISO() <= 1) { @@ -33,8 +33,12 @@ if (pimple.transonic()) fvm::ddt(psi, p) + fvm::div(phid, p) - fvm::laplacian(Dp, p) + == + sources(psi, p, rho.name()) ); + sources.constrain(pEqn, rho.name()); + pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter()))); if (pimple.finalNonOrthogonalIter()) @@ -65,8 +69,12 @@ else fvm::ddt(psi, p) + fvc::div(phiHbyA) - fvm::laplacian(Dp, p) + == + sources(psi, p, rho.name()) ); + sources.constrain(pEqn, rho.name()); + pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter()))); if (pimple.finalNonOrthogonalIter()) @@ -92,6 +100,7 @@ Info<< "rho max/min : " << max(rho).value() U = HbyA - rAU*fvc::grad(p); U.correctBoundaryConditions(); +sources.correct(U); K = 0.5*magSqr(U); if (thermo.dpdt()) diff --git a/applications/solvers/compressible/rhoPimpleFoam/rhoPimpleFoam.C b/applications/solvers/compressible/rhoPimpleFoam/rhoPimpleFoam.C index adb6882268..f9b8a901f7 100644 --- a/applications/solvers/compressible/rhoPimpleFoam/rhoPimpleFoam.C +++ b/applications/solvers/compressible/rhoPimpleFoam/rhoPimpleFoam.C @@ -38,6 +38,7 @@ Description #include "turbulenceModel.H" #include "bound.H" #include "pimpleControl.H" +#include "IObasicSourceList.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/applications/solvers/compressible/rhoPimpleFoam/rhoPimplecFoam/Make/options b/applications/solvers/compressible/rhoPimpleFoam/rhoPimplecFoam/Make/options index 6d3c41f0df..c78d474b4f 100644 --- a/applications/solvers/compressible/rhoPimpleFoam/rhoPimplecFoam/Make/options +++ b/applications/solvers/compressible/rhoPimpleFoam/rhoPimplecFoam/Make/options @@ -3,7 +3,10 @@ EXE_INC = \ -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ -I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel \ -I$(LIB_SRC)/finiteVolume/cfdTools \ - -I$(LIB_SRC)/finiteVolume/lnInclude + -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/meshTools/lnInclude \ + -I$(LIB_SRC)/sampling/lnInclude \ + -I$(LIB_SRC)/fieldSources/lnInclude EXE_LIBS = \ -lfluidThermophysicalModels \ @@ -12,4 +15,6 @@ EXE_LIBS = \ -lcompressibleRASModels \ -lcompressibleLESModels \ -lfiniteVolume \ - -lmeshTools + -lmeshTools \ + -lsampling \ + -lfieldSources diff --git a/applications/solvers/compressible/rhoPimpleFoam/rhoPimplecFoam/pEqn.H b/applications/solvers/compressible/rhoPimpleFoam/rhoPimplecFoam/pEqn.H index 75ed20e271..628eb71f29 100644 --- a/applications/solvers/compressible/rhoPimpleFoam/rhoPimplecFoam/pEqn.H +++ b/applications/solvers/compressible/rhoPimpleFoam/rhoPimplecFoam/pEqn.H @@ -7,7 +7,7 @@ volScalarField rAU(1.0/UEqn().A()); volScalarField rAtU(1.0/(1.0/rAU - UEqn().H1())); volVectorField HbyA("HbyA", U); -HbyA = rAU*UEqn().H(); +HbyA = rAU*(UEqn() == sources(rho, U))().H(); if (pimple.nCorrPIMPLE() <= 1) { @@ -44,11 +44,15 @@ if (pimple.transonic()) + fvm::div(phid, p) + fvc::div(phic) - fvm::laplacian(Dp, p) + == + sources(psi, p, rho.name()) ); // Relax the pressure equation to maintain diagonal dominance pEqn.relax(); + sources.constrain(pEqn, rho.name()); + pEqn.solve(); if (pimple.finalNonOrthogonalIter()) @@ -81,8 +85,12 @@ else fvm::ddt(psi, p) + fvc::div(phiHbyA) - fvm::laplacian(Dp, p) + == + sources(psi, p, rho.name()) ); + sources.constrain(pEqn, rho.name()); + pEqn.solve(); if (pimple.finalNonOrthogonalIter()) @@ -100,6 +108,7 @@ p.relax(); U = HbyA - rAtU*fvc::grad(p); U.correctBoundaryConditions(); +sources.correct(U); K = 0.5*magSqr(U); if (thermo.dpdt()) diff --git a/applications/solvers/compressible/rhoPimpleFoam/rhoPimplecFoam/rhoPimplecFoam.C b/applications/solvers/compressible/rhoPimpleFoam/rhoPimplecFoam/rhoPimplecFoam.C index cf8aed0bca..7e1664dbea 100644 --- a/applications/solvers/compressible/rhoPimpleFoam/rhoPimplecFoam/rhoPimplecFoam.C +++ b/applications/solvers/compressible/rhoPimpleFoam/rhoPimplecFoam/rhoPimplecFoam.C @@ -38,6 +38,7 @@ Description #include "turbulenceModel.H" #include "bound.H" #include "pimpleControl.H" +#include "IObasicSourceList.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/applications/solvers/compressible/rhoPimpleFoam/rhoPorousMRFLTSPimpleFoam/Make/options b/applications/solvers/compressible/rhoPimpleFoam/rhoPorousMRFLTSPimpleFoam/Make/options index 5c83c910d9..2976366c08 100644 --- a/applications/solvers/compressible/rhoPimpleFoam/rhoPorousMRFLTSPimpleFoam/Make/options +++ b/applications/solvers/compressible/rhoPimpleFoam/rhoPorousMRFLTSPimpleFoam/Make/options @@ -5,7 +5,9 @@ EXE_INC = \ -I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel \ -I$(LIB_SRC)/finiteVolume/cfdTools \ -I$(LIB_SRC)/finiteVolume/lnInclude \ - -I$(LIB_SRC)/meshTools/lnInclude + -I$(LIB_SRC)/meshTools/lnInclude \ + -I$(LIB_SRC)/sampling/lnInclude \ + -I$(LIB_SRC)/fieldSources/lnInclude EXE_LIBS = \ -lfluidThermophysicalModels \ @@ -14,4 +16,6 @@ EXE_LIBS = \ -lcompressibleRASModels \ -lcompressibleLESModels \ -lfiniteVolume \ - -lmeshTools + -lmeshTools \ + -lsampling \ + -lfieldSources diff --git a/applications/solvers/compressible/rhoPimpleFoam/rhoPorousMRFLTSPimpleFoam/rhoPorousMRFLTSPimpleFoam.C b/applications/solvers/compressible/rhoPimpleFoam/rhoPorousMRFLTSPimpleFoam/rhoPorousMRFLTSPimpleFoam.C index d729b46c37..82ba5cbac1 100644 --- a/applications/solvers/compressible/rhoPimpleFoam/rhoPorousMRFLTSPimpleFoam/rhoPorousMRFLTSPimpleFoam.C +++ b/applications/solvers/compressible/rhoPimpleFoam/rhoPorousMRFLTSPimpleFoam/rhoPorousMRFLTSPimpleFoam.C @@ -39,6 +39,7 @@ Description #include "turbulenceModel.H" #include "MRFZones.H" #include "IOporosityModelList.H" +#include "IObasicSourceList.H" #include "fvcSmooth.H" #include "pimpleControl.H" #include "bound.H" diff --git a/applications/solvers/compressible/rhoPimpleFoam/rhoPorousMRFPimpleFoam/Make/options b/applications/solvers/compressible/rhoPimpleFoam/rhoPorousMRFPimpleFoam/Make/options index f01ebda533..c78d474b4f 100644 --- a/applications/solvers/compressible/rhoPimpleFoam/rhoPorousMRFPimpleFoam/Make/options +++ b/applications/solvers/compressible/rhoPimpleFoam/rhoPorousMRFPimpleFoam/Make/options @@ -4,7 +4,9 @@ EXE_INC = \ -I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel \ -I$(LIB_SRC)/finiteVolume/cfdTools \ -I$(LIB_SRC)/finiteVolume/lnInclude \ - -I$(LIB_SRC)/meshTools/lnInclude + -I$(LIB_SRC)/meshTools/lnInclude \ + -I$(LIB_SRC)/sampling/lnInclude \ + -I$(LIB_SRC)/fieldSources/lnInclude EXE_LIBS = \ -lfluidThermophysicalModels \ @@ -13,4 +15,6 @@ EXE_LIBS = \ -lcompressibleRASModels \ -lcompressibleLESModels \ -lfiniteVolume \ - -lmeshTools + -lmeshTools \ + -lsampling \ + -lfieldSources diff --git a/applications/solvers/compressible/rhoPimpleFoam/rhoPorousMRFPimpleFoam/UEqn.H b/applications/solvers/compressible/rhoPimpleFoam/rhoPorousMRFPimpleFoam/UEqn.H index c24b1f587a..9651610157 100644 --- a/applications/solvers/compressible/rhoPimpleFoam/rhoPorousMRFPimpleFoam/UEqn.H +++ b/applications/solvers/compressible/rhoPimpleFoam/rhoPorousMRFPimpleFoam/UEqn.H @@ -11,9 +11,12 @@ tmp UEqn UEqn().relax(); mrfZones.addCoriolis(rho, UEqn()); + pZones.addResistance(UEqn()); +sources.constrain(UEqn()); + if (pimple.momentumPredictor()) { - solve(UEqn() == -fvc::grad(p)); + solve(UEqn() == -fvc::grad(p) + sources(rho, U)); } diff --git a/applications/solvers/compressible/rhoPimpleFoam/rhoPorousMRFPimpleFoam/pEqn.H b/applications/solvers/compressible/rhoPimpleFoam/rhoPorousMRFPimpleFoam/pEqn.H index b68823c6e3..304798b966 100644 --- a/applications/solvers/compressible/rhoPimpleFoam/rhoPorousMRFPimpleFoam/pEqn.H +++ b/applications/solvers/compressible/rhoPimpleFoam/rhoPorousMRFPimpleFoam/pEqn.H @@ -5,7 +5,7 @@ rho.relax(); volScalarField rAU(1.0/UEqn().A()); volVectorField HbyA("HbyA", U); -HbyA = rAU*UEqn().H(); +HbyA = rAU*(UEqn() == sources(rho, U))().H(); if (pimple.nCorrPISO() <= 1) { @@ -34,8 +34,12 @@ if (pimple.transonic()) fvm::ddt(psi, p) + fvm::div(phid, p) - fvm::laplacian(Dp, p) + == + sources(psi, p, rho.name()) ); + sources.constrain(pEqn, rho.name()); + pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter()))); if (pimple.finalNonOrthogonalIter()) @@ -68,8 +72,12 @@ else fvm::ddt(psi, p) + fvc::div(phiHbyA) - fvm::laplacian(Dp, p) + == + sources(psi, p, rho.name()) ); + sources.constrain(pEqn, rho.name()); + pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter()))); if (pimple.finalNonOrthogonalIter()) @@ -94,6 +102,7 @@ Info<< "rho max/min : " << max(rho).value() U = HbyA - rAU*fvc::grad(p); U.correctBoundaryConditions(); +sources.correct(U); K = 0.5*magSqr(U); if (thermo.dpdt()) diff --git a/applications/solvers/compressible/rhoPimpleFoam/rhoPorousMRFPimpleFoam/rhoPorousMRFPimpleFoam.C b/applications/solvers/compressible/rhoPimpleFoam/rhoPorousMRFPimpleFoam/rhoPorousMRFPimpleFoam.C index 47b3d6c35a..ac5dc1eadc 100644 --- a/applications/solvers/compressible/rhoPimpleFoam/rhoPorousMRFPimpleFoam/rhoPorousMRFPimpleFoam.C +++ b/applications/solvers/compressible/rhoPimpleFoam/rhoPorousMRFPimpleFoam/rhoPorousMRFPimpleFoam.C @@ -39,6 +39,7 @@ Description #include "bound.H" #include "MRFZones.H" #include "IOporosityModelList.H" +#include "IObasicSourceList.H" #include "pimpleControl.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/applications/solvers/compressible/rhoSimpleFoam/EEqn.H b/applications/solvers/compressible/rhoSimpleFoam/EEqn.H index e4c79b40cc..e496906d08 100644 --- a/applications/solvers/compressible/rhoSimpleFoam/EEqn.H +++ b/applications/solvers/compressible/rhoSimpleFoam/EEqn.H @@ -10,9 +10,12 @@ : fvc::div(phi, volScalarField("K", 0.5*magSqr(U))) ) - fvm::laplacian(turbulence->alphaEff(), he) + == + sources(rho, he) ); EEqn.relax(); + sources.constrain(EEqn); EEqn.solve(); thermo.correct(); diff --git a/applications/solvers/compressible/rhoSimpleFoam/Make/options b/applications/solvers/compressible/rhoSimpleFoam/Make/options index 339cc53bd9..741dc4f822 100644 --- a/applications/solvers/compressible/rhoSimpleFoam/Make/options +++ b/applications/solvers/compressible/rhoSimpleFoam/Make/options @@ -3,7 +3,10 @@ EXE_INC = \ -I$(LIB_SRC)/turbulenceModels \ -I$(LIB_SRC)/turbulenceModels/compressible/RAS/RASModel \ -I$(LIB_SRC)/finiteVolume/cfdTools \ - -I$(LIB_SRC)/finiteVolume/lnInclude + -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/sampling/lnInclude \ + -I$(LIB_SRC)/meshTools/lnInclude \ + -I$(LIB_SRC)/fieldSources/lnInclude EXE_LIBS = \ -lfluidThermophysicalModels \ @@ -11,4 +14,6 @@ EXE_LIBS = \ -lcompressibleTurbulenceModel \ -lcompressibleRASModels \ -lfiniteVolume \ - -lmeshTools + -lsampling \ + -lmeshTools \ + -lfieldSources diff --git a/applications/solvers/compressible/rhoSimpleFoam/createFields.H b/applications/solvers/compressible/rhoSimpleFoam/createFields.H index dea35b7657..3f4b2fd021 100644 --- a/applications/solvers/compressible/rhoSimpleFoam/createFields.H +++ b/applications/solvers/compressible/rhoSimpleFoam/createFields.H @@ -60,3 +60,6 @@ ); dimensionedScalar initialMass = fvc::domainIntegrate(rho); + + Info<< "Creating sources\n" << endl; + IObasicSourceList sources(mesh); diff --git a/applications/solvers/compressible/rhoSimpleFoam/pEqn.H b/applications/solvers/compressible/rhoSimpleFoam/pEqn.H index 4d7334c5f8..2ea228f172 100644 --- a/applications/solvers/compressible/rhoSimpleFoam/pEqn.H +++ b/applications/solvers/compressible/rhoSimpleFoam/pEqn.H @@ -6,7 +6,7 @@ volScalarField rAU(1.0/UEqn().A()); volVectorField HbyA("HbyA", U); - HbyA = rAU*UEqn().H(); + HbyA = rAU*(UEqn() == sources(rho, U))().H(); UEqn.clear(); @@ -25,12 +25,16 @@ fvScalarMatrix pEqn ( fvm::div(phid, p) - - fvm::laplacian(rho*rAU, p) + - fvm::laplacian(rho*rAU, p) + == + sources(psi, p, rho.name()) ); // Relax the pressure equation to ensure diagonal-dominance pEqn.relax(); + sources.constrain(pEqn, rho.name()); + pEqn.setReference(pRefCell, pRefValue); pEqn.solve(); @@ -56,11 +60,15 @@ fvScalarMatrix pEqn ( fvc::div(phiHbyA) - - fvm::laplacian(rho*rAU, p) + - fvm::laplacian(rho*rAU, p) + == + sources(psi, p, rho.name()) ); pEqn.setReference(pRefCell, pRefValue); + sources.constrain(pEqn, rho.name()); + pEqn.solve(); if (simple.finalNonOrthogonalIter()) @@ -78,6 +86,7 @@ U = HbyA - rAU*fvc::grad(p); U.correctBoundaryConditions(); + sources.correct(U); // For closed-volume cases adjust the pressure and density levels // to obey overall mass continuity diff --git a/applications/solvers/compressible/rhoSimpleFoam/rhoPorousMRFSimpleFoam/EEqn.H b/applications/solvers/compressible/rhoSimpleFoam/rhoPorousMRFSimpleFoam/EEqn.H index ff467c0382..e496906d08 100644 --- a/applications/solvers/compressible/rhoSimpleFoam/rhoPorousMRFSimpleFoam/EEqn.H +++ b/applications/solvers/compressible/rhoSimpleFoam/rhoPorousMRFSimpleFoam/EEqn.H @@ -10,11 +10,12 @@ : fvc::div(phi, volScalarField("K", 0.5*magSqr(U))) ) - fvm::laplacian(turbulence->alphaEff(), he) + == + sources(rho, he) ); - pZones.addEnergySource(thermo, rho, EEqn); - EEqn.relax(); + sources.constrain(EEqn); EEqn.solve(); thermo.correct(); diff --git a/applications/solvers/compressible/rhoSimpleFoam/rhoPorousMRFSimpleFoam/Make/options b/applications/solvers/compressible/rhoSimpleFoam/rhoPorousMRFSimpleFoam/Make/options index 2d328b3ed1..4ba7ed1f7d 100644 --- a/applications/solvers/compressible/rhoSimpleFoam/rhoPorousMRFSimpleFoam/Make/options +++ b/applications/solvers/compressible/rhoSimpleFoam/rhoPorousMRFSimpleFoam/Make/options @@ -1,18 +1,20 @@ EXE_INC = \ -I.. \ -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ - -I$(LIB_SRC)/thermophysicalModels/thermalPorousZone/lnInclude \ -I$(LIB_SRC)/turbulenceModels \ -I$(LIB_SRC)/turbulenceModels/compressible/RAS/RASModel \ -I$(LIB_SRC)/finiteVolume/cfdTools \ -I$(LIB_SRC)/finiteVolume/lnInclude \ - -I$(LIB_SRC)/meshTools/lnInclude + -I$(LIB_SRC)/sampling/lnInclude \ + -I$(LIB_SRC)/meshTools/lnInclude \ + -I$(LIB_SRC)/fieldSources/lnInclude EXE_LIBS = \ -lfluidThermophysicalModels \ - -lthermalPorousZone \ -lspecie \ -lcompressibleTurbulenceModel \ -lcompressibleRASModels \ -lfiniteVolume \ - -lmeshTools + -lsampling \ + -lmeshTools \ + -lfieldSources diff --git a/applications/solvers/compressible/rhoSimpleFoam/rhoPorousMRFSimpleFoam/UEqn.H b/applications/solvers/compressible/rhoSimpleFoam/rhoPorousMRFSimpleFoam/UEqn.H index c0e087b536..52e15e07b5 100644 --- a/applications/solvers/compressible/rhoSimpleFoam/rhoPorousMRFSimpleFoam/UEqn.H +++ b/applications/solvers/compressible/rhoSimpleFoam/rhoPorousMRFSimpleFoam/UEqn.H @@ -24,11 +24,13 @@ trTU = inv(tTU()); trTU().rename("rAU"); + sources.constrain(UEqn()); + volVectorField gradp(fvc::grad(p)); for (int UCorr=0; UCorr Date: Fri, 19 Oct 2012 13:54:41 +0100 Subject: [PATCH 18/25] ENH: Tutorial updates --- .../constant/porosityProperties | 8 ----- .../constant/sourcesProperties | 34 +++++++++++++++++++ 2 files changed, 34 insertions(+), 8 deletions(-) create mode 100644 tutorials/compressible/rhoPorousMRFSimpleFoam/angledDuctImplicit/constant/sourcesProperties diff --git a/tutorials/compressible/rhoPorousMRFSimpleFoam/angledDuctImplicit/constant/porosityProperties b/tutorials/compressible/rhoPorousMRFSimpleFoam/angledDuctImplicit/constant/porosityProperties index fe001b7bea..650f01268c 100644 --- a/tutorials/compressible/rhoPorousMRFSimpleFoam/angledDuctImplicit/constant/porosityProperties +++ b/tutorials/compressible/rhoPorousMRFSimpleFoam/angledDuctImplicit/constant/porosityProperties @@ -32,14 +32,6 @@ porosity1 e2 (0 0 1); } } - - thermalModel - { - type none; // fixedTemperature; - - // fixedTemperature coefficients - T 350; - } } diff --git a/tutorials/compressible/rhoPorousMRFSimpleFoam/angledDuctImplicit/constant/sourcesProperties b/tutorials/compressible/rhoPorousMRFSimpleFoam/angledDuctImplicit/constant/sourcesProperties new file mode 100644 index 0000000000..4386bc5250 --- /dev/null +++ b/tutorials/compressible/rhoPorousMRFSimpleFoam/angledDuctImplicit/constant/sourcesProperties @@ -0,0 +1,34 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "constant"; + object sourcesProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +source1 +{ + type fixedTemperatureSource; + active true; + timeStart 0; + duration 1000000; + selectionMode cellZone; + cellZone porosity; + + fixedTemperatureSourceCoeffs + { + temperature 350; + } +} + + +// ************************************************************************* // From c6c1fdbea06acd09aefd72b9426b9ea0ee9f4af3 Mon Sep 17 00:00:00 2001 From: andy Date: Fri, 19 Oct 2012 13:57:58 +0100 Subject: [PATCH 19/25] ENH: removed thermalPorousZone - functionality included by basic source (fieldSources) --- src/thermophysicalModels/Allwmake | 1 - .../thermalPorousZone/Make/files | 9 -- .../thermalPorousZone/Make/options | 9 -- .../fixedTemperature/fixedTemperature.C | 91 ----------- .../fixedTemperature/fixedTemperature.H | 102 ------------ .../noThermalModel/noThermalModel.C | 77 ---------- .../noThermalModel/noThermalModel.H | 94 ------------ .../thermalModel/thermalModel/thermalModel.C | 66 -------- .../thermalModel/thermalModel/thermalModel.H | 129 ---------------- .../thermalModel/thermalModelNew.C | 65 -------- .../thermalPorousZone/thermalPorousZone.C | 61 -------- .../thermalPorousZone/thermalPorousZone.H | 145 ------------------ .../thermalPorousZone/thermalPorousZones.C | 63 -------- .../thermalPorousZone/thermalPorousZones.H | 113 -------------- 14 files changed, 1025 deletions(-) delete mode 100644 src/thermophysicalModels/thermalPorousZone/Make/files delete mode 100644 src/thermophysicalModels/thermalPorousZone/Make/options delete mode 100644 src/thermophysicalModels/thermalPorousZone/thermalModel/fixedTemperature/fixedTemperature.C delete mode 100644 src/thermophysicalModels/thermalPorousZone/thermalModel/fixedTemperature/fixedTemperature.H delete mode 100644 src/thermophysicalModels/thermalPorousZone/thermalModel/noThermalModel/noThermalModel.C delete mode 100644 src/thermophysicalModels/thermalPorousZone/thermalModel/noThermalModel/noThermalModel.H delete mode 100644 src/thermophysicalModels/thermalPorousZone/thermalModel/thermalModel/thermalModel.C delete mode 100644 src/thermophysicalModels/thermalPorousZone/thermalModel/thermalModel/thermalModel.H delete mode 100644 src/thermophysicalModels/thermalPorousZone/thermalModel/thermalModel/thermalModelNew.C delete mode 100644 src/thermophysicalModels/thermalPorousZone/thermalPorousZone/thermalPorousZone.C delete mode 100644 src/thermophysicalModels/thermalPorousZone/thermalPorousZone/thermalPorousZone.H delete mode 100644 src/thermophysicalModels/thermalPorousZone/thermalPorousZone/thermalPorousZones.C delete mode 100644 src/thermophysicalModels/thermalPorousZone/thermalPorousZone/thermalPorousZones.H diff --git a/src/thermophysicalModels/Allwmake b/src/thermophysicalModels/Allwmake index 72255b9439..3a8da7148a 100755 --- a/src/thermophysicalModels/Allwmake +++ b/src/thermophysicalModels/Allwmake @@ -12,7 +12,6 @@ wmake $makeType reactionThermo wmake $makeType laminarFlameSpeed wmake $makeType chemistryModel wmake $makeType barotropicCompressibilityModel -wmake $makeType thermalPorousZone wmake $makeType SLGThermo wmake $makeType solidSpecie diff --git a/src/thermophysicalModels/thermalPorousZone/Make/files b/src/thermophysicalModels/thermalPorousZone/Make/files deleted file mode 100644 index 32e0e201f5..0000000000 --- a/src/thermophysicalModels/thermalPorousZone/Make/files +++ /dev/null @@ -1,9 +0,0 @@ -thermalPorousZone/thermalPorousZone.C -thermalPorousZone/thermalPorousZones.C - -thermalModel/thermalModel/thermalModel.C -thermalModel/thermalModel/thermalModelNew.C -thermalModel/fixedTemperature/fixedTemperature.C -thermalModel/noThermalModel/noThermalModel.C - -LIB = $(FOAM_LIBBIN)/libthermalPorousZone diff --git a/src/thermophysicalModels/thermalPorousZone/Make/options b/src/thermophysicalModels/thermalPorousZone/Make/options deleted file mode 100644 index d407126e2a..0000000000 --- a/src/thermophysicalModels/thermalPorousZone/Make/options +++ /dev/null @@ -1,9 +0,0 @@ -EXE_INC = \ - -I$(LIB_SRC)/finiteVolume/lnInclude \ - -I$(LIB_SRC)/meshTools/lnInclude \ - -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude - -LIB_LIBS = \ - -lfluidThermophysicalModels \ - -lmeshTools \ - -lfiniteVolume diff --git a/src/thermophysicalModels/thermalPorousZone/thermalModel/fixedTemperature/fixedTemperature.C b/src/thermophysicalModels/thermalPorousZone/thermalModel/fixedTemperature/fixedTemperature.C deleted file mode 100644 index b7fee86520..0000000000 --- a/src/thermophysicalModels/thermalPorousZone/thermalModel/fixedTemperature/fixedTemperature.C +++ /dev/null @@ -1,91 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM 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. - - OpenFOAM 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 OpenFOAM. If not, see . - -\*---------------------------------------------------------------------------*/ - -#include "fixedTemperature.H" -#include "addToRunTimeSelectionTable.H" -#include "fluidThermo.H" -#include "volFields.H" -#include "fvMatrices.H" - -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - -namespace Foam -{ -namespace porousMedia -{ - defineTypeNameAndDebug(fixedTemperature, 0); - - addToRunTimeSelectionTable - ( - thermalModel, - fixedTemperature, - pZone - ); -} -} - - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -Foam::porousMedia::fixedTemperature::fixedTemperature(const porousZone& pZone) -: - thermalModel(pZone), - T_(readScalar(thermalCoeffs_.lookup("T"))) -{} - - -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * // - -Foam::porousMedia::fixedTemperature::~fixedTemperature() -{} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -void Foam::porousMedia::fixedTemperature::addEnergySource -( - const fluidThermo& thermo, - const volScalarField& rho, - fvScalarMatrix& hEqn -) const -{ - const labelList& zones = pZone_.zoneIds(); - if (zones.empty() || T_ < 0.0) - { - return; - } - - const fvMesh& mesh = pZone_.mesh(); - const scalarField T(hEqn.diag().size(), T_); - - forAll(zones, zoneI) - { - const labelList& cells = mesh.cellZones()[zones[zoneI]]; - hEqn.setValues(cells, thermo.he(thermo.p(), T, cells)); - } -} - - -// ************************************************************************* // diff --git a/src/thermophysicalModels/thermalPorousZone/thermalModel/fixedTemperature/fixedTemperature.H b/src/thermophysicalModels/thermalPorousZone/thermalModel/fixedTemperature/fixedTemperature.H deleted file mode 100644 index f28317a9d4..0000000000 --- a/src/thermophysicalModels/thermalPorousZone/thermalModel/fixedTemperature/fixedTemperature.H +++ /dev/null @@ -1,102 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM 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. - - OpenFOAM 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 OpenFOAM. If not, see . - -Class - Foam::porousMedia::fixedTemperature - -Description - Fixed temperature model for porous media - -\*---------------------------------------------------------------------------*/ - -#ifndef fixedTemperature_H -#define fixedTemperature_H - -#include "thermalModel.H" -#include "runTimeSelectionTables.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ -namespace porousMedia -{ - -/*---------------------------------------------------------------------------*\ - Class fixedTemperature Declaration -\*---------------------------------------------------------------------------*/ - -class fixedTemperature -: - public thermalModel -{ - -protected: - - // Protected data - - //- Fixed temperature - const scalar T_; - - -public: - - //- Runtime type information - TypeName("fixedTemperature"); - - - // Constructors - - //- Construct from porous zone - fixedTemperature(const porousZone& pZone); - - - //- Destructor - virtual ~fixedTemperature(); - - - // Member Functions - - //- Add the thermal source to the enthalpy equation - virtual void addEnergySource - ( - const fluidThermo&, - const volScalarField& rho, - fvScalarMatrix& hEqn - ) const; -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace porousMedia - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/src/thermophysicalModels/thermalPorousZone/thermalModel/noThermalModel/noThermalModel.C b/src/thermophysicalModels/thermalPorousZone/thermalModel/noThermalModel/noThermalModel.C deleted file mode 100644 index 4beef65f4f..0000000000 --- a/src/thermophysicalModels/thermalPorousZone/thermalModel/noThermalModel/noThermalModel.C +++ /dev/null @@ -1,77 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM 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. - - OpenFOAM 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 OpenFOAM. If not, see . - -\*---------------------------------------------------------------------------*/ - -#include "noThermalModel.H" -#include "addToRunTimeSelectionTable.H" -#include "fluidThermo.H" -#include "volFields.H" -#include "fvMatrices.H" - -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - -namespace Foam -{ -namespace porousMedia -{ - defineTypeNameAndDebug(noThermalModel, 0); - - addToRunTimeSelectionTable - ( - thermalModel, - noThermalModel, - pZone - ); -} -} - - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -Foam::porousMedia::noThermalModel::noThermalModel(const porousZone& pZone) -: - thermalModel(pZone) -{} - - -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * // - -Foam::porousMedia::noThermalModel::~noThermalModel() -{} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -void Foam::porousMedia::noThermalModel::addEnergySource -( - const fluidThermo&, - const volScalarField&, - fvScalarMatrix& -) const -{ - // do nothing -} - - -// ************************************************************************* // diff --git a/src/thermophysicalModels/thermalPorousZone/thermalModel/noThermalModel/noThermalModel.H b/src/thermophysicalModels/thermalPorousZone/thermalModel/noThermalModel/noThermalModel.H deleted file mode 100644 index 1b9c1d8b83..0000000000 --- a/src/thermophysicalModels/thermalPorousZone/thermalModel/noThermalModel/noThermalModel.H +++ /dev/null @@ -1,94 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM 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. - - OpenFOAM 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 OpenFOAM. If not, see . - -Class - Foam::porousMedia::noThermalModel - -Description - A dummy thermal model porous media, corresponding to the 'none' option - -\*---------------------------------------------------------------------------*/ - -#ifndef noThermalModel_H -#define noThermalModel_H - -#include "thermalModel.H" -#include "runTimeSelectionTables.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ -namespace porousMedia -{ - -/*---------------------------------------------------------------------------*\ - Class noThermalModel Declaration -\*---------------------------------------------------------------------------*/ - -class noThermalModel -: - public thermalModel -{ - -public: - - //- Runtime type information - TypeName("none"); - - - // Constructors - - //- Construct from porous zone - noThermalModel(const porousZone&); - - - //- Destructor - virtual ~noThermalModel(); - - - // Member Functions - - //- Add the thermal source to the enthalpy equation - virtual void addEnergySource - ( - const fluidThermo&, - const volScalarField& rho, - fvScalarMatrix& hEqn - ) const; -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace porousMedia - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/src/thermophysicalModels/thermalPorousZone/thermalModel/thermalModel/thermalModel.C b/src/thermophysicalModels/thermalPorousZone/thermalModel/thermalModel/thermalModel.C deleted file mode 100644 index c8df5b4c24..0000000000 --- a/src/thermophysicalModels/thermalPorousZone/thermalModel/thermalModel/thermalModel.C +++ /dev/null @@ -1,66 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM 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. - - OpenFOAM 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 OpenFOAM. If not, see . - -\*---------------------------------------------------------------------------*/ - -#include "thermalModel.H" - -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - -namespace Foam -{ -namespace porousMedia -{ - defineTypeNameAndDebug(thermalModel, 0); - defineRunTimeSelectionTable(thermalModel, pZone); -} -} - - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -Foam::porousMedia::thermalModel::thermalModel(const porousZone& pZone) -: - pZone_(pZone), - thermalCoeffs_(pZone.dict().subDictPtr("thermalModel")) -{} - - -Foam::porousMedia::thermalModel::thermalModel -( - const porousZone& pZone, - const dictionary& thermalCoeffs -) -: - pZone_(pZone), - thermalCoeffs_(thermalCoeffs) -{} - - -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * // - -Foam::porousMedia::thermalModel::~thermalModel() -{} - - -// ************************************************************************* // diff --git a/src/thermophysicalModels/thermalPorousZone/thermalModel/thermalModel/thermalModel.H b/src/thermophysicalModels/thermalPorousZone/thermalModel/thermalModel/thermalModel.H deleted file mode 100644 index 26991dc40a..0000000000 --- a/src/thermophysicalModels/thermalPorousZone/thermalModel/thermalModel/thermalModel.H +++ /dev/null @@ -1,129 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM 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. - - OpenFOAM 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 OpenFOAM. If not, see . - -Class - Foam::porousMedia::thermalModel - -Description - Base class to select the temperature specification models for porousMedia - -\*---------------------------------------------------------------------------*/ - -#ifndef thermalModel_H -#define thermalModel_H - -#include "porousZone.H" -#include "autoPtr.H" -#include "runTimeSelectionTables.H" -#include "volFieldsFwd.H" -#include "fvMatricesFwd.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -// Forward declaration of classes -class fluidThermo; - -namespace porousMedia -{ - -/*---------------------------------------------------------------------------*\ - Class thermalModel Declaration -\*---------------------------------------------------------------------------*/ - -class thermalModel -{ - -protected: - - // Protected data - - //- Reference to the porous zone - const porousZone& pZone_; - - //- Thermal model coefficients dictionary - const dictionary thermalCoeffs_; - - -public: - - //- Runtime type information - TypeName("thermalModel"); - - //- Declare runtime constructor selection table - declareRunTimeSelectionTable - ( - autoPtr, - thermalModel, - pZone, - ( - const porousZone& pZone - ), - (pZone) - ); - - - // Constructors - - //- Construct from porous zone, coefficients from "thermalModel" entry - thermalModel(const porousZone&); - - //- Construct from porous zone and thermal model coefficients - thermalModel(const porousZone&, const dictionary& thermalCoeffs); - - - //- Destructor - virtual ~thermalModel(); - - - //- Selector - static autoPtr New(const porousZone&); - - - // Member Functions - - //- Add the thermal source to the enthalpy equation - virtual void addEnergySource - ( - const fluidThermo&, - const volScalarField& rho, - fvScalarMatrix& hEqn - ) const = 0; -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace porousMedia - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/src/thermophysicalModels/thermalPorousZone/thermalModel/thermalModel/thermalModelNew.C b/src/thermophysicalModels/thermalPorousZone/thermalModel/thermalModel/thermalModelNew.C deleted file mode 100644 index 9231ebe4ed..0000000000 --- a/src/thermophysicalModels/thermalPorousZone/thermalModel/thermalModel/thermalModelNew.C +++ /dev/null @@ -1,65 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM 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. - - OpenFOAM 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 OpenFOAM. If not, see . - -\*---------------------------------------------------------------------------*/ - -#include "thermalModel.H" - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -Foam::autoPtr -Foam::porousMedia::thermalModel::New -( - const porousZone& pZone -) -{ - // a missing thermalModel is the same as type "none" - word modelType("none"); - - if (const dictionary* dictPtr = pZone.dict().subDictPtr("thermalModel")) - { - dictPtr->lookup("type") >> modelType; - } - - Info<< "Selecting thermalModel " << modelType << endl; - - pZoneConstructorTable::iterator cstrIter = - pZoneConstructorTablePtr_->find(modelType); - - if (cstrIter == pZoneConstructorTablePtr_->end()) - { - FatalErrorIn - ( - "porousMedia::thermalModel::New(const porousZone&)" - ) << "Unknown thermalModel type " - << modelType << nl << nl - << "Valid thermalModel types are :" << endl - << pZoneConstructorTablePtr_->sortedToc() - << abort(FatalError); - } - - return autoPtr(cstrIter()(pZone)); -} - - -// ************************************************************************* // diff --git a/src/thermophysicalModels/thermalPorousZone/thermalPorousZone/thermalPorousZone.C b/src/thermophysicalModels/thermalPorousZone/thermalPorousZone/thermalPorousZone.C deleted file mode 100644 index c636fc9e87..0000000000 --- a/src/thermophysicalModels/thermalPorousZone/thermalPorousZone/thermalPorousZone.C +++ /dev/null @@ -1,61 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM 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. - - OpenFOAM 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 OpenFOAM. If not, see . - -\*----------------------------------------------------------------------------*/ - -#include "thermalPorousZone.H" -#include "fluidThermo.H" -#include "volFields.H" -#include "fvMatrices.H" - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -Foam::thermalPorousZone::thermalPorousZone -( - const keyType& key, - const fvMesh& mesh, - const dictionary& dict -) -: - porousZone(key, mesh, dict), - model_(porousMedia::thermalModel::New(*this)) -{} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -void Foam::thermalPorousZone::addEnergySource -( - const fluidThermo& thermo, - const volScalarField& rho, - fvScalarMatrix& hEqn -) const -{ - if (model_.valid()) - { - model_->addEnergySource(thermo, rho, hEqn); - } -} - - -// ************************************************************************* // diff --git a/src/thermophysicalModels/thermalPorousZone/thermalPorousZone/thermalPorousZone.H b/src/thermophysicalModels/thermalPorousZone/thermalPorousZone/thermalPorousZone.H deleted file mode 100644 index 127d7fdf91..0000000000 --- a/src/thermophysicalModels/thermalPorousZone/thermalPorousZone/thermalPorousZone.H +++ /dev/null @@ -1,145 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM 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. - - OpenFOAM 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 OpenFOAM. If not, see . - -Class - Foam::thermalPorousZone - -Description - Porous zone definition based on cell zones including terms for energy - equations. - -See Also - porousZone, thermalPorousZones and coordinateSystems with run-time - selectable thermal model - -SourceFiles - thermalPorousZone.C - -\*---------------------------------------------------------------------------*/ - -#ifndef thermalPorousZone_H -#define thermalPorousZone_H - -#include "porousZone.H" -#include "thermalModel.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -class fvMesh; -class fluidThermo; - -/*---------------------------------------------------------------------------*\ - Class thermalPorousZone Declaration -\*---------------------------------------------------------------------------*/ - -class thermalPorousZone -: - public porousZone -{ - // Private data - - //- Disallow default bitwise copy construct - thermalPorousZone(const thermalPorousZone&); - - //- Disallow default bitwise assignment - void operator=(const thermalPorousZone&); - - //- Thermal model - autoPtr model_; - - -public: - - // Constructors - - //- Construct from components - thermalPorousZone - ( - const keyType& key, - const fvMesh& mesh, - const dictionary& dict - ); - - //- Return clone - autoPtr clone() const - { - notImplemented("autoPtr clone() const"); - return autoPtr(NULL); - } - - //- Return pointer to new thermalPorousZone - // created on freestore from Istream - class iNew - { - //- Reference to the finite volume mesh this zone is part of - const fvMesh& mesh_; - - public: - - iNew(const fvMesh& mesh) - : - mesh_(mesh) - {} - - autoPtr operator()(Istream& is) const - { - keyType key(is); - dictionary dict(is); - - return autoPtr - ( - new thermalPorousZone(key, mesh_, dict) - ); - } - }; - - - //- Destructor - virtual ~thermalPorousZone() - {} - - - // Member Functions - - //- Add the thermal source to the enthalpy equation - void addEnergySource - ( - const fluidThermo&, - const volScalarField& rho, - fvScalarMatrix& hEqn - ) const; -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/src/thermophysicalModels/thermalPorousZone/thermalPorousZone/thermalPorousZones.C b/src/thermophysicalModels/thermalPorousZone/thermalPorousZone/thermalPorousZones.C deleted file mode 100644 index 8900a7350a..0000000000 --- a/src/thermophysicalModels/thermalPorousZone/thermalPorousZone/thermalPorousZones.C +++ /dev/null @@ -1,63 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM 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. - - OpenFOAM 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 OpenFOAM. If not, see . - -\*---------------------------------------------------------------------------*/ - -#include "thermalPorousZones.H" -#include "volFields.H" - -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - -namespace Foam -{ - defineTemplateTypeNameAndDebug(IOPtrList, 0); -} - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -Foam::thermalPorousZones::thermalPorousZones -( - const fvMesh& mesh -) -: - PorousZones(mesh) -{} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -void Foam::thermalPorousZones::addEnergySource -( - const fluidThermo& thermo, - const volScalarField& rho, - fvScalarMatrix& hEqn -) const -{ - forAll(*this, i) - { - operator[](i).addEnergySource(thermo, rho, hEqn); - } -} - - -// ************************************************************************* // diff --git a/src/thermophysicalModels/thermalPorousZone/thermalPorousZone/thermalPorousZones.H b/src/thermophysicalModels/thermalPorousZone/thermalPorousZone/thermalPorousZones.H deleted file mode 100644 index d239e0daf0..0000000000 --- a/src/thermophysicalModels/thermalPorousZone/thermalPorousZone/thermalPorousZones.H +++ /dev/null @@ -1,113 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM 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. - - OpenFOAM 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 OpenFOAM. If not, see . - -Class - Foam::thermalPorousZones - -Description - A centralized thermalPorousZone collection. - - Container class for a set of thermalPorousZones with the thermalPorousZone - member functions implemented to loop over the functions for each - thermalPorousZone. - - The input file \c constant/thermalPorousZone is implemented as - IOPtrList\ (but written as a dictionary) - and contains the following type of data: - - \verbatim - 1 - ( - cat1 - { - coordinateSystem system_10; - porosity 0.781; - Darcy - { - d d [0 -2 0 0 0] (-1000 -1000 0.50753e+08); - f f [0 -1 0 0 0] (-1000 -1000 12.83); - } - thermalModel - { - type fixedTemperature; - T T [0 0 1 0 0] 600; - } - } - ) - \endverbatim - -SourceFiles - thermalPorousZones.C - -\*---------------------------------------------------------------------------*/ - -#ifndef thermalPorousZones_H -#define thermalPorousZones_H - -#include "PorousZones.H" -#include "thermalPorousZone.H" - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -/*---------------------------------------------------------------------------*\ - Class thermalPorousZones Declaration -\*---------------------------------------------------------------------------*/ - -class thermalPorousZones -: - public PorousZones -{ - -public: - - // Constructors - - //- Construct from fvMesh - thermalPorousZones(const fvMesh&); - - - // Member Functions - - //- Add the thermal source to the enthalpy equation - void addEnergySource - ( - const fluidThermo&, - const volScalarField& rho, - fvScalarMatrix& hEqn - ) const; -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // From 69c93be12587f0af1340e0db828cd62c193e28ce Mon Sep 17 00:00:00 2001 From: andy Date: Fri, 19 Oct 2012 14:09:27 +0100 Subject: [PATCH 20/25] ENH: Further addition of run-time selectable sources to solvers --- .../solvers/combustion/coldEngineFoam/Make/options | 10 ++++++++-- .../combustion/coldEngineFoam/coldEngineFoam.C | 1 + .../solvers/combustion/coldEngineFoam/createFields.H | 3 +++ .../heatTransfer/buoyantPimpleFoam/Make/options | 11 +++++++++-- .../solvers/heatTransfer/buoyantPimpleFoam/UEqn.H | 1 + .../buoyantPimpleFoam/buoyantPimpleFoam.C | 1 + .../heatTransfer/buoyantPimpleFoam/createFields.H | 3 +++ .../solvers/heatTransfer/buoyantPimpleFoam/pEqn.H | 7 ++++++- 8 files changed, 32 insertions(+), 5 deletions(-) diff --git a/applications/solvers/combustion/coldEngineFoam/Make/options b/applications/solvers/combustion/coldEngineFoam/Make/options index a59f3b8053..25217ab23f 100644 --- a/applications/solvers/combustion/coldEngineFoam/Make/options +++ b/applications/solvers/combustion/coldEngineFoam/Make/options @@ -7,7 +7,10 @@ EXE_INC = \ -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \ -I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel \ - -I$(LIB_SRC)/finiteVolume/lnInclude + -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/sampling/lnInclude \ + -I$(LIB_SRC)/meshTools/lnInclude \ + -I$(LIB_SRC)/fieldSources/lnInclude EXE_LIBS = \ -lengine \ @@ -16,4 +19,7 @@ EXE_LIBS = \ -lcompressibleLESModels \ -lfluidThermophysicalModels \ -lspecie \ - -lfiniteVolume + -lfiniteVolume \ + -lsampling \ + -lmeshTools \ + -lfieldSources diff --git a/applications/solvers/combustion/coldEngineFoam/coldEngineFoam.C b/applications/solvers/combustion/coldEngineFoam/coldEngineFoam.C index 87474e778f..401690c3e4 100644 --- a/applications/solvers/combustion/coldEngineFoam/coldEngineFoam.C +++ b/applications/solvers/combustion/coldEngineFoam/coldEngineFoam.C @@ -35,6 +35,7 @@ Description #include "psiThermo.H" #include "turbulenceModel.H" #include "OFstream.H" +#include "IObasicSourceList.H" #include "pimpleControl.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/applications/solvers/combustion/coldEngineFoam/createFields.H b/applications/solvers/combustion/coldEngineFoam/createFields.H index f78e5bde29..72e88435ac 100644 --- a/applications/solvers/combustion/coldEngineFoam/createFields.H +++ b/applications/solvers/combustion/coldEngineFoam/createFields.H @@ -69,3 +69,6 @@ Info<< "Creating field kinetic energy K\n" << endl; volScalarField K("K", 0.5*magSqr(U)); + + Info<< "Creating sources\n" << endl; + IObasicSourceList sources(mesh); diff --git a/applications/solvers/heatTransfer/buoyantPimpleFoam/Make/options b/applications/solvers/heatTransfer/buoyantPimpleFoam/Make/options index f6e12a3b7c..5d86b094de 100644 --- a/applications/solvers/heatTransfer/buoyantPimpleFoam/Make/options +++ b/applications/solvers/heatTransfer/buoyantPimpleFoam/Make/options @@ -2,7 +2,10 @@ EXE_INC = \ -I../../compressible/rhoPimpleFoam \ -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ -I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel \ - -I$(LIB_SRC)/finiteVolume/lnInclude + -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/sampling/lnInclude \ + -I$(LIB_SRC)/meshTools/lnInclude \ + -I$(LIB_SRC)/fieldSources/lnInclude \ EXE_LIBS = \ -lmeshTools \ @@ -11,4 +14,8 @@ EXE_LIBS = \ -lcompressibleTurbulenceModel \ -lcompressibleRASModels \ -lcompressibleLESModels \ - -lfiniteVolume + -lfiniteVolume \ + -lsampling \ + -lmeshTools \ + -lfieldSources + diff --git a/applications/solvers/heatTransfer/buoyantPimpleFoam/UEqn.H b/applications/solvers/heatTransfer/buoyantPimpleFoam/UEqn.H index 9597f6ac08..d8f3bb56ce 100644 --- a/applications/solvers/heatTransfer/buoyantPimpleFoam/UEqn.H +++ b/applications/solvers/heatTransfer/buoyantPimpleFoam/UEqn.H @@ -22,6 +22,7 @@ - fvc::snGrad(p_rgh) )*mesh.magSf() ) + + sources(rho, U) ); K = 0.5*magSqr(U); } diff --git a/applications/solvers/heatTransfer/buoyantPimpleFoam/buoyantPimpleFoam.C b/applications/solvers/heatTransfer/buoyantPimpleFoam/buoyantPimpleFoam.C index dfa88b59a9..79d3fb7f2f 100644 --- a/applications/solvers/heatTransfer/buoyantPimpleFoam/buoyantPimpleFoam.C +++ b/applications/solvers/heatTransfer/buoyantPimpleFoam/buoyantPimpleFoam.C @@ -37,6 +37,7 @@ Description #include "rhoThermo.H" #include "turbulenceModel.H" #include "fixedGradientFvPatchFields.H" +#include "IObasicSourceList.H" #include "pimpleControl.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/applications/solvers/heatTransfer/buoyantPimpleFoam/createFields.H b/applications/solvers/heatTransfer/buoyantPimpleFoam/createFields.H index f6b183e3fc..9838978028 100644 --- a/applications/solvers/heatTransfer/buoyantPimpleFoam/createFields.H +++ b/applications/solvers/heatTransfer/buoyantPimpleFoam/createFields.H @@ -89,3 +89,6 @@ Info<< "Creating field kinetic energy K\n" << endl; volScalarField K("K", 0.5*magSqr(U)); + + Info<< "Creating sources\n" << endl; + IObasicSourceList sources(mesh); diff --git a/applications/solvers/heatTransfer/buoyantPimpleFoam/pEqn.H b/applications/solvers/heatTransfer/buoyantPimpleFoam/pEqn.H index d67011dba1..6aa559a763 100644 --- a/applications/solvers/heatTransfer/buoyantPimpleFoam/pEqn.H +++ b/applications/solvers/heatTransfer/buoyantPimpleFoam/pEqn.H @@ -9,7 +9,7 @@ surfaceScalarField rhorAUf("Dp", fvc::interpolate(rho*rAU)); volVectorField HbyA("HbyA", U); - HbyA = rAU*UEqn.H(); + HbyA = rAU*(UEqn == sources(rho, U))().H(); surfaceScalarField phig(-rhorAUf*ghf*fvc::snGrad(rho)*mesh.magSf()); @@ -28,6 +28,8 @@ ( fvc::ddt(rho) + psi*correction(fvm::ddt(p_rgh)) + fvc::div(phiHbyA) + == + sources(psi, p, rho.name()) ); while (pimple.correctNonOrthogonal()) @@ -38,6 +40,8 @@ - fvm::laplacian(rhorAUf, p_rgh) ); + sources.constrain(p_rghEqn, rho.name()); + p_rghEqn.solve(mesh.solver(p_rgh.select(pimple.finalInnerIter()))); if (pimple.finalNonOrthogonalIter()) @@ -52,6 +56,7 @@ // calculated from the relaxed pressure U = HbyA + rAU*fvc::reconstruct((phig + p_rghEqn.flux())/rhorAUf); U.correctBoundaryConditions(); + sources.correct(U); K = 0.5*magSqr(U); } } From 35d1bdd80006d34a93e84d676280ad6a35db3182 Mon Sep 17 00:00:00 2001 From: andy Date: Fri, 19 Oct 2012 16:25:13 +0100 Subject: [PATCH 21/25] BUG: SubModelBase - use copy instead of reference for sub-model coeffs dictionary --- src/lagrangian/intermediate/submodels/SubModelBase.H | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lagrangian/intermediate/submodels/SubModelBase.H b/src/lagrangian/intermediate/submodels/SubModelBase.H index 0427c162f7..608cee614e 100644 --- a/src/lagrangian/intermediate/submodels/SubModelBase.H +++ b/src/lagrangian/intermediate/submodels/SubModelBase.H @@ -61,7 +61,7 @@ protected: CloudType& owner_; //- Reference to the cloud dictionary - const dictionary& dict_; + const dictionary dict_; //- Name of the sub-model base class const word baseName_; @@ -73,7 +73,7 @@ protected: const word modelName_; //- Coefficients dictionary - const dictionary& coeffDict_; + const dictionary coeffDict_; // Protected Member Functions From a01233bda6a1787cda5da971de04526a4b082bbf Mon Sep 17 00:00:00 2001 From: andy Date: Fri, 19 Oct 2012 16:30:00 +0100 Subject: [PATCH 22/25] BUG: corrected source term solve variable --- applications/solvers/heatTransfer/buoyantPimpleFoam/pEqn.H | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/applications/solvers/heatTransfer/buoyantPimpleFoam/pEqn.H b/applications/solvers/heatTransfer/buoyantPimpleFoam/pEqn.H index 6aa559a763..86c314c9c4 100644 --- a/applications/solvers/heatTransfer/buoyantPimpleFoam/pEqn.H +++ b/applications/solvers/heatTransfer/buoyantPimpleFoam/pEqn.H @@ -29,7 +29,7 @@ fvc::ddt(rho) + psi*correction(fvm::ddt(p_rgh)) + fvc::div(phiHbyA) == - sources(psi, p, rho.name()) + sources(psi, p_rgh, rho.name()) ); while (pimple.correctNonOrthogonal()) From 7230cfd99dd3826f3781848c0332a58755d8691f Mon Sep 17 00:00:00 2001 From: andy Date: Fri, 19 Oct 2012 16:30:22 +0100 Subject: [PATCH 23/25] BUG: Cannot do a parallel reduce in this part of the code --- .../AMIInterpolation/AMIInterpolation.C | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolation.C b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolation.C index 7e85e6723e..1f9f4c66ec 100644 --- a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolation.C +++ b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolation.C @@ -266,7 +266,6 @@ Foam::label Foam::AMIInterpolation::findTargetFace const point srcPt = srcFace.centre(srcPts); const scalar srcFaceArea = srcMagSf_[srcFaceI]; -// pointIndexHit sample = treePtr_->findNearest(srcPt, sqr(0.1*bb.mag())); pointIndexHit sample = treePtr_->findNearest(srcPt, 10.0*srcFaceArea); @@ -295,7 +294,6 @@ void Foam::AMIInterpolation::appendNbrFaces DynamicList