diff --git a/applications/utilities/parallelProcessing/redistributePar/redistributePar.C b/applications/utilities/parallelProcessing/redistributePar/redistributePar.C index e3638fd150..fb09b40bd3 100644 --- a/applications/utilities/parallelProcessing/redistributePar/redistributePar.C +++ b/applications/utilities/parallelProcessing/redistributePar/redistributePar.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -458,6 +458,8 @@ int main(int argc, char *argv[]) regIOobject::fileModificationChecking = regIOobject::timeStamp; # include "createTime.H" + runTime.functionObjects().off(); + word regionName = polyMesh::defaultRegion; fileName meshSubDir; diff --git a/applications/utilities/preProcessing/createZeroDirectory/Make/files b/applications/utilities/preProcessing/createZeroDirectory/Make/files new file mode 100644 index 0000000000..379802af21 --- /dev/null +++ b/applications/utilities/preProcessing/createZeroDirectory/Make/files @@ -0,0 +1,7 @@ +boundaryInfo.C +boundaryTemplates.C +caseInfo.C +solverTemplate.C +createZeroDirectory.C + +EXE = $(FOAM_APPBIN)/createZeroDirectory diff --git a/applications/utilities/preProcessing/createZeroDirectory/Make/options b/applications/utilities/preProcessing/createZeroDirectory/Make/options new file mode 100644 index 0000000000..e3f71c9a41 --- /dev/null +++ b/applications/utilities/preProcessing/createZeroDirectory/Make/options @@ -0,0 +1,12 @@ +EXE_INC = \ + -DFULLDEBUG -g -O0 \ + -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/dynamicMesh/lnInclude \ + -I$(LIB_SRC)/meshTools/lnInclude \ + -I$(LIB_SRC)/regionModels/regionModel/lnInclude + +EXE_LIBS = \ + -lfiniteVolume \ + -ldynamicMesh \ + -lmeshTools \ + -lregionModels diff --git a/applications/utilities/preProcessing/createZeroDirectory/boundaryInfo.C b/applications/utilities/preProcessing/createZeroDirectory/boundaryInfo.C new file mode 100644 index 0000000000..ced18bce1d --- /dev/null +++ b/applications/utilities/preProcessing/createZeroDirectory/boundaryInfo.C @@ -0,0 +1,126 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2014 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 "boundaryInfo.H" +#include "Time.H" +#include "IOPtrList.H" +#include "polyMesh.H" + +using namespace Foam; + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineTemplateTypeNameAndDebug(IOPtrList, 0); +} + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +Foam::boundaryInfo::boundaryInfo(const Time& runTime, const word& regionName) +: + names_(), + types_(), + constraint_(), + groups_(), + allGroupNames_() +{ + // read the mesh boundaries for the current region + Info<< " Reading mesh boundaries" << endl; + + const_cast(IOPtrList::typeName) = word::null; + IOPtrList boundaryPatchList + ( + IOobject + ( + "boundary", + runTime.constant(), + regionName/polyMesh::meshSubDir, + runTime, + IOobject::READ_IF_PRESENT, + IOobject::NO_WRITE, + false + ) + ); + + names_.setSize(boundaryPatchList.size()); + types_.setSize(boundaryPatchList.size()); + constraint_.setSize(boundaryPatchList.size(), false); + groups_.setSize(boundaryPatchList.size()); + + + forAll(boundaryPatchList, patchI) + { + const dictionary& dict = boundaryPatchList[patchI].dict(); + + names_[patchI] = dict.dictName(); + dict.lookup("type") >> types_[patchI]; + if (polyPatch::constraintType(types_[patchI])) + { + constraint_[patchI] = true; + } + + if (dict.found("inGroups")) + { + dict.lookup("inGroups") >> groups_[patchI]; + allGroupNames_.insert(groups_[patchI]); + } + } +} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +const Foam::wordList& Foam::boundaryInfo::names() const +{ + return names_; +} + + +const Foam::wordList& Foam::boundaryInfo::types() const +{ + return types_; +} + + +const Foam::boolList& Foam::boundaryInfo::constraint() const +{ + return constraint_; +} + + +const Foam::List& Foam::boundaryInfo::groups() const +{ + return groups_; +} + + +const Foam::wordHashSet& Foam::boundaryInfo::allGroupNames() const +{ + return allGroupNames_; +} + + +// ************************************************************************* // diff --git a/applications/utilities/preProcessing/createZeroDirectory/boundaryInfo.H b/applications/utilities/preProcessing/createZeroDirectory/boundaryInfo.H new file mode 100644 index 0000000000..eba0761d86 --- /dev/null +++ b/applications/utilities/preProcessing/createZeroDirectory/boundaryInfo.H @@ -0,0 +1,103 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2014 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::boundaryInfo + +Description + Class to interrogate the polyMesh/boundary file to provide mesh patching + information, without the need to read the mesh. + +\*---------------------------------------------------------------------------*/ + +#ifndef boundaryInfo_H +#define boundaryInfo_H + +#include "boolList.H" +#include "wordList.H" +#include "HashSet.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +class Time; + +/*---------------------------------------------------------------------------*\ + Class boundaryInfo Declaration +\*---------------------------------------------------------------------------*/ + +class boundaryInfo +{ + // Private data + + //- Patch names + wordList names_; + + //- Patch types + wordList types_; + + //- Constraint flag + boolList constraint_; + + //- Groups per patch + List groups_; + + //- Set of all group names + wordHashSet allGroupNames_; + + +public: + + //- Constructor + boundaryInfo(const Time& runTime, const word& regionName); + + + // Public member functions + + //- Patch names + const wordList& names() const; + + //- Patch types + const wordList& types() const; + + //- Constraint flag + const boolList& constraint() const; + + //- Groups + const List& groups() const; + + //- Set of all group names + const wordHashSet& allGroupNames() const; +}; + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/utilities/preProcessing/createZeroDirectory/boundaryTemplates.C b/applications/utilities/preProcessing/createZeroDirectory/boundaryTemplates.C new file mode 100644 index 0000000000..1c894d02a6 --- /dev/null +++ b/applications/utilities/preProcessing/createZeroDirectory/boundaryTemplates.C @@ -0,0 +1,463 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2014 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 "boundaryTemplates.H" +#include "Time.H" +#include "IFstream.H" +#include "OStringStream.H" + +using namespace Foam; + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::boundaryTemplates::boundaryTemplates +( + const fileName& baseDir, + const Time& runTime, + const word& solverType +) +: + templates_(dictionary::null), + options_(dictionary::null) +{ + Info<< " Reading boundary templates" << endl; + + fileName BCDir(baseDir/"boundaryConditions"); + + IOdictionary regionBCs + ( + IOobject + ( + fileName(BCDir/"boundaries"), + runTime, + IOobject::MUST_READ + ) + ); + + forAllConstIter(dictionary, regionBCs, iter) + { + const word& regionType = iter().keyword(); + wordList patchTypes(regionBCs.lookup(regionType)); + + dictionary regionTemplate = dictionary::null; + dictionary regionOptions = dictionary::null; + + // read general boundary types + forAll(patchTypes, i) + { + IOdictionary dict + ( + IOobject + ( + fileName(BCDir/regionType/patchTypes[i]), + runTime, + IOobject::MUST_READ + ) + ); + + regionTemplate.add(patchTypes[i], dictionary(dict)); + } + + // add solver type boundary types + forAll(patchTypes, i) + { + IOobject io + ( + fileName(BCDir/regionType/solverType/patchTypes[i]), + runTime, + IOobject::MUST_READ + ); + + if (io.headerOk()) + { + IOdictionary dict(io); + regionTemplate.subDict(patchTypes[i]).merge(dict); + } + } + + // read general boundary options + forAll(patchTypes, i) + { + IOobject io + ( + fileName(BCDir/regionType/patchTypes[i] + "Options"), + runTime, + IOobject::MUST_READ + ); + + if (io.headerOk()) + { + IOdictionary dict(io); + regionOptions.add(patchTypes[i], dictionary(dict)); + } + } + + // add solver type boundary options + forAll(patchTypes, i) + { + IOobject io + ( + fileName(BCDir/regionType/solverType/patchTypes[i] + "Options"), + runTime, + IOobject::MUST_READ + ); + + if (io.headerOk()) + { + IOdictionary dict(io); + regionOptions.subDict(patchTypes[i]).merge(dict); + } + } + + templates_.add(regionType, regionTemplate); + options_.add(regionType, regionOptions); + } +} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +const Foam::dictionary& Foam::boundaryTemplates::templates() const +{ + return templates_; +} + + +Foam::dictionary Foam::boundaryTemplates::generatePatchDict +( + const word& regionPrefix, + const word& fieldName, + const word& condition, + const word& category, + const word& patchType, + const dictionary& conditionOptions +) const +{ + const dictionary& regionTemplates = templates_.subDict(regionPrefix); + + // look for inlet, outlet, wall etc + if (regionTemplates.found(category)) + { + const dictionary& categoryDict(regionTemplates.subDict(category)); + + // look for subSonic, slip etc + if (categoryDict.found(patchType)) + { + dictionary patchDict = categoryDict.subDict(patchType); + + // add any options + if (patchDict.found("OPTIONS")) + { + const dictionary& regionOptions = + options_.subDict(regionPrefix); + + if (!regionOptions.found(category)) + { + FatalError<< "No options available for category " + << category << exit(FatalError); + } + + const dictionary& dict = regionOptions.subDict(category); + + const wordList requiredOptions(patchDict.lookup("OPTIONS")); + + forAll(requiredOptions, i) + { + const word& option = requiredOptions[i]; + + word selected; + if (!conditionOptions.readIfPresent(option, selected)) + { + FatalErrorIn + ( + "Foam::dictionary " + "Foam::boundaryTemplates::generatePatchDict" + "(" + "const word&, " + "const word&, " + "const word&, " + "const word&, " + "const word&, " + "const dictionary&" + ") const" + ) + << "Condition " << condition << ": " + << "No option '" << option + << "' available for category '" << category + << "' and patch type '" << patchType + << "'. Valid options are: " + << conditionOptions.toc() + << exit(FatalError); + } + + if (!dict.found(option)) + { + FatalErrorIn + ( + "Foam::dictionary " + "Foam::boundaryTemplates::generatePatchDict" + "(" + "const word&, " + "const word&, " + "const word&, " + "const word&, " + "const word&, " + "const dictionary&" + ") const" + ) + << "Condition " << condition << ": " + << "No option '" << option + << "' available for category '" << category + << "' and patch type '" << patchType + << "'. Valid options are " << dict.toc() + << exit(FatalError); + } + + const dictionary& optionDict = dict.subDict(option); + + if (!optionDict.found(selected)) + { + FatalErrorIn + ( + "Foam::dictionary " + "Foam::boundaryTemplates::generatePatchDict" + "(" + "const word&, " + "const word&, " + "const word&, " + "const word&, " + "const word&, " + "const dictionary&" + ") const" + ) + << "Condition " << condition << ": " + << "No option '" << selected + << "' available for category '" << category + << "' and patch type '" << patchType + << "'. Valid options are " << optionDict.toc() + << exit(FatalError); + } + + const dictionary& dict = optionDict.subDict(selected); + + patchDict.merge(dict); + } + } + + // look for field name + if (patchDict.found(fieldName)) + { + dictionary dict(dictionary::null); + const dictionary& fieldDict(patchDict.subDict(fieldName)); + + forAllConstIter(IDLList, fieldDict, iter) + { + OStringStream oss; + oss << iter(); + string s(oss.str()); + s.replace(iter().keyword(), ""); + s.replace + ( + "VALUE", + "boundaryConditions." + condition + ".values" + ); + dict.add(iter().keyword(), s.c_str()); + } + + return dict; + } + else + { + FatalErrorIn + ( + "Foam::dictionary " + "Foam::boundaryTemplates::generatePatchDict" + "(" + "const word&, " + "const word&, " + "const word&, " + "const word&, " + "const word&, " + "const dictionary&" + ") const" + ) + << "Condition " << condition << ": " + << "No '" << patchType + << "' condition found for field '" << fieldName + << "' in category type '" << category << "'" + << exit(FatalError); + } + } + else + { + FatalErrorIn + ( + "Foam::dictionary " + "Foam::boundaryTemplates::generatePatchDict" + "(" + "const word&, " + "const word&, " + "const word&, " + "const word&, " + "const word&, " + "const dictionary&" + ") const" + ) + << "Condition " << condition << ": " + << "No '" << patchType << "' boundary types defined in " + << categoryDict.dictName() << " templates. " + << "Available types are: " << categoryDict.toc() + << exit(FatalError); + } + } + else + { + FatalErrorIn + ( + "Foam::dictionary " + "Foam::boundaryTemplates::generatePatchDict" + "(" + "const word&, " + "const word&, " + "const word&, " + "const word&, " + "const word&, " + "const dictionary&" + ") const" + ) + << "Condition " << condition << ": " + << "Invalid boundary condition type '" << patchType + << "'. Valid types are:" << regionTemplates.toc() + << exit(FatalError); + } + + return dictionary::null; +} + + +void Foam::boundaryTemplates::checkPatch +( + const word& regionPrefix, + const word& condition, + const word& category, + const word& patchType +) const +{ + const dictionary& regionTemplates = templates_.subDict(regionPrefix); + + if (!regionTemplates.found(category)) + { + FatalErrorIn + ( + "void Foam::boundaryTemplates::checkPatch" + "(" + "const word&, " + "const word&" + ") const" + ) + << "Condition " << condition << ": " + << "Unknown category '" << category + << "'. Valid categories are: " << regionTemplates.toc() + << exit(FatalError); + } + + const dictionary& categoryDict = regionTemplates.subDict(category); + + if (!categoryDict.found(patchType)) + { + FatalErrorIn + ( + "void Foam::boundaryTemplates::checkPatch" + "(" + "const word&, " + "const word&" + ") const" + ) + << "Condition " << condition << ": " + << "Unknown type '" << patchType << "' in category '" + << category << "'. Valid types are: " << categoryDict.toc() + << exit(FatalError); + } +} + + +bool Foam::boundaryTemplates::optionsRequired +( + const word& regionPrefix, + const word& category, + const word& patchType +) const +{ + const dictionary& regionTemplates = templates_.subDict(regionPrefix); + + if (regionTemplates.found(category)) + { + const dictionary& categoryDict(regionTemplates.subDict(category)); + + if (categoryDict.found(patchType)) + { + const dictionary& patchDict = categoryDict.subDict(patchType); + + if (patchDict.found("OPTIONS")) + { + return true; + } + } + else + { + FatalErrorIn + ( + "bool Foam::boundaryTemplates::optionsRequired" + "(" + "const word&, " + "const word&" + ") const" + ) + << "No type '" << patchType << "' found in category '" + << category << "'. Valid types are " + << categoryDict.toc() + << exit(FatalError); + } + } + else + { + FatalErrorIn + ( + "bool Foam::boundaryTemplates::optionsRequired" + "(" + "const word&, " + "const word&" + ") const" + ) + << "No category '" << category << "' found in templates. " + << "Valid categories are " << templates_.toc() + << exit(FatalError); + } + + return false; +} + + +// ************************************************************************* // diff --git a/applications/utilities/preProcessing/createZeroDirectory/boundaryTemplates.H b/applications/utilities/preProcessing/createZeroDirectory/boundaryTemplates.H new file mode 100644 index 0000000000..8ab0e33503 --- /dev/null +++ b/applications/utilities/preProcessing/createZeroDirectory/boundaryTemplates.H @@ -0,0 +1,118 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2014 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::boundaryTemplates + +Description + Class to store boundary template specifications + + Templates are typically stored centrally, and constructed in a hierarchical + manner. The main use is to convert the (user) specified conditions into + a form which can be inserted into each field file as dictionary entries. + +\*---------------------------------------------------------------------------*/ + +#ifndef boundaryTemplates_H +#define boundaryTemplates_H + +#include "dictionary.H" +#include "wordList.H" +#include "wordReList.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +class Time; + +/*---------------------------------------------------------------------------*\ + Class boundaryTemplates Declaration +\*---------------------------------------------------------------------------*/ + +class boundaryTemplates +{ + // Private data + + //- Dictionary of boundary templates + dictionary templates_; + + //- Dictionary of boundary template options + dictionary options_; + + +public: + + //- Constructor + boundaryTemplates + ( + const fileName& baseDir, + const Time& runTime, + const word& solverType + ); + + + // Public member functions + + //- Return the dictionary of boundary templates + const dictionary& templates() const; + + //- Generate a dictionary representation of patch boundary condition + dictionary generatePatchDict + ( + const word& regionPrefix, + const word& fieldName, + const word& condition, + const word& category, + const word& patchType, + const dictionary& conditionOptions + ) const; + + //- Check that user supplied patch info is valid + void checkPatch + ( + const word& regionPrefix, + const word& condition, + const word& category, + const word& patchType + ) const; + + //- Return true if condition requires additional user options + bool optionsRequired + ( + const word& regionPrefix, + const word& category, + const word& patchType + ) const; +}; + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/utilities/preProcessing/createZeroDirectory/caseInfo.C b/applications/utilities/preProcessing/createZeroDirectory/caseInfo.C new file mode 100644 index 0000000000..579c2889f0 --- /dev/null +++ b/applications/utilities/preProcessing/createZeroDirectory/caseInfo.C @@ -0,0 +1,261 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2014 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 "caseInfo.H" +#include "Time.H" +#include "boundaryInfo.H" +#include "boundaryTemplates.H" + +using namespace Foam; + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +Foam::label Foam::caseInfo::findPatchConditionID +( + const label patchI, + const word& patchName +) const +{ + // 1. explicit patch names + forAll(patchNames_, i) + { + const wordReList& p = patchNames_[i]; + forAll(p, j) + { + if (!p[j].isPattern() && p[j] == patchName) + { + return i; + } + } + } + + // 2. patch groups using non-wildcard entries + const wordList& patchGroups = boundaryInfo_.groups()[patchI]; + forAll(patchNames_, i) + { + const wordReList& p = patchNames_[i]; + forAll(p, j) + { + if (!p[j].isPattern()) + { + forAll(patchGroups, groupI) + { + if (p[j] == patchGroups[groupI]) + { + return i; + } + } + } + } + } + + // 3. wildcard overrides + forAll(patchNames_, i) + { + const wordReList& p = patchNames_[i]; + forAll(p, j) + { + if (p[j].match(patchName)) + { + return i; + } + } + } + + FatalErrorIn + ( + "Foam::label Foam::caseInfo::findPatchConditionID" + "(" + "const label, " + "const word&" + ") const" + ) + << "Boundary patch " << patchName << " not defined" + << exit(FatalError); + + return -1; +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::caseInfo::caseInfo(const Time& runTime, const word& regionName) +: + properties_ + ( + IOobject + ( + "caseProperties", + runTime.system(), + regionName, + runTime, + IOobject::MUST_READ, + IOobject::NO_WRITE + ) + ), + boundaryInfo_(runTime, regionName), + bcDict_(properties_.subDict("boundaryConditions")), + conditionNames_(bcDict_.toc()), + patchNames_(conditionNames_.size()), + patchCategories_(conditionNames_.size()), + patchTypes_(conditionNames_.size()) +{ + // read the (user-supplied) boundary condition information + Info<< " Reading case properties" << endl; + + forAll(conditionNames_, i) + { + const dictionary& dict = bcDict_.subDict(conditionNames_[i]); + dict.lookup("category") >> patchCategories_[i]; + dict.lookup("type") >> patchTypes_[i]; + dict.lookup("patches") >> patchNames_[i]; + } +} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::caseInfo::checkPatches +( + const word& regionPrefix, + const boundaryTemplates& bcTemplates +) const +{ + // check that all conditions have been specified correctly wrt templates + forAll(conditionNames_, i) + { + bcTemplates.checkPatch + ( + regionPrefix, + conditionNames_[i], + patchCategories_[i], + patchTypes_[i] + ); + } +} + + +const Foam::List& Foam::caseInfo::patchNames() const +{ + return patchNames_; +} + + +const Foam::word& Foam::caseInfo::conditionName(const label patchI) const +{ + return conditionNames_[patchI]; +} + + +const Foam::word& Foam::caseInfo::patchCategory(const label patchI) const +{ + return patchCategories_[patchI]; +} + + +const Foam::word& Foam::caseInfo::patchType(const label patchI) const +{ + return patchTypes_[patchI]; +} + + +Foam::dictionary Foam::caseInfo::generateBoundaryField +( + const word& regionPrefix, + const word& fieldName, + const boundaryTemplates& bcTemplates +) const +{ + dictionary boundaryField = dictionary::null; + + forAll(boundaryInfo_.names(), j) + { + const word& patchName = boundaryInfo_.names()[j]; + + if (boundaryInfo_.constraint()[j]) + { + dictionary patchDict = dictionary::null; + patchDict.add("type", boundaryInfo_.types()[j]); + + // add value for processor patches + patchDict.add("value", "${:internalField}"); + boundaryField.add(patchName.c_str(), patchDict); + } + else + { + // condition ID to apply to mesh boundary boundaryPatchName + const label conditionI = findPatchConditionID(j, patchName); + + if (conditionI == -1) + { + FatalErrorIn + ( + "Foam::dictionary Foam::caseInfo::generateBoundaryField" + "(" + "const word&, " + "const word&, " + "const boundaryTemplates&" + ") const" + ) + << "Unable to find patch " << patchName + << " in list of boundary conditions" + << exit(FatalError); + } + + const word& condition = conditionNames_[conditionI]; + + const word& category = patchCategories_[conditionI]; + + const word& patchType = patchTypes_[conditionI]; + + dictionary optionDict = dictionary::null; + if (bcTemplates.optionsRequired(regionPrefix, category, patchType)) + { + optionDict = bcDict_.subDict(condition).subDict("options"); + } + + // create the patch dictionary entry + dictionary patchDict + ( + bcTemplates.generatePatchDict + ( + regionPrefix, + fieldName, + condition, + category, + patchType, + optionDict + ) + ); + + boundaryField.add(patchName.c_str(), patchDict); + } + } + + return boundaryField; +} + + +// ************************************************************************* // diff --git a/applications/utilities/preProcessing/createZeroDirectory/caseInfo.H b/applications/utilities/preProcessing/createZeroDirectory/caseInfo.H new file mode 100644 index 0000000000..bf335530ea --- /dev/null +++ b/applications/utilities/preProcessing/createZeroDirectory/caseInfo.H @@ -0,0 +1,135 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2014 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::caseInfo + +Description + Class to hold information related to the simaulation case. + +\*---------------------------------------------------------------------------*/ + +#ifndef caseInfo_H +#define caseInfo_H + +#include "boolList.H" +#include "labelList.H" +#include "wordList.H" +#include "HashSet.H" +#include "wordReList.H" +#include "IOdictionary.H" +#include "boundaryInfo.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +class Time; +class boundaryTemplates; + +/*---------------------------------------------------------------------------*\ + Class caseInfo Declaration +\*---------------------------------------------------------------------------*/ + +class caseInfo +{ + // Private data + + //- Properties dictionary + IOdictionary properties_; + + //- Mesh boundary information (read from mesh boundary file) + boundaryInfo boundaryInfo_; + + //- Boundary conditions dictionary + const dictionary& bcDict_; + + //- List of condition names + wordList conditionNames_; + + + // Per-condition information + + //- List of patch names + List patchNames_; + + //- Patch category + wordList patchCategories_; + + //- Patch type + wordList patchTypes_; + + +public: + + //- Constructor + caseInfo(const Time& runTime, const word& regionName); + + + // Public member functions + + //- Check patches + void checkPatches + ( + const word& regionPrefix, + const boundaryTemplates& bcTemplates + ) const; + + //- Return the list of patch names + const List& patchNames() const; + + //- Return the condition name for patch with index patchI + const word& conditionName(const label patchI) const; + + //- Return the category name for patch with index patchI + const word& patchCategory(const label patchI) const; + + //- Return the type name for patch with index patchI + const word& patchType(const label patchI) const; + + //- Return the condition ID for a boundary patch + label findPatchConditionID + ( + const label patchI, + const word& patchName + ) const; + + //- Generate boundary field (dictionary) + dictionary generateBoundaryField + ( + const word& regionPrefix, + const word& fieldName, + const boundaryTemplates& bcTemplates + ) const; +}; + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/utilities/preProcessing/createZeroDirectory/createZeroDirectory.C b/applications/utilities/preProcessing/createZeroDirectory/createZeroDirectory.C new file mode 100644 index 0000000000..8b63c69573 --- /dev/null +++ b/applications/utilities/preProcessing/createZeroDirectory/createZeroDirectory.C @@ -0,0 +1,274 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2014 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 . + +Application + createZeroDirectory + +Description + Creates a zero directory with fields appropriate for the chosen solver and + turbulence model. Operates on both single and multi-region cases. + +Usage + The set-up is configured using a 'caseProperties' dictionary, located under + the $FOAM_CASE/system (or system/regionName if multi-region) directory. + This consists of a lists of initial and boundary conditions, e.g. + + \beginverbatim + initialConditions + { + U uniform (0 0 0); + p uniform 0; + } + + boundaryConditions + { + topWall + { + category wall; + patches (movingWall); + type noSlip; + options + { + wallFunction highReynolds; + motion moving; + }; + values + { + U uniform (1 0 0); + } + } + + walls + { + category wall; + patches (fixedWalls); + type noSlip; + options + { + wallFunction highReynolds; + motion stationary; + }; + } + } + \endverbatim + +\*---------------------------------------------------------------------------*/ + +#include "argList.H" +#include "volFields.H" +#include "IOdictionary.H" +#include "boundaryInfo.H" +#include "caseInfo.H" +#include "boundaryTemplates.H" +#include "solverTemplate.H" + +using namespace Foam; + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +const word getClassType(const word& pType) +{ + if (pType == pTraits::typeName) + { + return GeometricField::typeName; + } + else if (pType == pTraits::typeName) + { + return GeometricField::typeName; + } + else if (pType == pTraits::typeName) + { + return GeometricField::typeName; + } + else if (pType == pTraits::typeName) + { + return GeometricField::typeName; + } + else if (pType == pTraits::typeName) + { + return GeometricField::typeName; + } + else + { + // error + return word::null; + } +} + + +void createFieldFiles +( + const Time& runTime, + const word& regionName, + const word& regionPrefix, + const wordList& fieldNames, + const wordList& fieldTypes, + const PtrList& fieldDimensions, + const caseInfo& cInfo, + const boundaryTemplates& bcTemplates +) +{ + Info<< " Generating field files" << nl << endl; + + // create files + mkDir(runTime.path()/"0"/regionName); + forAll(fieldNames, i) + { + const_cast(IOdictionary::typeName) = + getClassType(fieldTypes[i]); + + IOdictionary field + ( + IOobject + ( + fieldNames[i], + "0", + regionName, + runTime, + IOobject::NO_READ + ) + ); + + word regionPath = "/"; + + if (regionName != word::null) + { + regionPath += regionName + '/'; + } + + field.add + ( + "#include", + string + ( + "${FOAM_CASE}/system" + regionPath + "caseProperties" + ) + ); + + field.add("dimensions", fieldDimensions[i]); + + string iField("${:initialConditions." + fieldNames[i] + '}'); + field.add("internalField", iField.c_str()); + + dictionary boundaryField = + cInfo.generateBoundaryField + ( + regionPrefix, + fieldNames[i], + bcTemplates + ); + + field.add("boundaryField", boundaryField); + + field.regIOobject::writeObject + ( + IOstream::ASCII, + IOstream::currentVersion, + IOstream::UNCOMPRESSED + ); + } +} + + +// Main program: +int main(int argc, char *argv[]) +{ + // keep variable substitutions + entry::disableFunctionEntries = 1; + + #include "setRootCase.H" + #include "createTime.H" + + Info<< "Reading controlDict" << nl << endl; + + IOdictionary controlDict + ( + IOobject + ( + "controlDict", + runTime.system(), + runTime, + IOobject::MUST_READ, + IOobject::NO_WRITE + ) + ); + + fileName baseDir("${WM_PROJECT_USER_DIR}/etc/templates"); + baseDir.expand(); + + // read the solver + const word& solverName = controlDict.lookup("application"); + + // generate solver template + const solverTemplate solver(runTime, solverName); + + // read the boundary condition templates + const boundaryTemplates bcTemplates + ( + baseDir, + runTime, + solver.type() + ); + + Info<< endl; + + const label nRegion = solver.nRegion(); + for (label regionI = 0; regionI < nRegion; regionI++) + { + const word& regionName = solver.regionName(regionI); + + if (regionName == word::null) + { + Info<< "Region: " << polyMesh::defaultRegion << " (default)" + << endl; + } + else + { + Info<< "Region: " << regionName << endl; + } + + // read the case set-up info for the current region + const caseInfo cInfo(runTime, regionName); + + cInfo.checkPatches(solver.regionType(regionI), bcTemplates); + + createFieldFiles + ( + runTime, + regionName, + solver.regionType(regionI), + solver.fieldNames(regionI), + solver.fieldTypes(regionI), + solver.fieldDimensions(regionI), + cInfo, + bcTemplates + ); + } + + Info<< "End\n" << endl; + + return 0; +} + + +// ************************************************************************* // diff --git a/applications/utilities/preProcessing/createZeroDirectory/solverTemplate.C b/applications/utilities/preProcessing/createZeroDirectory/solverTemplate.C new file mode 100644 index 0000000000..f5a4e8328a --- /dev/null +++ b/applications/utilities/preProcessing/createZeroDirectory/solverTemplate.C @@ -0,0 +1,450 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2014 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 "solverTemplate.H" +#include "Time.H" +#include "IOPtrList.H" +#include "polyMesh.H" +#include "regionProperties.H" + +using namespace Foam; + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + template<> + const char* Foam::NamedEnum::names[] = + { + "compressible", + "incompressible", + "buoyant", + "unknown" + }; +} + +const Foam::NamedEnum + Foam::solverTemplate::solverTypeNames_; + + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +Foam::word Foam::solverTemplate::readFromDict +( + IOobject& dictHeader, + const word& entryName +) const +{ + if (!dictHeader.headerOk()) + { + FatalErrorIn + ( + "Foam::word Foam::solverTemplate::readFromDict" + "(" + "IOobject&, " + "const word&" + ") const" + ) + << "Unable to open file " + << dictHeader.objectPath() + << exit(FatalError); + } + + IOdictionary dict(dictHeader); + return dict.lookup(entryName); +} + + +Foam::dictionary Foam::solverTemplate::readFluidFieldTemplates +( + const word& regionName, + const fileName& baseDir, + const dictionary& solverDict, + const Time& runTime +) const +{ + Info<< " Reading fluid field templates"; + + if (regionName == word::null) + { + Info<< endl; + } + else + { + Info<< " for region " << regionName << endl; + } + + dictionary fieldTemplates = solverDict.subDict("fluidFields"); + + const fileName turbModelDir(baseDir/"models"/"turbulence"); + word turbulenceModel("laminar"); // default to laminar + + const dictionary fieldModels(solverDict.subDict("fluidModels")); + + word turbulenceType = "none"; + if (fieldModels.readIfPresent("turbulenceModel", turbulenceType)) + { + word simulationType(word::null); + + IOobject RASHeader + ( + "RASProperties", + runTime.constant(), + regionName, + runTime, + IOobject::MUST_READ, + IOobject::NO_WRITE + ); + + IOobject LESHeader + ( + "LESProperties", + runTime.constant(), + regionName, + runTime, + IOobject::MUST_READ, + IOobject::NO_WRITE + ); + + + if (turbulenceType == "turbulenceModel") + { + IOobject turbulencePropertiesHeader + ( + "turbulenceProperties", + runTime.constant(), + regionName, + runTime, + IOobject::MUST_READ, + IOobject::NO_WRITE + ); + + if (turbulencePropertiesHeader.headerOk()) + { + const IOdictionary turbulenceProperties + ( + turbulencePropertiesHeader + ); + + turbulenceProperties.lookup("simulationType") >> simulationType; + + if (simulationType == "RASModel") + { + turbulenceModel = readFromDict(RASHeader, "RASModel"); + } + else if (simulationType == "LESModel") + { + turbulenceModel = readFromDict(LESHeader, "LESModel"); + } + } + else + { + FatalError<< "Unable to open file " + << turbulencePropertiesHeader.objectPath() + << exit(FatalError); + } + } + else if (turbulenceType == "RASModel") + { + turbulenceModel = readFromDict(RASHeader, "RASModel"); + } + else if (turbulenceType == "LESModel") + { + turbulenceModel = readFromDict(LESHeader, "LESModel"); + } + else + { + FatalErrorIn + ( + "Foam::dictionary Foam::solverTemplate::readFluidFieldTemplates" + "(" + "const word&, " + "const fileName&, " + "const dictionary&, " + "const Time&" + ") const" + ) + << "Unhandled turbulence model option" + << abort(FatalError); + } + } + + IOdictionary turbModelDict + ( + IOobject + ( + fileName(turbModelDir/turbulenceModel), + runTime, + IOobject::MUST_READ + ) + ); + + switch (solverType_) + { + case stIncompressible: + { + fieldTemplates.merge(turbModelDict.subDict("incompressibleFields")); + break; + } + case stCompressible: + case stBuoyant: + { + fieldTemplates.merge(turbModelDict.subDict("compressibleFields")); + break; + } + default: + { + // do nothing + } + } + + return fieldTemplates; +} + + +Foam::dictionary Foam::solverTemplate::readSolidFieldTemplates +( + const word& regionName, + const dictionary& solverDict +) const +{ + Info<< " Reading solid field templates for region " << regionName + << endl; + + // nothing more to do for solids + return solverDict.subDict("solidFields"); +} + + +void Foam::solverTemplate::setRegionProperties +( + const dictionary& fieldDict, + const word& regionType, + const word& regionName, + const label regionI +) +{ + regionTypes_[regionI] = regionType, + regionNames_[regionI] = regionName, + fieldNames_[regionI] = fieldDict.toc(); + fieldTypes_[regionI].setSize(fieldNames_[regionI].size()); + fieldDimensions_[regionI].setSize(fieldNames_[regionI].size()); + + forAll(fieldNames_[regionI], i) + { + const word& fieldName = fieldNames_[regionI][i]; + const dictionary& dict = fieldDict.subDict(fieldName); + + dict.lookup("type") >> fieldTypes_[regionI][i]; + fieldDimensions_[regionI].set + ( + i, + new dimensionSet(dict.lookup("dimensions")) + ); + } +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::solverTemplate::solverTemplate +( + const Time& runTime, + const word& solverName +) +: + solverType_(stUnknown), + multiRegion_(false), + regionTypes_(), + fieldNames_(), + fieldTypes_(), + fieldDimensions_() +{ + fileName baseDir("${WM_PROJECT_USER_DIR}/etc/templates"); + baseDir.expand(); + + IOdictionary solverDict + ( + IOobject + ( + fileName(baseDir/"solvers"/solverName), + runTime, + IOobject::MUST_READ + ) + ); + + Info<< "Selecting " << solverName << ": "; + + solverType_ = solverTypeNames_.read(solverDict.lookup("solverType")); + Info<< solverTypeNames_[solverType_]; + + multiRegion_ = readBool(solverDict.lookup("multiRegion")); + if (multiRegion_) + { + Info<< ", multi-region"; + } + else + { + Info<< ", single-region"; + } + + Info<< " case" << endl; + + if (multiRegion_) + { + // read regionProperties + regionProperties rp(runTime); + + const wordList fluidNames(rp["fluid"]); + const wordList solidNames(rp["solid"]); + + const label nRegion = fluidNames.size() + solidNames.size(); + + regionTypes_.setSize(nRegion); + regionNames_.setSize(nRegion); + fieldNames_.setSize(nRegion); + fieldTypes_.setSize(nRegion); + fieldDimensions_.setSize(nRegion); + + // read templates for solver lists of avaliable + // - fields and dimensions required for the solver + // - models + label regionI = 0; + forAll(fluidNames, i) + { + const dictionary fieldDict + ( + readFluidFieldTemplates + ( + fluidNames[i], + baseDir, + solverDict, + runTime + ) + ); + + setRegionProperties(fieldDict, "fluid", fluidNames[i], regionI++); + } + + forAll(solidNames, i) + { + const dictionary fieldDict + ( + readSolidFieldTemplates + ( + solidNames[i], + solverDict + ) + ); + setRegionProperties(fieldDict, "solid", solidNames[i], regionI++); + } + } + else + { + regionTypes_.setSize(1); + regionNames_.setSize(1); + fieldNames_.setSize(1); + fieldTypes_.setSize(1); + fieldDimensions_.setSize(1); + + // read templates for solver lists of avaliable + // - fields and dimensions required for the solver + // - models + const dictionary fieldDict + ( + readFluidFieldTemplates + ( + word::null, // use region = null for single-region cases + baseDir, + solverDict, + runTime + ) + ); + + setRegionProperties(fieldDict, "fluid", word::null, 0); + } +} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::word Foam::solverTemplate::type() const +{ + return solverTypeNames_[solverType_]; +} + + +bool Foam::solverTemplate::multiRegion() const +{ + return multiRegion_; +} + + +label Foam::solverTemplate::nRegion() const +{ + return regionTypes_.size(); +} + + +const Foam::word& Foam::solverTemplate::regionType(const label regionI) const +{ + return regionTypes_[regionI]; +} + + +const Foam::word& Foam::solverTemplate::regionName(const label regionI) const +{ + return regionNames_[regionI]; +} + + +const Foam::wordList& Foam::solverTemplate::fieldNames +( + const label regionI +) const +{ + return fieldNames_[regionI]; +} + + +const Foam::wordList& Foam::solverTemplate::fieldTypes +( + const label regionI +) const +{ + return fieldTypes_[regionI]; +} + + +const Foam::PtrList& Foam::solverTemplate::fieldDimensions +( + const label regionI +) const +{ + return fieldDimensions_[regionI]; +} + + +// ************************************************************************* // diff --git a/applications/utilities/preProcessing/createZeroDirectory/solverTemplate.H b/applications/utilities/preProcessing/createZeroDirectory/solverTemplate.H new file mode 100644 index 0000000000..d78ac533a1 --- /dev/null +++ b/applications/utilities/preProcessing/createZeroDirectory/solverTemplate.H @@ -0,0 +1,182 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2014 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::solverTemplate + +Description + Class to store solver template specifications + +\*---------------------------------------------------------------------------*/ + +#ifndef solverTemplate_H +#define solverTemplate_H + +#include "boolList.H" +#include "wordList.H" +#include "dimensionSet.H" +#include "IOobject.H" +#include "NamedEnum.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +class Time; + +/*---------------------------------------------------------------------------*\ + Class solverTemplate Declaration +\*---------------------------------------------------------------------------*/ + +class solverTemplate +{ +public: + + // Public enumerations + + //- Solver type + enum solverType + { + stCompressible, + stIncompressible, + stBuoyant, + stUnknown + }; + + //- Solver type names + static const NamedEnum solverTypeNames_; + + +private: + + // Private data + + //- Solver type + solverType solverType_; + + //- Multi-region flag + bool multiRegion_; + + + // Per-region info + + //- Region types + wordList regionTypes_; + + //- Region names + wordList regionNames_; + + //- Field names + List fieldNames_; + + //- Field types + List fieldTypes_; + + //- Field dimensions + List > fieldDimensions_; + + + // Public member functions + + //- Read a word from a dictionary (offers some protection...) + word readFromDict + ( + IOobject& dictHeader, + const word& entryName + ) const; + + //- Read fluid region templates + dictionary readFluidFieldTemplates + ( + const word& regionName, + const fileName& baseDir, + const dictionary& solverDict, + const Time& runTime + ) const; + + //- Read solid region templates + dictionary readSolidFieldTemplates + ( + const word& regionName, + const dictionary& solverDict + ) const; + + //- Set the properties for region with index regionI + void setRegionProperties + ( + const dictionary& dict, + const word& regionType, + const word& regionName, + const label regionI + ); + + +public: + + //- Constructor + solverTemplate(const Time& runTime, const word& regionName); + + + // Public member functions + + //- Solver type name + word type() const; + + //- Return the multi-region flag + bool multiRegion() const; + + //- Return the number of regions + label nRegion() const; + + + // Per-region info + + //- Return the region type + const word& regionType(const label regionI) const; + + //- Return the region name + const word& regionName(const label regionI) const; + + //- Return the field names + const wordList& fieldNames(const label regionI) const; + + //- Return the field types + const wordList& fieldTypes(const label regionI) const; + + //- Return the field dimensions + const PtrList& fieldDimensions + ( + const label regionI + ) const; +}; + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/etc/templates/boundaryConditions/boundaries b/etc/templates/boundaryConditions/boundaries new file mode 100644 index 0000000000..3ae64b1767 --- /dev/null +++ b/etc/templates/boundaryConditions/boundaries @@ -0,0 +1,31 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 2.2.0 | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "templates"; + object boundaries; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +fluid +( + inlet + outlet + wall +); + +solid +( + wall +); + + +// ************************************************************************* // diff --git a/etc/templates/boundaryConditions/fluid/buoyant/inlet b/etc/templates/boundaryConditions/fluid/buoyant/inlet new file mode 100644 index 0000000000..e66a7700df --- /dev/null +++ b/etc/templates/boundaryConditions/fluid/buoyant/inlet @@ -0,0 +1,48 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 2.2.0 | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "templates"; + object inlet; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +subSonic +{ + p + { + type calculated; + value ${:VALUE.p}; + } + p_rgh + { + type fixedFluxPressure; + value ${:VALUE.p_rgh}; + } + T + { + type fixedValue; + value ${:VALUE.T}; + } + mut + { + type fixedValue; + value ${:VALUE.mut}; + } + alphat + { + type fixedValue; + value ${:VALUE.alphat}; + } +} + + +// ************************************************************************* // diff --git a/etc/templates/boundaryConditions/fluid/buoyant/inletOptions b/etc/templates/boundaryConditions/fluid/buoyant/inletOptions new file mode 100644 index 0000000000..16788e99ef --- /dev/null +++ b/etc/templates/boundaryConditions/fluid/buoyant/inletOptions @@ -0,0 +1,77 @@ +l/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 2.2.0 | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "templates"; + object inlet; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +flowSpecification +{ + fixedPressure + { + U + { + type pressureInletVelocity; + value ${:inlet.U}; + } + p + { + type calculated; + value ${:inlet.p}; + } + p_rgh + { + type fixedValue; + value ${:inlet.p_rgh}; + } + } + fixedVelocity + { + U + { + type fixedValue; + value ${:VALUE.U}; + } + p + { + type calculated; + value ${:inlet.p}; + } + p_rgh + { + type zeroGradient; + } + } + flowRate + { + U + { + type flowRateInletVelocity; + massFlowRate ${:VALUE.massFlowRate}; + value ${:VALUE.U}; + } + p + { + type calculated; + value ${:VALUE.p}; + } + p_rgh + { + type fixedFluxPressure; + value ${:VALUE.p_rgh}; + } + } +} + + +// ************************************************************************* // diff --git a/etc/templates/boundaryConditions/fluid/buoyant/outlet b/etc/templates/boundaryConditions/fluid/buoyant/outlet new file mode 100644 index 0000000000..8161894e00 --- /dev/null +++ b/etc/templates/boundaryConditions/fluid/buoyant/outlet @@ -0,0 +1,47 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 2.2.0 | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "templates"; + object outlet; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +subSonic +{ + T + { + type inletOutlet; + inletValue ${:VALUE.T}; + value ${:VALUE.T}; + } + p + { + type calculated; + value ${:VALUE.p}; + } + p_rgh + { + type fixedValue; + value ${:VALUE.p_rgh}; + } + mut + { + type zeroGradient; + } + alphat + { + type zeroGradient; + } +} + + +// ************************************************************************* // diff --git a/etc/templates/boundaryConditions/fluid/buoyant/wall b/etc/templates/boundaryConditions/fluid/buoyant/wall new file mode 100644 index 0000000000..5e51fbdc20 --- /dev/null +++ b/etc/templates/boundaryConditions/fluid/buoyant/wall @@ -0,0 +1,58 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 2.2.0 | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "templates"; + object wall; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +noSlip +{ + p + { + type calculated; + value ${:VALUE.p}; + } + p_rgh + { + type fixedFluxPressure; + value ${:VALUE.p_rgh}; + } + OPTIONS (wallFunction motion heatTransfer); +} + + +slip +{ + p + { + type calculated; + value ${:VALUE.p}; + } + p_rgh + { + type fixedFluxPressure; + value ${:VALUE.p_rgh}; + } + mut + { + type zeroGradient; + } + alphat + { + type zeroGradient; + } + OPTIONS (heatTransfer); +} + + +// ************************************************************************* // diff --git a/etc/templates/boundaryConditions/fluid/buoyant/wallOptions b/etc/templates/boundaryConditions/fluid/buoyant/wallOptions new file mode 100644 index 0000000000..51271ee513 --- /dev/null +++ b/etc/templates/boundaryConditions/fluid/buoyant/wallOptions @@ -0,0 +1,80 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 2.2.0 | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "templates"; + object wallOptions; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +wallFunction +{ + highReynolds + { + mut + { + type compressible::mutkWallFunction; + value ${:VALUE.mut}; + } + alphat + { + type compressible::alphatWallFunction; + value ${:VALUE.alphat}; + } + } + lowReynolds + { + mut + { + type fixedValue; + value uniform 0; + } + alphat + { + type fixedValue; + value uniform 0; + } + } +} + + +heatTransfer +{ + adiabatic + { + T + { + type zeroGradient; + } + } + fixedTemperature + { + T + { + type fixedValue; + value ${:VALUE.T}; + } + } + thermalCoupled + { + T + { + type compressible::turbulentTemperatureCoupledBaffleMixed; + value ${:VALUE.T}; + Tnbr T; + kappa fluidThermo; + kappaName none; + } + } +} + + +// ************************************************************************* // diff --git a/etc/templates/boundaryConditions/fluid/compressible/inlet b/etc/templates/boundaryConditions/fluid/compressible/inlet new file mode 100644 index 0000000000..e6c69f33d4 --- /dev/null +++ b/etc/templates/boundaryConditions/fluid/compressible/inlet @@ -0,0 +1,38 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 2.2.0 | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "templates"; + object inlet; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +subSonic +{ + T + { + type fixedValue; + value ${:VALUE.T}; + } + mut + { + type fixedValue; + value ${:VALUE.mut}; + } + alphat + { + type fixedValue; + value ${:VALUE.alphat}; + } +} + + +// ************************************************************************* // diff --git a/etc/templates/boundaryConditions/fluid/compressible/inletOptions b/etc/templates/boundaryConditions/fluid/compressible/inletOptions new file mode 100644 index 0000000000..1fe983b2a9 --- /dev/null +++ b/etc/templates/boundaryConditions/fluid/compressible/inletOptions @@ -0,0 +1,54 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 2.2.0 | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "templates"; + object inletOptions; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +flowSpecification +{ + fixedTotalPressure + { + U + { + type pressureInletVelocity; + value ${:inlet.U}; + } + p + { + type totalPressure; + U U; + phi phi; + rho rho; + psi none; + gamma 1; + p0 ${:inlet.p}; + value ${:inlet.p}; + } + } + flowRate + { + U + { + type flowRateInletVelocity; + massFlowRate ${:VALUE.massFlowRate}; + value ${:VALUE.U}; + } + p + { + type zeroGradient; + } + } +} + +// ************************************************************************* // diff --git a/etc/templates/boundaryConditions/fluid/compressible/outlet b/etc/templates/boundaryConditions/fluid/compressible/outlet new file mode 100644 index 0000000000..d5846132bd --- /dev/null +++ b/etc/templates/boundaryConditions/fluid/compressible/outlet @@ -0,0 +1,37 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 2.2.0 | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "templates"; + object outlet; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +subSonic +{ + T + { + type inletOutlet; + inletValue ${:VALUE.T}; + value ${:VALUE.T}; + } + mut + { + type zeroGradient; + } + alphat + { + type zeroGradient; + } +} + + +// ************************************************************************* // diff --git a/etc/templates/boundaryConditions/fluid/compressible/wall b/etc/templates/boundaryConditions/fluid/compressible/wall new file mode 100644 index 0000000000..aecd332903 --- /dev/null +++ b/etc/templates/boundaryConditions/fluid/compressible/wall @@ -0,0 +1,39 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 2.2.0 | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "templates"; + object wall; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +noSlip +{ + OPTIONS (wallFunction motion heatTransfer); +} + + +slip +{ + mut + { + type zeroGradient; + } + alphat + { + type zeroGradient; + } + + OPTIONS (heatTransfer); +} + + +// ************************************************************************* // diff --git a/etc/templates/boundaryConditions/fluid/compressible/wallOptions b/etc/templates/boundaryConditions/fluid/compressible/wallOptions new file mode 100644 index 0000000000..186c0ca1fe --- /dev/null +++ b/etc/templates/boundaryConditions/fluid/compressible/wallOptions @@ -0,0 +1,80 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 2.2.0 | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "templates"; + object wallOptions; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +wallFunction +{ + highReynolds + { + mut + { + type compressible::mutkWallFunction; + value ${:VALUE.nut}; + } + alphat + { + type compressible::alphatWallFunction; + value ${:VALUE.alphat}; + } + } + lowReynolds + { + mut + { + type fixedValue; + value uniform 0; + } + alphat + { + type fixedValue; + value uniform 0; + } + } +} + + +heatTransfer +{ + adiabatic + { + T + { + type zeroGradient; + } + } + fixedTemperature + { + T + { + type fixedValue; + value ${:VALUE.T}; + } + } + thermalCoupled + { + T + { + type compressible::turbulentTemperatureCoupledBaffleMixed; + value ${:VALUE.T}; + Tnbr T; + kappa fluidThermo; + kappaName none; + } + } +} + + +// ************************************************************************* // diff --git a/etc/templates/boundaryConditions/fluid/incompressible/inlet b/etc/templates/boundaryConditions/fluid/incompressible/inlet new file mode 100644 index 0000000000..e5b4828b1c --- /dev/null +++ b/etc/templates/boundaryConditions/fluid/incompressible/inlet @@ -0,0 +1,28 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 2.2.0 | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "templates"; + object inlet; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +subSonic +{ + nut + { + type fixedValue; + value ${:VALUE.nut}; + } +} + + +// ************************************************************************* // diff --git a/etc/templates/boundaryConditions/fluid/incompressible/inletOptions b/etc/templates/boundaryConditions/fluid/incompressible/inletOptions new file mode 100644 index 0000000000..18ea42d801 --- /dev/null +++ b/etc/templates/boundaryConditions/fluid/incompressible/inletOptions @@ -0,0 +1,54 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 2.2.0 | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "templates"; + object inletOptions; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +flowSpecification +{ + fixedTotalPressure + { + U + { + type pressureInletVelocity; + value ${:inlet.U}; + } + p + { + type totalPressure; + U U; + phi phi; + rho none; + psi none; + gamma 1; + p0 ${:inlet.p}; + value ${:inlet.p}; + } + } + flowRate + { + U + { + type flowRateInletVelocity; + volumeFlowRate ${:VALUE.volumeFlowRate}; + value ${:VALUE.U}; + } + p + { + type zeroGradient; + } + } +} + +// ************************************************************************* // diff --git a/etc/templates/boundaryConditions/fluid/incompressible/outlet b/etc/templates/boundaryConditions/fluid/incompressible/outlet new file mode 100644 index 0000000000..7634134645 --- /dev/null +++ b/etc/templates/boundaryConditions/fluid/incompressible/outlet @@ -0,0 +1,36 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 2.2.0 | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "templates"; + object outlet; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +subSonic +{ + nut + { + type zeroGradient; + } +} + + +subSonicNoReturn +{ + nut + { + type zeroGradient; + } +} + + +// ************************************************************************* // diff --git a/etc/templates/boundaryConditions/fluid/incompressible/wall b/etc/templates/boundaryConditions/fluid/incompressible/wall new file mode 100644 index 0000000000..1a0377ef38 --- /dev/null +++ b/etc/templates/boundaryConditions/fluid/incompressible/wall @@ -0,0 +1,27 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 2.2.0 | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "templates"; + object wall; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +slip +{ + nut + { + type zeroGradient; + } +} + + +// ************************************************************************* // diff --git a/etc/templates/boundaryConditions/fluid/incompressible/wallOptions b/etc/templates/boundaryConditions/fluid/incompressible/wallOptions new file mode 100644 index 0000000000..ffafd12b7e --- /dev/null +++ b/etc/templates/boundaryConditions/fluid/incompressible/wallOptions @@ -0,0 +1,39 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 2.2.0 | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "templates"; + object wallOptions; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +wallFunction +{ + highReynolds + { + nut + { + type nutkWallFunction; + value ${:VALUE.nut}; + } + } + lowReynolds + { + nut + { + type fixedValue; + value uniform 0; + } + } +} + + +// ************************************************************************* // diff --git a/etc/templates/boundaryConditions/fluid/inlet b/etc/templates/boundaryConditions/fluid/inlet new file mode 100644 index 0000000000..8dae7541f5 --- /dev/null +++ b/etc/templates/boundaryConditions/fluid/inlet @@ -0,0 +1,40 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 2.2.0 | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "templates"; + object inlet; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +subSonic +{ + k + { + type fixedValue; + value ${:VALUE.k}; + } + epsilon + { + type fixedValue; + value ${:VALUE.epsilon}; + } + omega + { + type fixedValue; + value ${:VALUE.omega}; + } + + OPTIONS (flowSpecification); +} + + +// ************************************************************************* // diff --git a/etc/templates/boundaryConditions/fluid/inletOptions b/etc/templates/boundaryConditions/fluid/inletOptions new file mode 100644 index 0000000000..89230ca19a --- /dev/null +++ b/etc/templates/boundaryConditions/fluid/inletOptions @@ -0,0 +1,47 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 2.2.0 | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "templates"; + object inletOptions; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +flowSpecification +{ + fixedPressure + { + U + { + type pressureInletVelocity; + value ${:inlet.U}; + } + p + { + type fixedValue; + value ${:inlet.p}; + } + } + fixedVelocity + { + U + { + type fixedValue; + value ${:VALUE.U}; + } + p + { + type zeroGradient; + } + } +} + +// ************************************************************************* // diff --git a/etc/templates/boundaryConditions/fluid/outlet b/etc/templates/boundaryConditions/fluid/outlet new file mode 100644 index 0000000000..c3d368b89e --- /dev/null +++ b/etc/templates/boundaryConditions/fluid/outlet @@ -0,0 +1,42 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 2.2.0 | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "templates"; + object outlet; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +subSonic +{ + p + { + type fixedValue; + value ${:VALUE.p}; + } + k + { + type zeroGradient; + } + epsilon + { + type zeroGradient; + } + omega + { + type zeroGradient; + } + + OPTIONS (returnFlow); +} + + +// ************************************************************************* // diff --git a/etc/templates/boundaryConditions/fluid/outletOptions b/etc/templates/boundaryConditions/fluid/outletOptions new file mode 100644 index 0000000000..068aca008e --- /dev/null +++ b/etc/templates/boundaryConditions/fluid/outletOptions @@ -0,0 +1,40 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 2.2.0 | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "templates"; + object outlet; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +returnFlow +{ + default + { + U + { + type pressureInletOutletVelocity; + value ${:VALUE.U}; + } + } + wall + { + U + { + type inletOutlet; + inletValue uniform (0 0 0); + value ${:VALUE.U}; + } + } +} + + +// ************************************************************************* // diff --git a/etc/templates/boundaryConditions/fluid/wall b/etc/templates/boundaryConditions/fluid/wall new file mode 100644 index 0000000000..f20bcb8abf --- /dev/null +++ b/etc/templates/boundaryConditions/fluid/wall @@ -0,0 +1,54 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 2.2.0 | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "templates"; + object wall; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +noSlip +{ + p + { + type zeroGradient; + } + + OPTIONS (wallFunction motion); +} + + +slip +{ + U + { + type slip; + } + p + { + type zeroGradient; + } + k + { + type zeroGradient; + } + epsilon + { + type zeroGradient; + } + omega + { + type zeroGradient; + } +} + + +// ************************************************************************* // diff --git a/etc/templates/boundaryConditions/fluid/wallOptions b/etc/templates/boundaryConditions/fluid/wallOptions new file mode 100644 index 0000000000..3d3fdabae6 --- /dev/null +++ b/etc/templates/boundaryConditions/fluid/wallOptions @@ -0,0 +1,79 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 2.2.0 | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "templates"; + object wallOptions; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +wallFunction +{ + highReynolds + { + k + { + type kqRWallFunction; + } + epsilon + { + type epsilonWallFunction; + value ${:VALUE.epsilon}; + } + omega + { + type omegaWallFunction; + value ${:VALUE.omega}; + } + } + lowReynolds + { + k + { + type fixedValue; + value uniform 0; + } + epsilon + { + type fixedValue; + value uniform 1e-8; + } + omega + { + type fixedValue; + value uniform 1e-8; + } + } +} + + +motion +{ + stationary + { + U + { + type fixedValue; + value uniform (0 0 0); + } + } + moving + { + U + { + type fixedValue; + value ${:VALUE.U}; + } + } +} + + +// ************************************************************************* // diff --git a/etc/templates/boundaryConditions/solid/wall b/etc/templates/boundaryConditions/solid/wall new file mode 100644 index 0000000000..29ae7ff665 --- /dev/null +++ b/etc/templates/boundaryConditions/solid/wall @@ -0,0 +1,30 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 2.2.0 | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "templates"; + object wall; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +thermal +{ + p + { + type calculated; + value ${:VALUE.T}; + } + + OPTIONS (heatTransfer); +} + + +// ************************************************************************* // diff --git a/etc/templates/boundaryConditions/solid/wallOptions b/etc/templates/boundaryConditions/solid/wallOptions new file mode 100644 index 0000000000..f2c015cdab --- /dev/null +++ b/etc/templates/boundaryConditions/solid/wallOptions @@ -0,0 +1,80 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 2.2.0 | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "templates"; + object wallOptions; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +wallFunction +{ + highReynolds + { + mut + { + type compressible::mutkWallFunction; + value ${:VALUE.nut}; + } + alphat + { + type compressible::alphatWallFunction; + value ${:VALUE.alphat}; + } + } + lowReynolds + { + mut + { + type fixedValue; + value uniform 0; + } + alphat + { + type fixedValue; + value uniform 0; + } + } +} + + +heatTransfer +{ + adiabatic + { + T + { + type zeroGradient; + } + } + fixedTemperature + { + T + { + type fixedValue; + value ${:VALUE.T}; + } + } + thermalCoupled + { + T + { + type compressible::turbulentTemperatureCoupledBaffleMixed; + value ${:VALUE.T}; + Tnbr T; + kappa solidThermo; + kappaName none; + } + } +} + + +// ************************************************************************* // diff --git a/etc/templates/models/turbulence/kEpsilon b/etc/templates/models/turbulence/kEpsilon new file mode 100644 index 0000000000..0076c15dff --- /dev/null +++ b/etc/templates/models/turbulence/kEpsilon @@ -0,0 +1,55 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 2.2.0 | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "templates"; + object kEpsilon; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +incompressibleFields +{ + k + { + type scalar; + dimensions [0 2 -2 0 0]; + } + epsilon + { + type scalar; + dimensions [0 2 -3 0 0]; + } + nut + { + type scalar; + dimensions [0 2 -1 0 0]; + } +} +compressibleFields +{ + k + { + type scalar; + dimensions [0 2 -2 0 0]; + } + epsilon + { + type scalar; + dimensions [0 2 -3 0 0]; + } + mut + { + type scalar; + dimensions [1 -1 -1 0 0]; + } +} + +// ************************************************************************* // diff --git a/etc/templates/models/turbulence/kOmega b/etc/templates/models/turbulence/kOmega new file mode 100644 index 0000000000..97af79cd0b --- /dev/null +++ b/etc/templates/models/turbulence/kOmega @@ -0,0 +1,55 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 2.2.0 | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "templates"; + object kOmega; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +incompressibleFields +{ + k + { + type scalar; + dimensions [0 2 -2 0 0]; + } + omega + { + type scalar; + dimensions [0 0 -1 0 0]; + } + nut + { + type scalar; + dimensions [0 2 -1 0 0]; + } +} +compressibleFields +{ + k + { + type scalar; + dimensions [0 2 -2 0 0]; + } + omega + { + type scalar; + dimensions [0 0 -1 0 0]; + } + mut + { + type scalar; + dimensions [1 -1 -1 0 0]; + } +} + +// ************************************************************************* // diff --git a/etc/templates/models/turbulence/kOmegaSST b/etc/templates/models/turbulence/kOmegaSST new file mode 100644 index 0000000000..97af79cd0b --- /dev/null +++ b/etc/templates/models/turbulence/kOmegaSST @@ -0,0 +1,55 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 2.2.0 | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "templates"; + object kOmega; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +incompressibleFields +{ + k + { + type scalar; + dimensions [0 2 -2 0 0]; + } + omega + { + type scalar; + dimensions [0 0 -1 0 0]; + } + nut + { + type scalar; + dimensions [0 2 -1 0 0]; + } +} +compressibleFields +{ + k + { + type scalar; + dimensions [0 2 -2 0 0]; + } + omega + { + type scalar; + dimensions [0 0 -1 0 0]; + } + mut + { + type scalar; + dimensions [1 -1 -1 0 0]; + } +} + +// ************************************************************************* // diff --git a/etc/templates/models/turbulence/laminar b/etc/templates/models/turbulence/laminar new file mode 100644 index 0000000000..012d41f87d --- /dev/null +++ b/etc/templates/models/turbulence/laminar @@ -0,0 +1,25 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 2.2.0 | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "templates"; + object laminar; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +incompressibleFields +{ +} +compressibleFields +{ +} + +// ************************************************************************* // diff --git a/etc/templates/solvers/chtMultiRegionFoam b/etc/templates/solvers/chtMultiRegionFoam new file mode 100644 index 0000000000..392246b1b3 --- /dev/null +++ b/etc/templates/solvers/chtMultiRegionFoam @@ -0,0 +1,70 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 2.2.0 | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "templates"; + object chtMultiRegionFoam; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +solverType buoyant; + +multiRegion yes; + +fluidModels +{ + turbulenceModel turbulenceModel; +} + +fluidFields +{ + alphat + { + type scalar; + dimensions [1 -1 -1 0 0]; + } + U + { + type vector; + dimensions [0 1 -1 0 0]; + } + p + { + type scalar; + dimensions [1 -1 -2 0 0]; + } + p_rgh + { + type scalar; + dimensions [1 -1 -2 0 0]; + } + T + { + type scalar; + dimensions [0 0 0 1 0]; + } +} + +solidFields +{ + p + { + type scalar; + dimensions [1 -1 -2 0 0]; + } + T + { + type scalar; + dimensions [0 0 0 1 0]; + } +} + +// ************************************************************************* // diff --git a/etc/templates/solvers/icoFoam b/etc/templates/solvers/icoFoam new file mode 100644 index 0000000000..0d0ade999b --- /dev/null +++ b/etc/templates/solvers/icoFoam @@ -0,0 +1,40 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 2.2.0 | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "templates"; + object icoFoam; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +solverType incompressible; + +multiRegion no; + +fluidModels +{ +} + +fluidFields +{ + U + { + type vector; + dimensions [0 1 -1 0 0]; + } + p + { + type scalar; + dimensions [0 2 -2 0 0]; + } +} + +// ************************************************************************* // diff --git a/etc/templates/solvers/simpleFoam b/etc/templates/solvers/simpleFoam new file mode 100644 index 0000000000..3eadf0caf6 --- /dev/null +++ b/etc/templates/solvers/simpleFoam @@ -0,0 +1,41 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 2.2.0 | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "templates"; + object simpleFoam; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +solverType incompressible; + +multiRegion no; + +fluidModels +{ + turbulenceModel RASModel; +} + +fluidFields +{ + U + { + type vector; + dimensions [0 1 -1 0 0]; + } + p + { + type scalar; + dimensions [0 2 -2 0 0]; + } +} + +// ************************************************************************* // diff --git a/src/OpenFOAM/dimensionSet/dimensionSet.C b/src/OpenFOAM/dimensionSet/dimensionSet.C index 8686861018..de1b547681 100644 --- a/src/OpenFOAM/dimensionSet/dimensionSet.C +++ b/src/OpenFOAM/dimensionSet/dimensionSet.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -78,6 +78,12 @@ Foam::dimensionSet::dimensionSet } +Foam::dimensionSet::dimensionSet(const dimensionSet& ds) +{ + reset(ds); +} + + // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // bool Foam::dimensionSet::dimensionless() const diff --git a/src/OpenFOAM/dimensionSet/dimensionSet.H b/src/OpenFOAM/dimensionSet/dimensionSet.H index 1b03e9e27d..105ea879a5 100644 --- a/src/OpenFOAM/dimensionSet/dimensionSet.H +++ b/src/OpenFOAM/dimensionSet/dimensionSet.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -158,6 +158,7 @@ private: label size_; + // Private Member Functions void push(const token&); @@ -172,6 +173,7 @@ private: tokeniser(Istream&); + // Member Functions Istream& stream() @@ -190,7 +192,6 @@ private: static bool valid(char c); static label priority(const token& t); - }; @@ -244,6 +245,15 @@ public: const scalar moles ); + //- Copy constructor + dimensionSet(const dimensionSet& ds); + + //- Construct and return a clone + autoPtr clone() const + { + return autoPtr(new dimensionSet(*this)); + } + //- Construct from Istream dimensionSet(Istream&); diff --git a/src/OpenFOAM/dimensionSet/dimensionSetIO.C b/src/OpenFOAM/dimensionSet/dimensionSetIO.C index e3cbb64fd5..b7a2cbc5ae 100644 --- a/src/OpenFOAM/dimensionSet/dimensionSetIO.C +++ b/src/OpenFOAM/dimensionSet/dimensionSetIO.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -652,7 +652,7 @@ Foam::Ostream& Foam::dimensionSet::write os << token::BEGIN_SQR; - if (writeUnits.valid()) + if (writeUnits.valid() && os.format() == IOstream::ASCII) { scalarField exponents(dimensionSet::nDimensions); for (int d=0; d - static void map - ( - const Field&, - const labelList& map, - Field& - ); - //- Update single volField. template static void MapVolField diff --git a/src/dynamicMesh/fvMeshAdder/fvMeshAdderTemplates.C b/src/dynamicMesh/fvMeshAdder/fvMeshAdderTemplates.C index d5afadb9b3..296bb3c513 100644 --- a/src/dynamicMesh/fvMeshAdder/fvMeshAdderTemplates.C +++ b/src/dynamicMesh/fvMeshAdder/fvMeshAdderTemplates.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -30,26 +30,6 @@ License // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -template -void Foam::fvMeshAdder::map -( - const Field& oldFld, - const labelList& oldToNew, - Field& fld -) -{ - forAll(oldFld, cellI) - { - label newCellI = oldToNew[cellI]; - - if (newCellI >= 0 && newCellI < fld.size()) - { - fld[newCellI] = oldFld[cellI]; - } - } -} - - template void Foam::fvMeshAdder::MapVolField ( @@ -73,8 +53,8 @@ void Foam::fvMeshAdder::MapVolField intFld.setSize(mesh.nCells()); - map(oldInternalField, meshMap.oldCellMap(), intFld); - map(fldToAdd.internalField(), meshMap.addedCellMap(), intFld); + intFld.rmap(oldInternalField, meshMap.oldCellMap()); + intFld.rmap(fldToAdd.internalField(), meshMap.addedCellMap()); } @@ -156,7 +136,7 @@ void Foam::fvMeshAdder::MapVolField oldPatchSizes[patchI], meshMap.oldFaceMap(), mesh.boundaryMesh()[newPatchI], - 0 // unmapped value + -1 // unmapped value ) ); @@ -218,7 +198,7 @@ void Foam::fvMeshAdder::MapVolField oldPatch.size(), meshMap.addedFaceMap(), newPatch, - 0 // unmapped values + -1 // unmapped values ) ); @@ -241,34 +221,23 @@ void Foam::fvMeshAdder::MapVolField // PatchField will have correct size already. Just slot in // my elements. - // From new patch faces to patch faces on added mesh. This - // time keep unmapped elements -1. - labelList newToAdded - ( - calcPatchMap - ( - oldPatch.start(), - oldPatch.size(), - meshMap.addedFaceMap(), - newPatch, - -1 // unmapped values - ) - ); - - const fvPatchField& addedFld = - fldToAdd.boundaryField()[patchI]; - - fvPatchField& newFld = bfld[newPatchI]; - - forAll(newFld, i) + labelList addedToNew(oldPatch.size(), -1); + forAll(addedToNew, i) { - label oldFaceI = newToAdded[i]; - - if (oldFaceI >= 0 && oldFaceI < addedFld.size()) + label addedFaceI = oldPatch.start()+i; + label newFaceI = meshMap.addedFaceMap()[addedFaceI]; + label patchFaceI = newFaceI-newPatch.start(); + if (patchFaceI >= 0 && patchFaceI < newPatch.size()) { - newFld[i] = addedFld[oldFaceI]; + addedToNew[i] = patchFaceI; } } + + bfld[newPatchI].rmap + ( + fldToAdd.boundaryField()[patchI], + addedToNew + ); } } } @@ -375,8 +344,9 @@ void Foam::fvMeshAdder::MapSurfaceField intFld.setSize(mesh.nInternalFaces()); - map(oldField, meshMap.oldFaceMap(), intFld); - map(fldToAdd, meshMap.addedFaceMap(), intFld); + intFld.rmap(oldField, meshMap.oldFaceMap()); + intFld.rmap(fldToAdd, meshMap.addedFaceMap()); + // Faces that were boundary faces but are not anymore. // Use owner value (so lowest numbered cell, i.e. from 'old' not 'added' @@ -474,13 +444,12 @@ void Foam::fvMeshAdder::MapSurfaceField oldPatchSizes[patchI], meshMap.oldFaceMap(), mesh.boundaryMesh()[newPatchI], - 0 // unmapped value + -1 // unmapped value ) ); directFvPatchFieldMapper patchMapper(newToOld); - // Create new patchField with same type as existing one. // Note: // - boundaryField already in new order so access with newPatchI @@ -536,7 +505,7 @@ void Foam::fvMeshAdder::MapSurfaceField oldPatch.size(), meshMap.addedFaceMap(), newPatch, - 0 // unmapped values + -1 // unmapped values ) ); @@ -559,34 +528,23 @@ void Foam::fvMeshAdder::MapSurfaceField // PatchField will have correct size already. Just slot in // my elements. - // From new patch faces to patch faces on added mesh. This - // time keep unmapped elements -1. - labelList newToAdded - ( - calcPatchMap - ( - oldPatch.start(), - oldPatch.size(), - meshMap.addedFaceMap(), - newPatch, - -1 // unmapped values - ) - ); - - const fvsPatchField& addedFld = - fldToAdd.boundaryField()[patchI]; - - fvsPatchField& newFld = bfld[newPatchI]; - - forAll(newFld, i) + labelList addedToNew(oldPatch.size(), -1); + forAll(addedToNew, i) { - label oldFaceI = newToAdded[i]; - - if (oldFaceI >= 0 && oldFaceI < addedFld.size()) + label addedFaceI = oldPatch.start()+i; + label newFaceI = meshMap.addedFaceMap()[addedFaceI]; + label patchFaceI = newFaceI-newPatch.start(); + if (patchFaceI >= 0 && patchFaceI < newPatch.size()) { - newFld[i] = addedFld[oldFaceI]; + addedToNew[i] = patchFaceI; } } + + bfld[newPatchI].rmap + ( + fldToAdd.boundaryField()[patchI], + addedToNew + ); } } } diff --git a/src/dynamicMesh/polyTopoChange/polyTopoChange/edgeCollapser.C b/src/dynamicMesh/polyTopoChange/polyTopoChange/edgeCollapser.C index cb6334306e..ef29a307db 100644 --- a/src/dynamicMesh/polyTopoChange/polyTopoChange/edgeCollapser.C +++ b/src/dynamicMesh/polyTopoChange/polyTopoChange/edgeCollapser.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -475,7 +475,7 @@ Foam::scalarField Foam::edgeCollapser::calcTargetFaceSizes() const { scalarField targetFaceSizes(mesh_.nFaces(), -1); - const scalarField& cellVolumes = mesh_.cellVolumes(); + const scalarField& V = mesh_.cellVolumes(); const polyBoundaryMesh& patches = mesh_.boundaryMesh(); const labelList& cellOwner = mesh_.faceOwner(); @@ -486,8 +486,8 @@ Foam::scalarField Foam::edgeCollapser::calcTargetFaceSizes() const // Calculate face size from cell volumes for internal faces for (label intFaceI = 0; intFaceI < mesh_.nInternalFaces(); ++intFaceI) { - const scalar cellOwnerVol = cellVolumes[cellOwner[intFaceI]]; - const scalar cellNeighbourVol = cellVolumes[cellNeighbour[intFaceI]]; + const scalar cellOwnerVol = max(0.0, V[cellOwner[intFaceI]]); + const scalar cellNeighbourVol = max(0.0, V[cellNeighbour[intFaceI]]); scalar targetFaceSizeA = Foam::pow(cellOwnerVol, 1.0/3.0); scalar targetFaceSizeB = Foam::pow(cellNeighbourVol, 1.0/3.0); @@ -512,7 +512,7 @@ Foam::scalarField Foam::edgeCollapser::calcTargetFaceSizes() const forAll(faceCells, facei) { - neiCellVolumes[bFaceI++] = cellVolumes[faceCells[facei]]; + neiCellVolumes[bFaceI++] = max(0.0, V[faceCells[facei]]); } } else @@ -522,7 +522,7 @@ Foam::scalarField Foam::edgeCollapser::calcTargetFaceSizes() const forAll(patch, patchFaceI) { const label extFaceI = patchFaceI + patch.start(); - const scalar cellOwnerVol = cellVolumes[cellOwner[extFaceI]]; + const scalar cellOwnerVol = max(0.0, V[cellOwner[extFaceI]]); targetFaceSizes[extFaceI] = Foam::pow(cellOwnerVol, 1.0/3.0); } @@ -542,7 +542,7 @@ Foam::scalarField Foam::edgeCollapser::calcTargetFaceSizes() const forAll(patch, patchFaceI) { const label localFaceI = patchFaceI + patch.start(); - const scalar cellOwnerVol = cellVolumes[cellOwner[localFaceI]]; + const scalar cellOwnerVol = max(0.0, V[cellOwner[localFaceI]]); const scalar cellNeighbourVol = neiCellVolumes[bFaceI++]; scalar targetFaceSizeA = Foam::pow(cellOwnerVol, 1.0/3.0); diff --git a/src/finiteVolume/fields/fvPatchFields/derived/waveSurfacePressure/waveSurfacePressureFvPatchScalarField.C b/src/finiteVolume/fields/fvPatchFields/derived/waveSurfacePressure/waveSurfacePressureFvPatchScalarField.C index 9451e4bc26..3dff6c94e1 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/waveSurfacePressure/waveSurfacePressureFvPatchScalarField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/waveSurfacePressure/waveSurfacePressureFvPatchScalarField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/finiteVolume/fields/fvPatchFields/derived/waveSurfacePressure/waveSurfacePressureFvPatchScalarField.H b/src/finiteVolume/fields/fvPatchFields/derived/waveSurfacePressure/waveSurfacePressureFvPatchScalarField.H index 858c6f690c..83f989fb12 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/waveSurfacePressure/waveSurfacePressureFvPatchScalarField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/waveSurfacePressure/waveSurfacePressureFvPatchScalarField.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/LocalInteraction/LocalInteraction.C b/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/LocalInteraction/LocalInteraction.C index 47e73f1818..77a6debde7 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/LocalInteraction/LocalInteraction.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/LocalInteraction/LocalInteraction.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -298,7 +298,7 @@ void Foam::LocalInteraction::info(Ostream& os) this->getModelProperty("massStick", mps0); // accumulate current data - labelList npe(nEscape_, 0); + labelList npe(nEscape_); Pstream::listCombineGather(npe, plusEqOp