Merge branch 'master' of github.com-OpenFOAM:OpenFOAM/OpenFOAM-dev

This commit is contained in:
Henry Weller
2020-07-02 09:45:06 +01:00
22 changed files with 920 additions and 26 deletions

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -130,8 +130,6 @@ public:
Point& edgePoint
) const;
bool insideBoundBox(const Point&) const;
// Ostream operator

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -257,23 +257,6 @@ Foam::scalar Foam::line<Point, PointRef>::nearestDist
}
template<class Point, class PointRef>
bool Foam::line<Point, PointRef>::insideBoundBox(const Point& p) const
{
if
(
( p.x() < min(a_.x(), b_.x()) || p.x() > max(a_.x(), b_.x()) )
|| ( p.y() < min(a_.y(), b_.y()) || p.y() > max(a_.y(), b_.y()) )
|| ( p.z() < min(a_.z(), b_.z()) || p.z() > max(a_.z(), b_.z()) )
)
{
return false;
}
return true;
}
// * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * * //
template<class Point, class PointRef>

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -1540,10 +1540,7 @@ void Foam::selectCutEdges
// If edge does not intersect the plane, delete.
const scalar intersect = cutPlane.lineIntersect(line);
const point featPoint = intersect*(p1 - p0) + p0;
if (!line.insideBoundBox(featPoint))
if (intersect < 0 || intersect > 1)
{
edgeStat[edgei] = surfaceFeatures::NONE;
}

View File

@ -0,0 +1,50 @@
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: dev
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
object T;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 0 0 1 0 0 0];
internalField uniform 0;
boundaryField
{
inlet
{
type fixedValue;
value uniform 1;
}
walls
{
type zeroGradient;
value uniform 0;
}
atmosphere
{
type inletOutlet;
inletValue uniform 0;
value uniform 0;
}
outlet
{
type zeroGradient;
}
#includeEtc "caseDicts/setConstraintTypes"
}
// ************************************************************************* //

View File

