refineMesh: Rationalised and standardised the coordinate axes naming to e1, e2 and e3

the previous naming tan1, tan2, normal was non-intuitive and very confusing.

It was not practical to maintain backward compatibility but all tutorials and
example refineMeshDict files have been updated to provide examples of the
change.
This commit is contained in:
Henry Weller
2021-06-15 16:08:55 +01:00
parent be9fb841a1
commit 926ba22b74
25 changed files with 175 additions and 175 deletions

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -264,9 +264,9 @@ int main(int argc, char *argv[])
Info<< "3D case; refining all directions" << nl << endl;
wordList directions(3);
directions[0] = "tan1";
directions[1] = "tan2";
directions[2] = "normal";
directions[0] = "e1";
directions[1] = "e2";
directions[2] = "e3";
refineDict.add("directions", directions);
// Use hex cutter
@ -281,20 +281,20 @@ int main(int argc, char *argv[])
if (dirs.x() == -1)
{
Info<< "2D case; refining in directions y,z\n" << endl;
directions[0] = "tan2";
directions[1] = "normal";
directions[0] = "e2";
directions[1] = "e3";
}
else if (dirs.y() == -1)
{
Info<< "2D case; refining in directions x,z\n" << endl;
directions[0] = "tan1";
directions[1] = "normal";
directions[0] = "e1";
directions[1] = "e3";
}
else
{
Info<< "2D case; refining in directions x,y\n" << endl;
directions[0] = "tan1";
directions[1] = "tan2";
directions[0] = "e1";
directions[1] = "e2";
}
refineDict.add("directions", directions);
@ -306,8 +306,8 @@ int main(int argc, char *argv[])
refineDict.add("coordinateSystem", "global");
dictionary coeffsDict;
coeffsDict.add("tan1", vector(1, 0, 0));
coeffsDict.add("tan2", vector(0, 1, 0));
coeffsDict.add("e1", vector(1, 0, 0));
coeffsDict.add("e2", vector(0, 1, 0));
refineDict.add("globalCoeffs", coeffsDict);
refineDict.add("geometricCut", "false");

View File

@ -73,26 +73,26 @@ selectHanging false;
coordinateSystem global;
//coordinateSystem patchLocal;
// .. and its coefficients. x,y in this case. (normal = tan1^tan2)
// .. and its coefficients. x,y in this case. (normal e3 = e1^e2)
globalCoeffs
{
tan1 (1 0 0);
tan2 (0 1 0);
e1 (1 0 0);
e2 (0 1 0);
}
patchLocalCoeffs
{
patch outside; // Normal direction is facenormal of zero'th face of patch
tan1 (1 0 0);
patch outside; // Normal direction is normal of zero'th face of patch
e1 (1 0 0);
}
// List of directions to refine
directions
(
tan1
tan2
normal
e1
e2
e3
);
// refinement level difference between neighbouring cells. Set to large if

View File

@ -29,26 +29,26 @@ coordinateSystem global;
//coordinateSystem patchLocal;
//coordinateSystem fieldBased;
// .. and its coefficients. x,y in this case. (normal direction is calculated
// as tan1^tan2)
// .. and its coefficients. x,y in this case. (normal (e3) direction is
// calculated as e1^e2)
globalCoeffs
{
tan1 (1 0 0);
tan2 (0 1 0);
e1 (1 0 0);
e2 (0 1 0);
}
patchLocalCoeffs
{
patch outside; // Normal direction is facenormal of zero'th face of patch
tan1 (1 0 0);
patch outside; // Normal direction is facenormal of zero'th face of patch
e1 (1 0 0);
}
// List of directions to refine, if global or patchLocal
directions
(
tan1
tan2
normal
e1
e2
e3
);
// List of directions to refine, if "fieldBased". Keep in mind that these

View File

