From f4109dc68b3ac67356605ce0bfe775b752714e36 Mon Sep 17 00:00:00 2001
From: andy <andy>
Date: Fri, 26 Oct 2012 16:18:45 +0100
Subject: [PATCH] ENH: Further updates to fan and jump BCs

---
 .../derived/fan/fanFvPatchField.C             |  9 ++++
 .../derived/fan/fanFvPatchField.H             |  7 +++
 .../derived/fan/fanFvPatchFields.C            | 53 +++++++++++--------
 .../derived/fixedJump/fixedJumpFvPatchField.C |  5 +-
 .../fixedJumpAMI/fixedJumpAMIFvPatchField.C   |  3 +-
 5 files changed, 53 insertions(+), 24 deletions(-)

diff --git a/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchField.C
index 3a150c6f707..18d5b332428 100644
--- a/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchField.C
+++ b/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchField.C
@@ -84,4 +84,13 @@ Foam::fanFvPatchField<Type>::fanFvPatchField
 {}
 
 
+// * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
+
+template<class Type>
+Foam::tmp<Foam::Field<Type> > Foam::fanFvPatchField<Type>::jump() const
+{
+    return uniformJumpFvPatchField<Type>::jump();
+}
+
+
 // ************************************************************************* //
diff --git a/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchField.H
index 463ebeb5436..bf0762f4788 100644
--- a/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchField.H
+++ b/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchField.H
@@ -172,6 +172,9 @@ public:
 
         // Evaluation functions
 
+            //- Return the "jump" across the patch
+            tmp<Field<Type> > jump() const;
+
             //- Update the coefficients associated with the patch field
             virtual void updateCoeffs();
 };
@@ -185,6 +188,10 @@ fanFvPatchField<scalar>::fanFvPatchField
     const DimensionedField<scalar, volMesh>&,
     const dictionary&
 );
+
+template<>
+tmp<Field<scalar> > fanFvPatchField<scalar>::jump() const;
+
 template<>
 void fanFvPatchField<scalar>::updateCoeffs();
 
diff --git a/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchFields.C b/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchFields.C
index 668d43483de..7922b66fe37 100644
--- a/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchFields.C
+++ b/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchFields.C
@@ -30,18 +30,16 @@ License
 #include "Tuple2.H"
 #include "polynomial.H"
 
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
 
 namespace Foam
 {
-
-// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
-
-makeTemplatePatchTypeField
-(
-    fvPatchScalarField,
-    fanFvPatchScalarField
-);
+    makeTemplatePatchTypeField
+    (
+        fvPatchScalarField,
+        fanFvPatchScalarField
+    );
+}
 
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
@@ -115,15 +113,10 @@ Foam::fanFvPatchField<Foam::scalar>::fanFvPatchField
 
 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
 
-//- Specialisation of the jump-condition for the pressure
 template<>
-void Foam::fanFvPatchField<Foam::scalar>::updateCoeffs()
+Foam::tmp<Foam::Field<Foam::scalar> >
+Foam::fanFvPatchField<Foam::scalar>::jump() const
 {
-    if (this->updated())
-    {
-        return;
-    }
-
     if (this->cyclicPatch().owner())
     {
         const surfaceScalarField& phi =
@@ -139,15 +132,33 @@ void Foam::fanFvPatchField<Foam::scalar>::updateCoeffs()
             Un /= patch().lookupPatchField<volScalarField, scalar>("rho");
         }
 
-        this->jump_ = this->jumpTable_->value(Un);
+        return this->jumpTable_->value(Un);
+    }
+    else
+    {
+        return refCast<const fanFvPatchField<scalar> >
+        (
+            this->neighbourPatchField()
+        ).jump();
     }
-
-    uniformJumpFvPatchField<scalar>::updateCoeffs();
 }
 
 
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+template<>
+void Foam::fanFvPatchField<Foam::scalar>::updateCoeffs()
+{
+    if (this->updated())
+    {
+        return;
+    }
+
+    if (this->cyclicPatch().owner())
+    {
+        this->jump_ = jump();
+    }
+
+    uniformJumpFvPatchField<scalar>::updateCoeffs();
+}
 
-} // End namespace Foam
 
 // ************************************************************************* //
diff --git a/src/finiteVolume/fields/fvPatchFields/derived/fixedJump/fixedJumpFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/fixedJump/fixedJumpFvPatchField.C
index e58270ec638..9ef4be21a40 100644
--- a/src/finiteVolume/fields/fvPatchFields/derived/fixedJump/fixedJumpFvPatchField.C
+++ b/src/finiteVolume/fields/fvPatchFields/derived/fixedJump/fixedJumpFvPatchField.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
+    \\  /    A nd           | Copyright (C) 2011-2012 OpenFOAM Foundation
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -138,7 +138,8 @@ template<class Type>
 void Foam::fixedJumpFvPatchField<Type>::write(Ostream& os) const
 {
     fvPatchField<Type>::write(os);
-    os.writeKeyword("patchType") << "cyclic" << token::END_STATEMENT << nl;
+    os.writeKeyword("patchType") << this->interfaceFieldType()
+        << token::END_STATEMENT << nl;
     jump_.writeEntry("jump", os);
     this->writeEntry("value", os);
 }
diff --git a/src/finiteVolume/fields/fvPatchFields/derived/fixedJumpAMI/fixedJumpAMIFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/fixedJumpAMI/fixedJumpAMIFvPatchField.C
index d9cdc383a3f..4c3290cf2d7 100644
--- a/src/finiteVolume/fields/fvPatchFields/derived/fixedJumpAMI/fixedJumpAMIFvPatchField.C
+++ b/src/finiteVolume/fields/fvPatchFields/derived/fixedJumpAMI/fixedJumpAMIFvPatchField.C
@@ -141,7 +141,8 @@ template<class Type>
 void Foam::fixedJumpAMIFvPatchField<Type>::write(Ostream& os) const
 {
     fvPatchField<Type>::write(os);
-    os.writeKeyword("patchType") << "cyclicAMI" << token::END_STATEMENT << nl;
+    os.writeKeyword("patchType") << this->interfaceFieldType()
+        << token::END_STATEMENT << nl;
     jump_.writeEntry("jump", os);
     this->writeEntry("value", os);
 }
-- 
GitLab