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
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
|
||||
\\/ M anipulation | Copyright (C) 2017-2018 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -31,24 +31,37 @@ License
|
||||
|
||||
Foam::mirrorFvMesh::mirrorFvMesh(const IOobject& io)
|
||||
:
|
||||
fvMesh(io),
|
||||
mirrorMeshDict_
|
||||
mirrorFvMesh
|
||||
(
|
||||
IOobject
|
||||
io,
|
||||
IOdictionary
|
||||
(
|
||||
"mirrorMeshDict",
|
||||
time().system(),
|
||||
*this,
|
||||
IOobject::MUST_READ_IF_MODIFIED,
|
||||
IOobject::NO_WRITE
|
||||
IOobject
|
||||
(
|
||||
"mirrorMeshDict",
|
||||
io.time().system(),
|
||||
io.time(),
|
||||
IOobject::MUST_READ_IF_MODIFIED,
|
||||
IOobject::NO_WRITE
|
||||
)
|
||||
)
|
||||
)
|
||||
{}
|
||||
|
||||
|
||||
Foam::mirrorFvMesh::mirrorFvMesh
|
||||
(
|
||||
const IOobject& io,
|
||||
const IOdictionary& mirrorDict
|
||||
)
|
||||
:
|
||||
fvMesh(io)
|
||||
{
|
||||
plane mirrorPlane(mirrorMeshDict_);
|
||||
plane mirrorPlane(mirrorDict);
|
||||
|
||||
const scalar planeTolerance
|
||||
(
|
||||
mirrorMeshDict_.get<scalar>("planeTolerance")
|
||||
mirrorDict.get<scalar>("planeTolerance")
|
||||
);
|
||||
|
||||
const pointField& oldPoints = points();
|
||||
@ -57,6 +70,9 @@ Foam::mirrorFvMesh::mirrorFvMesh(const IOobject& io)
|
||||
const label nOldInternalFaces = nInternalFaces();
|
||||
const polyPatchList& oldPatches = boundaryMesh();
|
||||
|
||||
Info<< "Mirroring mesh at origin:" << mirrorPlane.origin()
|
||||
<< " normal:" << mirrorPlane.normal() << nl;
|
||||
|
||||
// Mirror the points
|
||||
Info<< "Mirroring points. Old points: " << oldPoints.size();
|
||||
|
||||
@ -66,15 +82,15 @@ Foam::mirrorFvMesh::mirrorFvMesh(const IOobject& io)
|
||||
labelList mirrorPointLookup(oldPoints.size(), -1);
|
||||
|
||||
// Grab the old points
|
||||
forAll(oldPoints, pointi)
|
||||
for (const point& pt : oldPoints)
|
||||
{
|
||||
newPoints[nNewPoints] = oldPoints[pointi];
|
||||
nNewPoints++;
|
||||
newPoints[nNewPoints] = pt;
|
||||
++nNewPoints;
|
||||
}
|
||||
|
||||
forAll(oldPoints, pointi)
|
||||
{
|
||||
scalar alpha =
|
||||
const scalar alpha =
|
||||
mirrorPlane.normalIntersect
|
||||
(
|
||||
oldPoints[pointi],
|
||||
@ -121,7 +137,6 @@ Foam::mirrorFvMesh::mirrorFvMesh(const IOobject& io)
|
||||
}
|
||||
|
||||
|
||||
|
||||
Info<< "Mirroring faces. Old faces: " << oldFaces.size();
|
||||
|
||||
// Algorithm:
|
||||
@ -325,7 +340,7 @@ Foam::mirrorFvMesh::mirrorFvMesh(const IOobject& io)
|
||||
Info<< "Mirroring patches. Old patches: " << boundary().size()
|
||||
<< " New patches: " << boundary().size() << endl;
|
||||
|
||||
Info<< "Mirroring cells. Old cells: " << oldCells.size()
|
||||
Info<< "Mirroring cells. Old cells: " << oldCells.size()
|
||||
<< " New cells: " << 2*oldCells.size() << endl;
|
||||
|
||||
cellList newCells(2*oldCells.size());
|
||||
|
||||
@ -51,9 +51,6 @@ class mirrorFvMesh
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Mirror dictionary
|
||||
IOdictionary mirrorMeshDict_;
|
||||
|
||||
//- Mirrored mesh
|
||||
autoPtr<fvMesh> mirrorMeshPtr_;
|
||||
|
||||
@ -77,8 +74,11 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from IOobject
|
||||
mirrorFvMesh(const IOobject& io);
|
||||
//- Construct from IOobject, using system mirrorMeshDict
|
||||
explicit mirrorFvMesh(const IOobject& io);
|
||||
|
||||
//- Construct from IOobject and specified mirrorMeshDict
|
||||
mirrorFvMesh(const IOobject& io, const IOdictionary& mirrorDict);
|
||||
|
||||
|
||||
//- Destructor
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -49,12 +49,25 @@ int main(int argc, char *argv[])
|
||||
"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 "setRootCase.H"
|
||||
#include "createTime.H"
|
||||
|
||||
const bool overwrite = args.found("overwrite");
|
||||
|
||||
const word dictName("mirrorMeshDict");
|
||||
|
||||
#include "setSystemRunTimeDictionaryIO.H"
|
||||
|
||||
Info<< "Reading " << dictName << "\n" << endl;
|
||||
|
||||
const IOdictionary mirrorDict(dictIO);
|
||||
|
||||
mirrorFvMesh mesh
|
||||
(
|
||||
IOobject
|
||||
@ -62,7 +75,8 @@ int main(int argc, char *argv[])
|
||||
mirrorFvMesh::defaultRegion,
|
||||
runTime.constant(),
|
||||
runTime
|
||||
)
|
||||
),
|
||||
mirrorDict
|
||||
);
|
||||
|
||||
hexRef8Data refData
|
||||
|
||||
Reference in New Issue
Block a user