FreeFOAM The Cross-Platform CFD Toolkit
motionDirectionalDiffusivity.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
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.
15 
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
19  for more details.
20 
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/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
30 
31 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
32 
33 namespace Foam
34 {
35  defineTypeNameAndDebug(motionDirectionalDiffusivity, 0);
36 
38  (
39  motionDiffusivity,
40  motionDirectionalDiffusivity,
41  Istream
42  );
43 }
44 
45 
46 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
47 
48 Foam::motionDirectionalDiffusivity::motionDirectionalDiffusivity
49 (
50  const fvMotionSolver& mSolver,
51  Istream& mdData
52 )
53 :
54  uniformDiffusivity(mSolver, mdData),
55  diffusivityVector_(mdData)
56 {}
57 
58 
59 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
60 
62 {}
63 
64 
65 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
66 
68 {
69  const fvMesh& mesh = mSolver().mesh();
70 
71  static bool first = true;
72 
73  if (!first)
74  {
75  const volVectorField& cellMotionU =
76  mesh.lookupObject<volVectorField>("cellMotionU");
77 
79  (
80  IOobject
81  (
82  "D",
83  mesh.time().timeName(),
84  mesh
85  ),
86  diffusivityVector_.y()*vector::one
87  + (diffusivityVector_.x() - diffusivityVector_.y())*cellMotionU
88  /(mag(cellMotionU) + dimensionedScalar("small", dimVelocity, SMALL)),
89  zeroGradientFvPatchVectorField::typeName
90  );
91  D.correctBoundaryConditions();
92 
93  surfaceVectorField n = mesh.Sf()/mesh.magSf();
94  faceDiffusivity_ == (n & cmptMultiply(fvc::interpolate(D), n));
95  }
96  else
97  {
98  first = false;
99  const_cast<fvMotionSolver&>(mSolver()).solve();
100  correct();
101  }
102 }
103 
104 
105 // ************************ vim: set sw=4 sts=4 et: ************************ //