From db246431ff0bd33d39e33d77b38a9e65d08c8d8d Mon Sep 17 00:00:00 2001 From: mattijs <mattijs> Date: Wed, 9 Dec 2020 10:23:42 +0000 Subject: [PATCH] BUG: mappedPatch: do not use sampleMesh. Fixes #1951. The helper function sampleMesh returns a reference to the sampled mesh. This will fail if that mesh is on a different world. --- ...TemperatureCoupledBaffleMixedFvPatchScalarField.C | 12 +----------- .../mappedPatches/mappedPolyPatch/mappedPatchBaseI.H | 8 ++++++-- .../laminar/waterCooler/solid/system/fvSolution | 2 +- 3 files changed, 8 insertions(+), 14 deletions(-) diff --git a/src/TurbulenceModels/compressible/turbulentFluidThermoModels/derivedFvPatchFields/turbulentTemperatureCoupledBaffleMixed/turbulentTemperatureCoupledBaffleMixedFvPatchScalarField.C b/src/TurbulenceModels/compressible/turbulentFluidThermoModels/derivedFvPatchFields/turbulentTemperatureCoupledBaffleMixed/turbulentTemperatureCoupledBaffleMixedFvPatchScalarField.C index 6cbddc56723..e1506f058c2 100644 --- a/src/TurbulenceModels/compressible/turbulentFluidThermoModels/derivedFvPatchFields/turbulentTemperatureCoupledBaffleMixed/turbulentTemperatureCoupledBaffleMixedFvPatchScalarField.C +++ b/src/TurbulenceModels/compressible/turbulentFluidThermoModels/derivedFvPatchFields/turbulentTemperatureCoupledBaffleMixed/turbulentTemperatureCoupledBaffleMixedFvPatchScalarField.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2019 OpenCFD Ltd. + Copyright (C) 2019-2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -118,16 +118,6 @@ turbulentTemperatureCoupledBaffleMixedFvPatchScalarField kappaLayers_(0), contactRes_(0.0) { - if (!isA<mappedPatchBase>(this->patch().patch())) - { - FatalErrorInFunction - << "' not type '" << mappedPatchBase::typeName << "'" - << "\n for patch " << p.name() - << " of field " << internalField().name() - << " in file " << internalField().objectPath() - << exit(FatalError); - } - if (dict.readIfPresent("thicknessLayers", thicknessLayers_)) { dict.readEntry("kappaLayers", kappaLayers_); diff --git a/src/meshTools/mappedPatches/mappedPolyPatch/mappedPatchBaseI.H b/src/meshTools/mappedPatches/mappedPolyPatch/mappedPatchBaseI.H index 350dab003fe..d89e3fb15f0 100644 --- a/src/meshTools/mappedPatches/mappedPolyPatch/mappedPatchBaseI.H +++ b/src/meshTools/mappedPatches/mappedPolyPatch/mappedPatchBaseI.H @@ -167,7 +167,9 @@ inline bool Foam::mappedPatchBase::sameRegion() const inline const Foam::mapDistribute& Foam::mappedPatchBase::map() const { const polyMesh& thisMesh = patch_.boundaryMesh().mesh(); - bool topoChange = sampleMesh().topoChanging() || thisMesh.topoChanging(); + bool topoChange = + (sameWorld() && sampleMesh().topoChanging()) + || thisMesh.topoChanging(); if (topoChange) { @@ -189,7 +191,9 @@ inline const Foam::AMIPatchToPatchInterpolation& Foam::mappedPatchBase::AMI ) const { const polyMesh& thisMesh = patch_.boundaryMesh().mesh(); - bool topoChange = sampleMesh().topoChanging() || thisMesh.topoChanging(); + bool topoChange = + (sameWorld() && sampleMesh().topoChanging()) + || thisMesh.topoChanging(); if (topoChange || forceUpdate) { diff --git a/tutorials/multiphase/compressibleInterFoam/laminar/waterCooler/solid/system/fvSolution b/tutorials/multiphase/compressibleInterFoam/laminar/waterCooler/solid/system/fvSolution index 31ca7120238..813e92c688b 100644 --- a/tutorials/multiphase/compressibleInterFoam/laminar/waterCooler/solid/system/fvSolution +++ b/tutorials/multiphase/compressibleInterFoam/laminar/waterCooler/solid/system/fvSolution @@ -17,7 +17,7 @@ FoamFile solvers { - h + "h.*" { solver PCG; preconditioner DIC; -- GitLab