mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: add -dict option for mirrorMesh
This commit is contained in:
@ -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-2017 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2017 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.
|
||||||
@ -31,24 +31,37 @@ License
|
|||||||
|
|
||||||
Foam::mirrorFvMesh::mirrorFvMesh(const IOobject& io)
|
Foam::mirrorFvMesh::mirrorFvMesh(const IOobject& io)
|
||||||
:
|
:
|
||||||
fvMesh(io),
|
mirrorFvMesh
|
||||||
mirrorMeshDict_
|
(
|
||||||
|
io,
|
||||||
|
IOdictionary
|
||||||
(
|
(
|
||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
"mirrorMeshDict",
|
"mirrorMeshDict",
|
||||||
time().system(),
|
io.time().system(),
|
||||||
*this,
|
io.time(),
|
||||||
IOobject::MUST_READ_IF_MODIFIED,
|
IOobject::MUST_READ_IF_MODIFIED,
|
||||||
IOobject::NO_WRITE
|
IOobject::NO_WRITE
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::mirrorFvMesh::mirrorFvMesh
|
||||||
|
(
|
||||||
|
const IOobject& io,
|
||||||
|
const IOdictionary& mirrorDict
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fvMesh(io)
|
||||||
{
|
{
|
||||||
plane mirrorPlane(mirrorMeshDict_);
|
plane mirrorPlane(mirrorDict);
|
||||||
|
|
||||||
const scalar planeTolerance
|
const scalar planeTolerance
|
||||||
(
|
(
|
||||||
mirrorMeshDict_.get<scalar>("planeTolerance")
|
mirrorDict.get<scalar>("planeTolerance")
|
||||||
);
|
);
|
||||||
|
|
||||||
const pointField& oldPoints = points();
|
const pointField& oldPoints = points();
|
||||||
@ -57,6 +70,9 @@ Foam::mirrorFvMesh::mirrorFvMesh(const IOobject& io)
|
|||||||
const label nOldInternalFaces = nInternalFaces();
|
const label nOldInternalFaces = nInternalFaces();
|
||||||
const polyPatchList& oldPatches = boundaryMesh();
|
const polyPatchList& oldPatches = boundaryMesh();
|
||||||
|
|
||||||
|
Info<< "Mirroring mesh at origin:" << mirrorPlane.origin()
|
||||||
|
<< " normal:" << mirrorPlane.normal() << nl;
|
||||||
|
|
||||||
// Mirror the points
|
// Mirror the points
|
||||||
Info<< "Mirroring points. Old points: " << oldPoints.size();
|
Info<< "Mirroring points. Old points: " << oldPoints.size();
|
||||||
|
|
||||||
@ -66,15 +82,15 @@ Foam::mirrorFvMesh::mirrorFvMesh(const IOobject& io)
|
|||||||
labelList mirrorPointLookup(oldPoints.size(), -1);
|
labelList mirrorPointLookup(oldPoints.size(), -1);
|
||||||
|
|
||||||
// Grab the old points
|
// Grab the old points
|
||||||
forAll(oldPoints, pointi)
|
for (const point& pt : oldPoints)
|
||||||
{
|
{
|
||||||
newPoints[nNewPoints] = oldPoints[pointi];
|
newPoints[nNewPoints] = pt;
|
||||||
nNewPoints++;
|
++nNewPoints;
|
||||||
}
|
}
|
||||||
|
|
||||||
forAll(oldPoints, pointi)
|
forAll(oldPoints, pointi)
|
||||||
{
|
{
|
||||||
scalar alpha =
|
const scalar alpha =
|
||||||
mirrorPlane.normalIntersect
|
mirrorPlane.normalIntersect
|
||||||
(
|
(
|
||||||
oldPoints[pointi],
|
oldPoints[pointi],
|
||||||
@ -121,7 +137,6 @@ Foam::mirrorFvMesh::mirrorFvMesh(const IOobject& io)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Info<< "Mirroring faces. Old faces: " << oldFaces.size();
|
Info<< "Mirroring faces. Old faces: " << oldFaces.size();
|
||||||
|
|
||||||
// Algorithm:
|
// Algorithm:
|
||||||
|
|||||||
@ -51,9 +51,6 @@ class mirrorFvMesh
|
|||||||
{
|
{
|
||||||
// Private data
|
// Private data
|
||||||
|
|
||||||
//- Mirror dictionary
|
|
||||||
IOdictionary mirrorMeshDict_;
|
|
||||||
|
|
||||||
//- Mirrored mesh
|
//- Mirrored mesh
|
||||||
autoPtr<fvMesh> mirrorMeshPtr_;
|
autoPtr<fvMesh> mirrorMeshPtr_;
|
||||||
|
|
||||||
@ -77,8 +74,11 @@ public:
|
|||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct from IOobject
|
//- Construct from IOobject, using system mirrorMeshDict
|
||||||
mirrorFvMesh(const IOobject& io);
|
explicit mirrorFvMesh(const IOobject& io);
|
||||||
|
|
||||||
|
//- Construct from IOobject and specified mirrorMeshDict
|
||||||
|
mirrorFvMesh(const IOobject& io, const IOdictionary& mirrorDict);
|
||||||
|
|
||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
|
|||||||
@ -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-2017 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2017 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.
|
||||||
@ -49,12 +49,25 @@ int main(int argc, char *argv[])
|
|||||||
"Mirrors a mesh around a given plane."
|
"Mirrors a mesh around a given plane."
|
||||||
);
|
);
|
||||||
|
|
||||||
|
#include "addDictOption.H"
|
||||||
|
// Adjust the help text
|
||||||
|
argList::addUsage("dict", "Specify alternative mirrorMeshDict");
|
||||||
|
argList::setAdvanced("decomposeParDict");
|
||||||
|
|
||||||
#include "addOverwriteOption.H"
|
#include "addOverwriteOption.H"
|
||||||
#include "setRootCase.H"
|
#include "setRootCase.H"
|
||||||
#include "createTime.H"
|
#include "createTime.H"
|
||||||
|
|
||||||
const bool overwrite = args.found("overwrite");
|
const bool overwrite = args.found("overwrite");
|
||||||
|
|
||||||
|
const word dictName("mirrorMeshDict");
|
||||||
|
|
||||||
|
#include "setSystemRunTimeDictionaryIO.H"
|
||||||
|
|
||||||
|
Info<< "Reading " << dictName << "\n" << endl;
|
||||||
|
|
||||||
|
const IOdictionary mirrorDict(dictIO);
|
||||||
|
|
||||||
mirrorFvMesh mesh
|
mirrorFvMesh mesh
|
||||||
(
|
(
|
||||||
IOobject
|
IOobject
|
||||||
@ -62,7 +75,8 @@ int main(int argc, char *argv[])
|
|||||||
mirrorFvMesh::defaultRegion,
|
mirrorFvMesh::defaultRegion,
|
||||||
runTime.constant(),
|
runTime.constant(),
|
||||||
runTime
|
runTime
|
||||||
)
|
),
|
||||||
|
mirrorDict
|
||||||
);
|
);
|
||||||
|
|
||||||
hexRef8Data refData
|
hexRef8Data refData
|
||||||
|
|||||||
@ -138,7 +138,7 @@ _of_complete_cache_[mergeOrSplitBaffles]="-case -decomposeParDict -dict -fileHan
|
|||||||
_of_complete_cache_[mergeSurfacePatches]="-case -fileHandler -output -patchIdRange -patchIds -patchNames | -keep -noFunctionObjects -doc -doc-source -help"
|
_of_complete_cache_[mergeSurfacePatches]="-case -fileHandler -output -patchIdRange -patchIds -patchNames | -keep -noFunctionObjects -doc -doc-source -help"
|
||||||
_of_complete_cache_[meshToFPMA]="-case -decomposeParDict -fileHandler | -noFunctionObjects -parallel -doc -doc-source -help"
|
_of_complete_cache_[meshToFPMA]="-case -decomposeParDict -fileHandler | -noFunctionObjects -parallel -doc -doc-source -help"
|
||||||
_of_complete_cache_[mhdFoam]="-case -decomposeParDict -fileHandler | -dry-run -dry-run-write -listFunctionObjects -listRegisteredSwitches -listScalarBCs -listSwitches -listUnsetSwitches -listVectorBCs -noFunctionObjects -parallel -postProcess -doc -doc-source -help"
|
_of_complete_cache_[mhdFoam]="-case -decomposeParDict -fileHandler | -dry-run -dry-run-write -listFunctionObjects -listRegisteredSwitches -listScalarBCs -listSwitches -listUnsetSwitches -listVectorBCs -noFunctionObjects -parallel -postProcess -doc -doc-source -help"
|
||||||
_of_complete_cache_[mirrorMesh]="-case -decomposeParDict -fileHandler | -noFunctionObjects -overwrite -parallel -doc -doc-source -help"
|
_of_complete_cache_[mirrorMesh]="-case -dict -decomposeParDict -fileHandler | -noFunctionObjects -overwrite -parallel -doc -doc-source -help"
|
||||||
_of_complete_cache_[mixtureAdiabaticFlameT]="-case -fileHandler | -doc -doc-source -help"
|
_of_complete_cache_[mixtureAdiabaticFlameT]="-case -fileHandler | -doc -doc-source -help"
|
||||||
_of_complete_cache_[modifyMesh]="-case -decomposeParDict -dict -fileHandler | -overwrite -parallel -doc -doc-source -help"
|
_of_complete_cache_[modifyMesh]="-case -decomposeParDict -dict -fileHandler | -overwrite -parallel -doc -doc-source -help"
|
||||||
_of_complete_cache_[moveDynamicMesh]="-case -decomposeParDict -fileHandler -region | -checkAMI -noFunctionObjects -parallel -doc -doc-source -help"
|
_of_complete_cache_[moveDynamicMesh]="-case -decomposeParDict -fileHandler -region | -checkAMI -noFunctionObjects -parallel -doc -doc-source -help"
|
||||||
|
|||||||
@ -5,13 +5,8 @@ cd ${0%/*} || exit 1 # Run from this directory
|
|||||||
runApplication blockMesh
|
runApplication blockMesh
|
||||||
runApplication transformPoints -scale '(1.6666 1 1)'
|
runApplication transformPoints -scale '(1.6666 1 1)'
|
||||||
|
|
||||||
runApplication changeDictionary -instance system -dict system/changeDictionaryDict.X
|
runApplication -s xplane mirrorMesh -dict system/mirrorMeshDict.X -overwrite
|
||||||
runApplication mirrorMesh -overwrite
|
runApplication -s yplane mirrorMesh -dict system/mirrorMeshDict.Y -overwrite
|
||||||
rm -f log.mirrorMesh
|
|
||||||
rm -f log.changeDictionary
|
|
||||||
|
|
||||||
runApplication changeDictionary -instance system -dict system/changeDictionaryDict.Y
|
|
||||||
runApplication mirrorMesh -overwrite
|
|
||||||
|
|
||||||
restore0Dir
|
restore0Dir
|
||||||
|
|
||||||
|
|||||||
@ -10,7 +10,6 @@ FoamFile
|
|||||||
version 2.0;
|
version 2.0;
|
||||||
format ascii;
|
format ascii;
|
||||||
class dictionary;
|
class dictionary;
|
||||||
location "system";
|
|
||||||
object mirrorMeshDict;
|
object mirrorMeshDict;
|
||||||
}
|
}
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
@ -20,10 +19,9 @@ planeType pointAndNormal;
|
|||||||
pointAndNormalDict
|
pointAndNormalDict
|
||||||
{
|
{
|
||||||
point (0 0 0);
|
point (0 0 0);
|
||||||
normal (0 -1 0);
|
normal (0 0 -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
planeTolerance 1e-06;
|
planeTolerance 1e-6;
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -10,17 +10,18 @@ FoamFile
|
|||||||
version 2.0;
|
version 2.0;
|
||||||
format ascii;
|
format ascii;
|
||||||
class dictionary;
|
class dictionary;
|
||||||
object changeDictionaryDict;
|
object mirrorMeshDict;
|
||||||
}
|
}
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
mirrorMeshDict
|
planeType pointAndNormal;
|
||||||
{
|
|
||||||
pointAndNormalDict
|
pointAndNormalDict
|
||||||
{
|
{
|
||||||
point (0 0 0);
|
point (0 0 0);
|
||||||
normal (-1 0 0);
|
normal (-1 0 0);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
planeTolerance 1e-6;
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
@ -10,17 +10,18 @@ FoamFile
|
|||||||
version 2.0;
|
version 2.0;
|
||||||
format ascii;
|
format ascii;
|
||||||
class dictionary;
|
class dictionary;
|
||||||
object changeDictionaryDict;
|
object mirrorMeshDict;
|
||||||
}
|
}
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
mirrorMeshDict
|
planeType pointAndNormal;
|
||||||
{
|
|
||||||
pointAndNormalDict
|
pointAndNormalDict
|
||||||
{
|
{
|
||||||
point (0 0 0);
|
point (0 0 0);
|
||||||
normal (0 -1 0);
|
normal (0 -1 0);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
planeTolerance 1e-6;
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
Reference in New Issue
Block a user