Merge commit '9fbf8f1bfce0b178d61be485fac02007bf9c8b77' into nextRelease
This commit is contained in:
commit
e3b43562a7
22 changed files with 9733 additions and 4 deletions
|
@ -0,0 +1,3 @@
|
||||||
|
runDynamicMesh.C
|
||||||
|
|
||||||
|
EXE = $(FOAM_APPBIN)/runDynamicMesh
|
|
@ -0,0 +1,12 @@
|
||||||
|
EXE_INC = \
|
||||||
|
-I$(LIB_SRC)/dynamicMesh/dynamicFvMesh/lnInclude \
|
||||||
|
-I$(LIB_SRC)/dynamicMesh/dynamicMesh/lnInclude \
|
||||||
|
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||||
|
-I$(LIB_SRC)/finiteVolume/lnInclude
|
||||||
|
|
||||||
|
EXE_LIBS = \
|
||||||
|
-ldynamicFvMesh \
|
||||||
|
-ldynamicMesh \
|
||||||
|
-lmeshTools \
|
||||||
|
-lfiniteVolume \
|
||||||
|
-L$(MESQUITE_LIB_DIR) -lmesquite
|
|
@ -0,0 +1,13 @@
|
||||||
|
Info<< "Reading field alpha\n" << endl;
|
||||||
|
volScalarField alpha
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"alpha",
|
||||||
|
runTime.timeName(),
|
||||||
|
mesh,
|
||||||
|
IOobject::MUST_READ,
|
||||||
|
IOobject::AUTO_WRITE
|
||||||
|
),
|
||||||
|
mesh
|
||||||
|
);
|
|
@ -0,0 +1,80 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | foam-extend: Open Source CFD
|
||||||
|
\\ / O peration | Version: 4.0
|
||||||
|
\\ / A nd | Web: http://www.foam-extend.org
|
||||||
|
\\/ M anipulation | For copyright notice see file Copyright
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of foam-extend.
|
||||||
|
|
||||||
|
foam-extend 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.
|
||||||
|
|
||||||
|
foam-extend 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 foam-extend. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Application
|
||||||
|
runDynamicMesh
|
||||||
|
|
||||||
|
Description
|
||||||
|
Creates dynamicFvMesh and updates it in a time loop. Reads indicator field
|
||||||
|
alpha used for dynamic mesh refinement to trigger refinement in certain
|
||||||
|
areas.
|
||||||
|
|
||||||
|
Author
|
||||||
|
Vuko Vukcevic, Wikki Ltd. All rights reserved.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "fvCFD.H"
|
||||||
|
#include "dynamicFvMesh.H"
|
||||||
|
#include "simpleControl.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
# include "setRootCase.H"
|
||||||
|
# include "createTime.H"
|
||||||
|
# include "createDynamicFvMesh.H"
|
||||||
|
|
||||||
|
simpleControl simple(mesh);
|
||||||
|
|
||||||
|
# include "createFields.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Info<< "\nStarting time loop\n" << endl;
|
||||||
|
|
||||||
|
while (simple.loop())
|
||||||
|
{
|
||||||
|
Info<< "Time = " << runTime.timeName() << nl << endl;
|
||||||
|
|
||||||
|
bool meshChanged = mesh.update();
|
||||||
|
|
||||||
|
// Write only if mesh has changed
|
||||||
|
if (meshChanged)
|
||||||
|
{
|
||||||
|
runTime.write();
|
||||||
|
}
|
||||||
|
|
||||||
|
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
|
||||||
|
<< " ClockTime = " << runTime.elapsedClockTime() << " s"
|
||||||
|
<< nl << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
Info<< "End\n" << endl;
|
||||||
|
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -4,6 +4,7 @@ linearNormal/linearNormal.C
|
||||||
linearRadial/linearRadial.C
|
linearRadial/linearRadial.C
|
||||||
sigmaRadial/sigmaRadial.C
|
sigmaRadial/sigmaRadial.C
|
||||||
wedge/wedge.C
|
wedge/wedge.C
|
||||||
|
gradedNormal/gradedNormal.C
|
||||||
|
|
||||||
LIB = $(FOAM_LIBBIN)/libextrudeModel
|
LIB = $(FOAM_LIBBIN)/libextrudeModel
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
EXE_INC = \
|
EXE_INC = \
|
||||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||||
-I$(LIB_SRC)/dynamicMesh/lnInclude
|
-I$(LIB_SRC)/dynamicMesh/lnInclude \
|
||||||
|
-I$(LIB_SRC)/ODE/lnInclude
|
||||||
|
|
||||||
EXE_LIBS = \
|
EXE_LIBS = \
|
||||||
-lmeshTools \
|
-lmeshTools \
|
||||||
-ldynamicMesh
|
-ldynamicMesh \
|
||||||
|
-lODE
|
||||||
|
|
|
@ -0,0 +1,143 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | foam-extend: Open Source CFD
|
||||||
|
\\ / O peration | Version: 4.0
|
||||||
|
\\ / A nd | Web: http://www.foam-extend.org
|
||||||
|
\\/ M anipulation | For copyright notice see file Copyright
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of foam-extend.
|
||||||
|
|
||||||
|
foam-extend 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.
|
||||||
|
|
||||||
|
foam-extend 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 foam-extend. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "gradedNormal.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
#include "BisectionRoot.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
namespace extrudeModels
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
defineTypeNameAndDebug(gradedNormal, 0);
|
||||||
|
|
||||||
|
addToRunTimeSelectionTable(extrudeModel, gradedNormal, dictionary);
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
gradedNormal::gradedNormal(const dictionary& dict)
|
||||||
|
:
|
||||||
|
extrudeModel(typeName, dict),
|
||||||
|
thickness_(readScalar(coeffDict_.lookup("thickness"))),
|
||||||
|
delta0_(readScalar(coeffDict_.lookup("initialCellLength"))),
|
||||||
|
expansionFactor_(1.0)
|
||||||
|
{
|
||||||
|
// Sanity checks
|
||||||
|
if (thickness_ <= SMALL)
|
||||||
|
{
|
||||||
|
FatalErrorIn("gradedNormal(const dictionary&)")
|
||||||
|
<< "thickness should be positive: " << thickness_
|
||||||
|
<< exit(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (delta0_ <= SMALL)
|
||||||
|
{
|
||||||
|
FatalErrorIn("gradedNormal(const dictionary&)")
|
||||||
|
<< "initialCellLength should be positive: " << delta0_
|
||||||
|
<< exit(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
|
const scalar maxExpFactor =
|
||||||
|
coeffDict_.lookupOrDefault<scalar>("maxExpansionFactor", 3.0);
|
||||||
|
|
||||||
|
if (maxExpFactor <= SMALL)
|
||||||
|
{
|
||||||
|
FatalErrorIn("gradedNormal(const dictionary&)")
|
||||||
|
<< "maxExpansionFactor should be positive: " << maxExpFactor
|
||||||
|
<< exit(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
|
const scalar bisectionTol =
|
||||||
|
coeffDict_.lookupOrDefault<scalar>("bisectionTol", 1e-5);
|
||||||
|
|
||||||
|
if (bisectionTol <= SMALL)
|
||||||
|
{
|
||||||
|
FatalErrorIn("gradedNormal(const dictionary&)")
|
||||||
|
<< "bisectionTolerance should be positive: " << bisectionTol
|
||||||
|
<< exit(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create expansion factor equation represented as a function object
|
||||||
|
expansionFactorEqn eqn(*this);
|
||||||
|
|
||||||
|
// Calculate the expansionFactor using the bisection algorithm with the
|
||||||
|
// default tolerance of 1e-5
|
||||||
|
BisectionRoot<expansionFactorEqn> rootFinder
|
||||||
|
(
|
||||||
|
eqn,
|
||||||
|
bisectionTol
|
||||||
|
);
|
||||||
|
|
||||||
|
// Search for the root in [0, 3], where upper bound 3 is default
|
||||||
|
expansionFactor_ = rootFinder.root
|
||||||
|
(
|
||||||
|
0.0,
|
||||||
|
maxExpFactor
|
||||||
|
);
|
||||||
|
|
||||||
|
// Report the result
|
||||||
|
Info<< "Calculated expansion factor: " << expansionFactor_ << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
gradedNormal::~gradedNormal()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Operators * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
point gradedNormal::operator()
|
||||||
|
(
|
||||||
|
const point& surfacePoint,
|
||||||
|
const vector& surfaceNormal,
|
||||||
|
const label layer
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
scalar d = 0.0;
|
||||||
|
|
||||||
|
for (label i = 0; i < layer; ++i)
|
||||||
|
{
|
||||||
|
d += delta0_*pow(expansionFactor_, i);
|
||||||
|
}
|
||||||
|
|
||||||
|
return surfacePoint + d*surfaceNormal;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace extrudeModels
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
|
|
|
@ -0,0 +1,158 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | foam-extend: Open Source CFD
|
||||||
|
\\ / O peration | Version: 4.0
|
||||||
|
\\ / A nd | Web: http://www.foam-extend.org
|
||||||
|
\\/ M anipulation | For copyright notice see file Copyright
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of foam-extend.
|
||||||
|
|
||||||
|
foam-extend 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.
|
||||||
|
|
||||||
|
foam-extend 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 foam-extend. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Class
|
||||||
|
Foam::extrudeModels::gradedNormal
|
||||||
|
|
||||||
|
Description
|
||||||
|
Extrudes by transforming points normal to the surface. Input parameters are:
|
||||||
|
1. Extrusion thickness (in meters),
|
||||||
|
2. Initial delta (in meters),
|
||||||
|
3. Number of layers.
|
||||||
|
|
||||||
|
Expansion factor is calculated numerically using bisection algorithm.
|
||||||
|
|
||||||
|
Author
|
||||||
|
Vuko Vukcevic. FMENA Zagreb. All rights reserved.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef gradedNormal_H
|
||||||
|
#define gradedNormal_H
|
||||||
|
|
||||||
|
#include "point.H"
|
||||||
|
#include "extrudeModel.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
namespace extrudeModels
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class gradedNormal Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class gradedNormal
|
||||||
|
:
|
||||||
|
public extrudeModel
|
||||||
|
{
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
//- Layer thickness
|
||||||
|
scalar thickness_;
|
||||||
|
|
||||||
|
//- Initial delta (cell size at the extruded patch)
|
||||||
|
scalar delta0_;
|
||||||
|
|
||||||
|
//- Expansion factor
|
||||||
|
scalar expansionFactor_;
|
||||||
|
|
||||||
|
|
||||||
|
// Expansion factor equation (functor class used by BisectionRoot)
|
||||||
|
class expansionFactorEqn
|
||||||
|
{
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
//- Const reference to underlying gradedNormal model
|
||||||
|
const gradedNormal& gnm_;
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Construct given gradedNormal model
|
||||||
|
explicit expansionFactorEqn(const gradedNormal& gnm)
|
||||||
|
:
|
||||||
|
gnm_(gnm)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
//- Function call operator
|
||||||
|
scalar operator()(const scalar& x) const
|
||||||
|
{
|
||||||
|
scalar result = gnm_.thickness();
|
||||||
|
|
||||||
|
for (label i = 0; i <= gnm_.nLayers(); ++i)
|
||||||
|
{
|
||||||
|
result -= gnm_.delta0()*pow(x, i);
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("gradedNormal");
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from components
|
||||||
|
gradedNormal(const dictionary& dict);
|
||||||
|
|
||||||
|
|
||||||
|
//- Destructor
|
||||||
|
~gradedNormal();
|
||||||
|
|
||||||
|
|
||||||
|
// Access functions
|
||||||
|
|
||||||
|
//- Return const reference to thickness
|
||||||
|
const scalar& thickness() const
|
||||||
|
{
|
||||||
|
return thickness_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//- Return const reference to initial delta
|
||||||
|
const scalar& delta0() const
|
||||||
|
{
|
||||||
|
return delta0_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Member Operators
|
||||||
|
|
||||||
|
point operator()
|
||||||
|
(
|
||||||
|
const point& surfacePoint,
|
||||||
|
const vector& surfaceNormal,
|
||||||
|
const label layer
|
||||||
|
) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace extrudeModels
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
|
|
|
@ -103,6 +103,37 @@ bool domainDecomposition::writeDecomposition()
|
||||||
label maxProcFaces = 0;
|
label maxProcFaces = 0;
|
||||||
|
|
||||||
|
|
||||||
|
// Note: get cellLevel and pointLevel. Avoid checking whether they exist or
|
||||||
|
// not by hand. If they don't exist, simpy assume that the level is 0
|
||||||
|
const labelIOList globalCellLevel
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"cellLevel",
|
||||||
|
this->facesInstance(),
|
||||||
|
polyMesh::meshSubDir,
|
||||||
|
*this,
|
||||||
|
IOobject::READ_IF_PRESENT,
|
||||||
|
IOobject::NO_WRITE
|
||||||
|
),
|
||||||
|
labelList(nCells(), 0)
|
||||||
|
);
|
||||||
|
|
||||||
|
const labelIOList globalPointLevel
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"pointLevel",
|
||||||
|
this->facesInstance(),
|
||||||
|
polyMesh::meshSubDir,
|
||||||
|
*this,
|
||||||
|
IOobject::READ_IF_PRESENT,
|
||||||
|
IOobject::NO_WRITE
|
||||||
|
),
|
||||||
|
labelList(nPoints(), 0)
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
// Write out the meshes
|
// Write out the meshes
|
||||||
for (label procI = 0; procI < nProcs_; procI++)
|
for (label procI = 0; procI < nProcs_; procI++)
|
||||||
{
|
{
|
||||||
|
@ -615,6 +646,39 @@ bool domainDecomposition::writeDecomposition()
|
||||||
procBoundaryAddressing_[procI]
|
procBoundaryAddressing_[procI]
|
||||||
);
|
);
|
||||||
boundaryProcAddressing.write();
|
boundaryProcAddressing.write();
|
||||||
|
|
||||||
|
// Create and write cellLevel and pointLevel information
|
||||||
|
const unallocLabelList& cellMap = cellProcAddressing;
|
||||||
|
labelIOList procCellLevel
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"cellLevel",
|
||||||
|
procMesh.facesInstance(),
|
||||||
|
procMesh.meshSubDir,
|
||||||
|
procMesh,
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::NO_WRITE
|
||||||
|
),
|
||||||
|
labelList(globalCellLevel, cellMap)
|
||||||
|
);
|
||||||
|
procCellLevel.write();
|
||||||
|
|
||||||
|
const unallocLabelList& pointMap = pointProcAddressing;
|
||||||
|
labelIOList procPointLevel
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"pointLevel",
|
||||||
|
procMesh.facesInstance(),
|
||||||
|
procMesh.meshSubDir,
|
||||||
|
procMesh,
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::NO_WRITE
|
||||||
|
),
|
||||||
|
labelList(globalPointLevel, pointMap)
|
||||||
|
);
|
||||||
|
procPointLevel.write();
|
||||||
}
|
}
|
||||||
|
|
||||||
Info<< nl
|
Info<< nl
|
||||||
|
|
|
@ -10,6 +10,7 @@ dynamicMotionSolverFvMesh/dynamicMotionSolverFvMesh.C
|
||||||
subsetMotionSolverFvMesh/subsetMotionSolverFvMesh.C
|
subsetMotionSolverFvMesh/subsetMotionSolverFvMesh.C
|
||||||
dynamicInkJetFvMesh/dynamicInkJetFvMesh.C
|
dynamicInkJetFvMesh/dynamicInkJetFvMesh.C
|
||||||
dynamicRefineFvMesh/dynamicRefineFvMesh.C
|
dynamicRefineFvMesh/dynamicRefineFvMesh.C
|
||||||
|
dynamicRefinePolyFvMesh/dynamicRefinePolyFvMesh.C
|
||||||
|
|
||||||
mixerGgiFvMesh/mixerGgiFvMesh.C
|
mixerGgiFvMesh/mixerGgiFvMesh.C
|
||||||
turboFvMesh/turboFvMesh.C
|
turboFvMesh/turboFvMesh.C
|
||||||
|
|
|
@ -0,0 +1,77 @@
|
||||||
|
/*--------------------------------*- C++ -*----------------------------------*\
|
||||||
|
| ========= | |
|
||||||
|
| \\ / F ield | foam-extend: Open Source CFD |
|
||||||
|
| \\ / O peration | Version: 4.0 |
|
||||||
|
| \\ / A nd | Web: http://www.foam-extend.org |
|
||||||
|
| \\/ M anipulation | |
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
FoamFile
|
||||||
|
{
|
||||||
|
version 2.0;
|
||||||
|
format ascii;
|
||||||
|
class dictionary;
|
||||||
|
object dynamicMeshDict;
|
||||||
|
}
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
//dynamicFvMeshLib "libtopoChangerFvMesh.so";
|
||||||
|
dynamicFvMesh dynamicRefinePolyFvMesh;
|
||||||
|
//staticFvMesh;
|
||||||
|
|
||||||
|
mixerFvMeshCoeffs
|
||||||
|
{
|
||||||
|
coordinateSystem
|
||||||
|
{
|
||||||
|
type cylindrical;
|
||||||
|
origin (0 0 0);
|
||||||
|
axis (0 0 1);
|
||||||
|
direction (1 0 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
rpm 10;
|
||||||
|
|
||||||
|
slider
|
||||||
|
{
|
||||||
|
inside insideSlider;
|
||||||
|
outside outsideSlider;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Refinement
|
||||||
|
dynamicRefineFvMeshCoeffs
|
||||||
|
{
|
||||||
|
// Refine every refineInterval timesteps
|
||||||
|
refineInterval 3;
|
||||||
|
|
||||||
|
// Maximum refinement level (starts from 0)
|
||||||
|
maxRefinement 2;
|
||||||
|
|
||||||
|
// Maximum cell limit (approximate)
|
||||||
|
maxCells 1000000;
|
||||||
|
|
||||||
|
// volScalarField to base refinement on
|
||||||
|
field gamma;
|
||||||
|
|
||||||
|
// Which cells to un/refine: based on point values (simple averaging).
|
||||||
|
// - refine pointCells of point value inbetween minLevel..maxLevel
|
||||||
|
// - unrefine pointCells that are within nBufferLayers of points marked
|
||||||
|
// for refinement.
|
||||||
|
minLevel 0.01;
|
||||||
|
maxLevel 0.99;
|
||||||
|
nBufferLayers 1;
|
||||||
|
|
||||||
|
// Newly introduced patch points optionally get projected onto a surface
|
||||||
|
//projectSurfaces ("fixedWalls4.stl");
|
||||||
|
//projectPatches (fixedWalls);
|
||||||
|
// Maximum project distance
|
||||||
|
//projectDistance 1;
|
||||||
|
|
||||||
|
// Fluxes to adapt. For newly created faces or split faces the flux
|
||||||
|
// gets estimated from an interpolated volVectorField ('velocity')
|
||||||
|
// First is name of the flux to adapt, second is velocity that will
|
||||||
|
// be interpolated and inner-producted with the face area vector.
|
||||||
|
correctFluxes ((phi U));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
File diff suppressed because it is too large
Load diff
|
@ -0,0 +1,215 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | foam-extend: Open Source CFD
|
||||||
|
\\ / O peration | Version: 4.0
|
||||||
|
\\ / A nd | Web: http://www.foam-extend.org
|
||||||
|
\\/ M anipulation | For copyright notice see file Copyright
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of foam-extend.
|
||||||
|
|
||||||
|
foam-extend 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.
|
||||||
|
|
||||||
|
foam-extend 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 foam-extend. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Class
|
||||||
|
Foam::dynamicRefinePolyFvMesh
|
||||||
|
|
||||||
|
Description
|
||||||
|
A fvMesh with built-in refinement of arbitrary polyhedral cells.
|
||||||
|
|
||||||
|
Determines which cells to refine/unrefine and does all in update().
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
dynamicRefinePolyFvMesh.C
|
||||||
|
|
||||||
|
Author
|
||||||
|
Vuko Vukcevic, Wikki Ltd. All rights reserved
|
||||||
|
|
||||||
|
Notes
|
||||||
|
Generalisation of dynamicRefineMesh for polyhedral cells
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef dynamicRefinePolyFvMesh_H
|
||||||
|
#define dynamicRefinePolyFvMesh_H
|
||||||
|
|
||||||
|
#include "dynamicFvMesh.H"
|
||||||
|
#include "polyRef.H"
|
||||||
|
#include "PackedBoolList.H"
|
||||||
|
#include "Switch.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class dynamicRefinePolyFvMesh Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class dynamicRefinePolyFvMesh
|
||||||
|
:
|
||||||
|
public dynamicFvMesh
|
||||||
|
{
|
||||||
|
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
// Helper variables to enable switching between a single and multiple
|
||||||
|
// mesh motion updates within a time step (if update() is called more
|
||||||
|
// than once in a single time step)
|
||||||
|
|
||||||
|
//- Switch for single motion update (true by default)
|
||||||
|
Switch singleMotionUpdate_;
|
||||||
|
|
||||||
|
//- Helper varaible: current time index
|
||||||
|
label curTimeIndex_;
|
||||||
|
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
//- Mesh cutting engine
|
||||||
|
polyRef meshCutter_;
|
||||||
|
|
||||||
|
//- Dump cellLevel for postprocessing
|
||||||
|
Switch dumpLevel_;
|
||||||
|
|
||||||
|
//- Fluxes to map
|
||||||
|
List<Pair<word> > correctFluxes_;
|
||||||
|
|
||||||
|
//- Number of refinement/unrefinement steps done so far.
|
||||||
|
label nRefinementIterations_;
|
||||||
|
|
||||||
|
|
||||||
|
// Private Member Functions
|
||||||
|
|
||||||
|
//- Count set/unset elements in packedlist.
|
||||||
|
static label count(const PackedBoolList&, const unsigned int);
|
||||||
|
|
||||||
|
//- Read the projection parameters from dictionary
|
||||||
|
void readDict();
|
||||||
|
|
||||||
|
|
||||||
|
//- Refine cells. Update mesh and fields.
|
||||||
|
autoPtr<mapPolyMesh> refine(const labelList&);
|
||||||
|
|
||||||
|
//- Unrefine cells. Gets passed in centre points of cells to combine.
|
||||||
|
autoPtr<mapPolyMesh> unrefine(const labelList&);
|
||||||
|
|
||||||
|
|
||||||
|
// Selection of cells to un/refine
|
||||||
|
|
||||||
|
//- Get per cell max of connected point
|
||||||
|
scalarField maxPointField(const scalarField&) const;
|
||||||
|
|
||||||
|
//- Get point min of connected cell
|
||||||
|
scalarField minCellField(const volScalarField&) const;
|
||||||
|
|
||||||
|
//- Simple (non-parallel) interpolation by averaging
|
||||||
|
scalarField cellToPoint(const scalarField& vFld) const;
|
||||||
|
|
||||||
|
//- Calculate error (= -1 by default or distance from inbetween
|
||||||
|
// levels
|
||||||
|
scalarField error
|
||||||
|
(
|
||||||
|
const scalarField& fld,
|
||||||
|
const scalar minLevel,
|
||||||
|
const scalar maxLevel
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- Select candidate cells for refinement
|
||||||
|
virtual void selectRefineCandidates
|
||||||
|
(
|
||||||
|
const scalar lowerRefineLevel,
|
||||||
|
const scalar upperRefineLevel,
|
||||||
|
const scalarField& vFld,
|
||||||
|
PackedBoolList& candidateCell
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- Subset candidate cells for refinement
|
||||||
|
virtual labelList selectRefineCells
|
||||||
|
(
|
||||||
|
const label maxCells,
|
||||||
|
const label maxRefinement,
|
||||||
|
const PackedBoolList& candidateCell
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- Select points that can be unrefined
|
||||||
|
virtual labelList selectUnrefinePoints
|
||||||
|
(
|
||||||
|
const scalar unrefineLevel,
|
||||||
|
const PackedBoolList& markedCell,
|
||||||
|
const scalarField& pFld
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- Extend markedCell with cell-face-cell
|
||||||
|
void extendMarkedCells(PackedBoolList& markedCell) const;
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
//- Disallow default bitwise copy construct
|
||||||
|
dynamicRefinePolyFvMesh(const dynamicRefinePolyFvMesh&);
|
||||||
|
|
||||||
|
//- Disallow default bitwise assignment
|
||||||
|
void operator=(const dynamicRefinePolyFvMesh&);
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("dynamicRefinePolyFvMesh");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from IOobject
|
||||||
|
explicit dynamicRefinePolyFvMesh(const IOobject& io);
|
||||||
|
|
||||||
|
|
||||||
|
// Destructor
|
||||||
|
|
||||||
|
virtual ~dynamicRefinePolyFvMesh();
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
//- Direct access to the refinement engine
|
||||||
|
const polyRef& meshCutter() const
|
||||||
|
{
|
||||||
|
return meshCutter_;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Update the mesh for both mesh motion and topology change
|
||||||
|
virtual bool update();
|
||||||
|
|
||||||
|
|
||||||
|
// Writing
|
||||||
|
|
||||||
|
//- Write using given format, version and compression
|
||||||
|
virtual bool writeObject
|
||||||
|
(
|
||||||
|
IOstream::streamFormat fmt,
|
||||||
|
IOstream::versionNumber ver,
|
||||||
|
IOstream::compressionType cmp
|
||||||
|
) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -52,6 +52,7 @@ motionSolver/motionSolver.C
|
||||||
refinementData/refinementData.C
|
refinementData/refinementData.C
|
||||||
refinementData/refinementDistanceData.C
|
refinementData/refinementDistanceData.C
|
||||||
refinementData/refinementHistory.C
|
refinementData/refinementHistory.C
|
||||||
|
refinementData/polyRefinementHistory.C
|
||||||
|
|
||||||
directTopoChange/directTopoChange/directTopoChange.C
|
directTopoChange/directTopoChange/directTopoChange.C
|
||||||
|
|
||||||
|
@ -60,6 +61,7 @@ $(directActions)/addPatchCellLayer.C
|
||||||
$(directActions)/edgeCollapser.C
|
$(directActions)/edgeCollapser.C
|
||||||
$(directActions)/faceCollapser.C
|
$(directActions)/faceCollapser.C
|
||||||
$(directActions)/hexRef8.C
|
$(directActions)/hexRef8.C
|
||||||
|
$(directActions)/polyRef.C
|
||||||
$(directActions)/removeCells.C
|
$(directActions)/removeCells.C
|
||||||
$(directActions)/removeFaces.C
|
$(directActions)/removeFaces.C
|
||||||
$(directActions)/removePoints.C
|
$(directActions)/removePoints.C
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -0,0 +1,558 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | foam-extend: Open Source CFD
|
||||||
|
\\ / O peration | Version: 4.0
|
||||||
|
\\ / A nd | Web: http://www.foam-extend.org
|
||||||
|
\\/ M anipulation | For copyright notice see file Copyright
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of foam-extend.
|
||||||
|
|
||||||
|
foam-extend 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.
|
||||||
|
|
||||||
|
foam-extend 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 foam-extend. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Class
|
||||||
|
Foam::polyRef
|
||||||
|
|
||||||
|
Description
|
||||||
|
Refinement of (split) polyhedra using directTopoChange.
|
||||||
|
|
||||||
|
Each polyhedron is split by the following procedure:
|
||||||
|
1. Adding points at the edge centre, face centre and cell centre,
|
||||||
|
2. Adding cells n cells where n is the number of points of the cell,
|
||||||
|
3. Splitting each face into multiple faces going from:
|
||||||
|
existing corner point -> new edge centre point -> new face centre
|
||||||
|
point -> other new edge centre point (sharing the same corner point)
|
||||||
|
4. Adding internal faces going from:
|
||||||
|
new edge centre point -> new face centre point -> new cell centre
|
||||||
|
point -> other new face centre point (sharing the same edge)
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
polyRef.C
|
||||||
|
|
||||||
|
Author
|
||||||
|
Vuko Vukcevic, Wikki Ltd. All rights reserved.
|
||||||
|
|
||||||
|
Notes
|
||||||
|
Generalisation of hexRef8 for polyhedral cells
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef polyRef_H
|
||||||
|
#define polyRef_H
|
||||||
|
|
||||||
|
#include "labelIOList.H"
|
||||||
|
#include "face.H"
|
||||||
|
#include "HashSet.H"
|
||||||
|
#include "DynamicList.H"
|
||||||
|
#include "primitivePatch.H"
|
||||||
|
#include "removeFaces.H"
|
||||||
|
#include "polyRefinementHistory.H"
|
||||||
|
#include "PackedList.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// Forward declaration of classes
|
||||||
|
class polyMesh;
|
||||||
|
class polyPatch;
|
||||||
|
class directTopoChange;
|
||||||
|
class mapPolyMesh;
|
||||||
|
class mapDistributePolyMesh;
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class polyRef Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class polyRef
|
||||||
|
{
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
//- Reference to underlying mesh
|
||||||
|
const polyMesh& mesh_;
|
||||||
|
|
||||||
|
//- Per cell the refinement level
|
||||||
|
labelIOList cellLevel_;
|
||||||
|
|
||||||
|
//- Per point the refinement level
|
||||||
|
labelIOList pointLevel_;
|
||||||
|
|
||||||
|
//- Typical edge length between unrefined points
|
||||||
|
const scalar level0Edge_;
|
||||||
|
|
||||||
|
//- Refinement history
|
||||||
|
polyRefinementHistory history_;
|
||||||
|
|
||||||
|
//- Face remover engine
|
||||||
|
removeFaces faceRemover_;
|
||||||
|
|
||||||
|
//- Level of saved points
|
||||||
|
Map<label> savedPointLevel_;
|
||||||
|
|
||||||
|
//- Level of saved cells
|
||||||
|
Map<label> savedCellLevel_;
|
||||||
|
|
||||||
|
|
||||||
|
// Private Member Functions
|
||||||
|
|
||||||
|
//- Reorder according to map
|
||||||
|
static void reorder
|
||||||
|
(
|
||||||
|
const labelList& map,
|
||||||
|
const label len,
|
||||||
|
const label null,
|
||||||
|
labelList& elems
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Get patch and zone info
|
||||||
|
void getFaceInfo
|
||||||
|
(
|
||||||
|
const label faceI,
|
||||||
|
label& patchID,
|
||||||
|
label& zoneID,
|
||||||
|
label& zoneFlip
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- Adds a face on top of existing faceI. Reverses if nessecary
|
||||||
|
label addFace
|
||||||
|
(
|
||||||
|
directTopoChange& meshMod,
|
||||||
|
const label faceI,
|
||||||
|
const face& newFace,
|
||||||
|
const label own,
|
||||||
|
const label nei
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- Adds internal face from point. No checks on reversal
|
||||||
|
label addInternalFace
|
||||||
|
(
|
||||||
|
directTopoChange& meshMod,
|
||||||
|
const label meshFaceI,
|
||||||
|
const label meshPointI,
|
||||||
|
const face& newFace,
|
||||||
|
const label own,
|
||||||
|
const label nei
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- Modifies existing faceI for either new owner/neighbour or new face
|
||||||
|
// points. Reverses if nessecary
|
||||||
|
void modFace
|
||||||
|
(
|
||||||
|
directTopoChange& meshMod,
|
||||||
|
const label faceI,
|
||||||
|
const face& newFace,
|
||||||
|
const label own,
|
||||||
|
const label nei
|
||||||
|
) const;
|
||||||
|
|
||||||
|
scalar getLevel0EdgeLength() const;
|
||||||
|
|
||||||
|
//- Get cell added to point of cellI (if any)
|
||||||
|
label getAnchorCell
|
||||||
|
(
|
||||||
|
const labelListList& cellAnchorPoints,
|
||||||
|
const labelListList& cellAddedCells,
|
||||||
|
const label cellI,
|
||||||
|
const label faceI,
|
||||||
|
const label pointI
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- Get new owner and neighbour (in unspecified order) of pointI
|
||||||
|
// on faceI
|
||||||
|
void getFaceNeighbours
|
||||||
|
(
|
||||||
|
const labelListList& cellAnchorPoints,
|
||||||
|
const labelListList& cellAddedCells,
|
||||||
|
const label faceI,
|
||||||
|
const label pointI,
|
||||||
|
|
||||||
|
label& own,
|
||||||
|
label& nei
|
||||||
|
) const;
|
||||||
|
|
||||||
|
|
||||||
|
//- Get index of point with minimum pointlevel
|
||||||
|
label findMinLevel(const labelList& f) const;
|
||||||
|
|
||||||
|
//- Get index of point with maximum pointlevel
|
||||||
|
label findMaxLevel(const labelList& f) const;
|
||||||
|
|
||||||
|
//- Count number of vertices <= anchorLevel
|
||||||
|
label countAnchors(const labelList&, const label) const;
|
||||||
|
|
||||||
|
//- Find index of point with wantedLevel, starting from fp
|
||||||
|
label findLevel
|
||||||
|
(
|
||||||
|
const face& f,
|
||||||
|
const label startFp,
|
||||||
|
const bool searchForward,
|
||||||
|
const label wantedLevel
|
||||||
|
) const;
|
||||||
|
|
||||||
|
////- Print levels of list of points.
|
||||||
|
//void printLevels(Ostream&, const labelList&) const;
|
||||||
|
|
||||||
|
//- debug: check orientation of added internal face
|
||||||
|
static void checkInternalOrientation
|
||||||
|
(
|
||||||
|
directTopoChange& meshMod,
|
||||||
|
const label cellI,
|
||||||
|
const label faceI,
|
||||||
|
const point& ownPt,
|
||||||
|
const point& neiPt,
|
||||||
|
const face& newFace
|
||||||
|
);
|
||||||
|
|
||||||
|
//- debug: check orientation of new boundary face
|
||||||
|
static void checkBoundaryOrientation
|
||||||
|
(
|
||||||
|
directTopoChange& meshMod,
|
||||||
|
const label cellI,
|
||||||
|
const label faceI,
|
||||||
|
const point& ownPt,
|
||||||
|
const point& boundaryPt,
|
||||||
|
const face& newFace
|
||||||
|
);
|
||||||
|
|
||||||
|
//- If p0 and p1 are existing vertices check if edge is split and insert
|
||||||
|
// splitPoint
|
||||||
|
void insertEdgeSplit
|
||||||
|
(
|
||||||
|
const labelList& edgeMidPoint,
|
||||||
|
const label p0,
|
||||||
|
const label p1,
|
||||||
|
dynamicLabelList& verts
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- Store in maps correspondence from midpoint to anchors and faces
|
||||||
|
label storeMidPointInfo
|
||||||
|
(
|
||||||
|
const labelListList& cellAnchorPoints,
|
||||||
|
const labelListList& cellAddedCells,
|
||||||
|
const labelList& cellMidPoint,
|
||||||
|
const labelList& edgeMidPoint,
|
||||||
|
const label cellI,
|
||||||
|
const label faceI,
|
||||||
|
const bool faceOrder,
|
||||||
|
const label midPointI,
|
||||||
|
const label anchorPointI,
|
||||||
|
const label faceMidPointI,
|
||||||
|
|
||||||
|
Map<edge>& midPointToAnchors,
|
||||||
|
Map<edge>& midPointToFaceMids,
|
||||||
|
directTopoChange& meshMod
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- Create all internal faces from an unsplit face
|
||||||
|
void createInternalFromSplitFace
|
||||||
|
(
|
||||||
|
const labelListList& cellAnchorPoints,
|
||||||
|
const labelListList& cellAddedCells,
|
||||||
|
const labelList& cellMidPoint,
|
||||||
|
const labelList& faceMidPoint,
|
||||||
|
const labelList& edgeMidPoint,
|
||||||
|
const label cellI,
|
||||||
|
const label faceI,
|
||||||
|
|
||||||
|
Map<edge>& midPointToAnchors,
|
||||||
|
Map<edge>& midPointToFaceMids,
|
||||||
|
directTopoChange& meshMod,
|
||||||
|
label& nFacesAdded
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- Create all internal faces to split cellI into n cells where n is the
|
||||||
|
// number of cell points
|
||||||
|
void createInternalFaces
|
||||||
|
(
|
||||||
|
const labelListList& cellAnchorPoints,
|
||||||
|
const labelListList& cellAddedCells,
|
||||||
|
const labelList& cellMidPoint,
|
||||||
|
const labelList& faceMidPoint,
|
||||||
|
const labelList& faceAnchorLevel,
|
||||||
|
const labelList& edgeMidPoint,
|
||||||
|
const label cellI,
|
||||||
|
directTopoChange& meshMod
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- Store vertices from startFp upto face split point.
|
||||||
|
// Used when splitting face into n faces where n is the number of
|
||||||
|
// points in a face (or number of edges)
|
||||||
|
void walkFaceToMid
|
||||||
|
(
|
||||||
|
const labelList& edgeMidPoint,
|
||||||
|
const label cLevel,
|
||||||
|
const label faceI,
|
||||||
|
const label startFp,
|
||||||
|
dynamicLabelList& faceVerts
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- Same as walkFaceToMid but now walk back
|
||||||
|
void walkFaceFromMid
|
||||||
|
(
|
||||||
|
const labelList& edgeMidPoint,
|
||||||
|
const label cLevel,
|
||||||
|
const label faceI,
|
||||||
|
const label startFp,
|
||||||
|
dynamicLabelList& faceVerts
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- Updates refineCell so consistent 2:1 refinement. Returns local
|
||||||
|
// number of cells changed
|
||||||
|
label faceConsistentRefinement
|
||||||
|
(
|
||||||
|
const bool maxSet,
|
||||||
|
PackedList<1>& refineCell
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- Check wanted refinement for 2:1 consistency
|
||||||
|
void checkWantedRefinementLevels(const labelList&) const;
|
||||||
|
|
||||||
|
|
||||||
|
// Copy control
|
||||||
|
|
||||||
|
//- Disallow default bitwise copy construct
|
||||||
|
polyRef(const polyRef&);
|
||||||
|
|
||||||
|
//- Disallow default bitwise assignment
|
||||||
|
void operator=(const polyRef&);
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
ClassName("polyRef");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from mesh, read_if_present refinement data
|
||||||
|
// (from write below)
|
||||||
|
polyRef(const polyMesh& mesh);
|
||||||
|
|
||||||
|
//- Construct from mesh and un/refinement data
|
||||||
|
polyRef
|
||||||
|
(
|
||||||
|
const polyMesh& mesh,
|
||||||
|
const labelList& cellLevel,
|
||||||
|
const labelList& pointLevel,
|
||||||
|
const polyRefinementHistory& history
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct from mesh and refinement data.
|
||||||
|
polyRef
|
||||||
|
(
|
||||||
|
const polyMesh& mesh,
|
||||||
|
const labelList& cellLevel,
|
||||||
|
const labelList& pointLevel
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
// Access
|
||||||
|
|
||||||
|
const labelIOList& cellLevel() const
|
||||||
|
{
|
||||||
|
return cellLevel_;
|
||||||
|
}
|
||||||
|
|
||||||
|
const labelIOList& pointLevel() const
|
||||||
|
{
|
||||||
|
return pointLevel_;
|
||||||
|
}
|
||||||
|
|
||||||
|
const polyRefinementHistory& history() const
|
||||||
|
{
|
||||||
|
return history_;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Typical edge length between unrefined points
|
||||||
|
scalar level0EdgeLength() const
|
||||||
|
{
|
||||||
|
return level0Edge_;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Refinement
|
||||||
|
|
||||||
|
// Get cell level such that the face has the most points that are
|
||||||
|
// <= level (at least three points)
|
||||||
|
label getAnchorLevel(const label faceI) const;
|
||||||
|
|
||||||
|
//- Helper: get points of a cell without using cellPoints addressing
|
||||||
|
labelList cellPoints(const label cellI) const;
|
||||||
|
|
||||||
|
//- Given valid mesh and current cell level and proposed
|
||||||
|
// cells to refine calculate any clashes (due to 2:1) and return
|
||||||
|
// ok list of cells to refine.
|
||||||
|
// Either adds cells to refine to set (maxSet = true) or
|
||||||
|
// removes cells to refine (maxSet = false)
|
||||||
|
labelList consistentRefinement
|
||||||
|
(
|
||||||
|
const labelList& cellsToRefine,
|
||||||
|
const bool maxSet
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- Like consistentRefinement but slower:
|
||||||
|
// - specify number of cells between consecutive refinement levels
|
||||||
|
// (consistentRefinement equivalent to 1)
|
||||||
|
// - specify max level difference between point-connected cells.
|
||||||
|
// (-1 to disable). Note that with normal 2:1 limitation
|
||||||
|
// (maxFaceDiff=1) there can be 8:1 size difference across point
|
||||||
|
// connected cells so maxPointDiff allows you to make that less.
|
||||||
|
// cellsToRefine : cells we're thinking about refining. It will
|
||||||
|
// extend this set. All refinement levels will be
|
||||||
|
// at least maxFaceDiff layers thick.
|
||||||
|
// facesToCheck : additional faces where to implement the
|
||||||
|
// maxFaceDiff thickness (usually only boundary
|
||||||
|
// faces)
|
||||||
|
labelList consistentSlowRefinement
|
||||||
|
(
|
||||||
|
const label maxFaceDiff,
|
||||||
|
const labelList& cellsToRefine,
|
||||||
|
const labelList& facesToCheck,
|
||||||
|
const label maxPointDiff,
|
||||||
|
const labelList& pointsToCheck
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- Like consistentSlowRefinement but uses different meshWave
|
||||||
|
// (proper distance instead of toplogical count). No point checks
|
||||||
|
// yet
|
||||||
|
labelList consistentSlowRefinement2
|
||||||
|
(
|
||||||
|
const label maxFaceDiff,
|
||||||
|
const labelList& cellsToRefine,
|
||||||
|
const labelList& facesToCheck
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- Insert refinement. All selected cells will be split into n cells
|
||||||
|
// where n is the number of points per cell.
|
||||||
|
// Returns per element in cells the n cells they were split into.
|
||||||
|
// Guarantees that the 0th element is the original cell label.
|
||||||
|
// Mapping:
|
||||||
|
// -split cells: n new ones get added from original
|
||||||
|
// -split faces: original gets modified; n - 1 new ones get added
|
||||||
|
// from original
|
||||||
|
// -added internal faces: added from original cell face (if
|
||||||
|
// that was internal) or created out-of-nothing (so will not
|
||||||
|
// get mapped!). Note: could make this inflate from point but
|
||||||
|
// that will allocate interpolation.
|
||||||
|
// -points added to split edge: added from edge start()
|
||||||
|
// -midpoints added: added from cellPoints[0].
|
||||||
|
labelListList setRefinement
|
||||||
|
(
|
||||||
|
const labelList& cells,
|
||||||
|
directTopoChange&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Update local numbering for changed mesh
|
||||||
|
void updateMesh(const mapPolyMesh&);
|
||||||
|
|
||||||
|
|
||||||
|
// Restoring : is where other processes delete and reinsert data.
|
||||||
|
// These callbacks allow this to restore the cellLevel
|
||||||
|
// and pointLevel for reintroduced points.
|
||||||
|
// Is not related to undoing my refinement
|
||||||
|
|
||||||
|
//- Signal points/face/cells for which to store data
|
||||||
|
void storeData
|
||||||
|
(
|
||||||
|
const labelList& pointsToStore,
|
||||||
|
const labelList& facesToStore,
|
||||||
|
const labelList& cellsToStore
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Update local numbering + undo
|
||||||
|
// Data to restore given as new pointlabel + stored pointlabel
|
||||||
|
// (i.e. what was in pointsToStore)
|
||||||
|
void updateMesh
|
||||||
|
(
|
||||||
|
const mapPolyMesh&,
|
||||||
|
const Map<label>& pointsToRestore,
|
||||||
|
const Map<label>& facesToRestore,
|
||||||
|
const Map<label>& cellsToRestore
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
//- Update local numbering for subsetted mesh.
|
||||||
|
// Gets new-to-old maps. Not compatible with unrefinement.
|
||||||
|
void subset
|
||||||
|
(
|
||||||
|
const labelList& pointMap,
|
||||||
|
const labelList& faceMap,
|
||||||
|
const labelList& cellMap
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Update local numbering for mesh redistribution
|
||||||
|
void distribute(const mapDistributePolyMesh&);
|
||||||
|
|
||||||
|
//- Debug: Check coupled mesh for correctness
|
||||||
|
void checkMesh() const;
|
||||||
|
|
||||||
|
//- Debug: Check 2:1 consistency across faces.
|
||||||
|
// maxPointDiff==-1 : only check 2:1 across faces
|
||||||
|
// maxPointDiff!=-1 : check point-connected cells.
|
||||||
|
void checkRefinementLevels
|
||||||
|
(
|
||||||
|
const label maxPointDiff,
|
||||||
|
const labelList& pointsToCheck
|
||||||
|
) const;
|
||||||
|
|
||||||
|
|
||||||
|
// Unrefinement (undoing refinement, not arbitrary coarsening)
|
||||||
|
|
||||||
|
//- Return the points at the centre of top-level split cells
|
||||||
|
// that can be unsplit.
|
||||||
|
labelList getSplitPoints() const;
|
||||||
|
|
||||||
|
//- Given proposed splitPoints to unrefine according to calculate
|
||||||
|
// any clashes (due to 2:1) and return ok list of points to
|
||||||
|
// unrefine. Either adds points to refine to set (maxSet = true)
|
||||||
|
// or removes points to refine (maxSet = false)
|
||||||
|
labelList consistentUnrefinement
|
||||||
|
(
|
||||||
|
const labelList& pointsToUnrefine,
|
||||||
|
const bool maxSet
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- Remove some refinement. Needs to be supplied output of
|
||||||
|
// consistentUnrefinement. Only call if undoable set.
|
||||||
|
// All n pointCells of a split point will be combined into
|
||||||
|
// the lowest numbered cell of those n.
|
||||||
|
void setUnrefinement
|
||||||
|
(
|
||||||
|
const labelList& splitPointLabels,
|
||||||
|
directTopoChange&
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// Write
|
||||||
|
|
||||||
|
// Set instance for mesh files
|
||||||
|
void setInstance(const fileName& inst);
|
||||||
|
|
||||||
|
//- Force writing refinement+history to polyMesh directory.
|
||||||
|
bool write() const;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
1160
src/dynamicMesh/dynamicMesh/refinementData/polyRefinementHistory.C
Normal file
1160
src/dynamicMesh/dynamicMesh/refinementData/polyRefinementHistory.C
Normal file
File diff suppressed because it is too large
Load diff
|
@ -0,0 +1,378 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | foam-extend: Open Source CFD
|
||||||
|
\\ / O peration | Version: 4.0
|
||||||
|
\\ / A nd | Web: http://www.foam-extend.org
|
||||||
|
\\/ M anipulation | For copyright notice see file Copyright
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of foam-extend.
|
||||||
|
|
||||||
|
foam-extend 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.
|
||||||
|
|
||||||
|
foam-extend 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 foam-extend. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Class
|
||||||
|
Foam::polyRefinementHistory
|
||||||
|
|
||||||
|
Description
|
||||||
|
All refinement history. Used in unrefinement.
|
||||||
|
|
||||||
|
- visibleCells: valid for the current mesh and contains per cell -1
|
||||||
|
(cell unrefined) or an index into splitCells_.
|
||||||
|
- splitCells: for every split contains the parent (also index into
|
||||||
|
splitCells) and optionally a subsplit as n indices into splitCells, where
|
||||||
|
n is the number of points of a cell. Note that the numbers in splitCells
|
||||||
|
are not cell labels, they are purely indices into splitCells.
|
||||||
|
|
||||||
|
E.g. 2 cells, cell 1 gets refined so end up with 9 cells:
|
||||||
|
@verbatim
|
||||||
|
// splitCells
|
||||||
|
9
|
||||||
|
(
|
||||||
|
-1 (1 2 3 4 5 6 7 8)
|
||||||
|
0 0()
|
||||||
|
0 0()
|
||||||
|
0 0()
|
||||||
|
0 0()
|
||||||
|
0 0()
|
||||||
|
0 0()
|
||||||
|
0 0()
|
||||||
|
0 0()
|
||||||
|
)
|
||||||
|
|
||||||
|
// visibleCells
|
||||||
|
9(-1 1 2 3 4 5 6 7 8)
|
||||||
|
@endverbatim
|
||||||
|
|
||||||
|
|
||||||
|
So cell0 (visibleCells=-1) is unrefined.
|
||||||
|
Cells 1-8 have all valid splitCells entries which are:
|
||||||
|
- parent:0
|
||||||
|
- subsplits:0()
|
||||||
|
|
||||||
|
The parent 0 refers back to the splitcell entries.
|
||||||
|
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
polyRefinementHistory.C
|
||||||
|
|
||||||
|
Author
|
||||||
|
Vuko Vukcevic, Wikki Ltd. All rights reserved
|
||||||
|
|
||||||
|
Notes
|
||||||
|
Generalisation of refinementHistory for polyhedral cells
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef polyRefinementHistory_H
|
||||||
|
#define polyRefinementHistory_H
|
||||||
|
|
||||||
|
#include "DynamicList.H"
|
||||||
|
#include "dynamicLabelList.H"
|
||||||
|
#include "labelList.H"
|
||||||
|
#include "FixedList.H"
|
||||||
|
#include "SLList.H"
|
||||||
|
#include "autoPtr.H"
|
||||||
|
#include "regIOobject.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// Forward declaration of classes
|
||||||
|
class mapPolyMesh;
|
||||||
|
class mapDistributePolyMesh;
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class polyRefinementHistory Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class polyRefinementHistory
|
||||||
|
:
|
||||||
|
public regIOobject
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
class splitPolyCell
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
// Index to original splitCell this cell was refined off from
|
||||||
|
// -1: top level cell
|
||||||
|
// -2: free splitCell (so should also be in freeSplitCells_)
|
||||||
|
label parent_;
|
||||||
|
|
||||||
|
//- cells this cell was refined into
|
||||||
|
autoPtr<labelList> addedCellsPtr_;
|
||||||
|
|
||||||
|
//- Construct null (parent = -1)
|
||||||
|
splitPolyCell();
|
||||||
|
|
||||||
|
//- Construct from parent
|
||||||
|
splitPolyCell(const label parent);
|
||||||
|
|
||||||
|
//- Construct from Istream
|
||||||
|
splitPolyCell(Istream& is);
|
||||||
|
|
||||||
|
//- Construct as deep copy
|
||||||
|
splitPolyCell(const splitPolyCell&);
|
||||||
|
|
||||||
|
//- Copy operator since autoPtr otherwise 'steals' storage.
|
||||||
|
void operator=(const splitPolyCell& s)
|
||||||
|
{
|
||||||
|
// Check for assignment to self
|
||||||
|
if (this == &s)
|
||||||
|
{
|
||||||
|
FatalErrorIn
|
||||||
|
(
|
||||||
|
"splitPolyCell::operator=(const Foam::splitPolyCell&)"
|
||||||
|
) << "Attempted assignment to self"
|
||||||
|
<< abort(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
|
parent_ = s.parent_;
|
||||||
|
|
||||||
|
addedCellsPtr_.reset
|
||||||
|
(
|
||||||
|
s.addedCellsPtr_.valid()
|
||||||
|
? new labelList(s.addedCellsPtr_())
|
||||||
|
: NULL
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool operator==(const splitPolyCell& s) const
|
||||||
|
{
|
||||||
|
if (addedCellsPtr_.valid() != s.addedCellsPtr_.valid())
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else if (parent_ != s.parent_)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else if (addedCellsPtr_.valid())
|
||||||
|
{
|
||||||
|
return addedCellsPtr_() == s.addedCellsPtr_();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool operator!=(const splitPolyCell& s) const
|
||||||
|
{
|
||||||
|
return !operator==(s);
|
||||||
|
}
|
||||||
|
|
||||||
|
friend Istream& operator>>(Istream&, splitPolyCell&);
|
||||||
|
friend Ostream& operator<<(Ostream&, const splitPolyCell&);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
TypeName("polyRefinementHistory");
|
||||||
|
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
//- Storage for splitCells
|
||||||
|
DynamicList<splitPolyCell> splitCells_;
|
||||||
|
|
||||||
|
//- Unused indices in splitCells
|
||||||
|
dynamicLabelList freeSplitCells_;
|
||||||
|
|
||||||
|
//- Currently visible cells. Indices into splitCells.
|
||||||
|
labelList visibleCells_;
|
||||||
|
|
||||||
|
|
||||||
|
// Private member functions
|
||||||
|
|
||||||
|
//- Debug write
|
||||||
|
static void writeEntry
|
||||||
|
(
|
||||||
|
const List<splitPolyCell>&,
|
||||||
|
const splitPolyCell&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Debug write
|
||||||
|
static void writeDebug
|
||||||
|
(
|
||||||
|
const labelList&,
|
||||||
|
const List<splitPolyCell>&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Check consistency of structure, i.e. indices into splitCells_.
|
||||||
|
void checkIndices() const;
|
||||||
|
|
||||||
|
//- Allocate a splitCell. Return index in splitCells_.
|
||||||
|
label allocateSplitCell
|
||||||
|
(
|
||||||
|
const label parent,
|
||||||
|
const label i,
|
||||||
|
const label nCells
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Free a splitCell.
|
||||||
|
void freeSplitCell(const label index);
|
||||||
|
|
||||||
|
//- Mark entry in splitCells. Recursively mark its parent and subs.
|
||||||
|
void markSplit
|
||||||
|
(
|
||||||
|
const label,
|
||||||
|
labelList& oldToNew,
|
||||||
|
DynamicList<splitPolyCell>&
|
||||||
|
) const;
|
||||||
|
|
||||||
|
void countProc
|
||||||
|
(
|
||||||
|
const label index,
|
||||||
|
const label newProcNo,
|
||||||
|
labelList& splitCellProc,
|
||||||
|
labelList& splitCellNum
|
||||||
|
) const;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct (read) given an IOobject
|
||||||
|
polyRefinementHistory(const IOobject&);
|
||||||
|
|
||||||
|
//- Construct (read) or construct null
|
||||||
|
polyRefinementHistory
|
||||||
|
(
|
||||||
|
const IOobject&,
|
||||||
|
const List<splitPolyCell>& splitCells,
|
||||||
|
const labelList& visibleCells
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct (read) or construct from initial number of cells
|
||||||
|
// (all visible)
|
||||||
|
polyRefinementHistory(const IOobject&, const label nCells);
|
||||||
|
|
||||||
|
//- Construct as copy
|
||||||
|
polyRefinementHistory(const IOobject&, const polyRefinementHistory&);
|
||||||
|
|
||||||
|
//- Construct from Istream
|
||||||
|
polyRefinementHistory(const IOobject&, Istream&);
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
//- Per cell in the current mesh (i.e. visible) either -1 (unrefined)
|
||||||
|
// or an index into splitCells.
|
||||||
|
const labelList& visibleCells() const
|
||||||
|
{
|
||||||
|
return visibleCells_;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Storage for splitPolyCells.
|
||||||
|
const DynamicList<splitPolyCell>& splitCells() const
|
||||||
|
{
|
||||||
|
return splitCells_;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Cache of unused indices in splitCells
|
||||||
|
const dynamicLabelList& freeSplitCells() const
|
||||||
|
{
|
||||||
|
return freeSplitCells_;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Is there unrefinement history. Note that this will fall over if
|
||||||
|
// there are 0 cells in the mesh. But this gives problems with
|
||||||
|
// lots of other programs anyway.
|
||||||
|
bool active() const
|
||||||
|
{
|
||||||
|
return visibleCells_.size() > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Get parent of cell
|
||||||
|
label parentIndex(const label cellI) const
|
||||||
|
{
|
||||||
|
label index = visibleCells_[cellI];
|
||||||
|
|
||||||
|
if (index < 0)
|
||||||
|
{
|
||||||
|
FatalErrorIn("polyRefinementHistory::parentIndex(const label)")
|
||||||
|
<< "Cell " << cellI << " is not visible"
|
||||||
|
<< abort(FatalError);
|
||||||
|
}
|
||||||
|
return splitCells_[index].parent_;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Store splitting of cell into n (number of points for a cell)
|
||||||
|
void storeSplit
|
||||||
|
(
|
||||||
|
const label cellI,
|
||||||
|
const labelList& addedCells
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Store combining n cells into master
|
||||||
|
void combineCells
|
||||||
|
(
|
||||||
|
const label masterCellI,
|
||||||
|
const labelList& combinedCells
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Update numbering for mesh changes
|
||||||
|
void updateMesh(const mapPolyMesh&);
|
||||||
|
|
||||||
|
//- Update numbering for subsetting
|
||||||
|
void subset
|
||||||
|
(
|
||||||
|
const labelList& pointMap,
|
||||||
|
const labelList& faceMap,
|
||||||
|
const labelList& cellMap
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Update local numbering for mesh redistribution.
|
||||||
|
// Can only distribute clusters sent across in one go; cannot
|
||||||
|
// handle parts recombined in multiple passes.
|
||||||
|
void distribute(const mapDistributePolyMesh&);
|
||||||
|
|
||||||
|
//- Compact splitCells_. Removes all freeSplitCells_ elements.
|
||||||
|
void compact();
|
||||||
|
|
||||||
|
//- Extend/shrink storage. additional visibleCells_ elements get
|
||||||
|
// set to -1.
|
||||||
|
void resize(const label nCells);
|
||||||
|
|
||||||
|
//- Debug write
|
||||||
|
void writeDebug() const;
|
||||||
|
|
||||||
|
|
||||||
|
//- ReadData function required for regIOobject read operation
|
||||||
|
virtual bool readData(Istream&);
|
||||||
|
|
||||||
|
//- WriteData function required for regIOobject write operation
|
||||||
|
virtual bool writeData(Ostream&) const;
|
||||||
|
|
||||||
|
|
||||||
|
// IOstream Operators
|
||||||
|
|
||||||
|
friend Istream& operator>>(Istream&, polyRefinementHistory&);
|
||||||
|
friend Ostream& operator<<(Ostream&, const polyRefinementHistory&);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -28,7 +28,7 @@ Description
|
||||||
All refinement history. Used in unrefinement.
|
All refinement history. Used in unrefinement.
|
||||||
|
|
||||||
- visibleCells: valid for the current mesh and contains per cell -1
|
- visibleCells: valid for the current mesh and contains per cell -1
|
||||||
(cell unrefined) or an index into splitCells_.
|
(cell unrefined) or an index into splitCells_.
|
||||||
- splitCells: for every split contains the parent (also index into
|
- splitCells: for every split contains the parent (also index into
|
||||||
splitCells) and optionally a subsplit as 8 indices into splitCells.
|
splitCells) and optionally a subsplit as 8 indices into splitCells.
|
||||||
Note that the numbers in splitCells are not cell labels, they are purely
|
Note that the numbers in splitCells are not cell labels, they are purely
|
||||||
|
|
|
@ -186,6 +186,7 @@ $(derivedFvPatchFields)/uniformDensityHydrostaticPressure/uniformDensityHydrosta
|
||||||
$(derivedFvPatchFields)/pulseFixedValue/pulseFixedValueFvPatchFields.C
|
$(derivedFvPatchFields)/pulseFixedValue/pulseFixedValueFvPatchFields.C
|
||||||
$(derivedFvPatchFields)/waveTransmissiveInlet/waveTransmissiveInletFvPatchFields.C
|
$(derivedFvPatchFields)/waveTransmissiveInlet/waveTransmissiveInletFvPatchFields.C
|
||||||
$(derivedFvPatchFields)/noSlipWall/noSlipWallFvPatchVectorField.C
|
$(derivedFvPatchFields)/noSlipWall/noSlipWallFvPatchVectorField.C
|
||||||
|
$(derivedFvPatchFields)/noSlipMovingWall/noSlipMovingWallFvPatchVectorField.C
|
||||||
|
|
||||||
fvsPatchFields = fields/fvsPatchFields
|
fvsPatchFields = fields/fvsPatchFields
|
||||||
$(fvsPatchFields)/fvsPatchField/fvsPatchFields.C
|
$(fvsPatchFields)/fvsPatchField/fvsPatchFields.C
|
||||||
|
|
|
@ -0,0 +1,204 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | foam-extend: Open Source CFD
|
||||||
|
\\ / O peration | Version: 4.0
|
||||||
|
\\ / A nd | Web: http://www.foam-extend.org
|
||||||
|
\\/ M anipulation | For copyright notice see file Copyright
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of foam-extend.
|
||||||
|
|
||||||
|
foam-extend 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.
|
||||||
|
|
||||||
|
foam-extend 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 foam-extend. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "noSlipMovingWallFvPatchVectorField.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
#include "volFields.H"
|
||||||
|
#include "surfaceFields.H"
|
||||||
|
#include "fvcMeshPhi.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
noSlipMovingWallFvPatchVectorField::noSlipMovingWallFvPatchVectorField
|
||||||
|
(
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<vector, volMesh>& iF
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedValueFvPatchVectorField(p, iF)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
noSlipMovingWallFvPatchVectorField::noSlipMovingWallFvPatchVectorField
|
||||||
|
(
|
||||||
|
const noSlipMovingWallFvPatchVectorField& ptf,
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<vector, volMesh>& iF,
|
||||||
|
const fvPatchFieldMapper& mapper
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedValueFvPatchVectorField(ptf, p, iF, mapper)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
noSlipMovingWallFvPatchVectorField::noSlipMovingWallFvPatchVectorField
|
||||||
|
(
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<vector, volMesh>& iF,
|
||||||
|
const dictionary& dict
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedValueFvPatchVectorField(p, iF)
|
||||||
|
{
|
||||||
|
fvPatchVectorField::operator=(vectorField("value", dict, p.size()));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
noSlipMovingWallFvPatchVectorField::noSlipMovingWallFvPatchVectorField
|
||||||
|
(
|
||||||
|
const noSlipMovingWallFvPatchVectorField& pivpvf
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedValueFvPatchVectorField(pivpvf)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
noSlipMovingWallFvPatchVectorField::noSlipMovingWallFvPatchVectorField
|
||||||
|
(
|
||||||
|
const noSlipMovingWallFvPatchVectorField& pivpvf,
|
||||||
|
const DimensionedField<vector, volMesh>& iF
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedValueFvPatchVectorField(pivpvf, iF)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void noSlipMovingWallFvPatchVectorField::updateCoeffs()
|
||||||
|
{
|
||||||
|
if (updated())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const fvMesh& mesh = dimensionedInternalField().mesh();
|
||||||
|
|
||||||
|
if (mesh.changing())
|
||||||
|
{
|
||||||
|
const fvPatch& p = patch();
|
||||||
|
const polyPatch& pp = p.patch();
|
||||||
|
const pointField& oldPoints = mesh.oldPoints();
|
||||||
|
|
||||||
|
vectorField oldFc(pp.size());
|
||||||
|
|
||||||
|
forAll(oldFc, i)
|
||||||
|
{
|
||||||
|
oldFc[i] = pp[i].centre(oldPoints);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get wall-parallel mesh motion velocity from geometry
|
||||||
|
vectorField Up =
|
||||||
|
(pp.faceCentres() - oldFc)/mesh.time().deltaT().value();
|
||||||
|
|
||||||
|
const volVectorField& U =
|
||||||
|
mesh.lookupObject<volVectorField>
|
||||||
|
(
|
||||||
|
dimensionedInternalField().name()
|
||||||
|
);
|
||||||
|
|
||||||
|
scalarField phip =
|
||||||
|
p.patchField<surfaceScalarField, scalar>(fvc::meshPhi(U));
|
||||||
|
|
||||||
|
vectorField n = p.nf();
|
||||||
|
const scalarField& magSf = p.magSf();
|
||||||
|
scalarField Un = phip/(magSf + VSMALL);
|
||||||
|
|
||||||
|
// Adjust for surface-normal mesh motion flux
|
||||||
|
vectorField::operator=(Up + n*(Un - (n & Up)));
|
||||||
|
}
|
||||||
|
|
||||||
|
fixedValueFvPatchVectorField::updateCoeffs();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
tmp<vectorField>
|
||||||
|
noSlipMovingWallFvPatchVectorField::gradientInternalCoeffs() const
|
||||||
|
{
|
||||||
|
const vectorField nPatch = this->patch().nf();
|
||||||
|
|
||||||
|
// Calculate the diagonal part of the transformation tensor
|
||||||
|
vectorField implicitCoeffs(nPatch.size(), vector::zero);
|
||||||
|
contractLinear(implicitCoeffs, I - nPatch*nPatch);
|
||||||
|
|
||||||
|
return -this->patch().deltaCoeffs()*implicitCoeffs;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
tmp<vectorField>
|
||||||
|
noSlipMovingWallFvPatchVectorField::gradientBoundaryCoeffs() const
|
||||||
|
{
|
||||||
|
// Get necessary field
|
||||||
|
const vectorField& UPatch = *this;
|
||||||
|
const vectorField nPatch = this->patch().nf();
|
||||||
|
const tensorField T = I - nPatch*nPatch;
|
||||||
|
const vectorField UPatchInternal = this->patchInternalField();
|
||||||
|
|
||||||
|
// Calculate the explicit contribution in the loop for performance
|
||||||
|
vectorField explicitCoeffs(nPatch.size(), vector::zero);
|
||||||
|
|
||||||
|
forAll(explicitCoeffs, faceI)
|
||||||
|
{
|
||||||
|
const tensor& curT = T[faceI];
|
||||||
|
tensor curDiagT(tensor::zero);
|
||||||
|
expandLinear(curDiagT, contractLinear(curT));
|
||||||
|
|
||||||
|
explicitCoeffs[faceI] =
|
||||||
|
(curT & UPatch[faceI])
|
||||||
|
- (
|
||||||
|
(curT - curDiagT)
|
||||||
|
& UPatchInternal[faceI]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return this->patch().deltaCoeffs()*explicitCoeffs;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void noSlipMovingWallFvPatchVectorField::write(Ostream& os) const
|
||||||
|
{
|
||||||
|
fvPatchVectorField::write(os);
|
||||||
|
writeEntry("value", os);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
makePatchTypeField
|
||||||
|
(
|
||||||
|
fvPatchVectorField,
|
||||||
|
noSlipMovingWallFvPatchVectorField
|
||||||
|
);
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
|
@ -0,0 +1,150 @@
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | foam-extend: Open Source CFD
|
||||||
|
\\ / O peration | Version: 4.0
|
||||||
|
\\ / A nd | Web: http://www.foam-extend.org
|
||||||
|
\\/ M anipulation | For copyright notice see file Copyright
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of foam-extend.
|
||||||
|
|
||||||
|
foam-extend 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.
|
||||||
|
|
||||||
|
foam-extend 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 foam-extend. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Class
|
||||||
|
Foam::noSlipMovingWallFvPatchVectorField
|
||||||
|
|
||||||
|
Description
|
||||||
|
Foam::noSlipMovingWallFvPatchVectorField
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
noSlipMovingWallFvPatchVectorField.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef noSlipMovingWallFvPatchVectorField_H
|
||||||
|
#define noSlipMovingWallFvPatchVectorField_H
|
||||||
|
|
||||||
|
#include "fvPatchFields.H"
|
||||||
|
#include "fixedValueFvPatchFields.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class noSlipMovingWallFvPatch Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class noSlipMovingWallFvPatchVectorField
|
||||||
|
:
|
||||||
|
public fixedValueFvPatchVectorField
|
||||||
|
{
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("noSlipMovingWall");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from patch and internal field
|
||||||
|
noSlipMovingWallFvPatchVectorField
|
||||||
|
(
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<vector, volMesh>&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct from patch, internal field and dictionary
|
||||||
|
noSlipMovingWallFvPatchVectorField
|
||||||
|
(
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<vector, volMesh>&,
|
||||||
|
const dictionary&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct by mapping given noSlipMovingWallFvPatchVectorField
|
||||||
|
// onto a new patch
|
||||||
|
noSlipMovingWallFvPatchVectorField
|
||||||
|
(
|
||||||
|
const noSlipMovingWallFvPatchVectorField&,
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<vector, volMesh>&,
|
||||||
|
const fvPatchFieldMapper&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct as copy
|
||||||
|
noSlipMovingWallFvPatchVectorField
|
||||||
|
(
|
||||||
|
const noSlipMovingWallFvPatchVectorField&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct and return a clone
|
||||||
|
virtual tmp<fvPatchVectorField> clone() const
|
||||||
|
{
|
||||||
|
return tmp<fvPatchVectorField>
|
||||||
|
(
|
||||||
|
new noSlipMovingWallFvPatchVectorField(*this)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Construct as copy setting internal field reference
|
||||||
|
noSlipMovingWallFvPatchVectorField
|
||||||
|
(
|
||||||
|
const noSlipMovingWallFvPatchVectorField&,
|
||||||
|
const DimensionedField<vector, volMesh>&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct and return a clone setting internal field reference
|
||||||
|
virtual tmp<fvPatchVectorField> clone
|
||||||
|
(
|
||||||
|
const DimensionedField<vector, volMesh>& iF
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
return tmp<fvPatchVectorField>
|
||||||
|
(
|
||||||
|
new noSlipMovingWallFvPatchVectorField(*this, iF)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Member functions
|
||||||
|
|
||||||
|
//- Update the coefficients associated with the patch field
|
||||||
|
virtual void updateCoeffs();
|
||||||
|
|
||||||
|
//- Return the matrix diagonal coefficients corresponding to the
|
||||||
|
// evaluation of the gradient of this patchField
|
||||||
|
virtual tmp<vectorField> gradientInternalCoeffs() const;
|
||||||
|
|
||||||
|
//- Return the matrix source coefficients corresponding to the
|
||||||
|
// evaluation of the gradient of this patchField
|
||||||
|
virtual tmp<vectorField> gradientBoundaryCoeffs() const;
|
||||||
|
|
||||||
|
//- Write
|
||||||
|
virtual void write(Ostream&) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
Reference in a new issue