PhaseLimitStabilization.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) 2017 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 "fvMatrices.H"
30 #include "fvmSup.H"
32 
33 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
34 
35 template<class Type>
37 (
38  const word& name,
39  const word& modelType,
40  const dictionary& dict,
41  const fvMesh& mesh
42 )
43 :
44  option(name, modelType, dict, mesh),
45  fieldName_(coeffs_.get<word>("field")),
46  rateName_(coeffs_.get<word>("rate")),
47  residualAlpha_(coeffs_.get<scalar>("residualAlpha"))
48 {
49  fieldNames_.setSize(1, fieldName_);
50  applied_.setSize(1, false);
51 }
52 
53 
54 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
55 
56 template<class Type>
58 (
59  const volScalarField& alpha,
60  const volScalarField& rho,
61  fvMatrix<Type>& eqn,
62  const label fieldi
63 )
64 {
66 
68  mesh_.lookupObjectRef<uniformDimensionedScalarField>(rateName_);
69 
70  eqn -= fvm::Sp(max(residualAlpha_ - alpha, scalar(0))*rho*rate, psi);
71 }
72 
73 
74 template<class Type>
76 {
77  if (option::read(dict))
78  {
79  coeffs_.readEntry("residualAlpha", residualAlpha_);
80 
81  return true;
82  }
83 
84  return false;
85 }
86 
87 
88 // ************************************************************************* //
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
Foam::constant::atomic::alpha
const dimensionedScalar alpha
Fine-structure constant: default SI units: [].
Definition: readThermalProperties.H:212
Sp
zeroField Sp
Definition: alphaSuSp.H:2
rho
rho
Definition: readInitialConditions.H:96
Foam::fvMatrix::psi
const GeometricField< Type, fvPatchField, volMesh > & psi() const
Definition: fvMatrix.H:285
fvMatrices.H
A special matrix type and solver, designed for finite volume solutions of scalar equations.
Foam::fv::PhaseLimitStabilization
Stabilization source for phase transport equations.
Definition: PhaseLimitStabilization.H:75
Foam::UniformDimensionedField< scalar >
Foam::label
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:62
Foam::fv::option
Finite volume options abstract base class. Provides a base set of controls, e.g.:
Definition: fvOption.H:69
Foam::name
word name(const complex &c)
Return string representation of complex.
Definition: complex.C:76
Foam::max
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
Definition: hashSets.C:47
Foam::blockMeshTools::read
void read(Istream &, label &, const dictionary &)
In-place read with dictionary lookup.
Definition: blockMeshTools.C:33
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:121
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:84
PhaseLimitStabilization.H
fvmSup.H
Calculate the matrix for implicit and explicit sources.
uniformDimensionedFields.H
Foam::fv::PhaseLimitStabilization::addSup
virtual void addSup(const volScalarField &alpha, const volScalarField &rho, fvMatrix< Type > &eqn, const label fieldi)
Source term to compressible phase equation.
Definition: PhaseLimitStabilization.C:58
Foam::fv::PhaseLimitStabilization::read
virtual bool read(const dictionary &dict)
Read dictionary.
Definition: PhaseLimitStabilization.C:75
Foam::fvMatrix
A special matrix type and solver, designed for finite volume solutions of scalar equations....
Definition: fvPatchField.H:76
Foam::GeometricField< scalar, fvPatchField, volMesh >
psi
const volScalarField & psi
Definition: createFieldRefs.H:1