From fb1783ab293a59db392fef9ba32199b8714409ed Mon Sep 17 00:00:00 2001 From: mattijs Date: Mon, 14 Nov 2011 15:10:11 +0000 Subject: [PATCH 1/6] ENH: pipeCyclic: pipe using AMI --- .../simpleFoam/pipeCyclic/0.org/U | 58 +++++++++ .../simpleFoam/pipeCyclic/0.org/epsilon | 50 ++++++++ .../simpleFoam/pipeCyclic/0.org/k | 50 ++++++++ .../simpleFoam/pipeCyclic/0.org/nuTilda | 44 +++++++ .../simpleFoam/pipeCyclic/0.org/nut | 49 ++++++++ .../simpleFoam/pipeCyclic/0.org/p | 45 +++++++ .../simpleFoam/pipeCyclic/Allclean | 11 ++ .../simpleFoam/pipeCyclic/Allrun | 19 +++ .../pipeCyclic/constant/RASProperties | 25 ++++ .../constant/polyMesh/blockMeshDict | 118 ++++++++++++++++++ .../pipeCyclic/constant/polyMesh/boundary | 62 +++++++++ .../pipeCyclic/constant/transportProperties | 23 ++++ .../pipeCyclic/constant/turbulenceProperties | 20 +++ .../simpleFoam/pipeCyclic/system/controlDict | 49 ++++++++ .../pipeCyclic/system/decomposeParDict | 22 ++++ .../simpleFoam/pipeCyclic/system/fvSchemes | 71 +++++++++++ .../simpleFoam/pipeCyclic/system/fvSolution | 104 +++++++++++++++ .../simpleFoam/pipeCyclic/system/topoSetDict | 76 +++++++++++ 18 files changed, 896 insertions(+) create mode 100644 tutorials/incompressible/simpleFoam/pipeCyclic/0.org/U create mode 100644 tutorials/incompressible/simpleFoam/pipeCyclic/0.org/epsilon create mode 100644 tutorials/incompressible/simpleFoam/pipeCyclic/0.org/k create mode 100644 tutorials/incompressible/simpleFoam/pipeCyclic/0.org/nuTilda create mode 100644 tutorials/incompressible/simpleFoam/pipeCyclic/0.org/nut create mode 100644 tutorials/incompressible/simpleFoam/pipeCyclic/0.org/p create mode 100755 tutorials/incompressible/simpleFoam/pipeCyclic/Allclean create mode 100755 tutorials/incompressible/simpleFoam/pipeCyclic/Allrun create mode 100644 tutorials/incompressible/simpleFoam/pipeCyclic/constant/RASProperties create mode 100644 tutorials/incompressible/simpleFoam/pipeCyclic/constant/polyMesh/blockMeshDict create mode 100644 tutorials/incompressible/simpleFoam/pipeCyclic/constant/polyMesh/boundary create mode 100644 tutorials/incompressible/simpleFoam/pipeCyclic/constant/transportProperties create mode 100644 tutorials/incompressible/simpleFoam/pipeCyclic/constant/turbulenceProperties create mode 100644 tutorials/incompressible/simpleFoam/pipeCyclic/system/controlDict create mode 100644 tutorials/incompressible/simpleFoam/pipeCyclic/system/decomposeParDict create mode 100644 tutorials/incompressible/simpleFoam/pipeCyclic/system/fvSchemes create mode 100644 tutorials/incompressible/simpleFoam/pipeCyclic/system/fvSolution create mode 100644 tutorials/incompressible/simpleFoam/pipeCyclic/system/topoSetDict diff --git a/tutorials/incompressible/simpleFoam/pipeCyclic/0.org/U b/tutorials/incompressible/simpleFoam/pipeCyclic/0.org/U new file mode 100644 index 0000000000..8ad1348851 --- /dev/null +++ b/tutorials/incompressible/simpleFoam/pipeCyclic/0.org/U @@ -0,0 +1,58 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volVectorField; + object U; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 1 -1 0 0 0 0]; + +internalField uniform (1 0 0); + +boundaryField +{ + inlet + { + type codedFixedValue; + redirectType swirl; + + code + #{ + const vector axis(1, 0, 0); + + vectorField v = 2.0*this->patch().Cf() ^ axis; + v.replace(vector::X, 1.0); + operator==(v); + #}; + value $internalField; + } + + outlet + { + type inletOutlet; + inletValue $internalField; + value $internalField; + } + + walls + { + type fixedValue; + value uniform (0 0 0); + } + + "side.*" + { + type cyclicAMI; + } +} + +// ************************************************************************* // diff --git a/tutorials/incompressible/simpleFoam/pipeCyclic/0.org/epsilon b/tutorials/incompressible/simpleFoam/pipeCyclic/0.org/epsilon new file mode 100644 index 0000000000..9f571637a7 --- /dev/null +++ b/tutorials/incompressible/simpleFoam/pipeCyclic/0.org/epsilon @@ -0,0 +1,50 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + location "0"; + object epsilon; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [ 0 2 -3 0 0 0 0 ]; + +internalField uniform 1; + +boundaryField +{ + inlet + { + type turbulentMixingLengthDissipationRateInlet; + mixingLength 0.5; // 0.5m - half channel height + value $internalField; + } + + outlet + { + type inletOutlet; + inletValue $internalField; + } + + walls + { + type epsilonWallFunction; + value uniform 0; + } + + "side.*" + { + type cyclicAMI; + } +} + + +// ************************************************************************* // diff --git a/tutorials/incompressible/simpleFoam/pipeCyclic/0.org/k b/tutorials/incompressible/simpleFoam/pipeCyclic/0.org/k new file mode 100644 index 0000000000..7266279462 --- /dev/null +++ b/tutorials/incompressible/simpleFoam/pipeCyclic/0.org/k @@ -0,0 +1,50 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + location "0"; + object k; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [ 0 2 -2 0 0 0 0 ]; + +internalField uniform 1; + +boundaryField +{ + inlet + { + type turbulentIntensityKineticEnergyInlet; + intensity 0.05; // 5% turbulent intensity + value $internalField; + } + + outlet + { + type inletOutlet; + inletValue $internalField; + } + + walls + { + type kqRWallFunction; + value uniform 0; + } + + "side.*" + { + type cyclicAMI; + } +} + + +// ************************************************************************* // diff --git a/tutorials/incompressible/simpleFoam/pipeCyclic/0.org/nuTilda b/tutorials/incompressible/simpleFoam/pipeCyclic/0.org/nuTilda new file mode 100644 index 0000000000..f25d205095 --- /dev/null +++ b/tutorials/incompressible/simpleFoam/pipeCyclic/0.org/nuTilda @@ -0,0 +1,44 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + object nuTilda; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 2 -1 0 0 0 0]; + +internalField uniform 0; + +boundaryField +{ + inlet + { + type zeroGradient; + } + + outlet + { + type zeroGradient; + } + + walls + { + type zeroGradient; + } + + "side.*" + { + type cyclicAMI; + } +} + +// ************************************************************************* // diff --git a/tutorials/incompressible/simpleFoam/pipeCyclic/0.org/nut b/tutorials/incompressible/simpleFoam/pipeCyclic/0.org/nut new file mode 100644 index 0000000000..62cb2f0e62 --- /dev/null +++ b/tutorials/incompressible/simpleFoam/pipeCyclic/0.org/nut @@ -0,0 +1,49 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + location "0"; + object nut; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [ 0 2 -1 0 0 0 0 ]; + +internalField uniform 0; + +boundaryField +{ + inlet + { + type calculated; + value $internalField; + } + + outlet + { + type calculated; + value $internalField; + } + + walls + { + type nutkWallFunction; + value $internalField; + } + + "side.*" + { + type cyclicAMI; + } +} + + +// ************************************************************************* // diff --git a/tutorials/incompressible/simpleFoam/pipeCyclic/0.org/p b/tutorials/incompressible/simpleFoam/pipeCyclic/0.org/p new file mode 100644 index 0000000000..ede4c306b8 --- /dev/null +++ b/tutorials/incompressible/simpleFoam/pipeCyclic/0.org/p @@ -0,0 +1,45 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + object p; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 2 -2 0 0 0 0]; + +internalField uniform 0; + +boundaryField +{ + inlet + { + type zeroGradient; + } + + outlet + { + type fixedValue; + value uniform 0; + } + + walls + { + type zeroGradient; + } + + "side.*" + { + type cyclicAMI; + } +} + +// ************************************************************************* // diff --git a/tutorials/incompressible/simpleFoam/pipeCyclic/Allclean b/tutorials/incompressible/simpleFoam/pipeCyclic/Allclean new file mode 100755 index 0000000000..d16400a94f --- /dev/null +++ b/tutorials/incompressible/simpleFoam/pipeCyclic/Allclean @@ -0,0 +1,11 @@ +#!/bin/sh +cd ${0%/*} || exit 1 # run from this directory + +# Source tutorial clean functions +. $WM_PROJECT_DIR/bin/tools/CleanFunctions + +rm -rf 0 > /dev/null 2>&1 + +cleanCase + +# ----------------------------------------------------------------- end-of-file diff --git a/tutorials/incompressible/simpleFoam/pipeCyclic/Allrun b/tutorials/incompressible/simpleFoam/pipeCyclic/Allrun new file mode 100755 index 0000000000..6ab4c317b6 --- /dev/null +++ b/tutorials/incompressible/simpleFoam/pipeCyclic/Allrun @@ -0,0 +1,19 @@ +#!/bin/sh +cd ${0%/*} || exit 1 # run from this directory + +# Source tutorial run functions +. $WM_PROJECT_DIR/bin/tools/RunFunctions + +# Get application directory +application=`getApplication` + +runApplication blockMesh +runApplication topoSet +runApplication refineHexMesh c0 -overwrite +cp -r 0.org 0 + +#runApplication $application +runApplication decomposePar -cellDist +runParallel $application 5 + +# ----------------------------------------------------------------- end-of-file diff --git a/tutorials/incompressible/simpleFoam/pipeCyclic/constant/RASProperties b/tutorials/incompressible/simpleFoam/pipeCyclic/constant/RASProperties new file mode 100644 index 0000000000..63ed5a5ef8 --- /dev/null +++ b/tutorials/incompressible/simpleFoam/pipeCyclic/constant/RASProperties @@ -0,0 +1,25 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "constant"; + object RASProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +RASModel realizableKE; + +turbulence on; + +printCoeffs on; + + +// ************************************************************************* // diff --git a/tutorials/incompressible/simpleFoam/pipeCyclic/constant/polyMesh/blockMeshDict b/tutorials/incompressible/simpleFoam/pipeCyclic/constant/polyMesh/blockMeshDict new file mode 100644 index 0000000000..e8fa4bbb33 --- /dev/null +++ b/tutorials/incompressible/simpleFoam/pipeCyclic/constant/polyMesh/blockMeshDict @@ -0,0 +1,118 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object blockMeshDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +convertToMeters 1; + +//- half angle of wedge in degrees +halfAngle 45.0; + +//- Radius of pipe [m] +radius 0.5; + + +radHalfAngle #calc "degToRad($halfAngle)"; +y #calc "$radius*sin($radHalfAngle)"; +minY #calc "-1.0*$y"; +z #calc "$radius*cos($radHalfAngle)"; +minZ #calc "-1.0*$z"; + +vertices +( + (0.0 0.0 0) //0 + (10 0.0 0) + (10 0.0 0) //2 + (0.0 0.0 0) + + (0.0 $minY $z) //4 + (10 $minY $z) + (10 $y $z) //6 + (0.0 $y $z) + +); + +blocks +( + // inlet block + hex (0 1 2 3 4 5 6 7) (50 5 5) simpleGrading (1 1 1) +); + +edges +( + arc 4 7 (0 0 $radius) + arc 5 6 (10 0 $radius) +); + +boundary +( + inlet + { + type patch; + faces + ( + (0 4 7 3) + ); + } + + outlet + { + type patch; + faces + ( + (1 2 6 5) + ); + } + + side1 + { + type cyclicAMI; + neighbourPatch side2; + faces + ( + (0 1 5 4) + ); + + transform rotational; + rotationAxis (1 0 0); + rotationCentre (0 0 0); + } + + side2 + { + type cyclicAMI; + neighbourPatch side1; + faces + ( + (7 6 2 3) + ); + + transform rotational; + rotationAxis (1 0 0); + rotationCentre (0 0 0); + } + + walls + { + type wall; + faces + ( + (4 5 6 7) + (3 2 1 0) + ); + } +); + + +// ************************************************************************* // diff --git a/tutorials/incompressible/simpleFoam/pipeCyclic/constant/polyMesh/boundary b/tutorials/incompressible/simpleFoam/pipeCyclic/constant/polyMesh/boundary new file mode 100644 index 0000000000..9b8e73ecfd --- /dev/null +++ b/tutorials/incompressible/simpleFoam/pipeCyclic/constant/polyMesh/boundary @@ -0,0 +1,62 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class polyBoundaryMesh; + location "constant/polyMesh"; + object boundary; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +5 +( + inlet + { + type patch; + nFaces 28; + startFace 4422; + } + outlet + { + type patch; + nFaces 28; + startFace 4450; + } + side1 + { + type cyclicAMI; + nFaces 400; + startFace 4478; + matchTolerance 0.0001; + neighbourPatch side2; + transform rotational; + rotationAxis (1 0 0); + rotationCentre (0 0 0); + } + side2 + { + type cyclicAMI; + nFaces 250; + startFace 4878; + matchTolerance 0.0001; + neighbourPatch side1; + transform rotational; + rotationAxis (1 0 0); + rotationCentre (0 0 0); + } + walls + { + type wall; + nFaces 250; + startFace 5128; + } +) + +// ************************************************************************* // diff --git a/tutorials/incompressible/simpleFoam/pipeCyclic/constant/transportProperties b/tutorials/incompressible/simpleFoam/pipeCyclic/constant/transportProperties new file mode 100644 index 0000000000..ab12b49567 --- /dev/null +++ b/tutorials/incompressible/simpleFoam/pipeCyclic/constant/transportProperties @@ -0,0 +1,23 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "constant"; + object transportProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +transportModel Newtonian; + +nu nu [ 0 2 -1 0 0 0 0 ] 1e-06; + + +// ************************************************************************* // diff --git a/tutorials/incompressible/simpleFoam/pipeCyclic/constant/turbulenceProperties b/tutorials/incompressible/simpleFoam/pipeCyclic/constant/turbulenceProperties new file mode 100644 index 0000000000..e7fa28c74a --- /dev/null +++ b/tutorials/incompressible/simpleFoam/pipeCyclic/constant/turbulenceProperties @@ -0,0 +1,20 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "constant"; + object turbulenceProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +simulationType RASModel; + +// ************************************************************************* // diff --git a/tutorials/incompressible/simpleFoam/pipeCyclic/system/controlDict b/tutorials/incompressible/simpleFoam/pipeCyclic/system/controlDict new file mode 100644 index 0000000000..e43cefc79a --- /dev/null +++ b/tutorials/incompressible/simpleFoam/pipeCyclic/system/controlDict @@ -0,0 +1,49 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object controlDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +application simpleFoam; + +startFrom startTime; + +startTime 0; + +stopAt endTime; + +endTime 1000; + +deltaT 1; + +writeControl timeStep; + +writeInterval 100; + +purgeWrite 0; + +writeFormat ascii; + +writePrecision 6; + +writeCompression uncompressed; + +timeFormat general; + +timePrecision 6; + +runTimeModifiable true; + + +// ************************************************************************* // diff --git a/tutorials/incompressible/simpleFoam/pipeCyclic/system/decomposeParDict b/tutorials/incompressible/simpleFoam/pipeCyclic/system/decomposeParDict new file mode 100644 index 0000000000..b76e7ccd24 --- /dev/null +++ b/tutorials/incompressible/simpleFoam/pipeCyclic/system/decomposeParDict @@ -0,0 +1,22 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object decomposeParDict; +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +numberOfSubdomains 5; + +method scotch; + +// ************************************************************************* // diff --git a/tutorials/incompressible/simpleFoam/pipeCyclic/system/fvSchemes b/tutorials/incompressible/simpleFoam/pipeCyclic/system/fvSchemes new file mode 100644 index 0000000000..c1af3f9649 --- /dev/null +++ b/tutorials/incompressible/simpleFoam/pipeCyclic/system/fvSchemes @@ -0,0 +1,71 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object fvSchemes; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +ddtSchemes +{ + default steadyState; +} + +gradSchemes +{ + default Gauss linear; + grad(p) Gauss linear; + grad(U) Gauss linear; +} + +divSchemes +{ + default none; + div(phi,U) Gauss limitedLinearV 1; + div(phi,k) Gauss limitedLinear 1; + div(phi,epsilon) Gauss limitedLinear 1; + div(phi,R) Gauss limitedLinear 1; + div(R) Gauss linear; + div(phi,nuTilda) Gauss limitedLinear 1; + div((nuEff*dev(T(grad(U))))) Gauss linear; +} + +laplacianSchemes +{ + default none; + laplacian(nuEff,U) Gauss linear corrected; + laplacian((1|A(U)),p) Gauss linear corrected; + laplacian(DkEff,k) Gauss linear corrected; + laplacian(DepsilonEff,epsilon) Gauss linear corrected; + laplacian(DREff,R) Gauss linear corrected; + laplacian(DnuTildaEff,nuTilda) Gauss linear corrected; +} + +interpolationSchemes +{ + default linear; + interpolate(U) linear; +} + +snGradSchemes +{ + default corrected; +} + +fluxRequired +{ + default no; + p ; +} + + +// ************************************************************************* // diff --git a/tutorials/incompressible/simpleFoam/pipeCyclic/system/fvSolution b/tutorials/incompressible/simpleFoam/pipeCyclic/system/fvSolution new file mode 100644 index 0000000000..5d305469b4 --- /dev/null +++ b/tutorials/incompressible/simpleFoam/pipeCyclic/system/fvSolution @@ -0,0 +1,104 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object fvSolution; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +solvers +{ + p + { + solver GAMG; + smoother GaussSeidel; + cacheAgglomeration true; + nCellsInCoarsestLevel 10; + agglomerator faceAreaPair; + mergeLevels 1; + + tolerance 1e-06; + relTol 0.05; + } + + pFinal + { + solver GAMG; + smoother GaussSeidel; + cacheAgglomeration true; + nCellsInCoarsestLevel 10; + agglomerator faceAreaPair; + mergeLevels 1; + + tolerance 1e-06; + relTol 0; + } + + "(U|k|epsilon)" + { + solver smoothSolver; + smoother GaussSeidel; + tolerance 1e-05; + relTol 0.1; + } + + "(U|k|epsilon)Final" + { + solver PBiCG; + preconditioner DILU; + + tolerance 1e-05; + relTol 0; + } +} + +PIMPLE +{ + nOuterCorrectors 4; + nCorrectors 1; + nNonOrthogonalCorrectors 0; + pRefCell 0; + pRefValue 0; +} + +SIMPLE +{ + nNonOrthogonalCorrectors 0; + residualControl + { + p 1e-2; + U 1e-3; + "(k|epsilon)" 1e-3; + } +} + +relaxationFactors +{ + fields + { + p 0.3; + } + equations + { + U 0.7; + k 0.7; + "epsilon.*" 0.7; + } +} + +cache +{ + grad(U); +} + + +// ************************************************************************* // diff --git a/tutorials/incompressible/simpleFoam/pipeCyclic/system/topoSetDict b/tutorials/incompressible/simpleFoam/pipeCyclic/system/topoSetDict new file mode 100644 index 0000000000..bce9f89021 --- /dev/null +++ b/tutorials/incompressible/simpleFoam/pipeCyclic/system/topoSetDict @@ -0,0 +1,76 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object topoSetDict; +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +actions +( + { + name f0; + type faceSet; + action new; + source patchToFace; + sourceInfo + { + name "side1"; + } + } + { + name f0; + type faceSet; + action subset; + source boxToFace; + sourceInfo + { + box (0 -100 -100)(100 -0.2 100); + } + } + { + name c0; + type cellSet; + action new; + source faceToCell; + sourceInfo + { + set f0; + option any; + } + } + + + { + name walls; + type faceSet; + action new; + source patchToFace; + sourceInfo + { + name "walls"; + } + } + { + name c0; + type cellSet; + action delete; + source faceToCell; + sourceInfo + { + set walls; + option any; + } + } +); + +// ************************************************************************* // From 0143ef82ea208bc1a1417a323a3654df0cfe9147 Mon Sep 17 00:00:00 2001 From: mattijs Date: Mon, 14 Nov 2011 15:11:30 +0000 Subject: [PATCH 2/6] ENH: dynamicCode: include unitConversion by default --- etc/codeTemplates/dynamicCode/codeStreamTemplate.C | 1 + etc/codeTemplates/dynamicCode/fixedValueFvPatchFieldTemplate.C | 1 + etc/codeTemplates/dynamicCode/functionObjectTemplate.C | 1 + 3 files changed, 3 insertions(+) diff --git a/etc/codeTemplates/dynamicCode/codeStreamTemplate.C b/etc/codeTemplates/dynamicCode/codeStreamTemplate.C index 3288b7cefb..5d69d99632 100644 --- a/etc/codeTemplates/dynamicCode/codeStreamTemplate.C +++ b/etc/codeTemplates/dynamicCode/codeStreamTemplate.C @@ -29,6 +29,7 @@ Description #include "dictionary.H" #include "Ostream.H" #include "Pstream.H" +#include "unitConversion.H" //{{{ begin codeInclude ${codeInclude} diff --git a/etc/codeTemplates/dynamicCode/fixedValueFvPatchFieldTemplate.C b/etc/codeTemplates/dynamicCode/fixedValueFvPatchFieldTemplate.C index a8b6a6da67..c7f442f03a 100644 --- a/etc/codeTemplates/dynamicCode/fixedValueFvPatchFieldTemplate.C +++ b/etc/codeTemplates/dynamicCode/fixedValueFvPatchFieldTemplate.C @@ -28,6 +28,7 @@ License #include "fvPatchFieldMapper.H" #include "volFields.H" #include "surfaceFields.H" +#include "unitConversion.H" //{{{ begin codeInclude ${codeInclude} //}}} end codeInclude diff --git a/etc/codeTemplates/dynamicCode/functionObjectTemplate.C b/etc/codeTemplates/dynamicCode/functionObjectTemplate.C index 61cba180c3..a747b528b6 100644 --- a/etc/codeTemplates/dynamicCode/functionObjectTemplate.C +++ b/etc/codeTemplates/dynamicCode/functionObjectTemplate.C @@ -26,6 +26,7 @@ License #include "functionObjectTemplate.H" #include "Time.H" #include "fvCFD.H" +#include "unitConversion.H" //{{{ begin codeInclude ${codeInclude} From 35395ea438d00aed567578d379b850b3f85d426c Mon Sep 17 00:00:00 2001 From: mattijs Date: Mon, 14 Nov 2011 15:15:06 +0000 Subject: [PATCH 3/6] BUG: cyclicAMI: differentiate between coupled geometry and coupled fields --- .../derived/coupled/coupledFacePointPatch.H | 12 ---------- .../polyPatches/polyPatch/polyPatch.H | 3 ++- .../cyclicAMI/cyclicAMIFvPatchField.C | 23 ++++++++++++++++++- .../cyclicAMI/cyclicAMIFvPatchField.H | 6 ++++- .../processor/processorFvPatchField.H | 2 +- .../cyclicAMI/cyclicAMIFvsPatchField.C | 23 +++++++++++++++++++ .../cyclicAMI/cyclicAMIFvsPatchField.H | 8 +++++++ .../leastSquaresGrad/leastSquaresVectors.C | 6 ++--- .../cellToFace/extendedCellToFaceStencil.C | 2 +- .../faceToCell/extendedFaceToCellStencil.C | 2 +- .../schemes/clippedLinear/clippedLinear.H | 2 +- .../schemes/reverseLinear/reverseLinear.H | 2 +- .../FacePostProcessing/FacePostProcessing.C | 2 +- .../cyclicAMIPointPatch/cyclicAMIPointPatch.H | 11 +++++++++ .../cyclicAMIPolyPatch/cyclicAMIPolyPatch.C | 17 -------------- .../cyclicAMIPolyPatch/cyclicAMIPolyPatch.H | 10 ++++---- .../sampledSurface/isoSurface/isoSurface.C | 2 +- 17 files changed, 87 insertions(+), 46 deletions(-) diff --git a/src/OpenFOAM/meshes/pointMesh/pointPatches/derived/coupled/coupledFacePointPatch.H b/src/OpenFOAM/meshes/pointMesh/pointPatches/derived/coupled/coupledFacePointPatch.H index 368782d0a3..91db5fc873 100644 --- a/src/OpenFOAM/meshes/pointMesh/pointPatches/derived/coupled/coupledFacePointPatch.H +++ b/src/OpenFOAM/meshes/pointMesh/pointPatches/derived/coupled/coupledFacePointPatch.H @@ -96,18 +96,6 @@ public: //- Destructor virtual ~coupledFacePointPatch(); - - - // Member Functions - - // Access - - //- Return true because this patch is coupled - virtual bool coupled() const - { - return true; - } - }; diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/polyPatch/polyPatch.H b/src/OpenFOAM/meshes/polyMesh/polyPatches/polyPatch/polyPatch.H index ceb6220585..5601c1e993 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyPatches/polyPatch/polyPatch.H +++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/polyPatch/polyPatch.H @@ -285,7 +285,8 @@ public: //- Return boundaryMesh reference const polyBoundaryMesh& boundaryMesh() const; - //- Return true if this patch field is coupled + //- Return true if this patch is geometrically coupled (i.e. faces and + // points correspondence) virtual bool coupled() const { return false; diff --git a/src/finiteVolume/fields/fvPatchFields/constraint/cyclicAMI/cyclicAMIFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/constraint/cyclicAMI/cyclicAMIFvPatchField.C index 8e358063fa..31729346e2 100644 --- a/src/finiteVolume/fields/fvPatchFields/constraint/cyclicAMI/cyclicAMIFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/constraint/cyclicAMI/cyclicAMIFvPatchField.C @@ -106,7 +106,7 @@ Foam::cyclicAMIFvPatchField::cyclicAMIFvPatchField << exit(FatalIOError); } - if (cyclicAMIPatch_.coupled()) + if (this->coupled()) { this->evaluate(Pstream::blocking); } @@ -140,6 +140,27 @@ Foam::cyclicAMIFvPatchField::cyclicAMIFvPatchField // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // +template +bool Foam::cyclicAMIFvPatchField::coupled() const +{ + if + ( + Pstream::parRun() + || ( + this->cyclicAMIPatch_.size() + && this->cyclicAMIPatch_.cyclicAMIPatch().neighbPatch().size() + ) + ) + { + return true; + } + else + { + return false; + } +} + + template Foam::tmp > Foam::cyclicAMIFvPatchField::patchNeighbourField() const diff --git a/src/finiteVolume/fields/fvPatchFields/constraint/cyclicAMI/cyclicAMIFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/constraint/cyclicAMI/cyclicAMIFvPatchField.H index 9a4e5f6b4c..2e05111cb6 100644 --- a/src/finiteVolume/fields/fvPatchFields/constraint/cyclicAMI/cyclicAMIFvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/constraint/cyclicAMI/cyclicAMIFvPatchField.H @@ -147,8 +147,12 @@ public: // Evaluation functions + //- Return true if coupled. Note that the underlying patch + // is not coupled() - the points don't align. + virtual bool coupled() const; + //- Return neighbour coupled internal cell data - tmp > patchNeighbourField() const; + virtual tmp > patchNeighbourField() const; //- Return reference to neighbour patchField const cyclicAMIFvPatchField& neighbourPatchField() const; diff --git a/src/finiteVolume/fields/fvPatchFields/constraint/processor/processorFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/constraint/processor/processorFvPatchField.H index 7e3152e131..0130909d04 100644 --- a/src/finiteVolume/fields/fvPatchFields/constraint/processor/processorFvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/constraint/processor/processorFvPatchField.H @@ -154,7 +154,7 @@ public: } //- Return neighbour field given internal field - tmp > patchNeighbourField() const; + virtual tmp > patchNeighbourField() const; // Evaluation functions diff --git a/src/finiteVolume/fields/fvsPatchFields/constraint/cyclicAMI/cyclicAMIFvsPatchField.C b/src/finiteVolume/fields/fvsPatchFields/constraint/cyclicAMI/cyclicAMIFvsPatchField.C index a347bc4347..0ffe6b9c95 100644 --- a/src/finiteVolume/fields/fvsPatchFields/constraint/cyclicAMI/cyclicAMIFvsPatchField.C +++ b/src/finiteVolume/fields/fvsPatchFields/constraint/cyclicAMI/cyclicAMIFvsPatchField.C @@ -123,4 +123,27 @@ Foam::cyclicAMIFvsPatchField::cyclicAMIFvsPatchField {} +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +bool Foam::cyclicAMIFvsPatchField::coupled() const +{ + if + ( + Pstream::parRun() + || ( + this->cyclicAMIPatch_.size() + && this->cyclicAMIPatch_.cyclicAMIPatch().neighbPatch().size() + ) + ) + { + return true; + } + else + { + return false; + } +} + + // ************************************************************************* // diff --git a/src/finiteVolume/fields/fvsPatchFields/constraint/cyclicAMI/cyclicAMIFvsPatchField.H b/src/finiteVolume/fields/fvsPatchFields/constraint/cyclicAMI/cyclicAMIFvsPatchField.H index fe84983134..d55ff5cd5d 100644 --- a/src/finiteVolume/fields/fvsPatchFields/constraint/cyclicAMI/cyclicAMIFvsPatchField.H +++ b/src/finiteVolume/fields/fvsPatchFields/constraint/cyclicAMI/cyclicAMIFvsPatchField.H @@ -123,6 +123,14 @@ public: new cyclicAMIFvsPatchField(*this, iF) ); } + + // Member functions + + // Access + + //- Return true if running parallel + virtual bool coupled() const; + }; diff --git a/src/finiteVolume/finiteVolume/gradSchemes/leastSquaresGrad/leastSquaresVectors.C b/src/finiteVolume/finiteVolume/gradSchemes/leastSquaresGrad/leastSquaresVectors.C index 6002a07e1c..27f5b72fcf 100644 --- a/src/finiteVolume/finiteVolume/gradSchemes/leastSquaresGrad/leastSquaresVectors.C +++ b/src/finiteVolume/finiteVolume/gradSchemes/leastSquaresGrad/leastSquaresVectors.C @@ -132,7 +132,7 @@ void Foam::leastSquaresVectors::makeLeastSquaresVectors() const // Build the d-vectors vectorField pd = p.delta(); - if (p.coupled()) + if (pw.coupled()) { forAll(pd, patchFacei) { @@ -185,7 +185,7 @@ void Foam::leastSquaresVectors::makeLeastSquaresVectors() const // Build the d-vectors vectorField pd = p.delta(); - if (p.coupled()) + if (pw.coupled()) { forAll(pd, patchFacei) { @@ -256,7 +256,7 @@ void Foam::leastSquaresVectors::makeLeastSquaresVectors() const label patchFacei = facei - mesh.boundaryMesh()[patchi].start(); - if (mesh.boundary()[patchi].coupled()) + if (w.boundaryField()[patchi].coupled()) { scalar wf = max ( diff --git a/src/finiteVolume/fvMesh/extendedStencil/cellToFace/extendedCellToFaceStencil.C b/src/finiteVolume/fvMesh/extendedStencil/cellToFace/extendedCellToFaceStencil.C index 85c6f3f61f..021241fa27 100644 --- a/src/finiteVolume/fvMesh/extendedStencil/cellToFace/extendedCellToFaceStencil.C +++ b/src/finiteVolume/fvMesh/extendedStencil/cellToFace/extendedCellToFaceStencil.C @@ -103,7 +103,7 @@ Foam::extendedCellToFaceStencil::extendedCellToFaceStencil(const polyMesh& mesh) forAll(patches, patchI) { - if (isA(patches[patchI])) + if (patches[patchI].coupled()) { const coupledPolyPatch& cpp = refCast(patches[patchI]); diff --git a/src/finiteVolume/fvMesh/extendedStencil/faceToCell/extendedFaceToCellStencil.C b/src/finiteVolume/fvMesh/extendedStencil/faceToCell/extendedFaceToCellStencil.C index 0943d86685..4f364dc288 100644 --- a/src/finiteVolume/fvMesh/extendedStencil/faceToCell/extendedFaceToCellStencil.C +++ b/src/finiteVolume/fvMesh/extendedStencil/faceToCell/extendedFaceToCellStencil.C @@ -38,7 +38,7 @@ Foam::extendedFaceToCellStencil::extendedFaceToCellStencil(const polyMesh& mesh) forAll(patches, patchI) { - if (isA(patches[patchI])) + if (patches[patchI].coupled()) { const coupledPolyPatch& cpp = refCast(patches[patchI]); diff --git a/src/finiteVolume/interpolation/surfaceInterpolation/schemes/clippedLinear/clippedLinear.H b/src/finiteVolume/interpolation/surfaceInterpolation/schemes/clippedLinear/clippedLinear.H index 312a453c44..b69b2a05dc 100644 --- a/src/finiteVolume/interpolation/surfaceInterpolation/schemes/clippedLinear/clippedLinear.H +++ b/src/finiteVolume/interpolation/surfaceInterpolation/schemes/clippedLinear/clippedLinear.H @@ -157,7 +157,7 @@ public: forAll(mesh.boundary(), patchi) { - if (mesh.boundary()[patchi].coupled()) + if (clippedLinearWeights.boundaryField()[patchi].coupled()) { clippedLinearWeights.boundaryField()[patchi] = max diff --git a/src/finiteVolume/interpolation/surfaceInterpolation/schemes/reverseLinear/reverseLinear.H b/src/finiteVolume/interpolation/surfaceInterpolation/schemes/reverseLinear/reverseLinear.H index 5dd8ee104a..3f3cae05fe 100644 --- a/src/finiteVolume/interpolation/surfaceInterpolation/schemes/reverseLinear/reverseLinear.H +++ b/src/finiteVolume/interpolation/surfaceInterpolation/schemes/reverseLinear/reverseLinear.H @@ -129,7 +129,7 @@ public: forAll(mesh.boundary(), patchI) { - if (mesh.boundary()[patchI].coupled()) + if (reverseLinearWeights.boundaryField()[patchI].coupled()) { reverseLinearWeights.boundaryField()[patchI] = 1.0 - cdWeights.boundaryField()[patchI]; diff --git a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/FacePostProcessing/FacePostProcessing.C b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/FacePostProcessing/FacePostProcessing.C index 0f2a765ea8..36fb2aa035 100644 --- a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/FacePostProcessing/FacePostProcessing.C +++ b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/FacePostProcessing/FacePostProcessing.C @@ -316,7 +316,7 @@ Foam::FacePostProcessing::FacePostProcessing if ( - !pp.coupled() + !magSf.boundaryField()[patchI].coupled() || refCast(pp).owner() ) { diff --git a/src/meshTools/AMIInterpolation/patches/cyclic/cyclicAMIPointPatch/cyclicAMIPointPatch.H b/src/meshTools/AMIInterpolation/patches/cyclic/cyclicAMIPointPatch/cyclicAMIPointPatch.H index 3ade3aeaef..78c69e0ad0 100644 --- a/src/meshTools/AMIInterpolation/patches/cyclic/cyclicAMIPointPatch/cyclicAMIPointPatch.H +++ b/src/meshTools/AMIInterpolation/patches/cyclic/cyclicAMIPointPatch/cyclicAMIPointPatch.H @@ -107,6 +107,17 @@ public: //- Destructor virtual ~cyclicAMIPointPatch(); + + + // Member Functions + + //- Is patch 'coupled'. Note that on AMI the geometry is not + // coupled but the fields are! + virtual bool coupled() const + { + return false; + } + }; diff --git a/src/meshTools/AMIInterpolation/patches/cyclic/cyclicAMIPolyPatch/cyclicAMIPolyPatch.C b/src/meshTools/AMIInterpolation/patches/cyclic/cyclicAMIPolyPatch/cyclicAMIPolyPatch.C index b6769849f7..d281afc21f 100644 --- a/src/meshTools/AMIInterpolation/patches/cyclic/cyclicAMIPolyPatch/cyclicAMIPolyPatch.C +++ b/src/meshTools/AMIInterpolation/patches/cyclic/cyclicAMIPolyPatch/cyclicAMIPolyPatch.C @@ -548,23 +548,6 @@ Foam::cyclicAMIPolyPatch::~cyclicAMIPolyPatch() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -bool Foam::cyclicAMIPolyPatch::coupled() const -{ - if - ( - Pstream::parRun() - || (size() && neighbPatch().size()) - ) - { - return true; - } - else - { - return false; - } -} - - Foam::label Foam::cyclicAMIPolyPatch::neighbPatchID() const { if (nbrPatchID_ == -1) diff --git a/src/meshTools/AMIInterpolation/patches/cyclic/cyclicAMIPolyPatch/cyclicAMIPolyPatch.H b/src/meshTools/AMIInterpolation/patches/cyclic/cyclicAMIPolyPatch/cyclicAMIPolyPatch.H index ced7968171..9ced39571a 100644 --- a/src/meshTools/AMIInterpolation/patches/cyclic/cyclicAMIPolyPatch/cyclicAMIPolyPatch.H +++ b/src/meshTools/AMIInterpolation/patches/cyclic/cyclicAMIPolyPatch/cyclicAMIPolyPatch.H @@ -254,10 +254,12 @@ public: // Access - //- Return true only if is coupled. Note that for non-parallel - // operation of a decomposed case this can return the wrong - // result - virtual bool coupled() const; + //- Is patch 'coupled'. Note that on AMI the geometry is not + // coupled but the fields are! + virtual bool coupled() const + { + return false; + } //- Neighbour patch name inline const word& neighbPatchName() const; diff --git a/src/sampling/sampledSurface/isoSurface/isoSurface.C b/src/sampling/sampledSurface/isoSurface/isoSurface.C index 81497e47a0..f96983d27a 100644 --- a/src/sampling/sampledSurface/isoSurface/isoSurface.C +++ b/src/sampling/sampledSurface/isoSurface/isoSurface.C @@ -1769,7 +1769,7 @@ Foam::isoSurface::isoSurface const polyPatch& pp = patches[patchI]; // Adapt separated coupled (proc and cyclic) patches - if (isA(pp)) + if (pp.coupled()) { fvPatchVectorField& pfld = const_cast ( From cf8ad3d9364b76e413d4e534fa908b83efd43bc9 Mon Sep 17 00:00:00 2001 From: mattijs Date: Tue, 15 Nov 2011 10:29:59 +0000 Subject: [PATCH 4/6] ENH: cyclicAMI: handle FaceCellWave (e.g. wall distance) --- src/OpenFOAM/Make/files | 3 - .../polyPatches/polyPatch/polyPatch.H | 2 +- .../AMIInterpolation/AMIInterpolation.C | 258 +++++++------ .../AMIInterpolation/AMIInterpolation.H | 29 +- .../cyclicAMIPolyPatch/cyclicAMIPolyPatch.H | 9 + .../cyclicAMIPolyPatchTemplates.C | 19 + src/meshTools/Make/files | 11 +- .../algorithms/MeshWave/FaceCellWave.C | 342 +++++++++++++----- .../algorithms/MeshWave/FaceCellWave.H | 11 +- .../algorithms/MeshWave/FaceCellWaveName.C | 0 .../algorithms/MeshWave/MeshWave.C | 0 .../algorithms/MeshWave/MeshWave.H | 0 .../algorithms/MeshWave/MeshWaveName.C | 0 .../PatchEdgeFaceWave/PatchEdgeFaceWave.C | 0 .../PatchEdgeFaceWave/PatchEdgeFaceWave.H | 0 .../PatchEdgeFaceWave/PatchEdgeFaceWaveName.C | 0 .../PatchEdgeFaceWave/patchEdgeFaceInfo.C | 0 .../PatchEdgeFaceWave/patchEdgeFaceInfo.H | 0 .../PatchEdgeFaceWave/patchEdgeFaceInfoI.H | 0 .../PointEdgeWave/PointEdgeWave.C | 0 .../PointEdgeWave/PointEdgeWave.H | 0 .../PointEdgeWave/PointEdgeWaveName.C | 0 .../PointEdgeWave/pointEdgePoint.C | 0 .../PointEdgeWave/pointEdgePoint.H | 0 .../PointEdgeWave/pointEdgePointI.H | 0 25 files changed, 479 insertions(+), 205 deletions(-) rename src/{OpenFOAM => meshTools}/algorithms/MeshWave/FaceCellWave.C (77%) rename src/{OpenFOAM => meshTools}/algorithms/MeshWave/FaceCellWave.H (97%) rename src/{OpenFOAM => meshTools}/algorithms/MeshWave/FaceCellWaveName.C (100%) rename src/{OpenFOAM => meshTools}/algorithms/MeshWave/MeshWave.C (100%) rename src/{OpenFOAM => meshTools}/algorithms/MeshWave/MeshWave.H (100%) rename src/{OpenFOAM => meshTools}/algorithms/MeshWave/MeshWaveName.C (100%) rename src/meshTools/{ => algorithms}/PatchEdgeFaceWave/PatchEdgeFaceWave.C (100%) rename src/meshTools/{ => algorithms}/PatchEdgeFaceWave/PatchEdgeFaceWave.H (100%) rename src/meshTools/{ => algorithms}/PatchEdgeFaceWave/PatchEdgeFaceWaveName.C (100%) rename src/meshTools/{ => algorithms}/PatchEdgeFaceWave/patchEdgeFaceInfo.C (100%) rename src/meshTools/{ => algorithms}/PatchEdgeFaceWave/patchEdgeFaceInfo.H (100%) rename src/meshTools/{ => algorithms}/PatchEdgeFaceWave/patchEdgeFaceInfoI.H (100%) rename src/meshTools/{ => algorithms}/PointEdgeWave/PointEdgeWave.C (100%) rename src/meshTools/{ => algorithms}/PointEdgeWave/PointEdgeWave.H (100%) rename src/meshTools/{ => algorithms}/PointEdgeWave/PointEdgeWaveName.C (100%) rename src/meshTools/{ => algorithms}/PointEdgeWave/pointEdgePoint.C (100%) rename src/meshTools/{ => algorithms}/PointEdgeWave/pointEdgePoint.H (100%) rename src/meshTools/{ => algorithms}/PointEdgeWave/pointEdgePointI.H (100%) diff --git a/src/OpenFOAM/Make/files b/src/OpenFOAM/Make/files index 6e169d64bc..da569b2e21 100644 --- a/src/OpenFOAM/Make/files +++ b/src/OpenFOAM/Make/files @@ -577,9 +577,6 @@ $(interpolations)/interpolationTable/tableReaders/tableReaders.C $(interpolations)/interpolationTable/tableReaders/openFoam/openFoamTableReaders.C $(interpolations)/interpolationTable/tableReaders/csv/csvTableReaders.C -algorithms/MeshWave/MeshWaveName.C -algorithms/MeshWave/FaceCellWaveName.C - algorithms/indexedOctree/indexedOctreeName.C algorithms/indexedOctree/treeDataCell.C diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/polyPatch/polyPatch.H b/src/OpenFOAM/meshes/polyMesh/polyPatches/polyPatch/polyPatch.H index 5601c1e993..0fa859bddb 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyPatches/polyPatch/polyPatch.H +++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/polyPatch/polyPatch.H @@ -300,7 +300,7 @@ public: //- Slice list to patch template - const typename List::subList patchSlice(const List& l) const + const typename List::subList patchSlice(const UList& l) const { return typename List::subList(l, this->size(), start_); } diff --git a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolation.C b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolation.C index a0965ff941..cae738707d 100644 --- a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolation.C +++ b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolation.C @@ -30,6 +30,37 @@ License #include "mergePoints.H" #include "mapDistribute.H" +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + //- Combine operator for interpolateToSource/Target + template + class combineBinaryOp + { + const BinaryOp& bop_; + + public: + + combineBinaryOp(const BinaryOp& bop) + : + bop_(bop) + {} + + void operator() + ( + Type& x, + const label faceI, + const Type& y, + const scalar weight + ) const + { + x = bop_(x, weight*y); + } + }; +} + + // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // template @@ -1773,94 +1804,12 @@ void Foam::AMIInterpolation::update template -template -Foam::tmp > -Foam::AMIInterpolation::interpolateToSource +template +void Foam::AMIInterpolation::interpolateToTarget ( - const Field& fld, - const BinaryOp& bop -) const -{ - if (fld.size() != tgtAddress_.size()) - { - FatalErrorIn - ( - "AMIInterpolation::interpolateToSource(const Field) const" - ) << "Supplied field size is not equal to target patch size" << nl - << " source patch = " << srcAddress_.size() << nl - << " target patch = " << tgtAddress_.size() << nl - << " supplied field = " << fld.size() - << abort(FatalError); - } - - tmp > tresult - ( - new Field - ( - srcAddress_.size(), - pTraits::zero - ) - ); - - Field& result = tresult(); - - if (singlePatchProc_ == -1) - { - const mapDistribute& map = tgtMapPtr_(); - - Field work(fld); - map.distribute(work); - - forAll(result, faceI) - { - const labelList& faces = srcAddress_[faceI]; - const scalarList& weights = srcWeights_[faceI]; - - forAll(faces, i) - { - result[faceI] = bop(result[faceI], work[faces[i]]*weights[i]); - } - } - } - else - { - forAll(result, faceI) - { - const labelList& faces = srcAddress_[faceI]; - const scalarList& weights = srcWeights_[faceI]; - - forAll(faces, i) - { - result[faceI] = bop(result[faceI], fld[faces[i]]*weights[i]); - } - } - } - - return tresult; -} - - -template -template -Foam::tmp > -Foam::AMIInterpolation::interpolateToSource -( - const tmp >& tFld, - const BinaryOp& bop -) const -{ - return interpolateToSource(tFld(), bop); -} - - - -template -template -Foam::tmp > -Foam::AMIInterpolation::interpolateToTarget -( - const Field& fld, - const BinaryOp& bop + const UList& fld, + const CombineOp& bop, + List& result ) const { if (fld.size() != srcAddress_.size()) @@ -1875,22 +1824,13 @@ Foam::AMIInterpolation::interpolateToTarget << abort(FatalError); } - tmp > tresult - ( - new Field - ( - tgtAddress_.size(), - pTraits::zero - ) - ); - - Field& result = tresult(); + result.setSize(tgtAddress_.size()); if (singlePatchProc_ == -1) { const mapDistribute& map = srcMapPtr_(); - Field work(fld); + List work(fld); map.distribute(work); forAll(result, faceI) @@ -1900,7 +1840,7 @@ Foam::AMIInterpolation::interpolateToTarget forAll(faces, i) { - result[faceI] = bop(result[faceI], work[faces[i]]*weights[i]); + bop(result[faceI], faceI, work[faces[i]], weights[i]); } } } @@ -1913,10 +1853,126 @@ Foam::AMIInterpolation::interpolateToTarget forAll(faces, i) { - result[faceI] = bop(result[faceI], fld[faces[i]]*weights[i]); + bop(result[faceI], faceI, fld[faces[i]], weights[i]); } } } +} + + +template +template +void Foam::AMIInterpolation::interpolateToSource +( + const UList& fld, + const CombineOp& bop, + List& result +) const +{ + if (fld.size() != tgtAddress_.size()) + { + FatalErrorIn + ( + "AMIInterpolation::interpolateToSource(const Field) const" + ) << "Supplied field size is not equal to target patch size" << nl + << " source patch = " << srcAddress_.size() << nl + << " target patch = " << tgtAddress_.size() << nl + << " supplied field = " << fld.size() + << abort(FatalError); + } + + result.setSize(srcAddress_.size()); + + if (singlePatchProc_ == -1) + { + const mapDistribute& map = tgtMapPtr_(); + + List work(fld); + map.distribute(work); + + forAll(result, faceI) + { + const labelList& faces = srcAddress_[faceI]; + const scalarList& weights = srcWeights_[faceI]; + + forAll(faces, i) + { + bop(result[faceI], faceI, work[faces[i]], weights[i]); + } + } + } + else + { + forAll(result, faceI) + { + const labelList& faces = srcAddress_[faceI]; + const scalarList& weights = srcWeights_[faceI]; + + forAll(faces, i) + { + bop(result[faceI], faceI, fld[faces[i]], weights[i]); + } + } + } +} + + +template +template +Foam::tmp > +Foam::AMIInterpolation::interpolateToSource +( + const Field& fld, + const BinaryOp& bop +) const +{ + tmp > tresult + ( + new Field + ( + srcAddress_.size(), + pTraits::zero + ) + ); + + interpolateToSource(fld, combineBinaryOp(bop), tresult()); + + return tresult; +} + + +template +template +Foam::tmp > +Foam::AMIInterpolation::interpolateToSource +( + const tmp >& tFld, + const BinaryOp& bop +) const +{ + return interpolateToSource(tFld, bop); +} + + +template +template +Foam::tmp > +Foam::AMIInterpolation::interpolateToTarget +( + const Field& fld, + const BinaryOp& bop +) const +{ + tmp > tresult + ( + new Field + ( + tgtAddress_.size(), + pTraits::zero + ) + ); + + interpolateToTarget(fld, combineBinaryOp(bop), tresult()); return tresult; } @@ -1931,7 +1987,7 @@ Foam::AMIInterpolation::interpolateToTarget const BinaryOp& bop ) const { - return interpolateToTarget(tFld(), bop); + return interpolateToTarget(tFld, bop); } diff --git a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolation.H b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolation.H index e43180db6f..c9aa12da90 100644 --- a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolation.H +++ b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolation.H @@ -404,7 +404,30 @@ public: // Evaluation - //- Interpolate from target to source with supplied op + // Low-level + + //- Interpolate from target to source with supplied op + // to combine existing value with remote value and weight + template + void interpolateToSource + ( + const UList& fld, + const CombineOp& bop, + List& result + ) const; + + //- Interpolate from source to target with supplied op + // to combine existing value with remote value and weight + template + void interpolateToTarget + ( + const UList& fld, + const CombineOp& bop, + List& result + ) const; + + + //- Interpolate from target to source with supplied binary op template tmp > interpolateToSource ( @@ -412,7 +435,8 @@ public: const BinaryOp& bop ) const; - //- Interpolate from target tmp field to source with supplied op + //- Interpolate from target tmp field to source with supplied + // binary op template tmp > interpolateToSource ( @@ -464,7 +488,6 @@ public: const tmp >& tFld ) const; - // Checks //- Write face connectivity as OBJ file diff --git a/src/meshTools/AMIInterpolation/patches/cyclic/cyclicAMIPolyPatch/cyclicAMIPolyPatch.H b/src/meshTools/AMIInterpolation/patches/cyclic/cyclicAMIPolyPatch/cyclicAMIPolyPatch.H index 9ced39571a..dcd26799c0 100644 --- a/src/meshTools/AMIInterpolation/patches/cyclic/cyclicAMIPolyPatch/cyclicAMIPolyPatch.H +++ b/src/meshTools/AMIInterpolation/patches/cyclic/cyclicAMIPolyPatch/cyclicAMIPolyPatch.H @@ -318,6 +318,15 @@ public: const tmp >& tFld ) const; + //- Low-level interpolate List + template + void interpolate + ( + const UList& fld, + const BinaryOp& bop, + List& result + ) const; + //- Calculate the patch geometry virtual void calcGeometry diff --git a/src/meshTools/AMIInterpolation/patches/cyclic/cyclicAMIPolyPatch/cyclicAMIPolyPatchTemplates.C b/src/meshTools/AMIInterpolation/patches/cyclic/cyclicAMIPolyPatch/cyclicAMIPolyPatchTemplates.C index ccafd75fd4..4bf59fba41 100644 --- a/src/meshTools/AMIInterpolation/patches/cyclic/cyclicAMIPolyPatch/cyclicAMIPolyPatchTemplates.C +++ b/src/meshTools/AMIInterpolation/patches/cyclic/cyclicAMIPolyPatch/cyclicAMIPolyPatchTemplates.C @@ -59,4 +59,23 @@ Foam::tmp > Foam::cyclicAMIPolyPatch::interpolate } +template +void Foam::cyclicAMIPolyPatch::interpolate +( + const UList& fld, + const BinaryOp& bop, + List& result +) const +{ + if (owner()) + { + AMIPtr_->interpolateToSource(fld, bop, result); + } + else + { + neighbPatch().AMIPtr_->interpolateToTarget(fld, bop, result); + } +} + + // ************************************************************************* // diff --git a/src/meshTools/Make/files b/src/meshTools/Make/files index 4ba28fce08..e1c9854902 100644 --- a/src/meshTools/Make/files +++ b/src/meshTools/Make/files @@ -30,14 +30,21 @@ meshSearch/meshSearch.C meshTools/meshTools.C -pWave = PointEdgeWave +algorithms = algorithms + +pWave = $(algorithms)/PointEdgeWave $(pWave)/PointEdgeWaveName.C $(pWave)/pointEdgePoint.C -patchWave = PatchEdgeFaceWave +patchWave = $(algorithms)/PatchEdgeFaceWave $(patchWave)/PatchEdgeFaceWaveName.C $(patchWave)/patchEdgeFaceInfo.C +meshWave = $(algorithms)/MeshWave +$(meshWave)/MeshWaveName.C +$(meshWave)/FaceCellWaveName.C + + regionSplit/regionSplit.C indexedOctree/treeDataEdge.C diff --git a/src/OpenFOAM/algorithms/MeshWave/FaceCellWave.C b/src/meshTools/algorithms/MeshWave/FaceCellWave.C similarity index 77% rename from src/OpenFOAM/algorithms/MeshWave/FaceCellWave.C rename to src/meshTools/algorithms/MeshWave/FaceCellWave.C index 5b11137329..c0e1e72ee8 100644 --- a/src/OpenFOAM/algorithms/MeshWave/FaceCellWave.C +++ b/src/meshTools/algorithms/MeshWave/FaceCellWave.C @@ -27,11 +27,14 @@ License #include "polyMesh.H" #include "processorPolyPatch.H" #include "cyclicPolyPatch.H" +#include "cyclicAMIPolyPatch.H" #include "OPstream.H" #include "IPstream.H" #include "PstreamReduceOps.H" #include "debug.H" #include "typeInfo.H" +#include "SubField.H" +#include "globalMeshData.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -44,6 +47,53 @@ Foam::scalar Foam::FaceCellWave::propagationTol_ = 0.01; template Foam::label Foam::FaceCellWave::dummyTrackData_ = 12345; +namespace Foam +{ + //- Combine operator for AMIInterpolation + template + class combine + { + FaceCellWave& solver_; + + const polyPatch& patch_; + + public: + + combine + ( + FaceCellWave& solver, + const polyPatch& patch + ) + : + solver_(solver), + patch_(patch) + {} + + + void operator() + ( + Type& x, + const label faceI, + const Type& y, + const scalar weight + ) const + { + if (y.valid(solver_.data())) + { + x.updateFace + ( + solver_.mesh(), + patch_.start() + faceI, + y, + solver_.propagationTol(), + solver_.data() + ); + } + } + }; +} + + // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // @@ -244,11 +294,12 @@ void Foam::FaceCellWave::checkCyclic // Check if has cyclic patches template -bool Foam::FaceCellWave::hasCyclicPatch() const +template +bool Foam::FaceCellWave::hasPatch() const { forAll(mesh_.boundaryMesh(), patchI) { - if (isA(mesh_.boundaryMesh()[patchI])) + if (isA(mesh_.boundaryMesh()[patchI])) { return true; } @@ -446,119 +497,117 @@ void Foam::FaceCellWave::offset template void Foam::FaceCellWave::handleProcPatches() { + const globalMeshData& pData = mesh_.globalData(); + + // Which patches are processor patches + const labelList& procPatches = pData.processorPatches(); + // Send all PstreamBuffers pBufs(Pstream::nonBlocking); - forAll(mesh_.boundaryMesh(), patchI) + forAll(procPatches, i) { - const polyPatch& patch = mesh_.boundaryMesh()[patchI]; + label patchI = procPatches[i]; - if (isA(patch)) + const processorPolyPatch& procPatch = + refCast(mesh_.boundaryMesh()[patchI]); + + // Allocate buffers + label nSendFaces; + labelList sendFaces(procPatch.size()); + List sendFacesInfo(procPatch.size()); + + // Determine which faces changed on current patch + nSendFaces = getChangedPatchFaces + ( + procPatch, + 0, + procPatch.size(), + sendFaces, + sendFacesInfo + ); + + // Adapt wallInfo for leaving domain + leaveDomain + ( + procPatch, + nSendFaces, + sendFaces, + sendFacesInfo + ); + + if (debug) { - // Allocate buffers - label nSendFaces; - labelList sendFaces(patch.size()); - List sendFacesInfo(patch.size()); - - // Determine which faces changed on current patch - nSendFaces = getChangedPatchFaces - ( - patch, - 0, - patch.size(), - sendFaces, - sendFacesInfo - ); - - // Adapt wallInfo for leaving domain - leaveDomain - ( - patch, - nSendFaces, - sendFaces, - sendFacesInfo - ); - - const processorPolyPatch& procPatch = - refCast(patch); - - if (debug) - { - Pout<< " Processor patch " << patchI << ' ' << patch.name() - << " communicating with " << procPatch.neighbProcNo() - << " Sending:" << nSendFaces - << endl; - } - - UOPstream toNeighbour(procPatch.neighbProcNo(), pBufs); - //writeFaces(nSendFaces, sendFaces, sendFacesInfo, toNeighbour); - toNeighbour - << SubList