1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
11 OpenFOAM is free software; you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by the
13 Free Software Foundation; either version 2 of the License, or (at your
14 option) any later version.
16 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM; if not, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 \*---------------------------------------------------------------------------*/
27 #include "inverseDistanceDiffusivity.H"
28 #include <OpenFOAM/addToRunTimeSelectionTable.H>
29 #include <meshTools/patchWave.H>
30 #include <OpenFOAM/HashSet.H>
31 #include <finiteVolume/surfaceInterpolate.H>
32 #include <finiteVolume/zeroGradientFvPatchFields.H>
34 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
38 defineTypeNameAndDebug(inverseDistanceDiffusivity, 0);
40 addToRunTimeSelectionTable
43 inverseDistanceDiffusivity,
49 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
51 Foam::inverseDistanceDiffusivity::inverseDistanceDiffusivity
53 const fvMotionSolver& mSolver,
57 uniformDiffusivity(mSolver, mdData),
64 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
66 Foam::inverseDistanceDiffusivity::~inverseDistanceDiffusivity()
70 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
72 Foam::tmp<Foam::scalarField> Foam::inverseDistanceDiffusivity::y() const
74 const polyMesh& mesh = mSolver().mesh();
76 labelHashSet patchSet(mesh.boundaryMesh().patchSet(patchNames_));
80 return tmp<scalarField>
82 new scalarField(patchWave(mesh, patchSet, false).distance())
87 return tmp<scalarField>(new scalarField(mesh.nCells(), 1.0));
92 void Foam::inverseDistanceDiffusivity::correct()
94 const fvMesh& mesh = mSolver().mesh();
101 mesh.time().timeName(),
106 zeroGradientFvPatchScalarField::typeName
108 y_.internalField() = y();
109 y_.correctBoundaryConditions();
111 faceDiffusivity_ = 1.0/fvc::interpolate(y_);
115 // ************************ vim: set sw=4 sts=4 et: ************************ //