From e8a2c4570b3c68580950ce18ea433fb50fd20559 Mon Sep 17 00:00:00 2001 From: Will Bainbridge Date: Wed, 1 Jul 2020 14:32:51 +0100 Subject: [PATCH 1/2] surfaceFeatures: Prevent floating point error when edge is parallel to plane --- .../meshes/primitiveShapes/line/line.H | 4 +--- .../meshes/primitiveShapes/line/lineI.H | 19 +------------------ .../surfaceFeatures/surfaceFeatures.C | 7 ++----- 3 files changed, 4 insertions(+), 26 deletions(-) diff --git a/src/OpenFOAM/meshes/primitiveShapes/line/line.H b/src/OpenFOAM/meshes/primitiveShapes/line/line.H index 3106abcba2..0eb5a3a5f2 100644 --- a/src/OpenFOAM/meshes/primitiveShapes/line/line.H +++ b/src/OpenFOAM/meshes/primitiveShapes/line/line.H @@ -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 diff --git a/src/OpenFOAM/meshes/primitiveShapes/line/lineI.H b/src/OpenFOAM/meshes/primitiveShapes/line/lineI.H index f1cbeefebc..d0c645a9f1 100644 --- a/src/OpenFOAM/meshes/primitiveShapes/line/lineI.H +++ b/src/OpenFOAM/meshes/primitiveShapes/line/lineI.H @@ -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::nearestDist } -template -bool Foam::line::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 diff --git a/src/meshTools/triSurface/surfaceFeatures/surfaceFeatures.C b/src/meshTools/triSurface/surfaceFeatures/surfaceFeatures.C index 72b791fcad..20bb57bb79 100644 --- a/src/meshTools/triSurface/surfaceFeatures/surfaceFeatures.C +++ b/src/meshTools/triSurface/surfaceFeatures/surfaceFeatures.C @@ -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; } From 197b1480105689a8b474c418ce7595aceb7fd9ca Mon Sep 17 00:00:00 2001 From: Chris Greenshields Date: Wed, 1 Jul 2020 14:42:33 +0100 Subject: [PATCH 2/2] flowWithOpenBoundary: tutorial case to explore p and U boundary conditions at an open boundary --- .../RAS/flowWithOpenBoundary/0/T.orig | 50 ++++++++ .../RAS/flowWithOpenBoundary/0/U.orig | 51 ++++++++ .../pimpleFoam/RAS/flowWithOpenBoundary/0/k | 51 ++++++++ .../pimpleFoam/RAS/flowWithOpenBoundary/0/nut | 42 +++++++ .../RAS/flowWithOpenBoundary/0/omega | 51 ++++++++ .../RAS/flowWithOpenBoundary/0/p.orig | 52 ++++++++ .../RAS/flowWithOpenBoundary/Allclean | 13 ++ .../RAS/flowWithOpenBoundary/Allrun | 111 ++++++++++++++++ .../constant/momentumTransport | 28 +++++ .../constant/transportProperties | 21 ++++ .../distortMesh/Make/files | 3 + .../distortMesh/Make/options | 7 ++ .../distortMesh/distortMesh.C | 79 ++++++++++++ .../flowWithOpenBoundary/system/blockMeshDict | 118 ++++++++++++++++++ .../flowWithOpenBoundary/system/controlDict | 53 ++++++++ .../system/extrudeMeshDict | 29 +++++ .../RAS/flowWithOpenBoundary/system/fvSchemes | 64 ++++++++++ .../flowWithOpenBoundary/system/fvSolution | 70 +++++++++++ .../system/scalarTransport | 23 ++++ 19 files changed, 916 insertions(+) create mode 100644 tutorials/incompressible/pimpleFoam/RAS/flowWithOpenBoundary/0/T.orig create mode 100644 tutorials/incompressible/pimpleFoam/RAS/flowWithOpenBoundary/0/U.orig create mode 100644 tutorials/incompressible/pimpleFoam/RAS/flowWithOpenBoundary/0/k create mode 100644 tutorials/incompressible/pimpleFoam/RAS/flowWithOpenBoundary/0/nut create mode 100644 tutorials/incompressible/pimpleFoam/RAS/flowWithOpenBoundary/0/omega create mode 100644 tutorials/incompressible/pimpleFoam/RAS/flowWithOpenBoundary/0/p.orig create mode 100755 tutorials/incompressible/pimpleFoam/RAS/flowWithOpenBoundary/Allclean create mode 100755 tutorials/incompressible/pimpleFoam/RAS/flowWithOpenBoundary/Allrun create mode 100644 tutorials/incompressible/pimpleFoam/RAS/flowWithOpenBoundary/constant/momentumTransport create mode 100644 tutorials/incompressible/pimpleFoam/RAS/flowWithOpenBoundary/constant/transportProperties create mode 100644 tutorials/incompressible/pimpleFoam/RAS/flowWithOpenBoundary/distortMesh/Make/files create mode 100644 tutorials/incompressible/pimpleFoam/RAS/flowWithOpenBoundary/distortMesh/Make/options create mode 100644 tutorials/incompressible/pimpleFoam/RAS/flowWithOpenBoundary/distortMesh/distortMesh.C create mode 100644 tutorials/incompressible/pimpleFoam/RAS/flowWithOpenBoundary/system/blockMeshDict create mode 100644 tutorials/incompressible/pimpleFoam/RAS/flowWithOpenBoundary/system/controlDict create mode 100644 tutorials/incompressible/pimpleFoam/RAS/flowWithOpenBoundary/system/extrudeMeshDict create mode 100644 tutorials/incompressible/pimpleFoam/RAS/flowWithOpenBoundary/system/fvSchemes create mode 100644 tutorials/incompressible/pimpleFoam/RAS/flowWithOpenBoundary/system/fvSolution create mode 100644 tutorials/incompressible/pimpleFoam/RAS/flowWithOpenBoundary/system/scalarTransport diff --git a/tutorials/incompressible/pimpleFoam/RAS/flowWithOpenBoundary/0/T.orig b/tutorials/incompressible/pimpleFoam/RAS/flowWithOpenBoundary/0/T.orig new file mode 100644 index 0000000000..7e5498cbf5 --- /dev/null +++ b/tutorials/incompressible/pimpleFoam/RAS/flowWithOpenBoundary/0/T.orig @@ -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" +} + +// ************************************************************************* // diff --git a/tutorials/incompressible/pimpleFoam/RAS/flowWithOpenBoundary/0/U.orig b/tutorials/incompressible/pimpleFoam/RAS/flowWithOpenBoundary/0/U.orig new file mode 100644 index 0000000000..225af0520b --- /dev/null +++ b/tutorials/incompressible/pimpleFoam/RAS/flowWithOpenBoundary/0/U.orig @@ -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; + } +} + +// ************************************************************************* // diff --git a/tutorials/incompressible/pimpleFoam/RAS/flowWithOpenBoundary/0/k b/tutorials/incompressible/pimpleFoam/RAS/flowWithOpenBoundary/0/k new file mode 100644 index 0000000000..78c024a9d7 --- /dev/null +++ b/tutorials/incompressible/pimpleFoam/RAS/flowWithOpenBoundary/0/k @@ -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; + } +} + + +// ************************************************************************* // diff --git a/tutorials/incompressible/pimpleFoam/RAS/flowWithOpenBoundary/0/nut b/tutorials/incompressible/pimpleFoam/RAS/flowWithOpenBoundary/0/nut new file mode 100644 index 0000000000..f2d8a48c3a --- /dev/null +++ b/tutorials/incompressible/pimpleFoam/RAS/flowWithOpenBoundary/0/nut @@ -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; + } +} + + +// ************************************************************************* // diff --git a/tutorials/incompressible/pimpleFoam/RAS/flowWithOpenBoundary/0/omega b/tutorials/incompressible/pimpleFoam/RAS/flowWithOpenBoundary/0/omega new file mode 100644 index 0000000000..20e8056086 --- /dev/null +++ b/tutorials/incompressible/pimpleFoam/RAS/flowWithOpenBoundary/0/omega @@ -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; + } +} + + +// ************************************************************************* // diff --git a/tutorials/incompressible/pimpleFoam/RAS/flowWithOpenBoundary/0/p.orig b/tutorials/incompressible/pimpleFoam/RAS/flowWithOpenBoundary/0/p.orig new file mode 100644 index 0000000000..5e1db5f731 --- /dev/null +++ b/tutorials/incompressible/pimpleFoam/RAS/flowWithOpenBoundary/0/p.orig @@ -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; + } +} + +// ************************************************************************* // diff --git a/tutorials/incompressible/pimpleFoam/RAS/flowWithOpenBoundary/Allclean b/tutorials/incompressible/pimpleFoam/RAS/flowWithOpenBoundary/Allclean new file mode 100755 index 0000000000..90a6a030af --- /dev/null +++ b/tutorials/incompressible/pimpleFoam/RAS/flowWithOpenBoundary/Allclean @@ -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 + +#------------------------------------------------------------------------------ diff --git a/tutorials/incompressible/pimpleFoam/RAS/flowWithOpenBoundary/Allrun b/tutorials/incompressible/pimpleFoam/RAS/flowWithOpenBoundary/Allrun new file mode 100755 index 0000000000..05acdfd89a --- /dev/null +++ b/tutorials/incompressible/pimpleFoam/RAS/flowWithOpenBoundary/Allrun @@ -0,0 +1,111 @@ +#!/bin/sh + +usage () { + exec 1>&2 + while [ "$#" -ge 1 ]; do echo "$1"; shift; done + cat < set BC for p on the atmosphere patch + -U | -UBC 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)" + +#------------------------------------------------------------------------------ diff --git a/tutorials/incompressible/pimpleFoam/RAS/flowWithOpenBoundary/constant/momentumTransport b/tutorials/incompressible/pimpleFoam/RAS/flowWithOpenBoundary/constant/momentumTransport new file mode 100644 index 0000000000..096791b1f9 --- /dev/null +++ b/tutorials/incompressible/pimpleFoam/RAS/flowWithOpenBoundary/constant/momentumTransport @@ -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; +} + +// ************************************************************************* // diff --git a/tutorials/incompressible/pimpleFoam/RAS/flowWithOpenBoundary/constant/transportProperties b/tutorials/incompressible/pimpleFoam/RAS/flowWithOpenBoundary/constant/transportProperties new file mode 100644 index 0000000000..c5c4d6b1e5 --- /dev/null +++ b/tutorials/incompressible/pimpleFoam/RAS/flowWithOpenBoundary/constant/transportProperties @@ -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; + +// ************************************************************************* // diff --git a/tutorials/incompressible/pimpleFoam/RAS/flowWithOpenBoundary/distortMesh/Make/files b/tutorials/incompressible/pimpleFoam/RAS/flowWithOpenBoundary/distortMesh/Make/files new file mode 100644 index 0000000000..d04ce80abd --- /dev/null +++ b/tutorials/incompressible/pimpleFoam/RAS/flowWithOpenBoundary/distortMesh/Make/files @@ -0,0 +1,3 @@ +distortMesh.C + +EXE = $(FOAM_USER_APPBIN)/distortMesh diff --git a/tutorials/incompressible/pimpleFoam/RAS/flowWithOpenBoundary/distortMesh/Make/options b/tutorials/incompressible/pimpleFoam/RAS/flowWithOpenBoundary/distortMesh/Make/options new file mode 100644 index 0000000000..d27c95d033 --- /dev/null +++ b/tutorials/incompressible/pimpleFoam/RAS/flowWithOpenBoundary/distortMesh/Make/options @@ -0,0 +1,7 @@ +EXE_INC = \ + -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/meshTools/lnInclude + +EXE_LIBS = \ + -lfiniteVolume \ + -lmeshTools diff --git a/tutorials/incompressible/pimpleFoam/RAS/flowWithOpenBoundary/distortMesh/distortMesh.C b/tutorials/incompressible/pimpleFoam/RAS/flowWithOpenBoundary/distortMesh/distortMesh.C new file mode 100644 index 0000000000..6354c346b0 --- /dev/null +++ b/tutorials/incompressible/pimpleFoam/RAS/flowWithOpenBoundary/distortMesh/distortMesh.C @@ -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 . + +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(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; +} + + +// ************************************************************************* // diff --git a/tutorials/incompressible/pimpleFoam/RAS/flowWithOpenBoundary/system/blockMeshDict b/tutorials/incompressible/pimpleFoam/RAS/flowWithOpenBoundary/system/blockMeshDict new file mode 100644 index 0000000000..d523f32d23 --- /dev/null +++ b/tutorials/incompressible/pimpleFoam/RAS/flowWithOpenBoundary/system/blockMeshDict @@ -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 +( +); + +// ************************************************************************* // diff --git a/tutorials/incompressible/pimpleFoam/RAS/flowWithOpenBoundary/system/controlDict b/tutorials/incompressible/pimpleFoam/RAS/flowWithOpenBoundary/system/controlDict new file mode 100644 index 0000000000..ca56d5bba9 --- /dev/null +++ b/tutorials/incompressible/pimpleFoam/RAS/flowWithOpenBoundary/system/controlDict @@ -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 +} + +// ************************************************************************* // diff --git a/tutorials/incompressible/pimpleFoam/RAS/flowWithOpenBoundary/system/extrudeMeshDict b/tutorials/incompressible/pimpleFoam/RAS/flowWithOpenBoundary/system/extrudeMeshDict new file mode 100644 index 0000000000..be3b6c7b9b --- /dev/null +++ b/tutorials/incompressible/pimpleFoam/RAS/flowWithOpenBoundary/system/extrudeMeshDict @@ -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; + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/tutorials/incompressible/pimpleFoam/RAS/flowWithOpenBoundary/system/fvSchemes b/tutorials/incompressible/pimpleFoam/RAS/flowWithOpenBoundary/system/fvSchemes new file mode 100644 index 0000000000..fe04c4c7a3 --- /dev/null +++ b/tutorials/incompressible/pimpleFoam/RAS/flowWithOpenBoundary/system/fvSchemes @@ -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; +} + +// ************************************************************************* // diff --git a/tutorials/incompressible/pimpleFoam/RAS/flowWithOpenBoundary/system/fvSolution b/tutorials/incompressible/pimpleFoam/RAS/flowWithOpenBoundary/system/fvSolution new file mode 100644 index 0000000000..90c9f6236a --- /dev/null +++ b/tutorials/incompressible/pimpleFoam/RAS/flowWithOpenBoundary/system/fvSolution @@ -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; + } +} + +// ************************************************************************* // diff --git a/tutorials/incompressible/pimpleFoam/RAS/flowWithOpenBoundary/system/scalarTransport b/tutorials/incompressible/pimpleFoam/RAS/flowWithOpenBoundary/system/scalarTransport new file mode 100644 index 0000000000..a0601c41e7 --- /dev/null +++ b/tutorials/incompressible/pimpleFoam/RAS/flowWithOpenBoundary/system/scalarTransport @@ -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; + +// ************************************************************************* //