Commit 49b27907 authored by mattijs's avatar mattijs
Browse files

Merge branch 'master' of /home/dm4/OpenFOAM/OpenFOAM-dev

parents 4c0c6b82 53a5eda5
......@@ -11,9 +11,7 @@ EXE_INC = \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/solidThermo/lnInclude \
-I$(LIB_SRC)/turbulenceModels/compressible/RAS/lnInclude \
-I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel/lnInclude \
-I$(LIB_SRC)/turbulenceModels \
-I$(LIB_SRC)/thermophysicalModels/radiationModels/lnInclude \
-I$(LIB_SRC)/fvOptions/lnInclude \
-I$(LIB_SRC)/regionModels/regionModel/lnInclude
......@@ -25,6 +23,7 @@ EXE_LIBS = \
-lspecie \
-lcompressibleTurbulenceModel \
-lcompressibleRASModels \
-lcompressibleLESModels \
-lmeshTools \
-lfiniteVolume \
-lradiationModels \
......
......@@ -146,7 +146,8 @@ bool Foam::GeometricField<Type, PatchField, GeoMesh>::readOldTimeIfPresent()
this->time().timeName(),
this->db(),
IOobject::READ_IF_PRESENT,
IOobject::AUTO_WRITE
IOobject::AUTO_WRITE,
this->registerObject()
);
if (field0.headerOk())
......@@ -761,7 +762,10 @@ Foam::GeometricField<Type, PatchField, GeoMesh>::oldTime() const
(
this->name() + "_0",
this->time().timeName(),
this->db()
this->db(),
IOobject::NO_READ,
IOobject::NO_WRITE,
this->registerObject()
),
*this
);
......
......@@ -150,13 +150,13 @@ int Foam::processorCyclicPolyPatch::tag() const
referPatch()
);
if (cycPatch.owner())
if (owner())
{
tag_ = Hash<word>()(cycPatch.name());
tag_ = Hash<word>()(cycPatch.name()) % 32768u;
}
else
{
tag_ = Hash<word>()(cycPatch.neighbPatch().name());
tag_ = Hash<word>()(cycPatch.neighbPatch().name()) % 32768u;
}
if (tag_ == Pstream::msgType() || tag_ == -1)
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -175,7 +175,7 @@ Op(lessEq, x <= y)
Op(greater, x > y)
Op(greaterEq, x >= y)
weightedOp(multiply, weight * y)
weightedOp(multiply, (weight*y))
#undef Op
......
......@@ -193,7 +193,8 @@ void Foam::fv::option::setCellSet()
meshToMeshNew::interpolationMethodNames_.read
(
dict_.lookup("interpolationMethod")
)
),
false // not interpolating patches
)
);
}
......
......@@ -78,6 +78,9 @@ void Foam::fv::interRegionHeatTransferModel::setNbrModel()
}
firstIter_ = false;
// set nbr model's nbr model to avoid construction order problems
nbrModel_->setNbrModel();
}
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -857,7 +857,7 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::normaliseWeights
if (nFace)
{
Info<< "AMI: Patch " << patchName << " weights min/max/average = "
IInfo<< "AMI: Patch " << patchName << " weights min/max/average = "
<< gMin(wghtSum) << ", "
<< gMax(wghtSum) << ", "
<< gAverage(wghtSum) << endl;
......@@ -1156,7 +1156,7 @@ Foam::AMIInterpolation<SourcePatch, TargetPatch>::AMIInterpolation
label srcSize = returnReduce(srcPatch.size(), sumOp<label>());
label tgtSize = returnReduce(tgtPatch.size(), sumOp<label>());
Info<< "AMI: Creating addressing and weights between "
IInfo<< "AMI: Creating addressing and weights between "
<< srcSize << " source faces and " << tgtSize << " target faces"
<< endl;
......@@ -1191,7 +1191,7 @@ Foam::AMIInterpolation<SourcePatch, TargetPatch>::AMIInterpolation
label srcSize = returnReduce(srcPatch.size(), sumOp<label>());
label tgtSize = returnReduce(tgtPatch.size(), sumOp<label>());
Info<< "AMI: Creating addressing and weights between "
IInfo<< "AMI: Creating addressing and weights between "
<< srcSize << " source faces and " << tgtSize << " target faces"
<< endl;
......@@ -1312,9 +1312,9 @@ Foam::AMIInterpolation<SourcePatch, TargetPatch>::AMIInterpolation
(
"AMIInterpolation<SourcePatch, TargetPatch>::AMIInterpolation"
"("
" const AMIInterpolation<SourcePatch, TargetPatch>&, "
" const labelList&, "
" const labelList&"
"const AMIInterpolation<SourcePatch, TargetPatch>&, "
"const labelList&, "
"const labelList&"
")"
) << "Size mismatch." << nl
<< "Source patch size:" << fineAMI.srcAddress().size() << nl
......@@ -1579,7 +1579,8 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::update
if (debug)
{
Info<< "AMIInterpolation : Constructed addressing and weights" << nl
<< " triMode :" << triMode_ << nl
<< " triMode :"
<< faceAreaIntersect::triangulationModeNames_[triMode_] << nl
<< " singlePatchProc:" << singlePatchProc_ << nl
<< " srcMagSf :" << gSum(srcMagSf_) << nl
<< " tgtMagSf :" << gSum(tgtMagSf_) << nl
......
......@@ -469,7 +469,7 @@ public:
) const;
//- Interpolate from target to source with supplied binary op
//- Interpolate from target to source with supplied op
template<class Type, class CombineOp>
tmp<Field<Type> > interpolateToSource
(
......@@ -477,8 +477,7 @@ public:
const CombineOp& cop
) const;
//- Interpolate from target tmp field to source with supplied
// binary op
//- Interpolate from target tmp field to source with supplied op
template<class Type, class CombineOp>
tmp<Field<Type> > interpolateToSource
(
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -27,6 +27,19 @@ License
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
template<>
const char* NamedEnum<faceAreaIntersect::triangulationMode, 2>::names[] =
{
"fan",
"mesh"
};
}
const Foam::NamedEnum<Foam::faceAreaIntersect::triangulationMode, 2>
Foam::faceAreaIntersect::triangulationModeNames_;
Foam::scalar Foam::faceAreaIntersect::tol = 1e-6;
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -41,6 +41,7 @@ SourceFiles
#include "FixedList.H"
#include "plane.H"
#include "face.H"
#include "NamedEnum.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
......@@ -63,6 +64,8 @@ public:
tmMesh
};
static const NamedEnum<triangulationMode, 2> triangulationModeNames_;
private:
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -108,7 +108,7 @@ public:
(
const surfaceFilmModel& owner,
const dictionary& dict,
const word& mdoelType
const word& modelType
);
......
......@@ -60,6 +60,9 @@ $(meshToMesh)/calculateMeshToMeshAddressing.C
$(meshToMesh)/calculateMeshToMeshWeights.C
meshToMeshNew = meshToMeshInterpolation/meshToMeshNew
$(meshToMeshNew)/calcDirect.C
$(meshToMeshNew)/calcMapNearest.C
$(meshToMeshNew)/calcCellVolumeWeight.C
$(meshToMeshNew)/meshToMeshNew.C
$(meshToMeshNew)/meshToMeshNewParallelOps.C
......
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "meshToMeshNew.H"
#include "tetOverlapVolume.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::meshToMeshNew::calcCellVolumeWeight
(
const polyMesh& src,
const polyMesh& tgt,
const label srcSeedI,
const label tgtSeedI,
const labelList& srcCellIDs,
boolList& mapFlag,
label& startSeedI
)
{
label srcCellI = srcSeedI;
label tgtCellI = tgtSeedI;
List<DynamicList<label> > srcToTgtAddr(src.nCells());
List<DynamicList<scalar> > srcToTgtWght(src.nCells());
List<DynamicList<label> > tgtToSrcAddr(tgt.nCells());
List<DynamicList<scalar> > tgtToSrcWght(tgt.nCells());
// list of tgt cell neighbour cells
DynamicList<label> nbrTgtCells(10);
// list of tgt cells currently visited for srcCellI to avoid multiple hits
DynamicList<label> visitedTgtCells(10);
// list to keep track of tgt cells used to seed src cells
labelList seedCells(src.nCells(), -1);
seedCells[srcCellI] = tgtCellI;
const scalarField& srcVol = src.cellVolumes();
do
{
nbrTgtCells.clear();
visitedTgtCells.clear();
// append initial target cell and neighbours
nbrTgtCells.append(tgtCellI);
appendNbrCells(tgtCellI, tgt, visitedTgtCells, nbrTgtCells);
do
{
tgtCellI = nbrTgtCells.remove();
visitedTgtCells.append(tgtCellI);
scalar vol = interVol(src, tgt, srcCellI, tgtCellI);
// accumulate addressing and weights for valid intersection
if (vol/srcVol[srcCellI] > tolerance_)
{
// store src/tgt cell pair
srcToTgtAddr[srcCellI].append(tgtCellI);
srcToTgtWght[srcCellI].append(vol);
tgtToSrcAddr[tgtCellI].append(srcCellI);
tgtToSrcWght[tgtCellI].append(vol);
appendNbrCells(tgtCellI, tgt, visitedTgtCells, nbrTgtCells);
// accumulate intersection volume
V_ += vol;
}
}
while (!nbrTgtCells.empty());
mapFlag[srcCellI] = false;
// find new source seed cell
setNextCells
(
startSeedI,
srcCellI,
tgtCellI,
src,
tgt,
srcCellIDs,
mapFlag,
visitedTgtCells,
seedCells
);
}
while (srcCellI != -1);
// transfer addressing into persistent storage
forAll(srcToTgtCellAddr_, i)
{
srcToTgtCellAddr_[i].transfer(srcToTgtAddr[i]);
srcToTgtCellWght_[i].transfer(srcToTgtWght[i]);
}
forAll(tgtToSrcCellAddr_, i)
{
tgtToSrcCellAddr_[i].transfer(tgtToSrcAddr[i]);
tgtToSrcCellWght_[i].transfer(tgtToSrcWght[i]);
}
}
void Foam::meshToMeshNew::setNextCells
(
label& startSeedI,
label& srcCellI,
label& tgtCellI,
const polyMesh& src,
const polyMesh& tgt,
const labelList& srcCellIDs,
const boolList& mapFlag,
const DynamicList<label>& visitedCells,
labelList& seedCells
) const
{
const labelList& srcNbrCells = src.cellCells()[srcCellI];
// set possible seeds for later use by querying all src cell neighbours
// with all visited target cells
bool valuesSet = false;
forAll(srcNbrCells, i)
{
label cellS = srcNbrCells[i];
if (mapFlag[cellS] && seedCells[cellS] == -1)
{
forAll(visitedCells, j)
{
label cellT = visitedCells[j];
if (intersect(src, tgt, cellS, cellT))
{
seedCells[cellS] = cellT;
if (!valuesSet)
{
srcCellI = cellS;
tgtCellI = cellT;
valuesSet = true;
}
}
}
}
}
// set next src and tgt cells if not set above
if (valuesSet)
{
return;
}
else
{
// try to use existing seed
bool foundNextSeed = false;
for (label i = startSeedI; i < srcCellIDs.size(); i++)
{
label cellS = srcCellIDs[i];
if (mapFlag[cellS])
{
if (!foundNextSeed)
{
startSeedI = i;
foundNextSeed = true;
}
if (seedCells[cellS] != -1)
{
srcCellI = cellS;
tgtCellI = seedCells[cellS];
return;
}
}
}
// perform new search to find match
if (debug)
{
Pout<< "Advancing front stalled: searching for new "
<< "target cell" << endl;
}
bool restart =
findInitialSeeds
(
src,
tgt,
srcCellIDs,
mapFlag,
startSeedI,
srcCellI,
tgtCellI
);
if (restart)
{
// successfully found new starting seed-pair
return;
}
}
// if we have got to here, there are no more src/tgt cell intersections
srcCellI = -1;
tgtCellI = -1;
}
bool Foam::meshToMeshNew::intersect
(
const polyMesh& src,
const polyMesh& tgt,
const label srcCellI,
const label tgtCellI
) const
{
scalar threshold = tolerance_*src.cellVolumes()[srcCellI];
tetOverlapVolume overlapEngine;
treeBoundBox bbTgtCell
(
pointField
(
tgt.points(),
tgt.cellPoints()[tgtCellI]
)
);
return overlapEngine.cellCellOverlapMinDecomp
(
src,
srcCellI,
tgt,
tgtCellI,
bbTgtCell,
threshold
);
}
Foam::scalar Foam::meshToMeshNew::interVol
(
const polyMesh& src,
const polyMesh& tgt,
const label srcCellI,
const label tgtCellI
) const
{
tetOverlapVolume overlapEngine;
treeBoundBox bbTgtCell
(
pointField
(
tgt.points(),
tgt.cellPoints()[tgtCellI]
)
);
scalar vol = overlapEngine.cellCellOverlapVolumeMinDecomp
(
src,
srcCellI,
tgt,
tgtCellI,
bbTgtCell
);
return vol;
}
// ************************************************************************* //
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "meshToMeshNew.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::meshToMeshNew::calcDirect
(
const polyMesh& src,
const polyMesh& tgt,
const label srcSeedI,
const label tgtSeedI