From 1277352fa55ad7581a62691db15a996ff916fe35 Mon Sep 17 00:00:00 2001 From: HenningScheufler Date: Sun, 13 Dec 2020 22:23:43 +0100 Subject: [PATCH 01/10] update to version ofv2012 and addition of damBreak testcase --- .../dynamicMultiDimRefineFvMesh.C | 12 +- .../dynamicMultiDimRefineFvMesh.H | 4 +- src/dynamicLoadBalanceFvMesh/hexRef/hexRef.C | 16 +-- .../hexRef/hexRef3D/hexRef3D.C | 4 +- .../hexRef/hexRef4/hexRef4.C | 10 +- .../hexRef/hexRef4Axi/hexRef4Axi.C | 10 +- .../hexRef/refinementHistoryMultiDim.C | 2 +- tutorials/damBreak/0.orig/U | 54 +++++++++ tutorials/damBreak/0.orig/alpha.water | 51 ++++++++ tutorials/damBreak/0.orig/p_rgh | 59 +++++++++ tutorials/damBreak/Allclean | 10 ++ tutorials/damBreak/Allrun | 15 +++ tutorials/damBreak/Allrun-parallel | 17 +++ tutorials/damBreak/constant/dynamicMeshDict | 88 ++++++++++++++ tutorials/damBreak/constant/g | 22 ++++ .../damBreak/constant/transportProperties | 38 ++++++ .../damBreak/constant/turbulenceProperties | 21 ++++ tutorials/damBreak/system/balanceParDict | 38 ++++++ tutorials/damBreak/system/blockMeshDict | 114 ++++++++++++++++++ tutorials/damBreak/system/controlDict | 86 +++++++++++++ tutorials/damBreak/system/decomposeParDict | 50 ++++++++ tutorials/damBreak/system/fvSchemes | 59 +++++++++ tutorials/damBreak/system/fvSolution | 93 ++++++++++++++ tutorials/damBreak/system/setFieldsDict | 36 ++++++ .../system/balanceParDict | 2 +- .../damBreakWithObstacle/system/controlDict | 2 +- .../system/decomposeParDict | 2 +- 27 files changed, 881 insertions(+), 34 deletions(-) create mode 100644 tutorials/damBreak/0.orig/U create mode 100644 tutorials/damBreak/0.orig/alpha.water create mode 100644 tutorials/damBreak/0.orig/p_rgh create mode 100755 tutorials/damBreak/Allclean create mode 100755 tutorials/damBreak/Allrun create mode 100755 tutorials/damBreak/Allrun-parallel create mode 100644 tutorials/damBreak/constant/dynamicMeshDict create mode 100644 tutorials/damBreak/constant/g create mode 100644 tutorials/damBreak/constant/transportProperties create mode 100644 tutorials/damBreak/constant/turbulenceProperties create mode 100755 tutorials/damBreak/system/balanceParDict create mode 100644 tutorials/damBreak/system/blockMeshDict create mode 100644 tutorials/damBreak/system/controlDict create mode 100644 tutorials/damBreak/system/decomposeParDict create mode 100644 tutorials/damBreak/system/fvSchemes create mode 100644 tutorials/damBreak/system/fvSolution create mode 100644 tutorials/damBreak/system/setFieldsDict diff --git a/src/dynamicLoadBalanceFvMesh/dynamicMultiDimRefineFvMesh/dynamicMultiDimRefineFvMesh.C b/src/dynamicLoadBalanceFvMesh/dynamicMultiDimRefineFvMesh/dynamicMultiDimRefineFvMesh.C index 02f26eb..b7b12f6 100644 --- a/src/dynamicLoadBalanceFvMesh/dynamicMultiDimRefineFvMesh/dynamicMultiDimRefineFvMesh.C +++ b/src/dynamicLoadBalanceFvMesh/dynamicMultiDimRefineFvMesh/dynamicMultiDimRefineFvMesh.C @@ -595,7 +595,7 @@ Foam::dynamicMultiDimRefineFvMesh::unrefine forAllConstIters(faceToSplitPoint, iter) { const label oldFacei = iter.key(); - const label oldPointi = iter.object(); + const label oldPointi = iter.val(); if (reversePointMap[oldPointi] < 0) { @@ -929,7 +929,7 @@ Foam::dynamicMultiDimRefineFvMesh::dynamicMultiDimRefineFvMesh(const IOobject& i protectedCell_(nCells()), nRefinementIterations_(0), dumpLevel_(false), - adaptCriteriaPtr_() + adaptCriteriaPtr_() { // Read static part of dictionary readDict(); @@ -1210,7 +1210,7 @@ bool Foam::dynamicMultiDimRefineFvMesh::update() newRefineCell.set(celli); } } - // move content in refineCell + // move content in refineCell refineCell.transfer(newRefineCell); } @@ -1276,9 +1276,7 @@ bool Foam::dynamicMultiDimRefineFvMesh::update() bool Foam::dynamicMultiDimRefineFvMesh::writeObject ( - IOstream::streamFormat fmt, - IOstream::versionNumber ver, - IOstream::compressionType cmp, + IOstreamOption streamOpt, const bool valid ) const { @@ -1287,7 +1285,7 @@ bool Foam::dynamicMultiDimRefineFvMesh::writeObject bool writeOk = ( - dynamicFvMesh::writeObject(fmt, ver, cmp, valid) + dynamicFvMesh::writeObject(streamOpt, valid) && meshCutter_->write(valid) ); diff --git a/src/dynamicLoadBalanceFvMesh/dynamicMultiDimRefineFvMesh/dynamicMultiDimRefineFvMesh.H b/src/dynamicLoadBalanceFvMesh/dynamicMultiDimRefineFvMesh/dynamicMultiDimRefineFvMesh.H index e200620..3bf766e 100644 --- a/src/dynamicLoadBalanceFvMesh/dynamicMultiDimRefineFvMesh/dynamicMultiDimRefineFvMesh.H +++ b/src/dynamicLoadBalanceFvMesh/dynamicMultiDimRefineFvMesh/dynamicMultiDimRefineFvMesh.H @@ -268,9 +268,7 @@ public: //- Write using given format, version and compression virtual bool writeObject ( - IOstream::streamFormat fmt, - IOstream::versionNumber ver, - IOstream::compressionType cmp, + IOstreamOption streamOpt, const bool valid ) const; }; diff --git a/src/dynamicLoadBalanceFvMesh/hexRef/hexRef.C b/src/dynamicLoadBalanceFvMesh/hexRef/hexRef.C index ccf9fae..d3d5c6c 100755 --- a/src/dynamicLoadBalanceFvMesh/hexRef/hexRef.C +++ b/src/dynamicLoadBalanceFvMesh/hexRef/hexRef.C @@ -555,7 +555,7 @@ Foam::label Foam::hexRef::getAnchorCell { if (cellAnchorPoints[celli].size()) { - label index = findIndex(cellAnchorPoints[celli], pointi); + label index = cellAnchorPoints[celli].find(pointi); if (index != -1) { @@ -570,7 +570,7 @@ Foam::label Foam::hexRef::getAnchorCell forAll(f, fp) { - label index = findIndex(cellAnchorPoints[celli], f[fp]); + label index = cellAnchorPoints[celli].find(f[fp]); if (index != -1) { @@ -1340,7 +1340,7 @@ bool Foam::hexRef::matchHexShape if (iter != pointFaces.end()) { labelList& pFaces = iter(); - if (findIndex(pFaces, facei) == -1) + if (pFaces.find(facei) == -1) { pFaces.append(facei); } @@ -1904,7 +1904,7 @@ Foam::labelList Foam::hexRef::consistentSlowRefinement << "Argument facesToCheck seems to have duplicate entries!" << endl << "face:" << facei << " occurs at positions " - << findIndices(facesToCheck, facei) + << facesToCheck.find(facei) << abort(FatalError); } @@ -2390,7 +2390,7 @@ Foam::labelList Foam::hexRef::consistentSlowRefinement2 << "Argument facesToCheck seems to have duplicate entries!" << endl << "face:" << facei << " occurs at positions " - << findIndices(facesToCheck, facei) + << facesToCheck.find(facei) << abort(FatalError); } @@ -2996,7 +2996,7 @@ void Foam::hexRef::subset cellLevel_.transfer(newCellLevel); - if (findIndex(cellLevel_, -1) != -1) + if (cellLevel_.find(-1) != -1) { FatalErrorInFunction << "Problem : " @@ -3017,7 +3017,7 @@ void Foam::hexRef::subset pointLevel_.transfer(newPointLevel); - if (findIndex(pointLevel_, -1) != -1) + if (pointLevel_.find(-1) != -1) { FatalErrorInFunction << "Problem : " @@ -3537,7 +3537,7 @@ void Foam::hexRef::checkRefinementLevels const Foam::cellShapeList& Foam::hexRef::cellShapes() const { - if (cellShapesPtr_.empty()) + if (cellShapesPtr_) { if (debug) { diff --git a/src/dynamicLoadBalanceFvMesh/hexRef/hexRef3D/hexRef3D.C b/src/dynamicLoadBalanceFvMesh/hexRef/hexRef3D/hexRef3D.C index 1668987..5e515af 100755 --- a/src/dynamicLoadBalanceFvMesh/hexRef/hexRef3D/hexRef3D.C +++ b/src/dynamicLoadBalanceFvMesh/hexRef/hexRef3D/hexRef3D.C @@ -73,7 +73,7 @@ Foam::label Foam::hexRef3D::getAnchorCell { if (cellAnchorPoints[celli].size()) { - label index = findIndex(cellAnchorPoints[celli], pointi); + label index = cellAnchorPoints[celli].find(pointi); if (index != -1) { @@ -88,7 +88,7 @@ Foam::label Foam::hexRef3D::getAnchorCell forAll(f, fp) { - label index = findIndex(cellAnchorPoints[celli], f[fp]); + label index = cellAnchorPoints[celli].find(f[fp]); if (index != -1) { diff --git a/src/dynamicLoadBalanceFvMesh/hexRef/hexRef4/hexRef4.C b/src/dynamicLoadBalanceFvMesh/hexRef/hexRef4/hexRef4.C index 7885cae..983cf87 100755 --- a/src/dynamicLoadBalanceFvMesh/hexRef/hexRef4/hexRef4.C +++ b/src/dynamicLoadBalanceFvMesh/hexRef/hexRef4/hexRef4.C @@ -74,7 +74,7 @@ Foam::label Foam::hexRef4::getAnchorCell { if (cellAnchorPoints[celli].size()) { - label index = findIndex(cellAnchorPoints[celli], pointi); + label index = cellAnchorPoints[celli].find(pointi); if (index != -1) { @@ -97,7 +97,7 @@ Foam::label Foam::hexRef4::getAnchorCell forAll(f, fp) { - label index = findIndex(cellAnchorPoints[celli], f[fp]); + label index = cellAnchorPoints[celli].find(f[fp]); if (index != -1) { @@ -214,7 +214,7 @@ Foam::label Foam::hexRef4::storeMidPointInfo } const edge& anchors = midPointToAnchors[edgeMidPointi]; - label index = findIndex(cellAnchorPoints[celli], anchorPointi); + label index = cellAnchorPoints[celli].find(anchorPointi); if (index == 0) { @@ -235,7 +235,7 @@ Foam::label Foam::hexRef4::storeMidPointInfo if (faceOrder == (mesh_.faceOwner()[facei] == celli)) { - label anch = findIndex(f, point1); + label anch = f.find(point1); if (pointLevel_[f[f.rcIndex(anch)]] <= cellLevel_[celli]) { @@ -274,7 +274,7 @@ Foam::label Foam::hexRef4::storeMidPointInfo } else { - label anch = findIndex(f, point1); + label anch = f.find(point1); if (pointLevel_[f[f.fcIndex(anch)]] <= cellLevel_[celli]) { diff --git a/src/dynamicLoadBalanceFvMesh/hexRef/hexRef4Axi/hexRef4Axi.C b/src/dynamicLoadBalanceFvMesh/hexRef/hexRef4Axi/hexRef4Axi.C index 97ea201..71f46ba 100755 --- a/src/dynamicLoadBalanceFvMesh/hexRef/hexRef4Axi/hexRef4Axi.C +++ b/src/dynamicLoadBalanceFvMesh/hexRef/hexRef4Axi/hexRef4Axi.C @@ -75,7 +75,7 @@ Foam::label Foam::hexRef4Axi::getAnchorCell { if (cellAnchorPoints[celli].size()) { - label index = findIndex(cellAnchorPoints[celli], pointi); + label index = cellAnchorPoints[celli].find(pointi); if (index != -1) { @@ -98,7 +98,7 @@ Foam::label Foam::hexRef4Axi::getAnchorCell forAll(f, fp) { - label index = findIndex(cellAnchorPoints[celli], f[fp]); + label index = cellAnchorPoints[celli].find(f[fp]); if (index != -1) { @@ -214,7 +214,7 @@ Foam::label Foam::hexRef4Axi::storeMidPointInfo } const edge& anchors = midPointToAnchors[edgeMidPointi]; - label index = findIndex(cellAnchorPoints[celli], anchorPointi); + label index = cellAnchorPoints[celli].find(anchorPointi); if (index == 0) { @@ -235,7 +235,7 @@ Foam::label Foam::hexRef4Axi::storeMidPointInfo if (faceOrder == (mesh_.faceOwner()[facei] == celli)) { - label anch = findIndex(f, point1); + label anch = f.find(point1); if (pointLevel_[f[f.rcIndex(anch)]] <= cellLevel_[celli]) { @@ -277,7 +277,7 @@ Foam::label Foam::hexRef4Axi::storeMidPointInfo } else { - label anch = findIndex(f, point1); + label anch = f.find(point1); if (pointLevel_[f[f.fcIndex(anch)]] <= cellLevel_[celli]) { diff --git a/src/dynamicLoadBalanceFvMesh/hexRef/refinementHistoryMultiDim.C b/src/dynamicLoadBalanceFvMesh/hexRef/refinementHistoryMultiDim.C index 9638f0b..7bef2e6 100755 --- a/src/dynamicLoadBalanceFvMesh/hexRef/refinementHistoryMultiDim.C +++ b/src/dynamicLoadBalanceFvMesh/hexRef/refinementHistoryMultiDim.C @@ -312,7 +312,7 @@ void Foam::refinementHistoryMultiDim::freeSplitCell(const label index) { FixedList& subCells = subCellsPtr(); - label myPos = findIndex(subCells, index); + label myPos = subCells.find(index); if (myPos == -1) { diff --git a/tutorials/damBreak/0.orig/U b/tutorials/damBreak/0.orig/U new file mode 100644 index 0000000..7fd1357 --- /dev/null +++ b/tutorials/damBreak/0.orig/U @@ -0,0 +1,54 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: v2006 | +| \\ / A nd | Website: www.openfoam.com | +| \\/ 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 +{ + leftWall + { + type fixedValue; + value uniform (0 0 0); + } + + rightWall + { + type fixedValue; + value uniform (0 0 0); + } + + lowerWall + { + type fixedValue; + value uniform (0 0 0); + } + + atmosphere + { + type pressureInletOutletVelocity; + value uniform (0 0 0); + } + + defaultFaces + { + type empty; + } +} + + +// ************************************************************************* // diff --git a/tutorials/damBreak/0.orig/alpha.water b/tutorials/damBreak/0.orig/alpha.water new file mode 100644 index 0000000..fd229e3 --- /dev/null +++ b/tutorials/damBreak/0.orig/alpha.water @@ -0,0 +1,51 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: v2006 | +| \\ / A nd | Website: www.openfoam.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + object alpha.water; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 0 0 0 0 0 0]; + +internalField uniform 0; + +boundaryField +{ + leftWall + { + type zeroGradient; + } + + rightWall + { + type zeroGradient; + } + + lowerWall + { + type zeroGradient; + } + + atmosphere + { + type inletOutlet; + inletValue uniform 0; + value uniform 0; + } + + defaultFaces + { + type empty; + } +} + +// ************************************************************************* // diff --git a/tutorials/damBreak/0.orig/p_rgh b/tutorials/damBreak/0.orig/p_rgh new file mode 100644 index 0000000..d06db58 --- /dev/null +++ b/tutorials/damBreak/0.orig/p_rgh @@ -0,0 +1,59 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: v2006 | +| \\ / A nd | Website: www.openfoam.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + object p_rgh; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [1 -1 -2 0 0 0 0]; + +internalField uniform 0; + +boundaryField +{ + leftWall + { + type fixedFluxPressure; + value uniform 0; + } + + rightWall + { + type fixedFluxPressure; + value uniform 0; + } + + lowerWall + { + type fixedFluxPressure; + value uniform 0; + } + + atmosphere + { + type totalPressure; + p0 uniform 0; + U U; + phi phi; + rho rho; + psi none; + gamma 1; + value uniform 0; + } + + defaultFaces + { + type empty; + } +} + +// ************************************************************************* // diff --git a/tutorials/damBreak/Allclean b/tutorials/damBreak/Allclean new file mode 100755 index 0000000..0223703 --- /dev/null +++ b/tutorials/damBreak/Allclean @@ -0,0 +1,10 @@ +#!/bin/sh +cd "${0%/*}" || exit # Run from this directory +. ${WM_PROJECT_DIR:?}/bin/tools/CleanFunctions # Tutorial clean functions +#------------------------------------------------------------------------------ + +cleanCase0 + +rm -rf isoFaces sequencedVTK + +#------------------------------------------------------------------------------ diff --git a/tutorials/damBreak/Allrun b/tutorials/damBreak/Allrun new file mode 100755 index 0000000..cf8a095 --- /dev/null +++ b/tutorials/damBreak/Allrun @@ -0,0 +1,15 @@ +#!/bin/sh +cd "${0%/*}" || exit # Run from this directory +. ${WM_PROJECT_DIR:?}/bin/tools/RunFunctions # Tutorial run functions +#------------------------------------------------------------------------------ +touch damBreak.foam + +restore0Dir + +runApplication blockMesh + +runApplication setFields + +runApplication $(getApplication) +foamSequenceVTKFiles -vtp +#------------------------------------------------------------------------------ diff --git a/tutorials/damBreak/Allrun-parallel b/tutorials/damBreak/Allrun-parallel new file mode 100755 index 0000000..cbc1f44 --- /dev/null +++ b/tutorials/damBreak/Allrun-parallel @@ -0,0 +1,17 @@ +#!/bin/sh +cd "${0%/*}" || exit # Run from this directory +. ${WM_PROJECT_DIR:?}/bin/tools/RunFunctions # Tutorial run functions +#------------------------------------------------------------------------------ +touch damBreak.foam + +restore0Dir + +runApplication blockMesh + +runApplication decomposePar + +runParallel setFields + +runParallel $(getApplication) + +#------------------------------------------------------------------------------ diff --git a/tutorials/damBreak/constant/dynamicMeshDict b/tutorials/damBreak/constant/dynamicMeshDict new file mode 100644 index 0000000..28b6cf3 --- /dev/null +++ b/tutorials/damBreak/constant/dynamicMeshDict @@ -0,0 +1,88 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: v1812 | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "constant"; + object dynamicMeshDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dynamicFvMesh dynamicMultiDimRefineBalancedFvMesh; //dynamicMultiDimRefineFvMesh + +enableBalancing true; +allowableImbalance 0.10; + +adaptCriteria +{ + // type fieldBounds; + // fieldName alpha.water; + // lowerBound 0.001; + // upperBound 0.999; + + type composedAdaptCriteria; + operation or; + criteria + ( + interface // refLvl 4 at the inteface + { + type fieldBounds; + fieldName alpha.water; + lowerBound 0.01; + upperBound 0.99; + nLayer 2; + } + fluid // refLvl 2 in fluid + { + type fieldBounds; + fieldName alpha.water; + lowerBound 0.01; + upperBound 2; + maxCellLevel 2; + } + ); +} +// How often to refine +refineInterval 5; + + +// Have slower than 2:1 refinement +nBufferLayers 1; + +// Refine cells only up to maxRefinement levels +maxRefinement 3; + +// Stop refinement if maxCells reached +maxCells 1500000; + +// Flux field and corresponding velocity field. Fluxes on changed +// faces get recalculated by interpolating the velocity. Use 'none' +// on surfaceScalarFields that do not need to be reinterpolated. +correctFluxes +( + (phi none) + (nHatf none) + (rhoPhi none) + (alphaPhi0.water none) + (alphaPhi0 none) + (alphaPhiUn none) + (ghf none) + (phi0 none) + (dVf_ none) +); + +// Write the refinement level as a volScalarField +dumpLevel true; + + + + + +// ************************************************************************* // \ No newline at end of file diff --git a/tutorials/damBreak/constant/g b/tutorials/damBreak/constant/g new file mode 100644 index 0000000..8798a29 --- /dev/null +++ b/tutorials/damBreak/constant/g @@ -0,0 +1,22 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: v2006 | +| \\ / A nd | Website: www.openfoam.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class uniformDimensionedVectorField; + location "constant"; + object g; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 1 -2 0 0 0 0]; +value ( 0 -9.81 0 ); + + +// ************************************************************************* // diff --git a/tutorials/damBreak/constant/transportProperties b/tutorials/damBreak/constant/transportProperties new file mode 100644 index 0000000..191bb8c --- /dev/null +++ b/tutorials/damBreak/constant/transportProperties @@ -0,0 +1,38 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: v2006 | +| \\ / A nd | Website: www.openfoam.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "constant"; + object transportProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +phases (water air); + +water +{ + transportModel Newtonian; + nu 1e-06; + rho 1000; +} + +air +{ + transportModel Newtonian; + nu 1.48e-05; + rho 1; +} + + +sigma 0.07; + + +// ************************************************************************* // diff --git a/tutorials/damBreak/constant/turbulenceProperties b/tutorials/damBreak/constant/turbulenceProperties new file mode 100644 index 0000000..fbd1e3c --- /dev/null +++ b/tutorials/damBreak/constant/turbulenceProperties @@ -0,0 +1,21 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: v2006 | +| \\ / A nd | Website: www.openfoam.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "constant"; + object turbulenceProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +simulationType laminar; + + +// ************************************************************************* // diff --git a/tutorials/damBreak/system/balanceParDict b/tutorials/damBreak/system/balanceParDict new file mode 100755 index 0000000..6e7777c --- /dev/null +++ b/tutorials/damBreak/system/balanceParDict @@ -0,0 +1,38 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 2.1.1 | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object balanceParDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +numberOfSubdomains 4; + +method ptscotch; //clsutered //scotch + + +simpleCoeffs +{ + n (1 4 1); + delta 0.001; +} + +constraints +{ + refinementHistoryMultiDim + { + //- Decompose cells such that all cell originating from single cell + // end up on same processor + type refinementHistoryMultiDim; + } +} +// ************************************************************************* // diff --git a/tutorials/damBreak/system/blockMeshDict b/tutorials/damBreak/system/blockMeshDict new file mode 100644 index 0000000..f32507b --- /dev/null +++ b/tutorials/damBreak/system/blockMeshDict @@ -0,0 +1,114 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: v2006 | +| \\ / A nd | Website: www.openfoam.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object blockMeshDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +scale 0.146; + +vertices +( + (0 0 0) + (2 0 0) + (2.16438 0 0) + (4 0 0) + (0 0.32876 0) + (2 0.32876 0) + (2.16438 0.32876 0) + (4 0.32876 0) + (0 4 0) + (2 4 0) + (2.16438 4 0) + (4 4 0) + (0 0 0.1) + (2 0 0.1) + (2.16438 0 0.1) + (4 0 0.1) + (0 0.32876 0.1) + (2 0.32876 0.1) + (2.16438 0.32876 0.1) + (4 0.32876 0.1) + (0 4 0.1) + (2 4 0.1) + (2.16438 4 0.1) + (4 4 0.1) +); + +blocks +( + hex (0 1 5 4 12 13 17 16) (12 8 1) simpleGrading (1 1 1) + hex (2 3 7 6 14 15 19 18) (19 8 1) simpleGrading (1 1 1) + hex (4 5 9 8 16 17 21 20) (12 42 1) simpleGrading (1 1 1) + hex (5 6 10 9 17 18 22 21) (4 42 1) simpleGrading (1 1 1) + hex (6 7 11 10 18 19 23 22) (19 42 1) simpleGrading (1 1 1) + + //hex (0 1 5 4 12 13 17 16) (46 16 1) simpleGrading (1 1 1) // std + //hex (2 3 7 6 14 15 19 18) (38 16 1) simpleGrading (1 1 1) + //hex (4 5 9 8 16 17 21 20) (46 84 1) simpleGrading (1 1 1) + //hex (5 6 10 9 17 18 22 21) (8 84 1) simpleGrading (1 1 1) + //hex (6 7 11 10 18 19 23 22) (38 84 1) simpleGrading (1 1 1) +); + +edges +( +); + +boundary +( + leftWall + { + type wall; + faces + ( + (0 12 16 4) + (4 16 20 8) + ); + } + rightWall + { + type wall; + faces + ( + (7 19 15 3) + (11 23 19 7) + ); + } + lowerWall + { + type wall; + faces + ( + (0 1 13 12) + (1 5 17 13) + (5 6 18 17) + (2 14 18 6) + (2 3 15 14) + ); + } + atmosphere + { + type patch; + faces + ( + (8 20 21 9) + (9 21 22 10) + (10 22 23 11) + ); + } +); + +mergePatchPairs +( +); + +// ************************************************************************* // diff --git a/tutorials/damBreak/system/controlDict b/tutorials/damBreak/system/controlDict new file mode 100644 index 0000000..ec6a244 --- /dev/null +++ b/tutorials/damBreak/system/controlDict @@ -0,0 +1,86 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: v2006 | +| \\ / A nd | Website: www.openfoam.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object controlDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +application interIsoFoam; // interIsoFoam interFlow + +startFrom latestTime; + +startTime 0; + +stopAt endTime; + +endTime 1; + +deltaT 1e-6; + +//writeControl timeStep; +writeControl adjustableRunTime; + +writeInterval 0.02; + +purgeWrite 0; + +writeFormat ascii; + +writePrecision 6; + +writeCompression off; + +timeFormat general; + +timePrecision 6; + +runTimeModifiable yes; + +adjustTimeStep yes; + +maxCo 10; + +maxAlphaCo 0.5; + +maxDeltaT 1; + +libs +( + "libdynamicLoadBalanceFvMesh.so" // All AMR and LB enhancements +); + +functions +{ + surfaces + { + type surfaces; + libs (geometricVoF sampling); + writeControl writeTime; + + surfaceFormat vtp; + fields (p U); + + interpolationScheme cell; + + surfaces + { + freeSurf + { + type interface; + interpolate false; + } + } + } +} + +// ************************************************************************* // diff --git a/tutorials/damBreak/system/decomposeParDict b/tutorials/damBreak/system/decomposeParDict new file mode 100644 index 0000000..bc4d353 --- /dev/null +++ b/tutorials/damBreak/system/decomposeParDict @@ -0,0 +1,50 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.5 | +| \\ / A nd | Web: http://www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object decomposeParDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +numberOfSubdomains 4; + +method scotch; + +constraints +{ + refinementHistoryMultiDim + { + //- Decompose cells such that all cell originating from single cell + // end up on same processor + type refinementHistoryMultiDim; + } +} + +simpleCoeffs +{ + n (2 2 1); + delta 0.001; +} + +hierarchicalCoeffs +{ + n (2 2 1); + delta 0.001; + order xyz; +} + +distributed no; + +roots +( +); + +// ************************************************************************* // diff --git a/tutorials/damBreak/system/fvSchemes b/tutorials/damBreak/system/fvSchemes new file mode 100644 index 0000000..8f3cd6d --- /dev/null +++ b/tutorials/damBreak/system/fvSchemes @@ -0,0 +1,59 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: v1812 | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object fvSchemes; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +ddtSchemes +{ + default Euler; +} + +gradSchemes +{ + default pointCellsLeastSquares; +} + +divSchemes +{ + div(rhoPhi,U) Gauss upwind; + div(phi,alpha) Gauss vanLeer; + div(phirb,alpha) Gauss linear; + div(phi,k) Gauss upwind; + div(phi,omega) Gauss upwind; + div(((rho*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/damBreak/system/fvSolution b/tutorials/damBreak/system/fvSolution new file mode 100644 index 0000000..e11b36e --- /dev/null +++ b/tutorials/damBreak/system/fvSolution @@ -0,0 +1,93 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: v1812 | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object fvSolution; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +solvers +{ + "alpha.water.*" + { + nAlphaCorr 1; + nAlphaSubCycles 3; + cAlpha 1; + advectionScheme isoAdvection; + reconstructionScheme gradAlpha; + vof2IsoTol 1e-8; + surfCellTol 1e-6; + } + + p_rgh + { + solver GAMG; + tolerance 1e-08; + relTol 0.0001; + smoother DIC; + cacheAgglomeration no; + } + + p_rghFinal + { + $p_rgh; + relTol 0; + } + + "pcorr.*" + { + $p_rghFinal; + tolerance 1e-08; + cacheAgglomeration no; + relTol 0; + } + + U + { + solver smoothSolver; + smoother GaussSeidel; + tolerance 1e-06; + relTol 0; + nSweeps 1; + } + + UFinal + { + solver smoothSolver; + smoother GaussSeidel; + tolerance 1e-06; + relTol 0; + nSweeps 1; + } + + "(k|omega|B|nuTilda).*" + { + solver smoothSolver; + smoother symGaussSeidel; + tolerance 1e-08; + relTol 0; + } +} + +PIMPLE +{ + momentumPredictor yes; + nCorrectors 3; + nNonOrthogonalCorrectors 0; + correctPhi yes; + + pRefPoint (0.51 0.51 0.51); + pRefValue 0; +} + + +// ************************************************************************* // diff --git a/tutorials/damBreak/system/setFieldsDict b/tutorials/damBreak/system/setFieldsDict new file mode 100644 index 0000000..92e1e30 --- /dev/null +++ b/tutorials/damBreak/system/setFieldsDict @@ -0,0 +1,36 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: v2006 | +| \\ / A nd | Website: www.openfoam.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object setFieldsDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +defaultFieldValues +( + volScalarFieldValue alpha.water 0 +); + +regions +( + boxToCell + { + box (0 0 -1) (0.1461 0.292 1); + fieldValues + ( + volScalarFieldValue alpha.water 1 + ); + } +); + + +// ************************************************************************* // diff --git a/tutorials/damBreakWithObstacle/system/balanceParDict b/tutorials/damBreakWithObstacle/system/balanceParDict index 6e7777c..947fd8e 100755 --- a/tutorials/damBreakWithObstacle/system/balanceParDict +++ b/tutorials/damBreakWithObstacle/system/balanceParDict @@ -15,7 +15,7 @@ FoamFile } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -numberOfSubdomains 4; +numberOfSubdomains 6; method ptscotch; //clsutered //scotch diff --git a/tutorials/damBreakWithObstacle/system/controlDict b/tutorials/damBreakWithObstacle/system/controlDict index d8d2675..f5cc36d 100644 --- a/tutorials/damBreakWithObstacle/system/controlDict +++ b/tutorials/damBreakWithObstacle/system/controlDict @@ -15,7 +15,7 @@ FoamFile } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -application interFoam; // interFlow works with VoFLibrary +application interIsoFoam; // interFlow works with VoFLibrary startFrom startTime; diff --git a/tutorials/damBreakWithObstacle/system/decomposeParDict b/tutorials/damBreakWithObstacle/system/decomposeParDict index bc4d353..ee741ae 100644 --- a/tutorials/damBreakWithObstacle/system/decomposeParDict +++ b/tutorials/damBreakWithObstacle/system/decomposeParDict @@ -14,7 +14,7 @@ FoamFile } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -numberOfSubdomains 4; +numberOfSubdomains 6; method scotch; From 5b84afb135ea8d13139964985684018122596b48 Mon Sep 17 00:00:00 2001 From: HenningScheufler Date: Mon, 4 Jan 2021 15:14:56 +0100 Subject: [PATCH 02/10] BUG: wrong substitution deprecated method autoPtr->empty() --- src/dynamicLoadBalanceFvMesh/hexRef/hexRef.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/dynamicLoadBalanceFvMesh/hexRef/hexRef.C b/src/dynamicLoadBalanceFvMesh/hexRef/hexRef.C index d3d5c6c..a8f8340 100755 --- a/src/dynamicLoadBalanceFvMesh/hexRef/hexRef.C +++ b/src/dynamicLoadBalanceFvMesh/hexRef/hexRef.C @@ -3537,7 +3537,7 @@ void Foam::hexRef::checkRefinementLevels const Foam::cellShapeList& Foam::hexRef::cellShapes() const { - if (cellShapesPtr_) + if (!cellShapesPtr_) { if (debug) { From b5f4d26ba93700c5f041f806a38caea47790b2d1 Mon Sep 17 00:00:00 2001 From: HenningScheufler Date: Thu, 4 Feb 2021 20:44:21 +0100 Subject: [PATCH 03/10] update readme --- README.md | 82 ++++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 75 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 53ee90b..dcc165b 100644 --- a/README.md +++ b/README.md @@ -11,21 +11,26 @@ Rettenmaier, Daniel, et al. "Load balanced 2D and 3D adaptive mesh refinement in link: https://www.sciencedirect.com/science/article/pii/S2352711018301699 -port to the OpenFOAM+ version v1812 and v2006 +port to the OpenFOAM+ version v1812 and v2006,v2012 refinement selection algoritm is based on foam extended 4.1 ## Getting Started -install OpenFOAM v1812 +install OpenFOAM v1812 and v2006 compile the library - +``` ./Allwmake - +``` +in case of v2012: +``` +git checkout v2012 +./Allwmake +``` ### Prerequisites -Requires OpenFOAM v1812: +Requires OpenFOAM v1812 or v2006,v2012: ``` https://www.openfoam.com/download/release-history.php @@ -40,11 +45,16 @@ https://www.openfoam.com/download/release-history.php ``` ### Usage -add to contolDict: +add following lines to the contolDict: ``` libs ( - "libdynamicLoadBalanceFvMesh.so" + "libdynamicLoadBalanceFvMesh.so" +); +or depending on the openfoam version +libs +( + dynamicLoadBalanceFvMesh ); ``` @@ -115,6 +125,64 @@ constraints } // ************************************************************************* // ``` +### refinement selection + +the cells to refine are specified in the adaptCriteria dictionary +``` +adaptCriteria +{ + type fieldBounds; // options fieldBounds geometric + fieldName alpha.water; + lowerBound 0.001; + upperBound 0.999; + nLayer 2; // extends refinement zone by two layers + maxCellLevel 2; // default value very high number limits the maxium refinement level + minCellLevel 0; // default value 0 specify minimum refinement level + negate false; // default false // negates the selection +} +``` +the composedAdaptCriteria enables us to combine the simple functions above by logial operator: +``` +adaptCriteria +{ + + type composedAdaptCriteria; + operation or; // and or xor + criteria + ( + interface // refine to the maxRefinement + { + type fieldBounds; + fieldName alpha.water; + lowerBound 0.01; + upperBound 0.99; + nLayer 2; + } + fluid // refLvl 2 in fluid + { + type fieldBounds; + fieldName alpha.water; + lowerBound 0.01; + upperBound 2; + maxCellLevel 2; + } + ); +} +``` +This way we can specify a higher refinement level at the interface than in the fluid or in combination with the geometric refinement option chose only to refine in a given region. Note that the composedAdaptCriteria can also consists of multiple composedAdaptCriteria + + +### Known Issues + +* boundary condition that use function e.g. uniformFixedValue + crash if the table function is used see issue #2 + + Solution: the issue can be resolved by switching to v2012 + +* the load balancing crashes if a domain with no cells is created + + Solution: use more cells or try a different method in balanceParDict kahip seems to work better than ptscotch +I ## License From 93db74b2fd02c665fc7f199eb571fd99c4ed35a0 Mon Sep 17 00:00:00 2001 From: "Scheufler, Henning" Date: Tue, 25 Jan 2022 14:25:55 +0100 Subject: [PATCH 04/10] FIX: compiles with clang --- .../dynamicMultiDimRefineFvMeshTemplates.C | 2 +- test/test-2DHex/constant/transportProperties | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/dynamicLoadBalanceFvMesh/dynamicMultiDimRefineFvMesh/dynamicMultiDimRefineFvMeshTemplates.C b/src/dynamicLoadBalanceFvMesh/dynamicMultiDimRefineFvMesh/dynamicMultiDimRefineFvMeshTemplates.C index aeb9e0b..78d3bdb 100644 --- a/src/dynamicLoadBalanceFvMesh/dynamicMultiDimRefineFvMesh/dynamicMultiDimRefineFvMeshTemplates.C +++ b/src/dynamicLoadBalanceFvMesh/dynamicMultiDimRefineFvMesh/dynamicMultiDimRefineFvMeshTemplates.C @@ -178,7 +178,7 @@ void Foam::dynamicMultiDimRefineFvMesh::mapNewInternalFaces // Convert to intensive and non oriented // sqr(magSf) can throw float point exception //NormalGeoField fFld(sFld*Sf/Foam::sqr(magSf)); - surfaceVectorField n = Sf/magSf; + surfaceVectorField n(Sf/magSf); NormalGeoField fFld(sFld*n/magSf); // Interpolate diff --git a/test/test-2DHex/constant/transportProperties b/test/test-2DHex/constant/transportProperties index edaff1b..6e024ec 100644 --- a/test/test-2DHex/constant/transportProperties +++ b/test/test-2DHex/constant/transportProperties @@ -37,7 +37,7 @@ sigma sigma [ 1 0 -2 0 0 0 0 ] 0.07; surfaceForces { sigma 0.07; - curvatureModel gradAlpha; + surfaceTensionForceModel gradAlpha; accelerationModel gravity; gravity ( 0 -9.81 0 ); deltaFunctionModel alphaCSF; From b03b088d2c1678a5bab2b63348a60dbb9bc67742 Mon Sep 17 00:00:00 2001 From: Kazunobu Ndong <33208377+ndkazu@users.noreply.github.com> Date: Tue, 15 Mar 2022 17:30:38 +0900 Subject: [PATCH 05/10] Update adaptCriteria.C --- src/dynamicLoadBalanceFvMesh/adaptCriteria/adaptCriteria.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/dynamicLoadBalanceFvMesh/adaptCriteria/adaptCriteria.C b/src/dynamicLoadBalanceFvMesh/adaptCriteria/adaptCriteria.C index 3484e9b..ee9a34a 100644 --- a/src/dynamicLoadBalanceFvMesh/adaptCriteria/adaptCriteria.C +++ b/src/dynamicLoadBalanceFvMesh/adaptCriteria/adaptCriteria.C @@ -67,7 +67,7 @@ Foam::autoPtr Foam::adaptCriteria::New const word adaptCriteriaTypeName(dict.lookup("type")); Info<< "Creating adaptCriteria " << adaptCriteriaTypeName << endl; - dictionaryConstructorTable::iterator cstrIter = + auto cstrIter = dictionaryConstructorTablePtr_->find(adaptCriteriaTypeName); if (cstrIter == dictionaryConstructorTablePtr_->end()) From 2e9aea5c73fdaa24b222520b1eefa3c4a641b0fa Mon Sep 17 00:00:00 2001 From: Kazunobu Ndong <33208377+ndkazu@users.noreply.github.com> Date: Tue, 15 Mar 2022 17:33:19 +0900 Subject: [PATCH 06/10] Update hexRefNew.C --- src/dynamicLoadBalanceFvMesh/hexRef/hexRefNew.C | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/dynamicLoadBalanceFvMesh/hexRef/hexRefNew.C b/src/dynamicLoadBalanceFvMesh/hexRef/hexRefNew.C index 4198495..eada06e 100755 --- a/src/dynamicLoadBalanceFvMesh/hexRef/hexRefNew.C +++ b/src/dynamicLoadBalanceFvMesh/hexRef/hexRefNew.C @@ -61,7 +61,7 @@ Foam::autoPtr Foam::hexRef::New hexRefTypeName = "hexRef4"; } - meshConstructorTable::iterator hexRefIter = + auto hexRefIter = meshConstructorTablePtr_->find(hexRefTypeName); if (hexRefIter == meshConstructorTablePtr_->end()) @@ -112,7 +112,7 @@ Foam::autoPtr Foam::hexRef::New hexRefTypeName = "hexRef4"; } - levelsHistConstructorTable::iterator hexRefIter = + auto hexRefIter = levelsHistConstructorTablePtr_->find(hexRefTypeName); if (hexRefIter == levelsHistConstructorTablePtr_->end()) @@ -162,7 +162,7 @@ Foam::autoPtr Foam::hexRef::New hexRefTypeName = "hexRef4"; } - levelsConstructorTable::iterator hexRefIter = + auto hexRefIter = levelsConstructorTablePtr_->find(hexRefTypeName); if (hexRefIter == levelsConstructorTablePtr_->end()) From 0805e8556128cb5f8c359231f36f7e17e6730553 Mon Sep 17 00:00:00 2001 From: "Scheufler, Henning" Date: Tue, 19 Apr 2022 08:02:46 +0200 Subject: [PATCH 07/10] FIX: capillaryRiseAxi --- tutorials/capillaryRiseAxi/Allrun | 1 + .../capillaryRiseAxi/constant/dynamicMeshDict | 1 + .../constant/transportProperties | 24 ++++---- .../constant/turbulenceProperties | 2 +- .../capillaryRiseAxi/system/balanceParDict | 13 +++- .../capillaryRiseAxi/system/collapseDict | 28 +++++++++ .../capillaryRiseAxi/system/decomposeParDict | 8 +-- tutorials/capillaryRiseAxi/system/fvSchemes | 26 ++++---- tutorials/capillaryRiseAxi/system/fvSolution | 59 +++++++++++-------- 9 files changed, 103 insertions(+), 59 deletions(-) create mode 100644 tutorials/capillaryRiseAxi/system/collapseDict diff --git a/tutorials/capillaryRiseAxi/Allrun b/tutorials/capillaryRiseAxi/Allrun index 651c579..63c1455 100755 --- a/tutorials/capillaryRiseAxi/Allrun +++ b/tutorials/capillaryRiseAxi/Allrun @@ -5,6 +5,7 @@ cd ${0%/*} || exit 1 # run from this directory . $WM_PROJECT_DIR/bin/tools/RunFunctions runApplication blockMesh +runApplication collapseEdges -overwrite restore0Dir runApplication setFields # Make .foam file diff --git a/tutorials/capillaryRiseAxi/constant/dynamicMeshDict b/tutorials/capillaryRiseAxi/constant/dynamicMeshDict index 77b4144..cd38145 100755 --- a/tutorials/capillaryRiseAxi/constant/dynamicMeshDict +++ b/tutorials/capillaryRiseAxi/constant/dynamicMeshDict @@ -28,6 +28,7 @@ adaptCriteria // upperBound 0.999; type composedAdaptCriteria; + operation and; criteria ( interface diff --git a/tutorials/capillaryRiseAxi/constant/transportProperties b/tutorials/capillaryRiseAxi/constant/transportProperties index 406a649..2dd40ce 100755 --- a/tutorials/capillaryRiseAxi/constant/transportProperties +++ b/tutorials/capillaryRiseAxi/constant/transportProperties @@ -1,8 +1,8 @@ /*--------------------------------*- C++ -*----------------------------------*\ | ========= | | -| \\ / F ield | OpenFOAM Extend Project: Open Source CFD | -| \\ / O peration | Version: 1.6-ext | -| \\ / A nd | Web: www.extend-project.de | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: v1812 | +| \\ / A nd | Web: www.OpenFOAM.com | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile @@ -18,20 +18,22 @@ FoamFile phases (water air); - -//1bar, 20°C -water // 10 times more viscose +water { transportModel Newtonian; - nu nu [ 0 2 -1 0 0 0 0 ] 10.04e-6; - rho rho [ 1 -3 0 0 0 0 0 ] 9.982e2; + nu 1e-06; + rho 1000; } air { transportModel Newtonian; - nu nu [ 0 2 -1 0 0 0 0 ] 15.35e-6; - rho rho [ 1 -3 0 0 0 0 0 ] 1.188; + nu 1.48e-05; + rho 1; } -sigma sigma [ 1 0 -2 0 0 0 0 ] 72.75e-3; \ No newline at end of file +sigma 0.07; + + +surfaceForces +// ************************************************************************* // diff --git a/tutorials/capillaryRiseAxi/constant/turbulenceProperties b/tutorials/capillaryRiseAxi/constant/turbulenceProperties index 7f66cf2..50d6d7f 100755 --- a/tutorials/capillaryRiseAxi/constant/turbulenceProperties +++ b/tutorials/capillaryRiseAxi/constant/turbulenceProperties @@ -1,7 +1,7 @@ /*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: 1.7.1 | +| \\ / O peration | Version: v1812 | | \\ / A nd | Web: www.OpenFOAM.com | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ diff --git a/tutorials/capillaryRiseAxi/system/balanceParDict b/tutorials/capillaryRiseAxi/system/balanceParDict index 027aef5..947fd8e 100755 --- a/tutorials/capillaryRiseAxi/system/balanceParDict +++ b/tutorials/capillaryRiseAxi/system/balanceParDict @@ -15,17 +15,24 @@ FoamFile } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -numberOfSubdomains 4; +numberOfSubdomains 6; method ptscotch; //clsutered //scotch + +simpleCoeffs +{ + n (1 4 1); + delta 0.001; +} + constraints { - refinementHistory + refinementHistoryMultiDim { //- Decompose cells such that all cell originating from single cell // end up on same processor - type refinementHistory; + type refinementHistoryMultiDim; } } // ************************************************************************* // diff --git a/tutorials/capillaryRiseAxi/system/collapseDict b/tutorials/capillaryRiseAxi/system/collapseDict new file mode 100644 index 0000000..5cc6ec7 --- /dev/null +++ b/tutorials/capillaryRiseAxi/system/collapseDict @@ -0,0 +1,28 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: v2106 | +| \\ / A nd | Website: www.openfoam.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object collapseDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +collapseEdgesCoeffs +{ + // Edges shorter than this absolute value will be merged + minimumEdgeLength 2e-7; + + // The maximum angle between two edges that share a point attached to + // no other edges + maximumMergeAngle 5; +} + + +// ************************************************************************* // diff --git a/tutorials/capillaryRiseAxi/system/decomposeParDict b/tutorials/capillaryRiseAxi/system/decomposeParDict index 14380ec..ee741ae 100755 --- a/tutorials/capillaryRiseAxi/system/decomposeParDict +++ b/tutorials/capillaryRiseAxi/system/decomposeParDict @@ -14,17 +14,17 @@ FoamFile } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -numberOfSubdomains 4; +numberOfSubdomains 6; method scotch; constraints { - refinementHistory + refinementHistoryMultiDim { //- Decompose cells such that all cell originating from single cell // end up on same processor - type refinementHistory; + type refinementHistoryMultiDim; } } @@ -43,7 +43,7 @@ hierarchicalCoeffs distributed no; -roots +roots ( ); diff --git a/tutorials/capillaryRiseAxi/system/fvSchemes b/tutorials/capillaryRiseAxi/system/fvSchemes index 20bacdc..cdc1abf 100755 --- a/tutorials/capillaryRiseAxi/system/fvSchemes +++ b/tutorials/capillaryRiseAxi/system/fvSchemes @@ -1,7 +1,7 @@ /*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: 1.7.1 | +| \\ / O peration | Version: v1812 | | \\ / A nd | Web: www.OpenFOAM.com | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ @@ -22,26 +22,27 @@ ddtSchemes gradSchemes { - default pointCellsLeastSquares; //Gauss linear; - grad(U) cellMDLimited pointCellsLeastSquares 1; + default Gauss linear; } divSchemes { - div(rhoPhi,U) Gauss skewCorrected linearUpwind grad(U); - div(phi,alpha) Gauss vanLeer; //Gauss vanLeer; - div(phirb,alpha) Gauss interfaceCompression; - div(((rho*nuEff)*dev2(T(grad(U))))) Gauss skewCorrected linear; + div(rhoPhi,U) Gauss upwind; + div(phi,alpha) Gauss vanLeer; + div(phirb,alpha) Gauss linear; + div(phi,k) Gauss upwind; + div(phi,omega) Gauss upwind; + div(((rho*nuEff)*dev2(T(grad(U))))) Gauss linear; } laplacianSchemes { - default Gauss linear corrected; + default Gauss linear corrected; } interpolationSchemes { - default skewCorrected linear; + default linear; } snGradSchemes @@ -49,12 +50,9 @@ snGradSchemes default corrected; } -fluxRequired +wallDist { - default no; - p_rgh; - pcorr; - alpha.water; + method meshWave; } diff --git a/tutorials/capillaryRiseAxi/system/fvSolution b/tutorials/capillaryRiseAxi/system/fvSolution index a8ecf19..a32fe55 100755 --- a/tutorials/capillaryRiseAxi/system/fvSolution +++ b/tutorials/capillaryRiseAxi/system/fvSolution @@ -1,7 +1,7 @@ /*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: 1.7.1 | +| \\ / O peration | Version: v1812 | | \\ / A nd | Web: www.OpenFOAM.com | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ @@ -42,58 +42,65 @@ solvers // //-- } - - - "pcorr.*" - { - solver PCG; - preconditioner DIC; - tolerance 1e-10; - relTol 0; - } - p_rgh { - solver PCG; - preconditioner DIC; - tolerance 1e-07; - relTol 0.05; + solver GAMG; + tolerance 1e-08; + relTol 0.01; + smoother DIC; + cacheAgglomeration no; } p_rghFinal { $p_rgh; - tolerance 1e-07; + relTol 0; + } + + "pcorr.*" + { + $p_rghFinal; + tolerance 1e-08; relTol 0; } U { solver smoothSolver; - smoother symGaussSeidel; + smoother GaussSeidel; tolerance 1e-06; relTol 0; + nSweeps 1; } UFinal { - solver PBiCG; - preconditioner DILU; + solver smoothSolver; + smoother GaussSeidel; tolerance 1e-06; relTol 0; + nSweeps 1; + } + + "(k|omega|B|nuTilda).*" + { + solver smoothSolver; + smoother symGaussSeidel; + tolerance 1e-08; + relTol 0; } } PIMPLE { momentumPredictor yes; - nCorrectors 4; - nNonOrthogonalCorrectors 1; - nAlphaCorr 1; - nAlphaSubCycles 2; - cAlpha 1; -} + nCorrectors 3; + nNonOrthogonalCorrectors 0; + correctPhi yes; + pRefPoint (0.51 0.51 0.51); + pRefValue 0; +} -// *************************************************************************// +// ************************************************************************* // From 346b4aab0b7b6b2b5fa45e048991f65890ba3e90 Mon Sep 17 00:00:00 2001 From: "Scheufler, Henning" Date: Tue, 19 Apr 2022 08:03:14 +0200 Subject: [PATCH 08/10] STY: update style in capillaryRisePlates2D --- .../constant/dynamicMeshDict | 9 +- .../constant/transportProperties | 24 +++--- .../constant/turbulenceProperties | 2 +- .../system/balanceParDict | 11 ++- .../system/decomposeParDict | 4 +- .../capillaryRisePlates2D/system/fvSchemes | 25 +++--- .../capillaryRisePlates2D/system/fvSolution | 82 +++++++++---------- 7 files changed, 75 insertions(+), 82 deletions(-) diff --git a/tutorials/capillaryRisePlates2D/constant/dynamicMeshDict b/tutorials/capillaryRisePlates2D/constant/dynamicMeshDict index 44a457c..7d1da04 100755 --- a/tutorials/capillaryRisePlates2D/constant/dynamicMeshDict +++ b/tutorials/capillaryRisePlates2D/constant/dynamicMeshDict @@ -22,12 +22,9 @@ allowableImbalance 0.10; adaptCriteria { - // type fieldBounds; - // fieldName alpha.water; - // lowerBound 0.001; - // upperBound 0.999; - + type composedAdaptCriteria; + operation or; criteria ( interface @@ -84,4 +81,4 @@ dumpLevel true; -// ************************************************************************* // \ No newline at end of file +// ************************************************************************* // diff --git a/tutorials/capillaryRisePlates2D/constant/transportProperties b/tutorials/capillaryRisePlates2D/constant/transportProperties index 406a649..b25e325 100755 --- a/tutorials/capillaryRisePlates2D/constant/transportProperties +++ b/tutorials/capillaryRisePlates2D/constant/transportProperties @@ -1,8 +1,8 @@ /*--------------------------------*- C++ -*----------------------------------*\ | ========= | | -| \\ / F ield | OpenFOAM Extend Project: Open Source CFD | -| \\ / O peration | Version: 1.6-ext | -| \\ / A nd | Web: www.extend-project.de | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: v1812 | +| \\ / A nd | Web: www.OpenFOAM.com | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile @@ -15,23 +15,23 @@ FoamFile } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - phases (water air); - -//1bar, 20°C -water // 10 times more viscose +water { transportModel Newtonian; - nu nu [ 0 2 -1 0 0 0 0 ] 10.04e-6; - rho rho [ 1 -3 0 0 0 0 0 ] 9.982e2; + nu 1e-06; + rho 1000; } air { transportModel Newtonian; - nu nu [ 0 2 -1 0 0 0 0 ] 15.35e-6; - rho rho [ 1 -3 0 0 0 0 0 ] 1.188; + nu 1.48e-05; + rho 1; } -sigma sigma [ 1 0 -2 0 0 0 0 ] 72.75e-3; \ No newline at end of file +sigma 0.07; + + +// ************************************************************************* // diff --git a/tutorials/capillaryRisePlates2D/constant/turbulenceProperties b/tutorials/capillaryRisePlates2D/constant/turbulenceProperties index 7f66cf2..50d6d7f 100755 --- a/tutorials/capillaryRisePlates2D/constant/turbulenceProperties +++ b/tutorials/capillaryRisePlates2D/constant/turbulenceProperties @@ -1,7 +1,7 @@ /*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: 1.7.1 | +| \\ / O peration | Version: v1812 | | \\ / A nd | Web: www.OpenFOAM.com | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ diff --git a/tutorials/capillaryRisePlates2D/system/balanceParDict b/tutorials/capillaryRisePlates2D/system/balanceParDict index 22d7f87..947fd8e 100755 --- a/tutorials/capillaryRisePlates2D/system/balanceParDict +++ b/tutorials/capillaryRisePlates2D/system/balanceParDict @@ -1,7 +1,7 @@ /*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: v1812 | +| \\ / O peration | Version: 2.1.1 | | \\ / A nd | Web: www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ @@ -15,10 +15,17 @@ FoamFile } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -numberOfSubdomains 4; +numberOfSubdomains 6; method ptscotch; //clsutered //scotch + +simpleCoeffs +{ + n (1 4 1); + delta 0.001; +} + constraints { refinementHistoryMultiDim diff --git a/tutorials/capillaryRisePlates2D/system/decomposeParDict b/tutorials/capillaryRisePlates2D/system/decomposeParDict index fed43ff..a9754c8 100755 --- a/tutorials/capillaryRisePlates2D/system/decomposeParDict +++ b/tutorials/capillaryRisePlates2D/system/decomposeParDict @@ -1,7 +1,7 @@ /*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: v1812 | +| \\ / O peration | Version: 1.5 | | \\ / A nd | Web: http://www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ @@ -14,7 +14,7 @@ FoamFile } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -numberOfSubdomains 4; +numberOfSubdomains 6; method scotch; diff --git a/tutorials/capillaryRisePlates2D/system/fvSchemes b/tutorials/capillaryRisePlates2D/system/fvSchemes index abdde5f..4926053 100755 --- a/tutorials/capillaryRisePlates2D/system/fvSchemes +++ b/tutorials/capillaryRisePlates2D/system/fvSchemes @@ -22,27 +22,27 @@ ddtSchemes gradSchemes { - default leastSquares; //Gauss linear; - //default cellMDLimited Gauss linear 0.5; - grad(alpha1) Gauss linear; + default Gauss linear; } divSchemes { - div(rhoPhi,U) Gauss skewCorrected linearUpwind grad(U); - div(phi,alpha) Gauss vanLeer; //Gauss vanLeer; - div(phirb,alpha) Gauss interfaceCompression; - div(((rho*nuEff)*dev2(T(grad(U))))) Gauss skewCorrected linear; + div(rhoPhi,U) Gauss upwind; + div(phi,alpha) Gauss vanLeer; + div(phirb,alpha) Gauss linear; + div(phi,k) Gauss upwind; + div(phi,omega) Gauss upwind; + div(((rho*nuEff)*dev2(T(grad(U))))) Gauss linear; } laplacianSchemes { - default Gauss linear corrected; + default Gauss linear corrected; } interpolationSchemes { - default skewCorrected linear; + default linear; } snGradSchemes @@ -50,12 +50,9 @@ snGradSchemes default corrected; } -fluxRequired +wallDist { - default no; - p_rgh; - pcorr; - alpha.water; + method meshWave; } diff --git a/tutorials/capillaryRisePlates2D/system/fvSolution b/tutorials/capillaryRisePlates2D/system/fvSolution index 651bec0..a19526b 100755 --- a/tutorials/capillaryRisePlates2D/system/fvSolution +++ b/tutorials/capillaryRisePlates2D/system/fvSolution @@ -19,82 +19,74 @@ solvers { "alpha.water.*" { - nAlphaCorr 2; - nAlphaSubCycles 2; + nAlphaCorr 1; + nAlphaSubCycles 3; cAlpha 1; - } - - "pcorr.*" - { - solver PCG; - preconditioner DIC; - tolerance 1e-10; - relTol 0; + advectionScheme isoAdvection; + reconstructionScheme plicRDF; + vof2IsoTol 1e-8; + surfCellTol 1e-6; } p_rgh { - solver PCG; - preconditioner DIC; - tolerance 1e-07; - relTol 0.05; + solver GAMG; + tolerance 1e-08; + relTol 0.01; + smoother DIC; + cacheAgglomeration no; } p_rghFinal { $p_rgh; - tolerance 1e-07; + relTol 0; + } + + "pcorr.*" + { + $p_rghFinal; + tolerance 1e-08; relTol 0; } U { solver smoothSolver; - smoother symGaussSeidel; + smoother GaussSeidel; tolerance 1e-06; relTol 0; + nSweeps 1; } UFinal { - solver PBiCG; - preconditioner DILU; + solver smoothSolver; + smoother GaussSeidel; tolerance 1e-06; relTol 0; + nSweeps 1; } -} - -PIMPLE -{ - momentumPredictor yes; - nCorrectors 4; - nNonOrthogonalCorrectors 1; - nAlphaCorr 1; - nAlphaSubCycles 2; - cAlpha 1; -} -relaxationFactors -{ - fields - { - } - equations + "(k|omega|B|nuTilda).*" { - ".*" 1; + solver smoothSolver; + smoother symGaussSeidel; + tolerance 1e-08; + relTol 0; } } -interfaceReconstruction +PIMPLE { - interpolationMethod inverseDistance2; - //interpolationMethod linearFit2; //- gives better results on unstructured meshes - smoothSym no; //- smooth the curvature at symmetryPlanePlanes - distanceTreshold 2e-4; //- important if dynamicMesh is used based on distance - thinFilm no; //- do not delete nHat at wall and at symmetryPlanePlanes - // if there is only a thin liquid or vapor film -} + momentumPredictor yes; + nCorrectors 3; + nNonOrthogonalCorrectors 0; + correctPhi yes; + pRefPoint (0.51 0.51 0.51); + pRefValue 0; +} -// *************************************************************************// +// ************************************************************************* // From 114cc7b587237324af3a7f98d262d635c5e64ff2 Mon Sep 17 00:00:00 2001 From: lianxiali Date: Tue, 2 Jul 2024 17:55:59 -0400 Subject: [PATCH 09/10] fixed faceList for OF2306 --- .../fvMeshDistributeAddPatch/fvMeshDistributeAddPatch.C | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/dynamicLoadBalanceFvMesh/dynamicMultiDimRefineBalancedFvMesh/fvMeshDistributeAddPatch/fvMeshDistributeAddPatch.C b/src/dynamicLoadBalanceFvMesh/dynamicMultiDimRefineBalancedFvMesh/fvMeshDistributeAddPatch/fvMeshDistributeAddPatch.C index e114108..e34246c 100644 --- a/src/dynamicLoadBalanceFvMesh/dynamicMultiDimRefineBalancedFvMesh/fvMeshDistributeAddPatch/fvMeshDistributeAddPatch.C +++ b/src/dynamicLoadBalanceFvMesh/dynamicMultiDimRefineBalancedFvMesh/fvMeshDistributeAddPatch/fvMeshDistributeAddPatch.C @@ -1479,7 +1479,8 @@ void Foam::fvMeshDistributeAddPatch::sendMesh // Send toDomain << mesh.points() - << CompactListList(mesh.faces()) +// << CompactListList(mesh.faces())//original + << CompactListList