Commit 1c9f93e1 authored by Johan Roenby's avatar Johan Roenby Committed by Andrew Heather
Browse files

TUT: Added sloshingTank2D case for comparison with the interFoam solver

parent 007c7669
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / 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
{
front
{
type empty;
}
back
{
type empty;
}
walls
{
type movingWallVelocity;
value uniform (0 0 0);
}
}
// ************************************************************************* //
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
object alpha.water;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 0 0 0 0 0 0];
internalField uniform 0;
boundaryField
{
front
{
type empty;
}
back
{
type empty;
}
walls
{
type zeroGradient;
}
}
// ************************************************************************* //
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
object p_rgh;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [1 -1 -2 0 0 0 0];
internalField uniform 0;
boundaryField
{
front
{
type empty;
}
back
{
type empty;
}
walls
{
type fixedFluxPressure;
}
}
// ************************************************************************* //
#!/bin/sh
cd ${0%/*} || exit 1 # Run from this directory
foamCleanTutorials cases
rm -rf 0/alpha.water 0/alpha.water.gz probes wallPressure pRefProbe
#------------------------------------------------------------------------------
#!/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
cp 0/alpha.water.orig 0/alpha.water
runApplication setFields
runApplication $(getApplication)
#------------------------------------------------------------------------------
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "constant";
object dynamicMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dynamicFvMesh dynamicMotionSolverFvMesh;
motionSolver solidBody;
solidBodyMotionFunction SDA;
CofG (0 0 0);
lamda 50;
rollAmax 0.22654;
rollAmin 0.10472;
heaveA 3.79;
swayA 2.34;
Q 2;
Tp 13.93;
Tpn 11.93;
dTi 0.059;
dTp -0.001;
// ************************************************************************* //
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class uniformDimensionedVectorField;
location "constant";
object g;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 1 -2 0 0 0 0];
value (0 0 -9.81);
// ************************************************************************* //
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "constant";
object transportProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
phases (water air);
water
{
transportModel Newtonian;
nu 1e-06;
rho 998.2;
}
air
{
transportModel Newtonian;
nu 1.48e-05;
rho 1;
}
sigma 0;
// ************************************************************************* //
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "constant";
object turbulenceProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
simulationType laminar;
// ************************************************************************* //
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
`format' ascii;
class dictionary;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// General m4 macros
changecom(//)changequote([,]) dnl>
define(calc, [esyscmd(perl -e 'use Math::Trig; print ($1)')]) dnl>
define(VCOUNT, 0)
define(vlabel, [[// ]Vertex $1 = VCOUNT define($1, VCOUNT)define([VCOUNT], incr(VCOUNT))])
define(hex2D, hex (b$1 b$2 b$3 b$4 f$1 f$2 f$3 f$4))
define(quad2D, (b$1 b$2 f$2 f$1))
define(frontQuad, (f$1 f$2 f$3 f$4))
define(backQuad, (b$1 b$4 b$3 b$2))
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// User-defined parameters
scale 1;
define(l, 1.0) // Length of tank (x-direction)
define(b, 40) // Breadth of tank (y-direction)
define(h, 30) // Depth of tank (z-direction)
define(hlc, 5) // Depth to the top (height) of lower chamfer
define(huc, 10) // Height of upper chamfer
define(thetalc, 45) // Angle of lower chamfer to the horizontal
define(thetauc, 45) // Angle of upper chamfer to the horizontal
define(CofGy, calc(b/2.0)) // Centre of gravity in y-direction
define(CofGz, 10.0) // Centre of gravity in z-direction
define(Nl, 1) // Number of cells in the length (1 for 2D)
define(Nb, 40) // Number of cells in the breadth
define(Nhlc, 6) // Number of cells in the height of the lower champfer
define(Nh, 16) // Number of cells in the height between the chamfers
define(Nhuc, 12) // Number of cells in the height of the upper champfer
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Derived parameters
define(blc, calc(hlc/tan(deg2rad(thetalc)))) // Breadth to the top (height) of lower chamfer
define(buc, calc(huc/tan(deg2rad(thetauc)))) // Breadth of upper chamfer
define(Yl, -CofGy)
define(Yllc, calc(Yl + blc))
define(Yluc, calc(Yl + buc))
define(Yr, calc(Yl + b))
define(Yrlc, calc(Yr - blc))
define(Yruc, calc(Yr - buc))
define(Zb, -CofGz)
define(Zlc, calc(Zb + hlc))
define(Zt, calc(Zb + h))
define(Zuc, calc(Zt - huc))
define(Xf, calc(l/2.0))
define(Xb, calc(Xf - l))
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Parametric description
vertices
(
(Xb Yllc Zb) vlabel(bllcb)
(Xb Yl Zlc) vlabel(bllc)
(Xb Yl Zuc) vlabel(bluc)
(Xb Yluc Zt) vlabel(bluct)
(Xb Yrlc Zb) vlabel(brlcb)
(Xb Yr Zlc) vlabel(brlc)
(Xb Yr Zuc) vlabel(bruc)
(Xb Yruc Zt) vlabel(bruct)
(Xf Yllc Zb) vlabel(fllcb)
(Xf Yl Zlc) vlabel(fllc)
(Xf Yl Zuc) vlabel(fluc)
(Xf Yluc Zt) vlabel(fluct)
(Xf Yrlc Zb) vlabel(frlcb)
(Xf Yr Zlc) vlabel(frlc)
(Xf Yr Zuc) vlabel(fruc)
(Xf Yruc Zt) vlabel(fruct)
);
blocks
(
// block0
hex2D(llcb, rlcb, rlc, llc)
(Nb Nhlc Nl)
simpleGrading (1 1 1)
// block1
hex2D(llc, rlc, ruc, luc)
(Nb Nh Nl)
simpleGrading (1 1 1)
// block2
hex2D(luc, ruc, ruct, luct)
(Nb Nhuc Nl)
simpleGrading (1 1 1)
);
patches
(
patch walls
(
quad2D(llcb, rlcb)
quad2D(rlcb, rlc)
quad2D(rlc, ruc)
quad2D(ruc, ruct)
quad2D(ruct, luct)
quad2D(luct, luc)
quad2D(luc, llc)
quad2D(llc, llcb)
)
empty front
(
frontQuad(llcb, rlcb, rlc, llc)
frontQuad(llc, rlc, ruc, luc)
frontQuad(luc, ruc, ruct, luct)
)
empty back
(
backQuad(llcb, rlcb, rlc, llc)
backQuad(llc, rlc, ruc, luc)
backQuad(luc, ruc, ruct, luct)
)
);
// ************************************************************************* //
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
application interIsoFoam;
startFrom startTime;
startTime 0;
stopAt endTime;
endTime 40;
deltaT 0.01;
writeControl adjustableRunTime;
writeInterval 0.05;
purgeWrite 0;
writeFormat ascii;
writePrecision 6;
writeCompression on;
timeFormat general;
timePrecision 6;
runTimeModifiable yes;
adjustTimeStep yes;
maxCo 0.5;
maxAlphaCo 0.5;
maxDeltaT 1;
functions
{
probes
{
type probes;
libs ("libsampling.so");
writeControl writeTime;
probeLocations
(
(0 9.95 19.77)
(0 -9.95 19.77)
);
fixedLocations false;
fields
(
p
);
}
wallPressure
{
type surfaces;
libs ("libsampling.so");
writeControl writeTime;
surfaceFormat raw;
fields
(
p
);
interpolationScheme cellPoint;
surfaces
(
walls
{
type patch;
patches (walls);
triangulate false;
}
);
}
}
// ************************************************************************* //
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object decomposeParDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
numberOfSubdomains 16;
method hierarchical;
coeffs
{
n (4 2 2);
//delta 0.001; // default=0.001
//order xyz; // default=xzy
}
distributed no;
roots ( );
// ************************************************************************* //
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object fvSchemes;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
ddtSchemes
{
default Euler;
}
gradSchemes
{
default Gauss linear;
}
divSchemes
{
div(rhoPhi,U) Gauss vanLeerV;
div(phi,alpha) Gauss vanLeer;
div(phirb,alpha) Gauss vanLeer;
div(((rho*nuEff)*dev2(T(grad(U))))) Gauss linear;
}
laplacianSchemes
{
default Gauss linear corrected;
}
interpolationSchemes
{
default linear;
}
snGradSchemes
{
default corrected;
}
// ************************************************************************* //
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object fvSolution;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
solvers
{
alpha.water
{
nAlphaCorr 1;
nAlphaSubCycles 3;