From 2d799c2cdf746297e5e3afb23ee4ce1f59a73dd9 Mon Sep 17 00:00:00 2001 From: Hrvoje Jasak Date: Tue, 30 Apr 2019 15:07:08 +0100 Subject: [PATCH 1/5] Bugfix: bad addressing in analysis of coupled boundar IBM cut --- .../immersedBoundaryPolyPatch.C | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/immersedBoundary/immersedBoundary/immersedBoundaryPolyPatch/immersedBoundaryPolyPatch.C b/src/immersedBoundary/immersedBoundary/immersedBoundaryPolyPatch/immersedBoundaryPolyPatch.C index 7d6d32938..f63398ff4 100644 --- a/src/immersedBoundary/immersedBoundary/immersedBoundaryPolyPatch/immersedBoundaryPolyPatch.C +++ b/src/immersedBoundary/immersedBoundary/immersedBoundaryPolyPatch/immersedBoundaryPolyPatch.C @@ -674,7 +674,7 @@ void Foam::immersedBoundaryPolyPatch::calcImmersedBoundary() const { // Direct face cut, coupled on live side - // Get face index. Noye the difference between faceI + // Get face index. Note the difference between faceI // and patchFaceI const label faceI = bMesh[patchI].start() + patchFaceI; @@ -945,8 +945,8 @@ void Foam::immersedBoundaryPolyPatch::calcImmersedBoundary() const // Wet on wet if ( - intersectedCell[patchFaceI] == immersedPoly::WET - && intersectedCell[patchFaceI] == immersedPoly::WET + curOwnCut[patchFaceI] == immersedPoly::WET + && curNbrCut[patchFaceI] == immersedPoly::WET ) { intersectedFace[patchStart + patchFaceI] = @@ -956,8 +956,8 @@ void Foam::immersedBoundaryPolyPatch::calcImmersedBoundary() const // Dry on dry if ( - intersectedCell[patchFaceI] == immersedPoly::DRY - && intersectedCell[patchFaceI] == immersedPoly::DRY + curOwnCut[patchFaceI] == immersedPoly::DRY + && curNbrCut[patchFaceI] == immersedPoly::DRY ) { intersectedFace[patchStart + patchFaceI] = @@ -969,12 +969,12 @@ void Foam::immersedBoundaryPolyPatch::calcImmersedBoundary() const if ( ( - intersectedCell[patchFaceI] == immersedPoly::WET - && intersectedCell[patchFaceI] == immersedPoly::CUT + curOwnCut[patchFaceI] == immersedPoly::WET + && curNbrCut[patchFaceI] == immersedPoly::CUT ) || ( - intersectedCell[patchFaceI] == immersedPoly::CUT - && intersectedCell[patchFaceI] == immersedPoly::WET + curOwnCut[patchFaceI] == immersedPoly::CUT + && curNbrCut[patchFaceI] == immersedPoly::WET ) ) { From b1e3690002c2844c4e213ff4b174126fce8fa854 Mon Sep 17 00:00:00 2001 From: Hrvoje Jasak Date: Tue, 30 Apr 2019 15:43:01 +0100 Subject: [PATCH 2/5] Fixed fallthrough attribute --- src/foam/primitives/hashes/Hasher/Hasher.C | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/foam/primitives/hashes/Hasher/Hasher.C b/src/foam/primitives/hashes/Hasher/Hasher.C index e26ba7262..3ea7b6dd1 100644 --- a/src/foam/primitives/hashes/Hasher/Hasher.C +++ b/src/foam/primitives/hashes/Hasher/Hasher.C @@ -457,8 +457,7 @@ static unsigned jenkins_hashbig case 4 : a += k[3]; [[fallthrough]]; case 3 : a += static_cast(k[2]) << 8; [[fallthrough]]; case 2 : a += static_cast(k[1]) << 16; [[fallthrough]]; - case 1 : a += static_cast(k[0]) << 24; [[fallthrough]]; - break; + case 1 : a += static_cast(k[0]) << 24; break; case 0 : return c; } } From e63cc43dfae0295b4722b2b490559bbb81e83e89 Mon Sep 17 00:00:00 2001 From: Hrvoje Jasak Date: Tue, 30 Apr 2019 15:43:38 +0100 Subject: [PATCH 3/5] Reverting unnecessary DLB change by HR --- .../finiteVolume/fvSchemes/fvSchemes.C | 29 +++++++++---------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/src/finiteVolume/finiteVolume/fvSchemes/fvSchemes.C b/src/finiteVolume/finiteVolume/fvSchemes/fvSchemes.C index b0533cd44..c9050cd4d 100644 --- a/src/finiteVolume/finiteVolume/fvSchemes/fvSchemes.C +++ b/src/finiteVolume/finiteVolume/fvSchemes/fvSchemes.C @@ -70,12 +70,7 @@ Foam::fvSchemes::fvSchemes(const objectRegistry& obr) "fvSchemes", obr.time().system(), obr, - ( - obr.readOpt() == IOobject::MUST_READ - || obr.readOpt() == IOobject::READ_IF_PRESENT - ? IOobject::MUST_READ_IF_MODIFIED - : obr.readOpt() - ), + IOobject::READ_IF_PRESENT_IF_MODIFIED, // Allow default dictionary creation IOobject::NO_WRITE ) ), @@ -173,17 +168,21 @@ Foam::fvSchemes::fvSchemes(const objectRegistry& obr) fluxRequired_(), // Do not read flux required option defaultFluxRequired_(false) { - // HR 21.12.18 : Writing a default fvSchemes is not useful in PLB. Please - // specify MUST_READ on obr if you need this. - if - ( - readOpt() == IOobject::MUST_READ - || readOpt() == IOobject::MUST_READ_IF_MODIFIED - || (readOpt() == IOobject::READ_IF_PRESENT && headerOk()) - ) + if (!headerOk()) { - read(); + if (debug) + { + InfoIn + ( + "fvSchemes::fvSchemes(const objectRegistry& obr)" + ) << "fvSchemes dictionary not found. Creating default." + << endl; + } + + regIOobject::write(); } + + read(); } From f97c0f81ab7c078bd73790102155ed52d2d8c533 Mon Sep 17 00:00:00 2001 From: Hrvoje Jasak Date: Tue, 30 Apr 2019 15:44:09 +0100 Subject: [PATCH 4/5] Updated I/O handling of fixed gradient and mixed FV patches for DLB. Vuko Vukcevic --- .../fixedGradient/fixedGradientFvPatchField.C | 22 +++++++++++++++---- .../basic/mixed/mixedFvPatchField.C | 17 ++++++++++---- .../basic/transform/transformFvPatchField.C | 2 +- 3 files changed, 32 insertions(+), 9 deletions(-) diff --git a/src/finiteVolume/fields/fvPatchFields/basic/fixedGradient/fixedGradientFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/basic/fixedGradient/fixedGradientFvPatchField.C index fa1a73466..3e8437239 100644 --- a/src/finiteVolume/fields/fvPatchFields/basic/fixedGradient/fixedGradientFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/basic/fixedGradient/fixedGradientFvPatchField.C @@ -67,11 +67,20 @@ fixedGradientFvPatchField::fixedGradientFvPatchField const dictionary& dict ) : - // HR 15.12.18: Must not call evaluate during construction. Read value - // instead. This is needed for PLB. - fvPatchField(p, iF, dict, true), + fvPatchField(p, iF, dict), gradient_("gradient", dict, p.size()) -{} +{ + // Call evaluate only if the value is not found. Used to avoid evaluating + // when we have incomplete meshes during Parallel Load Balancing. When + // shipping the field over to another processor, we first call write, making + // sure that the value is written and read it on the other side (see + // write member function). If this proves to be problematic, we can always + // initialize with patch internal field for the start-up. VV, 12/Apr/2019. + if (!dict.found("value")) + { + evaluate(); + } +} template @@ -190,6 +199,11 @@ void fixedGradientFvPatchField::write(Ostream& os) const { fvPatchField::write(os); gradient_.writeEntry("gradient", os); + + // Write value along with the gradient in order to avoid calling evaluate + // on construction (from dictionary constructor) for Parallel Load Balancing + // runs. See dictionary constructor for details. VV, 12/Apr/2019. + this->writeEntry("value", os); } diff --git a/src/finiteVolume/fields/fvPatchFields/basic/mixed/mixedFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/basic/mixed/mixedFvPatchField.C index e542db57b..2223cc6d4 100644 --- a/src/finiteVolume/fields/fvPatchFields/basic/mixed/mixedFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/basic/mixed/mixedFvPatchField.C @@ -54,13 +54,22 @@ mixedFvPatchField::mixedFvPatchField const dictionary& dict ) : - // HR 15.12.18: Must not call evaluate during construction. Read value - // instead. This is needed for PLB. - fvPatchField(p, iF, dict, true), + fvPatchField(p, iF, dict), refValue_("refValue", dict, p.size()), refGrad_("refGradient", dict, p.size()), valueFraction_("valueFraction", dict, p.size()) -{} +{ + // Call evaluate only if the value is not found. Used to avoid evaluating + // when we have incomplete meshes during Parallel Load Balancing. When + // shipping the field over to another processor, we first call write, making + // sure that the value is written and read it on the other side (see + // write member function). If this proves to be problematic, we can always + // initialize with patch internal field for the start-up. VV, 12/Apr/2019. + if (!dict.found("value")) + { + evaluate(); + } +} template diff --git a/src/finiteVolume/fields/fvPatchFields/basic/transform/transformFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/basic/transform/transformFvPatchField.C index 27d6dd2c2..1199f4e87 100644 --- a/src/finiteVolume/fields/fvPatchFields/basic/transform/transformFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/basic/transform/transformFvPatchField.C @@ -41,7 +41,7 @@ transformFvPatchField::transformFvPatchField const DimensionedField& iF ) : - fvPatchField(p, iF) + fvPatchField(p, iF) {} From ef519cd839915126060766a0cabf2d1faaa9f917 Mon Sep 17 00:00:00 2001 From: Hrvoje Jasak Date: Tue, 30 Apr 2019 15:44:41 +0100 Subject: [PATCH 5/5] Porting: typed label bug fix. Daniel Khazaei --- .../polyMeshModifiers/refinement/refinement/refinement.C | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/dynamicMesh/dynamicMesh/polyMeshModifiers/refinement/refinement/refinement.C b/src/dynamicMesh/dynamicMesh/polyMeshModifiers/refinement/refinement/refinement.C index eaf3e075e..63e1dd1fe 100644 --- a/src/dynamicMesh/dynamicMesh/polyMeshModifiers/refinement/refinement/refinement.C +++ b/src/dynamicMesh/dynamicMesh/polyMeshModifiers/refinement/refinement/refinement.C @@ -1343,8 +1343,8 @@ void Foam::refinement::setRefinement(polyTopoChange& ref) const mesh_, pointLevel_, maxEqOp