diff --git a/src/finiteVolume/Make/files b/src/finiteVolume/Make/files index bf626a6aaf..c9f11150e8 100644 --- a/src/finiteVolume/Make/files +++ b/src/finiteVolume/Make/files @@ -377,6 +377,7 @@ $(laplacianSchemes)/gaussLaplacianScheme/gaussLaplacianSchemes.C finiteVolume/fvc/fvcMeshPhi.C finiteVolume/fvc/fvcSmooth/fvcSmooth.C +finiteVolume/fvc/fvcReconstructMag.C general = cfdTools/general $(general)/findRefCell/findRefCell.C diff --git a/src/finiteVolume/finiteVolume/fvc/fvcReconstruct.C b/src/finiteVolume/finiteVolume/fvc/fvcReconstruct.C index 5c886900e8..880bd7f72e 100644 --- a/src/finiteVolume/finiteVolume/fvc/fvcReconstruct.C +++ b/src/finiteVolume/finiteVolume/fvc/fvcReconstruct.C @@ -25,6 +25,9 @@ License #include "fvcReconstruct.H" #include "fvMesh.H" +#include "volFields.H" +#include "surfaceFields.H" +#include "fvcSurfaceIntegrate.H" #include "zeroGradientFvPatchFields.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/finiteVolume/finiteVolume/fvc/fvcReconstruct.H b/src/finiteVolume/finiteVolume/fvc/fvcReconstruct.H index fa85c36abd..63a2adaac3 100644 --- a/src/finiteVolume/finiteVolume/fvc/fvcReconstruct.H +++ b/src/finiteVolume/finiteVolume/fvc/fvcReconstruct.H @@ -69,6 +69,9 @@ namespace fvc ( const tmp >& ); + + tmp reconstructMag(const surfaceScalarField&); + tmp reconstructMag(const tmp&); } diff --git a/src/finiteVolume/finiteVolume/fvc/fvcReconstructSimple.C b/src/finiteVolume/finiteVolume/fvc/fvcReconstructMag.C similarity index 67% rename from src/finiteVolume/finiteVolume/fvc/fvcReconstructSimple.C rename to src/finiteVolume/finiteVolume/fvc/fvcReconstructMag.C index c3e7f8dc85..63c03590ca 100644 --- a/src/finiteVolume/finiteVolume/fvc/fvcReconstructSimple.C +++ b/src/finiteVolume/finiteVolume/fvc/fvcReconstructMag.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -25,6 +25,8 @@ License #include "fvcReconstruct.H" #include "fvMesh.H" +#include "volFields.H" +#include "surfaceFields.H" #include "zeroGradientFvPatchFields.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -39,21 +41,8 @@ namespace fvc // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -template -tmp -< - GeometricField - < - typename outerProduct::type, fvPatchField, volMesh - > -> -reconstruct -( - const GeometricField& ssf -) +tmp reconstructMag(const surfaceScalarField& ssf) { - typedef typename outerProduct::type GradType; - const fvMesh& mesh = ssf.mesh(); const labelUList& owner = mesh.owner(); @@ -61,10 +50,12 @@ reconstruct const volVectorField& C = mesh.C(); const surfaceVectorField& Cf = mesh.Cf(); + const surfaceVectorField& Sf = mesh.Sf(); + const surfaceScalarField& magSf = mesh.magSf(); - tmp > treconField + tmp treconField ( - new GeometricField + new volScalarField ( IOobject ( @@ -75,41 +66,44 @@ reconstruct IOobject::NO_WRITE ), mesh, - dimensioned + dimensionedScalar ( "0", ssf.dimensions()/dimArea, - pTraits::zero + scalar(0) ), - zeroGradientFvPatchField::typeName + zeroGradientFvPatchScalarField::typeName ) ); - Field& rf = treconField(); + scalarField& rf = treconField(); forAll(owner, facei) { label own = owner[facei]; label nei = neighbour[facei]; - rf[own] += (Cf[facei] - C[own])*ssf[facei]; - rf[nei] -= (Cf[facei] - C[nei])*ssf[facei]; + rf[own] += (Sf[facei] & (Cf[facei] - C[own]))*ssf[facei]/magSf[facei]; + rf[nei] -= (Sf[facei] & (Cf[facei] - C[nei]))*ssf[facei]/magSf[facei]; } - const typename GeometricField:: - GeometricBoundaryField& bsf = ssf.boundaryField(); + const surfaceScalarField::GeometricBoundaryField& bsf = ssf.boundaryField(); forAll(bsf, patchi) { - const fvsPatchField& psf = bsf[patchi]; + const fvsPatchScalarField& psf = bsf[patchi]; const labelUList& pOwner = mesh.boundary()[patchi].faceCells(); const vectorField& pCf = Cf.boundaryField()[patchi]; + const vectorField& pSf = Sf.boundaryField()[patchi]; + const scalarField& pMagSf = magSf.boundaryField()[patchi]; forAll(pOwner, pFacei) { label own = pOwner[pFacei]; - rf[own] += (pCf[pFacei] - C[own])*psf[pFacei]; + rf[own] += + (pSf[pFacei] & (pCf[pFacei] - C[own])) + *psf[pFacei]/pMagSf[pFacei]; } } @@ -121,23 +115,11 @@ reconstruct } -template -tmp -< - GeometricField - < - typename outerProduct::type, fvPatchField, volMesh - > -> -reconstruct -( - const tmp >& tssf -) +tmp reconstructMag(const tmp& tssf) { - typedef typename outerProduct::type GradType; - tmp > tvf + tmp tvf ( - fvc::reconstruct(tssf()) + fvc::reconstructMag(tssf()) ); tssf.clear(); return tvf;