refineMesh: Added customizable direction fields to multiDirRefinement
Contribution provided by Bruno Santos Resolves feature request http://www.openfoam.org/mantisbt/view.php?id=2004
This commit is contained in:
@ -38,7 +38,7 @@ License
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(cellCuts, 0);
|
||||
defineTypeNameAndDebug(cellCuts, 0);
|
||||
}
|
||||
|
||||
|
||||
@ -120,7 +120,7 @@ void Foam::cellCuts::writeUncutOBJ
|
||||
const label cellI
|
||||
) const
|
||||
{
|
||||
//- Cell edges
|
||||
// Cell edges
|
||||
OFstream cutsStream(dir / "cell_" + name(cellI) + ".obj");
|
||||
|
||||
Pout<< "Writing cell for time " << mesh().time().timeName()
|
||||
@ -135,7 +135,7 @@ void Foam::cellCuts::writeUncutOBJ
|
||||
labelList(1, cellI)
|
||||
);
|
||||
|
||||
//- Loop cutting cell in two
|
||||
// Loop cutting cell in two
|
||||
OFstream cutStream(dir / "cellCuts_" + name(cellI) + ".obj");
|
||||
|
||||
Pout<< "Writing raw cuts on cell for time " << mesh().time().timeName()
|
||||
@ -180,7 +180,7 @@ void Foam::cellCuts::writeOBJ
|
||||
const labelList& anchors
|
||||
) const
|
||||
{
|
||||
//- Cell edges
|
||||
// Cell edges
|
||||
OFstream cutsStream(dir / "cell_" + name(cellI) + ".obj");
|
||||
|
||||
Pout<< "Writing cell for time " << mesh().time().timeName()
|
||||
@ -196,7 +196,7 @@ void Foam::cellCuts::writeOBJ
|
||||
);
|
||||
|
||||
|
||||
//- Loop cutting cell in two
|
||||
// Loop cutting cell in two
|
||||
OFstream loopStream(dir / "cellLoop_" + name(cellI) + ".obj");
|
||||
|
||||
Pout<< "Writing loop for time " << mesh().time().timeName()
|
||||
@ -207,7 +207,7 @@ void Foam::cellCuts::writeOBJ
|
||||
writeOBJ(loopStream, loopPoints, vertI);
|
||||
|
||||
|
||||
//- Anchors for cell
|
||||
// Anchors for cell
|
||||
OFstream anchorStream(dir / "anchors_" + name(cellI) + ".obj");
|
||||
|
||||
Pout<< "Writing anchors for time " << mesh().time().timeName()
|
||||
@ -2240,7 +2240,7 @@ void Foam::cellCuts::setFromCellCutter
|
||||
|
||||
WarningInFunction
|
||||
<< "Found loop on cell " << cellI
|
||||
<< " that resulted in an unexpected bad cut."
|
||||
<< " that resulted in an unexpected bad cut." << nl
|
||||
<< " Suggestions:" << nl
|
||||
<< " - Turn on the debug switch for 'cellCuts' to get"
|
||||
<< " geometry files that identify this cell." << nl
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -57,13 +57,12 @@ const Foam::NamedEnum<Foam::directions::directionType, 3>
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
// For debugging
|
||||
void Foam::directions::writeOBJ(Ostream& os, const point& pt)
|
||||
{
|
||||
os << "v " << pt.x() << ' ' << pt.y() << ' ' << pt.z() << endl;
|
||||
}
|
||||
|
||||
// For debugging
|
||||
|
||||
void Foam::directions::writeOBJ
|
||||
(
|
||||
Ostream& os,
|
||||
@ -81,7 +80,6 @@ void Foam::directions::writeOBJ
|
||||
}
|
||||
|
||||
|
||||
// Dump to file.
|
||||
void Foam::directions::writeOBJ
|
||||
(
|
||||
const fileName& fName,
|
||||
@ -137,7 +135,6 @@ void Foam::directions::check2D
|
||||
}
|
||||
|
||||
|
||||
// Get direction on all cells
|
||||
Foam::vectorField Foam::directions::propagateDirection
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
@ -283,34 +280,35 @@ Foam::directions::directions
|
||||
List<vectorField>(wordList(dict.lookup("directions")).size())
|
||||
{
|
||||
const wordList wantedDirs(dict.lookup("directions"));
|
||||
const word coordSystem(dict.lookup("coordinateSystem"));
|
||||
|
||||
bool wantNormal = false;
|
||||
bool wantTan1 = false;
|
||||
bool wantTan2 = false;
|
||||
label nDirs = 0;
|
||||
|
||||
forAll(wantedDirs, i)
|
||||
if (coordSystem != "fieldBased")
|
||||
{
|
||||
directionType wantedDir = directionTypeNames_[wantedDirs[i]];
|
||||
forAll(wantedDirs, i)
|
||||
{
|
||||
directionType wantedDir = directionTypeNames_[wantedDirs[i]];
|
||||
|
||||
if (wantedDir == NORMAL)
|
||||
{
|
||||
wantNormal = true;
|
||||
}
|
||||
else if (wantedDir == TAN1)
|
||||
{
|
||||
wantTan1 = true;
|
||||
}
|
||||
else if (wantedDir == TAN2)
|
||||
{
|
||||
wantTan2 = true;
|
||||
if (wantedDir == NORMAL)
|
||||
{
|
||||
wantNormal = true;
|
||||
}
|
||||
else if (wantedDir == TAN1)
|
||||
{
|
||||
wantTan1 = true;
|
||||
}
|
||||
else if (wantedDir == TAN2)
|
||||
{
|
||||
wantTan2 = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
label nDirs = 0;
|
||||
|
||||
const word coordSystem(dict.lookup("coordinateSystem"));
|
||||
|
||||
if (coordSystem == "global")
|
||||
{
|
||||
const dictionary& globalDict = dict.subDict("globalCoeffs");
|
||||
@ -424,12 +422,29 @@ Foam::directions::directions
|
||||
this->operator[](nDirs++) = tan2Dirs;
|
||||
}
|
||||
}
|
||||
else if (coordSystem == "fieldBased")
|
||||
{
|
||||
forAll(wantedDirs, i)
|
||||
{
|
||||
operator[](nDirs++) =
|
||||
vectorIOField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
mesh.instance()/wantedDirs[i],
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Unknown coordinate system "
|
||||
<< coordSystem << endl
|
||||
<< "Known types are global and patchLocal"
|
||||
<< "Known types are global, patchLocal and fieldBased"
|
||||
<< exit(FatalError);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -30,7 +30,8 @@ Description
|
||||
|
||||
Used in splitting cells.
|
||||
Either all cells have similar refinement direction ('global') or
|
||||
direction is dependent on local cell geometry. Controlled by dictionary.
|
||||
direction is dependent on local cell geometry, or loads selected fields
|
||||
by name ('fieldBased'). Controlled by dictionary.
|
||||
|
||||
SourceFiles
|
||||
directions.C
|
||||
@ -65,7 +66,9 @@ class directions
|
||||
:
|
||||
public List<vectorField>
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
// Data types
|
||||
|
||||
//- Enumeration listing the possible coordinate directions.
|
||||
@ -76,6 +79,7 @@ public:
|
||||
NORMAL
|
||||
};
|
||||
|
||||
|
||||
private:
|
||||
|
||||
static const NamedEnum<directionType, 3> directionTypeNames_;
|
||||
@ -83,7 +87,6 @@ private:
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
|
||||
//- For debugging. Write point coordinate.
|
||||
static void writeOBJ(Ostream& os, const point& pt);
|
||||
|
||||
@ -141,7 +144,6 @@ public:
|
||||
const dictionary& dict,
|
||||
const twoDPointCorrector* correct2DPtr = NULL
|
||||
);
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user