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

View File

@ -73,26 +73,26 @@ selectHanging false;
coordinateSystem global; coordinateSystem global;
//coordinateSystem patchLocal; //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 globalCoeffs
{ {
tan1 (1 0 0); e1 (1 0 0);
tan2 (0 1 0); e2 (0 1 0);
} }
patchLocalCoeffs patchLocalCoeffs
{ {
patch outside; // Normal direction is facenormal of zero'th face of patch patch outside; // Normal direction is normal of zero'th face of patch
tan1 (1 0 0); e1 (1 0 0);
} }
// List of directions to refine // List of directions to refine
directions directions
( (
tan1 e1
tan2 e2
normal e3
); );
// refinement level difference between neighbouring cells. Set to large if // refinement level difference between neighbouring cells. Set to large if

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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