@ -0,0 +1,51 @@
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: dev
\\/ 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
{
inlet
{
type fixedValue;
value uniform (1 0 0);
}
outlet
{
type zeroGradient;
}
walls
{
type noSlip;
}
atmosphere
{
type pressureInletOutletVelocity;
value uniform (0 0 0);
}
empty
{
type empty;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,51 @@
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: dev
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
object k;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
kInlet 0.001;
dimensions [0 2 -2 0 0 0 0];
internalField uniform $kInlet;
boundaryField
{
inlet
{
type fixedValue;
value uniform $kInlet;
}
"(atmosphere|outlet)"
{
type inletOutlet;
inletValue uniform $kInlet;
value uniform $kInlet;
}
walls
{
type kqRWallFunction;
value uniform $kInlet;
}
empty
{
type empty;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,42 @@
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: dev
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
object nut;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 2 -1 0 0 0 0];
internalField uniform 0;
boundaryField
{
".*"
{
type calculated;
value uniform 0;
}
walls
{
type nutkWallFunction;
value uniform 0;
}
empty
{
type empty;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,51 @@
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: dev
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
object omega;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
omegaInlet 1;
dimensions [0 0 -1 0 0 0 0];
internalField uniform $omegaInlet;
boundaryField
{
inlet
{
type fixedValue;
value uniform $omegaInlet;
}
"(atmosphere|outlet)"
{
type inletOutlet;
inletValue uniform $omegaInlet;
value uniform $omegaInlet;
}
walls
{
type omegaWallFunction;
value uniform $omegaInlet;
}
empty
{
type empty;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,52 @@
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: dev
\\/ 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;
}
walls
{
type zeroGradient;
}
atmosphere
{
type totalPressure;
p0 uniform 0;
value uniform 0;
}
empty
{
type empty;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,13 @@
#!/bin/sh
# Run from this directory
cd "${0%/*}" || exit 1
# Source tutorial clean functions
. "$WM_PROJECT_DIR/bin/tools/CleanFunctions"
cleanCase
wclean distortMesh
#------------------------------------------------------------------------------

View File

@ -0,0 +1,111 @@
#!/bin/sh
usage () {
exec 1>&2
while [ "$#" -ge 1 ]; do echo "$1"; shift; done
cat <<USAGE
Usage: ${0##*/} [OPTIONS]
options:
-d | -distort distort the mesh
-h | -help help
-p | -pBC <type> set BC for p on the atmosphere patch
-U | -UBC <type> set BC for U on the atmosphere patch
CFD simulation to demonstrate boundary conditions at a patch with mixed inflow
and outflow. The user can set the boundary condition on the atmosphere patch
with options:
+ p: totalPressure (default) or fixedValue
+ U: pressureInletOutletVelocity (default) or zeroGradient
USAGE
exit 1
}
distort () {
wmake distortMesh
runApplication distortMesh
rm 0/meshPhi;
mv 0/polyMesh/points constant/polyMesh
rm -rf 0/polyMesh
}
setAtmosphereBC () {
_field="$1"
_BC="$2"
echo "Setting $_field BC on atmosphere patch to $_BC"
foamDictionary \
-entry boundaryField.atmosphere.type \
-set "$_BC" \
"0/$_field" > /dev/null 2>&1
}
# VARIABLES
distort=""
pBC=""
UBC=""
# OPTIONS
while [ "$#" -gt 0 ]
do
case "$1" in
-d | -distort)
distort="yes"
shift
;;
-h | -help)
usage
;;
-p | -pBC)
[ "$#" -ge 2 ] || usage "'$1' option requires an argument"
pBC="$2"
shift 2
;;
-U | -UBC)
[ "$#" -ge 2 ] || usage "'$1' option requires an argument"
UBC="$2"
shift 2
;;
-*)
usage "Invalid option '$1'"
;;
*)
break
;;
esac
done
case "$pBC" in
totalPressure|fixedValue|"") ;;
*)
usage "Invalid boundary condition '$pBC' for p."\
"Valid options: 'totalPressure', 'fixedValue'."
;;
esac
case "$UBC" in
pressureInletOutletVelocity|zeroGradient|"") ;;
*)
usage "Invalid boundary condition '$UBC' for U."\
"Valid options: 'pressureInletOutletVelocity', 'zeroGradient'."
;;
esac
# Run from this directory
cd "${0%/*}" || exit 1
# Source tutorial run functions
. "$WM_PROJECT_DIR/bin/tools/RunFunctions"
runApplication blockMesh
[ "$distort" ] && distort
runApplication extrudeMesh
[ "$pBC" ] && setAtmosphereBC p "$pBC"
[ "$UBC" ] && setAtmosphereBC U "$UBC"
runApplication "$(getApplication)"
#------------------------------------------------------------------------------

View File

@ -0,0 +1,28 @@
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: dev
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object momentumProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
simulationType RAS;
RAS
{
model kOmegaSST;
turbulence on;
printCoeffs on;
}
// ************************************************************************* //

View File

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

View File

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

View File

@ -0,0 +1,7 @@
EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude
EXE_LIBS = \
-lfiniteVolume \
-lmeshTools

View File

@ -0,0 +1,79 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2020 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
distortMesh
Description
\*---------------------------------------------------------------------------*/
#include "fvCFD.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
int main(int argc, char *argv[])
{
#include "setRootCase.H"
#include "createTime.H"
#include "createMesh.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
const pointField& points(mesh.points());
pointField disp(points);
const point boundExtend(0, 0, 1);
const boundBox bounds
(
mesh.bounds().min() - boundExtend,
mesh.bounds().max() + boundExtend
);
Random RanGen(0);
const scalar s(0.04);
forAll(points, i)
{
const point& pi(points[i]);
if (bounds.containsInside(pi))
{
disp[i] += cmptMultiply(RanGen.sample01<vector>(),vector(s, s, 0));
}
}
mesh.movePoints(disp);
mesh.write();
Info<< nl << "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
<< " ClockTime = " << runTime.elapsedClockTime() << " s"
<< nl << endl;
Info<< "End\n" << endl;
return 0;
}
// ************************************************************************* //

