Commit a8e3f067 authored by sergio's avatar sergio
Browse files

Merge branch 'develop' of develop.openfoam.com:Development/OpenFOAM-plus into develop

parents 0be3caec c1223095
......@@ -17,22 +17,6 @@ FoamFile
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));
//- 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.
......@@ -126,6 +110,38 @@ structuredCoeffs
method scotch;
}
/*
constraints
{
//- Keep owner and neighbour on same processor for faces in zones:
faces
{
type preserveFaceZones,
zones (heater solid1 solid3);
}
//- Keep owner and neighbour on same processor for faces in patches:
// (makes sense only for cyclic patches)
patches
{
type preservePatches,
patches (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).
processors
{
type singleProcessorFaceSets;
sets ((f0 -1));
}
}
*/
//// Is the case distributed? Note: command-line argument -roots takes
//// precedence
//distributed yes;
......
......@@ -17,27 +17,6 @@ FoamFile
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.
......@@ -130,6 +109,37 @@ structuredCoeffs
method scotch;
}
/*
constraints
{
//- Keep owner and neighbour on same processor for faces in zones:
faces
{
type preserveFaceZones,
zones (heater solid1 solid3);
}
//- Keep owner and neighbour on same processor for faces in patches:
// (makes sense only for cyclic patches)
patches
{
type preservePatches,
patches (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).
processors
{
type singleProcessorFaceSets;
sets ((f0 -1));
}
}
*/
//// Is the case distributed? Note: command-line argument -roots takes
//// precedence
//distributed yes;
......
......@@ -17,27 +17,6 @@ FoamFile
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.
......@@ -130,6 +109,37 @@ structuredCoeffs
method scotch;
}
/*
constraints
{
//- Keep owner and neighbour on same processor for faces in zones:
faces
{
type preserveFaceZones,
zones (heater solid1 solid3);
}
//- Keep owner and neighbour on same processor for faces in patches:
// (makes sense only for cyclic patches)
patches
{
type preservePatches,
patches (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).
processors
{
type singleProcessorFaceSets;
sets ((f0 -1));
}
}
*/
//// Is the case distributed? Note: command-line argument -roots takes
//// precedence
//distributed yes;
......
......@@ -17,27 +17,6 @@ FoamFile
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.
......@@ -130,6 +109,37 @@ structuredCoeffs
method scotch;
}
/*
constraints
{
//- Keep owner and neighbour on same processor for faces in zones:
faces
{
type preserveFaceZones,
zones (heater solid1 solid3);
}
//- Keep owner and neighbour on same processor for faces in patches:
// (makes sense only for cyclic patches)
patches
{
type preservePatches,
patches (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).
processors
{
type singleProcessorFaceSets;
sets ((f0 -1));
}
}
*/
//// Is the case distributed? Note: command-line argument -roots takes
//// precedence
//distributed yes;
......
......@@ -17,22 +17,6 @@ FoamFile
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));
//- 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.
......@@ -125,6 +109,36 @@ structuredCoeffs
method scotch;
}
/*
constraints
{
//- Keep owner and neighbour on same processor for faces in zones:
faces
{
type preserveFaceZones,
zones (heater solid1 solid3);
}
//- Keep owner and neighbour on same processor for faces in patches:
// (makes sense only for cyclic patches)
patches
{
type preservePatches,
patches (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).
processors
{
type singleProcessorFaceSets;
sets ((f0 -1));
}
}
*/
//// Is the case distributed? Note: command-line argument -roots takes
//// precedence
//distributed yes;
......
......@@ -467,7 +467,6 @@ inline void Swap(FixedList<T,Size>& lhs, FixedList<T,Size>& rhs);
//- Hashing for FixedList data, which uses Hasher for contiguous data and
//- element-wise incrementally hashing otherwise.
template<>
template<class T, unsigned N>
struct Hash<FixedList<T, N>>
{
......
......@@ -348,7 +348,6 @@ public:
//- Hashing for List data, which uses Hasher for contiguous data and
//- element-wise incrementally hashing otherwise.
template<>
template<class T>
struct Hash<List<T>>
{
......
......@@ -594,7 +594,6 @@ inline void Swap(UList<T>& a, UList<T>& b);
//- Hashing for UList data, which uses Hasher for contiguous data and
//- element-wise incrementally hashing otherwise.
template<>
template<class T>
struct Hash<UList<T>>
{
......
......@@ -158,7 +158,6 @@ public:
//- Hashing for Pair data, which uses Hasher for contiguous data and
//- element-wise incrementally hashing otherwise.
template<>
template<class T>
struct Hash<Pair<T>>
{
......
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2014-2017 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify i
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "dynamicOversetFvMesh.H"
#include "addToRunTimeSelectionTable.H"
#include "cellCellStencilObject.H"
#include "zeroGradientFvPatchFields.H"
#include "lduPrimitiveProcessorInterface.H"
#include "globalIndex.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(dynamicOversetFvMesh, 0);
addToRunTimeSelectionTable(dynamicFvMesh, dynamicOversetFvMesh, IOobject);
}
// * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * * //
bool Foam::dynamicOversetFvMesh::updateAddressing() const
{
const cellCellStencilObject& overlap = Stencil::New(*this);
// The (processor-local part of the) stencil determines the local
// faces to add to the matrix. tbd: parallel
const labelListList& stencil = overlap.cellStencil();
// Get the base addressing
const lduAddressing& baseAddr = dynamicMotionSolverFvMesh::lduAddr();
// Add to the base addressing
labelList lowerAddr;
labelList upperAddr;
label nExtraFaces;
const globalIndex globalNumbering(baseAddr.size());
labelListList localFaceCells;
labelListList remoteFaceCells;
labelList globalCellIDs(overlap.cellInterpolationMap().constructSize());
forAll(baseAddr, cellI)
{
globalCellIDs[cellI] = globalNumbering.toGlobal(cellI);
}
overlap.cellInterpolationMap().distribute(globalCellIDs);
reverseFaceMap_ = fvMeshPrimitiveLduAddressing::addAddressing
(
baseAddr,
stencil,
nExtraFaces,
lowerAddr,
upperAddr,
stencilFaces_,
globalNumbering,
globalCellIDs,
localFaceCells,
remoteFaceCells
);
if (debug)
{
Pout<< "dynamicOversetFvMesh::update() : extended addressing from"
<< " nFaces:" << baseAddr.lowerAddr().size()
<< " to nFaces:" << lowerAddr.size()
<< " nExtraFaces:" << nExtraFaces << endl;
}
// Extract relevant remote processors
labelList nbrProcs(localFaceCells.size());
{
label nbrI = 0;
forAll(localFaceCells, procI)
{
if (localFaceCells[procI].size())
{
//Pout<< " from proc:" << procI
// << " want its local cells " << remoteFaceCells[procI]
// << " to add to my local cells:" << localFaceCells[procI]
// << endl;
nbrProcs[nbrI++] = procI;
}
}
nbrProcs.setSize(nbrI);
}
// Construct interfaces
remoteStencilInterfaces_.setSize(nbrProcs.size());
forAll(nbrProcs, i)
{
label procI = nbrProcs[i];
remoteStencilInterfaces_.set
(
i,
new lduPrimitiveProcessorInterface
(
localFaceCells[procI],
Pstream::myProcNo(),
procI,
tensorField(0),
Pstream::msgType()
)
);
}
// Get addressing and interfaces of all interfaces
List<const labelUList*> patchAddr;
{
const fvBoundaryMesh& fvp = boundary();
patchAddr.setSize(fvp.size() + remoteStencilInterfaces_.size());
allInterfaces_ = dynamicMotionSolverFvMesh::interfaces();
allInterfaces_.setSize(patchAddr.size());
forAll(fvp, patchI)
{
patchAddr[patchI] = &fvp[patchI].faceCells();
}
forAll(remoteStencilInterfaces_, i)
{
label patchI = fvp.size()+i;
const lduPrimitiveProcessorInterface& pp =
remoteStencilInterfaces_[i];
//Pout<< "at patch:" << patchI
// << " have procPatch:" << pp.type()
// << " from:" << pp.myProcNo()
// << " to:" << pp.neighbProcNo()
// << " with fc:" << pp.faceCells().size() << endl;
patchAddr[patchI] = &pp.faceCells();
allInterfaces_.set(patchI, &pp);
}
}
const lduSchedule ps
(
lduPrimitiveMesh::nonBlockingSchedule<processorLduInterface>
(
allInterfaces_
)
);
lduPtr_.reset
(
new fvMeshPrimitiveLduAddressing
(
nCells(),
std::move(lowerAddr),
std::move(upperAddr),
patchAddr,
ps
)
);
// Check
if (debug)
{
const lduAddressing& addr = lduPtr_(); //this->lduAddr();
Pout<< "Adapted addressing:"
<< " lower:" << addr.lowerAddr().size()
<< " upper:" << addr.upperAddr().size() << endl;
lduInterfacePtrsList iFaces = this->interfaces();
// Using lduAddressing::patch
forAll(patchAddr, patchI)
{
Pout<< " " << patchI << "\tpatchAddr:"
<< addr.patchAddr(patchI).size()
<< endl;
}
// Using interfaces
Pout<< "iFaces:" << iFaces.size() << endl;
forAll(iFaces, patchI)
{
if (iFaces.set(patchI))
{
Pout<< " " << patchI << "\tiFace:" << iFaces[patchI].type()
<< endl;
}
}
Pout<< "end of printing." << endl;
}
return true;
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::dynamicOversetFvMesh::dynamicOversetFvMesh(const IOobject& io)
:
dynamicMotionSolverFvMesh(io),
active_(false)
{
// Load stencil (but do not update)
(void)Stencil::New(*this, false);
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::dynamicOversetFvMesh::~dynamicOversetFvMesh()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
const Foam::lduAddressing& Foam::dynamicOversetFvMesh::lduAddr() const
{
if (!active_)
{
return dynamicMotionSolverFvMesh::lduAddr();
}
if (lduPtr_.empty())
{
// Build extended addressing
updateAddressing();
}
return *lduPtr_;
}
const Foam::fvMeshPrimitiveLduAddressing&
Foam::dynamicOversetFvMesh::primitiveLduAddr() const
{
if (lduPtr_.empty())
{
FatalErrorInFunction
<< "Extended addressing not allocated" << abort(FatalError);
}