diff --git a/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMeshDict b/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMeshDict index b3be8fe96f68bfd6240a98ef05fb71c0b45b7e15..f0cc40a8e4867cc7d1de6408832d6360006e9985 100644 --- a/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMeshDict +++ b/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMeshDict @@ -245,6 +245,10 @@ snapControls //- Use castellatedMeshControls::features (default = true) explicitFeatureSnap true; + + //- Detect features between multiple surfaces + // (only for explicitFeatureSnap, default = false) + multiRegionFeatureSnap false; } // Settings for the layer addition. diff --git a/applications/utilities/miscellaneous/foamDebugSwitches/Make/options b/applications/utilities/miscellaneous/foamDebugSwitches/Make/options index 6fe40ed9f19464475c06f704c9842935d8fcdfd1..6fa4104188a79deb511308fe1cf34d9e80243768 100644 --- a/applications/utilities/miscellaneous/foamDebugSwitches/Make/options +++ b/applications/utilities/miscellaneous/foamDebugSwitches/Make/options @@ -60,7 +60,6 @@ EXE_LIBS = \ -lsurfaceFilmModels \ -lsurfMesh \ -lsystemCall \ - -lthermalPorousZone \ -lthermophysicalFunctions \ -ltopoChangerFvMesh \ -ltriSurface \ diff --git a/applications/utilities/surface/surfaceFeatureExtract/surfaceFeatureExtract.C b/applications/utilities/surface/surfaceFeatureExtract/surfaceFeatureExtract.C index d06e5d03cb8b12ff53e10e575d6a01fc31a58cdc..b3b390af515122423aaf6a99116a267366cd1da2 100644 --- a/applications/utilities/surface/surfaceFeatureExtract/surfaceFeatureExtract.C +++ b/applications/utilities/surface/surfaceFeatureExtract/surfaceFeatureExtract.C @@ -25,7 +25,8 @@ Application surfaceFeatureExtract Description - Extracts and writes surface features to file + Extracts and writes surface features to file. All but the basic feature + extraction is WIP. \*---------------------------------------------------------------------------*/ @@ -472,6 +473,176 @@ void unmarkBaffles } +//- Divide into multiple normal bins +// - return REGION if != 2 normals +// - return REGION if 2 normals that make feature angle +// - otherwise return NONE and set normals,bins +surfaceFeatures::edgeStatus checkFlatRegionEdge +( + const triSurface& surf, + const scalar tol, + const scalar includedAngle, + const label edgeI +) +{ + const edge& e = surf.edges()[edgeI]; + const labelList& eFaces = surf.edgeFaces()[edgeI]; + + // Bin according to normal + + DynamicList<Foam::vector> normals(2); + DynamicList<labelList> bins(2); + + forAll(eFaces, eFaceI) + { + const Foam::vector& n = surf.faceNormals()[eFaces[eFaceI]]; + + // Find the normal in normals + label index = -1; + forAll(normals, normalI) + { + if (mag(n&normals[normalI]) > (1-tol)) + { + index = normalI; + break; + } + } + + if (index != -1) + { + bins[index].append(eFaceI); + } + else if (normals.size() >= 2) + { + // Would be third normal. Mark as feature. + //Pout<< "** at edge:" << surf.localPoints()[e[0]] + // << surf.localPoints()[e[1]] + // << " have normals:" << normals + // << " and " << n << endl; + return surfaceFeatures::REGION; + } + else + { + normals.append(n); + bins.append(labelList(1, eFaceI)); + } + } + + + // Check resulting number of bins + if (bins.size() == 1) + { + // Note: should check here whether they are two sets of faces + // that are planar or indeed 4 faces al coming together at an edge. + //Pout<< "** at edge:" + // << surf.localPoints()[e[0]] + // << surf.localPoints()[e[1]] + // << " have single normal:" << normals[0] + // << endl; + return surfaceFeatures::NONE; + } + else + { + // Two bins. Check if normals make an angle + + //Pout<< "** at edge:" + // << surf.localPoints()[e[0]] + // << surf.localPoints()[e[1]] << nl + // << " normals:" << normals << nl + // << " bins :" << bins << nl + // << endl; + + if (includedAngle >= 0) + { + scalar minCos = Foam::cos(degToRad(180.0 - includedAngle)); + + forAll(eFaces, i) + { + const Foam::vector& ni = surf.faceNormals()[eFaces[i]]; + for (label j=i+1; j<eFaces.size(); j++) + { + const Foam::vector& nj = surf.faceNormals()[eFaces[j]]; + if (mag(ni & nj) < minCos) + { + //Pout<< "have sharp feature between normal:" << ni + // << " and " << nj << endl; + + // Is feature. Keep as region or convert to + // feature angle? For now keep as region. + return surfaceFeatures::REGION; + } + } + } + } + + + // So now we have two normals bins but need to make sure both + // bins have the same regions in it. + + // 1. store + or - region number depending + // on orientation of triangle in bins[0] + const labelList& bin0 = bins[0]; + labelList regionAndNormal(bin0.size()); + forAll(bin0, i) + { + const labelledTri& t = surf.localFaces()[eFaces[bin0[i]]]; + int dir = t.edgeDirection(e); + + if (dir > 0) + { + regionAndNormal[i] = t.region()+1; + } + else if (dir == 0) + { + FatalErrorIn("problem.") + << exit(FatalError); + } + else + { + regionAndNormal[i] = -(t.region()+1); + } + } + + // 2. check against bin1 + const labelList& bin1 = bins[1]; + labelList regionAndNormal1(bin1.size()); + forAll(bin1, i) + { + const labelledTri& t = surf.localFaces()[eFaces[bin1[i]]]; + int dir = t.edgeDirection(e); + + label myRegionAndNormal; + if (dir > 0) + { + myRegionAndNormal = t.region()+1; + } + else + { + myRegionAndNormal = -(t.region()+1); + } + + regionAndNormal1[i] = myRegionAndNormal; + + label index = findIndex(regionAndNormal, -myRegionAndNormal); + if (index == -1) + { + // Not found. + //Pout<< "cannot find region " << myRegionAndNormal + // << " in regions " << regionAndNormal << endl; + + return surfaceFeatures::REGION; + } + } + + // Passed all checks, two normal bins with the same contents. + //Pout<< "regionAndNormal:" << regionAndNormal << endl; + //Pout<< "myRegionAndNormal:" << regionAndNormal1 << endl; + + return surfaceFeatures::NONE; + } +} + + void writeStats(const extendedFeatureEdgeMesh& fem, Ostream& os) { os << " points : " << fem.points().size() << nl @@ -610,6 +781,8 @@ int main(int argc, char *argv[]) surfaceFeatures set(surf); + scalar includedAngle = -1; + if (extractionMethod == "extractFromFile") { const fileName featureEdgeFile = @@ -630,14 +803,13 @@ int main(int argc, char *argv[]) } else if (extractionMethod == "extractFromSurface") { - const scalar includedAngle = - readScalar + includedAngle = readScalar + ( + surfaceDict.subDict("extractFromSurfaceCoeffs").lookup ( - surfaceDict.subDict("extractFromSurfaceCoeffs").lookup - ( - "includedAngle" - ) - ); + "includedAngle" + ) + ); Info<< nl << "Constructing feature set from included angle " << includedAngle << endl; @@ -727,13 +899,27 @@ int main(int argc, char *argv[]) if (!nonManifoldEdges) { Info<< "Removing all non-manifold edges" - << " (edges with > 2 connected faces)" << endl; + << " (edges with > 2 connected faces) unless they" + << " cross multiple regions" << endl; forAll(edgeStat, edgeI) { - if (surf.edgeFaces()[edgeI].size() > 2) + const labelList& eFaces = surf.edgeFaces()[edgeI]; + + if + ( + eFaces.size() > 2 + && edgeStat[edgeI] == surfaceFeatures::REGION + && (eFaces.size() % 2) == 0 + ) { - edgeStat[edgeI] = surfaceFeatures::NONE; + edgeStat[edgeI] = checkFlatRegionEdge + ( + surf, + 1e-5, //tol, + includedAngle, + edgeI + ); } } } diff --git a/applications/utilities/surface/surfaceFeatureExtract/surfaceFeatureExtractDict b/applications/utilities/surface/surfaceFeatureExtract/surfaceFeatureExtractDict index 6c1eab66e9c5cc466540055c8b0382dc633bf109..a52ebdfa555755da0ff951721f0d26823ad6b2b1 100644 --- a/applications/utilities/surface/surfaceFeatureExtract/surfaceFeatureExtractDict +++ b/applications/utilities/surface/surfaceFeatureExtract/surfaceFeatureExtractDict @@ -69,7 +69,8 @@ surface2.nas // Keep edges outside the box: outsideBox (0 0 0)(1 1 1); - // Keep nonManifold edges (edges with >2 connected faces) + // Keep nonManifold edges (edges with >2 connected faces where + // the faces form more than two different normal planes) nonManifoldEdges yes; // Keep open edges (edges with 1 connected face) diff --git a/bin/tools/RunFunctions b/bin/tools/RunFunctions index d986057b5fe91fc1212d731041be3b7d2992f4dc..093c6ed037cd74083b5154b5c3377ebf3e968508 100644 --- a/bin/tools/RunFunctions +++ b/bin/tools/RunFunctions @@ -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 @@ runApplication() echo "$APP_NAME already run on $PWD: remove log file to re-run" else echo "Running $APP_RUN on $PWD" - $APP_RUN $* > log.$APP_NAME 2>&1 + $APP_RUN "$@" > log.$APP_NAME 2>&1 fi } @@ -65,9 +65,9 @@ runParallel() #if [ "$WM_SCHEDULER" ] #then # echo "$PWD: $WM_SCHEDULER -np $nProcs" 1>&2 - # $WM_SCHEDULER -np $nProcs "( mpirun -np $nProcs $APP_RUN -parallel $* < /dev/null > log.$APP_NAME 2>&1 )" + # $WM_SCHEDULER -np $nProcs "( mpirun -np $nProcs $APP_RUN -parallel "$@" < /dev/null > log.$APP_NAME 2>&1 )" #else - ( mpirun -np $nProcs $APP_RUN -parallel $* < /dev/null > log.$APP_NAME 2>&1 ) + ( mpirun -np $nProcs $APP_RUN -parallel "$@" < /dev/null > log.$APP_NAME 2>&1 ) #fi fi } diff --git a/src/OSspecific/POSIX/regExp.C b/src/OSspecific/POSIX/regExp.C index 3ce0d2c4471b69f487781c4bbc64d5971ac5f4fa..2023f9ce59870df5786c1b58638c9c3f24ee882f 100644 --- a/src/OSspecific/POSIX/regExp.C +++ b/src/OSspecific/POSIX/regExp.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 @@ -80,12 +80,18 @@ void Foam::regExp::set(const char* pattern, const bool ignoreCase) const cflags |= REG_ICASE; } - if (regcomp(preg_, pattern, cflags) != 0) + int err = regcomp(preg_, pattern, cflags); + + if (err != 0) { + char errbuf[200]; + regerror(err, preg_, errbuf, sizeof(errbuf)); + FatalErrorIn ( "regExp::set(const char*)" ) << "Failed to compile regular expression '" << pattern << "'" + << nl << errbuf << exit(FatalError); } } diff --git a/src/OpenFOAM/db/IOstreams/Sstreams/ISstream.C b/src/OpenFOAM/db/IOstreams/Sstreams/ISstream.C index a3161386e69677e283c5b2d7872a6465dfdfde2d..c93aad5a36f956d6075d1b89e4329cd601ba5a93 100644 --- a/src/OpenFOAM/db/IOstreams/Sstreams/ISstream.C +++ b/src/OpenFOAM/db/IOstreams/Sstreams/ISstream.C @@ -266,7 +266,7 @@ Foam::Istream& Foam::ISstream::read(token& t) else { t = sPtr; - t.type() = token::STRING; + t.type() = token::VARIABLE; } return *this; } diff --git a/src/OpenFOAM/db/IOstreams/token/token.H b/src/OpenFOAM/db/IOstreams/token/token.H index 75c946d1d407c48fc2da2a73ab9fd783c9a72e1a..a1523fd3ffd5194b3e309457c7a069abb5026998 100644 --- a/src/OpenFOAM/db/IOstreams/token/token.H +++ b/src/OpenFOAM/db/IOstreams/token/token.H @@ -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 @@ -77,6 +77,7 @@ public: PUNCTUATION, WORD, + VARIABLE, STRING, VERBATIMSTRING, LABEL, @@ -331,6 +332,8 @@ public: inline bool isWord() const; inline const word& wordToken() const; + inline bool isVariable() const; + inline bool isString() const; inline const string& stringToken() const; diff --git a/src/OpenFOAM/db/IOstreams/token/tokenI.H b/src/OpenFOAM/db/IOstreams/token/tokenI.H index dfa6cdf93e453162c30fe7cb7546921dab6ee618..e23fc83679463bcaa3acb00a9857129ddbabd4f1 100644 --- a/src/OpenFOAM/db/IOstreams/token/tokenI.H +++ b/src/OpenFOAM/db/IOstreams/token/tokenI.H @@ -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 @@ -39,7 +39,7 @@ inline void token::clear() { delete wordTokenPtr_; } - else if (type_ == STRING || type_ == VERBATIMSTRING) + else if (type_ == STRING || type_ == VARIABLE || type_ == VERBATIMSTRING) { delete stringTokenPtr_; } @@ -88,6 +88,7 @@ inline token::token(const token& t) break; case STRING: + case VARIABLE: case VERBATIMSTRING: stringTokenPtr_ = new string(*t.stringTokenPtr_); break; @@ -235,14 +236,19 @@ inline const word& token::wordToken() const } } +inline bool token::isVariable() const +{ + return (type_ == VARIABLE); +} + inline bool token::isString() const { - return (type_ == STRING || type_ == VERBATIMSTRING); + return (type_ == STRING || type_ == VARIABLE || type_ == VERBATIMSTRING); } inline const string& token::stringToken() const { - if (type_ == STRING || type_ == VERBATIMSTRING) + if (type_ == STRING || type_ == VARIABLE || type_ == VERBATIMSTRING) { return *stringTokenPtr_; } @@ -411,6 +417,7 @@ inline void token::operator=(const token& t) break; case STRING: + case VARIABLE: case VERBATIMSTRING: stringTokenPtr_ = new string(*t.stringTokenPtr_); break; @@ -518,6 +525,7 @@ inline bool token::operator==(const token& t) const return *wordTokenPtr_ == *t.wordTokenPtr_; case STRING: + case VARIABLE: case VERBATIMSTRING: return *stringTokenPtr_ == *t.stringTokenPtr_; @@ -552,7 +560,11 @@ inline bool token::operator==(const word& w) const inline bool token::operator==(const string& s) const { - return ((type_ == STRING || type_ == VERBATIMSTRING) && stringToken() == s); + return + ( + (type_ == STRING || type_ == VARIABLE || type_ == VERBATIMSTRING) + && stringToken() == s + ); } inline bool token::operator==(const label l) const diff --git a/src/OpenFOAM/db/IOstreams/token/tokenIO.C b/src/OpenFOAM/db/IOstreams/token/tokenIO.C index 2aedebe6814f737da7bfd6c8574337e13286402b..b513a4be0eda7d991b10f538ae11499ced859134 100644 --- a/src/OpenFOAM/db/IOstreams/token/tokenIO.C +++ b/src/OpenFOAM/db/IOstreams/token/tokenIO.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 @@ -74,6 +74,11 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const token& t) os << *t.stringTokenPtr_; break; + case token::VARIABLE: + // Write variable as word so without "" + os.writeQuoted(*t.stringTokenPtr_, false); + break; + case token::LABEL: os << t.labelToken_; break; @@ -157,6 +162,10 @@ ostream& Foam::operator<<(ostream& os, const InfoProxy<token>& ip) os << " the string " << t.stringToken(); break; + case token::VARIABLE: + os << " the variable " << t.stringToken(); + break; + case token::VERBATIMSTRING: os << " the verbatim string " << t.stringToken(); break; @@ -231,6 +240,10 @@ Ostream& operator<<(Ostream& os, const InfoProxy<token>& ip) os << " the string " << t.stringToken(); break; + case token::VARIABLE: + os << " the variable " << t.stringToken(); + break; + case token::VERBATIMSTRING: os << " the verbatim string " << t.stringToken(); break; diff --git a/src/OpenFOAM/db/dictionary/primitiveEntry/primitiveEntryIO.C b/src/OpenFOAM/db/dictionary/primitiveEntry/primitiveEntryIO.C index d5626972cc37fc25f92bb87655613bd1ecf6ccac..04cb8cf1652a357bdfed346982650de532c0d493 100644 --- a/src/OpenFOAM/db/dictionary/primitiveEntry/primitiveEntryIO.C +++ b/src/OpenFOAM/db/dictionary/primitiveEntry/primitiveEntryIO.C @@ -55,7 +55,7 @@ void Foam::primitiveEntry::append newElmt(tokenIndex()++) = currToken; } } - else if (currToken.isString()) + else if (currToken.isVariable()) { const string& w = currToken.stringToken(); diff --git a/src/OpenFOAM/primitives/functions/DataEntry/Table/TableBase.H b/src/OpenFOAM/primitives/functions/DataEntry/Table/TableBase.H index 929e151a0c7aca1b197546435cf9d928c4de1dde..da670e2db56a80ec8eecc6e781963219464e79ce 100644 --- a/src/OpenFOAM/primitives/functions/DataEntry/Table/TableBase.H +++ b/src/OpenFOAM/primitives/functions/DataEntry/Table/TableBase.H @@ -125,7 +125,7 @@ public: //- Construct from dictionary - note table is not populated TableBase(const word& name, const dictionary& dict); - //- Copy constructor + //- Copy constructor. Note: steals interpolator, tableSamples TableBase(const TableBase<Type>& tbl); diff --git a/src/fieldSources/Make/files b/src/fieldSources/Make/files index 41fecea8008b9daed1f4be8e3654e50121066bff..11f91ff58ad4e2d3a5429e9ac793043e6de4726c 100644 --- a/src/fieldSources/Make/files +++ b/src/fieldSources/Make/files @@ -3,7 +3,7 @@ basicSource/basicSourceIO.C basicSource/basicSourceList.C basicSource/IObasicSourceList.C -general/explicitSource/explicitSource.C +general/semiImplicitSource/semiImplicitSource.C general/explicitSetValue/explicitSetValue.C general/codedSource/codedSource.C diff --git a/src/fieldSources/general/explicitSource/ExplicitSource.C b/src/fieldSources/general/semiImplicitSource/SemiImplicitSource.C similarity index 71% rename from src/fieldSources/general/explicitSource/ExplicitSource.C rename to src/fieldSources/general/semiImplicitSource/SemiImplicitSource.C index 64ed783cb934e72e746717e0dbdab21a296fc173..2e556eaf01ca19736387fff22571e158b7b233ca 100644 --- a/src/fieldSources/general/explicitSource/ExplicitSource.C +++ b/src/fieldSources/general/semiImplicitSource/SemiImplicitSource.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 @@ -23,15 +23,16 @@ License \*---------------------------------------------------------------------------*/ -#include "ExplicitSource.H" +#include "SemiImplicitSource.H" #include "fvMesh.H" #include "fvMatrices.H" #include "DimensionedField.H" +#include "fvmSup.H" // * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * * // template<class Type> -const Foam::wordList Foam::ExplicitSource<Type>:: +const Foam::wordList Foam::SemiImplicitSource<Type>:: volumeModeTypeNames_ ( IStringStream("(absolute specific)")() @@ -41,8 +42,8 @@ volumeModeTypeNames_ // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // template<class Type> -typename Foam::ExplicitSource<Type>::volumeModeType -Foam::ExplicitSource<Type>::wordToVolumeModeType +typename Foam::SemiImplicitSource<Type>::volumeModeType +Foam::SemiImplicitSource<Type>::wordToVolumeModeType ( const word& vmtName ) const @@ -57,8 +58,8 @@ Foam::ExplicitSource<Type>::wordToVolumeModeType FatalErrorIn ( - "ExplicitSource<Type>::volumeModeType" - "ExplicitSource<Type>::wordToVolumeModeType(const word&)" + "SemiImplicitSource<Type>::volumeModeType" + "SemiImplicitSource<Type>::wordToVolumeModeType(const word&)" ) << "Unknown volumeMode type " << vmtName << ". Valid volumeMode types are:" << nl << volumeModeTypeNames_ << exit(FatalError); @@ -68,7 +69,7 @@ Foam::ExplicitSource<Type>::wordToVolumeModeType template<class Type> -Foam::word Foam::ExplicitSource<Type>::volumeModeTypeToWord +Foam::word Foam::SemiImplicitSource<Type>::volumeModeTypeToWord ( const volumeModeType& vmtType ) const @@ -85,7 +86,7 @@ Foam::word Foam::ExplicitSource<Type>::volumeModeTypeToWord template<class Type> -void Foam::ExplicitSource<Type>::setFieldData(const dictionary& dict) +void Foam::SemiImplicitSource<Type>::setFieldData(const dictionary& dict) { fieldNames_.setSize(dict.toc().size()); injectionRate_.setSize(fieldNames_.size()); @@ -111,7 +112,7 @@ void Foam::ExplicitSource<Type>::setFieldData(const dictionary& dict) // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // template<class Type> -Foam::ExplicitSource<Type>::ExplicitSource +Foam::SemiImplicitSource<Type>::SemiImplicitSource ( const word& name, const word& modelType, @@ -131,7 +132,7 @@ Foam::ExplicitSource<Type>::ExplicitSource // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template<class Type> -void Foam::ExplicitSource<Type>::addSup +void Foam::SemiImplicitSource<Type>::addSup ( fvMatrix<Type>& eqn, const label fieldI @@ -139,15 +140,17 @@ void Foam::ExplicitSource<Type>::addSup { if (debug) { - Info<< "ExplicitSource<"<< pTraits<Type>::typeName + Info<< "SemiImplicitSource<" << pTraits<Type>::typeName << ">::addSup for source " << name_ << endl; } + const GeometricField<Type, fvPatchField, volMesh>& psi = eqn.psi(); + DimensionedField<Type, volMesh> Su ( IOobject ( - name_ + fieldNames_[fieldI] + "Sup", + name_ + fieldNames_[fieldI] + "Su", mesh_.time().timeName(), mesh_, IOobject::NO_READ, @@ -163,9 +166,31 @@ void Foam::ExplicitSource<Type>::addSup false ); - UIndirectList<Type>(Su, cells_) = injectionRate_[fieldI]/VDash_; + UIndirectList<Type>(Su, cells_) = injectionRate_[fieldI].first()/VDash_; + + DimensionedField<scalar, volMesh> Sp + ( + IOobject + ( + name_ + fieldNames_[fieldI] + "Sp", + mesh_.time().timeName(), + mesh_, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh_, + dimensioned<scalar> + ( + "zero", + Su.dimensions()/psi.dimensions(), + 0.0 + ), + false + ); + + UIndirectList<scalar>(Sp, cells_) = injectionRate_[fieldI].second()/VDash_; - eqn += Su; + eqn += Su + fvm::Sp(Sp, psi); } diff --git a/src/fieldSources/general/explicitSource/ExplicitSource.H b/src/fieldSources/general/semiImplicitSource/SemiImplicitSource.H similarity index 78% rename from src/fieldSources/general/explicitSource/ExplicitSource.H rename to src/fieldSources/general/semiImplicitSource/SemiImplicitSource.H index 30a18dd5d39b8ecdfefdcf291b587ec73261f85c..94a174034b24589aeac0355edd2ba6250e543355 100644 --- a/src/fieldSources/general/explicitSource/ExplicitSource.H +++ b/src/fieldSources/general/semiImplicitSource/SemiImplicitSource.H @@ -22,21 +22,33 @@ License along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. Class - Foam::ExplicitSource + Foam::SemiImplicitSource Description - Explicit source + Semi-implicit source, described using an input dictionary. The injection + rate coefficients are specified as pairs of Su-Sp coefficients, i.e. - Sources described by: + \f[ + S(x) = S_u + S_p x + \f] + + where + \vartable + S(x) | net source for field 'x' + S_u | explicit source contribution + S_p | linearised implicit contribution + \endvartable + + Example of the source specification: \verbatim - <Type>ExplicitSourceCoeffs + <Type>SemiImplicitSourceCoeffs { volumeMode absolute; // specific - injectionRate + injectionRateSuSp { - k 30.7; - epsilon 1.5; + k (30.7 0); + epsilon (1.5 0); } } \verbatim @@ -49,12 +61,12 @@ SeeAlso Foam::basicSource SourceFiles - ExplicitSource.C + SemiImplicitSource.C \*---------------------------------------------------------------------------*/ -#ifndef ExplicitSource_H -#define ExplicitSource_H +#ifndef SemiImplicitSource_H +#define SemiImplicitSource_H #include "Tuple2.H" #include "basicSource.H" @@ -69,7 +81,7 @@ namespace Foam class fvMesh; template<class Type> -class ExplicitSource; +class SemiImplicitSource; // Forward declaration of friend functions @@ -77,15 +89,15 @@ template<class Type> Ostream& operator<< ( Ostream&, - const ExplicitSource<Type>& + const SemiImplicitSource<Type>& ); /*---------------------------------------------------------------------------*\ - Class ExplicitSource Declaration + Class SemiImplicitSource Declaration \*---------------------------------------------------------------------------*/ template<class Type> -class ExplicitSource +class SemiImplicitSource : public basicSource { @@ -115,7 +127,7 @@ protected: scalar VDash_; //- Source field values - List<Type> injectionRate_; + List<Tuple2<Type, scalar> > injectionRate_; // Protected functions @@ -133,13 +145,13 @@ protected: public: //- Runtime type information - TypeName("ExplicitSource"); + TypeName("SemiImplicitSource"); // Constructors //- Construct from components - ExplicitSource + SemiImplicitSource ( const word& name, const word& modelType, @@ -156,7 +168,7 @@ public: inline const volumeModeType& volumeMode() const; //- Return const access to the source field values - inline const List<Type>& injectionRate() const; + inline const List<Tuple2<Type, scalar> >& injectionRate() const; // Edit @@ -165,7 +177,7 @@ public: inline volumeModeType& volumeMode(); //- Return access to the source field values - inline List<Type>& injectionRate(); + inline List<Tuple2<Type, scalar> >& injectionRate(); // Evaluation @@ -191,13 +203,13 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // #ifdef NoRepository -# include "ExplicitSource.C" -# include "ExplicitSourceIO.C" +# include "SemiImplicitSource.C" +# include "SemiImplicitSourceIO.C" #endif // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -#include "ExplicitSourceI.H" +#include "SemiImplicitSourceI.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/fieldSources/general/explicitSource/ExplicitSourceI.H b/src/fieldSources/general/semiImplicitSource/SemiImplicitSourceI.H similarity index 72% rename from src/fieldSources/general/explicitSource/ExplicitSourceI.H rename to src/fieldSources/general/semiImplicitSource/SemiImplicitSourceI.H index e3f4b8aa63b1ac3ec5107c1f4384d4ca0849dad2..eb352de08a36c423ff63fe3bd24dfc0f079e9dc8 100644 --- a/src/fieldSources/general/explicitSource/ExplicitSourceI.H +++ b/src/fieldSources/general/semiImplicitSource/SemiImplicitSourceI.H @@ -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 @@ -23,35 +23,37 @@ License \*---------------------------------------------------------------------------*/ -#include "ExplicitSource.H" +#include "SemiImplicitSource.H" // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template<class Type> -inline const typename Foam::ExplicitSource<Type>::volumeModeType& -Foam::ExplicitSource<Type>::volumeMode() const +inline const typename Foam::SemiImplicitSource<Type>::volumeModeType& +Foam::SemiImplicitSource<Type>::volumeMode() const { return volumeMode_; } template<class Type> -inline const Foam::List<Type>& Foam::ExplicitSource<Type>::injectionRate() const +inline const Foam::List<Foam::Tuple2<Type, Foam::scalar> >& +Foam::SemiImplicitSource<Type>::injectionRate() const { return injectionRate_; } template<class Type> -inline typename Foam::ExplicitSource<Type>::volumeModeType& -Foam::ExplicitSource<Type>::volumeMode() +inline typename Foam::SemiImplicitSource<Type>::volumeModeType& +Foam::SemiImplicitSource<Type>::volumeMode() { return volumeMode_; } template<class Type> -inline Foam::List<Type>& Foam::ExplicitSource<Type>::injectionRate() +inline Foam::List<Foam::Tuple2<Type, +Foam::scalar> >& Foam::SemiImplicitSource<Type>::injectionRate() { return injectionRate_; } diff --git a/src/fieldSources/general/explicitSource/ExplicitSourceIO.C b/src/fieldSources/general/semiImplicitSource/SemiImplicitSourceIO.C similarity index 83% rename from src/fieldSources/general/explicitSource/ExplicitSourceIO.C rename to src/fieldSources/general/semiImplicitSource/SemiImplicitSourceIO.C index f2abe69cbd67d5f738b8db9b41418eee7a491b27..6b91798be649a9c9faec5ccb084e1443ce946c14 100644 --- a/src/fieldSources/general/explicitSource/ExplicitSourceIO.C +++ b/src/fieldSources/general/semiImplicitSource/SemiImplicitSourceIO.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 @@ -23,12 +23,12 @@ License \*---------------------------------------------------------------------------*/ -#include "ExplicitSource.H" +#include "SemiImplicitSource.H" // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template<class Type> -void Foam::ExplicitSource<Type>::writeData(Ostream& os) const +void Foam::SemiImplicitSource<Type>::writeData(Ostream& os) const { os << indent << name_ << endl; dict_.write(os); @@ -36,12 +36,12 @@ void Foam::ExplicitSource<Type>::writeData(Ostream& os) const template<class Type> -bool Foam::ExplicitSource<Type>::read(const dictionary& dict) +bool Foam::SemiImplicitSource<Type>::read(const dictionary& dict) { if (basicSource::read(dict)) { volumeMode_ = wordToVolumeModeType(coeffs_.lookup("volumeMode")); - setFieldData(coeffs_.subDict("injectionRate")); + setFieldData(coeffs_.subDict("injectionRateSuSp")); return true; } diff --git a/src/fieldSources/general/explicitSource/explicitSource.C b/src/fieldSources/general/semiImplicitSource/semiImplicitSource.C similarity index 78% rename from src/fieldSources/general/explicitSource/explicitSource.C rename to src/fieldSources/general/semiImplicitSource/semiImplicitSource.C index 338a4220593b5bd424e338bdb500c8859b9b90cb..e3b294fa59d2b210d1a6802f597c7e138db3300a 100644 --- a/src/fieldSources/general/explicitSource/explicitSource.C +++ b/src/fieldSources/general/semiImplicitSource/semiImplicitSource.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 @@ -24,17 +24,17 @@ License \*---------------------------------------------------------------------------*/ #include "makeBasicSource.H" -#include "ExplicitSource.H" +#include "SemiImplicitSource.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { - makeBasicSource(ExplicitSource, scalar); - makeBasicSource(ExplicitSource, vector); - makeBasicSource(ExplicitSource, sphericalTensor); - makeBasicSource(ExplicitSource, symmTensor); - makeBasicSource(ExplicitSource, tensor); + makeBasicSource(SemiImplicitSource, scalar); + makeBasicSource(SemiImplicitSource, vector); + makeBasicSource(SemiImplicitSource, sphericalTensor); + makeBasicSource(SemiImplicitSource, symmTensor); + makeBasicSource(SemiImplicitSource, tensor); } diff --git a/src/finiteVolume/Make/files b/src/finiteVolume/Make/files index d13d0124687f353e9987288d01d812a726195e9b..eee3fd6894de4f6bde53846973c0a223103a5eea 100644 --- a/src/finiteVolume/Make/files +++ b/src/finiteVolume/Make/files @@ -102,6 +102,7 @@ $(constraintFvPatchFields)/cyclicAMI/cyclicAMIFvPatchFields.C $(constraintFvPatchFields)/cyclicSlip/cyclicSlipFvPatchFields.C $(constraintFvPatchFields)/empty/emptyFvPatchFields.C $(constraintFvPatchFields)/jumpCyclic/jumpCyclicFvPatchFields.C +$(constraintFvPatchFields)/jumpCyclicAMI/jumpCyclicAMIFvPatchFields.C $(constraintFvPatchFields)/nonuniformTransformCyclic/nonuniformTransformCyclicFvPatchFields.C $(constraintFvPatchFields)/processor/processorFvPatchFields.C $(constraintFvPatchFields)/processor/processorFvPatchScalarField.C @@ -114,66 +115,69 @@ derivedFvPatchFields = $(fvPatchFields)/derived $(derivedFvPatchFields)/activeBaffleVelocity/activeBaffleVelocityFvPatchVectorField.C $(derivedFvPatchFields)/activePressureForceBaffleVelocity/activePressureForceBaffleVelocityFvPatchVectorField.C $(derivedFvPatchFields)/advective/advectiveFvPatchFields.C -$(derivedFvPatchFields)/codedMixed/codedMixedFvPatchFields.C +$(derivedFvPatchFields)/buoyantPressure/buoyantPressureFvPatchScalarField.C $(derivedFvPatchFields)/codedFixedValue/codedFixedValueFvPatchFields.C -$(derivedFvPatchFields)/mappedField/mappedFieldFvPatchFields.C -$(derivedFvPatchFields)/mappedFixedInternalValue/mappedFixedInternalValueFvPatchFields.C -$(derivedFvPatchFields)/mappedFixedPushedInternalValue/mappedFixedPushedInternalValueFvPatchFields.C -$(derivedFvPatchFields)/mappedFixedValue/mappedFixedValueFvPatchFields.C -$(derivedFvPatchFields)/mappedVelocityFluxFixedValue/mappedVelocityFluxFixedValueFvPatchField.C -$(derivedFvPatchFields)/mappedFlowRate/mappedFlowRateFvPatchVectorField.C -$(derivedFvPatchFields)/fixedMean/fixedMeanFvPatchFields.C +$(derivedFvPatchFields)/codedMixed/codedMixedFvPatchFields.C +$(derivedFvPatchFields)/cylindricalInletVelocity/cylindricalInletVelocityFvPatchVectorField.C $(derivedFvPatchFields)/fan/fanFvPatchFields.C $(derivedFvPatchFields)/fanPressure/fanPressureFvPatchScalarField.C -$(derivedFvPatchFields)/buoyantPressure/buoyantPressureFvPatchScalarField.C -$(derivedFvPatchFields)/multiphaseFixedFluxPressure/multiphaseFixedFluxPressureFvPatchScalarField.C $(derivedFvPatchFields)/fixedFluxPressure/fixedFluxPressureFvPatchScalarField.C $(derivedFvPatchFields)/fixedInternalValueFvPatchField/fixedInternalValueFvPatchFields.C +$(derivedFvPatchFields)/fixedJump/fixedJumpFvPatchFields.C +$(derivedFvPatchFields)/fixedJumpAMI/fixedJumpAMIFvPatchFields.C +$(derivedFvPatchFields)/fixedMean/fixedMeanFvPatchFields.C $(derivedFvPatchFields)/fixedNormalSlip/fixedNormalSlipFvPatchFields.C $(derivedFvPatchFields)/fixedPressureCompressibleDensity/fixedPressureCompressibleDensityFvPatchScalarField.C +$(derivedFvPatchFields)/flowRateInletVelocity/flowRateInletVelocityFvPatchVectorField.C $(derivedFvPatchFields)/fluxCorrectedVelocity/fluxCorrectedVelocityFvPatchVectorField.C $(derivedFvPatchFields)/freestream/freestreamFvPatchFields.C $(derivedFvPatchFields)/freestreamPressure/freestreamPressureFvPatchScalarField.C $(derivedFvPatchFields)/inletOutlet/inletOutletFvPatchFields.C $(derivedFvPatchFields)/inletOutletTotalTemperature/inletOutletTotalTemperatureFvPatchScalarField.C -$(derivedFvPatchFields)/flowRateInletVelocity/flowRateInletVelocityFvPatchVectorField.C +$(derivedFvPatchFields)/mappedField/mappedFieldFvPatchFields.C +$(derivedFvPatchFields)/mappedFixedInternalValue/mappedFixedInternalValueFvPatchFields.C +$(derivedFvPatchFields)/mappedFixedPushedInternalValue/mappedFixedPushedInternalValueFvPatchFields.C +$(derivedFvPatchFields)/mappedFixedValue/mappedFixedValueFvPatchFields.C +$(derivedFvPatchFields)/mappedFlowRate/mappedFlowRateFvPatchVectorField.C +$(derivedFvPatchFields)/mappedVelocityFluxFixedValue/mappedVelocityFluxFixedValueFvPatchField.C $(derivedFvPatchFields)/movingWallVelocity/movingWallVelocityFvPatchVectorField.C -$(derivedFvPatchFields)/rotatingWallVelocity/rotatingWallVelocityFvPatchVectorField.C -$(derivedFvPatchFields)/translatingWallVelocity/translatingWallVelocityFvPatchVectorField.C +$(derivedFvPatchFields)/multiphaseFixedFluxPressure/multiphaseFixedFluxPressureFvPatchScalarField.C $(derivedFvPatchFields)/oscillatingFixedValue/oscillatingFixedValueFvPatchFields.C $(derivedFvPatchFields)/outletInlet/outletInletFvPatchFields.C +$(derivedFvPatchFields)/outletMappedUniformInlet/outletMappedUniformInletFvPatchFields.C $(derivedFvPatchFields)/partialSlip/partialSlipFvPatchFields.C +$(derivedFvPatchFields)/phaseHydrostaticPressure/phaseHydrostaticPressureFvPatchScalarField.C $(derivedFvPatchFields)/pressureDirectedInletOutletVelocity/pressureDirectedInletOutletVelocityFvPatchVectorField.C -$(derivedFvPatchFields)/pressureNormalInletOutletVelocity/pressureNormalInletOutletVelocityFvPatchVectorField.C $(derivedFvPatchFields)/pressureDirectedInletVelocity/pressureDirectedInletVelocityFvPatchVectorField.C -$(derivedFvPatchFields)/pressureInletOutletVelocity/pressureInletOutletVelocityFvPatchVectorField.C $(derivedFvPatchFields)/pressureInletOutletParSlipVelocity/pressureInletOutletParSlipVelocityFvPatchVectorField.C +$(derivedFvPatchFields)/pressureInletOutletVelocity/pressureInletOutletVelocityFvPatchVectorField.C $(derivedFvPatchFields)/pressureInletUniformVelocity/pressureInletUniformVelocityFvPatchVectorField.C $(derivedFvPatchFields)/pressureInletVelocity/pressureInletVelocityFvPatchVectorField.C +$(derivedFvPatchFields)/pressureNormalInletOutletVelocity/pressureNormalInletOutletVelocityFvPatchVectorField.C $(derivedFvPatchFields)/rotatingPressureInletOutletVelocity/rotatingPressureInletOutletVelocityFvPatchVectorField.C $(derivedFvPatchFields)/rotatingTotalPressure/rotatingTotalPressureFvPatchScalarField.C +$(derivedFvPatchFields)/rotatingWallVelocity/rotatingWallVelocityFvPatchVectorField.C $(derivedFvPatchFields)/slip/slipFvPatchFields.C $(derivedFvPatchFields)/supersonicFreestream/supersonicFreestreamFvPatchVectorField.C $(derivedFvPatchFields)/surfaceNormalFixedValue/surfaceNormalFixedValueFvPatchVectorField.C +$(derivedFvPatchFields)/swirlFlowRateInletVelocity/swirlFlowRateInletVelocityFvPatchVectorField.C $(derivedFvPatchFields)/syringePressure/syringePressureFvPatchScalarField.C $(derivedFvPatchFields)/timeVaryingMappedFixedValue/AverageIOFields.C $(derivedFvPatchFields)/timeVaryingMappedFixedValue/timeVaryingMappedFixedValueFvPatchFields.C $(derivedFvPatchFields)/totalPressure/totalPressureFvPatchScalarField.C $(derivedFvPatchFields)/totalTemperature/totalTemperatureFvPatchScalarField.C +$(derivedFvPatchFields)/translatingWallVelocity/translatingWallVelocityFvPatchVectorField.C $(derivedFvPatchFields)/turbulentInlet/turbulentInletFvPatchFields.C $(derivedFvPatchFields)/turbulentIntensityKineticEnergyInlet/turbulentIntensityKineticEnergyInletFvPatchScalarField.C +$(derivedFvPatchFields)/uniformDensityHydrostaticPressure/uniformDensityHydrostaticPressureFvPatchScalarField.C $(derivedFvPatchFields)/uniformFixedValue/uniformFixedValueFvPatchFields.C +$(derivedFvPatchFields)/uniformJump/uniformJumpFvPatchFields.C +$(derivedFvPatchFields)/uniformJumpAMI/uniformJumpAMIFvPatchFields.C $(derivedFvPatchFields)/uniformTotalPressure/uniformTotalPressureFvPatchScalarField.C -$(derivedFvPatchFields)/waveTransmissive/waveTransmissiveFvPatchFields.C -$(derivedFvPatchFields)/uniformDensityHydrostaticPressure/uniformDensityHydrostaticPressureFvPatchScalarField.C -$(derivedFvPatchFields)/swirlFlowRateInletVelocity/swirlFlowRateInletVelocityFvPatchVectorField.C -$(derivedFvPatchFields)/cylindricalInletVelocity/cylindricalInletVelocityFvPatchVectorField.C -$(derivedFvPatchFields)/outletMappedUniformInlet/outletMappedUniformInletFvPatchFields.C -$(derivedFvPatchFields)/waveSurfacePressure/waveSurfacePressureFvPatchScalarField.C -$(derivedFvPatchFields)/phaseHydrostaticPressure/phaseHydrostaticPressureFvPatchScalarField.C $(derivedFvPatchFields)/variableHeightFlowRate/variableHeightFlowRateFvPatchField.C $(derivedFvPatchFields)/variableHeightFlowRateInletVelocity/variableHeightFlowRateInletVelocityFvPatchVectorField.C -$(derivedFvPatchFields)/temperatureJump/temperatureJumpFvPatchScalarField.C +$(derivedFvPatchFields)/waveTransmissive/waveTransmissiveFvPatchFields.C +$(derivedFvPatchFields)/waveSurfacePressure/waveSurfacePressureFvPatchScalarField.C fvsPatchFields = fields/fvsPatchFields $(fvsPatchFields)/fvsPatchField/fvsPatchFields.C diff --git a/src/finiteVolume/fields/fvPatchFields/constraint/jumpCyclic/jumpCyclicFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/constraint/jumpCyclic/jumpCyclicFvPatchField.C index 193008daffc3aa07cba17a13113b16bb56f0144e..db6849d26746be1dbdd6a5ffe56feed4e8dde12b 100644 --- a/src/finiteVolume/fields/fvPatchFields/constraint/jumpCyclic/jumpCyclicFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/constraint/jumpCyclic/jumpCyclicFvPatchField.C @@ -77,7 +77,6 @@ jumpCyclicFvPatchField<Type>::jumpCyclicFvPatchField const jumpCyclicFvPatchField<Type>& ptf ) : - cyclicLduInterfaceField(), cyclicFvPatchField<Type>(ptf) {} @@ -105,12 +104,11 @@ tmp<Field<Type> > jumpCyclicFvPatchField<Type>::patchNeighbourField() const tmp<Field<Type> > tpnf(new Field<Type>(this->size())); Field<Type>& pnf = tpnf(); - tmp<Field<scalar> > tjf = jump(); + Field<Type> jf(this->jump()); if (!this->cyclicPatch().owner()) { - tjf = -tjf; + jf *= -1.0; } - const Field<scalar>& jf = tjf(); if (this->doTransform()) { @@ -149,14 +147,15 @@ void jumpCyclicFvPatchField<Type>::updateInterfaceMatrix const labelUList& nbrFaceCells = this->cyclicPatch().neighbFvPatch().faceCells(); - if (&psiInternal == &this->internalField()) + // for AMG solve - only apply jump to finest level + if (psiInternal.size() == this->internalField().size()) { - tmp<Field<scalar> > tjf = jump()().component(cmpt); + Field<scalar> jf(this->jump()().component(cmpt)); + if (!this->cyclicPatch().owner()) { - tjf = -tjf; + jf *= -1.0; } - const Field<scalar>& jf = tjf(); forAll(*this, facei) { @@ -197,14 +196,15 @@ void jumpCyclicFvPatchField<Type>::updateInterfaceMatrix const labelUList& nbrFaceCells = this->cyclicPatch().neighbFvPatch().faceCells(); - if (&psiInternal == &this->internalField()) + // for AMG solve - only apply jump to finest level + if (psiInternal.size() == this->internalField().size()) { - tmp<Field<Type> > tjf = jump(); + Field<Type> jf(this->jump()); + if (!this->cyclicPatch().owner()) { - tjf = -tjf; + jf *= -1.0; } - const Field<Type>& jf = tjf(); forAll(*this, facei) { diff --git a/src/finiteVolume/fields/fvPatchFields/constraint/jumpCyclicAMI/jumpCyclicAMIFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/constraint/jumpCyclicAMI/jumpCyclicAMIFvPatchField.C new file mode 100644 index 0000000000000000000000000000000000000000..87d7c20efd5ba6f36d52eb22b8596efd211eb1bc --- /dev/null +++ b/src/finiteVolume/fields/fvPatchFields/constraint/jumpCyclicAMI/jumpCyclicAMIFvPatchField.C @@ -0,0 +1,201 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "jumpCyclicAMIFvPatchField.H" +#include "transformField.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template<class Type> +Foam::jumpCyclicAMIFvPatchField<Type>::jumpCyclicAMIFvPatchField +( + const fvPatch& p, + const DimensionedField<Type, volMesh>& iF +) +: + cyclicAMIFvPatchField<Type>(p, iF) +{} + + +template<class Type> +Foam::jumpCyclicAMIFvPatchField<Type>::jumpCyclicAMIFvPatchField +( + const jumpCyclicAMIFvPatchField<Type>& ptf, + const fvPatch& p, + const DimensionedField<Type, volMesh>& iF, + const fvPatchFieldMapper& mapper +) +: + cyclicAMIFvPatchField<Type>(ptf, p, iF, mapper) +{} + + +template<class Type> +Foam::jumpCyclicAMIFvPatchField<Type>::jumpCyclicAMIFvPatchField +( + const fvPatch& p, + const DimensionedField<Type, volMesh>& iF, + const dictionary& dict +) +: + cyclicAMIFvPatchField<Type>(p, iF, dict) +{ + // Call this evaluation in derived classes + //this->evaluate(Pstream::blocking); +} + + +template<class Type> +Foam::jumpCyclicAMIFvPatchField<Type>::jumpCyclicAMIFvPatchField +( + const jumpCyclicAMIFvPatchField<Type>& ptf +) +: + cyclicAMIFvPatchField<Type>(ptf) +{} + + +template<class Type> +Foam::jumpCyclicAMIFvPatchField<Type>::jumpCyclicAMIFvPatchField +( + const jumpCyclicAMIFvPatchField<Type>& ptf, + const DimensionedField<Type, volMesh>& iF +) +: + cyclicAMIFvPatchField<Type>(ptf, iF) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template<class Type> +Foam::tmp<Foam::Field<Type> > +Foam::jumpCyclicAMIFvPatchField<Type>::patchNeighbourField() const +{ + const Field<Type>& iField = this->internalField(); + const labelUList& nbrFaceCells = + this->cyclicAMIPatch().cyclicAMIPatch().neighbPatch().faceCells(); + + Field<Type> pnf(iField, nbrFaceCells); + tmp<Field<Type> > tpnf + ( + new Field<Type>(this->cyclicAMIPatch().interpolate(pnf)) + ); + + if (this->doTransform()) + { + tpnf = transform(this->forwardT(), tpnf); + } + + tmp<Field<Type> > tjf = jump(); + if (!this->cyclicAMIPatch().owner()) + { + tjf = -tjf; + } + + return tpnf - tjf; +} + + +template<class Type> +void Foam::jumpCyclicAMIFvPatchField<Type>::updateInterfaceMatrix +( + scalarField& result, + const scalarField& psiInternal, + const scalarField& coeffs, + const direction cmpt, + const Pstream::commsTypes +) const +{ + const labelUList& nbrFaceCells = + this->cyclicAMIPatch().cyclicAMIPatch().neighbPatch().faceCells(); + + scalarField pnf(psiInternal, nbrFaceCells); + + pnf = this->cyclicAMIPatch().interpolate(pnf); + + // for AMG solve - only apply jump to finest level + if (psiInternal.size() == this->internalField().size()) + { + tmp<Field<scalar> > tjf = jump()().component(cmpt); + if (!this->cyclicAMIPatch().owner()) + { + tjf = -tjf; + } + pnf -= tjf; + } + + // Transform according to the transformation tensors + this->transformCoupleField(pnf, cmpt); + + // Multiply the field by coefficients and add into the result + const labelUList& faceCells = this->cyclicAMIPatch().faceCells(); + forAll(faceCells, elemI) + { + result[faceCells[elemI]] -= coeffs[elemI]*pnf[elemI]; + } +} + + +template<class Type> +void Foam::jumpCyclicAMIFvPatchField<Type>::updateInterfaceMatrix +( + Field<Type>& result, + const Field<Type>& psiInternal, + const scalarField& coeffs, + const Pstream::commsTypes +) const +{ + const labelUList& nbrFaceCells = + this->cyclicAMIPatch().cyclicAMIPatch().neighbPatch().faceCells(); + + Field<Type> pnf(psiInternal, nbrFaceCells); + + pnf = this->cyclicAMIPatch().interpolate(pnf); + + // for AMG solve - only apply jump to finest level + if (psiInternal.size() == this->internalField().size()) + { + tmp<Field<Type> > tjf = jump(); + if (!this->cyclicAMIPatch().owner()) + { + tjf = -tjf; + } + pnf -= tjf; + } + + // Transform according to the transformation tensors + this->transformCoupleField(pnf); + + // Multiply the field by coefficients and add into the result + const labelUList& faceCells = this->cyclicAMIPatch().faceCells(); + forAll(faceCells, elemI) + { + result[faceCells[elemI]] -= coeffs[elemI]*pnf[elemI]; + } +} + + +// ************************************************************************* // diff --git a/src/finiteVolume/fields/fvPatchFields/constraint/jumpCyclicAMI/jumpCyclicAMIFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/constraint/jumpCyclicAMI/jumpCyclicAMIFvPatchField.H new file mode 100644 index 0000000000000000000000000000000000000000..6759b09a36c57ba5a49b75d48147e216f010126e --- /dev/null +++ b/src/finiteVolume/fields/fvPatchFields/constraint/jumpCyclicAMI/jumpCyclicAMIFvPatchField.H @@ -0,0 +1,165 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 <http://www.gnu.org/licenses/>. + +Class + Foam::jumpCyclicAMIFvPatchField + +Group + grpCoupledBoundaryConditions + +Description + This boundary condition provides a base class that enforces a cyclic + condition with a specified 'jump' (or offset) between a pair of boundaries, + whereby communication between the patches is performed using an arbitrary + mesh interface (AMI) interpolation. + +SeeAlso + Foam::cyclicAMIFvPatchField + +SourceFiles + jumpCyclicAMIFvPatchField.C + +\*---------------------------------------------------------------------------*/ + +#ifndef jumpCyclicAMIFvPatchField_H +#define jumpCyclicAMIFvPatchField_H + +#include "cyclicAMIFvPatchField.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class jumpCyclicAMIFvPatchField Declaration +\*---------------------------------------------------------------------------*/ + +template<class Type> +class jumpCyclicAMIFvPatchField +: + public cyclicAMIFvPatchField<Type> +{ + +public: + + //- Runtime type information + TypeName("jumpCyclicAMI"); + + + // Constructors + + //- Construct from patch and internal field + jumpCyclicAMIFvPatchField + ( + const fvPatch&, + const DimensionedField<Type, volMesh>& + ); + + //- Construct from patch, internal field and dictionary + jumpCyclicAMIFvPatchField + ( + const fvPatch&, + const DimensionedField<Type, volMesh>&, + const dictionary& + ); + + //- Construct by mapping given jumpCyclicAMIFvPatchField onto a + // new patch + jumpCyclicAMIFvPatchField + ( + const jumpCyclicAMIFvPatchField<Type>&, + const fvPatch&, + const DimensionedField<Type, volMesh>&, + const fvPatchFieldMapper& + ); + + //- Construct as copy + jumpCyclicAMIFvPatchField + ( + const jumpCyclicAMIFvPatchField<Type>& + ); + + //- Construct as copy setting internal field reference + jumpCyclicAMIFvPatchField + ( + const jumpCyclicAMIFvPatchField<Type>&, + const DimensionedField<Type, volMesh>& + ); + + + // Member functions + + // Access + + //- Return the interface type + virtual const word& interfaceFieldType() const + { + return cyclicAMIFvPatchField<Type>::type(); + } + + //- Return the "jump" across the patch as a "half" field + virtual tmp<Field<Type> > jump() const = 0; + + + // Evaluation functions + + //- Return neighbour coupled given internal cell data + tmp<Field<Type> > patchNeighbourField() const; + + //- Update result field based on interface functionality + virtual void updateInterfaceMatrix + ( + scalarField& result, + const scalarField& psiInternal, + const scalarField& coeffs, + const direction cmpt, + const Pstream::commsTypes commsType + ) const; + + //- Update result field based on interface functionality + virtual void updateInterfaceMatrix + ( + Field<Type>&, + const Field<Type>&, + const scalarField&, + const Pstream::commsTypes commsType + ) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "jumpCyclicAMIFvPatchField.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/finiteVolume/fields/fvPatchFields/constraint/jumpCyclicAMI/jumpCyclicAMIFvPatchFields.C b/src/finiteVolume/fields/fvPatchFields/constraint/jumpCyclicAMI/jumpCyclicAMIFvPatchFields.C new file mode 100644 index 0000000000000000000000000000000000000000..323f460d9f7d99139c13f5d878c6b6e2094a9c05 --- /dev/null +++ b/src/finiteVolume/fields/fvPatchFields/constraint/jumpCyclicAMI/jumpCyclicAMIFvPatchFields.C @@ -0,0 +1,43 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "jumpCyclicAMIFvPatchFields.H" +#include "addToRunTimeSelectionTable.H" +#include "volFields.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +makePatchFieldsTypeName(jumpCyclicAMI); + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/finiteVolume/fields/fvPatchFields/constraint/jumpCyclicAMI/jumpCyclicAMIFvPatchFields.H b/src/finiteVolume/fields/fvPatchFields/constraint/jumpCyclicAMI/jumpCyclicAMIFvPatchFields.H new file mode 100644 index 0000000000000000000000000000000000000000..6f5039e0bc7db0be77e9cba6638b8134102a6c0a --- /dev/null +++ b/src/finiteVolume/fields/fvPatchFields/constraint/jumpCyclicAMI/jumpCyclicAMIFvPatchFields.H @@ -0,0 +1,49 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#ifndef jumpCyclicAMIFvPatchFields_H +#define jumpCyclicAMIFvPatchFields_H + +#include "jumpCyclicAMIFvPatchField.H" +#include "fieldTypes.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +makePatchTypeFieldTypedefs(jumpCyclicAMI); + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/finiteVolume/fields/fvPatchFields/constraint/jumpCyclicAMI/jumpCyclicAMIFvPatchFieldsFwd.H b/src/finiteVolume/fields/fvPatchFields/constraint/jumpCyclicAMI/jumpCyclicAMIFvPatchFieldsFwd.H new file mode 100644 index 0000000000000000000000000000000000000000..c4bc6547b06c39a51dc11e001ebbe2da50b8945d --- /dev/null +++ b/src/finiteVolume/fields/fvPatchFields/constraint/jumpCyclicAMI/jumpCyclicAMIFvPatchFieldsFwd.H @@ -0,0 +1,50 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#ifndef jumpCyclicAMIFvPatchFieldsFwd_H +#define jumpCyclicAMIFvPatchFieldsFwd_H + +#include "fieldTypes.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +template<class Type> class jumpCyclicAMIFvPatchField; + +makePatchTypeFieldTypedefs(jumpCyclicAMI); + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchField.C index 477b242b76a0973b587c158780c0b199fda55568..3a150c6f70792102426a0c851279fe19c0838c66 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchField.C @@ -34,8 +34,7 @@ Foam::fanFvPatchField<Type>::fanFvPatchField const DimensionedField<Type, volMesh>& iF ) : - fixedJumpFvPatchField<Type>(p, iF), - jumpTable_(0) + uniformJumpFvPatchField<Type>(p, iF) {} @@ -48,8 +47,7 @@ Foam::fanFvPatchField<Type>::fanFvPatchField const fvPatchFieldMapper& mapper ) : - fixedJumpFvPatchField<Type>(ptf, p, iF, mapper), - jumpTable_(ptf.jumpTable_().clone().ptr()) + uniformJumpFvPatchField<Type>(ptf, p, iF, mapper) {} @@ -61,8 +59,7 @@ Foam::fanFvPatchField<Type>::fanFvPatchField const dictionary& dict ) : - fixedJumpFvPatchField<Type>(p, iF), - jumpTable_(DataEntry<Type>::New("jumpTable", dict)) + uniformJumpFvPatchField<Type>(p, iF, dict) {} @@ -72,9 +69,7 @@ Foam::fanFvPatchField<Type>::fanFvPatchField const fanFvPatchField<Type>& ptf ) : - cyclicLduInterfaceField(), - fixedJumpFvPatchField<Type>(ptf), - jumpTable_(ptf.jumpTable_().clone().ptr()) + uniformJumpFvPatchField<Type>(ptf) {} @@ -85,25 +80,8 @@ Foam::fanFvPatchField<Type>::fanFvPatchField const DimensionedField<Type, volMesh>& iF ) : - fixedJumpFvPatchField<Type>(ptf, iF), - jumpTable_(ptf.jumpTable_().clone().ptr()) + uniformJumpFvPatchField<Type>(ptf, iF) {} -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - - -template<class Type> -void Foam::fanFvPatchField<Type>::write(Ostream& os) const -{ - - fixedJumpFvPatchField<Type>::write(os); - if (this->cyclicPatch().owner()) - { - jumpTable_->writeData(os); - } - this->writeEntry("value", os); -} - - // ************************************************************************* // diff --git a/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchField.H index 3eea1382f39400ec5f98a6b1ed4e3109459d87df..463ebeb543602d0a1dd0e4291b626b6ef1101307 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchField.H @@ -83,7 +83,7 @@ SourceFiles #ifndef fanFvPatchField_H #define fanFvPatchField_H -#include "fixedJumpFvPatchField.H" +#include "uniformJumpFvPatchField.H" #include "DataEntry.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -98,13 +98,8 @@ namespace Foam template<class Type> class fanFvPatchField : - public fixedJumpFvPatchField<Type> + public uniformJumpFvPatchField<Type> { - // Private data - - //- Interpolation table - autoPtr<DataEntry<Type> > jumpTable_; - public: @@ -179,10 +174,6 @@ public: //- Update the coefficients associated with the patch field virtual void updateCoeffs(); - - - //- Write - virtual void write(Ostream&) const; }; diff --git a/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchFields.C b/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchFields.C index 1b291d500cc548e71adc183e198c97c364b2822e..668d43483de22fd7e282f9d999bea437d36ee6a3 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchFields.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchFields.C @@ -53,8 +53,7 @@ Foam::fanFvPatchField<Foam::scalar>::fanFvPatchField const dictionary& dict ) : - fixedJumpFvPatchField<scalar>(p, iF), - jumpTable_(new DataEntry<scalar>("jumpTable")) + uniformJumpFvPatchField<scalar>(p, iF) { if (this->cyclicPatch().owner()) { @@ -83,7 +82,7 @@ Foam::fanFvPatchField<Foam::scalar>::fanFvPatchField } } - jumpTable_.reset + this->jumpTable_.reset ( new polynomial("jumpTable", coeffs) ); @@ -91,10 +90,14 @@ Foam::fanFvPatchField<Foam::scalar>::fanFvPatchField else { // Generic input constructed from dictionary - jumpTable_ = DataEntry<scalar>::New("jumpTable", dict); + this->jumpTable_ = DataEntry<scalar>::New("jumpTable", dict); } } - + else + { + // Dummy jump table + this->jumpTable_.reset(new DataEntry<scalar>("jumpTable")); + } if (dict.found("value")) { @@ -136,10 +139,10 @@ void Foam::fanFvPatchField<Foam::scalar>::updateCoeffs() Un /= patch().lookupPatchField<volScalarField, scalar>("rho"); } - jump_ = jumpTable_->value(Un); + this->jump_ = this->jumpTable_->value(Un); } - fixedJumpFvPatchField<scalar>::updateCoeffs(); + uniformJumpFvPatchField<scalar>::updateCoeffs(); } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/fixedJump/fixedJumpFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/fixedJump/fixedJumpFvPatchField.C index fd2050ffcc0d6cb6c005bfdbe354f2bf0bbcea2f..e58270ec638df26b663319261278f6661d3f9b12 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/fixedJump/fixedJumpFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/fixedJump/fixedJumpFvPatchField.C @@ -72,7 +72,6 @@ Foam::fixedJumpFvPatchField<Type>::fixedJumpFvPatchField const fixedJumpFvPatchField<Type>& ptf ) : - cyclicLduInterfaceField(), jumpCyclicFvPatchField<Type>(ptf), jump_(ptf.jump_) {} @@ -92,6 +91,23 @@ Foam::fixedJumpFvPatchField<Type>::fixedJumpFvPatchField // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // +template<class Type> +Foam::tmp<Foam::Field<Type> > Foam::fixedJumpFvPatchField<Type>::jump() const +{ + if (this->cyclicPatch().owner()) + { + return jump_; + } + else + { + return refCast<const fixedJumpFvPatchField<Type> > + ( + this->neighbourPatchField() + ).jump(); + } +} + + template<class Type> void Foam::fixedJumpFvPatchField<Type>::autoMap ( @@ -124,6 +140,7 @@ void Foam::fixedJumpFvPatchField<Type>::write(Ostream& os) const fvPatchField<Type>::write(os); os.writeKeyword("patchType") << "cyclic" << token::END_STATEMENT << nl; jump_.writeEntry("jump", os); + this->writeEntry("value", os); } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/fixedJump/fixedJumpFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/derived/fixedJump/fixedJumpFvPatchField.H index 30ec57fc54eb35c11df20a7f18fcfdde72f659be..ede9fea8af48fca9c9901037f61b5dbd3669f695 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/fixedJump/fixedJumpFvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/fixedJump/fixedJumpFvPatchField.H @@ -28,14 +28,37 @@ Group grpCoupledBoundaryConditions Description - Base class for "jump" of a field<type> + This boundary condition provides a jump condition, using the \c cyclic + condition as a base. + + The jump is specified as a fixed value field, applied as an offset to the + 'owner' patch. + + \heading Patch usage + + \table + Property | Description | Required | Default value + patchType | underlying patch type should be \c cyclic| yes | + jump | current jump value | yes | + \endtable + + Example of the boundary condition specification: + \verbatim + myPatch + { + type fixedJump; + patchType cyclic; + jump uniform 10; + } + \endverbatim + + The above example shows the use of a fixed jump of '10'. Note - not used directly + The underlying \c patchType should be set to \c cyclic SeeAlso - Foam::fanFvPatchScalarField - Foam::fanPressureFvPatchScalarField + Foam::jumpCyclicFvPatchField SourceFiles fixedJumpFvPatchField.C @@ -72,6 +95,9 @@ protected: public: + //- Runtime type information + TypeName("fixedJump"); + // Constructors //- Construct from patch and internal field @@ -138,21 +164,8 @@ public: // Access - //- Return the "jump" across the patch. - virtual tmp<Field<Type> > jump() const - { - if (this->cyclicPatch().owner()) - { - return jump_; - } - else - { - return refCast<const fixedJumpFvPatchField<Type> > - ( - this->neighbourPatchField() - ).jump(); - } - } + //- Return the "jump" across the patch + virtual tmp<Field<Type> > jump() const; // Mapping functions diff --git a/src/finiteVolume/fields/fvPatchFields/derived/fixedJump/fixedJumpFvPatchFields.C b/src/finiteVolume/fields/fvPatchFields/derived/fixedJump/fixedJumpFvPatchFields.C new file mode 100644 index 0000000000000000000000000000000000000000..b06849691a0cba40004f7305fa4bcb6980d71993 --- /dev/null +++ b/src/finiteVolume/fields/fvPatchFields/derived/fixedJump/fixedJumpFvPatchFields.C @@ -0,0 +1,43 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "fixedJumpFvPatchFields.H" +#include "addToRunTimeSelectionTable.H" +#include "volFields.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +makePatchFields(fixedJump); + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/finiteVolume/fields/fvPatchFields/derived/fixedJump/fixedJumpFvPatchFields.H b/src/finiteVolume/fields/fvPatchFields/derived/fixedJump/fixedJumpFvPatchFields.H new file mode 100644 index 0000000000000000000000000000000000000000..444d3259bdc05c879b8943ca4c10521e99e142ab --- /dev/null +++ b/src/finiteVolume/fields/fvPatchFields/derived/fixedJump/fixedJumpFvPatchFields.H @@ -0,0 +1,49 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#ifndef fixedJumpFvPatchFields_H +#define fixedJumpFvPatchFields_H + +#include "fixedJumpFvPatchField.H" +#include "fieldTypes.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +makePatchTypeFieldTypedefs(fixedJump); + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/finiteVolume/fields/fvPatchFields/derived/fixedJump/fixedJumpFvPatchFieldsFwd.H b/src/finiteVolume/fields/fvPatchFields/derived/fixedJump/fixedJumpFvPatchFieldsFwd.H new file mode 100644 index 0000000000000000000000000000000000000000..97a42cfa465e344103daff0064c13b5d56deae4a --- /dev/null +++ b/src/finiteVolume/fields/fvPatchFields/derived/fixedJump/fixedJumpFvPatchFieldsFwd.H @@ -0,0 +1,50 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#ifndef fixedJumpFvPatchFieldsFwd_H +#define fixedJumpFvPatchFieldsFwd_H + +#include "fieldTypes.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +template<class Type> class fixedJumpFvPatchField; + +makePatchTypeFieldTypedefs(fixedJump); + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/finiteVolume/fields/fvPatchFields/derived/fixedJumpAMI/fixedJumpAMIFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/fixedJumpAMI/fixedJumpAMIFvPatchField.C new file mode 100644 index 0000000000000000000000000000000000000000..d9cdc383a3f56c64518e87484ee8a442e27eae72 --- /dev/null +++ b/src/finiteVolume/fields/fvPatchFields/derived/fixedJumpAMI/fixedJumpAMIFvPatchField.C @@ -0,0 +1,150 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "fixedJumpAMIFvPatchField.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template<class Type> +Foam::fixedJumpAMIFvPatchField<Type>::fixedJumpAMIFvPatchField +( + const fvPatch& p, + const DimensionedField<Type, volMesh>& iF +) +: + jumpCyclicAMIFvPatchField<Type>(p, iF), + jump_(this->size(), pTraits<Type>::zero) +{} + + +template<class Type> +Foam::fixedJumpAMIFvPatchField<Type>::fixedJumpAMIFvPatchField +( + const fixedJumpAMIFvPatchField<Type>& ptf, + const fvPatch& p, + const DimensionedField<Type, volMesh>& iF, + const fvPatchFieldMapper& mapper +) +: + jumpCyclicAMIFvPatchField<Type>(ptf, p, iF, mapper), + jump_(ptf.jump_, mapper) +{} + + +template<class Type> +Foam::fixedJumpAMIFvPatchField<Type>::fixedJumpAMIFvPatchField +( + const fvPatch& p, + const DimensionedField<Type, volMesh>& iF, + const dictionary& dict +) +: + jumpCyclicAMIFvPatchField<Type>(p, iF), + jump_("jump", dict, p.size()) +{} + + +template<class Type> +Foam::fixedJumpAMIFvPatchField<Type>::fixedJumpAMIFvPatchField +( + const fixedJumpAMIFvPatchField<Type>& ptf +) +: + jumpCyclicAMIFvPatchField<Type>(ptf), + jump_(ptf.jump_) +{} + + +template<class Type> +Foam::fixedJumpAMIFvPatchField<Type>::fixedJumpAMIFvPatchField +( + const fixedJumpAMIFvPatchField<Type>& ptf, + const DimensionedField<Type, volMesh>& iF +) +: + jumpCyclicAMIFvPatchField<Type>(ptf, iF), + jump_(ptf.jump_) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template<class Type> +Foam::tmp<Foam::Field<Type> > Foam::fixedJumpAMIFvPatchField<Type>::jump() const +{ + if (this->cyclicAMIPatch().owner()) + { + return jump_; + } + else + { + const fixedJumpAMIFvPatchField& nbrPatch = + refCast<const fixedJumpAMIFvPatchField<Type> > + ( + this->neighbourPatchField() + ); + + return this->cyclicAMIPatch().interpolate(nbrPatch.jump()); + } +} + + +template<class Type> +void Foam::fixedJumpAMIFvPatchField<Type>::autoMap +( + const fvPatchFieldMapper& m +) +{ + jumpCyclicAMIFvPatchField<Type>::autoMap(m); + jump_.autoMap(m); +} + + +template<class Type> +void Foam::fixedJumpAMIFvPatchField<Type>::rmap +( + const fvPatchField<Type>& ptf, + const labelList& addr +) +{ + jumpCyclicAMIFvPatchField<Type>::rmap(ptf, addr); + + const fixedJumpAMIFvPatchField<Type>& tiptf = + refCast<const fixedJumpAMIFvPatchField<Type> >(ptf); + jump_.rmap(tiptf.jump_, addr); +} + + +template<class Type> +void Foam::fixedJumpAMIFvPatchField<Type>::write(Ostream& os) const +{ + fvPatchField<Type>::write(os); + os.writeKeyword("patchType") << "cyclicAMI" << token::END_STATEMENT << nl; + jump_.writeEntry("jump", os); + this->writeEntry("value", os); +} + + +// ************************************************************************* // diff --git a/src/finiteVolume/fields/fvPatchFields/derived/fixedJumpAMI/fixedJumpAMIFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/derived/fixedJumpAMI/fixedJumpAMIFvPatchField.H new file mode 100644 index 0000000000000000000000000000000000000000..9a0c4bf52048c20f0a67d1b9054f763f020b417b --- /dev/null +++ b/src/finiteVolume/fields/fvPatchFields/derived/fixedJumpAMI/fixedJumpAMIFvPatchField.H @@ -0,0 +1,200 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 <http://www.gnu.org/licenses/>. + +Class + Foam::fixedJumpAMIFvPatchField + +Group + grpCoupledBoundaryConditions + +Description + This boundary condition provides a jump condition, across non-conformal + cyclic path-pairs, employing an arbitraryMeshInterface (AMI). + + The jump is specified as a fixed value field, applied as an offset to the + 'owner' patch. + + \heading Patch usage + + \table + Property | Description | Required | Default value + patchType | underlying patch type should be \c cyclic| yes | + jump | current jump value | yes | + \endtable + + Example of the boundary condition specification: + \verbatim + myPatch + { + type fixedJumpAMI; + patchType cyclic; + jump uniform 10; + } + \endverbatim + + The above example shows the use of a fixed jump of '10'. + +Note + The underlying \c patchType should be set to \c cyclicAMI + +SeeAlso + Foam::jumpCyclicAMIFvPatchField + +SourceFiles + fixedJumpAMIFvPatchField.C + +\*---------------------------------------------------------------------------*/ + +#ifndef fixedJumpAMIFvPatchField_H +#define fixedJumpAMIFvPatchField_H + +#include "jumpCyclicAMIFvPatchField.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class fixedJumpAMIFvPatchField Declaration +\*---------------------------------------------------------------------------*/ + +template<class Type> +class fixedJumpAMIFvPatchField +: + public jumpCyclicAMIFvPatchField<Type> +{ + +protected: + + // Protected data + + //- "jump" field + Field<Type> jump_; + + +public: + + //- Runtime type information + TypeName("fixedJumpAMI"); + + + // Constructors + + //- Construct from patch and internal field + fixedJumpAMIFvPatchField + ( + const fvPatch&, + const DimensionedField<Type, volMesh>& + ); + + //- Construct from patch, internal field and dictionary + fixedJumpAMIFvPatchField + ( + const fvPatch&, + const DimensionedField<Type, volMesh>&, + const dictionary& + ); + + //- Construct by mapping given fixedJumpAMIFvPatchField onto a + // new patch + fixedJumpAMIFvPatchField + ( + const fixedJumpAMIFvPatchField<Type>&, + const fvPatch&, + const DimensionedField<Type, volMesh>&, + const fvPatchFieldMapper& + ); + + //- Construct as copy + fixedJumpAMIFvPatchField + ( + const fixedJumpAMIFvPatchField<Type>& + ); + + //- Construct and return a clone + virtual tmp<fvPatchField<Type> > clone() const + { + return tmp<fvPatchField<Type> > + ( + new fixedJumpAMIFvPatchField<Type>(*this) + ); + } + + //- Construct as copy setting internal field reference + fixedJumpAMIFvPatchField + ( + const fixedJumpAMIFvPatchField<Type>&, + const DimensionedField<Type, volMesh>& + ); + + //- Construct and return a clone setting internal field reference + virtual tmp<fvPatchField<Type> > clone + ( + const DimensionedField<Type, volMesh>& iF + ) const + { + return tmp<fvPatchField<Type> > + ( + new fixedJumpAMIFvPatchField<Type>(*this, iF) + ); + } + + + // Member functions + + // Access + + //- Return the "jump" across the patch + virtual tmp<Field<Type> > jump() const; + + + // Mapping functions + + //- Map (and resize as needed) from self given a mapping object + virtual void autoMap(const fvPatchFieldMapper&); + + //- Reverse map the given fvPatchField onto this fvPatchField + virtual void rmap(const fvPatchField<Type>&, const labelList&); + + + //- Write + virtual void write(Ostream&) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "fixedJumpAMIFvPatchField.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/finiteVolume/fields/fvPatchFields/derived/fixedJumpAMI/fixedJumpAMIFvPatchFields.C b/src/finiteVolume/fields/fvPatchFields/derived/fixedJumpAMI/fixedJumpAMIFvPatchFields.C new file mode 100644 index 0000000000000000000000000000000000000000..c28877d601aa85ce02bc08c5c0aa3b6286339a2d --- /dev/null +++ b/src/finiteVolume/fields/fvPatchFields/derived/fixedJumpAMI/fixedJumpAMIFvPatchFields.C @@ -0,0 +1,43 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "fixedJumpAMIFvPatchFields.H" +#include "addToRunTimeSelectionTable.H" +#include "volFields.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +makePatchFields(fixedJumpAMI); + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/finiteVolume/fields/fvPatchFields/derived/fixedJumpAMI/fixedJumpAMIFvPatchFields.H b/src/finiteVolume/fields/fvPatchFields/derived/fixedJumpAMI/fixedJumpAMIFvPatchFields.H new file mode 100644 index 0000000000000000000000000000000000000000..b0da67335a32fe3ecee0ec0692390f137ef9d7d9 --- /dev/null +++ b/src/finiteVolume/fields/fvPatchFields/derived/fixedJumpAMI/fixedJumpAMIFvPatchFields.H @@ -0,0 +1,49 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#ifndef fixedJumpAMIFvPatchFields_H +#define fixedJumpAMIFvPatchFields_H + +#include "fixedJumpAMIFvPatchField.H" +#include "fieldTypes.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +makePatchTypeFieldTypedefs(fixedJumpAMI); + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/finiteVolume/fields/fvPatchFields/derived/fixedJumpAMI/fixedJumpAMIFvPatchFieldsFwd.H b/src/finiteVolume/fields/fvPatchFields/derived/fixedJumpAMI/fixedJumpAMIFvPatchFieldsFwd.H new file mode 100644 index 0000000000000000000000000000000000000000..9231539cf3e8f07816685ac0270732a918b01c9d --- /dev/null +++ b/src/finiteVolume/fields/fvPatchFields/derived/fixedJumpAMI/fixedJumpAMIFvPatchFieldsFwd.H @@ -0,0 +1,50 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#ifndef fixedJumpAMIFvPatchFieldsFwd_H +#define fixedJumpAMIFvPatchFieldsFwd_H + +#include "fieldTypes.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +template<class Type> class fixedJumpAMIFvPatchField; + +makePatchTypeFieldTypedefs(fixedJumpAMI); + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/finiteVolume/fields/fvPatchFields/derived/uniformJump/uniformJumpFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/uniformJump/uniformJumpFvPatchField.C new file mode 100644 index 0000000000000000000000000000000000000000..c4ee64eaa842271da8e38d9c61b2e13121019ee9 --- /dev/null +++ b/src/finiteVolume/fields/fvPatchFields/derived/uniformJump/uniformJumpFvPatchField.C @@ -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 <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "uniformJumpFvPatchField.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template<class Type> +Foam::uniformJumpFvPatchField<Type>::uniformJumpFvPatchField +( + const fvPatch& p, + const DimensionedField<Type, volMesh>& iF +) +: + fixedJumpFvPatchField<Type>(p, iF), + jumpTable_(0) +{} + + +template<class Type> +Foam::uniformJumpFvPatchField<Type>::uniformJumpFvPatchField +( + const uniformJumpFvPatchField<Type>& ptf, + const fvPatch& p, + const DimensionedField<Type, volMesh>& iF, + const fvPatchFieldMapper& mapper +) +: + fixedJumpFvPatchField<Type>(ptf, p, iF, mapper), + jumpTable_(ptf.jumpTable_().clone().ptr()) +{} + + +template<class Type> +Foam::uniformJumpFvPatchField<Type>::uniformJumpFvPatchField +( + const fvPatch& p, + const DimensionedField<Type, volMesh>& iF, + const dictionary& dict +) +: + fixedJumpFvPatchField<Type>(p, iF), + jumpTable_(new DataEntry<Type>("jumpTable")) +{ + if (this->cyclicPatch().owner()) + { + jumpTable_ = DataEntry<Type>::New("jumpTable", dict); + } + + if (dict.found("value")) + { + fvPatchField<Type>::operator= + ( + Field<Type>("value", dict, p.size()) + ); + } +} + + +template<class Type> +Foam::uniformJumpFvPatchField<Type>::uniformJumpFvPatchField +( + const uniformJumpFvPatchField<Type>& ptf +) +: + fixedJumpFvPatchField<Type>(ptf), + jumpTable_(ptf.jumpTable_().clone().ptr()) +{} + + +template<class Type> +Foam::uniformJumpFvPatchField<Type>::uniformJumpFvPatchField +( + const uniformJumpFvPatchField<Type>& ptf, + const DimensionedField<Type, volMesh>& iF +) +: + fixedJumpFvPatchField<Type>(ptf, iF), + jumpTable_(ptf.jumpTable_().clone().ptr()) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template<class Type> +Foam::tmp<Foam::Field<Type> > Foam::uniformJumpFvPatchField<Type>::jump() const +{ + if (this->cyclicPatch().owner()) + { + const Type value = jumpTable_->value(this->db().time().value()); + + return tmp<Field<Type> >(new Field<Type>(this->patch().size(), value)); + } + else + { + const uniformJumpFvPatchField& nbrPatch = + refCast<const uniformJumpFvPatchField<Type> > + ( + this->neighbourPatchField() + ); + + return nbrPatch.jump(); + } +} + + +template<class Type> +void Foam::uniformJumpFvPatchField<Type>::write(Ostream& os) const +{ + fixedJumpFvPatchField<Type>::write(os); + if (this->cyclicPatch().owner()) + { + jumpTable_->writeData(os); + } +} + + +// ************************************************************************* // diff --git a/src/finiteVolume/fields/fvPatchFields/derived/temperatureJump/temperatureJumpFvPatchScalarField.H b/src/finiteVolume/fields/fvPatchFields/derived/uniformJump/uniformJumpFvPatchField.H similarity index 57% rename from src/finiteVolume/fields/fvPatchFields/derived/temperatureJump/temperatureJumpFvPatchScalarField.H rename to src/finiteVolume/fields/fvPatchFields/derived/uniformJump/uniformJumpFvPatchField.H index 0663a1cb86745144c31881f95d2629d0f130c169..633dc1752e932bc92a6f646b8b73be79cf268623 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/temperatureJump/temperatureJumpFvPatchScalarField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/uniformJump/uniformJumpFvPatchField.H @@ -22,53 +22,53 @@ License along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. Class - Foam::temperatureJumpFvPatchScalarField + Foam::uniformJumpFvPatchField Group grpCoupledBoundaryConditions Description - This boundary condition provides a temperature jump condition across a - coupled pair of cyclic patches. - - The jump is specified as a \c DataEntry type, to enable the use of, e.g. - contant, polynomial, table values. + This boundary condition provides a jump condition, using the \c cyclic + condition as a base. The jump is specified as a time-varying uniform + value across the patch. \heading Patch usage \table Property | Description | Required | Default value patchType | underlying patch type should be \c cyclic| yes | - jump | current jump value | yes | - jumpTable | jump data, e.g. \c csvFile | yes | + jumpTable | jump value | yes | \endtable Example of the boundary condition specification: \verbatim myPatch { - type temperatureJump; + type uniformJump; patchType cyclic; - jumpTable constant 100; - value uniform 300; + jumpTable constant 10; } \endverbatim - The above example shows the use of a constant jump condition. + The above example shows the use of a fixed jump of '10'. Note - The underlying \c patchType should be set to \c cyclic + The uniformValue entry is a DataEntry type, able to describe time + varying functions. The example above gives the usage for supplying a + constant value. + + The underlying \c patchType should be set to \c cyclic SeeAlso Foam::fixedJumpFvPatchField SourceFiles - temperatureJumpFvPatchScalarField.C + uniformJumpFvPatchField.C \*---------------------------------------------------------------------------*/ -#ifndef temperatureJumpFvPatchScalarField_H -#define temperatureJumpFvPatchScalarField_H +#ifndef uniformJumpFvPatchField_H +#define uniformJumpFvPatchField_H #include "fixedJumpFvPatchField.H" #include "DataEntry.H" @@ -79,109 +79,115 @@ namespace Foam { /*---------------------------------------------------------------------------*\ - Class temperatureJumpFvPatchScalarField Declaration + Class uniformJumpFvPatchField Declaration \*---------------------------------------------------------------------------*/ -class temperatureJumpFvPatchScalarField +template<class Type> +class uniformJumpFvPatchField : - public fixedJumpFvPatchField<scalar> + public fixedJumpFvPatchField<Type> { - // Private data +protected: + + // Protected data - //- Interpolation table - autoPtr<DataEntry<scalar> > jumpTable_; + //- "jump" table + autoPtr<DataEntry<Type> > jumpTable_; public: //- Runtime type information - TypeName("temperatureJump"); + TypeName("uniformJump"); // Constructors //- Construct from patch and internal field - temperatureJumpFvPatchScalarField + uniformJumpFvPatchField ( const fvPatch&, - const DimensionedField<scalar, volMesh>& + const DimensionedField<Type, volMesh>& ); //- Construct from patch, internal field and dictionary - temperatureJumpFvPatchScalarField + uniformJumpFvPatchField ( const fvPatch&, - const DimensionedField<scalar, volMesh>&, + const DimensionedField<Type, volMesh>&, const dictionary& ); - //- Construct by mapping given temperatureJumpFvPatchScalarField onto a + //- Construct by mapping given uniformJumpFvPatchField onto a // new patch - temperatureJumpFvPatchScalarField + uniformJumpFvPatchField ( - const temperatureJumpFvPatchScalarField&, + const uniformJumpFvPatchField<Type>&, const fvPatch&, - const DimensionedField<scalar, volMesh>&, + const DimensionedField<Type, volMesh>&, const fvPatchFieldMapper& ); //- Construct as copy - temperatureJumpFvPatchScalarField + uniformJumpFvPatchField ( - const temperatureJumpFvPatchScalarField& + const uniformJumpFvPatchField<Type>& ); //- Construct and return a clone - virtual tmp<fvPatchField<scalar> > clone() const + virtual tmp<fvPatchField<Type> > clone() const { - return tmp<fvPatchField<scalar> > + return tmp<fvPatchField<Type> > ( - new temperatureJumpFvPatchScalarField(*this) + new uniformJumpFvPatchField<Type>(*this) ); } //- Construct as copy setting internal field reference - temperatureJumpFvPatchScalarField + uniformJumpFvPatchField ( - const temperatureJumpFvPatchScalarField&, - const DimensionedField<scalar, volMesh>& + const uniformJumpFvPatchField<Type>&, + const DimensionedField<Type, volMesh>& ); //- Construct and return a clone setting internal field reference - virtual tmp<fvPatchField<scalar> > clone + virtual tmp<fvPatchField<Type> > clone ( - const DimensionedField<scalar, volMesh>& iF + const DimensionedField<Type, volMesh>& iF ) const { - return tmp<fvPatchField<scalar> > + return tmp<fvPatchField<Type> > ( - new temperatureJumpFvPatchScalarField(*this, iF) + new uniformJumpFvPatchField<Type>(*this, iF) ); } // Member functions + // Access - // Access functions - - //- Return jumpTable - const DataEntry<scalar>& jumpTable() const - { - return jumpTable_(); - } + //- Return the "jump" across the patch. + virtual tmp<Field<Type> > jump() const; //- Write virtual void write(Ostream&) const; }; + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +#ifdef NoRepository +# include "uniformJumpFvPatchField.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + #endif // ************************************************************************* // diff --git a/src/finiteVolume/fields/fvPatchFields/derived/uniformJump/uniformJumpFvPatchFields.C b/src/finiteVolume/fields/fvPatchFields/derived/uniformJump/uniformJumpFvPatchFields.C new file mode 100644 index 0000000000000000000000000000000000000000..489ab5f6332a0eddfa53716dbdea008e89021e03 --- /dev/null +++ b/src/finiteVolume/fields/fvPatchFields/derived/uniformJump/uniformJumpFvPatchFields.C @@ -0,0 +1,43 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "uniformJumpFvPatchFields.H" +#include "addToRunTimeSelectionTable.H" +#include "volFields.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +makePatchFields(uniformJump); + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/finiteVolume/fields/fvPatchFields/derived/uniformJump/uniformJumpFvPatchFields.H b/src/finiteVolume/fields/fvPatchFields/derived/uniformJump/uniformJumpFvPatchFields.H new file mode 100644 index 0000000000000000000000000000000000000000..e28916c3835fd490182dd760827c3a777f90c940 --- /dev/null +++ b/src/finiteVolume/fields/fvPatchFields/derived/uniformJump/uniformJumpFvPatchFields.H @@ -0,0 +1,49 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#ifndef uniformJumpFvPatchFields_H +#define uniformJumpFvPatchFields_H + +#include "uniformJumpFvPatchField.H" +#include "fieldTypes.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +makePatchTypeFieldTypedefs(uniformJump); + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/finiteVolume/fields/fvPatchFields/derived/uniformJump/uniformJumpFvPatchFieldsFwd.H b/src/finiteVolume/fields/fvPatchFields/derived/uniformJump/uniformJumpFvPatchFieldsFwd.H new file mode 100644 index 0000000000000000000000000000000000000000..e9bcac0bbaa0e24b51e088229a78bae417de357b --- /dev/null +++ b/src/finiteVolume/fields/fvPatchFields/derived/uniformJump/uniformJumpFvPatchFieldsFwd.H @@ -0,0 +1,50 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#ifndef uniformJumpFvPatchFieldsFwd_H +#define uniformJumpFvPatchFieldsFwd_H + +#include "fieldTypes.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +template<class Type> class uniformJumpFvPatchField; + +makePatchTypeFieldTypedefs(uniformJump); + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/finiteVolume/fields/fvPatchFields/derived/uniformJumpAMI/uniformJumpAMIFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/uniformJumpAMI/uniformJumpAMIFvPatchField.C new file mode 100644 index 0000000000000000000000000000000000000000..a3e1fe659190cf604f8749567e9be9e22a21d501 --- /dev/null +++ b/src/finiteVolume/fields/fvPatchFields/derived/uniformJumpAMI/uniformJumpAMIFvPatchField.C @@ -0,0 +1,138 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "uniformJumpAMIFvPatchField.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template<class Type> +Foam::uniformJumpAMIFvPatchField<Type>::uniformJumpAMIFvPatchField +( + const fvPatch& p, + const DimensionedField<Type, volMesh>& iF +) +: + fixedJumpAMIFvPatchField<Type>(p, iF), + jumpTable_(0) +{} + + +template<class Type> +Foam::uniformJumpAMIFvPatchField<Type>::uniformJumpAMIFvPatchField +( + const uniformJumpAMIFvPatchField<Type>& ptf, + const fvPatch& p, + const DimensionedField<Type, volMesh>& iF, + const fvPatchFieldMapper& mapper +) +: + fixedJumpAMIFvPatchField<Type>(ptf, p, iF, mapper), + jumpTable_(ptf.jumpTable_().clone().ptr()) +{} + + +template<class Type> +Foam::uniformJumpAMIFvPatchField<Type>::uniformJumpAMIFvPatchField +( + const fvPatch& p, + const DimensionedField<Type, volMesh>& iF, + const dictionary& dict +) +: + fixedJumpAMIFvPatchField<Type>(p, iF), + jumpTable_(new DataEntry<Type>("jumpTable")) +{ + if (this->cyclicAMIPatch().owner()) + { + jumpTable_ = DataEntry<Type>::New("jumpTable", dict); + } + + if (dict.found("value")) + { + fvPatchField<Type>::operator=(Field<Type>("value", dict, p.size())); + } +} + + +template<class Type> +Foam::uniformJumpAMIFvPatchField<Type>::uniformJumpAMIFvPatchField +( + const uniformJumpAMIFvPatchField<Type>& ptf +) +: + fixedJumpAMIFvPatchField<Type>(ptf), + jumpTable_(ptf.jumpTable_().clone().ptr()) +{} + + +template<class Type> +Foam::uniformJumpAMIFvPatchField<Type>::uniformJumpAMIFvPatchField +( + const uniformJumpAMIFvPatchField<Type>& ptf, + const DimensionedField<Type, volMesh>& iF +) +: + fixedJumpAMIFvPatchField<Type>(ptf, iF), + jumpTable_(ptf.jumpTable_().clone().ptr()) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template<class Type> +Foam::tmp<Foam::Field<Type> > +Foam::uniformJumpAMIFvPatchField<Type>::jump() const +{ + if (this->cyclicAMIPatch().owner()) + { + Type j = jumpTable_->value(this->db().time().value()); + + return tmp<Field<Type> >(new Field<Type>(this->size(), j)); + } + else + { + const uniformJumpAMIFvPatchField& nbrPatch = + refCast<const uniformJumpAMIFvPatchField<Type> > + ( + this->neighbourPatchField() + ); + + return this->cyclicAMIPatch().interpolate(nbrPatch.jump()); + } +} + + +template<class Type> +void Foam::uniformJumpAMIFvPatchField<Type>::write(Ostream& os) const +{ + fixedJumpAMIFvPatchField<Type>::write(os); + if (this->cyclicAMIPatch().owner()) + { + jumpTable_->writeData(os); + } +} + + +// ************************************************************************* // diff --git a/src/finiteVolume/fields/fvPatchFields/derived/uniformJumpAMI/uniformJumpAMIFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/derived/uniformJumpAMI/uniformJumpAMIFvPatchField.H new file mode 100644 index 0000000000000000000000000000000000000000..e5eb2e6826883fb37c33b72c3af8d2118525af10 --- /dev/null +++ b/src/finiteVolume/fields/fvPatchFields/derived/uniformJumpAMI/uniformJumpAMIFvPatchField.H @@ -0,0 +1,193 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 <http://www.gnu.org/licenses/>. + +Class + Foam::uniformJumpAMIFvPatchField + +Group + grpCoupledBoundaryConditions + +Description + This boundary condition provides a jump condition, using the \c cyclicAMI + condition as a base. The jump is specified as a time-varying uniform + value across the patch. + + \heading Patch usage + + \table + Property | Description | Required | Default value + patchType | underlying patch type should be \c cyclicAMI| yes | + jumpTable | jump value | yes | + \endtable + + Example of the boundary condition specification: + \verbatim + myPatch + { + type uniformJumpAMI; + patchType cyclicAMI; + jumpTable constant 10; + } + \endverbatim + + The above example shows the use of a fixed jump of '10'. + +Note + The uniformValue entry is a DataEntry type, able to describe time + varying functions. The example above gives the usage for supplying a + constant value. + + The underlying \c patchType should be set to \c cyclic + +SeeAlso + Foam::jumpCyclicAMIFvPatchField + +SourceFiles + uniformJumpAMIFvPatchField.C + +\*---------------------------------------------------------------------------*/ + +#ifndef uniformJumpAMIFvPatchField_H +#define uniformJumpAMIFvPatchField_H + +#include "fixedJumpAMIFvPatchField.H" +#include "DataEntry.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class uniformJumpAMIFvPatchField Declaration +\*---------------------------------------------------------------------------*/ + +template<class Type> +class uniformJumpAMIFvPatchField +: + public fixedJumpAMIFvPatchField<Type> +{ + +protected: + + // Protected data + + //- "jump" table + autoPtr<DataEntry<Type> > jumpTable_; + + +public: + + //- Runtime type information + TypeName("uniformJumpAMI"); + + // Constructors + + //- Construct from patch and internal field + uniformJumpAMIFvPatchField + ( + const fvPatch&, + const DimensionedField<Type, volMesh>& + ); + + //- Construct from patch, internal field and dictionary + uniformJumpAMIFvPatchField + ( + const fvPatch&, + const DimensionedField<Type, volMesh>&, + const dictionary& + ); + + //- Construct by mapping given uniformJumpAMIFvPatchField onto a + // new patch + uniformJumpAMIFvPatchField + ( + const uniformJumpAMIFvPatchField<Type>&, + const fvPatch&, + const DimensionedField<Type, volMesh>&, + const fvPatchFieldMapper& + ); + + //- Construct as copy + uniformJumpAMIFvPatchField + ( + const uniformJumpAMIFvPatchField<Type>& + ); + + //- Construct and return a clone + virtual tmp<fvPatchField<Type> > clone() const + { + return tmp<fvPatchField<Type> > + ( + new uniformJumpAMIFvPatchField<Type>(*this) + ); + } + + //- Construct as copy setting internal field reference + uniformJumpAMIFvPatchField + ( + const uniformJumpAMIFvPatchField<Type>&, + const DimensionedField<Type, volMesh>& + ); + + //- Construct and return a clone setting internal field reference + virtual tmp<fvPatchField<Type> > clone + ( + const DimensionedField<Type, volMesh>& iF + ) const + { + return tmp<fvPatchField<Type> > + ( + new uniformJumpAMIFvPatchField<Type>(*this, iF) + ); + } + + + // Member functions + + // Access + + //- Return the "jump" across the patch. + virtual tmp<Field<Type> > jump() const; + + + //- Write + virtual void write(Ostream&) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "uniformJumpAMIFvPatchField.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/finiteVolume/fields/fvPatchFields/derived/uniformJumpAMI/uniformJumpAMIFvPatchFields.C b/src/finiteVolume/fields/fvPatchFields/derived/uniformJumpAMI/uniformJumpAMIFvPatchFields.C new file mode 100644 index 0000000000000000000000000000000000000000..f17f2849e86da26f2d733612a5dd53a629c9a99f --- /dev/null +++ b/src/finiteVolume/fields/fvPatchFields/derived/uniformJumpAMI/uniformJumpAMIFvPatchFields.C @@ -0,0 +1,43 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "uniformJumpAMIFvPatchFields.H" +#include "addToRunTimeSelectionTable.H" +#include "volFields.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +makePatchFields(uniformJumpAMI); + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/finiteVolume/fields/fvPatchFields/derived/uniformJumpAMI/uniformJumpAMIFvPatchFields.H b/src/finiteVolume/fields/fvPatchFields/derived/uniformJumpAMI/uniformJumpAMIFvPatchFields.H new file mode 100644 index 0000000000000000000000000000000000000000..0314210967bbe19b2752f146935ade3583f5523f --- /dev/null +++ b/src/finiteVolume/fields/fvPatchFields/derived/uniformJumpAMI/uniformJumpAMIFvPatchFields.H @@ -0,0 +1,49 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#ifndef uniformJumpAMIFvPatchFields_H +#define uniformJumpAMIFvPatchFields_H + +#include "uniformJumpAMIFvPatchField.H" +#include "fieldTypes.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +makePatchTypeFieldTypedefs(uniformJumpAMI); + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/finiteVolume/fields/fvPatchFields/derived/uniformJumpAMI/uniformJumpAMIFvPatchFieldsFwd.H b/src/finiteVolume/fields/fvPatchFields/derived/uniformJumpAMI/uniformJumpAMIFvPatchFieldsFwd.H new file mode 100644 index 0000000000000000000000000000000000000000..29080e7ec0b0f9245fe41472ac2ed826a2278034 --- /dev/null +++ b/src/finiteVolume/fields/fvPatchFields/derived/uniformJumpAMI/uniformJumpAMIFvPatchFieldsFwd.H @@ -0,0 +1,50 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#ifndef uniformJumpAMIFvPatchFieldsFwd_H +#define uniformJumpAMIFvPatchFieldsFwd_H + +#include "fieldTypes.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +template<class Type> class uniformJumpAMIFvPatchField; + +makePatchTypeFieldTypedefs(uniformJumpAMI); + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/thermophysicalModels/basic/Make/files b/src/thermophysicalModels/basic/Make/files index 3dc3d0c082e22f544773583ee6f609cedea5e6ba..5b82c8047663caef5f554a77857d9bb9e6436790 100644 --- a/src/thermophysicalModels/basic/Make/files +++ b/src/thermophysicalModels/basic/Make/files @@ -10,7 +10,9 @@ rhoThermo/rhoThermos.C derivedFvPatchFields/fixedEnergy/fixedEnergyFvPatchScalarField.C derivedFvPatchFields/gradientEnergy/gradientEnergyFvPatchScalarField.C derivedFvPatchFields/mixedEnergy/mixedEnergyFvPatchScalarField.C -derivedFvPatchFields/energyJump/energyJumpFvPatchScalarField.C + +derivedFvPatchFields/energyJump/energyJump/energyJumpFvPatchScalarField.C +derivedFvPatchFields/energyJump/energyJumpAMI/energyJumpAMIFvPatchScalarField.C derivedFvPatchFields/wallHeatTransfer/wallHeatTransferFvPatchScalarField.C diff --git a/src/thermophysicalModels/basic/Make/options b/src/thermophysicalModels/basic/Make/options index 16d886c766ceaf2770f063b58d22b0db48e1827d..5f64e9872d592f6b4dd450284481b5f8328f22e3 100644 --- a/src/thermophysicalModels/basic/Make/options +++ b/src/thermophysicalModels/basic/Make/options @@ -1,8 +1,8 @@ EXE_INC = \ -I$(LIB_SRC)/finiteVolume/lnInclude \ - -I$(LIB_SRC)/thermophysicalModels/specie/lnInclude + -I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \ + -I$(LIB_SRC)/meshTools/lnInclude LIB_LIBS = \ - -lfiniteVolume \ - -L$(FOAM_USER_LIBBIN)/FvPatchScalarFieldEnthalpyJump + -lfiniteVolume diff --git a/src/thermophysicalModels/basic/derivedFvPatchFields/energyJump/energyJumpFvPatchScalarField.C b/src/thermophysicalModels/basic/derivedFvPatchFields/energyJump/energyJump/energyJumpFvPatchScalarField.C similarity index 86% rename from src/thermophysicalModels/basic/derivedFvPatchFields/energyJump/energyJumpFvPatchScalarField.C rename to src/thermophysicalModels/basic/derivedFvPatchFields/energyJump/energyJump/energyJumpFvPatchScalarField.C index d3ba1becdd81d87b5a91dc65f28a29fdd56fd2d4..62ac6516efbe0c408c2fa518c6737d38019d4b81 100644 --- a/src/thermophysicalModels/basic/derivedFvPatchFields/energyJump/energyJumpFvPatchScalarField.C +++ b/src/thermophysicalModels/basic/derivedFvPatchFields/energyJump/energyJump/energyJumpFvPatchScalarField.C @@ -25,7 +25,7 @@ License #include "addToRunTimeSelectionTable.H" #include "energyJumpFvPatchScalarField.H" -#include "temperatureJumpFvPatchScalarField.H" +#include "fixedJumpFvPatchFields.H" #include "basicThermo.H" // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // @@ -61,7 +61,6 @@ Foam::energyJumpFvPatchScalarField::energyJumpFvPatchScalarField : fixedJumpFvPatchField<scalar>(p, iF) { - if (dict.found("value")) { fvPatchScalarField::operator= @@ -77,7 +76,6 @@ Foam::energyJumpFvPatchScalarField::energyJumpFvPatchScalarField const energyJumpFvPatchScalarField& ptf ) : - cyclicLduInterfaceField(), fixedJumpFvPatchField<scalar>(ptf) {} @@ -103,29 +101,21 @@ void Foam::energyJumpFvPatchScalarField::updateCoeffs() if (this->cyclicPatch().owner()) { - const basicThermo& thermo = db().lookupObject<basicThermo> - ( - "thermophysicalProperties" - ); + const basicThermo& thermo = + db().lookupObject<basicThermo>("thermophysicalProperties"); label patchID = patch().index(); const scalarField& pp = thermo.p().boundaryField()[patchID]; - const temperatureJumpFvPatchScalarField& TbPatch = - refCast<const temperatureJumpFvPatchScalarField> + const fixedJumpFvPatchScalarField& TbPatch = + refCast<const fixedJumpFvPatchScalarField> ( thermo.T().boundaryField()[patchID] ); - const scalar time = this->db().time().value(); - const scalarField jumpTb - ( - patch().size(), TbPatch.jumpTable().value(time) - ); - const labelUList& faceCells = this->patch().faceCells(); - jump_ = thermo.he(pp, jumpTb, faceCells); + jump_ = thermo.he(pp, TbPatch.jump(), faceCells); } fixedJumpFvPatchField<scalar>::updateCoeffs(); diff --git a/src/thermophysicalModels/basic/derivedFvPatchFields/energyJump/energyJumpFvPatchScalarField.H b/src/thermophysicalModels/basic/derivedFvPatchFields/energyJump/energyJump/energyJumpFvPatchScalarField.H similarity index 91% rename from src/thermophysicalModels/basic/derivedFvPatchFields/energyJump/energyJumpFvPatchScalarField.H rename to src/thermophysicalModels/basic/derivedFvPatchFields/energyJump/energyJump/energyJumpFvPatchScalarField.H index aae2d9597b07a17adbff7b2515b7eb23b81d091e..833072ad07a475fa409adf9318fe5001cb204b93 100644 --- a/src/thermophysicalModels/basic/derivedFvPatchFields/energyJump/energyJumpFvPatchScalarField.H +++ b/src/thermophysicalModels/basic/derivedFvPatchFields/energyJump/energyJump/energyJumpFvPatchScalarField.H @@ -29,23 +29,8 @@ Group Description This boundary condition provides an energy jump condition across a pair - of coupled patches. - - \heading Patch usage - - \table - Property | Description | Required | Default value - jump | energy jump values | yes | - \endtable - - Example of the boundary condition specification: - \verbatim - myPatch - { - type energyJump; - jump uniform 100; - } - \endverbatim + of coupled patches. It is not applied directly, but is employed on-the-fly + when converting temperature boundary conditions into energy. SeeAlso Foam::fixedJumpFvPatchField diff --git a/src/finiteVolume/fields/fvPatchFields/derived/temperatureJump/temperatureJumpFvPatchScalarField.C b/src/thermophysicalModels/basic/derivedFvPatchFields/energyJump/energyJumpAMI/energyJumpAMIFvPatchScalarField.C similarity index 55% rename from src/finiteVolume/fields/fvPatchFields/derived/temperatureJump/temperatureJumpFvPatchScalarField.C rename to src/thermophysicalModels/basic/derivedFvPatchFields/energyJump/energyJumpAMI/energyJumpAMIFvPatchScalarField.C index 99be42e3d6fc610f434fb8db65acb9889266dfbf..9f596c3cdec5589f8de979438241b12b1749023b 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/temperatureJump/temperatureJumpFvPatchScalarField.C +++ b/src/thermophysicalModels/basic/derivedFvPatchFields/energyJump/energyJumpAMI/energyJumpAMIFvPatchScalarField.C @@ -24,51 +24,43 @@ License \*---------------------------------------------------------------------------*/ #include "addToRunTimeSelectionTable.H" -#include "temperatureJumpFvPatchScalarField.H" -#include "volFields.H" +#include "energyJumpAMIFvPatchScalarField.H" +#include "fixedJumpAMIFvPatchFields.H" +#include "basicThermo.H" // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -Foam::temperatureJumpFvPatchScalarField::temperatureJumpFvPatchScalarField +Foam::energyJumpAMIFvPatchScalarField::energyJumpAMIFvPatchScalarField ( const fvPatch& p, const DimensionedField<scalar, volMesh>& iF ) : - fixedJumpFvPatchField<scalar>(p, iF), - jumpTable_(0) + fixedJumpAMIFvPatchField<scalar>(p, iF) {} -Foam::temperatureJumpFvPatchScalarField::temperatureJumpFvPatchScalarField +Foam::energyJumpAMIFvPatchScalarField::energyJumpAMIFvPatchScalarField ( - const temperatureJumpFvPatchScalarField& ptf, + const energyJumpAMIFvPatchScalarField& ptf, const fvPatch& p, const DimensionedField<scalar, volMesh>& iF, const fvPatchFieldMapper& mapper ) : - fixedJumpFvPatchField<scalar>(ptf, p, iF, mapper), - jumpTable_(ptf.jumpTable_().clone().ptr()) + fixedJumpAMIFvPatchField<scalar>(ptf, p, iF, mapper) {} -Foam::temperatureJumpFvPatchScalarField::temperatureJumpFvPatchScalarField +Foam::energyJumpAMIFvPatchScalarField::energyJumpAMIFvPatchScalarField ( const fvPatch& p, const DimensionedField<scalar, volMesh>& iF, const dictionary& dict ) : - fixedJumpFvPatchField<scalar>(p, iF), - jumpTable_(new DataEntry<scalar>("jumpTable")) + fixedJumpAMIFvPatchField<scalar>(p, iF) { - - if (this->cyclicPatch().owner()) - { - jumpTable_ = DataEntry<scalar>::New("jumpTable", dict); - } - if (dict.found("value")) { fvPatchScalarField::operator= @@ -79,38 +71,60 @@ Foam::temperatureJumpFvPatchScalarField::temperatureJumpFvPatchScalarField } -Foam::temperatureJumpFvPatchScalarField::temperatureJumpFvPatchScalarField +Foam::energyJumpAMIFvPatchScalarField::energyJumpAMIFvPatchScalarField ( - const temperatureJumpFvPatchScalarField& ptf + const energyJumpAMIFvPatchScalarField& ptf ) : - cyclicLduInterfaceField(), - fixedJumpFvPatchField<scalar>(ptf), - jumpTable_(ptf.jumpTable_().clone().ptr()) + fixedJumpAMIFvPatchField<scalar>(ptf) {} -Foam::temperatureJumpFvPatchScalarField::temperatureJumpFvPatchScalarField +Foam::energyJumpAMIFvPatchScalarField::energyJumpAMIFvPatchScalarField ( - const temperatureJumpFvPatchScalarField& ptf, + const energyJumpAMIFvPatchScalarField& ptf, const DimensionedField<scalar, volMesh>& iF ) : - fixedJumpFvPatchField<scalar>(ptf, iF), - jumpTable_(ptf.jumpTable_().clone().ptr()) + fixedJumpAMIFvPatchField<scalar>(ptf, iF) {} // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -void Foam::temperatureJumpFvPatchScalarField::write(Ostream& os) const +void Foam::energyJumpAMIFvPatchScalarField::updateCoeffs() { - fixedJumpFvPatchField<scalar>::write(os); - if (this->cyclicPatch().owner()) + if (this->updated()) { - jumpTable_->writeData(os); + return; } + + if (this->cyclicAMIPatch().owner()) + { + const basicThermo& thermo = + db().lookupObject<basicThermo>("thermophysicalProperties"); + + label patchID = patch().index(); + + const scalarField& pp = thermo.p().boundaryField()[patchID]; + const fixedJumpAMIFvPatchScalarField& TbPatch = + refCast<const fixedJumpAMIFvPatchScalarField> + ( + thermo.T().boundaryField()[patchID] + ); + + const labelUList& faceCells = this->patch().faceCells(); + + jump_ = thermo.he(pp, TbPatch.jump(), faceCells); + } + + fixedJumpAMIFvPatchField<scalar>::updateCoeffs(); +} + + +void Foam::energyJumpAMIFvPatchScalarField::write(Ostream& os) const +{ + fixedJumpAMIFvPatchField<scalar>::write(os); this->writeEntry("value", os); } @@ -122,7 +136,7 @@ namespace Foam makePatchTypeField ( fvPatchScalarField, - temperatureJumpFvPatchScalarField + energyJumpAMIFvPatchScalarField ); } diff --git a/src/thermophysicalModels/basic/derivedFvPatchFields/energyJump/energyJumpAMI/energyJumpAMIFvPatchScalarField.H b/src/thermophysicalModels/basic/derivedFvPatchFields/energyJump/energyJumpAMI/energyJumpAMIFvPatchScalarField.H new file mode 100644 index 0000000000000000000000000000000000000000..e000c6b2004706e00f97533cecbb4255ff234521 --- /dev/null +++ b/src/thermophysicalModels/basic/derivedFvPatchFields/energyJump/energyJumpAMI/energyJumpAMIFvPatchScalarField.H @@ -0,0 +1,150 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 <http://www.gnu.org/licenses/>. + +Class + Foam::energyJumpAMIFvPatchScalarField + +Group + grpThermoBoundaryConditions grpCoupledBoundaryConditions + +Description + This boundary condition provides an energy jump condition across a pair + of coupled patches with an arbitrary mesh interface (AMI). It is not + applied directly, but is employed on-the-fly when converting temperature + boundary conditions into energy. + +SeeAlso + Foam::fixedJumpAMIFvPatchField + +SourceFiles + energyJumpAMIFvPatchScalarField.C + +\*---------------------------------------------------------------------------*/ + +#ifndef energyJumpAMIFvPatchScalarField_H +#define energyJumpAMIFvPatchScalarField_H + +#include "fixedJumpAMIFvPatchField.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class energyJumpAMIFvPatchScalarField Declaration +\*---------------------------------------------------------------------------*/ + +class energyJumpAMIFvPatchScalarField +: + public fixedJumpAMIFvPatchField<scalar> +{ + +public: + + //- Runtime type information + TypeName("energyJumpAMI"); + + // Constructors + + //- Construct from patch and internal field + energyJumpAMIFvPatchScalarField + ( + const fvPatch&, + const DimensionedField<scalar, volMesh>& + ); + + //- Construct from patch, internal field and dictionary + energyJumpAMIFvPatchScalarField + ( + const fvPatch&, + const DimensionedField<scalar, volMesh>&, + const dictionary& + ); + + //- Construct by mapping given energyJumpAMIFvPatchScalarField onto a + // new patch + energyJumpAMIFvPatchScalarField + ( + const energyJumpAMIFvPatchScalarField&, + const fvPatch&, + const DimensionedField<scalar, volMesh>&, + const fvPatchFieldMapper& + ); + + //- Construct as copy + energyJumpAMIFvPatchScalarField + ( + const energyJumpAMIFvPatchScalarField& + ); + + //- Construct and return a clone + virtual tmp<fvPatchField<scalar> > clone() const + { + return tmp<fvPatchField<scalar> > + ( + new energyJumpAMIFvPatchScalarField(*this) + ); + } + + //- Construct as copy setting internal field reference + energyJumpAMIFvPatchScalarField + ( + const energyJumpAMIFvPatchScalarField&, + const DimensionedField<scalar, volMesh>& + ); + + //- Construct and return a clone setting internal field reference + virtual tmp<fvPatchField<scalar> > clone + ( + const DimensionedField<scalar, volMesh>& iF + ) const + { + return tmp<fvPatchField<scalar> > + ( + new energyJumpAMIFvPatchScalarField(*this, iF) + ); + } + + + // Member functions + + // Evaluation functions + + //- Update the coefficients + virtual void updateCoeffs(); + + + //- Write + virtual void write(Ostream&) const; +}; + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/thermophysicalModels/basic/heThermo/heThermo.C b/src/thermophysicalModels/basic/heThermo/heThermo.C index 4cace549800e870c736df2ae1464a4d123ab615f..f3902a033db0ca797deadbd4463561938f028dda 100644 --- a/src/thermophysicalModels/basic/heThermo/heThermo.C +++ b/src/thermophysicalModels/basic/heThermo/heThermo.C @@ -28,8 +28,10 @@ License #include "fixedEnergyFvPatchScalarField.H" #include "gradientEnergyFvPatchScalarField.H" #include "mixedEnergyFvPatchScalarField.H" -#include "temperatureJumpFvPatchScalarField.H" +#include "fixedJumpFvPatchFields.H" +#include "fixedJumpAMIFvPatchFields.H" #include "energyJumpFvPatchScalarField.H" +#include "energyJumpAMIFvPatchScalarField.H" // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // @@ -59,10 +61,14 @@ Foam::wordList Foam::heThermo<BasicThermo, MixtureType>::heBoundaryTypes() { hbt[patchi] = mixedEnergyFvPatchScalarField::typeName; } - else if (isA<temperatureJumpFvPatchScalarField>(tbf[patchi])) + else if (isA<fixedJumpFvPatchScalarField>(tbf[patchi])) { hbt[patchi] = energyJumpFvPatchScalarField::typeName; } + else if (isA<fixedJumpAMIFvPatchScalarField>(tbf[patchi])) + { + hbt[patchi] = energyJumpAMIFvPatchScalarField::typeName; + } } return hbt; diff --git a/src/thermophysicalModels/reactionThermo/Make/options b/src/thermophysicalModels/reactionThermo/Make/options index 9dad3910dd9b75e5495d69a22ad669c973dcbd5d..8c18cf8318024f42bb1525dd6e0884982f801738 100644 --- a/src/thermophysicalModels/reactionThermo/Make/options +++ b/src/thermophysicalModels/reactionThermo/Make/options @@ -1,7 +1,11 @@ EXE_INC = \ -I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ - -I$(LIB_SRC)/thermophysicalModels/specie/lnInclude + -I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \ + -I$(LIB_SRC)/meshTools/lnInclude LIB_LIBS = \ - -lfiniteVolume + -lfiniteVolume \ + -lfluidThermophysicalModels \ + -lspecie \ + -lmeshTools diff --git a/tutorials/combustion/engineFoam/kivaTest/Allrun b/tutorials/combustion/engineFoam/kivaTest/Allrun index 21d4983a9393d8df2e99d3d20096d0a2578905a6..5088aaff7bfcc1e9771b193ccee33e6f5e66a963 100755 --- a/tutorials/combustion/engineFoam/kivaTest/Allrun +++ b/tutorials/combustion/engineFoam/kivaTest/Allrun @@ -7,36 +7,14 @@ cd ${0%/*} || exit 1 # run from this directory # Get application name application=`getApplication` -runKivaToFoam() -{ - if [ -f log.kivaToFoam ] - then - echo "kivaToFoam already run: remove log file to re-run" - else - echo "kivaToFoam: converting kiva file" - kivaToFoam -file $1 > log.kivaToFoam 2>&1 - fi -} - - -restartApplication() -{ - if [ -f log-2.$1 ] - then - echo "$1 already run: remove log file to re-run" - else - echo "Running $1" - $1 > log-2.$1 2>&1 - fi -} - - -runKivaToFoam otape17 +runApplication kivaToFoam -file otape17 cp system/controlDict.1st system/controlDict runApplication $application +mv log.$application log.$application.1 cp system/controlDict.2nd system/controlDict -restartApplication $application +runApplication $application +mv log.$application log.$application.2 # ----------------------------------------------------------------- end-of-file diff --git a/tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/makeMesh b/tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/makeMesh index 937900177cf8dd32580188517f1288f2f7a37eda..3d13f36b4fd5dc0b8cb2736017d4be4d95a0696c 100755 --- a/tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/makeMesh +++ b/tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/makeMesh @@ -1,5 +1,8 @@ #!/bin/sh -set -x +cd ${0%/*} || exit 1 # run from this directory + +# Source tutorial run functions +. $WM_PROJECT_DIR/bin/tools/RunFunctions m4 < constant/polyMesh/blockMeshDict.m4 > constant/polyMesh/blockMeshDict -blockMesh > log.blockMesh 2>&1 +runApplication blockMesh diff --git a/tutorials/compressible/sonicFoam/ras/nacaAirfoil/Allrun b/tutorials/compressible/sonicFoam/ras/nacaAirfoil/Allrun index 6142b9557c81a05d64dd43de4b095a5d0b21493f..7ff431e35f3eae0e2e63ce137cd3a29dd66a628d 100755 --- a/tutorials/compressible/sonicFoam/ras/nacaAirfoil/Allrun +++ b/tutorials/compressible/sonicFoam/ras/nacaAirfoil/Allrun @@ -7,24 +7,13 @@ cd ${0%/*} || exit 1 # run from this directory # Get application name application=`getApplication` -runStarToFoam() -{ - if [ -f log.star3ToFoam -o -f log.starToFoam ] - then - echo "star3ToFoam already run on $PWD: remove log file to re-run" - else - echo "star3ToFoam: converting mesh $1" - star3ToFoam $1 > log.star3ToFoam 2>&1 - fi -} +runApplication star3ToFoam prostar/nacaAirfoil -runStarToFoam prostar/nacaAirfoil mv constant/polyMesh/boundary temp sed -e s/"\([\t ]*type[\t ]*\)symmetryPlane"/"\1empty"/g \ temp > constant/polyMesh/boundary rm temp -runApplication $application -# end-of-file +runApplication $application # ----------------------------------------------------------------- end-of-file diff --git a/tutorials/heatTransfer/buoyantSimpleFoam/buoyantCavity/validation/createGraphs b/tutorials/heatTransfer/buoyantSimpleFoam/buoyantCavity/validation/createGraphs index 2d9ceeb49a128a8d79c850a4c95ec7af0db83e72..4baed11dace892bc45de05403d70465d7bbd90fe 100755 --- a/tutorials/heatTransfer/buoyantSimpleFoam/buoyantCavity/validation/createGraphs +++ b/tutorials/heatTransfer/buoyantSimpleFoam/buoyantCavity/validation/createGraphs @@ -83,8 +83,16 @@ type -P gnuplot &>/dev/null || { exit 1 } +SETSDIR="../sets" + +if [ ! -d $SETSDIR ] +then + echo "createGraphs: results sets not available in folder $SETSDIR" + exit 0 +fi + # paths to data -LATESTTIME=`ls ../sets` +LATESTTIME=`ls $SETSDIR` OFDATAROOT=../sets/$LATESTTIME EXPTDATAROOT=./exptData diff --git a/tutorials/heatTransfer/buoyantSimpleFoam/circuitBoardCooling/Allrun b/tutorials/heatTransfer/buoyantSimpleFoam/circuitBoardCooling/Allrun index 6de4b18840f513923647e10ed3211e3520d17546..ed131900d36d14e0bb34237f1e1e0b69976c65dc 100755 --- a/tutorials/heatTransfer/buoyantSimpleFoam/circuitBoardCooling/Allrun +++ b/tutorials/heatTransfer/buoyantSimpleFoam/circuitBoardCooling/Allrun @@ -13,7 +13,7 @@ unset FOAM_SETNAN unset FOAM_SIGFPE # Create first baffle -createBaffles baffleFaces '(baffle1Wall_0 baffle1Wall_1)' -overwrite > log.createBaffles 2>&1 +runApplication createBaffles baffleFaces '(baffle1Wall_0 baffle1Wall_1)' -overwrite # Create region runApplication extrudeToRegionMesh -overwrite diff --git a/tutorials/incompressible/MRFSimpleFoam/mixerVessel2D/makeMesh b/tutorials/incompressible/MRFSimpleFoam/mixerVessel2D/makeMesh index 937900177cf8dd32580188517f1288f2f7a37eda..8cb3ae622ef5b4fbf91da2e3a558c41ec3b60797 100755 --- a/tutorials/incompressible/MRFSimpleFoam/mixerVessel2D/makeMesh +++ b/tutorials/incompressible/MRFSimpleFoam/mixerVessel2D/makeMesh @@ -1,5 +1,11 @@ #!/bin/sh -set -x +cd ${0%/*} || exit 1 # run from this directory + +# Source tutorial run functions +. $WM_PROJECT_DIR/bin/tools/RunFunctions m4 < constant/polyMesh/blockMeshDict.m4 > constant/polyMesh/blockMeshDict -blockMesh > log.blockMesh 2>&1 + +runApplication blockMesh + +# ----------------------------------------------------------------- end-of-file diff --git a/tutorials/incompressible/pimpleDyMFoam/mixerVesselAMI2D/Allrun b/tutorials/incompressible/pimpleDyMFoam/mixerVesselAMI2D/Allrun index 3aa63c00d9b7d1b846e4e231834287a4d5e56fa6..f038377853694a0f7ffba2e610774e5f01ae9904 100755 --- a/tutorials/incompressible/pimpleDyMFoam/mixerVesselAMI2D/Allrun +++ b/tutorials/incompressible/pimpleDyMFoam/mixerVesselAMI2D/Allrun @@ -1,7 +1,6 @@ #!/bin/sh cd ${0%/*} || exit 1 # run from this directory - # Source tutorial run functions . $WM_PROJECT_DIR/bin/tools/RunFunctions diff --git a/tutorials/incompressible/pimpleDyMFoam/mixerVesselAMI2D/makeMesh b/tutorials/incompressible/pimpleDyMFoam/mixerVesselAMI2D/makeMesh index edcd0dadfe341e37ec4fd4015cb2c54d16fc7f3f..937765f7cb7b519acdc5f2be2b23d0cd13c59ed9 100755 --- a/tutorials/incompressible/pimpleDyMFoam/mixerVesselAMI2D/makeMesh +++ b/tutorials/incompressible/pimpleDyMFoam/mixerVesselAMI2D/makeMesh @@ -1,6 +1,13 @@ #!/bin/sh -set -x +cd ${0%/*} || exit 1 # run from this directory + +# Source tutorial run functions +. $WM_PROJECT_DIR/bin/tools/RunFunctions m4 < constant/polyMesh/blockMeshDict.m4 > constant/polyMesh/blockMeshDict -blockMesh > log.blockMesh 2>&1 -topoSet + +runApplication blockMesh + +runApplication topoSet + +# ----------------------------------------------------------------- end-of-file diff --git a/tutorials/incompressible/pimpleFoam/TJunctionFan/0/p b/tutorials/incompressible/pimpleFoam/TJunctionFan/0/p index 16a8bb50eddb376e9a4d3efbbf94db59b3126a2b..e69dbaddef297209acae529c13477d797fc2e80d 100644 --- a/tutorials/incompressible/pimpleFoam/TJunctionFan/0/p +++ b/tutorials/incompressible/pimpleFoam/TJunctionFan/0/p @@ -56,7 +56,6 @@ boundaryField { type fan; patchType cyclic; - jump uniform 0; jumpTable polynomial 2 @@ -71,7 +70,6 @@ boundaryField { type fan; patchType cyclic; - jump uniform 0; value uniform 0; } defaultFaces diff --git a/tutorials/incompressible/pimpleFoam/TJunctionFan/Allrun b/tutorials/incompressible/pimpleFoam/TJunctionFan/Allrun index 84758693b88e0ac85b8dce7d3faf314190a50624..2374d2fb6c3277c6f5aa1db7cd77620c2bc5109e 100755 --- a/tutorials/incompressible/pimpleFoam/TJunctionFan/Allrun +++ b/tutorials/incompressible/pimpleFoam/TJunctionFan/Allrun @@ -16,9 +16,13 @@ unset FOAM_SETNAN # Create faceZones for fan and baffles runApplication topoSet + # Create fan cyclics -createBaffles cyclicFaces '(fan_half0 fan_half1)' -overwrite > log.createBaffles 2>&1 +runApplication createBaffles cyclicFaces '(fan_half0 fan_half1)' -overwrite +mv log.createBaffles log.createBaffles.1 + # Create wall baffles -createBaffles baffleFaces '(baffles baffles)' -overwrite > log.createBaffles 2>&1 +runApplication createBaffles baffleFaces '(baffles baffles)' -overwrite +mv log.createBaffles log.createBaffles.2 runApplication $application diff --git a/tutorials/incompressible/pimpleFoam/elipsekkLOmega/Allrun b/tutorials/incompressible/pimpleFoam/elipsekkLOmega/Allrun index fd85f49a951d0ded2fad152f116e272f97164bad..656b92f3addbd931034a7f844bb2f46dffce0a97 100755 --- a/tutorials/incompressible/pimpleFoam/elipsekkLOmega/Allrun +++ b/tutorials/incompressible/pimpleFoam/elipsekkLOmega/Allrun @@ -8,7 +8,7 @@ cd ${0%/*} || exit 1 # run from this directory application=`getApplication` runApplication blockMesh -transformPoints -scale '(1.6666 1 1)' +runApplication transformPoints -scale '(1.6666 1 1)' runApplication changeDictionary -instance system -dict system/changeDictionaryDict.X runApplication mirrorMesh -overwrite diff --git a/tutorials/lagrangian/reactingParcelFoam/filter/Allrun b/tutorials/lagrangian/reactingParcelFoam/filter/Allrun index 061be5a02eb8a1cd772b947b0c05a27f5230043e..b7428e064f41ff60966bae7e3ee0f990ef38bd62 100755 --- a/tutorials/lagrangian/reactingParcelFoam/filter/Allrun +++ b/tutorials/lagrangian/reactingParcelFoam/filter/Allrun @@ -21,10 +21,12 @@ setsToZones -noFlipMap > log.setsToZones 2>&1 # - use binary writing to avoid 'nan' # - use setFields to set values unset FOAM_SIGFPE -createBaffles cycLeft '(cycLeft_half0 cycLeft_half1)' -overwrite > log.createBaffles1 2>&1 +runApplication createBaffles cycLeft '(cycLeft_half0 cycLeft_half1)' -overwrite +mv log.createBaffles log.createBaffles1 # create the second cyclic - rhs of porous zone -createBaffles cycRight '(cycRight_half0 cycRight_half1)' -overwrite > log.createBaffles2 2>&1 +runApplication createBaffles cycRight '(cycRight_half0 cycRight_half1)' -overwrite +mv log.createBaffles log.createBaffles2 # Initialise newly created patchFields to 0 runApplication changeDictionary diff --git a/tutorials/lagrangian/reactingParcelFoam/filter/constant/porosityProperties b/tutorials/lagrangian/reactingParcelFoam/filter/constant/porosityProperties index fcd5c5d3f1724961ee4de6a065ec6dbdcebad16f..93c4de650d34640250d9533b2491c143b31daa9a 100644 --- a/tutorials/lagrangian/reactingParcelFoam/filter/constant/porosityProperties +++ b/tutorials/lagrangian/reactingParcelFoam/filter/constant/porosityProperties @@ -23,11 +23,8 @@ filter1 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); - } + 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 { diff --git a/tutorials/lagrangian/reactingParcelFoam/filter/constant/sourcesProperties b/tutorials/lagrangian/reactingParcelFoam/filter/constant/sourcesProperties index 7f40e5d0325447e8b0d3156e6b855d3a2bc5c4c6..e049d42c4b7ec727f97cf8b6cce7816dfd63762d 100644 --- a/tutorials/lagrangian/reactingParcelFoam/filter/constant/sourcesProperties +++ b/tutorials/lagrangian/reactingParcelFoam/filter/constant/sourcesProperties @@ -17,7 +17,7 @@ FoamFile massSource1 { - type scalarExplicitSource; + type scalarSemiImplicitSource; active true; timeStart 0.2; duration 2.0; @@ -27,13 +27,13 @@ massSource1 (2.75 0.5 0) ); - scalarExplicitSourceCoeffs + scalarSemiImplicitSourceCoeffs { volumeMode absolute; - injectionRate + injectionRateSuSp { - rho 1e-4; // kg/s - H2O 1e-4; // kg/s + rho (1e-4 0); // kg/s + H2O (1e-4 0); // kg/s } } } @@ -41,7 +41,7 @@ massSource1 momentumSource1 { - type vectorExplicitSource; + type vectorSemiImplicitSource; active true; timeStart 0.2; duration 2.0; @@ -51,12 +51,12 @@ momentumSource1 (2.75 0.5 0) ); - vectorExplicitSourceCoeffs + vectorSemiImplicitSourceCoeffs { volumeMode absolute; - injectionRate + injectionRateSuSp { - U (0 0.005 0); + U ((0 0.005 0) 0); } } } @@ -64,7 +64,7 @@ momentumSource1 energySource1 { - type scalarExplicitSource; + type scalarSemiImplicitSource; active true; timeStart 0.2; duration 2.0; @@ -74,12 +74,12 @@ energySource1 (2.75 0.5 0) ); - scalarExplicitSourceCoeffs + scalarSemiImplicitSourceCoeffs { volumeMode absolute; - injectionRate + injectionRateSuSp { - h 10; + h (10 0); } } } diff --git a/tutorials/mesh/snappyHexMesh/flange/system/snappyHexMeshDict b/tutorials/mesh/snappyHexMesh/flange/system/snappyHexMeshDict index 520d52950fd68de40456313e06c8e895313a99a2..a1c0e1162f43801b6007ec103c38b837ec14209c 100644 --- a/tutorials/mesh/snappyHexMesh/flange/system/snappyHexMeshDict +++ b/tutorials/mesh/snappyHexMesh/flange/system/snappyHexMeshDict @@ -186,6 +186,10 @@ snapControls //- Use castellatedMeshControls::features explicitFeatureSnap true; + + //- Detect features between multiple surfaces + // (only for explicitFeatureSnap, default = false) + multiRegionFeatureSnap true; } diff --git a/tutorials/multiphase/interFoam/ras/damBreakPorousBaffle/Allrun b/tutorials/multiphase/interFoam/ras/damBreakPorousBaffle/Allrun index 29758935af3f44d3b33636462a6c091fe16f7c15..32c7e6f948157c416cccf020b8c874198ee1ddcc 100755 --- a/tutorials/multiphase/interFoam/ras/damBreakPorousBaffle/Allrun +++ b/tutorials/multiphase/interFoam/ras/damBreakPorousBaffle/Allrun @@ -16,7 +16,7 @@ unset FOAM_SETNAN # Create faceZones for porous baffles runApplication topoSet -createBaffles cyclicZoneFaces '(porous_half0 porous_half1)' -overwrite > log.createBaffles 2>&1 +runApplication createBaffles cyclicZoneFaces '(porous_half0 porous_half1)' -overwrite runApplication changeDictionary