Maxwell model for viscoelasticity using the upper-convected time

derivative of the stress tensor.  See
http://en.wikipedia.org/wiki/Upper-convected_Maxwell_model

The model includes an additional viscosity (nu) from the transport
model from which it is instantiated, which makes it equivalent to the
Oldroyd-B model for the case of an incompressible transport model.
See https://en.wikipedia.org/wiki/Oldroyd-B_model
This commit is contained in:
Chris Greenshields
2016-09-20 18:38:15 +01:00
parent f6fa3d5cc6
commit 3264ba7ad5
33 changed files with 1769 additions and 0 deletions

View File

@ -0,0 +1,46 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volVectorField;
object U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Uinlet (0.03876 0 0);
dimensions [0 1 -1 0 0 0 0];
internalField uniform (0 0 0);
boundaryField
{
inlet
{
type fixedValue;
value uniform $Uinlet;
}
outlet
{
type zeroGradient;
value uniform (0 0 0);
}
wall
{
type fixedValue;
value uniform (0 0 0);
}
#includeEtc "caseDicts/setConstraintTypes"
}
// ************************************************************************* //

View File

@ -0,0 +1,42 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
object p;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 2 -2 0 0 0 0];
internalField uniform 0;
boundaryField
{
inlet
{
type zeroGradient;
}
outlet
{
type fixedValue;
value uniform 0;
}
wall
{
type zeroGradient;
}
#includeEtc "caseDicts/setConstraintTypes"
}
// ************************************************************************* //

View File

@ -0,0 +1,38 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volSymmTensorField;
object R;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 2 -2 0 0 0 0];
internalField uniform (0 0 0 0 0 0);
boundaryField
{
inlet
{
type fixedValue;
value $internalField;
}
".*"
{
type zeroGradient;
}
#includeEtc "caseDicts/setConstraintTypes"
}
// ************************************************************************* //

View File

@ -0,0 +1,21 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 3.0.1 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object transportProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
transportModel Newtonian;
nu [0 2 -1 0 0 0 0] 1e-5;
// ************************************************************************* //

View File

@ -0,0 +1,32 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object turbulenceProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
simulationType laminar;
laminar
{
laminarModel Maxwell;
MaxwellCoeffs
{
nuM 0.002;
lambda 0.03;
}
printCoeffs on;
}
// ************************************************************************* //

View File

@ -0,0 +1,112 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
convertToMeters 0.0032;
vertices
(
(-40 0 -1)
( 0 0 -1)
( 30 0 -1)
(-40 1 -1)
( 0 1 -1)
( 30 1 -1)
(-40 4 -1)
( 0 4 -1)
(-40 0 1)
( 0 0 1)
( 30 0 1)
(-40 1 1)
( 0 1 1)
( 30 1 1)
(-40 4 1)
( 0 4 1)
);
blocks
(
hex (0 1 4 3 8 9 12 11) (40 12 1) simpleGrading (0.02 0.4 1)
hex (1 2 5 4 9 10 13 12) (30 12 1) simpleGrading (50 0.4 1)
hex (3 4 7 6 11 12 15 14) (40 24 1) simpleGrading (0.02 ((0.5 0.5 4.0) (0.5 0.5 0.25)) 1)
);
edges
(
);
boundary
(
inlet
{
type patch;
faces
(
(0 3 11 8)
(3 6 14 11)
);
}
walls
{
type wall;
faces
(
(6 7 15 14)
(7 4 12 15)
(4 5 13 12)
);
}
outlet
{
type patch;
faces
(
(2 5 13 10)
);
}
centreline
{
type symmetryPlane;
faces
(
(0 1 9 8)
(1 2 10 9)
);
}
frontAndBack
{
type empty;
faces
(
(0 1 4 3)
(3 4 7 6)
(1 2 5 4)
(8 9 12 11)
(11 12 15 14)
(9 10 13 12)
);
}
);
mergePatchPairs
(
);
// ************************************************************************* //

View File

