diff --git a/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMeshDict b/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMeshDict index b3be8fe96f..f0cc40a8e4 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 6fe40ed9f1..6fa4104188 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 d06e5d03cb..b3b390af51 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 normals(2); + DynamicList 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 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 6c1eab66e9..a52ebdfa55 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 d986057b5f..093c6ed037 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 3ce0d2c447..2023f9ce59 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 a3161386e6..c93aad5a36 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 75c946d1d4..a1523fd3ff 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 dfa6cdf93e..e23fc83679 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 2aedebe681..b513a4be0e 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& 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& 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 d5626972cc..04cb8cf165 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 929e151a0c..da670e2db5 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& tbl); diff --git a/src/fieldSources/Make/files b/src/fieldSources/Make/files index 41fecea800..11f91ff58a 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 64ed783cb9..2e556eaf01 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 -const Foam::wordList Foam::ExplicitSource:: +const Foam::wordList Foam::SemiImplicitSource:: volumeModeTypeNames_ ( IStringStream("(absolute specific)")() @@ -41,8 +42,8 @@ volumeModeTypeNames_ // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // template -typename Foam::ExplicitSource::volumeModeType -Foam::ExplicitSource::wordToVolumeModeType +typename Foam::SemiImplicitSource::volumeModeType +Foam::SemiImplicitSource::wordToVolumeModeType ( const word& vmtName ) const @@ -57,8 +58,8 @@ Foam::ExplicitSource::wordToVolumeModeType FatalErrorIn ( - "ExplicitSource::volumeModeType" - "ExplicitSource::wordToVolumeModeType(const word&)" + "SemiImplicitSource::volumeModeType" + "SemiImplicitSource::wordToVolumeModeType(const word&)" ) << "Unknown volumeMode type " << vmtName << ". Valid volumeMode types are:" << nl << volumeModeTypeNames_ << exit(FatalError); @@ -68,7 +69,7 @@ Foam::ExplicitSource::wordToVolumeModeType template -Foam::word Foam::ExplicitSource::volumeModeTypeToWord +Foam::word Foam::SemiImplicitSource::volumeModeTypeToWord ( const volumeModeType& vmtType ) const @@ -85,7 +86,7 @@ Foam::word Foam::ExplicitSource::volumeModeTypeToWord template -void Foam::ExplicitSource::setFieldData(const dictionary& dict) +void Foam::SemiImplicitSource::setFieldData(const dictionary& dict) { fieldNames_.setSize(dict.toc().size()); injectionRate_.setSize(fieldNames_.size()); @@ -111,7 +112,7 @@ void Foam::ExplicitSource::setFieldData(const dictionary& dict) // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // template -Foam::ExplicitSource::ExplicitSource +Foam::SemiImplicitSource::SemiImplicitSource ( const word& name, const word& modelType, @@ -131,7 +132,7 @@ Foam::ExplicitSource::ExplicitSource // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template -void Foam::ExplicitSource::addSup +void Foam::SemiImplicitSource::addSup ( fvMatrix& eqn, const label fieldI @@ -139,15 +140,17 @@ void Foam::ExplicitSource::addSup { if (debug) { - Info<< "ExplicitSource<"<< pTraits::typeName + Info<< "SemiImplicitSource<" << pTraits::typeName << ">::addSup for source " << name_ << endl; } + const GeometricField& psi = eqn.psi(); + DimensionedField Su ( IOobject ( - name_ + fieldNames_[fieldI] + "Sup", + name_ + fieldNames_[fieldI] + "Su", mesh_.time().timeName(), mesh_, IOobject::NO_READ, @@ -163,9 +166,31 @@ void Foam::ExplicitSource::addSup false ); - UIndirectList(Su, cells_) = injectionRate_[fieldI]/VDash_; + UIndirectList(Su, cells_) = injectionRate_[fieldI].first()/VDash_; - eqn += Su; + DimensionedField Sp + ( + IOobject + ( + name_ + fieldNames_[fieldI] + "Sp", + mesh_.time().timeName(), + mesh_, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh_, + dimensioned + ( + "zero", + Su.dimensions()/psi.dimensions(), + 0.0 + ), + false + ); + + UIndirectList(Sp, cells_) = injectionRate_[fieldI].second()/VDash_; + + 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 30a18dd5d3..94a174034b 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 . 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 - ExplicitSourceCoeffs + 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 ExplicitSource; +class SemiImplicitSource; // Forward declaration of friend functions @@ -77,15 +89,15 @@ template Ostream& operator<< ( Ostream&, - const ExplicitSource& + const SemiImplicitSource& ); /*---------------------------------------------------------------------------*\ - Class ExplicitSource Declaration + Class SemiImplicitSource Declaration \*---------------------------------------------------------------------------*/ template -class ExplicitSource +class SemiImplicitSource : public basicSource { @@ -115,7 +127,7 @@ protected: scalar VDash_; //- Source field values - List injectionRate_; + List > 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& injectionRate() const; + inline const List >& injectionRate() const; // Edit @@ -165,7 +177,7 @@ public: inline volumeModeType& volumeMode(); //- Return access to the source field values - inline List& injectionRate(); + inline List >& 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 e3f4b8aa63..eb352de08a 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 -inline const typename Foam::ExplicitSource::volumeModeType& -Foam::ExplicitSource::volumeMode() const +inline const typename Foam::SemiImplicitSource::volumeModeType& +Foam::SemiImplicitSource::volumeMode() const { return volumeMode_; } template -inline const Foam::List& Foam::ExplicitSource::injectionRate() const +inline const Foam::List >& +Foam::SemiImplicitSource::injectionRate() const { return injectionRate_; } template -inline typename Foam::ExplicitSource::volumeModeType& -Foam::ExplicitSource::volumeMode() +inline typename Foam::SemiImplicitSource::volumeModeType& +Foam::SemiImplicitSource::volumeMode() { return volumeMode_; } template -inline Foam::List& Foam::ExplicitSource::injectionRate() +inline Foam::List >& Foam::SemiImplicitSource::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 f2abe69cbd..6b91798be6 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 -void Foam::ExplicitSource::writeData(Ostream& os) const +void Foam::SemiImplicitSource::writeData(Ostream& os) const { os << indent << name_ << endl; dict_.write(os); @@ -36,12 +36,12 @@ void Foam::ExplicitSource::writeData(Ostream& os) const template -bool Foam::ExplicitSource::read(const dictionary& dict) +bool Foam::SemiImplicitSource::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 338a422059..e3b294fa59 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 d13d012468..eee3fd6894 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)/uniformFixedValue/uniformFixedValueFvPatchFields.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)/uniformFixedValue/uniformFixedValueFvPatchFields.C +$(derivedFvPatchFields)/uniformJump/uniformJumpFvPatchFields.C +$(derivedFvPatchFields)/uniformJumpAMI/uniformJumpAMIFvPatchFields.C +$(derivedFvPatchFields)/uniformTotalPressure/uniformTotalPressureFvPatchScalarField.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 193008daff..db6849d267 100644 --- a/src/finiteVolume/fields/fvPatchFields/constraint/jumpCyclic/jumpCyclicFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/constraint/jumpCyclic/jumpCyclicFvPatchField.C @@ -77,7 +77,6 @@ jumpCyclicFvPatchField::jumpCyclicFvPatchField const jumpCyclicFvPatchField& ptf ) : - cyclicLduInterfaceField(), cyclicFvPatchField(ptf) {} @@ -105,12 +104,11 @@ tmp > jumpCyclicFvPatchField::patchNeighbourField() const tmp > tpnf(new Field(this->size())); Field& pnf = tpnf(); - tmp > tjf = jump(); + Field jf(this->jump()); if (!this->cyclicPatch().owner()) { - tjf = -tjf; + jf *= -1.0; } - const Field& jf = tjf(); if (this->doTransform()) { @@ -149,14 +147,15 @@ void jumpCyclicFvPatchField::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 > tjf = jump()().component(cmpt); + Field jf(this->jump()().component(cmpt)); + if (!this->cyclicPatch().owner()) { - tjf = -tjf; + jf *= -1.0; } - const Field& jf = tjf(); forAll(*this, facei) { @@ -197,14 +196,15 @@ void jumpCyclicFvPatchField::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 > tjf = jump(); + Field jf(this->jump()); + if (!this->cyclicPatch().owner()) { - tjf = -tjf; + jf *= -1.0; } - const Field& 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 0000000000..87d7c20efd --- /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 . + +\*---------------------------------------------------------------------------*/ + +#include "jumpCyclicAMIFvPatchField.H" +#include "transformField.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template +Foam::jumpCyclicAMIFvPatchField::jumpCyclicAMIFvPatchField +( + const fvPatch& p, + const DimensionedField& iF +) +: + cyclicAMIFvPatchField(p, iF) +{} + + +template +Foam::jumpCyclicAMIFvPatchField::jumpCyclicAMIFvPatchField +( + const jumpCyclicAMIFvPatchField& ptf, + const fvPatch& p, + const DimensionedField& iF, + const fvPatchFieldMapper& mapper +) +: + cyclicAMIFvPatchField(ptf, p, iF, mapper) +{} + + +template +Foam::jumpCyclicAMIFvPatchField::jumpCyclicAMIFvPatchField +( + const fvPatch& p, + const DimensionedField& iF, + const dictionary& dict +) +: + cyclicAMIFvPatchField(p, iF, dict) +{ + // Call this evaluation in derived classes + //this->evaluate(Pstream::blocking); +} + + +template +Foam::jumpCyclicAMIFvPatchField::jumpCyclicAMIFvPatchField +( + const jumpCyclicAMIFvPatchField& ptf +) +: + cyclicAMIFvPatchField(ptf) +{} + + +template +Foam::jumpCyclicAMIFvPatchField::jumpCyclicAMIFvPatchField +( + const jumpCyclicAMIFvPatchField& ptf, + const DimensionedField& iF +) +: + cyclicAMIFvPatchField(ptf, iF) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +Foam::tmp > +Foam::jumpCyclicAMIFvPatchField::patchNeighbourField() const +{ + const Field& iField = this->internalField(); + const labelUList& nbrFaceCells = + this->cyclicAMIPatch().cyclicAMIPatch().neighbPatch().faceCells(); + + Field pnf(iField, nbrFaceCells); + tmp > tpnf + ( + new Field(this->cyclicAMIPatch().interpolate(pnf)) + ); + + if (this->doTransform()) + { + tpnf = transform(this->forwardT(), tpnf); + } + + tmp > tjf = jump(); + if (!this->cyclicAMIPatch().owner()) + { + tjf = -tjf; + } + + return tpnf - tjf; +} + + +template +void Foam::jumpCyclicAMIFvPatchField::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 > 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 +void Foam::jumpCyclicAMIFvPatchField::updateInterfaceMatrix +( + Field& result, + const Field& psiInternal, + const scalarField& coeffs, + const Pstream::commsTypes +) const +{ + const labelUList& nbrFaceCells = + this->cyclicAMIPatch().cyclicAMIPatch().neighbPatch().faceCells(); + + Field pnf(psiInternal, nbrFaceCells); + + pnf = this->cyclicAMIPatch().interpolate(pnf); + + // for AMG solve - only apply jump to finest level + if (psiInternal.size() == this->internalField().size()) + { + tmp > 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 0000000000..6759b09a36 --- /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 . + +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 jumpCyclicAMIFvPatchField +: + public cyclicAMIFvPatchField +{ + +public: + + //- Runtime type information + TypeName("jumpCyclicAMI"); + + + // Constructors + + //- Construct from patch and internal field + jumpCyclicAMIFvPatchField + ( + const fvPatch&, + const DimensionedField& + ); + + //- Construct from patch, internal field and dictionary + jumpCyclicAMIFvPatchField + ( + const fvPatch&, + const DimensionedField&, + const dictionary& + ); + + //- Construct by mapping given jumpCyclicAMIFvPatchField onto a + // new patch + jumpCyclicAMIFvPatchField + ( + const jumpCyclicAMIFvPatchField&, + const fvPatch&, + const DimensionedField&, + const fvPatchFieldMapper& + ); + + //- Construct as copy + jumpCyclicAMIFvPatchField + ( + const jumpCyclicAMIFvPatchField& + ); + + //- Construct as copy setting internal field reference + jumpCyclicAMIFvPatchField + ( + const jumpCyclicAMIFvPatchField&, + const DimensionedField& + ); + + + // Member functions + + // Access + + //- Return the interface type + virtual const word& interfaceFieldType() const + { + return cyclicAMIFvPatchField::type(); + } + + //- Return the "jump" across the patch as a "half" field + virtual tmp > jump() const = 0; + + + // Evaluation functions + + //- Return neighbour coupled given internal cell data + tmp > 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&, + const Field&, + 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 0000000000..323f460d9f --- /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 . + +\*---------------------------------------------------------------------------*/ + +#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 0000000000..6f5039e0bc --- /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 . + +\*---------------------------------------------------------------------------*/ + +#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 0000000000..c4bc6547b0 --- /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 . + +\*---------------------------------------------------------------------------*/ + +#ifndef jumpCyclicAMIFvPatchFieldsFwd_H +#define jumpCyclicAMIFvPatchFieldsFwd_H + +#include "fieldTypes.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +template 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 477b242b76..3a150c6f70 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::fanFvPatchField const DimensionedField& iF ) : - fixedJumpFvPatchField(p, iF), - jumpTable_(0) + uniformJumpFvPatchField(p, iF) {} @@ -48,8 +47,7 @@ Foam::fanFvPatchField::fanFvPatchField const fvPatchFieldMapper& mapper ) : - fixedJumpFvPatchField(ptf, p, iF, mapper), - jumpTable_(ptf.jumpTable_().clone().ptr()) + uniformJumpFvPatchField(ptf, p, iF, mapper) {} @@ -61,8 +59,7 @@ Foam::fanFvPatchField::fanFvPatchField const dictionary& dict ) : - fixedJumpFvPatchField(p, iF), - jumpTable_(DataEntry::New("jumpTable", dict)) + uniformJumpFvPatchField(p, iF, dict) {} @@ -72,9 +69,7 @@ Foam::fanFvPatchField::fanFvPatchField const fanFvPatchField& ptf ) : - cyclicLduInterfaceField(), - fixedJumpFvPatchField(ptf), - jumpTable_(ptf.jumpTable_().clone().ptr()) + uniformJumpFvPatchField(ptf) {} @@ -85,25 +80,8 @@ Foam::fanFvPatchField::fanFvPatchField const DimensionedField& iF ) : - fixedJumpFvPatchField(ptf, iF), - jumpTable_(ptf.jumpTable_().clone().ptr()) + uniformJumpFvPatchField(ptf, iF) {} -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - - -template -void Foam::fanFvPatchField::write(Ostream& os) const -{ - - fixedJumpFvPatchField::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 3eea1382f3..463ebeb543 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 fanFvPatchField : - public fixedJumpFvPatchField + public uniformJumpFvPatchField { - // Private data - - //- Interpolation table - autoPtr > 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 1b291d500c..668d43483d 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::fanFvPatchField const dictionary& dict ) : - fixedJumpFvPatchField(p, iF), - jumpTable_(new DataEntry("jumpTable")) + uniformJumpFvPatchField(p, iF) { if (this->cyclicPatch().owner()) { @@ -83,7 +82,7 @@ Foam::fanFvPatchField::fanFvPatchField } } - jumpTable_.reset + this->jumpTable_.reset ( new polynomial("jumpTable", coeffs) ); @@ -91,10 +90,14 @@ Foam::fanFvPatchField::fanFvPatchField else { // Generic input constructed from dictionary - jumpTable_ = DataEntry::New("jumpTable", dict); + this->jumpTable_ = DataEntry::New("jumpTable", dict); } } - + else + { + // Dummy jump table + this->jumpTable_.reset(new DataEntry("jumpTable")); + } if (dict.found("value")) { @@ -136,10 +139,10 @@ void Foam::fanFvPatchField::updateCoeffs() Un /= patch().lookupPatchField("rho"); } - jump_ = jumpTable_->value(Un); + this->jump_ = this->jumpTable_->value(Un); } - fixedJumpFvPatchField::updateCoeffs(); + uniformJumpFvPatchField::updateCoeffs(); } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/fixedJump/fixedJumpFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/fixedJump/fixedJumpFvPatchField.C index fd2050ffcc..e58270ec63 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::fixedJumpFvPatchField const fixedJumpFvPatchField& ptf ) : - cyclicLduInterfaceField(), jumpCyclicFvPatchField(ptf), jump_(ptf.jump_) {} @@ -92,6 +91,23 @@ Foam::fixedJumpFvPatchField::fixedJumpFvPatchField // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // +template +Foam::tmp > Foam::fixedJumpFvPatchField::jump() const +{ + if (this->cyclicPatch().owner()) + { + return jump_; + } + else + { + return refCast > + ( + this->neighbourPatchField() + ).jump(); + } +} + + template void Foam::fixedJumpFvPatchField::autoMap ( @@ -124,6 +140,7 @@ void Foam::fixedJumpFvPatchField::write(Ostream& os) const fvPatchField::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 30ec57fc54..ede9fea8af 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 + 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 > jump() const - { - if (this->cyclicPatch().owner()) - { - return jump_; - } - else - { - return refCast > - ( - this->neighbourPatchField() - ).jump(); - } - } + //- Return the "jump" across the patch + virtual tmp > 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 0000000000..b06849691a --- /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 . + +\*---------------------------------------------------------------------------*/ + +#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 0000000000..444d3259bd --- /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 . + +\*---------------------------------------------------------------------------*/ + +#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 0000000000..97a42cfa46 --- /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 . + +\*---------------------------------------------------------------------------*/ + +#ifndef fixedJumpFvPatchFieldsFwd_H +#define fixedJumpFvPatchFieldsFwd_H + +#include "fieldTypes.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +template 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 0000000000..d9cdc383a3 --- /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 . + +\*---------------------------------------------------------------------------*/ + +#include "fixedJumpAMIFvPatchField.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template +Foam::fixedJumpAMIFvPatchField::fixedJumpAMIFvPatchField +( + const fvPatch& p, + const DimensionedField& iF +) +: + jumpCyclicAMIFvPatchField(p, iF), + jump_(this->size(), pTraits::zero) +{} + + +template +Foam::fixedJumpAMIFvPatchField::fixedJumpAMIFvPatchField +( + const fixedJumpAMIFvPatchField& ptf, + const fvPatch& p, + const DimensionedField& iF, + const fvPatchFieldMapper& mapper +) +: + jumpCyclicAMIFvPatchField(ptf, p, iF, mapper), + jump_(ptf.jump_, mapper) +{} + + +template +Foam::fixedJumpAMIFvPatchField::fixedJumpAMIFvPatchField +( + const fvPatch& p, + const DimensionedField& iF, + const dictionary& dict +) +: + jumpCyclicAMIFvPatchField(p, iF), + jump_("jump", dict, p.size()) +{} + + +template +Foam::fixedJumpAMIFvPatchField::fixedJumpAMIFvPatchField +( + const fixedJumpAMIFvPatchField& ptf +) +: + jumpCyclicAMIFvPatchField(ptf), + jump_(ptf.jump_) +{} + + +template +Foam::fixedJumpAMIFvPatchField::fixedJumpAMIFvPatchField +( + const fixedJumpAMIFvPatchField& ptf, + const DimensionedField& iF +) +: + jumpCyclicAMIFvPatchField(ptf, iF), + jump_(ptf.jump_) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +Foam::tmp > Foam::fixedJumpAMIFvPatchField::jump() const +{ + if (this->cyclicAMIPatch().owner()) + { + return jump_; + } + else + { + const fixedJumpAMIFvPatchField& nbrPatch = + refCast > + ( + this->neighbourPatchField() + ); + + return this->cyclicAMIPatch().interpolate(nbrPatch.jump()); + } +} + + +template +void Foam::fixedJumpAMIFvPatchField::autoMap +( + const fvPatchFieldMapper& m +) +{ + jumpCyclicAMIFvPatchField::autoMap(m); + jump_.autoMap(m); +} + + +template +void Foam::fixedJumpAMIFvPatchField::rmap +( + const fvPatchField& ptf, + const labelList& addr +) +{ + jumpCyclicAMIFvPatchField::rmap(ptf, addr); + + const fixedJumpAMIFvPatchField& tiptf = + refCast >(ptf); + jump_.rmap(tiptf.jump_, addr); +} + + +template +void Foam::fixedJumpAMIFvPatchField::write(Ostream& os) const +{ + fvPatchField::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 0000000000..9a0c4bf520 --- /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 . + +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 fixedJumpAMIFvPatchField +: + public jumpCyclicAMIFvPatchField +{ + +protected: + + // Protected data + + //- "jump" field + Field jump_; + + +public: + + //- Runtime type information + TypeName("fixedJumpAMI"); + + + // Constructors + + //- Construct from patch and internal field + fixedJumpAMIFvPatchField + ( + const fvPatch&, + const DimensionedField& + ); + + //- Construct from patch, internal field and dictionary + fixedJumpAMIFvPatchField + ( + const fvPatch&, + const DimensionedField&, + const dictionary& + ); + + //- Construct by mapping given fixedJumpAMIFvPatchField onto a + // new patch + fixedJumpAMIFvPatchField + ( + const fixedJumpAMIFvPatchField&, + const fvPatch&, + const DimensionedField&, + const fvPatchFieldMapper& + ); + + //- Construct as copy + fixedJumpAMIFvPatchField + ( + const fixedJumpAMIFvPatchField& + ); + + //- Construct and return a clone + virtual tmp > clone() const + { + return tmp > + ( + new fixedJumpAMIFvPatchField(*this) + ); + } + + //- Construct as copy setting internal field reference + fixedJumpAMIFvPatchField + ( + const fixedJumpAMIFvPatchField&, + const DimensionedField& + ); + + //- Construct and return a clone setting internal field reference + virtual tmp > clone + ( + const DimensionedField& iF + ) const + { + return tmp > + ( + new fixedJumpAMIFvPatchField(*this, iF) + ); + } + + + // Member functions + + // Access + + //- Return the "jump" across the patch + virtual tmp > 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&, 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 0000000000..c28877d601 --- /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 . + +\*---------------------------------------------------------------------------*/ + +#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 0000000000..b0da67335a --- /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 . + +\*---------------------------------------------------------------------------*/ + +#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 0000000000..9231539cf3 --- /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 . + +\*---------------------------------------------------------------------------*/ + +#ifndef fixedJumpAMIFvPatchFieldsFwd_H +#define fixedJumpAMIFvPatchFieldsFwd_H + +#include "fieldTypes.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +template 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 0000000000..c4ee64eaa8 --- /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 . + +\*---------------------------------------------------------------------------*/ + +#include "uniformJumpFvPatchField.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template +Foam::uniformJumpFvPatchField::uniformJumpFvPatchField +( + const fvPatch& p, + const DimensionedField& iF +) +: + fixedJumpFvPatchField(p, iF), + jumpTable_(0) +{} + + +template +Foam::uniformJumpFvPatchField::uniformJumpFvPatchField +( + const uniformJumpFvPatchField& ptf, + const fvPatch& p, + const DimensionedField& iF, + const fvPatchFieldMapper& mapper +) +: + fixedJumpFvPatchField(ptf, p, iF, mapper), + jumpTable_(ptf.jumpTable_().clone().ptr()) +{} + + +template +Foam::uniformJumpFvPatchField::uniformJumpFvPatchField +( + const fvPatch& p, + const DimensionedField& iF, + const dictionary& dict +) +: + fixedJumpFvPatchField(p, iF), + jumpTable_(new DataEntry("jumpTable")) +{ + if (this->cyclicPatch().owner()) + { + jumpTable_ = DataEntry::New("jumpTable", dict); + } + + if (dict.found("value")) + { + fvPatchField::operator= + ( + Field("value", dict, p.size()) + ); + } +} + + +template +Foam::uniformJumpFvPatchField::uniformJumpFvPatchField +( + const uniformJumpFvPatchField& ptf +) +: + fixedJumpFvPatchField(ptf), + jumpTable_(ptf.jumpTable_().clone().ptr()) +{} + + +template +Foam::uniformJumpFvPatchField::uniformJumpFvPatchField +( + const uniformJumpFvPatchField& ptf, + const DimensionedField& iF +) +: + fixedJumpFvPatchField(ptf, iF), + jumpTable_(ptf.jumpTable_().clone().ptr()) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +Foam::tmp > Foam::uniformJumpFvPatchField::jump() const +{ + if (this->cyclicPatch().owner()) + { + const Type value = jumpTable_->value(this->db().time().value()); + + return tmp >(new Field(this->patch().size(), value)); + } + else + { + const uniformJumpFvPatchField& nbrPatch = + refCast > + ( + this->neighbourPatchField() + ); + + return nbrPatch.jump(); + } +} + + +template +void Foam::uniformJumpFvPatchField::write(Ostream& os) const +{ + fixedJumpFvPatchField::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 0663a1cb86..633dc1752e 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 . 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 uniformJumpFvPatchField : - public fixedJumpFvPatchField + public fixedJumpFvPatchField { - // Private data +protected: - //- Interpolation table - autoPtr > jumpTable_; + // Protected data + + //- "jump" table + autoPtr > jumpTable_; public: //- Runtime type information - TypeName("temperatureJump"); + TypeName("uniformJump"); // Constructors //- Construct from patch and internal field - temperatureJumpFvPatchScalarField + uniformJumpFvPatchField ( const fvPatch&, - const DimensionedField& + const DimensionedField& ); //- Construct from patch, internal field and dictionary - temperatureJumpFvPatchScalarField + uniformJumpFvPatchField ( const fvPatch&, - const DimensionedField&, + const DimensionedField&, const dictionary& ); - //- Construct by mapping given temperatureJumpFvPatchScalarField onto a + //- Construct by mapping given uniformJumpFvPatchField onto a // new patch - temperatureJumpFvPatchScalarField + uniformJumpFvPatchField ( - const temperatureJumpFvPatchScalarField&, + const uniformJumpFvPatchField&, const fvPatch&, - const DimensionedField&, + const DimensionedField&, const fvPatchFieldMapper& ); //- Construct as copy - temperatureJumpFvPatchScalarField + uniformJumpFvPatchField ( - const temperatureJumpFvPatchScalarField& + const uniformJumpFvPatchField& ); //- Construct and return a clone - virtual tmp > clone() const + virtual tmp > clone() const { - return tmp > + return tmp > ( - new temperatureJumpFvPatchScalarField(*this) + new uniformJumpFvPatchField(*this) ); } //- Construct as copy setting internal field reference - temperatureJumpFvPatchScalarField + uniformJumpFvPatchField ( - const temperatureJumpFvPatchScalarField&, - const DimensionedField& + const uniformJumpFvPatchField&, + const DimensionedField& ); //- Construct and return a clone setting internal field reference - virtual tmp > clone + virtual tmp > clone ( - const DimensionedField& iF + const DimensionedField& iF ) const { - return tmp > + return tmp > ( - new temperatureJumpFvPatchScalarField(*this, iF) + new uniformJumpFvPatchField(*this, iF) ); } // Member functions + // Access - // Access functions - - //- Return jumpTable - const DataEntry& jumpTable() const - { - return jumpTable_(); - } + //- Return the "jump" across the patch. + virtual tmp > 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 0000000000..489ab5f633 --- /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 . + +\*---------------------------------------------------------------------------*/ + +#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 0000000000..e28916c383 --- /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 . + +\*---------------------------------------------------------------------------*/ + +#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 0000000000..e9bcac0bba --- /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 . + +\*---------------------------------------------------------------------------*/ + +#ifndef uniformJumpFvPatchFieldsFwd_H +#define uniformJumpFvPatchFieldsFwd_H + +#include "fieldTypes.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +template 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 0000000000..a3e1fe6591 --- /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 . + +\*---------------------------------------------------------------------------*/ + +#include "uniformJumpAMIFvPatchField.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template +Foam::uniformJumpAMIFvPatchField::uniformJumpAMIFvPatchField +( + const fvPatch& p, + const DimensionedField& iF +) +: + fixedJumpAMIFvPatchField(p, iF), + jumpTable_(0) +{} + + +template +Foam::uniformJumpAMIFvPatchField::uniformJumpAMIFvPatchField +( + const uniformJumpAMIFvPatchField& ptf, + const fvPatch& p, + const DimensionedField& iF, + const fvPatchFieldMapper& mapper +) +: + fixedJumpAMIFvPatchField(ptf, p, iF, mapper), + jumpTable_(ptf.jumpTable_().clone().ptr()) +{} + + +template +Foam::uniformJumpAMIFvPatchField::uniformJumpAMIFvPatchField +( + const fvPatch& p, + const DimensionedField& iF, + const dictionary& dict +) +: + fixedJumpAMIFvPatchField(p, iF), + jumpTable_(new DataEntry("jumpTable")) +{ + if (this->cyclicAMIPatch().owner()) + { + jumpTable_ = DataEntry::New("jumpTable", dict); + } + + if (dict.found("value")) + { + fvPatchField::operator=(Field("value", dict, p.size())); + } +} + + +template +Foam::uniformJumpAMIFvPatchField::uniformJumpAMIFvPatchField +( + const uniformJumpAMIFvPatchField& ptf +) +: + fixedJumpAMIFvPatchField(ptf), + jumpTable_(ptf.jumpTable_().clone().ptr()) +{} + + +template +Foam::uniformJumpAMIFvPatchField::uniformJumpAMIFvPatchField +( + const uniformJumpAMIFvPatchField& ptf, + const DimensionedField& iF +) +: + fixedJumpAMIFvPatchField(ptf, iF), + jumpTable_(ptf.jumpTable_().clone().ptr()) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +Foam::tmp > +Foam::uniformJumpAMIFvPatchField::jump() const +{ + if (this->cyclicAMIPatch().owner()) + { + Type j = jumpTable_->value(this->db().time().value()); + + return tmp >(new Field(this->size(), j)); + } + else + { + const uniformJumpAMIFvPatchField& nbrPatch = + refCast > + ( + this->neighbourPatchField() + ); + + return this->cyclicAMIPatch().interpolate(nbrPatch.jump()); + } +} + + +template +void Foam::uniformJumpAMIFvPatchField::write(Ostream& os) const +{ + fixedJumpAMIFvPatchField::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 0000000000..e5eb2e6826 --- /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 . + +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 uniformJumpAMIFvPatchField +: + public fixedJumpAMIFvPatchField +{ + +protected: + + // Protected data + + //- "jump" table + autoPtr > jumpTable_; + + +public: + + //- Runtime type information + TypeName("uniformJumpAMI"); + + // Constructors + + //- Construct from patch and internal field + uniformJumpAMIFvPatchField + ( + const fvPatch&, + const DimensionedField& + ); + + //- Construct from patch, internal field and dictionary + uniformJumpAMIFvPatchField + ( + const fvPatch&, + const DimensionedField&, + const dictionary& + ); + + //- Construct by mapping given uniformJumpAMIFvPatchField onto a + // new patch + uniformJumpAMIFvPatchField + ( + const uniformJumpAMIFvPatchField&, + const fvPatch&, + const DimensionedField&, + const fvPatchFieldMapper& + ); + + //- Construct as copy + uniformJumpAMIFvPatchField + ( + const uniformJumpAMIFvPatchField& + ); + + //- Construct and return a clone + virtual tmp > clone() const + { + return tmp > + ( + new uniformJumpAMIFvPatchField(*this) + ); + } + + //- Construct as copy setting internal field reference + uniformJumpAMIFvPatchField + ( + const uniformJumpAMIFvPatchField&, + const DimensionedField& + ); + + //- Construct and return a clone setting internal field reference + virtual tmp > clone + ( + const DimensionedField& iF + ) const + { + return tmp > + ( + new uniformJumpAMIFvPatchField(*this, iF) + ); + } + + + // Member functions + + // Access + + //- Return the "jump" across the patch. + virtual tmp > 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 0000000000..f17f2849e8 --- /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 . + +\*---------------------------------------------------------------------------*/ + +#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 0000000000..0314210967 --- /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 . + +\*---------------------------------------------------------------------------*/ + +#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 0000000000..29080e7ec0 --- /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 . + +\*---------------------------------------------------------------------------*/ + +#ifndef uniformJumpAMIFvPatchFieldsFwd_H +#define uniformJumpAMIFvPatchFieldsFwd_H + +#include "fieldTypes.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +template class uniformJumpAMIFvPatchField; + +makePatchTypeFieldTypedefs(uniformJumpAMI); + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/thermophysicalModels/basic/Make/files b/src/thermophysicalModels/basic/Make/files index 3dc3d0c082..5b82c80476 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 16d886c766..5f64e9872d 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 d3ba1becdd..62ac6516ef 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(p, iF) { - if (dict.found("value")) { fvPatchScalarField::operator= @@ -77,7 +76,6 @@ Foam::energyJumpFvPatchScalarField::energyJumpFvPatchScalarField const energyJumpFvPatchScalarField& ptf ) : - cyclicLduInterfaceField(), fixedJumpFvPatchField(ptf) {} @@ -103,29 +101,21 @@ void Foam::energyJumpFvPatchScalarField::updateCoeffs() if (this->cyclicPatch().owner()) { - const basicThermo& thermo = db().lookupObject - ( - "thermophysicalProperties" - ); + const basicThermo& thermo = + db().lookupObject("thermophysicalProperties"); label patchID = patch().index(); const scalarField& pp = thermo.p().boundaryField()[patchID]; - const temperatureJumpFvPatchScalarField& TbPatch = - refCast + const fixedJumpFvPatchScalarField& TbPatch = + refCast ( 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::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 aae2d9597b..833072ad07 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 99be42e3d6..9f596c3cde 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& iF ) : - fixedJumpFvPatchField(p, iF), - jumpTable_(0) + fixedJumpAMIFvPatchField(p, iF) {} -Foam::temperatureJumpFvPatchScalarField::temperatureJumpFvPatchScalarField +Foam::energyJumpAMIFvPatchScalarField::energyJumpAMIFvPatchScalarField ( - const temperatureJumpFvPatchScalarField& ptf, + const energyJumpAMIFvPatchScalarField& ptf, const fvPatch& p, const DimensionedField& iF, const fvPatchFieldMapper& mapper ) : - fixedJumpFvPatchField(ptf, p, iF, mapper), - jumpTable_(ptf.jumpTable_().clone().ptr()) + fixedJumpAMIFvPatchField(ptf, p, iF, mapper) {} -Foam::temperatureJumpFvPatchScalarField::temperatureJumpFvPatchScalarField +Foam::energyJumpAMIFvPatchScalarField::energyJumpAMIFvPatchScalarField ( const fvPatch& p, const DimensionedField& iF, const dictionary& dict ) : - fixedJumpFvPatchField(p, iF), - jumpTable_(new DataEntry("jumpTable")) + fixedJumpAMIFvPatchField(p, iF) { - - if (this->cyclicPatch().owner()) - { - jumpTable_ = DataEntry::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(ptf), - jumpTable_(ptf.jumpTable_().clone().ptr()) + fixedJumpAMIFvPatchField(ptf) {} -Foam::temperatureJumpFvPatchScalarField::temperatureJumpFvPatchScalarField +Foam::energyJumpAMIFvPatchScalarField::energyJumpAMIFvPatchScalarField ( - const temperatureJumpFvPatchScalarField& ptf, + const energyJumpAMIFvPatchScalarField& ptf, const DimensionedField& iF ) : - fixedJumpFvPatchField(ptf, iF), - jumpTable_(ptf.jumpTable_().clone().ptr()) + fixedJumpAMIFvPatchField(ptf, iF) {} // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -void Foam::temperatureJumpFvPatchScalarField::write(Ostream& os) const +void Foam::energyJumpAMIFvPatchScalarField::updateCoeffs() { - fixedJumpFvPatchField::write(os); - if (this->cyclicPatch().owner()) + if (this->updated()) { - jumpTable_->writeData(os); + return; } + + if (this->cyclicAMIPatch().owner()) + { + const basicThermo& thermo = + db().lookupObject("thermophysicalProperties"); + + label patchID = patch().index(); + + const scalarField& pp = thermo.p().boundaryField()[patchID]; + const fixedJumpAMIFvPatchScalarField& TbPatch = + refCast + ( + thermo.T().boundaryField()[patchID] + ); + + const labelUList& faceCells = this->patch().faceCells(); + + jump_ = thermo.he(pp, TbPatch.jump(), faceCells); + } + + fixedJumpAMIFvPatchField::updateCoeffs(); +} + + +void Foam::energyJumpAMIFvPatchScalarField::write(Ostream& os) const +{ + fixedJumpAMIFvPatchField::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 0000000000..e000c6b200 --- /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 . + +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 +{ + +public: + + //- Runtime type information + TypeName("energyJumpAMI"); + + // Constructors + + //- Construct from patch and internal field + energyJumpAMIFvPatchScalarField + ( + const fvPatch&, + const DimensionedField& + ); + + //- Construct from patch, internal field and dictionary + energyJumpAMIFvPatchScalarField + ( + const fvPatch&, + const DimensionedField&, + const dictionary& + ); + + //- Construct by mapping given energyJumpAMIFvPatchScalarField onto a + // new patch + energyJumpAMIFvPatchScalarField + ( + const energyJumpAMIFvPatchScalarField&, + const fvPatch&, + const DimensionedField&, + const fvPatchFieldMapper& + ); + + //- Construct as copy + energyJumpAMIFvPatchScalarField + ( + const energyJumpAMIFvPatchScalarField& + ); + + //- Construct and return a clone + virtual tmp > clone() const + { + return tmp > + ( + new energyJumpAMIFvPatchScalarField(*this) + ); + } + + //- Construct as copy setting internal field reference + energyJumpAMIFvPatchScalarField + ( + const energyJumpAMIFvPatchScalarField&, + const DimensionedField& + ); + + //- Construct and return a clone setting internal field reference + virtual tmp > clone + ( + const DimensionedField& iF + ) const + { + return tmp > + ( + 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 4cace54980..f3902a033d 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::heBoundaryTypes() { hbt[patchi] = mixedEnergyFvPatchScalarField::typeName; } - else if (isA(tbf[patchi])) + else if (isA(tbf[patchi])) { hbt[patchi] = energyJumpFvPatchScalarField::typeName; } + else if (isA(tbf[patchi])) + { + hbt[patchi] = energyJumpAMIFvPatchScalarField::typeName; + } } return hbt; diff --git a/src/thermophysicalModels/reactionThermo/Make/options b/src/thermophysicalModels/reactionThermo/Make/options index 9dad3910dd..8c18cf8318 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 21d4983a93..5088aaff7b 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 937900177c..3d13f36b4f 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 6142b9557c..7ff431e35f 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 - # ----------------------------------------------------------------- end-of-file diff --git a/tutorials/heatTransfer/buoyantSimpleFoam/buoyantCavity/validation/createGraphs b/tutorials/heatTransfer/buoyantSimpleFoam/buoyantCavity/validation/createGraphs index 2d9ceeb49a..4baed11dac 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 6de4b18840..ed131900d3 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 937900177c..8cb3ae622e 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 3aa63c00d9..f038377853 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 edcd0dadfe..937765f7cb 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 16a8bb50ed..e69dbaddef 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 84758693b8..2374d2fb6c 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 fd85f49a95..656b92f3ad 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 061be5a02e..b7428e064f 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 fcd5c5d3f1..93c4de650d 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 7f40e5d032..e049d42c4b 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 520d52950f..a1c0e1162f 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 29758935af..32c7e6f948 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