tutorials: Updated for new preconfigurations

This commit is contained in:
Will Bainbridge
2021-07-09 12:41:06 +01:00
parent 5d0d9a4fa3
commit 98b90398f1
68 changed files with 257 additions and 947 deletions

View File

@ -45,7 +45,7 @@ runTimeModifiable true;
functions
{
#includeFunc scalarTransport
#includeFunc scalarTransport(T, alphaD=1, alphaDt=1)
#includeFunc time
}

View File

@ -1,23 +0,0 @@
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: dev
\\/ M anipulation |
-------------------------------------------------------------------------------
Description
Solves a transport equation for a scalar field.
The name of the scalar field is specified in this file. A sample scalar
field file, that must be initialised for the case, typically in the 0
directory, is available in $FOAM_ETC/caseDicts/solvers/scalarTransport.
\*---------------------------------------------------------------------------*/
#includeEtc "caseDicts/postProcessing/solvers/scalarTransport/scalarTransport.cfg"
field T;
alphaD 1;
alphaDt 1;
// ************************************************************************* //

View File

@ -50,7 +50,7 @@ maxCo 5;
functions
{
#includeFunc patchAverage(name=inlet, fields=(p U))
#includeFunc patchAverage(patch=inlet, fields=(p U))
}
// ************************************************************************* //

View File

@ -50,7 +50,7 @@ maxCo 5;
functions
{
#includeFunc scalarTransport
#includeFunc scalarTransport(tracer)
}
// ************************************************************************* //

View File

@ -1,21 +0,0 @@
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: dev
\\/ M anipulation |
-------------------------------------------------------------------------------
Description
Solves a transport equation for a scalar field.
The name of the scalar field is specified in this file. A sample scalar
field file, that must be initialised for the case, typically in the 0
directory, is available in $FOAM_ETC/caseDicts/solvers/scalarTransport.
\*---------------------------------------------------------------------------*/
#includeEtc "caseDicts/postProcessing/solvers/scalarTransport/scalarTransport.cfg"
field tracer;
// ************************************************************************* //

View File

@ -50,7 +50,7 @@ maxCo 5;
functions
{
#includeFunc patchAverage(name=inlet, fields=(p U))
#includeFunc patchAverage(patch=inlet, fields=(p U))
}
// ************************************************************************* //

View File

@ -45,7 +45,9 @@ runTimeModifiable true;
functions
{
#includeFunc graphs
#includeFunc graphCell(funcName=lineA, start=(-0.0016 0 0), end=(-0.0016 0.0128 0), U)
#includeFunc graphCell(funcName=lineB, start=(-0.0048 0 0), end=(-0.0048 0.0128 0), U)
#includeFunc graphCell(funcName=lineC, start=(-0.0032 0 0), end=(-0.0032 0.0128 0), U)
}
// ************************************************************************* //

View File

