PhaseLimitStabilization.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2017-2018 OpenFOAM Foundation
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 
27 #include "fvMatrices.H"
28 #include "fvmSup.H"
30 
31 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
32 
33 template<class Type>
35 (
36  const word& name,
37  const word& modelType,
38  const dictionary& dict,
39  const fvMesh& mesh
40 )
41 :
42  option(name, modelType, dict, mesh),
43  fieldName_(coeffs_.lookup("field")),
44  rateName_(coeffs_.lookup("rate")),
45  residualAlpha_(readScalar(coeffs_.lookup("residualAlpha")))
46 {
47  fieldNames_.setSize(1, fieldName_);
48  applied_.setSize(1, false);
49 }
50 
51 
52 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
53 
54 template<class Type>
56 (
57  const volScalarField& alpha,
58  const volScalarField& rho,
59  fvMatrix<Type>& eqn,
60  const label fieldi
61 )
62 {
64 
66  mesh_.lookupObjectRef<uniformDimensionedScalarField>(rateName_);
67 
68  eqn -= fvm::Sp(max(residualAlpha_ - alpha, scalar(0))*rho*rate, psi);
69 }
70 
71 
72 template<class Type>
74 {
75  if (option::read(dict))
76  {
77  coeffs_.lookup("residualAlpha") >> residualAlpha_;
78 
79  return true;
80  }
81  else
82  {
83  return false;
84  }
85 }
86 
87 
88 // ************************************************************************* //
#define readScalar
Definition: doubleScalar.C:38
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:59
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:158
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
const GeometricField< Type, fvPatchField, volMesh > & psi() const
Definition: fvMatrix.H:282
virtual void addSup(const volScalarField &alpha, const volScalarField &rho, fvMatrix< Type > &eqn, const label fieldi)
Source term to compressible phase equation.
void read(Istream &, label &, const dictionary &)
In-place read with dictionary lookup.
A class for handling words, derived from string.
Definition: word.H:59
PhaseLimitStabilization(const word &name, const word &modelType, const dictionary &dict, const fvMesh &mesh)
Construct from components.
A special matrix type and solver, designed for finite volume solutions of scalar equations. Face addressing is used to make all matrix assembly and solution loops vectorise.
Definition: fvPatchField.H:72
virtual bool read(const dictionary &dict)
Read dictionary.
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
A special matrix type and solver, designed for finite volume solutions of scalar equations.
const volScalarField & psi
Calculate the matrix for implicit and explicit sources.
Finite volume options abstract base class. Provides a base set of controls, e.g.: ...
Definition: fvOption.H:66
zeroField Sp
Definition: alphaSuSp.H:2