mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: refineMesh: user-specified coordinate system
This commit is contained in:
@ -22,12 +22,15 @@ set c0;
|
||||
// x,y,z axis. Specify in globalCoeffs section below.
|
||||
// - patchLocal : coordinate system different for every cell. Specify in
|
||||
// patchLocalCoeffs section below.
|
||||
// - user : coordinate system provided. Usually cylindrical or spherical.
|
||||
// Specify in userCoeffs section below.
|
||||
// - fieldBased : uses the list of field names from the directions list for
|
||||
// selecting the directions to cut. Meant to be used with geometricCut, but
|
||||
// can also be used with useHexTopology.
|
||||
coordinateSystem global;
|
||||
//coordinateSystem patchLocal;
|
||||
//coordinateSystem fieldBased;
|
||||
//coordinateSystem user;
|
||||
|
||||
// .. and its coefficients. x,y in this case. (normal direction is calculated
|
||||
// as tan1^tan2)
|
||||
@ -43,6 +46,15 @@ patchLocalCoeffs
|
||||
tan1 (1 0 0);
|
||||
}
|
||||
|
||||
userCoeffs
|
||||
{
|
||||
type cylindrical;
|
||||
origin (0 0 0);
|
||||
e1 (1 0 0); // tan1 direction
|
||||
e3 (0 1 0); // normal direction
|
||||
}
|
||||
|
||||
|
||||
// List of directions to refine, if global or patchLocal
|
||||
directions
|
||||
(
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2020 OpenCFD Ltd.
|
||||
Copyright (C) 2020,2025 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -35,6 +35,7 @@ License
|
||||
#include "meshTools.H"
|
||||
#include "hexMatcher.H"
|
||||
#include "globalMeshData.H"
|
||||
#include "coordinateSystem.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
@ -341,6 +342,30 @@ Foam::directions::directions
|
||||
operator[](nDirs++) = vectorField(1, tan2);
|
||||
}
|
||||
}
|
||||
else if (coordSystem == "user")
|
||||
{
|
||||
const dictionary& globalDict = dict.subDict("userCoeffs");
|
||||
|
||||
auto csysPtr(coordinateSystem::New(mesh.thisDb(), globalDict));
|
||||
const auto& cs = csysPtr();
|
||||
|
||||
if (wantNormal)
|
||||
{
|
||||
// 'Normal' is usually e3.
|
||||
vectorField& result = operator[](nDirs++);
|
||||
result = cs.transform(mesh.cellCentres(), vector(0, 0, 1));
|
||||
}
|
||||
if (wantTan1)
|
||||
{
|
||||
vectorField& result = operator[](nDirs++);
|
||||
result = cs.transform(mesh.cellCentres(), vector(1, 0, 0));
|
||||
}
|
||||
if (wantTan2)
|
||||
{
|
||||
vectorField& result = operator[](nDirs++);
|
||||
result = cs.transform(mesh.cellCentres(), vector(0, 1, 0));
|
||||
}
|
||||
}
|
||||
else if (coordSystem == "patchLocal")
|
||||
{
|
||||
const dictionary& patchDict = dict.subDict("patchLocalCoeffs");
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2020 OpenCFD Ltd.
|
||||
Copyright (C) 2020-2025 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -31,10 +31,11 @@ Description
|
||||
Set of directions for each cell in the mesh. Either uniform and size=1
|
||||
or one set of directions per cell.
|
||||
|
||||
Used in splitting cells.
|
||||
Either all cells have similar refinement direction ('global') or
|
||||
direction is dependent on local cell geometry, or loads selected fields
|
||||
by name ('fieldBased'). Controlled by dictionary.
|
||||
Used in splitting cells. Options:
|
||||
- global : global xyz coordinate system
|
||||
- user : user-defined coordinate system
|
||||
- patchLocal : normal direction from (flat) given patch
|
||||
- fieldBased : supply separate vectorIOField for each direction
|
||||
|
||||
SourceFiles
|
||||
directions.C
|
||||
|
||||
Reference in New Issue
Block a user