diff --git a/applications/solvers/incompressible/pimpleFoam/pimpleDyMFoam/correctPhi.H b/applications/solvers/incompressible/pimpleFoam/pimpleDyMFoam/correctPhi.H index 117790446e..9bed803d1e 100644 --- a/applications/solvers/incompressible/pimpleFoam/pimpleDyMFoam/correctPhi.H +++ b/applications/solvers/incompressible/pimpleFoam/pimpleDyMFoam/correctPhi.H @@ -68,4 +68,6 @@ } } +phi.oldTime() = phi; + #include "continuityErrs.H" diff --git a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/correctPhi.H b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/correctPhi.H index 1d7b9ca624..513ef961bd 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/correctPhi.H +++ b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/correctPhi.H @@ -56,6 +56,8 @@ phi -= pcorrEqn.flux(); } } - - #include "continuityErrs.H" } + +phi.oldTime() = phi; + +#include "continuityErrs.H" diff --git a/applications/solvers/multiphase/interFoam/interDyMFoam/correctPhi.H b/applications/solvers/multiphase/interFoam/interDyMFoam/correctPhi.H index 0e373e1f40..c4cdbc044b 100644 --- a/applications/solvers/multiphase/interFoam/interDyMFoam/correctPhi.H +++ b/applications/solvers/multiphase/interFoam/interDyMFoam/correctPhi.H @@ -53,6 +53,8 @@ fvc::makeRelative(phi, U); } } - - #include "continuityErrs.H" } + +phi.oldTime() = phi; + +#include "continuityErrs.H" diff --git a/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.C b/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.C index f5622451cb..fa3d6d7a31 100644 --- a/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.C @@ -198,10 +198,61 @@ void Foam::fvPatchField::patchInternalField(Field& pif) const template void Foam::fvPatchField::autoMap ( - const fvPatchFieldMapper& m + const fvPatchFieldMapper& mapper ) { - Field::autoMap(m); + Field& f = *this; + + if (!this->size()) + { + f.setSize(mapper.size()); + if (f.size()) + { + f = this->patchInternalField(); + } + } + else + { + // Map all faces provided with mapping data + Field::autoMap(mapper); + + // For unmapped faces set to internal field value (zero-gradient) + if + ( + mapper.direct() + && &mapper.directAddressing() + && mapper.directAddressing().size() + ) + { + Field pif(this->patchInternalField()); + + const labelList& mapAddressing = mapper.directAddressing(); + + forAll(mapAddressing, i) + { + if (mapAddressing[i] < 0) + { + f[i] = pif[i]; + } + } + } + else if (!mapper.direct() && mapper.addressing().size()) + { + Field pif(this->patchInternalField()); + + const labelListList& mapAddressing = mapper.addressing(); + + forAll(mapAddressing, i) + { + const labelList& localAddrs = mapAddressing[i]; + + if (!localAddrs.size()) + { + f[i] = pif[i]; + } + } + } + } } diff --git a/tutorials/multiphase/compressibleTwoPhaseEulerFoam/bubbleColumn/0/epsilon b/tutorials/multiphase/compressibleTwoPhaseEulerFoam/bubbleColumn/0/epsilon index d5ee15eb79..bb5b3e0a73 100644 --- a/tutorials/multiphase/compressibleTwoPhaseEulerFoam/bubbleColumn/0/epsilon +++ b/tutorials/multiphase/compressibleTwoPhaseEulerFoam/bubbleColumn/0/epsilon @@ -29,6 +29,7 @@ boundaryField outlet { type inletOutlet; + phi phiwater; inletValue uniform 0.1; value uniform 0.1; } diff --git a/tutorials/multiphase/compressibleTwoPhaseEulerFoam/bubbleColumn/0/k b/tutorials/multiphase/compressibleTwoPhaseEulerFoam/bubbleColumn/0/k index a791cb824f..9701bd625c 100644 --- a/tutorials/multiphase/compressibleTwoPhaseEulerFoam/bubbleColumn/0/k +++ b/tutorials/multiphase/compressibleTwoPhaseEulerFoam/bubbleColumn/0/k @@ -29,6 +29,7 @@ boundaryField outlet { type inletOutlet; + phi phiwater; inletValue uniform 1e-8; value uniform 1e-8; } diff --git a/tutorials/multiphase/compressibleTwoPhaseEulerFoam/fluidisedBed/0/epsilon b/tutorials/multiphase/compressibleTwoPhaseEulerFoam/fluidisedBed/0/epsilon index ee84cd4426..69b3e74c83 100644 --- a/tutorials/multiphase/compressibleTwoPhaseEulerFoam/fluidisedBed/0/epsilon +++ b/tutorials/multiphase/compressibleTwoPhaseEulerFoam/fluidisedBed/0/epsilon @@ -31,6 +31,7 @@ boundaryField outlet { type inletOutlet; + phi phi2; inletValue uniform 10.0; value uniform 10.0; } diff --git a/tutorials/multiphase/compressibleTwoPhaseEulerFoam/fluidisedBed/0/k b/tutorials/multiphase/compressibleTwoPhaseEulerFoam/fluidisedBed/0/k index 45302e2a18..1ae05e468e 100644 --- a/tutorials/multiphase/compressibleTwoPhaseEulerFoam/fluidisedBed/0/k +++ b/tutorials/multiphase/compressibleTwoPhaseEulerFoam/fluidisedBed/0/k @@ -31,6 +31,7 @@ boundaryField outlet { type inletOutlet; + phi phi2; inletValue uniform 1.0; value uniform 1.0; } diff --git a/tutorials/multiphase/twoPhaseEulerFoam/bed/0/Theta b/tutorials/multiphase/twoPhaseEulerFoam/bed/0/Theta index 3a4a3b6744..2ac308e7d1 100644 --- a/tutorials/multiphase/twoPhaseEulerFoam/bed/0/Theta +++ b/tutorials/multiphase/twoPhaseEulerFoam/bed/0/Theta @@ -30,6 +30,7 @@ boundaryField top { type inletOutlet; + phi phi1; inletValue uniform 1.0e-8; } diff --git a/tutorials/multiphase/twoPhaseEulerFoam/bed/0/epsilon b/tutorials/multiphase/twoPhaseEulerFoam/bed/0/epsilon index 79b3e97bad..79fe0eda3f 100644 --- a/tutorials/multiphase/twoPhaseEulerFoam/bed/0/epsilon +++ b/tutorials/multiphase/twoPhaseEulerFoam/bed/0/epsilon @@ -29,6 +29,7 @@ boundaryField top { type inletOutlet; + phi phi2; inletValue uniform 10.0; value uniform 10.0; } diff --git a/tutorials/multiphase/twoPhaseEulerFoam/bed/0/k b/tutorials/multiphase/twoPhaseEulerFoam/bed/0/k index ebc748ced1..188184e8b4 100644 --- a/tutorials/multiphase/twoPhaseEulerFoam/bed/0/k +++ b/tutorials/multiphase/twoPhaseEulerFoam/bed/0/k @@ -29,6 +29,7 @@ boundaryField top { type inletOutlet; + phi phi2; inletValue uniform 1.0; value uniform 1.0; } diff --git a/tutorials/multiphase/twoPhaseEulerFoam/bed2/0/epsilon b/tutorials/multiphase/twoPhaseEulerFoam/bed2/0/epsilon index ee88570d39..4ff943aac3 100644 --- a/tutorials/multiphase/twoPhaseEulerFoam/bed2/0/epsilon +++ b/tutorials/multiphase/twoPhaseEulerFoam/bed2/0/epsilon @@ -27,6 +27,7 @@ boundaryField outlet { type inletOutlet; + phi phi2; inletValue uniform 10.0; value uniform 10.0; } diff --git a/tutorials/multiphase/twoPhaseEulerFoam/bed2/0/k b/tutorials/multiphase/twoPhaseEulerFoam/bed2/0/k index 0d6e80afba..6b3ddf98cf 100644 --- a/tutorials/multiphase/twoPhaseEulerFoam/bed2/0/k +++ b/tutorials/multiphase/twoPhaseEulerFoam/bed2/0/k @@ -27,6 +27,7 @@ boundaryField outlet { type inletOutlet; + phi phi2; inletValue uniform 1.0; value uniform 1.0; } diff --git a/tutorials/multiphase/twoPhaseEulerFoam/bubbleColumn/0/Theta b/tutorials/multiphase/twoPhaseEulerFoam/bubbleColumn/0/Theta index e45304b834..523be90f32 100644 --- a/tutorials/multiphase/twoPhaseEulerFoam/bubbleColumn/0/Theta +++ b/tutorials/multiphase/twoPhaseEulerFoam/bubbleColumn/0/Theta @@ -29,6 +29,7 @@ boundaryField outlet { type inletOutlet; + phi phi1; inletValue uniform 1.0e-7; value uniform 1.0e-7; } diff --git a/tutorials/multiphase/twoPhaseEulerFoam/bubbleColumn/0/epsilon b/tutorials/multiphase/twoPhaseEulerFoam/bubbleColumn/0/epsilon index d5ee15eb79..d54d0a402b 100644 --- a/tutorials/multiphase/twoPhaseEulerFoam/bubbleColumn/0/epsilon +++ b/tutorials/multiphase/twoPhaseEulerFoam/bubbleColumn/0/epsilon @@ -29,6 +29,7 @@ boundaryField outlet { type inletOutlet; + phi phi2; inletValue uniform 0.1; value uniform 0.1; } diff --git a/tutorials/multiphase/twoPhaseEulerFoam/bubbleColumn/0/k b/tutorials/multiphase/twoPhaseEulerFoam/bubbleColumn/0/k index a791cb824f..bf8d7cc467 100644 --- a/tutorials/multiphase/twoPhaseEulerFoam/bubbleColumn/0/k +++ b/tutorials/multiphase/twoPhaseEulerFoam/bubbleColumn/0/k @@ -29,6 +29,7 @@ boundaryField outlet { type inletOutlet; + phi phi2; inletValue uniform 1e-8; value uniform 1e-8; }