explicitPorositySource.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) 2012-2018 OpenFOAM Foundation
9 Copyright (C) 2020-2022 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
30#include "fvMesh.H"
31#include "fvMatrices.H"
32#include "porosityModel.H"
34
35// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
36
37namespace Foam
38{
39namespace fv
40{
43}
44}
45
46
47// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
48
50(
51 const word& name,
52 const word& modelType,
53 const dictionary& dict,
54 const fvMesh& mesh
55)
56:
57 fv::cellSetOption(name, modelType, dict, mesh),
58 porosityPtr_(nullptr)
59{
60 read(dict);
61
63}
64
65
66// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
67
69(
71 const label fieldi
72)
73{
74 fvMatrix<vector> porosityEqn(eqn.psi(), eqn.dimensions());
75 porosityPtr_->addResistance(porosityEqn);
76 eqn -= porosityEqn;
77}
78
79
81(
82 const volScalarField& rho,
84 const label fieldi
85)
86{
87 fvMatrix<vector> porosityEqn(eqn.psi(), eqn.dimensions());
88 porosityPtr_->addResistance(porosityEqn);
89 eqn -= porosityEqn;
90}
91
92
94(
95 const volScalarField& alpha,
96 const volScalarField& rho,
98 const label fieldi
99)
100{
101 fvMatrix<vector> porosityEqn(eqn.psi(), eqn.dimensions());
102 porosityPtr_->addResistance(porosityEqn);
103 eqn -= alpha*porosityEqn;
104}
105
106
108{
110 {
111 if (!coeffs_.readIfPresent("UNames", fieldNames_))
112 {
113 fieldNames_.resize(1);
114 fieldNames_.first() = coeffs_.getOrDefault<word>("U", "U");
115 }
116
118
119 return true;
120 }
121
122 return false;
123}
124
125
126// ************************************************************************* //
Macros for easy insertion into run-time selection tables.
#define addToRunTimeSelectionTable(baseType, thisType, argNames)
Add to construction table with typeName as the key.
virtual bool read()
Re-read model coefficients if they have changed.
static autoPtr< Time > New()
Construct (dummy) Time - no functionObjects or libraries.
Definition: Time.C:717
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
A special matrix type and solver, designed for finite volume solutions of scalar equations....
Definition: fvMatrix.H:121
const dimensionSet & dimensions() const noexcept
Definition: fvMatrix.H:453
const GeometricField< Type, fvPatchField, volMesh > & psi(const label i=0) const
Return psi.
Definition: fvMatrix.H:412
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:91
Intermediate abstract class for handling cell-set options for the derived fvOptions.
const wordRe & zoneName() const noexcept
Applies an explicit porosity source to the momentum equation within a specified region.
virtual bool read(const dictionary &dict)
Read dictionary.
autoPtr< porosityModel > porosityPtr_
Run-time selectable porosity model.
virtual void addSup(fvMatrix< vector > &eqn, const label fieldi)
Add implicit contribution to momentum equation.
Base abstract class for handling finite volume options (i.e. fvOption).
Definition: fvOption.H:127
const fvMesh & mesh_
Reference to the mesh database.
Definition: fvOption.H:139
dictionary coeffs_
Dictionary containing source coefficients.
Definition: fvOption.H:145
void resetApplied()
Resize/reset applied flag list for all fieldNames_ entries.
Definition: fvOption.C:48
const word name_
Source name.
Definition: fvOption.H:133
A class for handling words, derived from Foam::string.
Definition: word.H:68
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
Definition: className.H:121
dynamicFvMesh & mesh
A special matrix type and solver, designed for finite volume solutions of scalar equations.
Namespace for OpenFOAM.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
Definition: exprTraits.C:59
labelList fv(nPoints)
volScalarField & alpha
dictionary dict