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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2012 OpenFOAM Foundation
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 \*---------------------------------------------------------------------------*/
27 
29 #include "surfaceInterpolate.H"
32 #include "velocityMotionSolver.H"
33 
34 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
35 
36 namespace Foam
37 {
38  defineTypeNameAndDebug(motionDirectionalDiffusivity, 0);
39 
41  (
42  motionDiffusivity,
43  motionDirectionalDiffusivity,
44  Istream
45  );
46 }
47 
48 
49 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
50 
51 Foam::motionDirectionalDiffusivity::motionDirectionalDiffusivity
52 (
53  const fvMesh& mesh,
54  Istream& mdData
55 )
56 :
57  uniformDiffusivity(mesh, mdData),
58  diffusivityVector_(mdData)
59 {}
60 
61 
62 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
63 
65 {}
66 
67 
68 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
69 
71 {
72  static bool first = true;
73 
74  if (!first)
75  {
76  const volVectorField& cellMotionU =
77  mesh().lookupObject<volVectorField>("cellMotionU");
78 
80  (
81  IOobject
82  (
83  "D",
84  mesh().time().timeName(),
85  mesh()
86  ),
87  diffusivityVector_.y()*vector::one
88  + (diffusivityVector_.x() - diffusivityVector_.y())*cellMotionU
89  /(mag(cellMotionU) + dimensionedScalar("small", dimVelocity, SMALL)),
90  zeroGradientFvPatchVectorField::typeName
91  );
92  D.correctBoundaryConditions();
93 
94  const surfaceVectorField n(mesh().Sf()/mesh().magSf());
95  faceDiffusivity_ == (n & cmptMultiply(fvc::interpolate(D), n));
96  }
97  else
98  {
99  first = false;
100 
101  const velocityMotionSolver& mSolver =
102  mesh().lookupObject<velocityMotionSolver>("dynamicMeshDict");
103 
104  const_cast<velocityMotionSolver&>(mSolver).solve();
105  correct();
106  }
107 }
108 
109 
110 // ************************************************************************* //
Foam::addToRunTimeSelectionTable
addToRunTimeSelectionTable(decompositionMethod, kahipDecomp, dictionary)
Foam::IOobject
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition: IOobject.H:104
Foam::VectorSpace< Vector< Cmpt >, Cmpt, 3 >::one
static const Vector< Cmpt > one
Definition: VectorSpace.H:116
Foam::cmptMultiply
dimensioned< Type > cmptMultiply(const dimensioned< Type > &, const dimensioned< Type > &)
Foam::dimVelocity
const dimensionSet dimVelocity
Foam::uniformDiffusivity
Uniform uniform finite volume mesh motion diffusivity.
Definition: uniformDiffusivity.H:51
Foam::velocityMotionSolver
Virtual base class for velocity motion solver.
Definition: velocityMotionSolver.H:58
velocityMotionSolver.H
Foam::motionDirectionalDiffusivity::correct
virtual void correct()
Correct the motion diffusivity.
Definition: motionDirectionalDiffusivity.C:70
n
label n
Definition: TABSMDCalcMethod2.H:31
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:61
correct
fvOptions correct(rho)
Foam::solve
SolverPerformance< Type > solve(faMatrix< Type > &, Istream &)
Solve returning the solution statistics given convergence tolerance.
Foam::dimensionedScalar
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
Definition: dimensionedScalarFwd.H:43
Foam::objectRegistry::lookupObject
const Type & lookupObject(const word &name, const bool recursive=false) const
Definition: objectRegistryTemplates.C:434
timeName
word timeName
Definition: getTimeIndex.H:3
Foam::motionDirectionalDiffusivity::~motionDirectionalDiffusivity
virtual ~motionDirectionalDiffusivity()
Destructor.
Definition: motionDirectionalDiffusivity.C:64
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
addToRunTimeSelectionTable.H
Macros for easy insertion into run-time selection tables.
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:83
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::fvc::interpolate
static tmp< GeometricField< Type, fvsPatchField, surfaceMesh > > interpolate(const GeometricField< Type, fvPatchField, volMesh > &tvf, const surfaceScalarField &faceFlux, Istream &schemeData)
Interpolate field onto faces using scheme given by Istream.
Foam::mag
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
D
const dimensionedScalar & D
Definition: solveBulkSurfactant.H:4
motionDirectionalDiffusivity.H
Foam::GeometricField< vector, fvPatchField, volMesh >
Foam::defineTypeNameAndDebug
defineTypeNameAndDebug(combustionModel, 0)
zeroGradientFvPatchFields.H