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/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/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/src/OpenFOAM/Make/files b/src/OpenFOAM/Make/files index 41d694211a..f95dc85741 100644 --- a/src/OpenFOAM/Make/files +++ b/src/OpenFOAM/Make/files @@ -275,6 +275,8 @@ dimensionedTypes/dimensionedSphericalTensor/dimensionedSphericalTensor.C dimensionedTypes/dimensionedSymmTensor/dimensionedSymmTensor.C dimensionedTypes/dimensionedTensor/dimensionedTensor.C +orientedType/orientedType.C + matrices/solution/solution.C scalarMatrices = matrices/scalarMatrices diff --git a/src/OpenFOAM/fields/DimensionedFields/DimensionedField/DimensionedField.C b/src/OpenFOAM/fields/DimensionedFields/DimensionedField/DimensionedField.C index 5823ee3f57..e4717cd7fe 100644 --- a/src/OpenFOAM/fields/DimensionedFields/DimensionedField/DimensionedField.C +++ b/src/OpenFOAM/fields/DimensionedFields/DimensionedField/DimensionedField.C @@ -80,7 +80,8 @@ DimensionedField::DimensionedField regIOobject(io), Field(field), mesh_(mesh), - dimensions_(dims) + dimensions_(dims), + oriented_() { checkFieldSize(); } @@ -134,7 +135,8 @@ DimensionedField::DimensionedField regIOobject(io), Field(GeoMesh::size(mesh)), mesh_(mesh), - dimensions_(dims) + dimensions_(dims), + oriented_() { if (checkIOFlags) { @@ -155,7 +157,8 @@ DimensionedField::DimensionedField regIOobject(io), Field(GeoMesh::size(mesh), dt.value()), mesh_(mesh), - dimensions_(dt.dimensions()) + dimensions_(dt.dimensions()), + oriented_() { if (checkIOFlags) { @@ -173,7 +176,8 @@ DimensionedField::DimensionedField regIOobject(df), Field(df), mesh_(df.mesh_), - dimensions_(df.dimensions_) + dimensions_(df.dimensions_), + oriented_(df.oriented_) {} @@ -187,7 +191,8 @@ DimensionedField::DimensionedField regIOobject(df, reuse), Field(df, reuse), mesh_(df.mesh_), - dimensions_(df.dimensions_) + dimensions_(df.dimensions_), + oriented_(df.oriented_) {} @@ -200,7 +205,8 @@ DimensionedField::DimensionedField regIOobject(df(), true), Field(df), mesh_(df->mesh_), - dimensions_(df->dimensions_) + dimensions_(df->dimensions_), + oriented_(df->oriented_) {} @@ -218,7 +224,8 @@ DimensionedField::DimensionedField tdf.isTmp() ), mesh_(tdf().mesh_), - dimensions_(tdf().dimensions_) + dimensions_(tdf().dimensions_), + oriented_(tdf().oriented_) { tdf.clear(); } @@ -235,7 +242,8 @@ DimensionedField::DimensionedField regIOobject(io), Field(df), mesh_(df.mesh_), - dimensions_(df.dimensions_) + dimensions_(df.dimensions_), + oriented_(df.oriented_) {} @@ -250,7 +258,8 @@ DimensionedField::DimensionedField regIOobject(io, df), Field(df, reuse), mesh_(df.mesh_), - dimensions_(df.dimensions_) + dimensions_(df.dimensions_), + oriented_(df.oriented_) {} @@ -264,7 +273,8 @@ DimensionedField::DimensionedField regIOobject(newName, df, newName == df.name()), Field(df), mesh_(df.mesh_), - dimensions_(df.dimensions_) + dimensions_(df.dimensions_), + oriented_(df.oriented_) {} @@ -279,7 +289,8 @@ DimensionedField::DimensionedField regIOobject(newName, df, true), Field(df, reuse), mesh_(df.mesh_), - dimensions_(df.dimensions_) + dimensions_(df.dimensions_), + oriented_(df.oriented_) {} @@ -293,7 +304,8 @@ DimensionedField::DimensionedField regIOobject(newName, df, true), Field(df), mesh_(df->mesh_), - dimensions_(df->dimensions_) + dimensions_(df->dimensions_), + oriented_(df->oriented_) {} @@ -312,7 +324,8 @@ DimensionedField::DimensionedField tdf.isTmp() ), mesh_(tdf().mesh_), - dimensions_(tdf().dimensions_) + dimensions_(tdf().dimensions_), + oriented_(tdf().oriented_) { tdf.clear(); } @@ -487,6 +500,7 @@ void DimensionedField::operator= checkField(*this, df, "="); dimensions_ = df.dimensions(); + oriented_ = df.oriented(); Field::operator=(df); } @@ -510,6 +524,7 @@ void DimensionedField::operator= checkField(*this, df, "="); dimensions_ = df.dimensions(); + oriented_ = df.oriented(); this->transfer(const_cast&>(df)); tdf.clear(); } @@ -537,6 +552,7 @@ void DimensionedField::operator op \ checkField(*this, df, #op); \ \ dimensions_ op df.dimensions(); \ + oriented_ op df.oriented(); \ Field::operator op(df); \ } \ \ diff --git a/src/OpenFOAM/fields/DimensionedFields/DimensionedField/DimensionedField.H b/src/OpenFOAM/fields/DimensionedFields/DimensionedField/DimensionedField.H index b37c63724f..e37bcccc21 100644 --- a/src/OpenFOAM/fields/DimensionedFields/DimensionedField/DimensionedField.H +++ b/src/OpenFOAM/fields/DimensionedFields/DimensionedField/DimensionedField.H @@ -41,6 +41,7 @@ SourceFiles #include "regIOobject.H" #include "Field.H" #include "dimensionedType.H" +#include "orientedType.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -65,7 +66,7 @@ template Ostream& operator<< /*---------------------------------------------------------------------------*\ - Class DimensionedField Declaration + Class DimensionedField Declaration \*---------------------------------------------------------------------------*/ template @@ -99,6 +100,9 @@ private: //- Dimension set for this field dimensionSet dimensions_; + //- Oriented flag + orientedType oriented_; + // Private Member Functions @@ -283,6 +287,15 @@ public: //- Return non-const access to dimensions inline dimensionSet& dimensions(); + //- Return oriented type + inline const orientedType& oriented() const; + + //- Return non-const access to the oriented type + inline orientedType& oriented(); + + //- Set the oriented flag + inline void setOriented(const bool oriented = true); + //- Return field inline const Field& field() const; diff --git a/src/OpenFOAM/fields/DimensionedFields/DimensionedField/DimensionedFieldFunctionsM.C b/src/OpenFOAM/fields/DimensionedFields/DimensionedField/DimensionedFieldFunctionsM.C index 6da09d945c..8e69d61745 100644 --- a/src/OpenFOAM/fields/DimensionedFields/DimensionedField/DimensionedFieldFunctionsM.C +++ b/src/OpenFOAM/fields/DimensionedFields/DimensionedField/DimensionedFieldFunctionsM.C @@ -52,6 +52,8 @@ tmp> Func \ \ Func(tRes.ref().field(), df1.field()); \ \ + tRes.ref().oriented() = Dfunc(df1.oriented()); \ + \ return tRes; \ } \ \ @@ -75,6 +77,8 @@ tmp> Func \ \ Func(tRes.ref().field(), df1.field()); \ \ + tRes.ref().oriented() = Dfunc(df1.oriented()); \ + \ tdf1.clear(); \ \ return tRes; \ @@ -108,6 +112,8 @@ tmp> operator Op \ \ Foam::OpFunc(tRes.ref().field(), df1.field()); \ \ + tRes.ref().oriented() = Dfunc(df1.oriented()); \ + \ return tRes; \ } \ \ @@ -131,6 +137,8 @@ tmp> operator Op \ \ Foam::OpFunc(tRes.ref().field(), df1.field()); \ \ + tRes.ref().oriented() = Dfunc(df1.oriented()); \ + \ tdf1.clear(); \ \ return tRes; \ @@ -165,6 +173,8 @@ tmp> Func \ \ Func(tRes.ref().field(), df1.field(), df2.field()); \ \ + tRes.ref().oriented() = Func(df1.oriented(), df2.oriented()); \ + \ return tRes; \ } \ \ @@ -189,6 +199,8 @@ tmp> Func \ \ Func(tRes.ref().field(), df1.field(), df2.field()); \ \ + tRes.ref().oriented() = Func(df1.oriented(), df2.oriented()); \ + \ tdf2.clear(); \ \ return tRes; \ @@ -215,6 +227,8 @@ tmp> Func \ \ Func(tRes.ref().field(), df1.field(), df2.field()); \ \ + tRes.ref().oriented() = Func(df1.oriented(), df2.oriented()); \ + \ tdf1.clear(); \ \ return tRes; \ @@ -244,6 +258,8 @@ tmp> Func \ \ Func(tRes.ref().field(), df1.field(), df2.field()); \ \ + tRes.ref().oriented() = Func(df1.oriented(), df2.oriented()); \ + \ tdf1.clear(); \ tdf2.clear(); \ \ @@ -279,6 +295,8 @@ tmp> Func \ \ Func(tRes.ref().field(), dt1.value(), df2.field()); \ \ + tRes.ref().oriented() = df2.oriented(); \ + \ return tRes; \ } \ \ @@ -314,6 +332,8 @@ tmp> Func \ \ Func(tRes.ref().field(), dt1.value(), df2.field()); \ \ + tRes.ref().oriented() = df2.oriented(); \ + \ tdf2.clear(); \ \ return tRes; \ @@ -356,6 +376,8 @@ tmp> Func \ \ Func(tRes.ref().field(), df1.field(), dt2.value()); \ \ + tRes.ref().oriented() = df1.oriented(); \ + \ return tRes; \ } \ \ @@ -391,6 +413,8 @@ tmp> Func \ \ Func(tRes.ref().field(), df1.field(), dt2.value()); \ \ + tRes.ref().oriented() = df1.oriented(); \ + \ tdf1.clear(); \ \ return tRes; \ @@ -440,6 +464,8 @@ tmp> operator Op \ \ Foam::OpFunc(tRes.ref().field(), df1.field(), df2.field()); \ \ + tRes.ref().oriented() = df1.oriented() Op df2.oriented(); \ + \ return tRes; \ } \ \ @@ -464,6 +490,8 @@ tmp> operator Op \ \ Foam::OpFunc(tRes.ref().field(), df1.field(), df2.field()); \ \ + tRes.ref().oriented() = df1.oriented() Op df2.oriented(); \ + \ tdf2.clear(); \ \ return tRes; \ @@ -490,6 +518,8 @@ tmp> operator Op \ \ Foam::OpFunc(tRes.ref().field(), df1.field(), df2.field()); \ \ + tRes.ref().oriented() = df1.oriented() Op df2.oriented(); \ + \ tdf1.clear(); \ \ return tRes; \ @@ -519,6 +549,8 @@ tmp> operator Op \ \ Foam::OpFunc(tRes.ref().field(), df1.field(), df2.field()); \ \ + tRes.ref().oriented() = df1.oriented() Op df2.oriented(); \ + \ tdf1.clear(); \ tdf2.clear(); \ \ @@ -528,7 +560,7 @@ tmp> operator Op \ // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -#define BINARY_TYPE_OPERATOR_SF(ReturnType, Type1, Type2, Op, OpName, OpFunc) \ +#define BINARY_TYPE_OPERATOR_SF(ReturnType, Type1, Type2, Op, OpName, OpFunc) \ \ TEMPLATE \ tmp> operator Op \ @@ -552,6 +584,8 @@ tmp> operator Op \ ) \ ); \ \ + tRes.ref().oriented() = df2.oriented(); \ + \ Foam::OpFunc(tRes.ref().field(), dt1.value(), df2.field()); \ \ return tRes; \ @@ -589,6 +623,8 @@ tmp> operator Op \ \ Foam::OpFunc(tRes.ref().field(), dt1.value(), tdf2().field()); \ \ + tRes.ref().oriented() = df2.oriented(); \ + \ tdf2.clear(); \ \ return tRes; \ @@ -605,7 +641,7 @@ tmp> operator Op \ } -#define BINARY_TYPE_OPERATOR_FS(ReturnType, Type1, Type2, Op, OpName, OpFunc) \ +#define BINARY_TYPE_OPERATOR_FS(ReturnType, Type1, Type2, Op, OpName, OpFunc) \ \ TEMPLATE \ tmp> operator Op \ @@ -631,6 +667,8 @@ tmp> operator Op \ \ Foam::OpFunc(tRes.ref().field(), df1.field(), dt2.value()); \ \ + tRes.ref().oriented() = df1.oriented(); \ + \ return tRes; \ } \ \ @@ -666,6 +704,8 @@ tmp> operator Op \ \ Foam::OpFunc(tRes.ref().field(), tdf1().field(), dt2.value()); \ \ + tRes.ref().oriented() = df1.oriented(); \ + \ tdf1.clear(); \ \ return tRes; \ diff --git a/src/OpenFOAM/fields/DimensionedFields/DimensionedField/DimensionedFieldI.H b/src/OpenFOAM/fields/DimensionedFields/DimensionedField/DimensionedFieldI.H index 64cfd31589..b4a5b5d8b5 100644 --- a/src/OpenFOAM/fields/DimensionedFields/DimensionedField/DimensionedFieldI.H +++ b/src/OpenFOAM/fields/DimensionedFields/DimensionedField/DimensionedFieldI.H @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -48,14 +48,39 @@ Foam::DimensionedField::dimensions() const return dimensions_; } + template -inline Foam::dimensionSet& -Foam::DimensionedField::dimensions() +inline Foam::dimensionSet& Foam::DimensionedField::dimensions() { return dimensions_; } +template +inline const Foam::orientedType& +Foam::DimensionedField::oriented() const +{ + return oriented_; +} + + +template +inline Foam::orientedType& Foam::DimensionedField::oriented() +{ + return oriented_; +} + + +template +inline void Foam::DimensionedField::setOriented +( + const bool oriented +) +{ + oriented_.setOriented(oriented); +} + + template inline const Foam::Field& Foam::DimensionedField::field() const @@ -63,6 +88,7 @@ Foam::DimensionedField::field() const return *this; } + template inline Foam::Field& Foam::DimensionedField::field() diff --git a/src/OpenFOAM/fields/DimensionedFields/DimensionedField/DimensionedFieldIO.C b/src/OpenFOAM/fields/DimensionedFields/DimensionedField/DimensionedFieldIO.C index 74da71025c..7bbd460d36 100644 --- a/src/OpenFOAM/fields/DimensionedFields/DimensionedField/DimensionedFieldIO.C +++ b/src/OpenFOAM/fields/DimensionedFields/DimensionedField/DimensionedFieldIO.C @@ -37,6 +37,7 @@ void Foam::DimensionedField::readField ) { dimensions_.reset(dimensionSet(fieldDict.lookup("dimensions"))); + oriented_.read(fieldDict); Field f(fieldDictEntry, fieldDict, GeoMesh::size(mesh_)); this->transfer(f); @@ -74,7 +75,8 @@ Foam::DimensionedField::DimensionedField regIOobject(io), Field(0), mesh_(mesh), - dimensions_(dimless) + dimensions_(dimless), + oriented_() { readField(dictionary(readStream(typeName)), fieldDictEntry); } @@ -92,7 +94,8 @@ Foam::DimensionedField::DimensionedField regIOobject(io), Field(0), mesh_(mesh), - dimensions_(dimless) + dimensions_(dimless), + oriented_() { readField(fieldDict, fieldDictEntry); } @@ -107,17 +110,15 @@ bool Foam::DimensionedField::writeData const word& fieldDictEntry ) const { - os.writeKeyword("dimensions") << dimensions() << token::END_STATEMENT - << nl << nl; + os.writeEntry("dimensions", dimensions()); + oriented_.writeEntry(os); + + os<< nl << nl; Field::writeEntry(fieldDictEntry, os); // Check state of Ostream - os.check - ( - "bool DimensionedField::writeData" - "(Ostream& os, const word& fieldDictEntry) const" - ); + os.check(FUNCTION_NAME); return (os.good()); } diff --git a/src/OpenFOAM/fields/Fields/Field/Field.C b/src/OpenFOAM/fields/Fields/Field/Field.C index f60ed5047b..f6ca2a766c 100644 --- a/src/OpenFOAM/fields/Fields/Field/Field.C +++ b/src/OpenFOAM/fields/Fields/Field/Field.C @@ -28,7 +28,6 @@ License #include "dictionary.H" #include "contiguous.H" #include "mapDistributeBase.H" -#include "flipOp.H" // * * * * * * * * * * * * * * * Static Members * * * * * * * * * * * * * * // diff --git a/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.C b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.C index b75ce6c3eb..74ba7e39e2 100644 --- a/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.C +++ b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.C @@ -1175,6 +1175,7 @@ void Foam::GeometricField::operator= // Only assign field contents not ID this->dimensions() = gf.dimensions(); + this->oriented() = gf.oriented(); if (tgf.isTmp()) { @@ -1246,7 +1247,7 @@ void Foam::GeometricField::operator op \ { \ checkField(*this, gf, #op); \ \ - ref() op gf(); \ + ref() op gf(); \ boundaryFieldRef() op gf.boundaryField(); \ } \ \ @@ -1266,7 +1267,7 @@ void Foam::GeometricField::operator op \ const dimensioned& dt \ ) \ { \ - ref() op dt; \ + ref() op dt; \ boundaryFieldRef() op dt.value(); \ } diff --git a/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricFieldFunctions.C b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricFieldFunctions.C index 49a7ce2d62..4113b1d752 100644 --- a/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricFieldFunctions.C +++ b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricFieldFunctions.C @@ -51,6 +51,7 @@ void component { component(gcf.primitiveFieldRef(), gf.primitiveField(), d); component(gcf.boundaryFieldRef(), gf.boundaryField(), d); + gcf.oriented() = gf.oriented(); } @@ -63,6 +64,7 @@ void T { T(gf.primitiveFieldRef(), gf1.primitiveField()); T(gf.boundaryFieldRef(), gf1.boundaryField()); + gf.oriented() = gf1.oriented(); } @@ -81,6 +83,7 @@ void pow { pow(gf.primitiveFieldRef(), gf1.primitiveField(), r); pow(gf.boundaryFieldRef(), gf1.boundaryField(), r); + gf.oriented() = pow(gf1.oriented(), r); } template @@ -175,6 +178,7 @@ void sqr { sqr(gf.primitiveFieldRef(), gf1.primitiveField()); sqr(gf.boundaryFieldRef(), gf1.boundaryField()); + gf.oriented() = sqr(gf1.oriented()); } template class PatchField, class GeoMesh> @@ -263,6 +267,7 @@ void magSqr { magSqr(gsf.primitiveFieldRef(), gf.primitiveField()); magSqr(gsf.boundaryFieldRef(), gf.boundaryField()); + gsf.oriented() = magSqr(gf.oriented()); } template class PatchField, class GeoMesh> @@ -335,6 +340,7 @@ void mag { mag(gsf.primitiveFieldRef(), gf.primitiveField()); mag(gsf.boundaryFieldRef(), gf.boundaryField()); + gsf.oriented() = mag(gf.oriented()); } template class PatchField, class GeoMesh> @@ -412,6 +418,7 @@ void cmptAv { cmptAv(gcf.primitiveFieldRef(), gf.primitiveField()); cmptAv(gcf.boundaryFieldRef(), gf.boundaryField()); + gcf.oriented() = cmptAv(gf.oriented()); } template class PatchField, class GeoMesh> @@ -611,6 +618,8 @@ void opFunc \ gf1.boundaryField(), \ gf2.boundaryField() \ ); \ + \ + gf.oriented() = gf1.oriented() op gf2.oriented(); \ } \ \ template \ @@ -757,6 +766,7 @@ void opFunc \ { \ Foam::opFunc(gf.primitiveFieldRef(), gf1.primitiveField(), dvs.value()); \ Foam::opFunc(gf.boundaryFieldRef(), gf1.boundaryField(), dvs.value()); \ + gf.oriented() = gf1.oriented(); \ } \ \ template \ @@ -870,6 +880,7 @@ void opFunc \ { \ Foam::opFunc(gf.primitiveFieldRef(), dvs.value(), gf1.primitiveField()); \ Foam::opFunc(gf.boundaryFieldRef(), dvs.value(), gf1.boundaryField()); \ + gf.oriented() = gf1.oriented(); \ } \ \ template \ diff --git a/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricFieldFunctionsM.C b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricFieldFunctionsM.C index 377339dae9..9ff2ed8639 100644 --- a/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricFieldFunctionsM.C +++ b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricFieldFunctionsM.C @@ -43,6 +43,7 @@ void Func \ { \ Foam::Func(res.primitiveFieldRef(), gf1.primitiveField()); \ Foam::Func(res.boundaryFieldRef(), gf1.boundaryField()); \ + res.oriented() = gf1.oriented(); \ } \ \ TEMPLATE \ @@ -112,6 +113,7 @@ void OpFunc \ { \ Foam::OpFunc(res.primitiveFieldRef(), gf1.primitiveField()); \ Foam::OpFunc(res.boundaryFieldRef(), gf1.boundaryField()); \ + res.oriented() = gf1.oriented(); \ } \ \ TEMPLATE \ @@ -192,6 +194,7 @@ void Func \ gf1.boundaryField(), \ gf2.boundaryField() \ ); \ + res.oriented() = Func(gf1.oriented(), gf2.oriented()); \ } \ \ TEMPLATE \ @@ -320,6 +323,7 @@ void Func \ { \ Foam::Func(res.primitiveFieldRef(), dt1.value(), gf2.primitiveField()); \ Foam::Func(res.boundaryFieldRef(), dt1.value(), gf2.boundaryField()); \ + res.oriented() = gf2.oriented(); \ } \ \ TEMPLATE \ @@ -411,6 +415,7 @@ void Func \ { \ Foam::Func(res.primitiveFieldRef(), gf1.primitiveField(), dt2.value()); \ Foam::Func(res.boundaryFieldRef(), gf1.boundaryField(), dt2.value()); \ + res.oriented() = gf1.oriented(); \ } \ \ TEMPLATE \ @@ -511,6 +516,7 @@ void OpFunc \ (res.primitiveFieldRef(), gf1.primitiveField(), gf2.primitiveField()); \ Foam::OpFunc \ (res.boundaryFieldRef(), gf1.boundaryField(), gf2.boundaryField()); \ + res.oriented() = gf1.oriented() Op gf2.oriented(); \ } \ \ TEMPLATE \ @@ -639,6 +645,8 @@ void OpFunc \ { \ Foam::OpFunc(res.primitiveFieldRef(), dt1.value(), gf2.primitiveField()); \ Foam::OpFunc(res.boundaryFieldRef(), dt1.value(), gf2.boundaryField()); \ + res.oriented() = gf2.oriented(); \ + \ } \ \ TEMPLATE \ @@ -730,6 +738,7 @@ void OpFunc \ { \ Foam::OpFunc(res.primitiveFieldRef(), gf1.primitiveField(), dt2.value()); \ Foam::OpFunc(res.boundaryFieldRef(), gf1.boundaryField(), dt2.value()); \ + res.oriented() = gf1.oriented(); \ } \ \ TEMPLATE \ diff --git a/src/OpenFOAM/fields/GeometricFields/GeometricField/MapGeometricFields.H b/src/OpenFOAM/fields/GeometricFields/GeometricField/MapGeometricFields.H index 93a47eda9f..864318a4b0 100644 --- a/src/OpenFOAM/fields/GeometricFields/GeometricField/MapGeometricFields.H +++ b/src/OpenFOAM/fields/GeometricFields/GeometricField/MapGeometricFields.H @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -51,7 +51,7 @@ public: void operator() ( - Field& field, + DimensionedField& field, const MeshMapper& mapper ) const; }; @@ -72,10 +72,12 @@ void MapGeometricFields const MeshMapper& mapper ) { - HashTable*> fields + typedef GeometricField FieldType; + + HashTable fields ( mapper.thisDb().objectRegistry::template - lookupClass>() + lookupClass() ); // It is necessary to enforce that all old-time fields are stored @@ -83,17 +85,9 @@ void MapGeometricFields // old-time-level field is mapped before the field itself, sizes // will not match. - for - ( - typename HashTable*>:: - iterator fieldIter = fields.begin(); - fieldIter != fields.end(); - ++fieldIter - ) + forAllConstIter(typename HashTable, fields, fieldIter) { - GeometricField& field = - const_cast&> - (*fieldIter()); + FieldType& field = const_cast(*fieldIter()); //Note: check can be removed once pointFields are actually stored on // the pointMesh instead of now on the polyMesh! @@ -103,17 +97,9 @@ void MapGeometricFields } } - for - ( - typename HashTable*>:: - iterator fieldIter = fields.begin(); - fieldIter != fields.end(); - ++fieldIter - ) + forAllConstIter(typename HashTable, fields, fieldIter) { - GeometricField& field = - const_cast&> - (*fieldIter()); + FieldType& field = const_cast(*fieldIter()); if (&field.mesh() == &mapper.mesh()) { @@ -124,15 +110,11 @@ void MapGeometricFields } // Map the internal field - MapInternalField() - ( - field.primitiveFieldRef(), - mapper - ); + MapInternalField()(field.ref(), mapper); // Map the patch fields - typename GeometricField - ::Boundary& bfield = field.boundaryFieldRef(); + typename FieldType::Boundary& bfield = field.boundaryFieldRef(); + forAll(bfield, patchi) { // Cannot check sizes for patch fields because of diff --git a/src/OpenFOAM/orientedType/orientedType.C b/src/OpenFOAM/orientedType/orientedType.C new file mode 100644 index 0000000000..4a04453ac0 --- /dev/null +++ b/src/OpenFOAM/orientedType/orientedType.C @@ -0,0 +1,562 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 . + +\*---------------------------------------------------------------------------*/ + +#include "orientedType.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + template<> + const char* NamedEnum + < + orientedType::orientedOption, + 3 + >::names[] = + { + "oriented", + "unoriented", + "unknown" + }; +} + +const Foam::NamedEnum + Foam::orientedType::orientedOptionNames; + + +bool Foam::orientedType::checkType +( + const orientedType& ot1, + const orientedType& ot2 +) +{ + if + ( + (ot1.oriented() == UNKNOWN) + || (ot2.oriented() == UNKNOWN) + || (ot1.oriented() == ot2.oriented()) + ) + { + return true; + } + else + { + return false; + } +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::orientedType::orientedType() +: + oriented_(UNKNOWN) +{} + + +Foam::orientedType::orientedType(const orientedType& ot) +: + oriented_(ot.oriented_) +{} + + +Foam::orientedType::orientedType(const bool oriented) +: + oriented_(oriented ? ORIENTED : UNORIENTED) +{} + + +Foam::orientedType::orientedType(Istream& is) +: + oriented_(orientedOptionNames.read(is)) +{ + is.check(FUNCTION_NAME); +} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::orientedType::orientedOption& Foam::orientedType::oriented() +{ + return oriented_; +} + + +Foam::orientedType::orientedOption Foam::orientedType::oriented() const +{ + return oriented_; +} + + +void Foam::orientedType::setOriented(const bool oriented) +{ + oriented_ = oriented ? ORIENTED : UNORIENTED; +} + + +void Foam::orientedType::read(const dictionary& dict) +{ + if (dict.found("oriented")) + { + oriented_ = orientedOptionNames.read(dict.lookup("oriented")); + } + else + { + oriented_ = UNKNOWN; + } +} + + +void Foam::orientedType::writeEntry(Ostream& os) const +{ + if (oriented_ == ORIENTED) + { + os.writeEntry("oriented", orientedOptionNames[oriented_]); + } +} + + +// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // + +void Foam::orientedType::operator=(const orientedType& ot) +{ + // Oriented state is inherited on assignment + oriented_ = ot.oriented(); +} + + +void Foam::orientedType::operator+=(const orientedType& ot) +{ + // Set the oriented status if it was unknown + if (oriented_ == UNKNOWN) + { + oriented_ = ot.oriented(); + } + + if (!checkType(*this, ot)) + { + FatalErrorInFunction + << "Operator += is undefined for " + << orientedOptionNames[oriented_] << " and " + << orientedOptionNames[ot.oriented()] << " types" + << abort(FatalError); + } +} + + +void Foam::orientedType::operator-=(const orientedType& ot) +{ + // Set the oriented status if it was unknown + if (oriented_ == UNKNOWN) + { + oriented_ = ot.oriented(); + } + + if (!checkType(*this, ot)) + { + FatalErrorInFunction + << "Operator -= is undefined for " + << orientedOptionNames[oriented_] << " and " + << orientedOptionNames[ot.oriented()] << " types" + << abort(FatalError); + } +} + + +void Foam::orientedType::operator*=(const orientedType& ot) +{ + const orientedType& ot1 = *this; + if (ot1() ^ ot()) + { + oriented_ = ORIENTED; + } + else + { + oriented_ = UNORIENTED; + } +} + + +void Foam::orientedType::operator/=(const orientedType& ot) +{ + const orientedType& ot1 = *this; + if (ot1() ^ ot()) + { + oriented_ = ORIENTED; + } + else + { + oriented_ = UNORIENTED; + } +} + + +void Foam::orientedType::operator*=(const scalar s) +{ + // No change to oriented_ flag +} + + +void Foam::orientedType::operator/=(const scalar s) +{ + // No change to oriented_ flag +} + + +bool Foam::orientedType::operator()() const +{ + return oriented_ == ORIENTED; +} + + +// * * * * * * * * * * * * * * * Friend Functions * * * * * * * * * * * * * // + +Foam::orientedType Foam::max(const orientedType& ot1, const orientedType& ot2) +{ + if (!orientedType::checkType(ot1, ot2)) + { + FatalErrorInFunction + << "Operator max is undefined for " + << orientedType::orientedOptionNames[ot1.oriented()] << " and " + << orientedType::orientedOptionNames[ot2.oriented()] << " types" + << abort(FatalError); + } + + return ot1; +} + + +Foam::orientedType Foam::min(const orientedType& ot1, const orientedType& ot2) +{ + if (!orientedType::checkType(ot1, ot2)) + { + FatalErrorInFunction + << "Operator min is undefined for " + << orientedType::orientedOptionNames[ot1.oriented()] << " and " + << orientedType::orientedOptionNames[ot2.oriented()] << "types" + << abort(FatalError); + } + + return ot1; +} + + +Foam::orientedType Foam::cmptMultiply +( + const orientedType& ot1, + const orientedType& ot2 +) +{ + return ot1 ^ ot2; +} + + +Foam::orientedType Foam::cmptDivide +( + const orientedType& ot1, + const orientedType& ot2 +) +{ + return ot1 ^ ot2; +} + + +Foam::orientedType Foam::cmptAv(const orientedType& ot) +{ + return ot; +} + + +Foam::orientedType Foam::pow(const orientedType& ot, const scalar r) +{ + // Undefined??? + // - only defined for integers where: + // - odd powers = oriented_ = yes (if ot is oriented) + // - even powers = oriented_ = no + return ot; +} + + +Foam::orientedType Foam::sqr(const orientedType& ot) +{ + return orientedType(false); +} + + +Foam::orientedType Foam::pow3(const orientedType& ot) +{ + return ot; +} + + +Foam::orientedType Foam::pow4(const orientedType& ot) +{ + return orientedType(false); +} + + +Foam::orientedType Foam::pow5(const orientedType& ot) +{ + return ot; +} + + +Foam::orientedType Foam::pow6(const orientedType& ot) +{ + return orientedType(false); +} + + +Foam::orientedType Foam::pow025(const orientedType& ot) +{ + return ot; +} + + +Foam::orientedType Foam::sqrt(const orientedType& ot) +{ + return ot; +} + + +Foam::orientedType Foam::cbrt(const orientedType& ot) +{ + return ot; +} + + +Foam::orientedType Foam::magSqr(const orientedType& ot) +{ + return orientedType(false); +} + + +Foam::orientedType Foam::mag(const orientedType& ot) +{ + return orientedType(false); +} + + +Foam::orientedType Foam::sign(const orientedType& ot) +{ + return ot; +} + + +Foam::orientedType Foam::pos(const orientedType& ot) +{ + return ot; +} + + +Foam::orientedType Foam::neg(const orientedType& ot) +{ + return ot; +} + + +Foam::orientedType Foam::posPart(const orientedType& ot) +{ + return ot; +} + + +Foam::orientedType Foam::negPart(const orientedType& ot) +{ + return ot; +} + + +Foam::orientedType Foam::inv(const orientedType& ot) +{ + return ot; +} + + +Foam::orientedType Foam::trans(const orientedType& ot) +{ + return ot; +} + + +Foam::orientedType Foam::atan2 +( + const orientedType& ot1, + const orientedType& ot2 +) +{ + if (!orientedType::checkType(ot1, ot2)) + { + FatalErrorInFunction + << "Operator atan2 is undefined for " + << orientedType::orientedOptionNames[ot1.oriented()] << " and " + << orientedType::orientedOptionNames[ot2.oriented()] << "types" + << abort(FatalError); + } + + return ot1; +} + + +Foam::orientedType Foam::transform(const orientedType& ot) +{ + return ot; +} + + +// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * // + +Foam::Istream& Foam::operator>>(Istream& is, orientedType& ot) +{ + ot.oriented_ = orientedType::orientedOptionNames.read(is); + + is.check(FUNCTION_NAME); + + return is; +} + + +Foam::Ostream& Foam::operator<<(Ostream& os, const orientedType& ot) +{ + os << orientedType::orientedOptionNames[ot.oriented()]; + + os.check(FUNCTION_NAME); + + return os; +} + + +// * * * * * * * * * * * * * * * Global Operators * * * * * * * * * * * * * // + +Foam::orientedType Foam::operator+ +( + const orientedType& ot1, + const orientedType& ot2 +) +{ + if (!orientedType::checkType(ot1, ot2)) + { + FatalErrorInFunction + << "Operator + is undefined for " + << orientedType::orientedOptionNames[ot1.oriented()] << " and " + << orientedType::orientedOptionNames[ot2.oriented()] << " types" + << abort(FatalError); + } + + // Note use of () operators to convert to boolean op + return orientedType(ot1() || ot2()); +} + + +Foam::orientedType Foam::operator-(const orientedType& ot) +{ + return ot; +} + + +Foam::orientedType Foam::operator- +( + const orientedType& ot1, + const orientedType& ot2 +) +{ + if (!orientedType::checkType(ot1, ot2)) + { + FatalErrorInFunction + << "Operator - is undefined for " + << orientedType::orientedOptionNames[ot1.oriented()] << " and " + << orientedType::orientedOptionNames[ot2.oriented()] << " types" + << abort(FatalError); + } + + // Note use of () operators to convert to boolean op + return orientedType(ot1() || ot2()); +} + + +Foam::orientedType Foam::operator*(const scalar s, const orientedType& ot) +{ + return ot; +} + + +Foam::orientedType Foam::operator/(const orientedType& ot, const scalar s) +{ + return ot; +} + + +Foam::orientedType Foam::operator/ +( + const orientedType& ot1, + const orientedType& ot2 +) +{ + return ot1 ^ ot2; +} + + +Foam::orientedType Foam::operator* +( + const orientedType& ot1, + const orientedType& ot2 +) +{ + return ot1 ^ ot2; +} + + +Foam::orientedType Foam::operator^ +( + const orientedType& ot1, + const orientedType& ot2 +) +{ + // Note use of () operators to convert to boolean op + return orientedType(ot1() ^ ot2()); +} + + +Foam::orientedType Foam::operator& +( + const orientedType& ot1, + const orientedType& ot2 +) +{ + return ot1 ^ ot2; +} + + +Foam::orientedType Foam::operator&& +( + const orientedType& ot1, + const orientedType& ot2 +) +{ + return orientedType(false); +} + + +// ************************************************************************* // diff --git a/src/OpenFOAM/orientedType/orientedType.H b/src/OpenFOAM/orientedType/orientedType.H new file mode 100644 index 0000000000..d050f71dcb --- /dev/null +++ b/src/OpenFOAM/orientedType/orientedType.H @@ -0,0 +1,202 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 . + +Class + Foam::orientedType + +Description + Class to determine the 'oriented' status of surface fields + +SourceFiles + orientedType.C + +\*---------------------------------------------------------------------------*/ + +#ifndef orientedType_H +#define orientedType_H + +#include "Istream.H" +#include "Ostream.H" +#include "dictionary.H" +#include "NamedEnum.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// Forward declaration of friend functions and operators + +class orientedType; + +Istream& operator>>(Istream&, orientedType&); + +Ostream& operator<<(Ostream&, const orientedType&); + +/*---------------------------------------------------------------------------*\ + Class orientedType Declaration +\*---------------------------------------------------------------------------*/ + +class orientedType +{ +public: + + // Public data types + + //- Enumeration defining the valid oriented flags + enum orientedOption + { + ORIENTED, + UNORIENTED, + UNKNOWN + }; + + static const NamedEnum orientedOptionNames; + + +private: + + // Private data + + //- Oriented flag + orientedOption oriented_; + + +public: + + // Constructors + + //- Null constructor - flag initialised to false + orientedType(); + + //- Copy constructor + orientedType(const orientedType& ot); + + //- Construct from bool + orientedType(const bool oriented); + + //- Construct from Istream + orientedType(Istream& is); + + + // Member functions + + //- Return true if can operate on this pair of oriented types + static bool checkType + ( + const orientedType& ot1, + const orientedType& ot2 + ); + + //- Return non-const reference to the oriented flag + orientedOption& oriented(); + + //- Return const reference to the oriented flag + orientedOption oriented() const; + + //- Set the oriented flag + void setOriented(const bool oriented = true); + + //- Read the oriented state from dictionary + void read(const dictionary& dict); + + //- Write the oriented flag entry + void writeEntry(Ostream& os) const; + + + // Member operators + + void operator=(const orientedType& ot); + + void operator+=(const orientedType& ot); + void operator-=(const orientedType& ot); + void operator*=(const orientedType& ot); + void operator/=(const orientedType& ot); + void operator*=(const scalar s); + void operator/=(const scalar s); + bool operator()() const; + + + // IOstream operators + + friend Istream& operator>>(Istream& is, orientedType& ot); + + friend Ostream& operator<<(Ostream& os, const orientedType& ot); +}; + + +// * * * * * * * * * * * * * * * Global Operators * * * * * * * * * * * * * // + +orientedType max(const orientedType& ot1, const orientedType& ot2); +orientedType min(const orientedType& ot1, const orientedType& ot2); +orientedType cmptMultiply(const orientedType& ot1, const orientedType& ot2); +orientedType cmptDivide(const orientedType& ot1, const orientedType& ot); +orientedType cmptAv(const orientedType& ot); + + +orientedType pow(const orientedType& ot, const scalar r); +orientedType sqr(const orientedType& ot); +orientedType pow3(const orientedType& ot); +orientedType pow4(const orientedType& ot); +orientedType pow5(const orientedType& ot); +orientedType pow6(const orientedType& ot); +orientedType pow025(const orientedType& ot); + + +orientedType sqrt(const orientedType& ot); +orientedType cbrt(const orientedType& ot); +orientedType magSqr(const orientedType& ot); +orientedType mag(const orientedType& ot); +orientedType sign(const orientedType& ot); +orientedType pos(const orientedType& ot); +orientedType neg(const orientedType& ot); +orientedType posPart(const orientedType& ot); +orientedType negPart(const orientedType& ot); +orientedType inv(const orientedType& ot); + + +orientedType trans(const orientedType& ot); +orientedType atan2(const orientedType& ot1, const orientedType& ot2); +orientedType transform(const orientedType& ot); + +orientedType operator-(const orientedType& ot); +orientedType operator*(const scalar s, const orientedType& ot); +orientedType operator/(const orientedType& ot, const scalar s); + +orientedType operator+(const orientedType& ot1, const orientedType& ot2); +orientedType operator-(const orientedType& ot1, const orientedType& ot2); +orientedType operator/(const orientedType& ot1, const orientedType& ot2); +orientedType operator*(const orientedType& ot1, const orientedType& ot2); +orientedType operator^(const orientedType& ot1, const orientedType& ot2); +orientedType operator&(const orientedType& ot1, const orientedType& ot2); +orientedType operator&&(const orientedType& ot1, const orientedType& ot2); + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/dynamicMesh/fvMeshDistribute/fvMeshDistributeTemplates.C b/src/dynamicMesh/fvMeshDistribute/fvMeshDistributeTemplates.C index 86a9617750..e03840aaa5 100644 --- a/src/dynamicMesh/fvMeshDistribute/fvMeshDistributeTemplates.C +++ b/src/dynamicMesh/fvMeshDistribute/fvMeshDistributeTemplates.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation - \\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd. + \\/ M anipulation | Copyright (C) 2015-2017 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -205,6 +205,8 @@ void Foam::fvMeshDistribute::mapExposedFaces forAllIter(typename HashTable, flds, iter) { fldType& fld = *iter(); + const bool oriented = fld.oriented()(); + typename fldType::Boundary& bfld = fld.boundaryFieldRef(); const Field& oldInternal = oldFlds[fieldI++]; @@ -225,7 +227,7 @@ void Foam::fvMeshDistribute::mapExposedFaces { patchFld[i] = oldInternal[oldFaceI]; - if (map.flipFaceFlux().found(faceI)) + if (oriented && map.flipFaceFlux().found(faceI)) { patchFld[i] = flipOp()(patchFld[i]); } diff --git a/src/dynamicMesh/fvMeshSubset/fvMeshSubset.H b/src/dynamicMesh/fvMeshSubset/fvMeshSubset.H index 7d9c453b5e..3f057d2d57 100644 --- a/src/dynamicMesh/fvMeshSubset/fvMeshSubset.H +++ b/src/dynamicMesh/fvMeshSubset/fvMeshSubset.H @@ -283,16 +283,14 @@ public: const fvMesh& sMesh, const labelList& patchMap, const labelList& cellMap, - const labelList& faceMap, - const bool negateIfFlipped = true + const labelList& faceMap ); template tmp> interpolate ( - const GeometricField&, - const bool negateIfFlipped = true + const GeometricField& ) const; //- Map point field diff --git a/src/dynamicMesh/fvMeshSubset/fvMeshSubsetInterpolate.C b/src/dynamicMesh/fvMeshSubset/fvMeshSubsetInterpolate.C index 7a0192ee06..228b7df26d 100644 --- a/src/dynamicMesh/fvMeshSubset/fvMeshSubsetInterpolate.C +++ b/src/dynamicMesh/fvMeshSubset/fvMeshSubsetInterpolate.C @@ -102,6 +102,7 @@ tmp> fvMeshSubset::interpolate ) ); GeometricField& resF = tresF.ref(); + resF.oriented() = vf.oriented(); // 2. Change the fvPatchFields to the correct type using a mapper @@ -180,8 +181,7 @@ tmp> fvMeshSubset::interpolate const fvMesh& sMesh, const labelList& patchMap, const labelList& cellMap, - const labelList& faceMap, - const bool negateIfFlipped + const labelList& faceMap ) { // 1. Create the complete field with dummy patch fields @@ -247,6 +247,7 @@ tmp> fvMeshSubset::interpolate ) ); GeometricField& resF = tresF.ref(); + resF.oriented() = vf.oriented(); // 2. Change the fvsPatchFields to the correct type using a mapper @@ -310,7 +311,7 @@ tmp> fvMeshSubset::interpolate { Type val = vf.internalField()[baseFacei]; - if (cellMap[fc[i]] == own[baseFacei] || !negateIfFlipped) + if (cellMap[fc[i]] == own[baseFacei] || !vf.oriented()()) { pfld[i] = val; } @@ -342,8 +343,7 @@ tmp> fvMeshSubset::interpolate template tmp> fvMeshSubset::interpolate ( - const GeometricField& sf, - const bool negateIfFlipped + const GeometricField& sf ) const { return interpolate @@ -352,8 +352,7 @@ tmp> fvMeshSubset::interpolate subMesh(), patchMap(), cellMap(), - faceMap(), - negateIfFlipped + faceMap() ); } @@ -423,6 +422,7 @@ fvMeshSubset::interpolate ) ); GeometricField& resF = tresF.ref(); + resF.oriented() = vf.oriented(); // 2. Change the pointPatchFields to the correct type using a mapper @@ -532,6 +532,8 @@ tmp> fvMeshSubset::interpolate ) ); + tresF.ref().oriented() = df.oriented(); + return tresF; } diff --git a/src/finiteVolume/fields/fvsPatchFields/fvsPatchField/fvsPatchField.C b/src/finiteVolume/fields/fvsPatchFields/fvsPatchField/fvsPatchField.C index cb0276cc7c..f1ebd2e690 100644 --- a/src/finiteVolume/fields/fvsPatchFields/fvsPatchField/fvsPatchField.C +++ b/src/finiteVolume/fields/fvsPatchFields/fvsPatchField/fvsPatchField.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -26,6 +26,7 @@ License #include "IOobject.H" #include "dictionary.H" #include "fvMesh.H" +#include "surfaceMesh.H" #include "fvPatchFieldMapper.H" // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // @@ -93,20 +94,15 @@ Foam::fvsPatchField::fvsPatchField } else { - FatalIOErrorInFunction - ( - dict - ) << "essential value entry not provided" + FatalIOErrorInFunction(dict) + << "essential 'value' entry not provided" << exit(FatalIOError); } } template -Foam::fvsPatchField::fvsPatchField -( - const fvsPatchField& ptf -) +Foam::fvsPatchField::fvsPatchField(const fvsPatchField& ptf) : Field(ptf), patch_(ptf.patch_), @@ -149,12 +145,10 @@ void Foam::fvsPatchField::check(const fvsPatchField& ptf) const template -void Foam::fvsPatchField::autoMap -( - const fvPatchFieldMapper& m -) +void Foam::fvsPatchField::autoMap(const fvPatchFieldMapper& m) { - Field::autoMap(m); + const bool oriented = internalField_.oriented()(); + Field::autoMap(m, oriented); } diff --git a/src/finiteVolume/fields/fvsPatchFields/fvsPatchField/fvsPatchField.H b/src/finiteVolume/fields/fvsPatchFields/fvsPatchField/fvsPatchField.H index 6c2f12a436..1b9f0aa2ac 100644 --- a/src/finiteVolume/fields/fvsPatchFields/fvsPatchField/fvsPatchField.H +++ b/src/finiteVolume/fields/fvsPatchFields/fvsPatchField/fvsPatchField.H @@ -286,8 +286,7 @@ public: } //- Return dimensioned internal field reference - const DimensionedField& - internalField() const + const DimensionedField& internalField() const { return internalField_; } diff --git a/src/finiteVolume/finiteVolume/ddtSchemes/CrankNicolsonDdtScheme/CrankNicolsonDdtScheme.C b/src/finiteVolume/finiteVolume/ddtSchemes/CrankNicolsonDdtScheme/CrankNicolsonDdtScheme.C index e3f9e6961a..71be26d88d 100644 --- a/src/finiteVolume/finiteVolume/ddtSchemes/CrankNicolsonDdtScheme/CrankNicolsonDdtScheme.C +++ b/src/finiteVolume/finiteVolume/ddtSchemes/CrankNicolsonDdtScheme/CrankNicolsonDdtScheme.C @@ -75,8 +75,7 @@ CrankNicolsonDdtScheme::DDt0Field::DDt0Field template template -label CrankNicolsonDdtScheme::DDt0Field:: -startTimeIndex() const +label CrankNicolsonDdtScheme::DDt0Field::startTimeIndex() const { return startTimeIndex_; } @@ -84,8 +83,7 @@ startTimeIndex() const template template -GeoField& CrankNicolsonDdtScheme::DDt0Field:: -operator()() +GeoField& CrankNicolsonDdtScheme::DDt0Field::operator()() { return *this; } @@ -93,8 +91,10 @@ operator()() template template -void CrankNicolsonDdtScheme::DDt0Field:: -operator=(const GeoField& gf) +void CrankNicolsonDdtScheme::DDt0Field::operator= +( + const GeoField& gf +) { GeoField::operator=(gf); } @@ -1259,6 +1259,7 @@ CrankNicolsonDdtScheme::fvcDdtPhiCorr "ddtCorrDdt0(" + phi.name() + ')', phi.dimensions() ); + dphidt0.setOriented(); dimensionedScalar rDtCoef = rDtCoef_(ddt0); @@ -1503,6 +1504,8 @@ tmp CrankNicolsonDdtScheme::meshPhi dimVolume ); + meshPhi0.setOriented(); + if (evaluate(meshPhi0)) { meshPhi0 = diff --git a/src/finiteVolume/finiteVolume/laplacianSchemes/gaussLaplacianScheme/gaussLaplacianScheme.C b/src/finiteVolume/finiteVolume/laplacianSchemes/gaussLaplacianScheme/gaussLaplacianScheme.C index 795fbff975..5f372b1e84 100644 --- a/src/finiteVolume/finiteVolume/laplacianSchemes/gaussLaplacianScheme/gaussLaplacianScheme.C +++ b/src/finiteVolume/finiteVolume/laplacianSchemes/gaussLaplacianScheme/gaussLaplacianScheme.C @@ -115,6 +115,7 @@ gaussLaplacianScheme::gammaSnGradCorr *vf.dimensions()*mesh.deltaCoeffs().dimensions() ) ); + tgammaSnGradCorr.ref().oriented() = SfGammaCorr.oriented(); for (direction cmpt = 0; cmpt < pTraits::nComponents; cmpt++) { diff --git a/src/finiteVolume/finiteVolume/snGradSchemes/snGradScheme/snGradScheme.C b/src/finiteVolume/finiteVolume/snGradSchemes/snGradScheme/snGradScheme.C index ae7d0de458..5644e7a6b1 100644 --- a/src/finiteVolume/finiteVolume/snGradSchemes/snGradScheme/snGradScheme.C +++ b/src/finiteVolume/finiteVolume/snGradSchemes/snGradScheme/snGradScheme.C @@ -124,6 +124,7 @@ snGradScheme::snGrad ) ); GeometricField& ssf = tsf.ref(); + ssf.setOriented(); // set reference to difference factors array const scalarField& deltaCoeffs = tdeltaCoeffs(); diff --git a/src/finiteVolume/fvMatrices/fvMatrix/fvMatrix.C b/src/finiteVolume/fvMatrices/fvMatrix/fvMatrix.C index 4c2ffb5a1f..262444193c 100644 --- a/src/finiteVolume/fvMatrices/fvMatrix/fvMatrix.C +++ b/src/finiteVolume/fvMatrices/fvMatrix/fvMatrix.C @@ -892,6 +892,8 @@ flux() const GeometricField& fieldFlux = tfieldFlux.ref(); + fieldFlux.setOriented(); + for (direction cmpt=0; cmpt::nComponents; cmpt++) { fieldFlux.primitiveFieldRef().replace diff --git a/src/finiteVolume/fvMesh/fvMeshGeometry.C b/src/finiteVolume/fvMesh/fvMeshGeometry.C index a05569849f..c530ee0a9a 100644 --- a/src/finiteVolume/fvMesh/fvMeshGeometry.C +++ b/src/finiteVolume/fvMesh/fvMeshGeometry.C @@ -67,6 +67,8 @@ void Foam::fvMesh::makeSf() const dimArea, faceAreas() ); + + SfPtr_->setOriented(); } @@ -271,8 +273,7 @@ const Foam::volScalarField::Internal& Foam::fvMesh::V00() const } -Foam::tmp -Foam::fvMesh::Vsc() const +Foam::tmp Foam::fvMesh::Vsc() const { if (moving() && time().subCycling()) { @@ -300,8 +301,7 @@ Foam::fvMesh::Vsc() const } -Foam::tmp -Foam::fvMesh::Vsc0() const +Foam::tmp Foam::fvMesh::Vsc0() const { if (moving() && time().subCycling()) { @@ -400,6 +400,7 @@ Foam::tmp Foam::fvMesh::delta() const ) ); surfaceVectorField& delta = tdelta.ref(); + delta.setOriented(); const volVectorField& C = this->C(); const labelUList& owner = this->owner(); @@ -410,8 +411,7 @@ Foam::tmp Foam::fvMesh::delta() const delta[facei] = C[neighbour[facei]] - C[owner[facei]]; } - surfaceVectorField::Boundary& deltabf = - delta.boundaryFieldRef(); + surfaceVectorField::Boundary& deltabf = delta.boundaryFieldRef(); forAll(deltabf, patchi) { @@ -438,6 +438,8 @@ const Foam::surfaceScalarField& Foam::fvMesh::phi() const (*phiPtr_) = dimensionedScalar("0", dimVolume/dimTime, 0.0); } + phiPtr_->setOriented(); + return *phiPtr_; } diff --git a/src/finiteVolume/interpolation/mapping/fvFieldMappers/MapFvSurfaceField.H b/src/finiteVolume/interpolation/mapping/fvFieldMappers/MapFvSurfaceField.H index 40dfd16f79..d1f21db48a 100644 --- a/src/finiteVolume/interpolation/mapping/fvFieldMappers/MapFvSurfaceField.H +++ b/src/finiteVolume/interpolation/mapping/fvFieldMappers/MapFvSurfaceField.H @@ -48,7 +48,7 @@ public: void operator() ( - Field& field, + DimensionedField& field, const MeshMapper& mapper ) const; }; @@ -57,7 +57,7 @@ public: template void MapInternalField::operator() ( - Field& field, + DimensionedField& field, const MeshMapper& mapper ) const { @@ -69,16 +69,22 @@ void MapInternalField::operator() << abort(FatalError); } - field.autoMap(mapper.surfaceMap()); + // Passing in oriented flag so that oriented fields (e.g. phi) are negated + // if flipped. Un-oriented fields, e.g U interpolated to faces (Uf) are not + // touched + field.autoMap(mapper.surfaceMap(), field.oriented()()); - // Flip the flux - const labelList flipFaces = mapper.surfaceMap().flipFaceFlux().toc(); - - forAll(flipFaces, i) + if (field.oriented()()) { - if (flipFaces[i] < field.size()) + // Flip the flux + const labelList flipFaces = mapper.surfaceMap().flipFaceFlux().toc(); + + forAll(flipFaces, i) { - field[flipFaces[i]] *= -1.0; + if (flipFaces[i] < field.size()) + { + field[flipFaces[i]] *= -1.0; + } } } } diff --git a/src/finiteVolume/interpolation/mapping/fvFieldMappers/MapFvVolField.H b/src/finiteVolume/interpolation/mapping/fvFieldMappers/MapFvVolField.H index db8c9ce72b..f23517342f 100644 --- a/src/finiteVolume/interpolation/mapping/fvFieldMappers/MapFvVolField.H +++ b/src/finiteVolume/interpolation/mapping/fvFieldMappers/MapFvVolField.H @@ -48,7 +48,7 @@ public: void operator() ( - Field& field, + DimensionedField& field, const MeshMapper& mapper ) const; }; @@ -57,7 +57,7 @@ public: template void MapInternalField::operator() ( - Field& field, + DimensionedField& field, const MeshMapper& mapper ) const { diff --git a/src/finiteVolume/interpolation/surfaceInterpolation/surfaceInterpolation/surfaceInterpolation.C b/src/finiteVolume/interpolation/surfaceInterpolation/surfaceInterpolation/surfaceInterpolation.C index 6e8f8bc7d4..f13c646316 100644 --- a/src/finiteVolume/interpolation/surfaceInterpolation/surfaceInterpolation/surfaceInterpolation.C +++ b/src/finiteVolume/interpolation/surfaceInterpolation/surfaceInterpolation/surfaceInterpolation.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -73,8 +73,7 @@ Foam::surfaceInterpolation::~surfaceInterpolation() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -const Foam::surfaceScalarField& -Foam::surfaceInterpolation::weights() const +const Foam::surfaceScalarField& Foam::surfaceInterpolation::weights() const { if (!weights_) { @@ -85,8 +84,7 @@ Foam::surfaceInterpolation::weights() const } -const Foam::surfaceScalarField& -Foam::surfaceInterpolation::deltaCoeffs() const +const Foam::surfaceScalarField& Foam::surfaceInterpolation::deltaCoeffs() const { if (!deltaCoeffs_) { @@ -156,11 +154,12 @@ void Foam::surfaceInterpolation::makeWeights() const dimless ); surfaceScalarField& weights = *weights_; + weights.setOriented(); // Set local references to mesh data - // (note that we should not use fvMesh sliced fields at this point yet - // since this causes a loop when generating weighting factors in - // coupledFvPatchField evaluation phase) + // Note that we should not use fvMesh sliced fields at this point yet + // since this causes a loop when generating weighting factors in + // coupledFvPatchField evaluation phase const labelUList& owner = mesh_.owner(); const labelUList& neighbour = mesh_.neighbour(); @@ -174,7 +173,7 @@ void Foam::surfaceInterpolation::makeWeights() const forAll(owner, facei) { // Note: mag in the dot-product. - // For all valid meshes, the non-orthogonality will be less that + // For all valid meshes, the non-orthogonality will be less than // 90 deg and the dot-product will be positive. For invalid // meshes (d & s <= 0), this will stabilise the calculation // but the result will be poor. @@ -183,8 +182,7 @@ void Foam::surfaceInterpolation::makeWeights() const w[facei] = SfdNei/(SfdOwn + SfdNei); } - surfaceScalarField::Boundary& wBf = - weights.boundaryFieldRef(); + surfaceScalarField::Boundary& wBf = weights.boundaryFieldRef(); forAll(mesh_.boundary(), patchi) { @@ -228,6 +226,7 @@ void Foam::surfaceInterpolation::makeDeltaCoeffs() const dimless/dimLength ); surfaceScalarField& deltaCoeffs = *deltaCoeffs_; + deltaCoeffs.setOriented(); // Set local references to mesh data @@ -278,6 +277,7 @@ void Foam::surfaceInterpolation::makeNonOrthDeltaCoeffs() const dimless/dimLength ); surfaceScalarField& nonOrthDeltaCoeffs = *nonOrthDeltaCoeffs_; + nonOrthDeltaCoeffs.setOriented(); // Set local references to mesh data @@ -342,6 +342,7 @@ void Foam::surfaceInterpolation::makeNonOrthCorrectionVectors() const dimless ); surfaceVectorField& corrVecs = *nonOrthCorrectionVectors_; + corrVecs.setOriented(); // Set local references to mesh data const volVectorField& C = mesh_.C(); diff --git a/src/finiteVolume/interpolation/surfaceInterpolation/surfaceInterpolationScheme/surfaceInterpolationScheme.C b/src/finiteVolume/interpolation/surfaceInterpolation/surfaceInterpolationScheme/surfaceInterpolationScheme.C index 089d21bee2..0fbf63650b 100644 --- a/src/finiteVolume/interpolation/surfaceInterpolation/surfaceInterpolationScheme/surfaceInterpolationScheme.C +++ b/src/finiteVolume/interpolation/surfaceInterpolation/surfaceInterpolationScheme/surfaceInterpolationScheme.C @@ -311,6 +311,8 @@ Foam::surfaceInterpolationScheme::dotInterpolate tlambdas.clear(); +// tsf.ref().oriented() = Sf.oriented(); + return tsf; } @@ -363,6 +365,8 @@ Foam::surfaceInterpolationScheme::dotInterpolate > > tsf = dotInterpolate(Sf, vf, weights(vf)); + tsf.ref().oriented() = Sf.oriented(); + if (corrected()) { tsf.ref() += Sf & correction(vf); @@ -397,6 +401,7 @@ Foam::surfaceInterpolationScheme::dotInterpolate surfaceMesh > > tSfDotinterpVf = dotInterpolate(Sf, tvf()); + tvf.clear(); return tSfDotinterpVf; } diff --git a/src/functionObjects/field/fieldValues/surfaceFieldValue/surfaceFieldValue.C b/src/functionObjects/field/fieldValues/surfaceFieldValue/surfaceFieldValue.C index 5d5bb380d7..f28944d995 100644 --- a/src/functionObjects/field/fieldValues/surfaceFieldValue/surfaceFieldValue.C +++ b/src/functionObjects/field/fieldValues/surfaceFieldValue/surfaceFieldValue.C @@ -154,7 +154,7 @@ void Foam::functionObjects::fieldValues::surfaceFieldValue::setFaceZoneFaces() DynamicList