/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2018-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
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
mapFields
Group
grpPreProcessingUtilities
Description
Maps volume fields from one mesh to another, reading and
interpolating all fields present in the time directory of both cases.
Parallel and non-parallel cases are handled without the need to reconstruct
them first.
\*---------------------------------------------------------------------------*/
#include "fvCFD.H"
#include "meshToMesh0.H"
#include "processorFvPatch.H"
#include "MapMeshes.H"
#include "decompositionModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
int readNumProcs
(
const argList& args,
const word& optionName,
const Time& runTime
)
{
return decompositionMethod::nDomains
(
IOdictionary
(
IOobject::selectIO
(
IOobject
(
decompositionModel::canonicalName,
runTime.system(),
runTime,
IOobject::MUST_READ,
IOobject::NO_WRITE,
false // do not register
),
args.getOrDefault(optionName, "")
)
)
);
}
void mapConsistentMesh
(
const fvMesh& meshSource,
const fvMesh& meshTarget,
const meshToMesh0::order& mapOrder,
const bool subtract
)
{
if (subtract)
{
MapConsistentMesh
(
meshSource,
meshTarget,
mapOrder
);
}
else
{
MapConsistentMesh
(
meshSource,
meshTarget,
mapOrder
);
}
}
void mapSubMesh
(
const fvMesh& meshSource,
const fvMesh& meshTarget,
const HashTable& patchMap,
const wordList& cuttingPatches,
const meshToMesh0::order& mapOrder,
const bool subtract
)
{
if (subtract)
{
MapSubMesh
(
meshSource,
meshTarget,
patchMap,
cuttingPatches,
mapOrder
);
}
else
{
MapSubMesh
(
meshSource,
meshTarget,
patchMap,
cuttingPatches,
mapOrder
);
}
}
void mapConsistentSubMesh
(
const fvMesh& meshSource,
const fvMesh& meshTarget,
const meshToMesh0::order& mapOrder,
const bool subtract
)
{
if (subtract)
{
MapConsistentSubMesh
(
meshSource,
meshTarget,
mapOrder
);
}
else
{
MapConsistentSubMesh
(
meshSource,
meshTarget,
mapOrder
);
}
}
wordList addProcessorPatches
(
const fvMesh& meshTarget,
const wordList& cuttingPatches
)
{
// Add the processor patches to the cutting list
HashTable