1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
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
13 the Free Software Foundation, either version 3 of the License, or
14 (at your 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, see <http://www.gnu.org/licenses/>.
24 \*---------------------------------------------------------------------------*/
26 #include "inverseDistanceDiffusivity.H"
27 #include "addToRunTimeSelectionTable.H"
28 #include "patchWave.H"
30 #include "surfaceInterpolate.H"
31 #include "zeroGradientFvPatchFields.H"
33 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
37 defineTypeNameAndDebug(inverseDistanceDiffusivity, 0);
39 addToRunTimeSelectionTable
42 inverseDistanceDiffusivity,
48 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
50 Foam::inverseDistanceDiffusivity::inverseDistanceDiffusivity
52 const fvMotionSolver& mSolver,
56 uniformDiffusivity(mSolver, mdData),
63 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
65 Foam::inverseDistanceDiffusivity::~inverseDistanceDiffusivity()
69 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
71 Foam::tmp<Foam::scalarField> Foam::inverseDistanceDiffusivity::y() const
73 const polyMesh& mesh = mSolver().mesh();
75 labelHashSet patchSet(mesh.boundaryMesh().patchSet(patchNames_));
79 return tmp<scalarField>
81 new scalarField(patchWave(mesh, patchSet, false).distance())
86 return tmp<scalarField>(new scalarField(mesh.nCells(), 1.0));
91 void Foam::inverseDistanceDiffusivity::correct()
93 const fvMesh& mesh = mSolver().mesh();
100 mesh.time().timeName(),
105 zeroGradientFvPatchScalarField::typeName
107 y_.internalField() = y();
108 y_.correctBoundaryConditions();
110 faceDiffusivity_ = 1.0/fvc::interpolate(y_);
114 // ************************************************************************* //