@ -20,15 +20,15 @@ coordinateSystem global;
globalCoeffs
{
tan1 (1 0 0);
tan2 (0 1 0);
e1 (1 0 0);
e2 (0 1 0);
}
directions // comment out as required
(
tan1
tan2
normal
e1
e2
e3
);
useHexTopology no;

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -45,9 +45,9 @@ namespace Foam
3
>::names[] =
{
"tan1",
"tan2",
"normal"
"e1",
"e2",
"e3"
};
}
@ -286,9 +286,9 @@ Foam::directions::directions
const wordList wantedDirs(dict.lookup("directions"));
const word coordSystem(dict.lookup("coordinateSystem"));
bool wantNormal = false;
bool wantTan1 = false;
bool wantTan2 = false;
bool wantE3 = false;
bool wantE1 = false;
bool wantE2 = false;
label nDirs = 0;
if (coordSystem != "fieldBased")
@ -297,17 +297,17 @@ Foam::directions::directions
{
directionType wantedDir = directionTypeNames_[wantedDirs[i]];
if (wantedDir == NORMAL)
if (wantedDir == e3)
{
wantNormal = true;
wantE3 = true;
}
else if (wantedDir == TAN1)
else if (wantedDir == e1)
{
wantTan1 = true;
wantE1 = true;
}
else if (wantedDir == TAN2)
else if (wantedDir == e2)
{
wantTan2 = true;
wantE2 = true;
}
}
}
@ -317,32 +317,32 @@ Foam::directions::directions
{
const dictionary& globalDict = dict.subDict("globalCoeffs");
vector tan1(globalDict.lookup("tan1"));
check2D(correct2DPtr, tan1);
vector e1(globalDict.lookup("e1"));
check2D(correct2DPtr, e1);
vector tan2(globalDict.lookup("tan2"));
check2D(correct2DPtr, tan2);
vector e2(globalDict.lookup("e2"));
check2D(correct2DPtr, e2);
vector normal = tan1 ^ tan2;
normal /= mag(normal);
vector e3 = e1 ^ e2;
e3 /= mag(e3);
Info<< "Global Coordinate system:" << endl
<< " normal : " << normal << endl
<< " tan1 : " << tan1 << endl
<< " tan2 : " << tan2
<< " e3 : " << e3 << endl
<< " e1 : " << e1 << endl
<< " e2 : " << e2
<< endl << endl;
if (wantNormal)
if (wantE3)
{
operator[](nDirs++) = vectorField(1, normal);
operator[](nDirs++) = vectorField(1, e3);
}
if (wantTan1)
if (wantE1)
{
operator[](nDirs++) = vectorField(1, tan1);
operator[](nDirs++) = vectorField(1, e1);
}
if (wantTan2)
if (wantE2)
{
operator[](nDirs++) = vectorField(1, tan2);
operator[](nDirs++) = vectorField(1, e2);
}
}
else if (coordSystem == "patchLocal")
@ -364,28 +364,28 @@ Foam::directions::directions
// Take zeroth face on patch
const polyPatch& pp = mesh.boundaryMesh()[patchi];
vector tan1(patchDict.lookup("tan1"));
vector e1(patchDict.lookup("e1"));
const vector& n0 = pp.faceNormals()[0];
if (correct2DPtr)
{
tan1 = correct2DPtr->planeNormal() ^ n0;
e1 = correct2DPtr->planeNormal() ^ n0;
WarningInFunction
<< "Discarding user specified tan1 since 2D case." << endl
<< "Recalculated tan1 from face normal and planeNormal as "
<< tan1 << endl << endl;
<< "Discarding user specified e1 since 2D case." << endl
<< "Recalculated e1 from face normal and planeNormal as "
<< e1 << endl << endl;
}
Switch useTopo(dict.lookup("useHexTopology"));
vectorField normalDirs;
vectorField tan1Dirs;
vectorField e3Dirs;
vectorField e1Dirs;
if (wantNormal || wantTan2)
if (wantE3 || wantE2)
{
normalDirs =
e3Dirs =
propagateDirection
(
mesh,
@ -395,35 +395,35 @@ Foam::directions::directions
n0
);
if (wantNormal)
if (wantE3)
{
this->operator[](nDirs++) = normalDirs;
this->operator[](nDirs++) = e3Dirs;
}
}
if (wantTan1 || wantTan2)
if (wantE1 || wantE2)
{
tan1Dirs =
e1Dirs =
propagateDirection
(
mesh,
useTopo,
pp,
vectorField(pp.size(), tan1),
tan1
vectorField(pp.size(), e1),
e1
);
if (wantTan1)
if (wantE1)
{
this->operator[](nDirs++) = tan1Dirs;
this->operator[](nDirs++) = e1Dirs;
}
}
if (wantTan2)
if (wantE2)
{
tmp<vectorField> tan2Dirs = normalDirs ^ tan1Dirs;
tmp<vectorField> e2Dirs = e3Dirs ^ e1Dirs;
this->operator[](nDirs++) = tan2Dirs;
this->operator[](nDirs++) = e2Dirs;
}
}
else if (coordSystem == "fieldBased")

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -74,9 +74,9 @@ public:
//- Enumeration listing the possible coordinate directions.
enum directionType
{
TAN1,
TAN2,
NORMAL
e1,
e2,
e3
};
@ -107,8 +107,8 @@ private:
const vectorField& dirs
);
//- Check if vec has no component in 2D normal direction. Exits if
// so.
//- Check if vec has no component in 2D normal direction.
// Exits if so.
static void check2D
(
const twoDPointCorrector* correct2DPtr,

View File

@ -27,17 +27,17 @@ set range1;
coordinateSystem fieldBased;
// .. and its coefficients. x,y in this case. (normal direction is calculated
// as tan1^tan2)
// as e1 ^e2 )
globalCoeffs
{
tan1 (1 0 0);
tan2 (0 1 0);
e1 (1 0 0);
e2 (0 1 0);
}
patchLocalCoeffs
{
patch maxX; // Normal direction is facenormal of zero'th face of patch
tan1 (1 -1 0);
patch maxX; // Normal direction is facenormal of zero'th face of patch
e1 (1 -1 0);
}
// List of directions to refine

View File

@ -27,17 +27,17 @@ set range1;
coordinateSystem fieldBased;
// .. and its coefficients. x,y in this case. (normal direction is calculated
// as tan1^tan2)
// as e1 ^e2 )
globalCoeffs
{
tan1 (1 0 0);
tan2 (0 1 0);
e1 (1 0 0);
e2 (0 1 0);
}
patchLocalCoeffs
{
patch maxX; // Normal direction is facenormal of zero'th face of patch
tan1 (1 -1 0);
patch maxX; // Normal direction is facenormal of zero'th face of patch
e1 (1 -1 0);
}
// List of directions to refine

View File

@ -27,17 +27,17 @@ set range1;
coordinateSystem fieldBased;
// .. and its coefficients. x,y in this case. (normal direction is calculated
// as tan1^tan2)
// as e1 ^e2 )
globalCoeffs
{
tan1 (1 0 0);
tan2 (0 1 0);
e1 (1 0 0);
e2 (0 1 0);
}
patchLocalCoeffs
{
patch maxX; // Normal direction is facenormal of zero'th face of patch
tan1 (1 -1 0);
patch maxX; // Normal direction is facenormal of zero'th face of patch
e1 (1 -1 0);
}
// List of directions to refine

View File

@ -26,23 +26,23 @@ coordinateSystem global;
//coordinateSystem patchLocal;
// .. and its coefficients. x,y in this case. (normal direction is calculated
// as tan1^tan2)
// as e1 ^e2 )
globalCoeffs
{
tan1 (1 0 0);
tan2 (0 1 0);
e1 (1 0 0);
e2 (0 1 0);
}
patchLocalCoeffs
{
patch outside; // Normal direction is facenormal of zero'th face of patch
tan1 (1 0 0);
patch outside; // Normal direction is facenormal of zero'th face of patch
e1 (1 0 0);
}
// List of directions to refine
directions
(
normal
e3
);
// Whether to use hex topology. This will

View File

@ -26,23 +26,23 @@ coordinateSystem global;
//coordinateSystem patchLocal;
// .. and its coefficients. x,y in this case. (normal direction is calculated
// as tan1^tan2)
// as e1 ^e2 )
globalCoeffs
{
tan1 (1 0 0);
tan2 (0 1 0);
e1 (1 0 0);
e2 (0 1 0);
}
patchLocalCoeffs
{
patch outside; // Normal direction is facenormal of zero'th face of patch
tan1 (1 0 0);
patch outside; // Normal direction is facenormal of zero'th face of patch
e1 (1 0 0);
}
// List of directions to refine
directions
(
normal
e3
);
// Whether to use hex topology. This will

View File

@ -26,23 +26,23 @@ coordinateSystem global;
//coordinateSystem patchLocal;
// .. and its coefficients. x,y in this case. (normal direction is calculated
// as tan1^tan2)
// as e1 ^e2 )
globalCoeffs
{
tan1 (1 0 0);
tan2 (0 1 0);
e1 (1 0 0);
e2 (0 1 0);
}
patchLocalCoeffs
{
patch outside; // Normal direction is facenormal of zero'th face of patch
tan1 (1 0 0);
patch outside; // Normal direction is facenormal of zero'th face of patch
e1 (1 0 0);
}
// List of directions to refine
directions
(
normal
e3
);
// Whether to use hex topology. This will

View File

@ -26,23 +26,23 @@ coordinateSystem global;
//coordinateSystem patchLocal;
// .. and its coefficients. x,y in this case. (normal direction is calculated
// as tan1^tan2)
// as e1 ^e2 )
globalCoeffs
{
tan1 (1 0 0);
tan2 (0 1 0);
e1 (1 0 0);
e2 (0 1 0);
}
patchLocalCoeffs
{
patch outside; // Normal direction is facenormal of zero'th face of patch
tan1 (1 0 0);
patch outside; // Normal direction is facenormal of zero'th face of patch
e1 (1 0 0);
}
// List of directions to refine
directions
(
normal
e3
);
// Whether to use hex topology. This will

View File

@ -26,23 +26,23 @@ coordinateSystem global;
//coordinateSystem patchLocal;
// .. and its coefficients. x,y in this case. (normal direction is calculated
// as tan1^tan2)
// as e1 ^e2 )
globalCoeffs
{
tan1 (1 0 0);
tan2 (0 1 0);
e1 (1 0 0);
e2 (0 1 0);
}
patchLocalCoeffs
{
patch outside; // Normal direction is facenormal of zero'th face of patch
tan1 (1 0 0);
patch outside; // Normal direction is facenormal of zero'th face of patch
e1 (1 0 0);
}
// List of directions to refine
directions
(
normal
e3
);
// Whether to use hex topology. This will

View File

@ -26,23 +26,23 @@ coordinateSystem global;
//coordinateSystem patchLocal;
// .. and its coefficients. x,y in this case. (normal direction is calculated
// as tan1^tan2)
// as e1 ^e2 )
globalCoeffs
{
tan1 (1 0 0);
tan2 (0 1 0);
e1 (1 0 0);
e2 (0 1 0);
}
patchLocalCoeffs
{
patch outside; // Normal direction is facenormal of zero'th face of patch
tan1 (1 0 0);
patch outside; // Normal direction is facenormal of zero'th face of patch
e1 (1 0 0);
}
// List of directions to refine
directions
(
normal
e3
);
// Whether to use hex topology. This will

View File

@ -21,11 +21,11 @@ coordinateSystem global;
globalCoeffs
{
tan1 (1 0 0);
tan2 (0 1 0);
e1 (1 0 0);
e2 (0 1 0);
}
directions ( tan1 tan2 );
directions (e1 e2);
useHexTopology yes;

View File

@ -21,12 +21,12 @@ coordinateSystem global;
globalCoeffs
{
tan1 (1 0 0);
tan2 (0 1 0);
tan3 (0 0 1);
e1 (1 0 0);
e2 (0 1 0);
e3 (0 0 1);
}
directions ( tan1 tan2 tan3 );
directions (e1 e2 e3);
useHexTopology yes;

View File

@ -21,11 +21,11 @@ coordinateSystem global;
globalCoeffs
{
tan1 (1 0 0);
tan2 (0 1 0);
e1 (1 0 0);
e2 (0 1 0);
}
directions ( tan1 tan2 );
directions (e1 e2);
useHexTopology yes;

View File

@ -21,17 +21,17 @@ coordinateSystem global;
globalCoeffs
{
tan1 (1 0 0);
tan2 (0 1 0);
e1 (1 0 0);
e2 (0 1 0);
}
patchLocalCoeffs
{
patch outside;
tan1 (1 0 0);
e1 (1 0 0);
}
directions ( tan1 );
directions (e1);
useHexTopology no;

View File

@ -21,17 +21,17 @@ coordinateSystem global;
globalCoeffs
{
tan1 (1 0 0);
tan2 (0 1 0);
e1 (1 0 0);
e2 (0 1 0);
}
patchLocalCoeffs
{
patch outside;
tan1 (1 0 0);
e1 (1 0 0);
}
directions (tan1 tan2);
directions (e1 e2);
useHexTopology no;

View File

@ -21,17 +21,17 @@ coordinateSystem global;
globalCoeffs
{
tan1 (1 0 0);
tan2 (0 1 0);
e1 (1 0 0);
e2 (0 1 0);
}
patchLocalCoeffs
{
patch outside;
tan1 (1 0 0);
e1 (1 0 0);
}
directions ( tan1 tan2 );
directions (e1 e2);
useHexTopology no;

View File

@ -21,17 +21,17 @@ coordinateSystem global;
globalCoeffs
{
tan1 (1 0 0);
tan2 (0 1 0);
e1 (1 0 0);
e2 (0 1 0);
}
patchLocalCoeffs
{
patch outside;
tan1 (1 0 0);
e1 (1 0 0);
}
directions ( tan1 tan2 );
directions (e1 e2);
useHexTopology no;

View File

@ -21,17 +21,17 @@ coordinateSystem global;
globalCoeffs
{
tan1 ( 1 0 0 );
tan2 ( 0 1 0 );
e1 (1 0 0);
e2 (0 1 0);
}
patchLocalCoeffs
{
patch outside;
tan1 ( 1 0 0 );
e1 (1 0 0);
}
directions ( tan1 tan2 );
directions (e1 e2);
useHexTopology no;

View File

@ -21,13 +21,13 @@ coordinateSystem global;
globalCoeffs
{
tan1 (1 0 0);
tan2 (0 1 0);
e1 (1 0 0);
e2 (0 1 0);
}
directions
(
tan1
e1
);
useHexTopology true;

View File

@ -21,13 +21,13 @@ coordinateSystem global;
globalCoeffs
{
tan1 (1 0 0);
tan2 (0 1 0);
e1 (1 0 0);
e2 (0 1 0);
}
directions
(
tan2
e2
);
useHexTopology true;