@ -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 |
-------------------------------------------------------------------------------
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"
type sets;
libs ("libsampling.so");
writeControl writeTime;
interpolationScheme cellPoint;
setFormat raw;
setConfig
{
type lineCell;
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

@ -46,8 +46,8 @@ runTimeModifiable true;
functions
{
#includeFunc residuals(p, sigma)
#includeFunc singleGraph
#includeFunc probes
#includeFunc graphCell(funcName=graph, start=(0 0 0), end=(0 1 0), U)
#includeFunc probes(funcName=probes, points=((0 1 0)), U)
}
// ************************************************************************* //

View File

@ -1,21 +0,0 @@
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: dev
\\/ 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

@ -1,45 +0,0 @@
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: dev
\\/ 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"
type sets;
libs ("libsampling.so");
writeControl writeTime;
interpolationScheme cellPoint;
setFormat raw;
setConfig
{
type lineCell;
axis distance; // x, y, z, xyz
}
sets
(
line
{
$setConfig;
start (0 0 0);
end (0 1 0);
}
);
fields (U);
// ************************************************************************* //

View File

@ -53,5 +53,6 @@ const dictionary& gradPDict =
fvModels.subDict("momentumSource").subDict("sources");
const scalar K(vector(gradPDict.subDict("U").lookup("explicit")).x());
dictionary probes(IFstream(runTime.system()/"probes")());
const point location = pointField(probes.lookup("probeLocations"))[0];
const dictionary& probesDict =
runTime.controlDict().subDict("functions").subDict("probes");
const point location = pointField(probesDict.lookup("probeLocations"))[0];

View File

@ -50,13 +50,11 @@ functions
{
type probes;
libs ("libsampling.so");
writeControl timeStep;
writeInterval 1;
fields
(
p
);
fields (p);
probeLocations
(
@ -68,37 +66,29 @@ functions
(0.1524 0.0253 0)
(0.1778 0.0253 0)
);
}
#includeFunc fieldAverage(U, p, prime2Mean = yes)
surfaceSampling
{
// Sample near-wall velocity
type surfaces;
// Where to load it from (if not already in solver)
type surfaces;
libs ("libsampling.so");
writeControl writeTime;
interpolationScheme cellPoint;
surfaceFormat vtk;
surfaceFormat vtk;
// Fields to be sampled
fields
(
U
);
fields (U);
surfaces
(
nearWall
{
type patchInternalField;
patches ( lowerWall );
patches (lowerWall);
distance 1e-6;
interpolate true;
triangulate false;
@ -106,7 +96,7 @@ functions
);
}
#includeFunc scalarTransport
#includeFunc scalarTransport(s)
}
// ************************************************************************* //

View File

@ -47,8 +47,26 @@ runTimeModifiable true;
functions
{
#includeFunc wallShearStress
#includeFunc wallShearStressGraph
#includeFunc kGraph
#includeFunc graphUniform
(
funcName=wallShearStressGraph,
start=(0.04075 0.00075 0),
end=(3.04 0.00075 0),
nPoints=100,
axis=x,
wallShearStress
)
#includeFunc graphUniform
(
funcName=kGraph,
start=(0.04075 0.05 0),
end=(3.04 0.05 0),
nPoints=100,
axis=x,
k
)
}
// ************************************************************************* //

View File

@ -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 |
-------------------------------------------------------------------------------
Description
Writes graph data for specified fields along a line, specified by start
and end points.
\*---------------------------------------------------------------------------*/
start (0.04075 0.05 0);
end (3.04 0.05 0);
fields (k);
// Sampling and I/O settings
#includeEtc "caseDicts/postProcessing/graphs/sampleDict.cfg"
// Override settings here, e.g.
setConfig
{
axis x;
}
// Must be last entry
#includeEtc "caseDicts/postProcessing/graphs/graph.cfg"
// ************************************************************************* //

View File

@ -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 |
-------------------------------------------------------------------------------
Description
Writes graph data for specified fields along a line, specified by start
and end points.
\*---------------------------------------------------------------------------*/
start (0.04075 0.00075 0);
end (3.04 0.00075 0);
fields (wallShearStress);
// Sampling and I/O settings
#includeEtc "caseDicts/postProcessing/graphs/sampleDict.cfg"
// Override settings here, e.g.
setConfig
{
axis x;
}
// Must be last entry
#includeEtc "caseDicts/postProcessing/graphs/graph.cfg"
// ************************************************************************* //

View File

@ -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 |
-------------------------------------------------------------------------------
Description
Writes out surface files with interpolated field data in VTK format, e.g.
cutting planes, iso-surfaces and patch boundary surfaces.
This file includes a selection of example surfaces, each of which the user
should configure and/or remove.
\*---------------------------------------------------------------------------*/
#includeEtc "caseDicts/postProcessing/visualisation/surfaces.cfg"
fields (p);
surfaces
(
car
{
$patchSurface;
patches ( ".*(body|Wheels)" );
}
);
// ************************************************************************* //

View File

@ -50,10 +50,35 @@ runTimeModifiable true;
functions
{
#includeFunc forceCoeffsIncompressible
#includeFunc time
#includeFunc car
#includeFunc streamlines
#includeFunc slices
#includeFunc streamLinesSphere
(
funcName=streamlines,
centre=(4 0 0.7),
radius=1,
nPoints=30,
fields=(U)
)
#includeFunc cutPlaneSurface
(
funcName=xNormal,
point=(4 0 1),
normal=(1 0 0),
fields=(p U)
)
#includeFunc cutPlaneSurface
(
funcName=yNormal,
point=(-5 0.02 1),
normal=(0 1 0),
fields=(p U)
)
#includeFunc patchSurface(funcName=car, patch=".*(body|Wheels)", p)
}
// ************************************************************************* //

View File

@ -7,25 +7,26 @@
-------------------------------------------------------------------------------
Description
Calculates lift, drag and moment coefficients by summing forces on
specified patches for a case where the solver is incompressible (pressure
is kinematic, e.g. m^2/s^2).
specified patches for a case where the solver is incompressible; i.e.,
pressure is kinematic and has units of m^2/s^2.
\*---------------------------------------------------------------------------*/
#include "$FOAM_CASE/0/U"
patches ( ".*(body|Wheels)" );
magUInf $Uinlet;
lRef $wheelBase;
Aref 2.154;
liftDir (0 0 1);
dragDir (1 0 0);
CofR (1.391 0 0);
pitchAxis (0 1 0);
#includeEtc "caseDicts/postProcessing/forces/forceCoeffsIncompressible.cfg"
#include "$FOAM_CASE/0/U"
patches (".*(body|Wheels)"); // Patches on which to calculate forces
magUInf $Uinlet; // Far field velocity magnitude; e.g., 20 m/s
lRef $wheelBase; // Reference length scale for moment calculations;
// e.g., 1 m
Aref 2.154; // Reference area; e.g., 1 m^2
CofR (1.391 0 0); // Centre of rotation; e.g., (0 0 0)
liftDir (0 0 1); // Direction of lift force; e.g., (0 0 1)
dragDir (1 0 0); // Direction of drag force; e.g., (1 0 0)
pitchAxis (0 1 0); // Pitch axis; e.g., (0 1 0)
// ************************************************************************* //

View File

@ -1,46 +0,0 @@
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: dev
\\/ M anipulation |
-------------------------------------------------------------------------------
Description
Writes out surface files with interpolated field data in VTK format, e.g.
cutting planes, iso-surfaces and patch boundary surfaces.
This file includes a selection of example surfaces, each of which the user
should configure and/or remove.
\*---------------------------------------------------------------------------*/
#includeEtc "caseDicts/postProcessing/visualisation/surfaces.cfg"
fields (p U);
surfaces
(
xNormal
{
$cuttingPlane;
pointAndNormalDict
{
point (4 0 1);
normal $x;
}
filtering full;
}
yNormal
{
$cuttingPlane;
pointAndNormalDict
{
point (-5 0.02 1);
normal $y;
}
filtering full;
}
);
// ************************************************************************* //

View File

@ -1,28 +0,0 @@
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: dev
\\/ M anipulation |
-------------------------------------------------------------------------------
Description
Writes out files of streamlines with interpolated field data in VTK format.
\*---------------------------------------------------------------------------*/
#includeEtc "caseDicts/postProcessing/visualisation/streamlines.cfg"
fields (U);
direction both;
seedSampleSet
{
type sphereRandom;
centre (4 0 0.7);
radius 1;
nPoints 30;
axis x;
}
// ************************************************************************* //

View File

@ -51,7 +51,15 @@ cacheTemporaryObjects
functions
{
#includeFunc streamlines
#includeFunc streamLinesLine
(
funcName=streamlines,
start=(-0.0205 0.001 0.00001),
end=(-0.0205 0.0251 0.00001),
nPoints=10,
fields=(p k U)
)
#includeFunc writeObjects(kEpsilon:G)
}

View File

@ -1,28 +0,0 @@
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: dev
\\/ M anipulation |
-------------------------------------------------------------------------------
Description
Writes out files of streamlines with interpolated field data in VTK format.
\*---------------------------------------------------------------------------*/
direction both;
seedSampleSet
{
type lineUniform;
start (-0.0205 0.001 0.00001);
end (-0.0205 0.0251 0.00001);
nPoints 10;
axis x;
}
fields (p k U);
#includeEtc "caseDicts/postProcessing/visualisation/streamlines.cfg"
// ************************************************************************* //

View File

@ -6,10 +6,12 @@ cd ${0%/*} || exit 1 # Run from this directory
runApplication blockMesh
runApplication simpleFoam
runApplication -s age simpleFoam -latestTime -postProcess -func age
runApplication -s age simpleFoam -postProcess -latestTime \
-func "age(diffusion=true)"
runApplication -s probes1 postProcess -func probes1 -latestTime
runApplication -s probes2 postProcess -func probes2 -latestTime
runApplication -s flowRatePatch postProcess -func flowRatePatch -latestTime
runApplication -s patchFlowRate postProcess -latestTime \
-func "patchFlowRate(funcName=inletFlowRate,patch=inlet)" -latestTime
(cd validation && ./Allrun $*)

View File

@ -1,31 +0,0 @@
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: dev
\\/ M anipulation |
-------------------------------------------------------------------------------
Description
Solves a transport equation to determine the time taken for a particle to
convect from an inlet to the location in the flow.
This will output a field, age, with units of time. This field needs a
solver setting in fvSolution and a div(phi,age) scheme in fvSchemes.
Alternatively, a schemesField entry can be used to reuse settings from
another field.
The number of correctors, nCorr, determines how many times the solution is
repeated to iterate away any non-linearities in the choice of scheme. If
the divergence scheme is set to upwind, no corrections will be necessary.
\*---------------------------------------------------------------------------*/
type age;
libs ("libfieldFunctionObjects.so");
diffusion true;
executeControl writeTime;
writeControl writeTime;
// ************************************************************************* //

View File

@ -46,7 +46,7 @@ runTimeModifiable true;
functions
{
#includeFunc residuals
#includeFunc residuals(p, U)
}
// ************************************************************************* //

View File

@ -1,19 +0,0 @@
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: dev
\\/ M anipulation |
-------------------------------------------------------------------------------
Description
Calculates the flow rate through a specified patch by summing the flux on
patch faces. For solvers where the flux is volumetric, the flow rate is
volumetric; where flux is mass flux, the flow rate is mass flow rate.
\*---------------------------------------------------------------------------*/
name inlet;
#includeEtc "caseDicts/postProcessing/flowRate/flowRatePatch.cfg"
// ************************************************************************* //

View File

@ -10,10 +10,7 @@ Description
\*---------------------------------------------------------------------------*/
#includeEtc "caseDicts/postProcessing/probes/probes.cfg"
fields (age);
probeLocations
points
(
(1.13 1.8 0.0)
(1.13 1.8 0.1)
@ -47,4 +44,8 @@ probeLocations
(1.13 1.8 3.0)
);
fields (age);
#includeEtc "caseDicts/postProcessing/probes/probes.cfg"
// ************************************************************************* //

View File

@ -10,10 +10,7 @@ Description
\*---------------------------------------------------------------------------*/
#includeEtc "caseDicts/postProcessing/probes/probes.cfg"
fields (age);
probeLocations
points
(
(3.2 1.8 0.0)
(3.2 1.8 0.1)
@ -47,4 +44,8 @@ probeLocations
(3.2 1.8 3.0)
);
fields (age);
#includeEtc "caseDicts/postProcessing/probes/probes.cfg"
// ************************************************************************* //

View File

@ -7,7 +7,7 @@ head -n 30 ../postProcessing/probes1/*/age | cut -d' ' -f6 | cut -d')' -f1 > pos
# Build dimless age value
V=45.36
Vdot=`cat ../postProcessing/flowRatePatch/0/surfaceFieldValue.dat | tail -n 1 | xargs | cut -d' ' -f2`
Vdot=`cat ../postProcessing/inletFlowRate/*/surfaceFieldValue.dat | tail -n 1 | xargs | cut -d' ' -f2`
Vdot=`echo $Vdot | sed 's/e/*10^/'`
while IFS= read -r line