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-------------------------------------------------------------------------------
10License
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"
33
34// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
35
36namespace Foam
37{
39
41 (
45 );
46}
47
48
49// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
50
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 (
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// ************************************************************************* //
label n
Macros for easy insertion into run-time selection tables.
#define addToRunTimeSelectionTable(baseType, thisType, argNames)
Add to construction table with typeName as the key.
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition: IOobject.H:170
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:64
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:91
Abstract base class for cell-centre mesh motion diffusivity.
MotionDirectional finite volume mesh motion diffusivity.
virtual void correct()
Correct the motion diffusivity.
const Type & lookupObject(const word &name, const bool recursive=false) const
A class representing the concept of 1 (one) that can be used to avoid manipulating objects known to b...
Definition: one.H:62
Uniform uniform finite volume mesh motion diffusivity.
Virtual base class for velocity motion solver.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
Definition: className.H:121
thermo correct()
dynamicFvMesh & mesh
word timeName
Definition: getTimeIndex.H:3
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.
Namespace for OpenFOAM.
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
const dimensionSet dimVelocity
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
dimensioned< Type > cmptMultiply(const dimensioned< Type > &, const dimensioned< Type > &)
const dimensionedScalar & D
CEqn solve()