diff --git a/applications/solvers/compressible/rhoCentralFoam/rhoCentralDyMFoam/rhoCentralDyMFoam.C b/applications/solvers/compressible/rhoCentralFoam/rhoCentralDyMFoam/rhoCentralDyMFoam.C index 96413e0201..b24f21fe8d 100644 --- a/applications/solvers/compressible/rhoCentralFoam/rhoCentralDyMFoam/rhoCentralDyMFoam.C +++ b/applications/solvers/compressible/rhoCentralFoam/rhoCentralDyMFoam/rhoCentralDyMFoam.C @@ -120,11 +120,14 @@ int main(int argc, char *argv[]) "cSf_pos", interpolate(c, pos, T.name())*mesh.magSf() ); + cSf_pos.setOriented(); + surfaceScalarField cSf_neg ( "cSf_neg", interpolate(c, neg, T.name())*mesh.magSf() ); + cSf_neg.setOriented(); surfaceScalarField ap ( @@ -269,4 +272,5 @@ int main(int argc, char *argv[]) return 0; } + // ************************************************************************* // diff --git a/applications/solvers/compressible/rhoCentralFoam/rhoCentralFoam.C b/applications/solvers/compressible/rhoCentralFoam/rhoCentralFoam.C index 65ab9d2db3..6550d62b28 100644 --- a/applications/solvers/compressible/rhoCentralFoam/rhoCentralFoam.C +++ b/applications/solvers/compressible/rhoCentralFoam/rhoCentralFoam.C @@ -101,11 +101,14 @@ int main(int argc, char *argv[]) "cSf_pos", interpolate(c, pos, T.name())*mesh.magSf() ); + cSf_pos.setOriented(); + surfaceScalarField cSf_neg ( "cSf_neg", interpolate(c, neg, T.name())*mesh.magSf() ); + cSf_neg.setOriented(); surfaceScalarField ap ( diff --git a/applications/solvers/electromagnetics/magneticFoam/magnet.H b/applications/solvers/electromagnetics/magneticFoam/magnet.H index 7e9b04a4c5..8f15c69635 100644 --- a/applications/solvers/electromagnetics/magneticFoam/magnet.H +++ b/applications/solvers/electromagnetics/magneticFoam/magnet.H @@ -138,9 +138,7 @@ public: >> m.orientation_; is.readEnd("magnet"); - // Check state of Istream - is.check("operator>>(Istream&, magnet&)"); - + is.check(FUNCTION_NAME); return is; } diff --git a/applications/solvers/lagrangian/reactingParcelFoam/simpleReactingParcelFoam/simpleReactingParcelFoam.C b/applications/solvers/lagrangian/reactingParcelFoam/simpleReactingParcelFoam/simpleReactingParcelFoam.C index b3504da91a..bbec4a41ab 100644 --- a/applications/solvers/lagrangian/reactingParcelFoam/simpleReactingParcelFoam/simpleReactingParcelFoam.C +++ b/applications/solvers/lagrangian/reactingParcelFoam/simpleReactingParcelFoam/simpleReactingParcelFoam.C @@ -38,7 +38,6 @@ Description #include "basicReactingMultiphaseCloud.H" #include "rhoCombustionModel.H" #include "radiationModel.H" -#include "IOporosityModelList.H" #include "fvOptions.H" #include "SLGThermo.H" #include "simpleControl.H" diff --git a/applications/solvers/multiphase/compressibleMultiphaseInterFoam/multiphaseMixtureThermo/multiphaseMixtureThermo.C b/applications/solvers/multiphase/compressibleMultiphaseInterFoam/multiphaseMixtureThermo/multiphaseMixtureThermo.C index 55175d8d80..627dd41b6f 100644 --- a/applications/solvers/multiphase/compressibleMultiphaseInterFoam/multiphaseMixtureThermo/multiphaseMixtureThermo.C +++ b/applications/solvers/multiphase/compressibleMultiphaseInterFoam/multiphaseMixtureThermo/multiphaseMixtureThermo.C @@ -113,6 +113,7 @@ Foam::multiphaseMixtureThermo::multiphaseMixtureThermo 1e-8/pow(average(mesh_.V()), 1.0/3.0) ) { + rhoPhi_.setOriented(); calcAlphas(); alphas_.write(); correct(); @@ -698,6 +699,7 @@ Foam::multiphaseMixtureThermo::surfaceTensionForce() const ); surfaceScalarField& stf = tstf.ref(); + stf.setOriented(); forAllConstIter(PtrDictionary, phases_, phase1) { diff --git a/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseSystem/multiphaseSystem.C b/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseSystem/multiphaseSystem.C index 798e9c2eb6..de3084f69f 100644 --- a/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseSystem/multiphaseSystem.C +++ b/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseSystem/multiphaseSystem.C @@ -801,6 +801,7 @@ Foam::tmp Foam::multiphaseSystem::surfaceTension ) ) ); + tSurfaceTension.ref().setOriented(); forAllConstIter(PtrDictionary, phases_, iter) { diff --git a/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseSystem/phaseModel/phaseModel.C b/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseSystem/phaseModel/phaseModel.C index a1990a88c9..224d0345d6 100644 --- a/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseSystem/phaseModel/phaseModel.C +++ b/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseSystem/phaseModel/phaseModel.C @@ -113,6 +113,8 @@ Foam::phaseModel::phaseModel dimensionedScalar("0", dimensionSet(0, 3, -1, 0, 0), 0) ) { + alphaPhi_.setOriented(); + const word phiName = IOobject::groupName("phi", name_); IOobject phiHeader diff --git a/applications/solvers/multiphase/multiphaseInterFoam/multiphaseMixture/multiphaseMixture.C b/applications/solvers/multiphase/multiphaseInterFoam/multiphaseMixture/multiphaseMixture.C index 21b5edefe4..b6144051a4 100644 --- a/applications/solvers/multiphase/multiphaseInterFoam/multiphaseMixture/multiphaseMixture.C +++ b/applications/solvers/multiphase/multiphaseInterFoam/multiphaseMixture/multiphaseMixture.C @@ -128,6 +128,8 @@ Foam::multiphaseMixture::multiphaseMixture 1e-8/pow(average(mesh_.V()), 1.0/3.0) ) { + rhoPhi_.setOriented(); + calcAlphas(); alphas_.write(); } @@ -273,6 +275,7 @@ Foam::multiphaseMixture::surfaceTensionForce() const ); surfaceScalarField& stf = tstf.ref(); + stf.setOriented(); forAllConstIter(PtrDictionary, phases_, iter1) { diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/BlendedInterfacialModel/BlendedInterfacialModel.C b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/BlendedInterfacialModel/BlendedInterfacialModel.C index 64345bf759..2213f1a725 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/BlendedInterfacialModel/BlendedInterfacialModel.C +++ b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/BlendedInterfacialModel/BlendedInterfacialModel.C @@ -455,6 +455,7 @@ Foam::BlendedInterfacialModel::Ff() const dimensionedScalar("zero", ModelType::dimF*dimArea, 0) ) ); + x.ref().setOriented(); if (model_.valid()) { diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/MomentumTransferPhaseSystem/MomentumTransferPhaseSystem.C b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/MomentumTransferPhaseSystem/MomentumTransferPhaseSystem.C index b9859eb41d..02969b89cb 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/MomentumTransferPhaseSystem/MomentumTransferPhaseSystem.C +++ b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/MomentumTransferPhaseSystem/MomentumTransferPhaseSystem.C @@ -347,7 +347,7 @@ Foam::MomentumTransferPhaseSystem::Ff } else { - return tmp + tmp tFf ( new surfaceScalarField ( @@ -364,6 +364,10 @@ Foam::MomentumTransferPhaseSystem::Ff dimensionedScalar("zero", liftModel::dimF*dimArea, 0) ) ); + + tFf.ref().setOriented(); + + return tFf; } } @@ -621,6 +625,8 @@ Foam::MomentumTransferPhaseSystem::setPhiD ) ) ); + + phiDs[phasei].setOriented(); } return phiDs[phasei]; diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/MovingPhaseModel/MovingPhaseModel.C b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/MovingPhaseModel/MovingPhaseModel.C index 0605c1171e..2afa388aca 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/MovingPhaseModel/MovingPhaseModel.C +++ b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/MovingPhaseModel/MovingPhaseModel.C @@ -200,6 +200,9 @@ Foam::MovingPhaseModel::MovingPhaseModel dimensionedScalar("0", dimDensity/dimTime, 0) ) { + alphaPhi_.setOriented(); + alphaRhoPhi_.setOriented(); + phi_.writeOpt() = IOobject::AUTO_WRITE; correctKinematics(); } diff --git a/applications/solvers/multiphase/reactingEulerFoam/reactingMultiphaseEulerFoam/multiphaseSystem/multiphaseSystem.C b/applications/solvers/multiphase/reactingEulerFoam/reactingMultiphaseEulerFoam/multiphaseSystem/multiphaseSystem.C index 805d99844e..627af1db87 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/reactingMultiphaseEulerFoam/multiphaseSystem/multiphaseSystem.C +++ b/applications/solvers/multiphase/reactingEulerFoam/reactingMultiphaseEulerFoam/multiphaseSystem/multiphaseSystem.C @@ -548,6 +548,8 @@ Foam::tmp Foam::multiphaseSystem::surfaceTension ) ); + tSurfaceTension.ref().setOriented(); + forAll(phases(), phasej) { const phaseModel& phase2 = phases()[phasej]; diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/phaseModel/phaseModel.C b/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/phaseModel/phaseModel.C index 87a249277a..9352b72397 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/phaseModel/phaseModel.C +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/phaseModel/phaseModel.C @@ -109,6 +109,9 @@ Foam::phaseModel::phaseModel dimensionedScalar("0", dimensionSet(1, 0, -1, 0, 0), 0) ) { + alphaPhi_.setOriented(); + alphaRhoPhi_.setOriented(); + thermo_->validate("phaseModel " + name_, "h", "e"); const word phiName = IOobject::groupName("phi", name_); diff --git a/applications/test/NamedEnum/Test-NamedEnum.C b/applications/test/NamedEnum/Test-NamedEnum.C index 08d1f74972..079938b6b7 100644 --- a/applications/test/NamedEnum/Test-NamedEnum.C +++ b/applications/test/NamedEnum/Test-NamedEnum.C @@ -66,6 +66,9 @@ int main(int argc, char *argv[]) const List options = namedEnumTest::namedEnum.enums(); + dictionary testDict; + testDict.add("lookup1", "c"); + Info<< "enums: " << options << nl; Info<< "loop over enums (as list):" << nl; @@ -88,6 +91,30 @@ int main(int argc, char *argv[]) << namedEnumTest::namedEnum["a"] << nl << namedEnumTest::namedEnum[namedEnumTest::a] << nl; + Info<< "--- test dictionary lookup ---" << endl; + { + Info<< "dict: " << testDict << endl; + + namedEnumTest::option gotOpt = + namedEnumTest::namedEnum.lookupOrDefault + ( + "test", + testDict, + namedEnumTest::option::a + ); + + Info<< "got: " << gotOpt << endl; + + gotOpt = namedEnumTest::namedEnum.lookupOrDefault + ( + "lookup1", + testDict, + namedEnumTest::option::a + ); + + Info<< "got: " << gotOpt << endl; + } + Info<< "--- test read construction ---" << endl; namedEnumTest::option dummy(namedEnumTest::namedEnum.read(Sin)); diff --git a/applications/test/mapDistributePolyMesh/Make/files b/applications/test/mapDistributePolyMesh/Make/files new file mode 100644 index 0000000000..eb304044bf --- /dev/null +++ b/applications/test/mapDistributePolyMesh/Make/files @@ -0,0 +1,3 @@ +Test-mapDistributePolyMesh.C +EXE = $(FOAM_USER_APPBIN)/Test-mapDistributePolyMesh + diff --git a/applications/test/mapDistributePolyMesh/Make/options b/applications/test/mapDistributePolyMesh/Make/options new file mode 100644 index 0000000000..dc318df998 --- /dev/null +++ b/applications/test/mapDistributePolyMesh/Make/options @@ -0,0 +1,9 @@ +EXE_INC = \ + -I$(LIB_SRC)/meshTools/lnInclude \ + -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/dynamicMesh/lnInclude + +EXE_LIBS = \ + -lfiniteVolume \ + -ldynamicMesh \ + -lmeshTools diff --git a/applications/test/mapDistributePolyMesh/Test-mapDistributePolyMesh.C b/applications/test/mapDistributePolyMesh/Test-mapDistributePolyMesh.C new file mode 100644 index 0000000000..a925be3efe --- /dev/null +++ b/applications/test/mapDistributePolyMesh/Test-mapDistributePolyMesh.C @@ -0,0 +1,149 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2017 OpenCFD Ltd. + \\/ 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 + mapDistributePolyMesh + +Description + Test for procAddressing + +\*---------------------------------------------------------------------------*/ + +#include "IOmapDistributePolyMesh.H" +#include "argList.H" +#include "Time.H" +#include "surfaceFields.H" +#include "flipOp.H" + +using namespace Foam; + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +int main(int argc, char *argv[]) +{ + #include "setRootCase.H" + #include "createTime.H" + #include "createMesh.H" + + Info<< "Reading distribute map\n" << endl; + + const word instance("0.005"); + const scalar instanceValue(0.005); + + + IOobject io + ( + "procAddressing", + instance, + fvMesh::meshSubDir, + mesh, + IOobject::MUST_READ, + IOobject::NO_WRITE, + false + ); + + IOmapDistributePolyMesh map(io); + + { + // Load the instance mesh + runTime.setTime(instanceValue, 0); + polyMesh distributedMesh + ( + IOobject + ( + polyMesh::defaultRegion, + instance, + runTime, + IOobject::MUST_READ + ) + ); + + // Faces, no flip + { + const mapDistribute& faceMap = map.faceMap(); + pointField fc(mesh.faceCentres()); + faceMap.distribute(fc, noOp()); + Pout<< "Construct size:" << faceMap.constructSize() << endl; + forAll(distributedMesh.faceCentres(), facei) + { + Pout<< "face:" << facei + << "\tmappedFc:" << fc[facei] + << "\tactual:" << distributedMesh.faceCentres()[facei] + << endl; + } + } + // Faces, flipped field + { + const mapDistribute& faceMap = map.faceMap(); + scalarField flux(mesh.faceAreas() & vector(1, 1, 1)); + faceMap.distribute(flux, flipOp()); + Pout<< "Construct size:" << faceMap.constructSize() << endl; + const scalarField newFlux + ( + distributedMesh.faceAreas() + & vector(1, 1, 1) + ); + forAll(newFlux, facei) + { + Pout<< "face:" << facei + << "\tmappedFlux:" << flux[facei] + << "\tactual:" << newFlux[facei] + << endl; + } + } + + + { + const mapDistribute& cellMap = map.cellMap(); + pointField cc(mesh.cellCentres()); + cellMap.distribute(cc, noOp()); + Pout<< "Construct size:" << cellMap.constructSize() << endl; + forAll(distributedMesh.cellCentres(), celli) + { + Pout<< "cell:" << celli + << "\tmappedCc:" << cc[celli] + << "\tactual:" << distributedMesh.cellCentres()[celli] + << endl; + } + } + { + const mapDistribute& pointMap = map.pointMap(); + pointField pc(mesh.points()); + pointMap.distribute(pc, noOp()); + Pout<< "Construct size:" << pointMap.constructSize() << endl; + forAll(distributedMesh.points(), pointi) + { + Pout<< "point:" << pointi + << "\tmappedPoint:" << pc[pointi] + << "\tactual:" << distributedMesh.points()[pointi] + << endl; + } + } + } + + Info<< "End\n" << endl; + return 0; +} + + +// ************************************************************************* // diff --git a/applications/test/mapDistributePolyMesh/cavity/0/U b/applications/test/mapDistributePolyMesh/cavity/0/U new file mode 100644 index 0000000000..f3ab7eefb6 --- /dev/null +++ b/applications/test/mapDistributePolyMesh/cavity/0/U @@ -0,0 +1,41 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volVectorField; + object U; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 1 -1 0 0 0 0]; + +internalField uniform (1 1 0); + +boundaryField +{ + movingWall + { + type fixedValue; + value uniform (1 0 0); + } + + fixedWalls + { + type fixedValue; + value uniform (0 0 0); + } + + frontAndBack + { + type empty; + } +} + +// ************************************************************************* // diff --git a/applications/test/mapDistributePolyMesh/cavity/0/p b/applications/test/mapDistributePolyMesh/cavity/0/p new file mode 100644 index 0000000000..0976329ced --- /dev/null +++ b/applications/test/mapDistributePolyMesh/cavity/0/p @@ -0,0 +1,39 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + object p; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 2 -2 0 0 0 0]; + +internalField uniform 0; + +boundaryField +{ + movingWall + { + type zeroGradient; + } + + fixedWalls + { + type zeroGradient; + } + + frontAndBack + { + type empty; + } +} + +// ************************************************************************* // diff --git a/applications/test/mapDistributePolyMesh/cavity/0/phi b/applications/test/mapDistributePolyMesh/cavity/0/phi new file mode 100644 index 0000000000..0a745bbd5b --- /dev/null +++ b/applications/test/mapDistributePolyMesh/cavity/0/phi @@ -0,0 +1,228 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus.feature-oriented-fields | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class surfaceScalarField; + location "0"; + object fluxU; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 3 -1 0 0 0 0]; +oriented 1; + + +internalField nonuniform List +180 +( +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +0.0001 +) +; + +boundaryField +{ + movingWall + { + type calculated; + value uniform 0; + } + fixedWalls + { + type calculated; + value uniform 0; + } + frontAndBack + { + type empty; + value nonuniform 0(); + } +} + + +// ************************************************************************* // diff --git a/applications/test/mapDistributePolyMesh/cavity/Allclean b/applications/test/mapDistributePolyMesh/cavity/Allclean new file mode 100755 index 0000000000..1ddaee91ff --- /dev/null +++ b/applications/test/mapDistributePolyMesh/cavity/Allclean @@ -0,0 +1,13 @@ +#!/bin/sh +cd ${0%/*} || exit 1 # Run from this directory + +# Source tutorial clean functions +. $WM_PROJECT_DIR/bin/tools/CleanFunctions + +cleanCase + +# Restore default dictionaries +cp system/decomposeParDict-2 system/decomposeParDict +cp system/controlDict-startTime system/controlDict + +# ----------------------------------------------------------------------------- diff --git a/applications/test/mapDistributePolyMesh/cavity/Allrun b/applications/test/mapDistributePolyMesh/cavity/Allrun new file mode 100755 index 0000000000..9afaa5243d --- /dev/null +++ b/applications/test/mapDistributePolyMesh/cavity/Allrun @@ -0,0 +1,17 @@ +#!/bin/sh +cd ${0%/*} || exit 1 # Run from this directory + +# Source tutorial run functions +. $WM_PROJECT_DIR/bin/tools/RunFunctions + +runApplication blockMesh + +runApplication decomposePar -decomposeParDict system/decomposeParDict-2 + +runParallel -s scotch -np 5 redistributePar \ + -decomposeParDict system/decomposeParDict-5 + +runParallel -np 5 Test-mapDistributePolyMesh \ + -decomposeParDict system/decomposeParDict-5 + +# ----------------------------------------------------------------------------- diff --git a/applications/test/mapDistributePolyMesh/cavity/cavity.foam b/applications/test/mapDistributePolyMesh/cavity/cavity.foam new file mode 100644 index 0000000000..e69de29bb2 diff --git a/applications/test/mapDistributePolyMesh/cavity/constant/transportProperties b/applications/test/mapDistributePolyMesh/cavity/constant/transportProperties new file mode 100644 index 0000000000..de00c3587c --- /dev/null +++ b/applications/test/mapDistributePolyMesh/cavity/constant/transportProperties @@ -0,0 +1,21 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "constant"; + object transportProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +nu nu [ 0 2 -1 0 0 0 0 ] 0.01; + + +// ************************************************************************* // diff --git a/applications/test/mapDistributePolyMesh/cavity/system/blockMeshDict b/applications/test/mapDistributePolyMesh/cavity/system/blockMeshDict new file mode 100644 index 0000000000..3118c894d8 --- /dev/null +++ b/applications/test/mapDistributePolyMesh/cavity/system/blockMeshDict @@ -0,0 +1,75 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object blockMeshDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +convertToMeters 0.1; + +vertices +( + (0 0 0) + (1 0 0) + (1 1 0) + (0 1 0) + (0 0 0.1) + (1 0 0.1) + (1 1 0.1) + (0 1 0.1) +); + +blocks +( + hex (0 1 2 3 4 5 6 7) (10 10 1) simpleGrading (1 1 1) +); + +edges +( +); + +boundary +( + movingWall + { + type wall; + faces + ( + (3 7 6 2) + ); + } + fixedWalls + { + type wall; + faces + ( + (0 4 7 3) + (2 6 5 1) + (1 5 4 0) + ); + } + frontAndBack + { + type empty; + faces + ( + (0 3 2 1) + (4 5 6 7) + ); + } +); + +mergePatchPairs +( +); + +// ************************************************************************* // diff --git a/applications/test/mapDistributePolyMesh/cavity/system/controlDict b/applications/test/mapDistributePolyMesh/cavity/system/controlDict new file mode 100644 index 0000000000..78ef7651b9 --- /dev/null +++ b/applications/test/mapDistributePolyMesh/cavity/system/controlDict @@ -0,0 +1,49 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object controlDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +application icoFoam; + +startFrom startTime; + +startTime 0; + +stopAt endTime; + +endTime 0.5; + +deltaT 0.005; + +writeControl timeStep; + +writeInterval 20; + +purgeWrite 0; + +writeFormat ascii; + +writePrecision 6; + +writeCompression off; + +timeFormat general; + +timePrecision 6; + +runTimeModifiable true; + + +// ************************************************************************* // diff --git a/applications/test/mapDistributePolyMesh/cavity/system/controlDict-latestTime b/applications/test/mapDistributePolyMesh/cavity/system/controlDict-latestTime new file mode 100644 index 0000000000..8b3e003782 --- /dev/null +++ b/applications/test/mapDistributePolyMesh/cavity/system/controlDict-latestTime @@ -0,0 +1,49 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object controlDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +application icoFoam; + +startFrom latestTime; + +startTime 0; + +stopAt endTime; + +endTime 1.0; + +deltaT 0.005; + +writeControl timeStep; + +writeInterval 20; + +purgeWrite 0; + +writeFormat ascii; + +writePrecision 6; + +writeCompression off; + +timeFormat general; + +timePrecision 6; + +runTimeModifiable true; + + +// ************************************************************************* // diff --git a/applications/test/mapDistributePolyMesh/cavity/system/controlDict-startTime b/applications/test/mapDistributePolyMesh/cavity/system/controlDict-startTime new file mode 100644 index 0000000000..78ef7651b9 --- /dev/null +++ b/applications/test/mapDistributePolyMesh/cavity/system/controlDict-startTime @@ -0,0 +1,49 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object controlDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +application icoFoam; + +startFrom startTime; + +startTime 0; + +stopAt endTime; + +endTime 0.5; + +deltaT 0.005; + +writeControl timeStep; + +writeInterval 20; + +purgeWrite 0; + +writeFormat ascii; + +writePrecision 6; + +writeCompression off; + +timeFormat general; + +timePrecision 6; + +runTimeModifiable true; + + +// ************************************************************************* // diff --git a/applications/test/mapDistributePolyMesh/cavity/system/decomposeParDict b/applications/test/mapDistributePolyMesh/cavity/system/decomposeParDict new file mode 100644 index 0000000000..8c054db9bb --- /dev/null +++ b/applications/test/mapDistributePolyMesh/cavity/system/decomposeParDict @@ -0,0 +1,143 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + note "mesh decomposition control dictionary"; + object decomposeParDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +numberOfSubdomains 2; + +//- Keep owner and neighbour on same processor for faces in zones: +// preserveFaceZones (heater solid1 solid3); + +//- Keep owner and neighbour on same processor for faces in patches: +// (makes sense only for cyclic patches) +//preservePatches (cyclic_half0 cyclic_half1); + +//- Keep all of faceSet on a single processor. This puts all cells +// connected with a point, edge or face on the same processor. +// (just having face connected cells might not guarantee a balanced +// decomposition) +// The processor can be -1 (the decompositionMethod chooses the processor +// for a good load balance) or explicitly provided (upsets balance). +//singleProcessorFaceSets ((f0 -1)); + + +//- Keep owner and neighbour of baffles on same processor (i.e. keep it +// detectable as a baffle). Baffles are two boundary face sharing the +// same points. +//preserveBaffles true; + +//- Use the volScalarField named here as a weight for each cell in the +// decomposition. For example, use a particle population field to decompose +// for a balanced number of particles in a lagrangian simulation. +// weightField dsmcRhoNMean; + +method scotch; +//method hierarchical; +// method simple; +// method metis; +// method manual; +// method multiLevel; +// method structured; // does 2D decomposition of structured mesh + +multiLevelCoeffs +{ + // Decomposition methods to apply in turn. This is like hierarchical but + // fully general - every method can be used at every level. + + level0 + { + numberOfSubdomains 64; + //method simple; + //simpleCoeffs + //{ + // n (2 1 1); + // delta 0.001; + //} + method scotch; + } + level1 + { + numberOfSubdomains 4; + method scotch; + } +} + +// Desired output + +simpleCoeffs +{ + n (2 1 1); + delta 0.001; +} + +hierarchicalCoeffs +{ + n (1 2 1); + delta 0.001; + order xyz; +} + +metisCoeffs +{ + /* + processorWeights + ( + 1 + 1 + 1 + 1 + ); + */ +} + +scotchCoeffs +{ + //processorWeights + //( + // 1 + // 1 + // 1 + // 1 + //); + //writeGraph true; + //strategy "b"; +} + +manualCoeffs +{ + dataFile "decompositionData"; +} + +structuredCoeffs +{ + // Patches to do 2D decomposition on. Structured mesh only; cells have + // to be in 'columns' on top of patches. + patches (movingWall); + + // Method to use on the 2D subset + method scotch; +} + +//// Is the case distributed? Note: command-line argument -roots takes +//// precedence +//distributed yes; +//// Per slave (so nProcs-1 entries) the directory above the case. +//roots +//( +// "/tmp" +// "/tmp" +//); + +// ************************************************************************* // diff --git a/applications/test/mapDistributePolyMesh/cavity/system/decomposeParDict-2 b/applications/test/mapDistributePolyMesh/cavity/system/decomposeParDict-2 new file mode 100644 index 0000000000..8c054db9bb --- /dev/null +++ b/applications/test/mapDistributePolyMesh/cavity/system/decomposeParDict-2 @@ -0,0 +1,143 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + note "mesh decomposition control dictionary"; + object decomposeParDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +numberOfSubdomains 2; + +//- Keep owner and neighbour on same processor for faces in zones: +// preserveFaceZones (heater solid1 solid3); + +//- Keep owner and neighbour on same processor for faces in patches: +// (makes sense only for cyclic patches) +//preservePatches (cyclic_half0 cyclic_half1); + +//- Keep all of faceSet on a single processor. This puts all cells +// connected with a point, edge or face on the same processor. +// (just having face connected cells might not guarantee a balanced +// decomposition) +// The processor can be -1 (the decompositionMethod chooses the processor +// for a good load balance) or explicitly provided (upsets balance). +//singleProcessorFaceSets ((f0 -1)); + + +//- Keep owner and neighbour of baffles on same processor (i.e. keep it +// detectable as a baffle). Baffles are two boundary face sharing the +// same points. +//preserveBaffles true; + +//- Use the volScalarField named here as a weight for each cell in the +// decomposition. For example, use a particle population field to decompose +// for a balanced number of particles in a lagrangian simulation. +// weightField dsmcRhoNMean; + +method scotch; +//method hierarchical; +// method simple; +// method metis; +// method manual; +// method multiLevel; +// method structured; // does 2D decomposition of structured mesh + +multiLevelCoeffs +{ + // Decomposition methods to apply in turn. This is like hierarchical but + // fully general - every method can be used at every level. + + level0 + { + numberOfSubdomains 64; + //method simple; + //simpleCoeffs + //{ + // n (2 1 1); + // delta 0.001; + //} + method scotch; + } + level1 + { + numberOfSubdomains 4; + method scotch; + } +} + +// Desired output + +simpleCoeffs +{ + n (2 1 1); + delta 0.001; +} + +hierarchicalCoeffs +{ + n (1 2 1); + delta 0.001; + order xyz; +} + +metisCoeffs +{ + /* + processorWeights + ( + 1 + 1 + 1 + 1 + ); + */ +} + +scotchCoeffs +{ + //processorWeights + //( + // 1 + // 1 + // 1 + // 1 + //); + //writeGraph true; + //strategy "b"; +} + +manualCoeffs +{ + dataFile "decompositionData"; +} + +structuredCoeffs +{ + // Patches to do 2D decomposition on. Structured mesh only; cells have + // to be in 'columns' on top of patches. + patches (movingWall); + + // Method to use on the 2D subset + method scotch; +} + +//// Is the case distributed? Note: command-line argument -roots takes +//// precedence +//distributed yes; +//// Per slave (so nProcs-1 entries) the directory above the case. +//roots +//( +// "/tmp" +// "/tmp" +//); + +// ************************************************************************* // diff --git a/applications/test/mapDistributePolyMesh/cavity/system/decomposeParDict-5 b/applications/test/mapDistributePolyMesh/cavity/system/decomposeParDict-5 new file mode 100644 index 0000000000..0692228c7c --- /dev/null +++ b/applications/test/mapDistributePolyMesh/cavity/system/decomposeParDict-5 @@ -0,0 +1,143 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + note "mesh decomposition control dictionary"; + object decomposeParDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +numberOfSubdomains 5; + +//- Keep owner and neighbour on same processor for faces in zones: +// preserveFaceZones (heater solid1 solid3); + +//- Keep owner and neighbour on same processor for faces in patches: +// (makes sense only for cyclic patches) +//preservePatches (cyclic_half0 cyclic_half1); + +//- Keep all of faceSet on a single processor. This puts all cells +// connected with a point, edge or face on the same processor. +// (just having face connected cells might not guarantee a balanced +// decomposition) +// The processor can be -1 (the decompositionMethod chooses the processor +// for a good load balance) or explicitly provided (upsets balance). +//singleProcessorFaceSets ((f0 -1)); + + +//- Keep owner and neighbour of baffles on same processor (i.e. keep it +// detectable as a baffle). Baffles are two boundary face sharing the +// same points. +//preserveBaffles true; + +//- Use the volScalarField named here as a weight for each cell in the +// decomposition. For example, use a particle population field to decompose +// for a balanced number of particles in a lagrangian simulation. +// weightField dsmcRhoNMean; + +method scotch; +//method hierarchical; +// method simple; +// method metis; +// method manual; +// method multiLevel; +// method structured; // does 2D decomposition of structured mesh + +multiLevelCoeffs +{ + // Decomposition methods to apply in turn. This is like hierarchical but + // fully general - every method can be used at every level. + + level0 + { + numberOfSubdomains 64; + //method simple; + //simpleCoeffs + //{ + // n (2 1 1); + // delta 0.001; + //} + method scotch; + } + level1 + { + numberOfSubdomains 4; + method scotch; + } +} + +// Desired output + +simpleCoeffs +{ + n (2 1 1); + delta 0.001; +} + +hierarchicalCoeffs +{ + n (1 2 1); + delta 0.001; + order xyz; +} + +metisCoeffs +{ + /* + processorWeights + ( + 1 + 1 + 1 + 1 + ); + */ +} + +scotchCoeffs +{ + //processorWeights + //( + // 1 + // 1 + // 1 + // 1 + //); + //writeGraph true; + //strategy "b"; +} + +manualCoeffs +{ + dataFile "decompositionData"; +} + +structuredCoeffs +{ + // Patches to do 2D decomposition on. Structured mesh only; cells have + // to be in 'columns' on top of patches. + patches (movingWall); + + // Method to use on the 2D subset + method scotch; +} + +//// Is the case distributed? Note: command-line argument -roots takes +//// precedence +//distributed yes; +//// Per slave (so nProcs-1 entries) the directory above the case. +//roots +//( +// "/tmp" +// "/tmp" +//); + +// ************************************************************************* // diff --git a/applications/test/mapDistributePolyMesh/cavity/system/decomposeParDict-hierarchical b/applications/test/mapDistributePolyMesh/cavity/system/decomposeParDict-hierarchical new file mode 100644 index 0000000000..4914ae5e02 --- /dev/null +++ b/applications/test/mapDistributePolyMesh/cavity/system/decomposeParDict-hierarchical @@ -0,0 +1,29 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + note "mesh decomposition control dictionary"; + object decomposeParDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +numberOfSubdomains 2; + +method hierarchical; + +hierarchicalCoeffs +{ + n (1 2 1); + delta 0.001; + order xyz; +} + +// ************************************************************************* // diff --git a/applications/test/mapDistributePolyMesh/cavity/system/decomposeParDict-scotch b/applications/test/mapDistributePolyMesh/cavity/system/decomposeParDict-scotch new file mode 100644 index 0000000000..9df92a84e4 --- /dev/null +++ b/applications/test/mapDistributePolyMesh/cavity/system/decomposeParDict-scotch @@ -0,0 +1,28 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + note "mesh decomposition control dictionary"; + object decomposeParDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +numberOfSubdomains 2; + +//method scotch; +method hierarchical; +hierarchicalCoeffs +{ + n (2 1 1); + delta 0.001; + order xyz; +} +// ************************************************************************* // diff --git a/applications/test/mapDistributePolyMesh/cavity/system/fvSchemes b/applications/test/mapDistributePolyMesh/cavity/system/fvSchemes new file mode 100644 index 0000000000..b43ea748ac --- /dev/null +++ b/applications/test/mapDistributePolyMesh/cavity/system/fvSchemes @@ -0,0 +1,51 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object fvSchemes; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +ddtSchemes +{ + default Euler; +} + +gradSchemes +{ + default Gauss linear; + grad(p) Gauss linear; +} + +divSchemes +{ + default none; + div(phi,U) Gauss linear; +} + +laplacianSchemes +{ + default Gauss linear orthogonal; +} + +interpolationSchemes +{ + default linear; +} + +snGradSchemes +{ + default orthogonal; +} + + +// ************************************************************************* // diff --git a/applications/test/mapDistributePolyMesh/cavity/system/fvSolution b/applications/test/mapDistributePolyMesh/cavity/system/fvSolution new file mode 100644 index 0000000000..3be65f5ab5 --- /dev/null +++ b/applications/test/mapDistributePolyMesh/cavity/system/fvSolution @@ -0,0 +1,46 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object fvSolution; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +solvers +{ + "(p|pFinal)" + { + solver PCG; + preconditioner DIC; + tolerance 1e-06; + relTol 0; + } + + U + { + solver smoothSolver; + smoother symGaussSeidel; + tolerance 1e-05; + relTol 0; + } +} + +PISO +{ + nCorrectors 2; + nNonOrthogonalCorrectors 0; + pRefCell 0; + pRefValue 0; +} + + +// ************************************************************************* // diff --git a/applications/test/mapDistributePolyMesh/cavity/system/processorField b/applications/test/mapDistributePolyMesh/cavity/system/processorField new file mode 100644 index 0000000000..19c72f5418 --- /dev/null +++ b/applications/test/mapDistributePolyMesh/cavity/system/processorField @@ -0,0 +1,64 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object postProcessingDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +functions +{ + processorField + { + // Type of functionObject + type processorField; + + // Where to load it from (if not already in solver) + libs ("libfieldFunctionObjects.so"); + + // Function object enabled flag + enabled true; + + // When to output the average fields + writeControl writeTime; + } + cellID + { + // Load the library containing the 'coded' functionObject + functionObjectLibs ("libutilityFunctionObjects.so"); + type coded; + // Name of on-the-fly generated functionObject + redirectType cellID; + codeExecute + #{ + volScalarField cellID + ( + IOobject + ( + "cellID", + mesh().time().timeName(), + mesh(), + IOobject::NO_READ + ), + mesh(), + dimensionedScalar("cellID", dimless, 0) + ); + forAll(cellID, celli) + { + cellID[celli] = celli; + } + cellID.correctBoundaryConditions(); + cellID.write(); + #}; + } +} + +// ************************************************************************* // diff --git a/applications/test/mapDistributePolyMesh/cavity/system/renumberMeshDict-random b/applications/test/mapDistributePolyMesh/cavity/system/renumberMeshDict-random new file mode 100644 index 0000000000..67631d08ee --- /dev/null +++ b/applications/test/mapDistributePolyMesh/cavity/system/renumberMeshDict-random @@ -0,0 +1,112 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + note "mesh renumbering dictionary"; + object renumberMeshDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +// Write maps from renumbered back to original mesh +writeMaps true; + +// Optional entry: sort cells on coupled boundaries to last for use with +// e.g. nonBlockingGaussSeidel. +sortCoupledFaceCells false; + +// Optional entry: renumber on a block-by-block basis. It uses a +// blockCoeffs dictionary to construct a decompositionMethod to do +// a block subdivision) and then applies the renumberMethod to each +// block in turn. This can be used in large cases to keep the blocks +// fitting in cache with all the the cache misses bunched at the end. +// This number is the approximate size of the blocks - this gets converted +// to a number of blocks that is the input to the decomposition method. +//blockSize 1000; + +// Optional entry: sort points into internal and boundary points +//orderPoints false; + +// Optional: suppress renumbering cellSets,faceSets,pointSets +//renumberSets false; + + +//method CuthillMcKee; +//method Sloan; +//method manual; +method random; +//method structured; +//method spring; +//method zoltan; // only if compiled with zoltan support + +//CuthillMcKeeCoeffs +//{ +// // Reverse CuthillMcKee (RCM) or plain +// reverse true; +//} + +manualCoeffs +{ + // In system directory: new-to-original (i.e. order) labelIOList + dataFile "cellMap"; +} + + +// For extruded (i.e. structured in one direction) meshes +structuredCoeffs +{ + // Patches that mesh was extruded from. These determine the starting + // layer of cells + patches (movingWall); + // Method to renumber the starting layer of cells + method random; + + // Renumber in columns (depthFirst) or in layers + depthFirst true; + + // Reverse ordering + reverse false; +} + + +springCoeffs +{ + // Maximum jump of cell indices. Is fraction of number of cells + maxCo 0.01; + + // Limit the amount of movement; the fraction maxCo gets decreased + // with every iteration + freezeFraction 0.999; + + // Maximum number of iterations + maxIter 1000; +} + + +blockCoeffs +{ + method scotch; + //method hierarchical; + //hierarchicalCoeffs + //{ + // n (1 2 1); + // delta 0.001; + // order xyz; + //} +} + + +zoltanCoeffs +{ + ORDER_METHOD LOCAL_HSFC; +} + + +// ************************************************************************* // diff --git a/applications/utilities/parallelProcessing/redistributePar/parFvFieldReconstructorReconstructFields.C b/applications/utilities/parallelProcessing/redistributePar/parFvFieldReconstructorReconstructFields.C index 3df020099f..c561dc7183 100644 --- a/applications/utilities/parallelProcessing/redistributePar/parFvFieldReconstructorReconstructFields.C +++ b/applications/utilities/parallelProcessing/redistributePar/parFvFieldReconstructorReconstructFields.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2015 OpenFOAM Foundation - \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. + \\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -66,7 +66,7 @@ Foam::parFvFieldReconstructor::reconstructFvVolumeInternalField IOobject::NO_WRITE ); - return tmp> + tmp> tfield ( new DimensionedField ( @@ -76,6 +76,10 @@ Foam::parFvFieldReconstructor::reconstructFvVolumeInternalField internalField ) ); + + tfield.ref().oriented() = fld.oriented(); + + return tfield; } @@ -209,7 +213,7 @@ Foam::parFvFieldReconstructor::reconstructFvVolumeField IOobject::NO_WRITE ); - return tmp> + tmp> tfield ( new GeometricField ( @@ -220,6 +224,10 @@ Foam::parFvFieldReconstructor::reconstructFvVolumeField basePatchFields ) ); + + tfield.ref().oriented()= fld.oriented(); + + return tfield; } @@ -269,7 +277,7 @@ Foam::parFvFieldReconstructor::reconstructFvSurfaceField } // Map all faces - Field internalField(flatFld, mapper); + Field internalField(flatFld, mapper, fld.oriented()()); // Trim to internal faces (note: could also have special mapper) internalField.setSize @@ -372,7 +380,7 @@ Foam::parFvFieldReconstructor::reconstructFvSurfaceField IOobject::NO_WRITE ); - return tmp> + tmp> tfield ( new GeometricField ( @@ -383,6 +391,10 @@ Foam::parFvFieldReconstructor::reconstructFvSurfaceField basePatchFields ) ); + + tfield.ref().oriented() = fld.oriented(); + + return tfield; } diff --git a/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK.C b/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK.C index 602f68b2d0..dcf612a663 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK.C +++ b/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK.C @@ -341,6 +341,7 @@ int main(int argc, char *argv[]) #include "createTime.H" + const bool decomposePoly = !args.optionFound("poly"); const bool doWriteInternal = !args.optionFound("noInternal"); const bool doFaceZones = !args.optionFound("noFaceZones"); const bool doLinks = !args.optionFound("noLinks"); @@ -349,7 +350,7 @@ int main(int argc, char *argv[]) const bool noLagrangian = args.optionFound("noLagrangian"); // Decomposition of polyhedral cells into tets/pyramids cells - vtkTopo::decomposePoly = !args.optionFound("poly"); + vtkTopo::decomposePoly = decomposePoly; if (binary && (sizeof(floatScalar) != 4 || sizeof(label) != 4)) { @@ -410,8 +411,6 @@ int main(int argc, char *argv[]) args.optionReadIfPresent("pointSet", pointSetName); - instantList timeDirs = timeSelector::select0(runTime, args); - #include "createNamedMesh.H" // VTK/ directory in the case @@ -449,6 +448,9 @@ int main(int argc, char *argv[]) mkDir(fvPath); + instantList timeDirs = timeSelector::select0(runTime, args); + + // Mesh wrapper: does subsetting and decomposition vtkMesh vMesh(mesh, cellSetName); @@ -492,7 +494,7 @@ int main(int argc, char *argv[]) // Filename as if patch with same name. mkDir(fvPath/set.name()); - fileName patchFileName + fileName outputName ( fvPath/set.name()/set.name() + "_" @@ -500,12 +502,12 @@ int main(int argc, char *argv[]) + ".vtk" ); - Info<< " FaceSet : " << patchFileName << endl; - - writeFaceSet(binary, vMesh.mesh(), set, patchFileName); + Info<< " faceSet : " << outputName << endl; + writeFaceSet(binary, vMesh.mesh(), set, outputName); continue; } + // If pointSet: write pointSet only (as polydata) if (pointSetName.size()) { @@ -515,7 +517,7 @@ int main(int argc, char *argv[]) // Filename as if patch with same name. mkDir(fvPath/set.name()); - fileName patchFileName + fileName outputName ( fvPath/set.name()/set.name() + "_" @@ -523,10 +525,9 @@ int main(int argc, char *argv[]) + ".vtk" ); - Info<< " pointSet : " << patchFileName << endl; - - writePointSet(binary, vMesh.mesh(), set, patchFileName); + Info<< " pointSet : " << outputName << endl; + writePointSet(binary, vMesh.mesh(), set, outputName); continue; } @@ -868,11 +869,11 @@ int main(int argc, char *argv[]) { mkDir(fvPath/"allPatches"); - fileName patchFileName; + fileName outputName; if (vMesh.useSubMesh()) { - patchFileName = + outputName = fvPath/"allPatches"/cellSetName + "_" + timeDesc @@ -880,21 +881,21 @@ int main(int argc, char *argv[]) } else { - patchFileName = + outputName = fvPath/"allPatches"/"allPatches" + "_" + timeDesc + ".vtk"; } - Info<< " Combined patches : " << patchFileName << endl; + Info<< " Combined patches : " << outputName << endl; patchWriter writer ( vMesh.mesh(), binary, nearCellValue, - patchFileName, + outputName, getSelectedPatches(patches, excludePatches) ); @@ -946,11 +947,11 @@ int main(int argc, char *argv[]) { mkDir(fvPath/pp.name()); - fileName patchFileName; + fileName outputName; if (vMesh.useSubMesh()) { - patchFileName = + outputName = fvPath/pp.name()/cellSetName + "_" + timeDesc @@ -958,22 +959,22 @@ int main(int argc, char *argv[]) } else { - patchFileName = + outputName = fvPath/pp.name()/pp.name() + "_" + timeDesc + ".vtk"; } - Info<< " Patch : " << patchFileName << endl; + Info<< " Patch : " << outputName << endl; patchWriter writer ( vMesh.mesh(), binary, nearCellValue, - patchFileName, - labelList(1, patchi) + outputName, + labelList{patchi} ); if (!isA(pp)) @@ -1068,11 +1069,11 @@ int main(int argc, char *argv[]) mkDir(fvPath/fz.name()); - fileName patchFileName; + fileName outputName; if (vMesh.useSubMesh()) { - patchFileName = + outputName = fvPath/fz.name()/cellSetName + "_" + timeDesc @@ -1080,14 +1081,14 @@ int main(int argc, char *argv[]) } else { - patchFileName = + outputName = fvPath/fz.name()/fz.name() + "_" + timeDesc + ".vtk"; } - Info<< " FaceZone : " << patchFileName << endl; + Info<< " FaceZone : " << outputName << endl; indirectPrimitivePatch pp ( @@ -1100,7 +1101,7 @@ int main(int argc, char *argv[]) binary, pp, fz.name(), - patchFileName + outputName ); // Number of fields @@ -1131,14 +1132,13 @@ int main(int argc, char *argv[]) // Always create the cloud directory. mkDir(fvPath/cloud::prefix/cloudName); - fileName lagrFileName + fileName outputName ( fvPath/cloud::prefix/cloudName/cloudName + "_" + timeDesc + ".vtk" ); - Info<< " Lagrangian: " << lagrFileName << endl; - + Info<< " Lagrangian: " << outputName << endl; IOobjectList sprayObjs ( @@ -1189,7 +1189,7 @@ int main(int argc, char *argv[]) ( vMesh.mesh(), binary, - lagrFileName, + outputName, cloudName, false ); @@ -1219,7 +1219,7 @@ int main(int argc, char *argv[]) ( vMesh.mesh(), binary, - lagrFileName, + outputName, cloudName, true ); diff --git a/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK/writeFuns.H b/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK/writeFuns.H index 1776eefe09..60fe2a6d01 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK/writeFuns.H +++ b/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK/writeFuns.H @@ -104,6 +104,7 @@ public: //- Append elements to DynamicList static void insert(const labelList&, DynamicList