Commit b325cb86 authored by Andrew Heather's avatar Andrew Heather
Browse files

TUT: added mixerVesselAMI2DRefined to show example of AMI with topology change

parent 2ba62438
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2006 |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volVectorField;
object U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 1 -1 0 0 0 0];
internalField uniform (0 0 0);
boundaryField
{
rotor
{
type movingWallVelocity;
value uniform (0 0 0);
}
stator
{
type movingWallVelocity;
value uniform (0 0 0);
}
front
{
type movingWallVelocity;
value uniform (0 0 0);
}
back
{
type movingWallVelocity;
value uniform (0 0 0);
}
AMI1
{
type cyclicAMI;
value $internalField;
}
AMI2
{
type cyclicAMI;
value $internalField;
}
}
// ************************************************************************* //
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2006 |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "0";
object epsilon;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 2 -3 0 0 0 0];
internalField uniform 20;
boundaryField
{
rotor
{
type epsilonWallFunction;
value $internalField;
}
stator
{
type epsilonWallFunction;
value $internalField;
}
front
{
type epsilonWallFunction;
value $internalField;
}
back
{
type epsilonWallFunction;
value $internalField;
}
AMI1
{
type cyclicAMI;
value $internalField;
}
AMI2
{
type cyclicAMI;
value $internalField;
}
}
// ************************************************************************* //
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2006 |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "0";
object k;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 2 -2 0 0 0 0];
internalField uniform 1;
boundaryField
{
rotor
{
type kqRWallFunction;
value uniform 0;
}
stator
{
type kqRWallFunction;
value uniform 0;
}
front
{
type kqRWallFunction;
value uniform 0;
}
back
{
type kqRWallFunction;
value uniform 0;
}
AMI1
{
type cyclicAMI;
value $internalField;
}
AMI2
{
type cyclicAMI;
value $internalField;
}
}
// ************************************************************************* //
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2006 |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "0";
object nut;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 2 -1 0 0 0 0];
internalField uniform 0;
boundaryField
{
rotor
{
type nutkWallFunction;
value uniform 0;
}
stator
{
type nutkWallFunction;
value uniform 0;
}
front
{
type nutkWallFunction;
value uniform 0;
}
back
{
type nutkWallFunction;
value uniform 0;
}
AMI1
{
type cyclicAMI;
value $internalField;
}
AMI2
{
type cyclicAMI;
value $internalField;
}
}
// ************************************************************************* //
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2006 |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
object p;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 2 -2 0 0 0 0];
internalField uniform 0;
boundaryField
{
rotor
{
type zeroGradient;
}
stator
{
type zeroGradient;
}
front
{
type zeroGradient;
}
back
{
type zeroGradient;
}
AMI1
{
type cyclicAMI;
value $internalField;
}
AMI2
{
type cyclicAMI;
value $internalField;
}
}
// ************************************************************************* //
#!/bin/sh
cd ${0%/*} || exit 1 # Run from this directory
. $WM_PROJECT_DIR/bin/tools/RunFunctions # Tutorial run functions
./makeMesh
#runApplication $(getApplication)
runApplication decomposePar
runParallel $(getApplication)
runParallel redistributePar -reconstruct
#------------------------------------------------------------------------------
Refined version that includes wall layers.
- this causes significant pressure spikes using the default AMI
dynamicFvMesh dynamicMotionSolverFvMesh;
- enabling topology change where a 1-to-1 connectivity is established across
the AMI leads to a much smoother pressure trace. Ony change needed is to the
motion solver:
dynamicFvMesh dynamicMotionSolverFvMeshAMI;
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2006 |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "constant";
object dynamicMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dynamicFvMesh dynamicMotionSolverFvMeshAMI;
//dynamicFvMesh dynamicMotionSolverFvMesh;
motionSolver solidBody;
cellZone rotor;
solidBodyMotionFunction rotatingMotion;
origin (0 0 0);
axis (0 0 1);
omega 6.2832; // rad/s
// ************************************************************************* //
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2006 |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "constant";
object transportProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
transportModel Newtonian;
nu 1e-05;
// ************************************************************************* //
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2006 |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "constant";
object turbulenceProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
simulationType laminar;
// ************************************************************************* //
#!/bin/sh
cd ${0%/*} || exit 1 # Run from this directory
. $WM_PROJECT_DIR/bin/tools/RunFunctions # Tutorial run functions
m4 < system/blockMeshDict.m4 > system/blockMeshDict
runApplication blockMesh
runApplication topoSet
#------------------------------------------------------------------------------
set terminal pngcairo
set output "plot.png"
set yrange [-0.001 : 0.001]
plot "postProcessing/forces/0/moment.dat" u 1:4 w lines
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2006 |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
`format' ascii;
class dictionary;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// General macros to create 2D/extruded-2D meshes
changecom(//)changequote([,])
define(calc, [esyscmd(perl -e 'print ($1)')])
define(VCOUNT, 0)
define(vlabel, [[// ]Vertex $1 = VCOUNT define($1, VCOUNT)define([VCOUNT], incr(VCOUNT))])
define(pi, 3.14159265)
define(hex2D, hex ($1b $2b $3b $4b $1t $2t $3t $4t))
define(quad2D, ($1b $2b $2t $1t))
define(frontQuad, ($1t $2t $3t $4t))
define(backQuad, ($1b $4b $3b $2b))
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
scale 0.1;
// Hub radius
define(r, 0.2)
// Impeller-tip radius
define(rb, 0.5)
// Baffle-tip radius
define(Rb, 0.7)
// Tank radius
define(R, 1)
// MRF region radius
define(ri, calc(0.5*(rb + Rb)))
// Thickness of 2D slab
define(z, 0.1)
// Base z
define(Zb, 0)
// Top z
define(Zt, calc(Zb + z))
// Number of cells radially between hub and impeller tip
define(Nr, 12)
// Number of cells radially in each of the two regions between
// impeller and baffle tips
define(Ni, 4)
// Number of cells radially between baffle tip and tank
define(NR, 12)
// Number of cells azimuthally in each of the 8 blocks
define(Na, 12)
// Number of cells in the thickness of the slab
define(Nz, 30)
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
define(vert, (x$1$2 y$1$2 $3))
define(evert, (ex$1$2 ey$1$2 $3))
define(a0, 0)
define(a1, -45)
define(a2, -90)
define(a3, -135)
define(a4, 180)
define(a5, 135)
define(a6, 90)
define(a7, 45)
define(ea0, -22.5)
define(ea1, -67.5)
define(ea2, -112.5)
define(ea3, -157.5)
define(ea4, 157.5)
define(ea5, 112.5)
define(ea6, 67.5)
define(ea7, 22.5)
define(ca0, calc(cos((pi/180)*a0)))
define(ca1, calc(cos((pi/180)*a1)))
define(ca2, calc(cos((pi/180)*a2)))
define(ca3, calc(cos((pi/180)*a3)))
define(ca4, calc(cos((pi/180)*a4)))
define(ca5, calc(cos((pi/180)*a5)))
define(ca6, calc(cos((pi/180)*a6)))
define(ca7, calc(cos((pi/180)*a7)))
define(sa0, calc(sin((pi/180)*a0)))
define(sa1, calc(sin((pi/180)*a1)))
define(sa2, calc(sin((pi/180)*a2)))
define(sa3, calc(sin((pi/180)*a3)))
define(sa4, calc(sin((pi/180)*a4)))
define(sa5, calc(sin((pi/180)*a5)))
define(sa6, calc(sin((pi/180)*a6)))
define(sa7, calc(sin((pi/180)*a7)))
define(cea0, calc(cos((pi/180)*ea0)))
define(cea1, calc(cos((pi/180)*ea1)))
define(cea2, calc(cos((pi/180)*ea2)))
define(cea3, calc(cos((pi/180)*ea3)))
define(cea4, calc(cos((pi/180)*ea4)))
define(cea5, calc(cos((pi/180)*ea5)))
define(cea6, calc(cos((pi/180)*ea6)))
define(cea7, calc(cos((pi/180)*ea7)))
define(sea0, calc(sin((pi/180)*ea0)))
define(sea1, calc(sin((pi/180)*ea1)))
define(sea2, calc(sin((pi/180)*ea2)))
define(sea3, calc(sin((pi/180)*ea3)))
define(sea4, calc(sin((pi/180)*ea4)))
define(sea5, calc(sin((pi/180)*ea5)))
define(sea6, calc(sin((pi/180)*ea6)))
define(sea7, calc(sin((pi/180)*ea7)))
define(x00, calc(r*ca0))
define(x01, calc(r*ca1))
define(x02, calc(r*ca2))
define(x03, calc(r*ca3))
define(x04, calc(r*ca4))
define(x05, calc(r*ca5))
define(x06, calc(r*ca6))
define(x07, calc(r*ca7))