View File

@ -0,0 +1,118 @@
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: dev
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
convertToMeters 1;
vertices
(
(0 0 -1)
(5 0 -1)
(0 1 -1)
(5 1 -1)
(0 2 -1)
(5 2 -1)
(0 3 -1)
(5 3 -1)
(0 0 1)
(5 0 1)
(0 1 1)
(5 1 1)
(0 2 1)
(5 2 1)
(0 3 1)
(5 3 1)
);
blocks
(
hex (0 1 3 2 8 9 11 10) (100 20 1) simpleGrading (1 1 1)
hex (2 3 5 4 10 11 13 12) (100 20 1) simpleGrading (1 1 1)
hex (4 5 7 6 12 13 15 14) (100 20 1) simpleGrading (1 1 1)
);
edges
(
);
boundary
(
inlet
{
type patch;
faces
(
(2 4 12 10)
);
}
outlet
{
type patch;
faces
(
(1 3 11 9)
);
}
walls
{
type wall;
faces
(
(0 2 10 8)
(0 1 9 8)
(4 6 14 12)
(5 7 15 13)
(3 5 13 11)
);
}
atmosphere
{
type patch;
faces
(
(6 7 15 14)
);
}
front
{
type empty;
faces
(
(8 9 11 10)
(10 11 13 12)
(12 13 15 14)
);
}
back
{
type empty;
faces
(
(0 1 3 2)
(2 3 5 4)
(4 5 7 6)
);
}
);
mergePatchPairs
(
);
// ************************************************************************* //

View File

@ -0,0 +1,53 @@
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: dev
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
application pimpleFoam;
startFrom startTime;
startTime 0;
stopAt endTime;
endTime 100;
deltaT 0.02;
writeControl runTime;
writeInterval 2;
purgeWrite 0;
writeFormat ascii;
writePrecision 6;
writeCompression off;
timeFormat general;
timePrecision 6;
runTimeModifiable true;
functions
{
#includeFunc scalarTransport
#includeFunc time
}
// ************************************************************************* //

View File

@ -0,0 +1,29 @@
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: dev
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object extrudeProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
constructFrom patch;
sourceCase "$FOAM_CASE";
sourcePatches (back);
exposedPatchName front;
extrudeModel plane;
thickness 1;
flipNormals no;
mergeFaces no;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -0,0 +1,64 @@
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: dev
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object fvSchemes;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
ddtSchemes
{
default Euler;
}
gradSchemes
{
default Gauss linear;
limited cellLimited Gauss linear 1;
grad(U) $limited;
grad(omega) $limited;
}
divSchemes
{
default none;
div(phi,U) Gauss linearUpwind limited;
turbulence bounded Gauss limitedLinear 1;
div(phi,k) $turbulence;
div(phi,omega) $turbulence;
div(phi,T) $turbulence;
div((nuEff*dev2(T(grad(U))))) Gauss linear;
}
laplacianSchemes
{
default Gauss linear corrected;
}
interpolationSchemes
{
default linear;
}
snGradSchemes
{
default corrected;
}
wallDist
{
method meshWave;
}
// ************************************************************************* //

View File

@ -0,0 +1,70 @@
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: dev
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object fvSolution;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
solvers
{
p
{
solver GAMG;
smoother GaussSeidel;
tolerance 1e-06;
relTol 0.1;
}
"(U|k|omega)"
{
solver smoothSolver;
smoother GaussSeidel;
tolerance 1e-05;
relTol 0.1;
}
pFinal
{
$p;
tolerance 1e-06;
relTol 0;
}
"(U|k|omega|epsilon)Final"
{
$U;
relTol 0;
}
T
{
$U;
relTol 0;
}
}
"(PIMPLE|PISO)"
{
nOuterCorrectors 1;
nCorrectors 2;
nNonOrthogonalCorrectors 1;
}
relaxationFactors
{
equations
{
".*" 1;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,23 @@
/*--------------------------------*- 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;
// ************************************************************************* //