transport.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) 2011-2026 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 
26 #include "transport.H"
27 #include "XiEqModel.H"
28 #include "XiProfile.H"
29 #include "XiGModel.H"
30 #include "fvmDiv.H"
31 #include "fvcLaplacian.H"
32 #include "fvModels.H"
33 #include "fvConstraints.H"
35 
36 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
37 
38 namespace Foam
39 {
40 namespace XiModels
41 {
44 }
45 }
46 
47 
48 // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
49 
51 {
53  strainReduction_ =
54  dict.lookupOrDefault<Switch>("strainReduction", true);
55  curvatureReduction_ =
56  dict.lookupOrDefault<Switch>("curvatureReduction", false);
57  differentialPropagation_ =
58  dict.lookupOrDefault<Switch>("differentialPropagation", false);
59  return true;
60 }
61 
62 
63 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
64 
66 (
67  const dictionary& dict,
68  const ubRhoThermo& thermo,
70  const volScalarField& Su
71 )
72 :
74  XiEqModel_(XiEqModel::New(dict, thermo, turbulence, Su)),
75  XiProfile_(XiProfile::New(dict, b_)),
76  XiGModel_(XiGModel::New(dict, thermo, turbulence, Su))
77 {
80 }
81 
82 
83 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
84 
86 {}
87 
88 
89 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
90 
92 {
93  return XiEqModel_->Db();
94 }
95 
96 
98 {
99  const fvMesh& mesh(thermo_.mesh());
100 
103 
104  const volScalarField XiEqEta(XiEqModel_->XiEq());
105 
106  const volScalarField::Internal GEta(XiGModel_->G());
107  const volScalarField::Internal R(GEta*XiEqEta()/(XiEqEta() - 0.999));
108  const volScalarField::Internal XiEqStar(R/(R - GEta));
109  const volScalarField::Internal XiEq
110  (
111  1 + XiProfile_->profile()()*(XiEqStar - 1)
112  );
113  const volScalarField::Internal G(R*(XiEq - 1)/XiEq);
114 
115  const surfaceScalarField& phiSt =
120 
121  surfaceScalarField phiXi("phiXi", phiSt);
122 
123  if (differentialPropagation_)
124  {
125  phiXi += fvc::interpolate(rho_)*fvc::interpolate(Su_*(1/Xi_ - Xi_))*nf;
126  }
127 
128  const surfaceScalarField& phi = momentumTransport_.alphaRhoPhi();
129 
130  fvScalarMatrix XiEqn
131  (
132  fvm::ddt(rho_, Xi_)
133  + fvm::div(phi + phiXi, Xi_, "div(phiXi,Xi)")
134  - fvm::Sp(fvc::div(phiXi), Xi_)
135  - fvc::laplacian(Db, Xi_)
136  ==
137  rho_*R
138  - fvm::Sp(rho_*(R - G), Xi_)
139  + fvModels.source(rho_, Xi_)
140  );
141 
142  if (strainReduction_)
143  {
144  const tmp<volTensorField> tgradU(fvc::grad(momentumTransport_.U()));
145  const volTensorField::Internal& gradU(tgradU());
146 
147  const volScalarField::Internal rhoSigma
148  (
149  rho_
150  *max
151  (
152  (n() & n())*tr(gradU) - (n & gradU & n),
154  )
155  );
156 
157  XiEqn += fvm::Sp(rhoSigma, Xi_) - rhoSigma;
158  }
159 
160  if (curvatureReduction_)
161  {
162  const tmp<volTensorField> tgradSt(fvc::grad(Su_*Xi_*n));
163  const volTensorField::Internal& gradSt(tgradSt());
164 
165  const volScalarField::Internal rhoSigmaSt
166  (
167  rho_
168  *max
169  (
170  (n() & n())*tr(gradSt) - (n & gradSt & n),
172  )
173  );
174 
175  XiEqn += fvm::Sp(rhoSigmaSt, Xi_) - rhoSigmaSt;
176  }
177 
178  XiEqn.relax();
179 
180  fvConstraints.constrain(XiEqn);
181 
182  XiEqn.solve();
183 
185 
186  // Limit range of Xi for realisability and stability
187  Xi_.max(1);
188  Xi_ = min(Xi_, 2*XiEqEta);
189 }
190 
191 
192 // ************************************************************************* //
label n
Macros for easy insertion into run-time selection tables.
volScalarField Db("Db", rho *turbulence->nuEff())
static fvModels & New(const word &name, const fvMesh &mesh)
Construct and return the named DemandDrivenMeshObject.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Generic GeometricField class.
writeOption & writeOpt() const
Definition: IOobject.H:367
A simple wrapper around bool so that it can be read as a word: true/false, on/off,...
Definition: Switch.H:61
Base class for equilibrium flame wrinkling XiEq models.
Definition: XiEqModel.H:52
Base class for flame wrinkling Xi generation rate models.
Definition: XiGModel.H:68
Base-class for all Xi models used by the b-Xi combustion model.
Definition: XiModel.H:117
volScalarField Xi_
Flame wrinkling field.
Definition: XiModel.H:136
virtual bool readCoeffs(const dictionary &dict)=0
Update coefficients from given dictionary.
Definition: XiModel.C:39
Transport model for flame wrinkling Xi.
Definition: transport.H:74
virtual void correct()
Correct the flame-wrinkling Xi.
Definition: transport.C:97
transport(const dictionary &dict, const ubRhoThermo &thermo, const compressibleMomentumTransportModel &turbulence, const volScalarField &Su)
Construct from components.
Definition: transport.C:66
virtual bool readCoeffs(const dictionary &dict)
Update coefficients from given dictionary.
Definition: transport.C:50
virtual tmp< volScalarField > Db() const
Return the flame diffusivity.
Definition: transport.C:91
virtual ~transport()
Destructor.
Definition: transport.C:85
Base class for flame wrinkling profiles.
Definition: XiProfile.H:73
Base class for single-phase compressible momentum transport models.
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
Definition: dictionary.H:162
Finite volume constraints.
Definition: fvConstraints.H:68
bool constrain(fvMatrix< Type > &eqn) const
Apply constraints to an equation.
A special matrix type and solver, designed for finite volume solutions of scalar equations....
Definition: fvMatrix.H:118
void relax(const scalar alpha)
Relax matrix (for steady-state solution).
Definition: fvMatrix.C:602
SolverPerformance< Type > solve(const dictionary &)
Solve segregated or coupled returning the solution statistics.
Definition: fvMatrixSolve.C:58
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:98
Finite volume models.
Definition: fvModels.H:69
tmp< fvMatrix< Type > > source(const VolField< Type > &field) const
Return source for an equation.
const Type & lookupObject(const word &name) const
Lookup and return the object of the given Type and name.
A class for managing temporary objects.
Definition: tmp.H:55
Foam::fvConstraints & fvConstraints(Foam::fvConstraints::New(mesh))
Foam::fvModels & fvModels(Foam::fvModels::New(mesh))
Foam::fvMesh mesh(Foam::IOobject(regionName, runTime.name(), runTime, Foam::IOobject::MUST_READ), false)
Calculate the laplacian of the given field.
Calculate the matrix for the divergence of the given field and flux.
defineTypeNameAndDebug(equilibrium, 0)
addToRunTimeSelectionTable(XiModel, equilibrium, dictionary)
const dimensionedScalar G
Newtonian constant of gravitation.
static tmp< SurfaceField< Type > > interpolate(const VolField< Type > &tvf, const surfaceScalarField &faceFlux, Istream &schemeData)
Interpolate field onto faces using scheme given by Istream.
tmp< VolField< Type > > laplacian(const VolField< Type > &vf, const word &name)
Definition: fvcLaplacian.C:45
tmp< VolField< Type > > Su(const VolField< Type > &su, const VolField< Type > &vf)
Definition: fvcSup.C:44
tmp< VolField< typename outerProduct< vector, Type >::type > > grad(const SurfaceField< Type > &ssf)
Definition: fvcGrad.C:46
tmp< VolField< Type > > div(const SurfaceField< Type > &ssf)
Definition: fvcDiv.C:47
tmp< fvMatrix< Type > > div(const surfaceScalarField &flux, const VolField< Type > &vf, const word &name)
Definition: fvmDiv.C:48
tmp< fvMatrix< Type > > Sp(const volScalarField::Internal &, const VolField< Type > &)
tmp< fvMatrix< Type > > ddt(const VolField< Type > &vf)
Definition: fvmDdt.C:46
Namespace for OpenFOAM.
const dimensionSet & dimless
Definition: dimensions.C:138
void tr(pointPatchField< scalar > &, const pointPatchField< tensor > &)
const dimensionSet & dimTime
Definition: dimensions.C:142
dimensioned< Type > min(const DimensionedField< Type, GeoMesh, PrimitiveField > &df)
static scalar R(const scalar a, const scalar x)
Definition: invIncGamma.C:102
tmp< DimensionedField< TypeR, GeoMesh, Field > > New(const tmp< DimensionedField< TypeR, GeoMesh, Field >> &tdf1, const word &name, const dimensionSet &dimensions)
dimensioned< Type > max(const DimensionedField< Type, GeoMesh, PrimitiveField > &df)
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
dictionary dict
autoPtr< incompressible::momentumTransportModel > turbulence(incompressible::momentumTransportModel::New(U, phi, viscosity))
fluidMulticomponentThermo & thermo
Definition: createFields.H:15