Loading...
Searching...
No Matches
relativeVelocityModel.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) 2014-2017 OpenFOAM Foundation
9 Copyright (C) 2019-2021 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
12 This file is part of OpenFOAM.
13
14 OpenFOAM is free software: you can redistribute it and/or modify it
15 under the terms of the GNU General Public License as published by
16 the Free Software Foundation, either version 3 of the License, or
17 (at your option) any later version.
18
19 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26
27\*---------------------------------------------------------------------------*/
28
31#include "slipFvPatchFields.H"
33
34// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
35
36namespace Foam
37{
40}
41
42// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
43
44Foam::wordList Foam::relativeVelocityModel::UdmPatchFieldTypes() const
45{
46 const volVectorField& U = mixture_.U();
47
48 wordList UdmTypes
49 (
50 U.boundaryField().size(),
52 );
53
54 forAll(U.boundaryField(), i)
55 {
56 if
57 (
58 isA<fixedValueFvPatchVectorField>(U.boundaryField()[i])
59 || isA<slipFvPatchVectorField>(U.boundaryField()[i])
60 || isA<partialSlipFvPatchVectorField>(U.boundaryField()[i])
61 )
62 {
63 UdmTypes[i] = fixedValueFvPatchVectorField::typeName;
64 }
65 }
66
67 return UdmTypes;
68}
69
70
71// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
72
73Foam::relativeVelocityModel::relativeVelocityModel
74(
75 const dictionary& dict,
77)
78:
79 mixture_(mixture),
80 alphac_(mixture.alpha2()),
81 alphad_(mixture.alpha1()),
82 rhoc_(mixture.rhoc()),
83 rhod_(mixture.rhod()),
84
85 Udm_
86 (
88 (
89 "Udm",
90 alphac_.time().timeName(),
91 alphac_.mesh(),
92 IOobject::READ_IF_PRESENT,
93 IOobject::AUTO_WRITE
94 ),
95 alphac_.mesh(),
97 UdmPatchFieldTypes()
98 )
99{}
100
101
102// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
103
105(
106 const dictionary& dict,
107 const incompressibleTwoPhaseInteractingMixture& mixture
108)
109{
110 const word modelType(dict.get<word>(typeName));
111
112 Info<< "Selecting relative velocity model " << modelType << endl;
113
114 auto* ctorPtr = dictionaryConstructorTable(modelType);
115
116 if (!ctorPtr)
117 {
119 (
120 dict,
121 "relative velocity",
122 modelType,
123 *dictionaryConstructorTablePtr_
124 ) << abort(FatalIOError);
125 }
126
127 return
128 autoPtr<relativeVelocityModel>
129 (
130 ctorPtr
131 (
132 dict.optionalSubDict(modelType + "Coeffs"),
133 mixture
134 )
135 );
136}
137
138
139// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
140
142{}
143
144
145// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
146
147Foam::tmp<Foam::volScalarField> Foam::relativeVelocityModel::rho() const
148{
149 return alphac_*rhoc_ + alphad_*rhod_;
150}
151
152
153Foam::tmp<Foam::volSymmTensorField> Foam::relativeVelocityModel::tauDm() const
154{
155 volScalarField betac(alphac_*rhoc_);
156 volScalarField betad(alphad_*rhod_);
157
158 // Calculate the relative velocity of the continuous phase w.r.t the mean
159 volVectorField Ucm(betad*Udm_/betac);
160
162 (
163 "tauDm",
165 betad*sqr(Udm_) + betac*sqr(Ucm)
166 );
167}
168
169
170// ************************************************************************* //
const volScalarField & alpha1
const volScalarField & alpha2
static tmp< GeometricField< symmTensor, fvPatchField, volMesh > > New(const word &name, IOobjectOption::registerOption regOpt, const Mesh &mesh, const dimensionSet &dims, const word &patchFieldType=fvPatchField< symmTensor >::calculatedType())
@ NO_REGISTER
Do not request registration (bool: false).
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition IOobject.H:191
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition autoPtr.H:65
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
static const word & calculatedType() noexcept
The type name for calculated patch fields.
A two-phase incompressible transportModel for interacting phases requiring the direct evaluation of t...
virtual ~relativeVelocityModel()
Destructor.
static autoPtr< relativeVelocityModel > New(const dictionary &dict, const incompressibleTwoPhaseInteractingMixture &mixture)
tmp< volSymmTensorField > tauDm() const
Return the stress tensor due to the phase transport.
tmp< volScalarField > rho() const
Return the mixture mean density.
const incompressibleTwoPhaseInteractingMixture & mixture_
Mixture properties.
const incompressibleTwoPhaseInteractingMixture & mixture() const
Mixture properties.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
Definition className.H:142
U
Definition pEqn.H:72
dynamicFvMesh & mesh
#define FatalIOErrorInLookup(ios, lookupTag, lookupName, lookupTable)
Report an error message using Foam::FatalIOError.
Definition error.H:637
word timeName
Definition getTimeIndex.H:3
Namespace for OpenFOAM.
List< word > wordList
List of word.
Definition fileName.H:60
GeometricField< vector, fvPatchField, volMesh > volVectorField
dimensionedSymmTensor sqr(const dimensionedVector &dv)
GeometricField< scalar, fvPatchField, volMesh > volScalarField
const dimensionSet dimVelocity
messageStream Info
Information stream (stdout output on master, null elsewhere).
const word GlobalIOList< Tuple2< scalar, vector > >::typeName("scalarVectorTable")
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition Ostream.H:519
const Type * isA(const U &obj)
Attempt dynamic_cast to Type.
Definition typeInfo.H:87
errorManip< error > abort(error &err)
Definition errorManip.H:139
IOerror FatalIOError
Error stream (stdout output on all processes), with additional 'FOAM FATAL IO ERROR' header text and ...
static constexpr const zero Zero
Global zero (0).
Definition zero.H:127
dimensioned< vector > dimensionedVector
Dimensioned vector obtained from generic dimensioned type.
#define defineRunTimeSelectionTable(baseType, argNames)
Define run-time selection table.
dictionary dict
Info<< "Creating temperaturePhaseChangeTwoPhaseMixture\n"<< endl;autoPtr< temperaturePhaseChangeTwoPhaseMixture > mixture
#define forAll(list, i)
Loop across all elements in list.
Definition stdFoam.H:299