diff --git a/README.md b/README.md index 53ee90b..bf1309f 100644 --- a/README.md +++ b/README.md @@ -1,31 +1,36 @@ # dynamicAMR - -## Descrition +forked from [HenningScheufler/multiDimAMR](https://github.com/HenningScheufler/multiDimAMR) +## Description dynamic meshing with load balancing for hexahedral meshes in 3D and 2D -Library is based on: +The library is based on: Rettenmaier, Daniel, et al. "Load balanced 2D and 3D adaptive mesh refinement in OpenFOAM." SoftwareX 10 (2019): 100317. 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 +refinement selection algorithm is based on foam extended 4.1 ## Getting Started -install OpenFOAM v1812 - -compile the library +install OpenFOAM v1812 and v2006 +Compile the library +``` ./Allwmake - +``` +in case of v2012 and later: +``` +git checkout OF2306 +./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 the 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 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()) 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