From a0517f0ea9b8db5149e3acd152c45bb8e21d540f Mon Sep 17 00:00:00 2001 From: mattijs Date: Thu, 21 Oct 2010 18:38:58 +0100 Subject: [PATCH] BUG: fan b.c. was using phi on slave side. --- .../constraint/cyclic/cyclicFvPatchField.C | 17 ++++++++++++ .../constraint/cyclic/cyclicFvPatchField.H | 5 +++- .../derived/fan/fanFvPatchField.H | 12 ++++++++- .../pimpleFoam/t-junction-with-fan/0/U | 26 +++++++++---------- .../pimpleFoam/t-junction-with-fan/0/epsilon | 18 ++++++++----- .../pimpleFoam/t-junction-with-fan/0/k | 12 ++++----- .../pimpleFoam/t-junction-with-fan/0/nuTilda | 10 +++---- .../pimpleFoam/t-junction-with-fan/0/nut | 18 ++++++++----- .../pimpleFoam/t-junction-with-fan/0/p | 26 +++++++++---------- .../t-junction-with-fan/system/controlDict | 3 +-- 10 files changed, 93 insertions(+), 54 deletions(-) diff --git a/src/finiteVolume/fields/fvPatchFields/constraint/cyclic/cyclicFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/constraint/cyclic/cyclicFvPatchField.C index 0010ab4a0a..c3949a6ac0 100644 --- a/src/finiteVolume/fields/fvPatchFields/constraint/cyclic/cyclicFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/constraint/cyclic/cyclicFvPatchField.C @@ -171,6 +171,23 @@ tmp > cyclicFvPatchField::patchNeighbourField() const } +template +const cyclicFvPatchField& cyclicFvPatchField::neighbourPatchField() +const +{ + const GeometricField& fld = + static_cast&> + ( + this->internalField() + ); + + return refCast > + ( + fld.boundaryField()[this->cyclicPatch().neighbPatchID()] + ); +} + + template void cyclicFvPatchField::updateInterfaceMatrix ( diff --git a/src/finiteVolume/fields/fvPatchFields/constraint/cyclic/cyclicFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/constraint/cyclic/cyclicFvPatchField.H index 654bd0831a..198dbab741 100644 --- a/src/finiteVolume/fields/fvPatchFields/constraint/cyclic/cyclicFvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/constraint/cyclic/cyclicFvPatchField.H @@ -150,9 +150,12 @@ public: // Evaluation functions - //- Return neighbour coupled given internal cell data + //- Return neighbour coupled internal cell data tmp > patchNeighbourField() const; + //- Return reference to neighbour patchField + const cyclicFvPatchField& neighbourPatchField() const; + //- Update result field based on interface functionality virtual void updateInterfaceMatrix ( diff --git a/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchField.H index 73014e048a..31c51c999d 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchField.H @@ -140,7 +140,17 @@ public: //- Return the "jump" across the patch. virtual tmp > jump() const { - return jump_; + if (this->cyclicPatch().owner()) + { + return jump_; + } + else + { + return refCast > + ( + this->neighbourPatchField() + ).jump(); + } } diff --git a/tutorials/incompressible/pimpleFoam/t-junction-with-fan/0/U b/tutorials/incompressible/pimpleFoam/t-junction-with-fan/0/U index 51ef892fb8..f1006ceb5e 100644 --- a/tutorials/incompressible/pimpleFoam/t-junction-with-fan/0/U +++ b/tutorials/incompressible/pimpleFoam/t-junction-with-fan/0/U @@ -15,46 +15,46 @@ FoamFile } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -dimensions [ 0 1 -1 0 0 0 0 ]; +dimensions [0 1 -1 0 0 0 0]; -internalField uniform ( 0 0 0 ); +internalField uniform (0 0 0); boundaryField { inlet { type pressureInletOutletVelocity; - value uniform ( 0 0 0 ); + value uniform (0 0 0); } outlet1 { type inletOutlet; - inletValue uniform ( 0 0 0 ); - value uniform ( 0 0 0 ); + inletValue uniform (0 0 0); + value uniform (0 0 0); } outlet2 { type inletOutlet; - inletValue uniform ( 0 0 0 ); - value uniform ( 0 0 0 ); + inletValue uniform (0 0 0); + value uniform (0 0 0); } baffles { type fixedValue; - value uniform ( 0 0 0 ); + value uniform (0 0 0); } fan_half0 { type cyclic; } + fan_half1 + { + type cyclic; + } defaultFaces { type fixedValue; - value uniform ( 0 0 0 ); - } - fan_half1 - { - type cyclic; + value uniform (0 0 0); } } diff --git a/tutorials/incompressible/pimpleFoam/t-junction-with-fan/0/epsilon b/tutorials/incompressible/pimpleFoam/t-junction-with-fan/0/epsilon index dc1eb9da3e..5c6c53664d 100644 --- a/tutorials/incompressible/pimpleFoam/t-junction-with-fan/0/epsilon +++ b/tutorials/incompressible/pimpleFoam/t-junction-with-fan/0/epsilon @@ -15,7 +15,7 @@ FoamFile } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -dimensions [ 0 2 -3 0 0 0 0 ]; +dimensions [0 2 -3 0 0 0 0]; internalField uniform 1; @@ -42,21 +42,27 @@ boundaryField baffles { type epsilonWallFunction; - value uniform 1; + Cmu 0.09; + kappa 0.41; + E 9.8; + value uniform 0; } fan_half0 { type cyclic; } + fan_half1 + { + type cyclic; + } defaultFaces { type epsilonWallFunction; + Cmu 0.09; + kappa 0.41; + E 9.8; value uniform 1; } - fan_half1 - { - type cyclic; - } } diff --git a/tutorials/incompressible/pimpleFoam/t-junction-with-fan/0/k b/tutorials/incompressible/pimpleFoam/t-junction-with-fan/0/k index 06aeff0f1f..18cb53d519 100644 --- a/tutorials/incompressible/pimpleFoam/t-junction-with-fan/0/k +++ b/tutorials/incompressible/pimpleFoam/t-junction-with-fan/0/k @@ -15,7 +15,7 @@ FoamFile } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -dimensions [ 0 2 -2 0 0 0 0 ]; +dimensions [0 2 -2 0 0 0 0]; internalField uniform 1; @@ -42,21 +42,21 @@ boundaryField baffles { type kqRWallFunction; - value uniform 1; + value uniform 0; } fan_half0 { type cyclic; } + fan_half1 + { + type cyclic; + } defaultFaces { type kqRWallFunction; value uniform 1; } - fan_half1 - { - type cyclic; - } } diff --git a/tutorials/incompressible/pimpleFoam/t-junction-with-fan/0/nuTilda b/tutorials/incompressible/pimpleFoam/t-junction-with-fan/0/nuTilda index 699a951041..ffc7ac906f 100644 --- a/tutorials/incompressible/pimpleFoam/t-junction-with-fan/0/nuTilda +++ b/tutorials/incompressible/pimpleFoam/t-junction-with-fan/0/nuTilda @@ -15,7 +15,7 @@ FoamFile } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -dimensions [ 0 2 -1 0 0 0 0 ]; +dimensions [0 2 -1 0 0 0 0]; internalField uniform 0; @@ -41,14 +41,14 @@ boundaryField { type cyclic; } - defaultFaces - { - type zeroGradient; - } fan_half1 { type cyclic; } + defaultFaces + { + type zeroGradient; + } } diff --git a/tutorials/incompressible/pimpleFoam/t-junction-with-fan/0/nut b/tutorials/incompressible/pimpleFoam/t-junction-with-fan/0/nut index 1a5afb9689..6ed8f42dfc 100644 --- a/tutorials/incompressible/pimpleFoam/t-junction-with-fan/0/nut +++ b/tutorials/incompressible/pimpleFoam/t-junction-with-fan/0/nut @@ -15,7 +15,7 @@ FoamFile } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -dimensions [ 0 2 -1 0 0 0 0 ]; +dimensions [0 2 -1 0 0 0 0]; internalField uniform 0; @@ -39,21 +39,27 @@ boundaryField baffles { type nutkWallFunction; + Cmu 0.09; + kappa 0.41; + E 9.8; value uniform 0; } fan_half0 { type cyclic; } - defaultFaces - { - type nutkWallFunction; - value uniform 0; - } fan_half1 { type cyclic; } + defaultFaces + { + type nutkWallFunction; + Cmu 0.09; + kappa 0.41; + E 9.8; + value uniform 0; + } } diff --git a/tutorials/incompressible/pimpleFoam/t-junction-with-fan/0/p b/tutorials/incompressible/pimpleFoam/t-junction-with-fan/0/p index c77ad85725..66f5c1d712 100644 --- a/tutorials/incompressible/pimpleFoam/t-junction-with-fan/0/p +++ b/tutorials/incompressible/pimpleFoam/t-junction-with-fan/0/p @@ -15,7 +15,7 @@ FoamFile } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -dimensions [ 0 2 -2 0 0 0 0 ]; +dimensions [0 2 -2 0 0 0 0]; internalField uniform 100000; @@ -24,14 +24,12 @@ boundaryField inlet { type timeVaryingTotalPressure; - p0 100040; - outOfBounds clamp; - fileName "$FOAM_CASE/constant/p0vsTime"; - U U; - phi phi; rho none; psi none; gamma 1; + p0 100040; + fileName "$FOAM_CASE/constant/p0vsTime"; + outOfBounds clamp; value uniform 100040; } outlet1 @@ -52,19 +50,19 @@ boundaryField { type fan; patchType cyclic; - f 2 ( 50 -0.1 ); - value $internalField; - } - defaultFaces - { - type zeroGradient; + f 2(100 -0.1); + value uniform 0; } fan_half1 { type fan; patchType cyclic; - f 2 ( 50 -0.1 ); - value $internalField; + f 2(100 -0.1); + value uniform 0; + } + defaultFaces + { + type zeroGradient; } } diff --git a/tutorials/incompressible/pimpleFoam/t-junction-with-fan/system/controlDict b/tutorials/incompressible/pimpleFoam/t-junction-with-fan/system/controlDict index 9dc31d5561..63b2669008 100644 --- a/tutorials/incompressible/pimpleFoam/t-junction-with-fan/system/controlDict +++ b/tutorials/incompressible/pimpleFoam/t-junction-with-fan/system/controlDict @@ -28,7 +28,6 @@ endTime 1; deltaT 0.001; writeControl adjustableRunTime; - writeInterval 0.1; purgeWrite 0; @@ -47,7 +46,7 @@ runTimeModifiable true; adjustTimeStep yes; -maxCo 5; +maxCo 3; libs (