@ -0,0 +1,52 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
application pimpleFoam;
startFrom latestTime;
startTime 0;
stopAt endTime;
endTime 0.25;
deltaT 2e-4;
writeControl runTime;
writeInterval 0.01;
purgeWrite 0;
writeFormat ascii;
writePrecision 8;
writeCompression off;
timeFormat general;
timePrecision 6;
runTimeModifiable true;
functions
{
#includeFunc graphs
}
// ************************************************************************* //

View File

@ -0,0 +1,54 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object fvSchemes;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
ddtSchemes
{
default backward;
}
gradSchemes
{
default Gauss linear;
}
divSchemes
{
default none;
div(phi,U) Gauss linearUpwind grad(U);
div(phi,sigma) Gauss vanAlbada;
div(sigma) Gauss linear;
div((nu*dev2(T(grad(U))))) Gauss linear;
div((nuM*grad(U))) Gauss linear;
}
laplacianSchemes
{
default Gauss linear corrected;
}
interpolationSchemes
{
default linear;
}
snGradSchemes
{
default corrected;
}
// ************************************************************************* //

View File

@ -0,0 +1,67 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object fvSolution;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
solvers
{
p
{
solver GAMG;
smoother DIC;
tolerance 1e-6;
relTol 0.05;
}
"(U|sigma)"
{
solver smoothSolver;
smoother symGaussSeidel;
tolerance 1e-6;
relTol 0.1;
}
pFinal
{
$p;
relTol 0;
}
"(U|sigma)Final"
{
$U;
relTol 0;
}
}
PIMPLE
{
momentumPredictor off;
nOuterCorrectors 15;
nCorrectors 1;
nNonOrthogonalCorrectors 0;
pRefCell 0;
pRefValue 0;
turbOnFinalIterOnly no;
}
relaxationFactors
{
equations
{
".*" 1;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,62 @@
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Web: www.OpenFOAM.org
\\/ M anipulation |
-------------------------------------------------------------------------------
Description
Writes graph data for specified fields along a line, specified by start
and end points.
\*---------------------------------------------------------------------------*/
// Sampling and I/O settings
#includeEtc "caseDicts/postProcessing/graphs/sampleDict.cfg"
// Override settings here, e.g.
// setConfig { type midPoint; }
type sets;
libs ("libsampling.so");
writeControl writeTime;
interpolationScheme cellPoint;
setFormat raw;
setConfig
{
type midPoint; // midPoint
axis distance; // x, y, z, xyz
}
sets
(
lineA
{
$setConfig;
start (-0.0016 0 0);
end (-0.0016 0.0128 0);
}
lineB
{
$setConfig;
start (-0.0048 0 0);
end (-0.0048 0.0128 0);
}
lineC
{
$setConfig;
start (-0.032 0 0);
end (-0.032 0.0128 0);
}
);
fields (U);
// ************************************************************************* //

View File

@ -0,0 +1,32 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ 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
{
wall
{
type fixedValue;
value uniform (0 0 0);
}
#includeEtc "caseDicts/setConstraintTypes"
}
// ************************************************************************* //

View File

@ -0,0 +1,31 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
object p;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 2 -2 0 0 0 0];
internalField uniform 0;
boundaryField
{
walls
{
type zeroGradient;
}
#includeEtc "caseDicts/setConstraintTypes"
}
// ************************************************************************* //

View File

@ -0,0 +1,32 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volSymmTensorField;
object R;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 2 -2 0 0 0 0];
internalField uniform (0 0 0 0 0 0);
boundaryField
{
walls
{
type zeroGradient;
}
#includeEtc "caseDicts/setConstraintTypes"
}
// ************************************************************************* //

View File

