tutorials/mesh/refineMesh/sector: Simplification of refineFieldDirs
This commit is contained in:
@ -1,51 +0,0 @@
|
||||
#!/bin/sh
|
||||
cd ${0%/*} || exit 1 # Run from this directory
|
||||
|
||||
# Source tutorial run functions
|
||||
. $WM_PROJECT_DIR/bin/tools/RunFunctions
|
||||
|
||||
wmake calcRadiusField
|
||||
wclean calcRadiusField
|
||||
|
||||
runApplication blockMesh
|
||||
|
||||
##### Procedure for special refinement over Z
|
||||
|
||||
# We need the 0 folder to exist for these steps
|
||||
mkdir 0
|
||||
|
||||
# Refine over Z, in 6 passes
|
||||
for index in 1 2 3 4 5 6; do
|
||||
|
||||
runApplication -s tier$index calcRadiusField
|
||||
|
||||
runApplication -s tier$index \
|
||||
topoSet -dict topoSetDict.tier$index
|
||||
|
||||
## foamToVTK -cellSet tier$index
|
||||
|
||||
runApplication -s tier$index \
|
||||
refineMesh -dict refineMeshDict.tier$index -overwrite
|
||||
|
||||
rm -r 0/*
|
||||
|
||||
done
|
||||
|
||||
# Refine over cylindrical coordinates, in 3 passes
|
||||
for index in 1 2 3; do
|
||||
|
||||
runApplication -s range$index calcRadiusField -calcDirections
|
||||
|
||||
runApplication -s range$index \
|
||||
topoSet -dict topoSetDict.range$index
|
||||
|
||||
## foamToVTK -cellSet tier$index
|
||||
|
||||
runApplication -s range$index \
|
||||
refineMesh -dict refineMeshDict.range$index -overwrite
|
||||
|
||||
rm -r 0/*
|
||||
|
||||
done
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
@ -1,3 +0,0 @@
|
||||
calcRadiusField.C
|
||||
|
||||
EXE = $(FOAM_USER_APPBIN)/calcRadiusField
|
||||
@ -1,5 +0,0 @@
|
||||
EXE_INC = \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude
|
||||
|
||||
EXE_LIBS = \
|
||||
-lfiniteVolume
|
||||
@ -1,164 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2016-2023 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Description
|
||||
Write the volScalarField "radiusFieldXY" that has the distance to the
|
||||
origin over X,Y.
|
||||
|
||||
And also write the direction fields based on the option "-calcDirections".
|
||||
The resulting fields are:
|
||||
- radialDirection
|
||||
- angularDirection
|
||||
- heightDirection
|
||||
|
||||
Derived from:
|
||||
$FOAM_UTILITIES/postProcessing/miscellaneous/writeCellCentres
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "argList.H"
|
||||
#include "timeSelector.H"
|
||||
#include "Time.H"
|
||||
#include "fvMesh.H"
|
||||
#include "vectorIOField.H"
|
||||
#include "volFields.H"
|
||||
|
||||
using namespace Foam;
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
timeSelector::addOptions();
|
||||
#include "addRegionOption.H"
|
||||
|
||||
argList::addBoolOption
|
||||
(
|
||||
"calcDirections",
|
||||
"calculate the direction fields as well"
|
||||
);
|
||||
|
||||
#include "setRootCase.H"
|
||||
#include "createTime.H"
|
||||
|
||||
const instantList timeDirs = timeSelector::select0(runTime, args);
|
||||
const bool calcDirections = args.optionFound("calcDirections");
|
||||
|
||||
#include "createNamedMesh.H"
|
||||
|
||||
forAll(timeDirs, timeI)
|
||||
{
|
||||
runTime.setTime(timeDirs[timeI], timeI);
|
||||
|
||||
Info<< "Time = " << runTime.userTimeName() << endl;
|
||||
|
||||
// Check for new mesh
|
||||
mesh.readUpdate();
|
||||
|
||||
Info<< "Writing radius field over X,Y in "
|
||||
<< runTime.name() << endl;
|
||||
|
||||
volScalarField radiusFieldXY
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"radiusFieldXY",
|
||||
runTime.name(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
sqrt
|
||||
(
|
||||
mesh.C().component(0)*mesh.C().component(0)
|
||||
+ mesh.C().component(1)*mesh.C().component(1)
|
||||
)
|
||||
);
|
||||
radiusFieldXY.write();
|
||||
|
||||
|
||||
if(calcDirections)
|
||||
{
|
||||
|
||||
vectorIOField radialDirection
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"radialDirection",
|
||||
runTime.name(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
mesh.C()/magSqr(mesh.C())
|
||||
);
|
||||
radialDirection.replace(vector::Z, scalar(0));
|
||||
radialDirection /= sqrt(magSqr(radialDirection));
|
||||
radialDirection.write();
|
||||
|
||||
|
||||
const tensor transform2Tangencial
|
||||
(
|
||||
0, -1, 0,
|
||||
1, 0, 0,
|
||||
0, 0, 1
|
||||
);
|
||||
vectorIOField angularDirection
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"angularDirection",
|
||||
runTime.name(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
transform2Tangencial & mesh.C()
|
||||
);
|
||||
angularDirection.replace(vector::Z, scalar(0));
|
||||
angularDirection /= sqrt(magSqr(angularDirection));
|
||||
angularDirection.write();
|
||||
|
||||
vectorIOField heightDirection
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"heightDirection",
|
||||
runTime.name(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
radialDirection ^ angularDirection
|
||||
);
|
||||
heightDirection.write();
|
||||
}
|
||||
}
|
||||
|
||||
Info<< "\nEnd\n" << endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,62 +0,0 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Version: dev
|
||||
\\/ M anipulation |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
format ascii;
|
||||
class dictionary;
|
||||
object refineMeshDict;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
// Cells to refine; name of cell set
|
||||
set range1;
|
||||
|
||||
// Type of coordinate system:
|
||||
// - global : coordinate system same for every cell. Usually aligned with
|
||||
// x,y,z axis. Specify in globalCoeffs section below.
|
||||
// - patchLocal : coordinate system different for every cell. Specify in
|
||||
// patchLocalCoeffs section below.
|
||||
//coordinateSystem global;
|
||||
//coordinateSystem patchLocal;
|
||||
coordinateSystem fieldBased;
|
||||
|
||||
// .. and its coefficients. x,y in this case. (normal direction is calculated
|
||||
// as e1 ^e2 )
|
||||
globalCoeffs
|
||||
{
|
||||
e1 (1 0 0);
|
||||
e2 (0 1 0);
|
||||
}
|
||||
|
||||
patchLocalCoeffs
|
||||
{
|
||||
patch maxX; // Normal direction is facenormal of zero'th face of patch
|
||||
e1 (1 -1 0);
|
||||
}
|
||||
|
||||
// List of directions to refine
|
||||
directions
|
||||
(
|
||||
radialDirection
|
||||
angularDirection
|
||||
heightDirection
|
||||
);
|
||||
|
||||
// Whether to use hex topology. This will
|
||||
// - if patchLocal: all cells on selected patch should be hex
|
||||
// - split all hexes in 2x2x2 through the middle of edges.
|
||||
useHexTopology false;
|
||||
|
||||
// Cut purely geometric (will cut hexes through vertices) or take topology
|
||||
// into account. Incompatible with useHexTopology
|
||||
geometricCut true;
|
||||
|
||||
// Write meshes from intermediate steps
|
||||
writeMesh false;
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,62 +0,0 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Version: dev
|
||||
\\/ M anipulation |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
format ascii;
|
||||
class dictionary;
|
||||
object refineMeshDict;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
// Cells to refine; name of cell set
|
||||
set range1;
|
||||
|
||||
// Type of coordinate system:
|
||||
// - global : coordinate system same for every cell. Usually aligned with
|
||||
// x,y,z axis. Specify in globalCoeffs section below.
|
||||
// - patchLocal : coordinate system different for every cell. Specify in
|
||||
// patchLocalCoeffs section below.
|
||||
//coordinateSystem global;
|
||||
//coordinateSystem patchLocal;
|
||||
coordinateSystem fieldBased;
|
||||
|
||||
// .. and its coefficients. x,y in this case. (normal direction is calculated
|
||||
// as e1 ^e2 )
|
||||
globalCoeffs
|
||||
{
|
||||
e1 (1 0 0);
|
||||
e2 (0 1 0);
|
||||
}
|
||||
|
||||
patchLocalCoeffs
|
||||
{
|
||||
patch maxX; // Normal direction is facenormal of zero'th face of patch
|
||||
e1 (1 -1 0);
|
||||
}
|
||||
|
||||
// List of directions to refine
|
||||
directions
|
||||
(
|
||||
radialDirection
|
||||
angularDirection
|
||||
heightDirection
|
||||
);
|
||||
|
||||
// Whether to use hex topology. This will
|
||||
// - if patchLocal: all cells on selected patch should be hex
|
||||
// - split all hexes in 2x2x2 through the middle of edges.
|
||||
useHexTopology false;
|
||||
|
||||
// Cut purely geometric (will cut hexes through vertices) or take topology
|
||||
// into account. Incompatible with useHexTopology
|
||||
geometricCut true;
|
||||
|
||||
// Write meshes from intermediate steps
|
||||
writeMesh false;
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,62 +0,0 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Version: dev
|
||||
\\/ M anipulation |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
format ascii;
|
||||
class dictionary;
|
||||
object refineMeshDict;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
// Cells to refine; name of cell set
|
||||
set range1;
|
||||
|
||||
// Type of coordinate system:
|
||||
// - global : coordinate system same for every cell. Usually aligned with
|
||||
// x,y,z axis. Specify in globalCoeffs section below.
|
||||
// - patchLocal : coordinate system different for every cell. Specify in
|
||||
// patchLocalCoeffs section below.
|
||||
//coordinateSystem global;
|
||||
//coordinateSystem patchLocal;
|
||||
coordinateSystem fieldBased;
|
||||
|
||||
// .. and its coefficients. x,y in this case. (normal direction is calculated
|
||||
// as e1 ^e2 )
|
||||
globalCoeffs
|
||||
{
|
||||
e1 (1 0 0);
|
||||
e2 (0 1 0);
|
||||
}
|
||||
|
||||
patchLocalCoeffs
|
||||
{
|
||||
patch maxX; // Normal direction is facenormal of zero'th face of patch
|
||||
e1 (1 -1 0);
|
||||
}
|
||||
|
||||
// List of directions to refine
|
||||
directions
|
||||
(
|
||||
radialDirection
|
||||
angularDirection
|
||||
heightDirection
|
||||
);
|
||||
|
||||
// Whether to use hex topology. This will
|
||||
// - if patchLocal: all cells on selected patch should be hex
|
||||
// - split all hexes in 2x2x2 through the middle of edges.
|
||||
useHexTopology false;
|
||||
|
||||
// Cut purely geometric (will cut hexes through vertices) or take topology
|
||||
// into account. Incompatible with useHexTopology
|
||||
geometricCut true;
|
||||
|
||||
// Write meshes from intermediate steps
|
||||
writeMesh false;
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,59 +0,0 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Version: dev
|
||||
\\/ M anipulation |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
format ascii;
|
||||
class dictionary;
|
||||
object refineMeshDict;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
// Cells to refine; name of cell set
|
||||
set tier1;
|
||||
|
||||
// Type of coordinate system:
|
||||
// - global : coordinate system same for every cell. Usually aligned with
|
||||
// x,y,z axis. Specify in globalCoeffs section below.
|
||||
// - patchLocal : coordinate system different for every cell. Specify in
|
||||
// patchLocalCoeffs section below.
|
||||
coordinateSystem global;
|
||||
//coordinateSystem patchLocal;
|
||||
|
||||
// .. and its coefficients. x,y in this case. (normal direction is calculated
|
||||
// as e1 ^e2 )
|
||||
globalCoeffs
|
||||
{
|
||||
e1 (1 0 0);
|
||||
e2 (0 1 0);
|
||||
}
|
||||
|
||||
patchLocalCoeffs
|
||||
{
|
||||
patch outside; // Normal direction is facenormal of zero'th face of patch
|
||||
e1 (1 0 0);
|
||||
}
|
||||
|
||||
// List of directions to refine
|
||||
directions
|
||||
(
|
||||
e3
|
||||
);
|
||||
|
||||
// Whether to use hex topology. This will
|
||||
// - if patchLocal: all cells on selected patch should be hex
|
||||
// - split all hexes in 2x2x2 through the middle of edges.
|
||||
useHexTopology false;
|
||||
|
||||
// Cut purely geometric (will cut hexes through vertices) or take topology
|
||||
// into account. Incompatible with useHexTopology
|
||||
geometricCut true;
|
||||
|
||||
// Write meshes from intermediate steps
|
||||
writeMesh false;
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,59 +0,0 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Version: dev
|
||||
\\/ M anipulation |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
format ascii;
|
||||
class dictionary;
|
||||
object refineMeshDict;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
// Cells to refine; name of cell set
|
||||
set tier2;
|
||||
|
||||
// Type of coordinate system:
|
||||
// - global : coordinate system same for every cell. Usually aligned with
|
||||
// x,y,z axis. Specify in globalCoeffs section below.
|
||||
// - patchLocal : coordinate system different for every cell. Specify in
|
||||
// patchLocalCoeffs section below.
|
||||
coordinateSystem global;
|
||||
//coordinateSystem patchLocal;
|
||||
|
||||
// .. and its coefficients. x,y in this case. (normal direction is calculated
|
||||
// as e1 ^e2 )
|
||||
globalCoeffs
|
||||
{
|
||||
e1 (1 0 0);
|
||||
e2 (0 1 0);
|
||||
}
|
||||
|
||||
patchLocalCoeffs
|
||||
{
|
||||
patch outside; // Normal direction is facenormal of zero'th face of patch
|
||||
e1 (1 0 0);
|
||||
}
|
||||
|
||||
// List of directions to refine
|
||||
directions
|
||||
(
|
||||
e3
|
||||
);
|
||||
|
||||
// Whether to use hex topology. This will
|
||||
// - if patchLocal: all cells on selected patch should be hex
|
||||
// - split all hexes in 2x2x2 through the middle of edges.
|
||||
useHexTopology false;
|
||||
|
||||
// Cut purely geometric (will cut hexes through vertices) or take topology
|
||||
// into account. Incompatible with useHexTopology
|
||||
geometricCut true;
|
||||
|
||||
// Write meshes from intermediate steps
|
||||
writeMesh false;
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,59 +0,0 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Version: dev
|
||||
\\/ M anipulation |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
format ascii;
|
||||
class dictionary;
|
||||
object refineMeshDict;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
// Cells to refine; name of cell set
|
||||
set tier3;
|
||||
|
||||
// Type of coordinate system:
|
||||
// - global : coordinate system same for every cell. Usually aligned with
|
||||
// x,y,z axis. Specify in globalCoeffs section below.
|
||||
// - patchLocal : coordinate system different for every cell. Specify in
|
||||
// patchLocalCoeffs section below.
|
||||
coordinateSystem global;
|
||||
//coordinateSystem patchLocal;
|
||||
|
||||
// .. and its coefficients. x,y in this case. (normal direction is calculated
|
||||
// as e1 ^e2 )
|
||||
globalCoeffs
|
||||
{
|
||||
e1 (1 0 0);
|
||||
e2 (0 1 0);
|
||||
}
|
||||
|
||||
patchLocalCoeffs
|
||||
{
|
||||
patch outside; // Normal direction is facenormal of zero'th face of patch
|
||||
e1 (1 0 0);
|
||||
}
|
||||
|
||||
// List of directions to refine
|
||||
directions
|
||||
(
|
||||
e3
|
||||
);
|
||||
|
||||
// Whether to use hex topology. This will
|
||||
// - if patchLocal: all cells on selected patch should be hex
|
||||
// - split all hexes in 2x2x2 through the middle of edges.
|
||||
useHexTopology false;
|
||||
|
||||
// Cut purely geometric (will cut hexes through vertices) or take topology
|
||||
// into account. Incompatible with useHexTopology
|
||||
geometricCut true;
|
||||
|
||||
// Write meshes from intermediate steps
|
||||
writeMesh false;
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,59 +0,0 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Version: dev
|
||||
\\/ M anipulation |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
format ascii;
|
||||
class dictionary;
|
||||
object refineMeshDict;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
// Cells to refine; name of cell set
|
||||
set tier4;
|
||||
|
||||
// Type of coordinate system:
|
||||
// - global : coordinate system same for every cell. Usually aligned with
|
||||
// x,y,z axis. Specify in globalCoeffs section below.
|
||||
// - patchLocal : coordinate system different for every cell. Specify in
|
||||
// patchLocalCoeffs section below.
|
||||
coordinateSystem global;
|
||||
//coordinateSystem patchLocal;
|
||||
|
||||
// .. and its coefficients. x,y in this case. (normal direction is calculated
|
||||
// as e1 ^e2 )
|
||||
globalCoeffs
|
||||
{
|
||||
e1 (1 0 0);
|
||||
e2 (0 1 0);
|
||||
}
|
||||
|
||||
patchLocalCoeffs
|
||||
{
|
||||
patch outside; // Normal direction is facenormal of zero'th face of patch
|
||||
e1 (1 0 0);
|
||||
}
|
||||
|
||||
// List of directions to refine
|
||||
directions
|
||||
(
|
||||
e3
|
||||
);
|
||||
|
||||
// Whether to use hex topology. This will
|
||||
// - if patchLocal: all cells on selected patch should be hex
|
||||
// - split all hexes in 2x2x2 through the middle of edges.
|
||||
useHexTopology false;
|
||||
|
||||
// Cut purely geometric (will cut hexes through vertices) or take topology
|
||||
// into account. Incompatible with useHexTopology
|
||||
geometricCut true;
|
||||
|
||||
// Write meshes from intermediate steps
|
||||
writeMesh false;
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,59 +0,0 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Version: dev
|
||||
\\/ M anipulation |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
format ascii;
|
||||
class dictionary;
|
||||
object refineMeshDict;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
// Cells to refine; name of cell set
|
||||
set tier6;
|
||||
|
||||
// Type of coordinate system:
|
||||
// - global : coordinate system same for every cell. Usually aligned with
|
||||
// x,y,z axis. Specify in globalCoeffs section below.
|
||||
// - patchLocal : coordinate system different for every cell. Specify in
|
||||
// patchLocalCoeffs section below.
|
||||
coordinateSystem global;
|
||||
//coordinateSystem patchLocal;
|
||||
|
||||
// .. and its coefficients. x,y in this case. (normal direction is calculated
|
||||
// as e1 ^e2 )
|
||||
globalCoeffs
|
||||
{
|
||||
e1 (1 0 0);
|
||||
e2 (0 1 0);
|
||||
}
|
||||
|
||||
patchLocalCoeffs
|
||||
{
|
||||
patch outside; // Normal direction is facenormal of zero'th face of patch
|
||||
e1 (1 0 0);
|
||||
}
|
||||
|
||||
// List of directions to refine
|
||||
directions
|
||||
(
|
||||
e3
|
||||
);
|
||||
|
||||
// Whether to use hex topology. This will
|
||||
// - if patchLocal: all cells on selected patch should be hex
|
||||
// - split all hexes in 2x2x2 through the middle of edges.
|
||||
useHexTopology false;
|
||||
|
||||
// Cut purely geometric (will cut hexes through vertices) or take topology
|
||||
// into account. Incompatible with useHexTopology
|
||||
geometricCut true;
|
||||
|
||||
// Write meshes from intermediate steps
|
||||
writeMesh false;
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,30 +0,0 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Version: dev
|
||||
\\/ M anipulation |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
format ascii;
|
||||
class dictionary;
|
||||
object topoSetDict;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
actions
|
||||
(
|
||||
{
|
||||
name range1;
|
||||
type cellSet;
|
||||
action new;
|
||||
source fieldToCell;
|
||||
field radiusFieldXY;
|
||||
min 3.67;
|
||||
max 18.47;
|
||||
}
|
||||
);
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,30 +0,0 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Version: dev
|
||||
\\/ M anipulation |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
format ascii;
|
||||
class dictionary;
|
||||
object topoSetDict;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
actions
|
||||
(
|
||||
{
|
||||
name tier2;
|
||||
type cellSet;
|
||||
action new;
|
||||
source fieldToCell;
|
||||
field radiusFieldXY;
|
||||
min 0.0;
|
||||
max 1.03;
|
||||
}
|
||||
);
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,30 +0,0 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Version: dev
|
||||
\\/ M anipulation |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
format ascii;
|
||||
class dictionary;
|
||||
object topoSetDict;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
actions
|
||||
(
|
||||
{
|
||||
name tier3;
|
||||
type cellSet;
|
||||
action new;
|
||||
source fieldToCell;
|
||||
field radiusFieldXY;
|
||||
min 0.0;
|
||||
max 1.94;
|
||||
}
|
||||
);
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,30 +0,0 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Version: dev
|
||||
\\/ M anipulation |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
format ascii;
|
||||
class dictionary;
|
||||
object topoSetDict;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
actions
|
||||
(
|
||||
{
|
||||
name tier4;
|
||||
type cellSet;
|
||||
action new;
|
||||
source fieldToCell;
|
||||
field radiusFieldXY;
|
||||
min 0.0;
|
||||
max 3.67;
|
||||
}
|
||||
);
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,30 +0,0 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Version: dev
|
||||
\\/ M anipulation |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
format ascii;
|
||||
class dictionary;
|
||||
object topoSetDict;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
actions
|
||||
(
|
||||
{
|
||||
name tier5;
|
||||
type cellSet;
|
||||
action new;
|
||||
source fieldToCell;
|
||||
field radiusFieldXY;
|
||||
min 0.0;
|
||||
max 7.00;
|
||||
}
|
||||
);
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,30 +0,0 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Version: dev
|
||||
\\/ M anipulation |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
format ascii;
|
||||
class dictionary;
|
||||
object topoSetDict;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
actions
|
||||
(
|
||||
{
|
||||
name tier6;
|
||||
type cellSet;
|
||||
action new;
|
||||
source fieldToCell;
|
||||
field radiusFieldXY;
|
||||
min 0.0;
|
||||
max 13.36;
|
||||
}
|
||||
);
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -4,8 +4,6 @@ cd ${0%/*} || exit 1 # Run from this directory
|
||||
# Source tutorial clean functions
|
||||
. $WM_PROJECT_DIR/bin/tools/CleanFunctions
|
||||
|
||||
rm -rf 0
|
||||
|
||||
cleanCase
|
||||
cleanCase && rm -rf 0
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
39
tutorials/mesh/refineMesh/sector/Allrun
Executable file
39
tutorials/mesh/refineMesh/sector/Allrun
Executable file
@ -0,0 +1,39 @@
|
||||
#!/bin/sh
|
||||
cd ${0%/*} || exit 1 # Run from this directory
|
||||
|
||||
# Source tutorial run functions
|
||||
. $WM_PROJECT_DIR/bin/tools/RunFunctions
|
||||
|
||||
runApplication blockMesh
|
||||
|
||||
mkdir 0
|
||||
|
||||
# Refine in the z direction 6 times
|
||||
min=0
|
||||
for max in 0.64 1.03 1.94 3.67 7.00 13.36
|
||||
do
|
||||
runApplication -s R_z_${min}_to_${max} foamPostProcess -func R
|
||||
|
||||
foamDictionary system/topoSetDict -set "min=$min, max=$max"
|
||||
runApplication -s z_${min}_to_${max} topoSet
|
||||
|
||||
runApplication -s z_${min}_to_${max} \
|
||||
refineMesh -dict refineMeshDict.z -overwrite
|
||||
done
|
||||
|
||||
# Refine in cylindrical coordinate directions 3 times
|
||||
max=18.47
|
||||
for min in 13.36 7.00 3.67
|
||||
do
|
||||
runApplication -s R_cyl_${min}_to_${max} foamPostProcess -func R
|
||||
runApplication -s eRThetaZ_cyl_${min}_to_${max} \
|
||||
foamPostProcess -func eRThetaZ
|
||||
|
||||
foamDictionary system/topoSetDict -set "min=$min, max=$max"
|
||||
runApplication -s cyl_${min}_to_${max} topoSet
|
||||
|
||||
runApplication -s cyl_${min}_to_${max} \
|
||||
refineMesh -dict refineMeshDict.cyl -overwrite
|
||||
done
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
@ -5,26 +5,32 @@
|
||||
\\ / A nd | Version: dev
|
||||
\\/ M anipulation |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
format ascii;
|
||||
class dictionary;
|
||||
object topoSetDict;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
type coded;
|
||||
|
||||
actions
|
||||
(
|
||||
{
|
||||
name range1;
|
||||
type cellSet;
|
||||
action new;
|
||||
source fieldToCell;
|
||||
field radiusFieldXY;
|
||||
min 7.00;
|
||||
max 18.47;
|
||||
}
|
||||
);
|
||||
libs ("libutilityFunctionObjects.so");
|
||||
|
||||
name generateAlpha;
|
||||
|
||||
codeInclude
|
||||
#{
|
||||
#include "volFields.H"
|
||||
#};
|
||||
|
||||
codeWrite
|
||||
#{
|
||||
const tensor XY(1, 0, 0, 0, 1, 0, 0, 0, 0);
|
||||
|
||||
volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"R",
|
||||
mesh().time().timeName(),
|
||||
mesh()
|
||||
),
|
||||
mag(XY & mesh().C())
|
||||
).write();
|
||||
#};
|
||||
|
||||
// ************************************************************************* //
|
||||
49
tutorials/mesh/refineMesh/sector/system/eRThetaZ
Normal file
49
tutorials/mesh/refineMesh/sector/system/eRThetaZ
Normal file
@ -0,0 +1,49 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Version: dev
|
||||
\\/ M anipulation |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
type coded;
|
||||
|
||||
libs ("libutilityFunctionObjects.so");
|
||||
|
||||
name generateAlpha;
|
||||
|
||||
codeInclude
|
||||
#{
|
||||
#include "volFields.H"
|
||||
#};
|
||||
|
||||
codeWrite
|
||||
#{
|
||||
const tensor XY(1, 0, 0, 0, 1, 0, 0, 0, 0);
|
||||
|
||||
const vectorField xy(XY & mesh().C().primitiveField());
|
||||
|
||||
const vectorField z((tensor::I - XY) & mesh().C().primitiveField());
|
||||
const vector zLow(0, 0, 2*min(z.component(2)) - max(z.component(2)));
|
||||
const vectorField zStar(z - zLow);
|
||||
|
||||
vectorIOField
|
||||
(
|
||||
IOobject("eR", mesh().time().timeName(), mesh()),
|
||||
xy/mag(xy)
|
||||
).write();
|
||||
|
||||
vectorIOField
|
||||
(
|
||||
IOobject("eTheta", mesh().time().timeName(), mesh()),
|
||||
(zStar ^ xy)/mag(zStar ^ xy)
|
||||
).write();
|
||||
|
||||
vectorIOField
|
||||
(
|
||||
IOobject("eZ", mesh().time().timeName(), mesh()),
|
||||
zStar/mag(zStar)
|
||||
).write();
|
||||
#};
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -9,22 +9,32 @@ FoamFile
|
||||
{
|
||||
format ascii;
|
||||
class dictionary;
|
||||
object topoSetDict;
|
||||
object refineMeshDict;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
// Name of cell set to refine
|
||||
set refine;
|
||||
|
||||
actions
|
||||
// Type of coordinate system
|
||||
coordinateSystem fieldBased;
|
||||
|
||||
// List of directions to refine. These are all vector fields.
|
||||
directions
|
||||
(
|
||||
{
|
||||
name range1;
|
||||
type cellSet;
|
||||
action new;
|
||||
source fieldToCell;
|
||||
field radiusFieldXY;
|
||||
min 13.36;
|
||||
max 18.47;
|
||||
}
|
||||
eR
|
||||
eTheta
|
||||
eZ
|
||||
);
|
||||
|
||||
// Whether or not to use hex topology
|
||||
useHexTopology false;
|
||||
|
||||
// Cut purely geometric (will cut hexes through vertices) or take topology
|
||||
// into account. Incompatible with useHexTopology.
|
||||
geometricCut true;
|
||||
|
||||
// Write meshes from intermediate steps
|
||||
writeMesh false;
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -13,44 +13,31 @@ FoamFile
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
// Cells to refine; name of cell set
|
||||
set tier5;
|
||||
// Name of cell set to refine
|
||||
set refine;
|
||||
|
||||
// Type of coordinate system:
|
||||
// - global : coordinate system same for every cell. Usually aligned with
|
||||
// x,y,z axis. Specify in globalCoeffs section below.
|
||||
// - patchLocal : coordinate system different for every cell. Specify in
|
||||
// patchLocalCoeffs section below.
|
||||
// Type of coordinate system ...
|
||||
coordinateSystem global;
|
||||
//coordinateSystem patchLocal;
|
||||
|
||||
// .. and its coefficients. x,y in this case. (normal direction is calculated
|
||||
// as e1 ^e2 )
|
||||
// ... and its coefficients. x, y in this case. The normal direction is
|
||||
// calculated as e1^e2.
|
||||
globalCoeffs
|
||||
{
|
||||
e1 (1 0 0);
|
||||
e2 (0 1 0);
|
||||
}
|
||||
|
||||
patchLocalCoeffs
|
||||
{
|
||||
patch outside; // Normal direction is facenormal of zero'th face of patch
|
||||
e1 (1 0 0);
|
||||
}
|
||||
|
||||
// List of directions to refine
|
||||
directions
|
||||
(
|
||||
e3
|
||||
);
|
||||
|
||||
// Whether to use hex topology. This will
|
||||
// - if patchLocal: all cells on selected patch should be hex
|
||||
// - split all hexes in 2x2x2 through the middle of edges.
|
||||
// Whether or not to use hex topology
|
||||
useHexTopology false;
|
||||
|
||||
// Cut purely geometric (will cut hexes through vertices) or take topology
|
||||
// into account. Incompatible with useHexTopology
|
||||
// into account. Incompatible with useHexTopology.
|
||||
geometricCut true;
|
||||
|
||||
// Write meshes from intermediate steps
|
||||
@ -13,17 +13,19 @@ FoamFile
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
min <min>;
|
||||
max <max>;
|
||||
|
||||
actions
|
||||
(
|
||||
{
|
||||
name tier1;
|
||||
name refine;
|
||||
type cellSet;
|
||||
action new;
|
||||
source fieldToCell;
|
||||
field radiusFieldXY;
|
||||
min 0.0;
|
||||
max 0.64;
|
||||
source fieldToCell;
|
||||
field R;
|
||||
min $min;
|
||||
max $max;
|
||||
}
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user