diff --git a/applications/solvers/combustion/fireFoam/pEqn.H b/applications/solvers/combustion/fireFoam/pEqn.H index 3f4f485cf6b7e0abe4e43577558952568598e786..eb263b8a5033ab372f53654a2399031c02a3c2c5 100644 --- a/applications/solvers/combustion/fireFoam/pEqn.H +++ b/applications/solvers/combustion/fireFoam/pEqn.H @@ -4,6 +4,9 @@ volScalarField rAU(1.0/UEqn.A()); surfaceScalarField rhorAUf("Dp", fvc::interpolate(rho*rAU)); volVectorField HbyA("HbyA", U); HbyA = rAU*UEqn.H(); +phi.boundaryField() = + fvc::interpolate(rho.boundaryField()) + *(fvc::interpolate(U.boundaryField()) & mesh.Sf().boundaryField()); surfaceScalarField phig(-rhorAUf*ghf*fvc::snGrad(rho)*mesh.magSf()); diff --git a/applications/solvers/multiphase/interFoam/interDyMFoam/pEqn.H b/applications/solvers/multiphase/interFoam/interDyMFoam/pEqn.H index d942f2c5012634b2639e206b3e7a64aad7e6f375..42721c00189a9bb3c724c060e656b20cd4a6f157 100644 --- a/applications/solvers/multiphase/interFoam/interDyMFoam/pEqn.H +++ b/applications/solvers/multiphase/interFoam/interDyMFoam/pEqn.H @@ -4,6 +4,8 @@ volVectorField HbyA("HbyA", U); HbyA = rAU*UEqn.H(); + phi.boundaryField() = + fvc::interpolate(U.boundaryField()) & mesh.Sf().boundaryField(); surfaceScalarField phiHbyA ( diff --git a/src/finiteVolume/fields/fvPatchFields/basic/calculated/calculatedFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/basic/calculated/calculatedFvPatchField.C index 1f179134fec59dec3a5cf49d478830d4be750fdd..79b8c3750e973c2a215fb0a7e485ca6664206287 100644 --- a/src/finiteVolume/fields/fvPatchFields/basic/calculated/calculatedFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/basic/calculated/calculatedFvPatchField.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 @@ -98,20 +98,19 @@ calculatedFvPatchField<Type>::calculatedFvPatchField template<class Type> -template<class Type2> tmp<fvPatchField<Type> > fvPatchField<Type>::NewCalculatedType ( - const fvPatchField<Type2>& pf + const fvPatch& p ) { typename patchConstructorTable::iterator patchTypeCstrIter = - patchConstructorTablePtr_->find(pf.patch().type()); + patchConstructorTablePtr_->find(p.type()); if (patchTypeCstrIter != patchConstructorTablePtr_->end()) { return patchTypeCstrIter() ( - pf.patch(), + p, DimensionedField<Type, volMesh>::null() ); } @@ -121,7 +120,7 @@ tmp<fvPatchField<Type> > fvPatchField<Type>::NewCalculatedType ( new calculatedFvPatchField<Type> ( - pf.patch(), + p, DimensionedField<Type, volMesh>::null() ) ); @@ -129,6 +128,17 @@ tmp<fvPatchField<Type> > fvPatchField<Type>::NewCalculatedType } +template<class Type> +template<class Type2> +tmp<fvPatchField<Type> > fvPatchField<Type>::NewCalculatedType +( + const fvPatchField<Type2>& pf +) +{ + return NewCalculatedType(pf.patch()); +} + + // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template<class Type> diff --git a/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.H b/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.H index 4dc1041ffcba443bd3539f7b5e238217c5f76b6d..ecace2a0519d3e28c1da600c08aecb38bacce0b6 100644 --- a/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.H @@ -257,6 +257,13 @@ public: const dictionary& ); + //- Return a pointer to a new calculatedFvPatchField created on + // freestore without setting patchField values + static tmp<fvPatchField<Type> > NewCalculatedType + ( + const fvPatch& + ); + //- Return a pointer to a new calculatedFvPatchField created on // freestore without setting patchField values template<class Type2> diff --git a/src/finiteVolume/fields/fvsPatchFields/basic/calculated/calculatedFvsPatchField.C b/src/finiteVolume/fields/fvsPatchFields/basic/calculated/calculatedFvsPatchField.C index a22514c857099df46efd4312b973c71900a0b3ff..efe80d2f73644a5b57de6cc79887d3e1ca52eec3 100644 --- a/src/finiteVolume/fields/fvsPatchFields/basic/calculated/calculatedFvsPatchField.C +++ b/src/finiteVolume/fields/fvsPatchFields/basic/calculated/calculatedFvsPatchField.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 @@ -97,21 +97,20 @@ calculatedFvsPatchField<Type>::calculatedFvsPatchField template<class Type> -template<class Type2> tmp<fvsPatchField<Type> > fvsPatchField<Type>::NewCalculatedType ( - const fvsPatchField<Type2>& pf + const fvPatch& p ) { typename patchConstructorTable::iterator patchTypeCstrIter = - patchConstructorTablePtr_->find(pf.patch().type()); + patchConstructorTablePtr_->find(p.type()); if (patchTypeCstrIter != patchConstructorTablePtr_->end()) { return patchTypeCstrIter() ( - pf.patch(), - Field<Type>::null() + p, + DimensionedField<Type, surfaceMesh>::null() ); } else @@ -120,14 +119,25 @@ tmp<fvsPatchField<Type> > fvsPatchField<Type>::NewCalculatedType ( new calculatedFvsPatchField<Type> ( - pf.patch(), - Field<Type>::null() + p, + DimensionedField<Type, surfaceMesh>::null() ) ); } } +template<class Type> +template<class Type2> +tmp<fvsPatchField<Type> > fvsPatchField<Type>::NewCalculatedType +( + const fvsPatchField<Type2>& pf +) +{ + return NewCalculatedType(pf.patch()); +} + + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam diff --git a/src/finiteVolume/fields/fvsPatchFields/fvsPatchField/fvsPatchField.H b/src/finiteVolume/fields/fvsPatchFields/fvsPatchField/fvsPatchField.H index 7da763f09fd4c84f80f65502c30308e510aaa24c..88fb9a7d58d40dce40824467729e4ac13f6d0254 100644 --- a/src/finiteVolume/fields/fvsPatchFields/fvsPatchField/fvsPatchField.H +++ b/src/finiteVolume/fields/fvsPatchFields/fvsPatchField/fvsPatchField.H @@ -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 @@ -247,6 +247,13 @@ public: const dictionary& ); + //- Return a pointer to a new calculatedFvsPatchField created on + // freestore without setting patchField values + static tmp<fvsPatchField<Type> > NewCalculatedType + ( + const fvPatch& + ); + //- Return a pointer to a new calculatedFvsPatchField created on // freestore without setting patchField values template<class Type2> diff --git a/src/finiteVolume/interpolation/surfaceInterpolation/surfaceInterpolation/surfaceInterpolate.C b/src/finiteVolume/interpolation/surfaceInterpolation/surfaceInterpolation/surfaceInterpolate.C index 84f04e3a94d1833d61063aa0d7f12f5d1ef6e6b1..f4f4f54f65d19e365dfaadab62bbccf0ab121cfe 100644 --- a/src/finiteVolume/interpolation/surfaceInterpolation/surfaceInterpolation/surfaceInterpolate.C +++ b/src/finiteVolume/interpolation/surfaceInterpolation/surfaceInterpolation/surfaceInterpolate.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 @@ -302,6 +302,43 @@ interpolate } +template<class Type> +tmp<FieldField<fvsPatchField, Type> > interpolate +( + const FieldField<fvPatchField, Type>& fvpff +) +{ + FieldField<fvsPatchField, Type>* fvspffPtr + ( + new FieldField<fvsPatchField, Type>(fvpff.size()) + ); + + forAll(*fvspffPtr, patchi) + { + fvspffPtr->set + ( + patchi, + fvsPatchField<Type>::NewCalculatedType(fvpff[patchi].patch()).ptr() + ); + (*fvspffPtr)[patchi] = fvpff[patchi]; + } + + return tmp<FieldField<fvsPatchField, Type> >(fvspffPtr); +} + + +template<class Type> +tmp<FieldField<fvsPatchField, Type> > interpolate +( + const tmp<FieldField<fvPatchField, Type> >& tfvpff +) +{ + tmp<FieldField<fvPatchField, Type> > tfvspff = interpolate(tfvpff()); + tfvpff.clear(); + return tfvspff; +} + + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace fvc diff --git a/src/finiteVolume/interpolation/surfaceInterpolation/surfaceInterpolation/surfaceInterpolate.H b/src/finiteVolume/interpolation/surfaceInterpolation/surfaceInterpolation/surfaceInterpolate.H index 00c0da4f65b05c486f4d59b1e63c7639e75781e2..f6f0cf04b6d09a1a61a83f8395d6619b416d6f33 100644 --- a/src/finiteVolume/interpolation/surfaceInterpolation/surfaceInterpolation/surfaceInterpolate.H +++ b/src/finiteVolume/interpolation/surfaceInterpolation/surfaceInterpolation/surfaceInterpolate.H @@ -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 @@ -163,12 +163,26 @@ namespace fvc const tmp<GeometricField<Type, fvPatchField, volMesh> >& tvf ); - //- Interpolate tmp field onto faces using 'interpolate(\<name\>)' + //- Interpolate field onto faces using 'interpolate(\<name\>)' template<class Type> static tmp<GeometricField<Type, fvsPatchField, surfaceMesh> > interpolate ( const GeometricField<Type, fvPatchField, volMesh>& tvf ); + + //- Interpolate boundary field onto faces (simply a type conversion) + template<class Type> + static tmp<FieldField<fvsPatchField, Type> > interpolate + ( + const FieldField<fvPatchField, Type>& fvpff + ); + + //- Interpolate boundary field onto faces (simply a type conversion) + template<class Type> + static tmp<FieldField<fvsPatchField, Type> > interpolate + ( + const tmp<FieldField<fvPatchField, Type> >& tfvpff + ); }