diff --git a/src/immersedBoundary/immersedBoundary/Make/files b/src/immersedBoundary/immersedBoundary/Make/files index fd2ce9e58..d97b8dafc 100644 --- a/src/immersedBoundary/immersedBoundary/Make/files +++ b/src/immersedBoundary/immersedBoundary/Make/files @@ -1,6 +1,7 @@ immersedPoly/immersedPoly.C immersedPoly/distanceFunctions/triSurfaceDistance/triSurfaceDistance.C +immersedBoundaryPolyPatch/immersedBoundaryCorrectedMeshFields/immersedBoundaryCorrectedMeshFields.C immersedBoundaryPolyPatch/immersedBoundaryPolyPatch.C immersedBoundaryPointPatch/immersedBoundaryPointPatch.C immersedBoundaryFvPatch/immersedBoundaryFvPatch.C diff --git a/src/immersedBoundary/immersedBoundary/finiteVolume/immersedBoundaryFvcReconstruct/immersedBoundaryFvcReconstruct.C b/src/immersedBoundary/immersedBoundary/finiteVolume/immersedBoundaryFvcReconstruct/immersedBoundaryFvcReconstruct.C new file mode 100644 index 000000000..98cb08a27 --- /dev/null +++ b/src/immersedBoundary/immersedBoundary/finiteVolume/immersedBoundaryFvcReconstruct/immersedBoundaryFvcReconstruct.C @@ -0,0 +1,174 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | foam-extend: Open Source CFD + \\ / O peration | Version: 4.1 + \\ / A nd | Web: http://www.foam-extend.org + \\/ M anipulation | For copyright notice see file Copyright +------------------------------------------------------------------------------- +License + This file is part of foam-extend. + + foam-extend is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation, either version 3 of the License, or (at your + option) any later version. + + foam-extend is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with foam-extend. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "immersedBoundaryFvcReconstruct.H" +#include "fvMesh.H" +#include "zeroGradientFvPatchFields.H" +#include "fv.H" +#include "surfaceInterpolate.H" +#include "fvcVolumeIntegrate.H" +#include "fvcSurfaceIntegrate.H" +#include "fvcAverage.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace fvc +{ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +template +tmp +< + GeometricField + < + typename outerProduct::type, fvPatchField, volMesh + > +> +reconstructIb +( + const GeometricField& ssf +) +{ + typedef typename outerProduct::type GradType; + + const fvMesh& mesh = ssf.mesh(); + + tmp > treconField + ( + new GeometricField + ( + IOobject + ( + "volIntegrate(" + ssf.name() + ')', + ssf.instance(), + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh, + ssf.dimensions()/dimArea, + zeroGradientFvPatchField::typeName + ) + ); + GeometricField& reconField = + treconField(); + + // Note: + // 1) Reconstruction is only available in cell centres: there is no need + // to invert the tensor on the boundary + // 2) For boundaries, the only reconstructed data is the flux times + // normal. Based on this guess, boundary conditions can adjust + // patch values + // HJ, 12/Aug/2011 + + GeometricField fluxTimesNormal = + surfaceSum((mesh.Sf()/mag(mesh.Sf()))*ssf); + // surfaceSum((mesh.Sf()/mesh.magSf())*ssf); + + // Note: hinv inverse must be used to stabilise the inverse on bad meshes + // but it gives strange failures + // HJ, 19/Aug/2015 + + // Create the surface sum field + GeometricField, fvPatchField, volMesh> surfaceSumSqrSf = + surfaceSum(sqr(mesh.Sf())/mesh.magSf()); + Field > surfaceSumSqrSfIn = surfaceSumSqrSf.internalField(); + + // Keep treck of the zero determinant cells + DynamicList