diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index c13e4d8fb9b77dd2dd5a5c6c6a9f451ea37c2a92..eeae7c0a5a10952d4e38d077ab0c50d4f2627fc4 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -8,6 +8,7 @@ It is likely incomplete... - William Bainbridge - Gabriel Barajas - Kutalmis Bercin +- Ivor Clifford - Greg Collecutt - Jonathan Cranford - Sergio Ferraris diff --git a/src/mesh/extrudeModel/Make/files b/src/mesh/extrudeModel/Make/files index e18ad638e171829cbf7c1e7179b39142b9c7a75f..fceba78c99c5977c1c7fa45f4cfe84a26a1fa4c4 100644 --- a/src/mesh/extrudeModel/Make/files +++ b/src/mesh/extrudeModel/Make/files @@ -10,5 +10,6 @@ sigmaRadial/sigmaRadial.C sector/sector.C cyclicSector/cyclicSector.C wedge/wedge.C +polyline/polyline.C LIB = $(FOAM_LIBBIN)/libextrudeModel diff --git a/src/mesh/extrudeModel/Make/options b/src/mesh/extrudeModel/Make/options index ea559e279e199195b07ebc53fb1bbf3708e04670..bb80044cba74dcc6b91dd5f2e6a6014b67294741 100644 --- a/src/mesh/extrudeModel/Make/options +++ b/src/mesh/extrudeModel/Make/options @@ -1,7 +1,11 @@ EXE_INC = \ + -I$(LIB_SRC)/fileFormats/lnInclude \ -I$(LIB_SRC)/surfMesh/lnInclude \ - -I$(LIB_SRC)/meshTools/lnInclude + -I$(LIB_SRC)/meshTools/lnInclude \ + -I$(LIB_SRC)/mesh/blockMesh/lnInclude \ LIB_LIBS = \ + -lfileFormats \ -lsurfMesh \ - -lmeshTools + -lmeshTools \ + -lblockMesh diff --git a/src/mesh/extrudeModel/polyline/polyline.C b/src/mesh/extrudeModel/polyline/polyline.C new file mode 100644 index 0000000000000000000000000000000000000000..393e3833cce274ac5cced531207a5e4cdf3bcb78 --- /dev/null +++ b/src/mesh/extrudeModel/polyline/polyline.C @@ -0,0 +1,207 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | www.openfoam.com + \\/ M anipulation | +------------------------------------------------------------------------------- + Copyright (C) 2020 Ivor Clifford/Paul Scherrer Institut +------------------------------------------------------------------------------- +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/>. + +\*---------------------------------------------------------------------------*/ + +#include "polyline.H" +#include "addToRunTimeSelectionTable.H" +#include "interpolateXY.H" +#include "quaternion.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace extrudeModels +{ + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +defineTypeNameAndDebug(polyline, 0); + +addToRunTimeSelectionTable(extrudeModel, polyline, dictionary); + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +polyline::polyline(const dictionary& dict) +: + extrudeModel(typeName, dict), + geometry_(0), + vertices_(coeffDict_.lookup("vertices")), + segments_ + ( + coeffDict_.lookup("edges"), + blockEdge::iNew(coeffDict_, geometry_, vertices_) + ), + x_(segments_.size() + 1), + y_(segments_.size() + 1), + relTol_(coeffDict_.lookupOrDefault("toleranceCheck", SMALL)) +{ + // Check continuity and smoothness of the supplied polyline + for(label i=1; i < segments_.size(); i++) + { + // Check continuity + vector x0 = segments_[i-1].position(1); + vector x1 = segments_[i].position(0); + + if (mag(x1-x0) > SMALL) + { + FatalErrorInFunction() + << "Supplied polyline is not continuous." << endl + << Foam::abort(FatalError); + } + + // Check smoothness + vector v0 = (segments_[i-1].position(1) + - segments_[i-1].position(1-DELTA)); + v0 /= mag(v0); + vector v1 = (segments_[i].position(DELTA) + - segments_[i].position(0)); + v1 /= mag(v1); + + if ((v1 & v0) < (1 - relTol_)) + { + FatalErrorInFunction() + << "Supplied polyline is not smooth." << endl + << Foam::abort(FatalError); + } + } + + // Calculate cumulative length along polyline + x_[0] = 0.0; + y_[0] = 0.0; + scalar totalLength = 0.0; + forAll(segments_, i) + { + totalLength += segments_[i].length(); + x_[i+1] = totalLength; + y_[i+1] = i+1; + } + + // Normalise cumulative length (0 <= x <= 1) + x_ /= totalLength; + + // Position vector and direction at start of polyline + positionAndDirection(0, p0_, n0_); + + if (debug) + { + Info<< tab << "Polyline start: " << p0_ << nl + << tab << "Polyline normal at start: " << n0_ << nl + << tab << "Polyline end: " + << segments_[segments_.size()-1].position(1.0) << nl + << tab << "Total length: " << totalLength << endl; + } +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +polyline::~polyline() +{} + + +// * * * * * * * * * * * * * * * * Operators * * * * * * * * * * * * * * * * // + +point polyline::operator() +( + const point& surfacePoint, + const vector& surfaceNormal, + const label layer +) const +{ + // Offset between supplied point and origin of polyline + vector dp = (surfacePoint - p0_); + + // If this is the first layer, check whether the start of the + // polyline seems to lie on the surface + if (layer == 0) + { + if (mag((dp/mag(dp)) & n0_) > relTol_) + { + WarningInFunction() + << "The starting point of the polyline does not appear " + << "to lie of the supplied surface. Apparent absolute " + << "misalignment is " << (dp & n0_) << endl; + } + } + + // Position and direction vector at end of layer + vector p; + vector n; + positionAndDirection(sumThickness(layer), p, n); + + // Angle between normal vector and normal at origin + scalar cosTheta = (n & n0_); + + // Rotate point to align with current normal vector + if (cosTheta < (1-SMALL)) + { + vector axis = (n0_^n); + axis /= mag(axis); + + dp = quaternion(axis, cosTheta, true).transform(dp); + } + + return p + dp; +} + + +void polyline::positionAndDirection +( + const scalar lambda, + vector& p, + vector& n +) const +{ + // Find associated segment and position for supplied lambda + scalar y = interpolateXY(lambda, x_, y_); + int i = floor(y); + scalar s = y - i; + if (i > segments_.size()-1) + { + i = segments_.size()-1; + s = 1.0; + } + + // Position vector + p = segments_[i].position(s); + + // Normal vector at current position + // Estimated normal vector using numerical differencing since + // blockEdge doesn't include a normal function + n = segments_[i].position(min(s + DELTA, 1)) + - segments_[i].position(max(s - DELTA, 0)); + n /= mag(n); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace extrudeModels +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/mesh/extrudeModel/polyline/polyline.H b/src/mesh/extrudeModel/polyline/polyline.H new file mode 100644 index 0000000000000000000000000000000000000000..2cca1267defb64099c9f07f92106ea775d4217d2 --- /dev/null +++ b/src/mesh/extrudeModel/polyline/polyline.H @@ -0,0 +1,139 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | www.openfoam.com + \\/ M anipulation | +------------------------------------------------------------------------------- + Copyright (C) 2020 Ivor Clifford/Paul Scherrer Institut +------------------------------------------------------------------------------- +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/>. + +Class + Foam::extrudeModels::polyline + +Description + Extrudes by transforming points along a polyline provided as a + series of points and edge segments. Supports all blockMesh edge + types, e.g. line, arc, spline. The surface points are rotated to + follow the path. + + \table + Property | Description | Required | Default + vertices | List of vertices | yes | + edges | List of blockEdge segments | yes | + toleranceCheck | Relative tolerance for polyline checks | no | SMALL + \endtable + +\*---------------------------------------------------------------------------*/ + +#ifndef polyline_H +#define polyline_H + +#include "extrudeModel.H" +#include "blockEdgeList.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace extrudeModels +{ + +/*---------------------------------------------------------------------------*\ + Class polyline Declaration +\*---------------------------------------------------------------------------*/ + +class polyline +: + public extrudeModel +{ + // Private data + + //- Dummy object needed to use blockEdge + searchableSurfaces geometry_; + + //- List of points + pointField vertices_; + + //- List of line segments + blockEdgeList segments_; + + //- Relative length along all segments for interplation (0 <= x <= 1) + scalarField x_; + + //- Relative position on segments for interpolation + //- (0 <= y <= segments_.size()) + scalarField y_; + + //- Position vector at start of polyline + vector p0_; + + //- Direction vector at start of polyline + vector n0_; + + //- Relative tolerance for checking alignment of polyline and surface + scalar relTol_; + + //- Small delta for numerical differencing + const scalar DELTA = 1e-6; + +public: + + //- Runtime type information + TypeName("polyline"); + + // Constructors + + //- Construct from dictionary + polyline(const dictionary& dict); + + + //- Destructor + virtual ~polyline(); + + + // Member Operators + + point operator() + ( + const point& surfacePoint, + const vector& surfaceNormal, + const label layer + ) const; + + //- The point and direction vector corresponding to the polyline + //- parameter [0-1] + void positionAndDirection + ( + const scalar lambda, + vector& p, + vector& n + ) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace extrudeModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/tutorials/mesh/extrudeMesh/polyline/Allclean b/tutorials/mesh/extrudeMesh/polyline/Allclean new file mode 100755 index 0000000000000000000000000000000000000000..fb1f3847301c377e02e12439ba58cbf303af3ef9 --- /dev/null +++ b/tutorials/mesh/extrudeMesh/polyline/Allclean @@ -0,0 +1,8 @@ +#!/bin/sh +cd "${0%/*}" || exit # Run from this directory +. ${WM_PROJECT_DIR:?}/bin/tools/CleanFunctions # Tutorial clean functions +#------------------------------------------------------------------------------ + +cleanCase0 + +#------------------------------------------------------------------------------ diff --git a/tutorials/mesh/extrudeMesh/polyline/Allrun b/tutorials/mesh/extrudeMesh/polyline/Allrun new file mode 100755 index 0000000000000000000000000000000000000000..9752bb957c41ce86473cd00e3ee1c63e511e70ee --- /dev/null +++ b/tutorials/mesh/extrudeMesh/polyline/Allrun @@ -0,0 +1,10 @@ +#!/bin/sh +cd "${0%/*}" || exit # Run from this directory +. ${WM_PROJECT_DIR:?}/bin/tools/RunFunctions # Tutorial run functions +#------------------------------------------------------------------------------ + +runApplication extrudeMesh +mkdir 0 +runApplication checkMesh -writeAllFields + +#------------------------------------------------------------------------------ diff --git a/tutorials/mesh/extrudeMesh/polyline/constant/triSurface/channel.vtk b/tutorials/mesh/extrudeMesh/polyline/constant/triSurface/channel.vtk new file mode 100644 index 0000000000000000000000000000000000000000..1bfd51d32692f1ab1a1ab3afb6eeabfd2a4a0025 --- /dev/null +++ b/tutorials/mesh/extrudeMesh/polyline/constant/triSurface/channel.vtk @@ -0,0 +1,76 @@ +# vtk DataFile Version 2.0 +triSurface +ASCII +DATASET POLYDATA +POINTS 150 float + -0.00118462 0.00145556 0.05 0.00362917 -0.00794343 0.05 0.00906034 0.00261524 0.05 -0.000733732 0.00987627 0.05 -0.00640955 -0.0075571 0.05 -0.010337 0.00220302 0.05 -0.0103681 0.012258 0.05 0.0101661 0.0125848 0.05 0.0152507 -0.0094649 0.05 -0.000146367 0.0183159 0.05 +0.0190301 -0.00123334 0.05 5.77316e-16 -0.0192282 0.05 0.00893781 -0.0172851 0.05 -0.0192619 -0.00364522 0.05 -0.0158594 -0.012329 0.05 -0.00875674 -0.0180861 0.05 -0.0200044 0.00666196 0.05 0.0200294 0.00713721 0.05 -0.0107011 0.0223748 0.05 0.010384 0.0225978 0.05 +-0.0205437 0.0166667 0.05 0.0205411 0.0169122 0.05 -0.000402551 0.0281378 0.05 0.0279622 -0.00741418 0.05 0.0171381 -0.0237049 0.05 0.00651776 -0.02856 0.05 0.0244607 -0.0164807 0.05 -0.0269584 -0.0120452 0.05 -0.00589008 -0.028961 0.05 -0.0296495 0.000266096 0.05 +-0.0185784 -0.0233062 0.05 0.0298837 0.00136826 0.05 -0.0303624 0.0111111 0.05 0.0303728 0.0112074 0.05 -0.0205437 0.0277778 0.05 0.0205437 0.0277778 0.05 0.010398 0.0333888 0.05 -0.0107249 0.0333333 0.05 -0.0303624 0.0222222 0.05 0.0303624 0.0222222 0.05 +-0.00062261 0.0389992 0.05 -0.0131668 -0.0376289 0.05 -0.0376289 -0.0131668 0.05 0.0131668 -0.0376289 0.05 0.0376289 -0.0131668 0.05 -0.0337554 -0.0212104 0.05 -0.0212104 -0.0337554 0.05 0.0212104 -0.0337554 0.05 -0.0281898 -0.0281898 0.05 0.0281898 -0.0281898 0.05 +-0.0396159 -0.00446292 0.05 -0.00446292 -0.0396159 0.05 0.00446292 -0.0396159 0.05 0.0396159 -0.00446292 0.05 0.0339259 -0.021305 0.05 -0.0401812 0.00555556 0.05 0.0401812 0.00555556 0.05 -0.0401812 0.0166667 0.05 0.0401812 0.0166667 0.05 0.0205437 0.0388889 0.05 +-0.0205437 0.0388889 0.05 -0.0303624 0.0333333 0.05 0.0303624 0.0333333 0.05 -0.0106454 0.0449279 0.05 0.00998637 0.0452813 0.05 -0.0401812 0.0277778 0.05 0.0401812 0.0277778 0.05 -0.05 0 0.05 0.05 0 0.05 6.56949e-16 -0.05 0.05 +-0.0450484 -0.0216942 0.05 -0.0216942 -0.0450484 0.05 0.0450484 -0.0216942 0.05 0.0216942 -0.0450484 0.05 -0.0390916 -0.0311745 0.05 -0.0311745 -0.0390916 0.05 0.0390916 -0.0311745 0.05 0.0311745 -0.0390916 0.05 -0.0487464 -0.011126 0.05 -0.011126 -0.0487464 0.05 +0.011126 -0.0487464 0.05 0.0487464 -0.011126 0.05 -0.00064175 0.0505428 0.05 -0.05 0.0111111 0.05 0.05 0.0111111 0.05 -0.0303624 0.0444444 0.05 0.0303624 0.0444444 0.05 -0.0202711 0.0502331 0.05 0.0199458 0.0504426 0.05 -0.05 0.0222222 0.05 +0.05 0.0222222 0.05 -0.0401812 0.0388889 0.05 0.0401812 0.0388889 0.05 -0.0106296 0.0575545 0.05 0.00923272 0.0590338 0.05 -0.05 0.0333333 0.05 0.05 0.0333333 0.05 -0.00174385 0.0607159 0.05 -0.0303624 0.0555556 0.05 0.0303624 0.0555556 0.05 +-0.0401812 0.05 0.05 0.0401812 0.05 0.05 0.0203616 0.0612505 0.05 -0.0203915 0.0612551 0.05 -0.05 0.0444444 0.05 0.05 0.0444444 0.05 0.000547585 0.0701127 0.05 -0.0106694 0.0696509 0.05 0.0110806 0.0703326 0.05 -0.0401812 0.0611111 0.05 +0.0401812 0.0611111 0.05 -0.0303019 0.0669473 0.05 0.0303018 0.0669474 0.05 -0.0208313 0.0717012 0.05 0.021081 0.0716942 0.05 -0.05 0.0555556 0.05 0.05 0.0555556 0.05 -0.00555556 0.0803624 0.05 0.00555556 0.0803624 0.05 0.0166148 0.0804898 0.05 +-0.0166333 0.0804897 0.05 0.0397529 0.0724965 0.05 -0.0397532 0.0724964 0.05 -0.05 0.0666667 0.05 0.05 0.0666667 0.05 -0.0287799 0.0796819 0.05 0.0287814 0.0796885 0.05 0 0.0901812 0.05 0.0111111 0.0901812 0.05 -0.0111111 0.0901812 0.05 +0.0402393 0.0830685 0.05 -0.0402396 0.0830686 0.05 -0.05 0.0777778 0.05 0.05 0.0777778 0.05 0.0222222 0.0901812 0.05 -0.0222222 0.0901812 0.05 0.0344393 0.0903502 0.05 -0.0344394 0.0903503 0.05 0.00555556 0.1 0.05 -0.00555556 0.1 0.05 +0.0166667 0.1 0.05 -0.0166667 0.1 0.05 -0.05 0.0888889 0.05 0.05 0.0888889 0.05 0.0277778 0.1 0.05 -0.0277778 0.1 0.05 -0.0388889 0.1 0.05 0.0388889 0.1 0.05 -0.05 0.1 0.05 0.05 0.1 0.05 +POLYGONS 257 1028 + 3 104 100 115 3 91 100 104 3 65 91 95 3 55 83 67 3 57 89 83 3 50 67 78 3 45 70 74 3 46 48 75 3 51 41 79 3 41 71 79 +3 42 78 70 3 109 123 115 3 122 132 123 3 43 52 80 3 131 142 132 3 76 72 54 3 47 73 77 3 146 148 142 3 44 54 72 3 53 44 81 +3 56 53 68 3 66 58 90 3 92 66 96 3 101 92 105 3 133 121 124 3 130 121 133 3 149 147 143 3 110 116 124 3 143 136 130 3 134 136 144 +3 128 134 140 3 128 119 134 3 129 117 127 3 131 122 125 3 146 137 145 3 58 84 90 3 91 104 95 3 65 95 89 3 48 74 75 3 49 77 76 +3 52 69 80 3 55 57 83 3 57 65 89 3 50 55 67 3 42 50 78 3 48 45 74 3 27 42 45 3 46 75 71 3 29 55 50 3 30 45 48 +3 51 79 69 3 30 41 28 3 52 51 69 3 28 41 51 3 41 46 71 3 42 27 50 3 42 70 45 3 43 25 52 3 109 115 100 3 127 138 139 +3 122 123 109 3 137 146 142 3 129 139 141 3 43 80 73 3 131 132 122 3 135 141 145 3 24 43 47 3 32 57 55 3 44 26 54 3 47 43 73 +3 49 76 54 3 49 24 47 3 49 47 77 3 44 72 81 3 38 65 57 3 53 23 44 3 53 81 68 3 61 91 65 3 56 68 84 3 56 31 53 +3 85 100 91 3 58 56 84 3 66 90 96 3 92 96 105 3 98 109 100 3 92 62 66 3 101 105 116 3 126 114 112 3 110 101 116 3 136 147 144 +3 130 133 143 3 130 126 121 3 110 124 121 3 102 99 112 3 143 147 136 3 126 130 136 3 134 144 140 3 128 140 138 3 127 128 138 3 111 122 109 +3 129 127 139 3 125 137 131 3 135 129 141 3 135 120 129 3 137 135 145 3 137 142 131 3 125 135 137 3 113 125 111 3 120 135 125 3 86 92 101 +3 118 128 127 3 117 129 120 3 103 113 111 3 118 127 117 3 88 86 99 3 119 128 118 3 126 136 134 3 99 101 110 3 112 110 121 3 126 134 119 +3 112 121 126 3 99 110 112 3 108 119 118 3 39 58 66 3 86 101 99 3 106 118 117 3 33 56 58 3 62 92 86 3 34 61 38 3 39 66 62 +3 20 38 32 3 30 48 46 3 52 28 51 3 49 26 24 3 33 58 39 3 31 56 33 3 23 53 31 3 44 23 26 3 10 23 31 3 111 125 122 +3 25 43 24 3 8 26 23 3 52 25 28 3 12 25 24 3 30 46 41 3 17 31 33 3 30 15 14 3 27 45 30 3 27 14 13 3 29 50 27 +3 29 32 55 3 29 13 16 3 16 20 32 3 35 39 62 3 38 57 32 3 85 98 100 3 59 62 86 3 61 65 38 3 85 91 61 3 85 60 87 +3 98 111 109 3 107 117 120 3 98 85 87 3 103 111 98 3 21 33 39 3 60 85 61 3 34 60 61 3 20 34 38 3 11 28 25 3 16 32 29 +3 13 29 27 3 14 27 30 3 5 16 13 3 15 30 28 3 4 13 14 3 11 15 28 3 4 14 15 3 103 98 87 3 113 120 125 3 107 106 117 +3 12 11 25 3 12 1 11 3 24 8 12 3 4 11 1 3 18 34 20 3 17 10 31 3 21 7 17 3 21 17 33 3 37 60 34 3 35 21 39 +3 63 87 60 3 59 36 35 3 59 35 62 3 93 103 87 3 88 59 86 3 102 112 114 3 102 88 99 3 102 94 88 3 114 126 119 3 114 108 102 +3 108 114 119 3 107 113 103 3 106 108 118 3 94 102 108 3 97 94 106 3 107 120 113 3 49 54 26 3 24 26 8 3 64 59 88 3 94 108 106 +3 93 107 103 3 82 64 94 3 107 97 106 3 64 88 94 3 40 63 37 3 36 59 64 3 36 64 40 3 19 21 35 3 19 35 36 3 22 37 18 +3 2 10 17 3 6 20 16 3 7 21 19 3 2 8 10 3 2 17 7 3 3 5 0 3 8 1 12 3 8 23 10 3 1 8 2 3 4 0 5 +3 0 1 2 3 4 15 11 3 5 13 4 3 6 16 5 3 3 2 7 3 9 22 18 3 18 20 6 3 37 34 18 3 22 19 36 3 63 93 87 +3 63 60 37 3 82 97 93 3 0 4 1 3 3 9 6 3 82 40 64 3 82 93 63 3 40 82 63 3 22 36 40 3 22 40 37 3 9 7 19 +3 9 18 6 3 9 3 7 3 9 19 22 3 3 0 2 3 3 6 5 3 107 93 97 3 97 82 94 +CELL_DATA 257 +FIELD attributes 1 +region 1 257 float + 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 diff --git a/tutorials/mesh/extrudeMesh/polyline/system/controlDict b/tutorials/mesh/extrudeMesh/polyline/system/controlDict new file mode 100644 index 0000000000000000000000000000000000000000..23a07249b6ac1375ee61af98602ae8a9bbd6a0dd --- /dev/null +++ b/tutorials/mesh/extrudeMesh/polyline/system/controlDict @@ -0,0 +1,47 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | foam-extend: Open Source CFD | +| \\ / O peration | Version: 3.1 | +| \\ / A nd | Web: http://www.extend-project.de | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object controlDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +application simpleFoam; + +startFrom latestTime; + +startTime 0; + +stopAt endTime; + +endTime 5; + +deltaT 0.0001; + +writeControl runTime; + +writeInterval 0.1; + +purgeWrite 0; + +writeFormat binary; + +writePrecision 8; + +writeCompression uncompressed; + +timeFormat general; + +timePrecision 6; + +runTimeModifiable yes; + +// ************************************************************************* // diff --git a/tutorials/mesh/extrudeMesh/polyline/system/extrudeMeshDict b/tutorials/mesh/extrudeMesh/polyline/system/extrudeMeshDict new file mode 100644 index 0000000000000000000000000000000000000000..fc86fee41df3d05fe3820de9a292e986959c9f9f --- /dev/null +++ b/tutorials/mesh/extrudeMesh/polyline/system/extrudeMeshDict @@ -0,0 +1,65 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 2.2.2 | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object extrudeMeshDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +constructFrom surface; + +surface "<constant>/triSurface/channel.vtk"; + +flipNormals false; + +extrudeModel polyline; + +nLayers 200; + +expansionRatio 1.0; + +polylineCoeffs +{ + vertices 10 + ( + ( 0 0 0.05 ) //0 + ( 0 0 0.75 ) + ( 0 -0.3 1.05 ) //2 + ( 0 -0.7 1.05 ) + ( 0 -1 1.35 ) //4 + ( 0 -1 1.75 ) + ( 0.3 -1 2.05 ) //6 + ( 0.826794919 -1 2.05 ) + ( 1.08660254 -1 1.9 ) //8 + ( 1.5 -1 1.183974596 ) + ); + + edges 9 + ( + line 0 1 + arc 1 2 ( 0 -0.087867966 0.962132034 ) + line 2 3 + arc 3 4 ( 0 -0.912132034 1.137867966 ) + line 4 5 + arc 5 6 ( 0.087867966 -1 1.962132034 ) + line 6 7 + arc 7 8 ( 0.976794919 -1 2.009807621 ) + line 8 9 + ); + + toleranceCheck 1e-6; +} + +mergeFaces false; + +mergeTol 0; + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/tutorials/mesh/extrudeMesh/polyline/system/fvSchemes b/tutorials/mesh/extrudeMesh/polyline/system/fvSchemes new file mode 100644 index 0000000000000000000000000000000000000000..0d45a8c47d2833327180c4fe51590a54f2f23be7 --- /dev/null +++ b/tutorials/mesh/extrudeMesh/polyline/system/fvSchemes @@ -0,0 +1,63 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | foam-extend: Open Source CFD | +| \\ / O peration | Version: 3.1 | +| \\ / A nd | Web: http://www.extend-project.de | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object fvSchemes; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +ddtSchemes +{ + default Euler; +} + +gradSchemes +{ + // default Gauss linear; + default cellMDLimited leastSquares 1.0; +} + +divSchemes +{ + default none; + div(phi,U) bounded Gauss upwind; + div(phi,k) bounded Gauss upwind; + div(phi,omega) bounded Gauss upwind; + div(phi,epsilon) bounded Gauss upwind; + div((nuEff*dev(grad(U).T()))) Gauss linear; + div((nuEff*dev(T(grad(U))))) Gauss linear; + div(U) Gauss linear; +} + +laplacianSchemes +{ + // default Gauss linear corrected; + default Gauss linear limited 0.5 corrected; +} + +interpolationSchemes +{ + default linear; + interpolate(U) linear; +} + +snGradSchemes +{ + default limited 0.5 corrected; +} + +fluxRequired +{ + default no; + p; +} + +// ************************************************************************* // diff --git a/tutorials/mesh/extrudeMesh/polyline/system/fvSolution b/tutorials/mesh/extrudeMesh/polyline/system/fvSolution new file mode 100644 index 0000000000000000000000000000000000000000..75aa523581cd5053b6bb20935783efa132999154 --- /dev/null +++ b/tutorials/mesh/extrudeMesh/polyline/system/fvSolution @@ -0,0 +1,109 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | foam-extend: Open Source CFD | +| \\ / O peration | Version: 3.1 | +| \\ / A nd | Web: http://www.extend-project.de | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object fvSolution; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +solvers +{ + "p|pFinal" + { + solver GAMG; + tolerance 1e-7; + relTol 1e-3; + smoother GaussSeidel; + nPreSweeps 0; + nPostSweeps 2; + cacheAgglomeration on; + agglomerator faceAreaPair; + nCellsInCoarsestLevel 10; + mergeLevels 1; + }; + + U + { + solver smoothSolver; + smoother GaussSeidel; + tolerance 1e-8; + relTol 1e-3; + nSweeps 1; + }; + + k + { + solver smoothSolver; + smoother GaussSeidel; + tolerance 1e-8; + relTol 1e-3; + nSweeps 1; + }; + + epsilon + { + solver smoothSolver; + smoother GaussSeidel; + tolerance 1e-8; + relTol 1e-3; + nSweeps 1; + }; + + omega + { + solver smoothSolver; + smoother GaussSeidel; + tolerance 1e-8; + relTol 1e-3; + nSweeps 1; + }; +} + +blockSolver +{ + nNonOrthogonalCorrectors 1; + nCorrectors 2; +} + +SIMPLE +{ + nNonOrthogonalCorrectors 0; +} + +PISO +{ + nCorrectors 3; +} + +PIMPLE +{ + nOuterCorrectors 2; + nCorrectors 2; + nNonOrthogonalCorrectors 0; + pRefCell 0; + pRefValue 0; +} + +potentialFlow +{ + nNonOrthogonalCorrectors 1; +} + +relaxationFactors +{ + p 0.3; + U 0.7; + k 0.7; + omega 0.7; + epsilon 0.7; +} + +// ************************************************************************* //