@ -0,0 +1,12 @@
#!/bin/sh
cd ${0%/*} || exit 1 # Run from this directory
# Source tutorial clean functions
. $WM_PROJECT_DIR/bin/tools/CleanFunctions
cleanCase
rm -rf postProcessing *.dat validation/*.eps
wclean validation/WatersKing
#------------------------------------------------------------------------------

View File

@ -0,0 +1,15 @@
#!/bin/sh
cd ${0%/*} || exit 1 # Run from this directory
# Source tutorial run functions
. $WM_PROJECT_DIR/bin/tools/RunFunctions
runApplication blockMesh
runApplication $(getApplication)
wmake validation/WatersKing
runApplication WatersKing
( cd validation && ./createGraph )
#------------------------------------------------------------------------------

View File

@ -0,0 +1,38 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "constant";
object fvOptions;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
momentumSource
{
type vectorSemiImplicitSource;
active yes;
vectorSemiImplicitSourceCoeffs
{
timeStart 0.0;
duration 1000;
selectionMode all;
volumeMode specific;
injectionRateSuSp
{
U ((5 0 0) 0);
}
}
}
// ************************************************************************* //

View File

@ -0,0 +1,21 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object transportProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
transportModel Newtonian;
nu [0 2 -1 0 0 0 0] 0.1; // kinematic -> 0.002 dynamic
// ************************************************************************* //

View File

@ -0,0 +1,32 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object turbulenceProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
simulationType laminar;
laminar
{
laminarModel Maxwell;
MaxwellCoeffs
{
nuM 1;
lambda 5;
}
printCoeffs on;
}
// ************************************************************************* //

View File

@ -0,0 +1,96 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
convertToMeters 0.1;
vertices
(
(-1 0 -1)
( 1 0 -1)
( 1 10 -1)
(-1 10 -1)
(-1 0 1)
( 1 0 1)
( 1 10 1)
(-1 10 1)
);
blocks
(
hex (0 1 2 3 4 5 6 7) (1 40 1) simpleGrading (1 4 1)
);
edges
(
);
boundary
(
left
{
type cyclic;
neighbourPatch right;
faces
(
(0 3 7 4)
);
}
right
{
type cyclic;
neighbourPatch left;
faces
(
(1 2 6 5)
);
}
walls
{
type wall;
faces
(
(0 1 5 4)
);
}
centreline
{
type symmetryPlane;
faces
(
(2 3 7 6)
);
}
frontAndBack
{
type empty;
faces
(
(0 1 2 3)
(4 5 6 7)
);
}
);
mergePatchPairs
(
);
// ************************************************************************* //

View File

@ -0,0 +1,54 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
application pimpleFoam;
startFrom startTime;
startTime 0;
stopAt endTime;
endTime 25;
deltaT 5e-3;
writeControl runTime;
writeInterval 1;
purgeWrite 0;
writeFormat ascii;
writePrecision 8;
writeCompression off;
timeFormat general;
timePrecision 6;
runTimeModifiable true;
functions
{
#includeFunc residuals
#includeFunc singleGraph
#includeFunc probes
}
// ************************************************************************* //

View File

@ -0,0 +1,54 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object fvSchemes;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
ddtSchemes
{
default backward;
}
gradSchemes
{
default Gauss linear;
}
divSchemes
{
default none;
div(phi,U) Gauss linearUpwind grad(U);
div(phi,sigma) Gauss vanAlbada;
div(sigma) Gauss linear;
div((nu*dev2(T(grad(U))))) Gauss linear;
div((nuM*grad(U))) Gauss linear;
}
laplacianSchemes
{
default Gauss linear uncorrected;
}
interpolationSchemes
{
default linear;
}
snGradSchemes
{
default uncorrected;
}
// ************************************************************************* //

View File

@ -0,0 +1,67 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object fvSolution;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
solvers
{
p
{
solver GAMG;
smoother DIC;
tolerance 1e-6;
relTol 0.05;
}
"(U|sigma)"
{
solver smoothSolver;
smoother symGaussSeidel;
tolerance 1e-6;
relTol 0.1;
}
pFinal
{
$p;
relTol 0;
}
"(U|sigma)Final"
{
$U;
relTol 0;
}
}
PIMPLE
{
momentumPredictor off;
nOuterCorrectors 15;
nCorrectors 3;
nNonOrthogonalCorrectors 0;
pRefCell 0;
pRefValue 0;
turbOnFinalIterOnly no;
}
relaxationFactors
{
equations
{
".*" 1;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,21 @@
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Web: www.OpenFOAM.org
\\/ M anipulation |
-------------------------------------------------------------------------------
Description
Writes out values of fields from cells nearest to specified locations.
\*---------------------------------------------------------------------------*/
#includeEtc "caseDicts/postProcessing/probes/probes.cfg"
fields (U);
probeLocations
(
(0 1 0)
);
// ************************************************************************* //

View File

@ -0,0 +1,19 @@
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Web: www.OpenFOAM.org
\\/ M anipulation |
-------------------------------------------------------------------------------
Description
For specified fields, writes out the initial residuals for the first
solution of each time step; for non-scalar fields (e.g. vectors), writes
the largest of the residuals for each component (e.g. x, y, z).
\*---------------------------------------------------------------------------*/
#includeEtc "caseDicts/postProcessing/numerical/residuals.cfg"
fields (p sigma);
// ************************************************************************* //

View File

@ -0,0 +1,48 @@
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Web: www.OpenFOAM.org
\\/ M anipulation |
-------------------------------------------------------------------------------
Description
Writes graph data for specified fields along a line, specified by start
and end points.
\*---------------------------------------------------------------------------*/
// Sampling and I/O settings
#includeEtc "caseDicts/postProcessing/graphs/sampleDict.cfg"
// Override settings here, e.g.
// setConfig { type midPoint; }
type sets;
libs ("libsampling.so");
writeControl writeTime;
interpolationScheme cellPoint;
setFormat raw;
setConfig
{
type midPoint; // midPoint
axis distance; // x, y, z, xyz
}
sets
(
line
{
$setConfig;
start (0 0 0);
end (0 1 0);
}
);
fields (U);
// ************************************************************************* //

View File

@ -0,0 +1,3 @@
WatersKing.C
EXE = $(FOAM_USER_APPBIN)/WatersKing

View File

@ -0,0 +1,14 @@
EXE_INC = \
-I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/incompressible/lnInclude \
-I$(LIB_SRC)/transportModels \
-I$(LIB_SRC)/transportModels/incompressible/singlePhaseTransportModel \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude
EXE_LIBS = \
-lturbulenceModels \
-lincompressibleTurbulenceModels \
-lincompressibleTransportModels \
-lfiniteVolume \
-lmeshTools

View File

@ -0,0 +1,146 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2016 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/>.
Application
WatersKing
Description
Analytical solution for the start-up planar Poiseuille flow of an
Oldroyd-B fluid.
References:
\verbatim
Waters, N. D., & King, M. J. (1970).
Unsteady flow of an elasto-viscous liquid.
Rheologica Acta, 9, 345-355.
Amoreira, L. J., & Oliveira, P. J. (2010).
Comparison of different formulations for the numerical
calculation of unsteady incompressible viscoelastic fluid
flow. Adv. Appl. Math. Mech, 4, 483-502.
\endverbatim
\*---------------------------------------------------------------------------*/
#include "fvCFD.H"
#include "singlePhaseTransportModel.H"
#include "turbulentTransportModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
int main(int argc, char *argv[])
{
#include "setRootCase.H"
#include "createTime.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "createMesh.H"
#include "createFields.H"
const scalar h = mesh.bounds().span().y();
Info<< "Height from centreline to wall = " << h << endl;
label centrelineID = mesh.boundary().findPatchID("centreline");
const vector patchToCell =
mesh.boundary()[centrelineID].Cf()[0]
- mesh.C()[mesh.findNearestCell(location)];
const scalar y = patchToCell.y()/h;
Info<< "Normalised distance from centreline = " << y << nl << endl;
const scalar nu0 = nu1 + nu2;
const scalar E = lambda*nu0/(rho*sqr(h));
const scalar beta = nu2/nu0;
const scalar UInf = K*sqr(h)/3.0/nu0;
Info<< "Waters and King parameters:" << nl
<< "E = " << E << nl
<< "beta = " << beta << nl
<< "K = " << K << nl
<< "UInf = " << UInf << nl << endl;
label order = 8;
scalarField ak(order, 0);
scalarField bk(order, 0);
scalarField ck(order, 0);
scalarField B(order, 0);
forAll(ak, i)
{
scalar k = i + 1;
ak[i] = (2.0*k - 1)/2.0*constant::mathematical::pi*::sqrt(E);
bk[i] = (1.0 + beta*sqr(ak[i]))/2.0;
ck[i] = ::sqrt(mag(sqr(bk[i]) - sqr(ak[i])));
B[i] = 48*::pow(-1, k)/::pow((2*k - 1)*constant::mathematical::pi, 3)*
::cos((2*k - 1)*constant::mathematical::pi*y/2);
}
scalarField A(order, 0);
OFstream file(runTime.path()/"WatersKing.dat");
const scalar LOGVGREAT = ::log(VGREAT);
while (!runTime.end())
{
scalar t = runTime.timeOutputValue()/lambda;
forAll(A, i)
{
if (bk[i]*t < LOGVGREAT)
{
if (bk[i] >= ak[i])
{
A[i] = (bk[i] - sqr(ak[i]))/ck[i]*::sinh(ck[i]*t)
+ ::cosh(ck[i]*t);
}
else
{
A[i] = (bk[i] - sqr(ak[i]))/ck[i]*::sin(ck[i]*t)
+ ::cos(ck[i]*t);
}
A[i] *= ::exp(-bk[i]*t);
}
else
{
Info<< "Coefficient A[" << order << "] = 0" << endl;
order = i;
Info<< "Resizing A and B to " << order << endl;
A.resize(order);
B.resize(order);
}
}
scalar U = UInf*(1.5*(1 - sqr(y)) + sum(A*B));
file<< runTime.timeName() << token::TAB << U << endl;
runTime++;
}
Info<< nl << "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
<< " ClockTime = " << runTime.elapsedClockTime() << " s"
<< nl << endl;
Info<< "End\n" << endl;
return 0;
}
// ************************************************************************* //

View File

@ -0,0 +1,64 @@
Info<< "Reading transportProperties\n" << endl;
IOdictionary transportProperties
(
IOobject
(
"transportProperties",
runTime.constant(),
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE
)
);
const scalar nu2 =
dimensionedScalar
(
"nu",
dimViscosity,
transportProperties.lookup("nu")
).value();
Info<< "Reading viscoelastic properties\n" << endl;
IOdictionary turbulenceProperties
(
IOobject
(
"turbulenceProperties",
runTime.constant(),
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE
)
);
const dictionary& MaxwellCoeffs =
turbulenceProperties.subDict("laminar").subDict("MaxwellCoeffs");
const scalar nu1 = readScalar(MaxwellCoeffs.lookup("nuM"));
const scalar lambda = readScalar(MaxwellCoeffs.lookup("lambda"));
const scalar rho = 1;
Info<< "Reading pressure gradient\n" << endl;
IOdictionary fvOptions
(
IOobject
(
"fvOptions",
runTime.constant(),
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE
)
);
const dictionary& gradPDict =
fvOptions.subDict("momentumSource").subDict
(
"vectorSemiImplicitSourceCoeffs"
).subDict
(
"injectionRateSuSp"
);
const scalar K =
Tuple2<vector, scalar>(gradPDict.lookup("U")).first().x();
dictionary probes(IFstream(runTime.system()/"probes")());
const point location = pointField(probes.lookup("probeLocations"))[0];

View File

@ -0,0 +1,27 @@
#!/bin/sh
tail -n +4 ../postProcessing/probes/0/U | \
tr -s " " | tr -d '(' | cut -d " " -f2-3 > ../Numerical.dat
if ! which gnuplot > /dev/null 2>&1
then
echo "gnuplot not found - skipping graph creation" >&2
exit 1
fi
gnuplot<<EOF
set terminal postscript eps color enhanced "Helvetica,20"
set output "planarPoiseuille.eps"
set xlabel "Time / [s]" font "Helvetica,24"
set ylabel "Velocity / [m/s]" font "Helvetica,24"
set grid
set key right top
set xrange [0:25]
set yrange [0:8]
plot \
"../Numerical.dat" t "OpenFOAM (every 100 pts)" \
with linespoints pointinterval 100 lt 1 pt 6 ps 1.5, \
"../WatersKing.dat" with lines t "Analytical" lt -1
EOF
# ----------------------------------------------------------------- end-of-file