BUG: cyclicACMI: ensure transformation tensors are valid. Fixes #1088.

This commit is contained in:
mattijs 2018-11-21 15:34:13 +00:00
parent ba86d90ffc
commit fa2971c17a
3 changed files with 21 additions and 62 deletions

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2013-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2013-2016 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2017-2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -238,9 +238,11 @@ void Foam::cyclicACMIPolyPatch::initGeometry(PstreamBuffers& pBufs)
Pout<< "cyclicACMIPolyPatch::initGeometry : " << name() << endl; Pout<< "cyclicACMIPolyPatch::initGeometry : " << name() << endl;
} }
// Note: calculates transformation and triggers face centre calculation
cyclicAMIPolyPatch::initGeometry(pBufs); cyclicAMIPolyPatch::initGeometry(pBufs);
// Initialise the AMI // Initialise the AMI early to make sure we adapt the face areas before the
// cell centre calculation gets triggered.
resetAMI(); resetAMI();
} }
@ -265,9 +267,11 @@ void Foam::cyclicACMIPolyPatch::initMovePoints
{ {
Pout<< "cyclicACMIPolyPatch::initMovePoints : " << name() << endl; Pout<< "cyclicACMIPolyPatch::initMovePoints : " << name() << endl;
} }
// Note: calculates transformation and triggers face centre calculation
cyclicAMIPolyPatch::initMovePoints(pBufs, p); cyclicAMIPolyPatch::initMovePoints(pBufs, p);
// Initialise the AMI // Initialise the AMI early. See initGeometry.
resetAMI(); resetAMI();
} }
@ -540,30 +544,6 @@ Foam::label Foam::cyclicACMIPolyPatch::nonOverlapPatchID() const
} }
void Foam::cyclicACMIPolyPatch::calcGeometry
(
const primitivePatch& referPatch,
const pointField& thisCtrs,
const vectorField& thisAreas,
const pointField& thisCc,
const pointField& nbrCtrs,
const vectorField& nbrAreas,
const pointField& nbrCc
)
{
cyclicAMIPolyPatch::calcGeometry
(
referPatch,
thisCtrs,
thisAreas,
thisCc,
nbrCtrs,
nbrAreas,
nbrCc
);
}
void Foam::cyclicACMIPolyPatch::initOrder void Foam::cyclicACMIPolyPatch::initOrder
( (
PstreamBuffers& pBufs, PstreamBuffers& pBufs,

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2013-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2013-2016 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -267,18 +267,6 @@ public:
inline static scalar tolerance(); inline static scalar tolerance();
//- Calculate the patch geometry
virtual void calcGeometry
(
const primitivePatch& referPatch,
const pointField& thisCtrs,
const vectorField& thisAreas,
const pointField& thisCc,
const pointField& nbrCtrs,
const vectorField& nbrAreas,
const pointField& nbrCc
);
//- Initialize ordering for primitivePatch. Does not //- Initialize ordering for primitivePatch. Does not
// refer to *this (except for name() and type() etc.) // refer to *this (except for name() and type() etc.)
virtual void initOrder virtual void initOrder

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -403,21 +403,18 @@ void Foam::cyclicAMIPolyPatch::initGeometry(PstreamBuffers& pBufs)
AMIPtr_.clear(); AMIPtr_.clear();
polyPatch::initGeometry(pBufs); polyPatch::initGeometry(pBufs);
// Early calculation of transforms so e.g. cyclicACMI can use them.
// Note: also triggers primitiveMesh face centre. Note that cell
// centres should -not- be calculated
// since e.g. cyclicACMI override face areas
calcTransforms();
} }
void Foam::cyclicAMIPolyPatch::calcGeometry(PstreamBuffers& pBufs) void Foam::cyclicAMIPolyPatch::calcGeometry(PstreamBuffers& pBufs)
{ {
calcGeometry // All geometry done inside initGeometry
(
*this,
faceCentres(),
faceAreas(),
faceCellCentres(),
neighbPatch().faceCentres(),
neighbPatch().faceAreas(),
neighbPatch().faceCellCentres()
);
} }
@ -434,6 +431,9 @@ void Foam::cyclicAMIPolyPatch::initMovePoints
// See below. Clear out any local geometry // See below. Clear out any local geometry
primitivePatch::movePoints(p); primitivePatch::movePoints(p);
// Early calculation of transforms. See above.
calcTransforms();
} }
@ -445,7 +445,7 @@ void Foam::cyclicAMIPolyPatch::movePoints
{ {
polyPatch::movePoints(pBufs, p); polyPatch::movePoints(pBufs, p);
calcTransforms(); // All transformation tensors already done in initMovePoints
} }
@ -962,16 +962,7 @@ void Foam::cyclicAMIPolyPatch::calcGeometry
const vectorField& nbrAreas, const vectorField& nbrAreas,
const pointField& nbrCc const pointField& nbrCc
) )
{ {}
calcTransforms
(
referPatch,
thisCtrs,
thisAreas,
nbrCtrs,
nbrAreas
);
}
void Foam::cyclicAMIPolyPatch::initOrder void Foam::cyclicAMIPolyPatch::initOrder