Subject | Hash | Author | Date (UTC) |
---|---|---|---|
initial commit | 7588fca1df5e437393a92558137d8fafae0a4135 | Anurag Misra | 2017-09-26 13:11:04 |
Add new directory | 34e3d681a663185f8098a20e129197ed6fdcf359 | EXT Anurag Misra | 2017-09-26 12:30:56 |
Update .gitignore | a8cf2a2e66d80e5f4facd744abb9250799c41b8e | EXT Anurag Misra | 2017-09-26 09:11:16 |
Add .gitignore | bb915188ad046d466526ec637b5f1faac8eb8e6d | EXT Anurag Misra | 2017-09-25 15:25:57 |
File multiphaseEulerPbeFoam/Allwclean added (mode: 100644) (index 0000000..a75382c) | |||
1 | #!/bin/sh | ||
2 | cd ${0%/*} || exit 1 # Run from this directory | ||
3 | set -x | ||
4 | |||
5 | wclean libso multiphaseSystem | ||
6 | wclean libso interfacialModels | ||
7 | wclean | ||
8 | |||
9 | # ----------------------------------------------------------------- end-of-file |
File multiphaseEulerPbeFoam/Allwmake added (mode: 100644) (index 0000000..84a99b7) | |||
1 | #!/bin/sh | ||
2 | cd ${0%/*} || exit 1 # Run from this directory | ||
3 | set -x | ||
4 | |||
5 | wmakeLnInclude interfacialModels | ||
6 | wmake libso multiphaseSystem | ||
7 | wmake libso interfacialModels | ||
8 | wmake | ||
9 | |||
10 | # ----------------------------------------------------------------- end-of-file |
File multiphaseEulerPbeFoam/CourantNo.H added (mode: 100644) (index 0000000..005d01a) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2011-2016 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 | Global | ||
25 | CourantNo | ||
26 | |||
27 | Description | ||
28 | Calculates and outputs the mean and maximum Courant Numbers. | ||
29 | |||
30 | \*---------------------------------------------------------------------------*/ | ||
31 | |||
32 | scalar CoNum = 0.0; | ||
33 | scalar meanCoNum = 0.0; | ||
34 | |||
35 | if (mesh.nInternalFaces()) | ||
36 | { | ||
37 | scalarField sumPhi | ||
38 | ( | ||
39 | fvc::surfaceSum(mag(phi))().primitiveField() | ||
40 | ); | ||
41 | |||
42 | forAllIter(PtrDictionary<phaseModel>, fluid.phases(), iter) | ||
43 | { | ||
44 | sumPhi = max | ||
45 | ( | ||
46 | sumPhi, | ||
47 | fvc::surfaceSum(mag(iter().phi()))().primitiveField() | ||
48 | ); | ||
49 | } | ||
50 | |||
51 | CoNum = 0.5*gMax(sumPhi/mesh.V().field())*runTime.deltaTValue(); | ||
52 | |||
53 | meanCoNum = | ||
54 | 0.5*(gSum(sumPhi)/gSum(mesh.V().field()))*runTime.deltaTValue(); | ||
55 | } | ||
56 | |||
57 | Info<< "Courant Number mean: " << meanCoNum | ||
58 | << " max: " << CoNum << endl; | ||
59 | |||
60 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/DDtU.H added (mode: 100644) (index 0000000..04b66a3) | |||
1 | forAllIter(PtrDictionary<phaseModel>, fluid.phases(), iter) | ||
2 | { | ||
3 | phaseModel& phase = iter(); | ||
4 | |||
5 | phase.DDtU() = | ||
6 | fvc::ddt(phase.U()) | ||
7 | + fvc::div(phase.phi(), phase.U()) | ||
8 | - fvc::div(phase.phi())*phase.U(); | ||
9 | |||
10 | MRF.addAcceleration(phase.U(), phase.DDtU()); | ||
11 | } |
File multiphaseEulerPbeFoam/MRFCorrectBCs.H added (mode: 100644) (index 0000000..e871719) | |||
1 | forAllIter(PtrDictionary<phaseModel>, fluid.phases(), iter) | ||
2 | { | ||
3 | MRF.correctBoundaryVelocity(iter().U()); | ||
4 | } | ||
5 | |||
6 | MRF.correctBoundaryVelocity(U); |
File multiphaseEulerPbeFoam/Make/files added (mode: 100644) (index 0000000..29d4de8) | |||
1 | multiphaseEulerPbeFoam.C | ||
2 | |||
3 | EXE = $(FOAM_USER_APPBIN)/multiphaseEulerPbeFoam |
File multiphaseEulerPbeFoam/Make/options added (mode: 100644) (index 0000000..b93c2a2) | |||
1 | EXE_INC = \ | ||
2 | -ImultiphaseSystem/lnInclude \ | ||
3 | -ImultiphaseFixedFluxPressure \ | ||
4 | -IinterfacialModels/lnInclude \ | ||
5 | -I$(LIB_SRC)/transportModels \ | ||
6 | -I$(LIB_SRC)/transportModels/incompressible/lnInclude \ | ||
7 | -I$(LIB_SRC)/transportModels/interfaceProperties/lnInclude \ | ||
8 | -I$(LIB_SRC)/transportModels/incompressible/lnInclude \ | ||
9 | -I$(LIB_SRC)/transportModels/incompressible/singlePhaseTransportModel \ | ||
10 | -I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \ | ||
11 | -I$(LIB_SRC)/TurbulenceModels/incompressible/lnInclude \ | ||
12 | -I$(LIB_SRC)/turbulenceModels/LES/LESdeltas/lnInclude \ | ||
13 | -I$(LIB_SRC)/finiteVolume/lnInclude \ | ||
14 | -I$(LIB_SRC)/meshTools/lnInclude \ | ||
15 | -I$../quadratureMethods/univariateMomentSet/lnInclude \ | ||
16 | -I$../quadratureMethods/extentedMomentInversion/lnInclude \ | ||
17 | -I$../quadratureMethods/quadratureNode \ | ||
18 | -I$../quadratureMethods/moments \ | ||
19 | -I$../quadratureMethods/quadratureApproximation/lnInclude \ | ||
20 | -I$../quadratureMethods/populationBalanceModels/lnInclude | ||
21 | |||
22 | EXE_LIBS = \ | ||
23 | -L$(FOAM_USER_LIBBIN) \ | ||
24 | -lmultiphaseSystem \ | ||
25 | -linterfaceProperties \ | ||
26 | -lincompressibleTransportModels \ | ||
27 | -lcompressibleMultiphaseEulerianInterfacialModels \ | ||
28 | -lturbulenceModels \ | ||
29 | -lincompressibleTurbulenceModels \ | ||
30 | -lfiniteVolume \ | ||
31 | -lmeshTools \ | ||
32 | -lmomentSet \ | ||
33 | -lextendedMomentInversion \ | ||
34 | -lquadratureApproximation \ | ||
35 | -lpopulationBalance |
File multiphaseEulerPbeFoam/TEqns.H added (mode: 100644) (index 0000000..427a5f0) | |||
1 | { | ||
2 | volScalarField kByCp1("kByCp1", alpha1*(k1/Cp1/rho1 + sqr(Ct)*nut2/Prt)); | ||
3 | volScalarField kByCp2("kByCp2", alpha2*(k2/Cp2/rho2 + nut2/Prt)); | ||
4 | |||
5 | fvScalarMatrix T1Eqn | ||
6 | ( | ||
7 | fvm::ddt(alpha1, T1) | ||
8 | + fvm::div(alphaPhi1, T1) | ||
9 | - fvm::laplacian(kByCp1, T1) | ||
10 | == | ||
11 | heatTransferCoeff*T2/Cp1/rho1 | ||
12 | - fvm::Sp(heatTransferCoeff/Cp1/rho1, T1) | ||
13 | + alpha1*Dp1Dt/Cp1/rho1 | ||
14 | ); | ||
15 | |||
16 | fvScalarMatrix T2Eqn | ||
17 | ( | ||
18 | fvm::ddt(alpha2, T2) | ||
19 | + fvm::div(alphaPhi2, T2) | ||
20 | - fvm::laplacian(kByCp2, T2) | ||
21 | == | ||
22 | heatTransferCoeff*T1/Cp2/rho2 | ||
23 | - fvm::Sp(heatTransferCoeff/Cp2/rho2, T2) | ||
24 | + alpha2*Dp2Dt/Cp2/rho2 | ||
25 | ); | ||
26 | |||
27 | T1Eqn.relax(); | ||
28 | T1Eqn.solve(); | ||
29 | |||
30 | T2Eqn.relax(); | ||
31 | T2Eqn.solve(); | ||
32 | |||
33 | // Update compressibilities | ||
34 | psi1 = 1.0/(R1*T1); | ||
35 | psi2 = 1.0/(R2*T2); | ||
36 | } |
File multiphaseEulerPbeFoam/UEqns.H added (mode: 100644) (index 0000000..76f47f8) | |||
1 | #include "MRFCorrectBCs.H" | ||
2 | |||
3 | PtrList<fvVectorMatrix> UEqns(fluid.phases().size()); | ||
4 | autoPtr<multiphaseSystem::dragCoeffFields> dragCoeffs(fluid.dragCoeffs()); | ||
5 | |||
6 | int phasei = 0; | ||
7 | forAllIter(PtrDictionary<phaseModel>, fluid.phases(), iter) | ||
8 | { | ||
9 | phaseModel& phase = iter(); | ||
10 | const volScalarField& alpha = phase; | ||
11 | volVectorField& U = phase.U(); | ||
12 | |||
13 | volScalarField nuEff(turbulence->nut() + iter().nu()); | ||
14 | |||
15 | UEqns.set | ||
16 | ( | ||
17 | phasei, | ||
18 | new fvVectorMatrix | ||
19 | ( | ||
20 | fvm::ddt(alpha, U) | ||
21 | + fvm::div(phase.alphaPhi(), U) | ||
22 | |||
23 | + (alpha/phase.rho())*fluid.Cvm(phase)* | ||
24 | ( | ||
25 | fvm::ddt(U) | ||
26 | + fvm::div(phase.phi(), U) | ||
27 | - fvm::Sp(fvc::div(phase.phi()), U) | ||
28 | ) | ||
29 | |||
30 | - fvm::laplacian(alpha*nuEff, U) | ||
31 | - fvc::div | ||
32 | ( | ||
33 | alpha*(nuEff*dev(T(fvc::grad(U))) /*- ((2.0/3.0)*I)*k*/), | ||
34 | "div(Rc)" | ||
35 | ) | ||
36 | == | ||
37 | //- fvm::Sp(fluid.dragCoeff(phase, dragCoeffs())/phase.rho(), U) | ||
38 | //- (alpha*phase.rho())*fluid.lift(phase) | ||
39 | //+ | ||
40 | (alpha/phase.rho())*fluid.Svm(phase) | ||
41 | - fvm::Sp | ||
42 | ( | ||
43 | slamDampCoeff | ||
44 | *max | ||
45 | ( | ||
46 | mag(U()) - maxSlamVelocity, | ||
47 | dimensionedScalar("U0", dimVelocity, 0) | ||
48 | ) | ||
49 | /pow(mesh.V(), 1.0/3.0), | ||
50 | U | ||
51 | ) | ||
52 | ) | ||
53 | ); | ||
54 | MRF.addAcceleration | ||
55 | ( | ||
56 | alpha*(1 + (1/phase.rho())*fluid.Cvm(phase)), | ||
57 | UEqns[phasei] | ||
58 | ); | ||
59 | //UEqns[phasei].relax(); | ||
60 | |||
61 | phasei++; | ||
62 | } |
File multiphaseEulerPbeFoam/Vandermonde/Make/files added (mode: 100644) (index 0000000..a7bde6d) | |||
1 | Vandermonde.C | ||
2 | |||
3 | LIB = $(FOAM_USER_LIBBIN)/libvandermonde |
File multiphaseEulerPbeFoam/Vandermonde/Make/options added (mode: 100644) (index 0000000..9bf6cb7) | |||
1 | EXE_INC = \ | ||
2 | -I$(LIB_SRC)/finiteVolume/lnInclude \ | ||
3 | |||
4 | EXE_LIBS = \ | ||
5 | -L$(FOAM_USER_LIBBIN) \ | ||
6 | -lfiniteVolume |
File multiphaseEulerPbeFoam/Vandermonde/Vandermonde.C added (mode: 100644) (index 0000000..88cc3a6) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2015-2016 Alberto Passalacqua | ||
6 | \\/ M anipulation | | ||
7 | ------------------------------------------------------------------------------- | ||
8 | License | ||
9 | This file is derivative work 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 "Vandermonde.H" | ||
27 | |||
28 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | ||
29 | |||
30 | Foam::Vandermonde::Vandermonde | ||
31 | ( | ||
32 | const scalarDiagonalMatrix& A | ||
33 | ) | ||
34 | : | ||
35 | scalarDiagonalMatrix(A), | ||
36 | m_(A.size()) | ||
37 | {} | ||
38 | |||
39 | |||
40 | Foam::Vandermonde::Vandermonde | ||
41 | ( | ||
42 | const scalarSquareMatrix& A, | ||
43 | const bool checkVandermonde | ||
44 | ) | ||
45 | : | ||
46 | scalarDiagonalMatrix(A.m()), | ||
47 | m_(A.m()) | ||
48 | { | ||
49 | if (checkVandermonde) | ||
50 | { | ||
51 | for (label i = 0; i < m_; i++) | ||
52 | { | ||
53 | for (label j = 0; i < m_; j++) | ||
54 | { | ||
55 | if (A[i][j] != pow(A[1][j], i)) | ||
56 | { | ||
57 | FatalErrorInFunction | ||
58 | << "Source matrix not of Vandermonde type." << nl | ||
59 | << abort(FatalError); | ||
60 | } | ||
61 | } | ||
62 | } | ||
63 | } | ||
64 | |||
65 | for (label i = 0; i < m_; i++) | ||
66 | { | ||
67 | (*this)[i] = A[1][i]; | ||
68 | } | ||
69 | } | ||
70 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | ||
71 | |||
72 | Foam::Vandermonde::~Vandermonde() | ||
73 | {} | ||
74 | |||
75 | |||
76 | // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // | ||
77 | |||
78 | void Foam::Vandermonde::solve | ||
79 | ( | ||
80 | scalarDiagonalMatrix& x, | ||
81 | const scalarDiagonalMatrix& source | ||
82 | ) | ||
83 | { | ||
84 | scalarDiagonalMatrix c(m_, 0.0); | ||
85 | |||
86 | scalar t = 1.0; | ||
87 | scalar r = 1.0; | ||
88 | scalar s = 0.0; | ||
89 | scalar xx = 0.0; | ||
90 | |||
91 | if (m_ == 1) | ||
92 | { | ||
93 | x[0] = source[0]; | ||
94 | } | ||
95 | else | ||
96 | { | ||
97 | c[m_ - 1] = -(*this)[0]; | ||
98 | |||
99 | for (label i = 1; i < m_; i++) | ||
100 | { | ||
101 | xx = -(*this)[i]; | ||
102 | |||
103 | for (label j = m_ - i - 1; j < m_ - 1; j++) | ||
104 | { | ||
105 | c[j] += xx*c[j + 1]; | ||
106 | } | ||
107 | c[m_ - 1] += xx; | ||
108 | } | ||
109 | |||
110 | for (label i = 0; i < m_; i++) | ||
111 | { | ||
112 | xx = (*this)[i]; | ||
113 | t = 1.0; | ||
114 | r = 1.0; | ||
115 | s = source[m_ - 1]; | ||
116 | |||
117 | for (label j = m_ - 1; j > 0; j--) | ||
118 | { | ||
119 | r = c[j] + r*xx; | ||
120 | s += r*source[j - 1]; | ||
121 | t = r + t*xx; | ||
122 | } | ||
123 | |||
124 | x[i] = s/t; | ||
125 | } | ||
126 | } | ||
127 | } | ||
128 | |||
129 | Foam::scalarSquareMatrix Foam::Vandermonde::inv() | ||
130 | { | ||
131 | scalarSquareMatrix inv(m_); | ||
132 | scalarDiagonalMatrix source(m_); | ||
133 | scalarDiagonalMatrix x(m_); | ||
134 | |||
135 | for (label i = 0; i < m_; i++) | ||
136 | { | ||
137 | for (label j = 0; j < m_; j++) | ||
138 | { | ||
139 | if (i != j) | ||
140 | { | ||
141 | source[j] = 0.0; | ||
142 | } | ||
143 | else | ||
144 | { | ||
145 | source[j] = 1.0; | ||
146 | } | ||
147 | } | ||
148 | |||
149 | solve(x, source); | ||
150 | |||
151 | for (label j = 0; j < m_; j++) | ||
152 | { | ||
153 | inv[j][i] = x[j]; | ||
154 | } | ||
155 | } | ||
156 | |||
157 | return inv; | ||
158 | } | ||
159 | |||
160 | |||
161 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/Vandermonde/Vandermonde.H added (mode: 100644) (index 0000000..f5f9ce2) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2015-2016 Alberto Passalacqua | ||
6 | \\/ M anipulation | | ||
7 | ------------------------------------------------------------------------------- | ||
8 | License | ||
9 | This file is derivative work 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 | Class | ||
25 | Foam::Vandermonde | ||
26 | |||
27 | Description | ||
28 | Stores the second row of a Vandermonde matrix, and solves the associated | ||
29 | linear system. | ||
30 | |||
31 | References | ||
32 | \verbatim | ||
33 | William H. Press, Saul A. Teukolsky, | ||
34 | William T. Vetterling, and Brian P. Flannery. 1992. | ||
35 | "Numerical Recipes in C (2nd Ed.): The Art of Scientific Computing." | ||
36 | Cambridge University Press, New York, NY, USA. | ||
37 | \endverbatim | ||
38 | |||
39 | SourceFiles | ||
40 | Vandermonde.C | ||
41 | |||
42 | \*---------------------------------------------------------------------------*/ | ||
43 | |||
44 | #ifndef Vandermonde_H | ||
45 | #define Vandermonde_H | ||
46 | |||
47 | #include "scalarMatrices.H" | ||
48 | |||
49 | |||
50 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
51 | |||
52 | namespace Foam | ||
53 | { | ||
54 | |||
55 | /*---------------------------------------------------------------------------*\ | ||
56 | Class Vandermonde Declaration | ||
57 | \*---------------------------------------------------------------------------*/ | ||
58 | |||
59 | class Vandermonde | ||
60 | : | ||
61 | public scalarDiagonalMatrix | ||
62 | { | ||
63 | // Private data | ||
64 | |||
65 | //- Dimesions of the matrix | ||
66 | const label m_; | ||
67 | |||
68 | public: | ||
69 | |||
70 | // Constructors | ||
71 | |||
72 | //- Construct from a given vector | ||
73 | Vandermonde | ||
74 | ( | ||
75 | const scalarDiagonalMatrix& A | ||
76 | ); | ||
77 | |||
78 | //- Construct from a square Vandermonde matrix | ||
79 | Vandermonde | ||
80 | ( | ||
81 | const scalarSquareMatrix& A, | ||
82 | const bool checkVandermonde = false | ||
83 | ); | ||
84 | |||
85 | |||
86 | //- Destructor | ||
87 | ~Vandermonde(); | ||
88 | |||
89 | |||
90 | // Member Functions | ||
91 | |||
92 | //- Solve the Vandermonde linear system with the given source vector | ||
93 | void solve | ||
94 | ( | ||
95 | scalarDiagonalMatrix& x, | ||
96 | const scalarDiagonalMatrix& source | ||
97 | ); | ||
98 | |||
99 | //- Invert Vandermonde matrix | ||
100 | scalarSquareMatrix inv(); | ||
101 | |||
102 | |||
103 | // Member Operators | ||
104 | |||
105 | //- Return the complete Vandermonde matrix | ||
106 | scalarSquareMatrix operator()(); | ||
107 | |||
108 | //- Return a given component of the Vandermonde matrix | ||
109 | scalar operator()(label i, label j); | ||
110 | }; | ||
111 | |||
112 | |||
113 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
114 | |||
115 | } // End namespace Foam | ||
116 | |||
117 | |||
118 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
119 | |||
120 | #include "VandermondeI.H" | ||
121 | |||
122 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
123 | |||
124 | #endif | ||
125 | |||
126 | |||
127 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/Vandermonde/VandermondeI.H added (mode: 100644) (index 0000000..d6266fb) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2015-2016 Alberto Passalacqua | ||
6 | \\/ M anipulation | | ||
7 | ------------------------------------------------------------------------------- | ||
8 | |||
9 | License | ||
10 | This file is derivative work of OpenFOAM. | ||
11 | |||
12 | OpenFOAM is free software: you can redistribute it and/or modify it | ||
13 | under the terms of the GNU General Public License as published by | ||
14 | the Free Software Foundation, either version 3 of the License, or | ||
15 | (at your option) any later version. | ||
16 | |||
17 | OpenFOAM is distributed in the hope that it will be useful, but WITHOUT | ||
18 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
19 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
20 | for more details. | ||
21 | |||
22 | You should have received a copy of the GNU General Public License | ||
23 | along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. | ||
24 | |||
25 | \*---------------------------------------------------------------------------*/ | ||
26 | |||
27 | // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // | ||
28 | |||
29 | Foam::scalarSquareMatrix Foam::Vandermonde::operator()() | ||
30 | { | ||
31 | scalarSquareMatrix tmpV(m_); | ||
32 | |||
33 | for (label i = 0; i < m_; i++) | ||
34 | { | ||
35 | for (label j = 0; j < m_; j++) | ||
36 | { | ||
37 | tmpV[i][j] = pow((*this)[j], i); | ||
38 | } | ||
39 | } | ||
40 | |||
41 | return tmpV; | ||
42 | } | ||
43 | |||
44 | Foam::scalar Foam::Vandermonde::operator()(label i, label j) | ||
45 | { | ||
46 | return pow((*this)[j], i); | ||
47 | } | ||
48 | |||
49 | |||
50 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/correctPhi.H added (mode: 100644) (index 0000000..9afcd58) | |||
1 | CorrectPhi | ||
2 | ( | ||
3 | U, | ||
4 | phi, | ||
5 | p_rgh, | ||
6 | dimensionedScalar("rAUf", dimTime/rho.dimensions(), 1), | ||
7 | geometricZeroField(), | ||
8 | pimple | ||
9 | ); | ||
10 | |||
11 | #include "continuityErrs.H" |
File multiphaseEulerPbeFoam/createFields.H added (mode: 100644) (index 0000000..d74d3ad) | |||
1 | Info<< "Reading field p_rgh\n" << endl; | ||
2 | volScalarField p_rgh | ||
3 | ( | ||
4 | IOobject | ||
5 | ( | ||
6 | "p_rgh", | ||
7 | runTime.timeName(), | ||
8 | mesh, | ||
9 | IOobject::MUST_READ, | ||
10 | IOobject::AUTO_WRITE | ||
11 | ), | ||
12 | mesh | ||
13 | ); | ||
14 | |||
15 | volVectorField U | ||
16 | ( | ||
17 | IOobject | ||
18 | ( | ||
19 | "U", | ||
20 | runTime.timeName(), | ||
21 | mesh, | ||
22 | IOobject::NO_READ, | ||
23 | IOobject::AUTO_WRITE | ||
24 | ), | ||
25 | mesh, | ||
26 | dimensionedVector("U", dimVelocity, Zero) | ||
27 | ); | ||
28 | |||
29 | surfaceScalarField phi | ||
30 | ( | ||
31 | IOobject | ||
32 | ( | ||
33 | "phi", | ||
34 | runTime.timeName(), | ||
35 | mesh, | ||
36 | IOobject::NO_READ, | ||
37 | IOobject::AUTO_WRITE | ||
38 | ), | ||
39 | mesh, | ||
40 | dimensionedScalar("phi", dimArea*dimVelocity, 0) | ||
41 | ); | ||
42 | |||
43 | multiphaseSystem fluid(U, phi); | ||
44 | |||
45 | forAllIter(PtrDictionary<phaseModel>, fluid.phases(), iter) | ||
46 | { | ||
47 | phaseModel& phase = iter(); | ||
48 | const volScalarField& alpha = phase; | ||
49 | |||
50 | U += alpha*phase.U(); | ||
51 | phi += fvc::interpolate(alpha)*phase.phi(); | ||
52 | } | ||
53 | |||
54 | |||
55 | volScalarField rho | ||
56 | ( | ||
57 | IOobject | ||
58 | ( | ||
59 | "rho", | ||
60 | runTime.timeName(), | ||
61 | mesh, | ||
62 | IOobject::NO_READ, | ||
63 | IOobject::AUTO_WRITE | ||
64 | ), | ||
65 | fluid.rho() | ||
66 | ); | ||
67 | |||
68 | |||
69 | // Construct incompressible turbulence model | ||
70 | autoPtr<incompressible::turbulenceModel> turbulence | ||
71 | ( | ||
72 | incompressible::turbulenceModel::New(U, phi, fluid) | ||
73 | ); | ||
74 | |||
75 | |||
76 | #include "readGravitationalAcceleration.H" | ||
77 | #include "readhRef.H" | ||
78 | #include "gh.H" | ||
79 | |||
80 | |||
81 | volScalarField p | ||
82 | ( | ||
83 | IOobject | ||
84 | ( | ||
85 | "p", | ||
86 | runTime.timeName(), | ||
87 | mesh, | ||
88 | IOobject::NO_READ, | ||
89 | IOobject::AUTO_WRITE | ||
90 | ), | ||
91 | p_rgh + rho*gh | ||
92 | ); | ||
93 | |||
94 | label pRefCell = 0; | ||
95 | scalar pRefValue = 0.0; | ||
96 | setRefCell | ||
97 | ( | ||
98 | p, | ||
99 | p_rgh, | ||
100 | pimple.dict(), | ||
101 | pRefCell, | ||
102 | pRefValue | ||
103 | ); | ||
104 | mesh.setFluxRequired(p_rgh.name()); | ||
105 | |||
106 | |||
107 | #include "createMRFZones.H" | ||
108 | |||
109 | // Define population balance variables | ||
110 | Info<< "Reading populationBalanceProperties\n" << endl; | ||
111 | |||
112 | IOdictionary populationBalanceProperties | ||
113 | ( | ||
114 | IOobject | ||
115 | ( | ||
116 | "populationBalanceProperties", | ||
117 | runTime.constant(), | ||
118 | mesh, | ||
119 | IOobject::MUST_READ_IF_MODIFIED, | ||
120 | IOobject::NO_WRITE | ||
121 | ) | ||
122 | ); | ||
123 | |||
124 | autoPtr<populationBalanceModel> populationBalance | ||
125 | ( | ||
126 | populationBalanceModel::New | ||
127 | ( | ||
128 | "populationBalance", populationBalanceProperties, U, phi | ||
129 | ) | ||
130 | ); |
File multiphaseEulerPbeFoam/createMRFZones.H added (mode: 100644) (index 0000000..ea04f3e) | |||
1 | IOMRFZoneList MRF(mesh); | ||
2 | |||
3 | forAllIter(PtrDictionary<phaseModel>, fluid.phases(), iter) | ||
4 | { | ||
5 | MRF.correctBoundaryVelocity(iter().U()); | ||
6 | } | ||
7 | |||
8 | MRF.correctBoundaryVelocity(U); |
File multiphaseEulerPbeFoam/eigenSolver/Make/files added (mode: 100644) (index 0000000..01a8c2e) | |||
1 | eigenSolver.C | ||
2 | |||
3 | LIB = $(FOAM_USER_LIBBIN)/libeigenSolver |
File multiphaseEulerPbeFoam/eigenSolver/Make/options added (mode: 100644) (index 0000000..a55ccac) | |||
1 | EXE_INC = \ | ||
2 | -I../lnInclude \ | ||
3 | -I$(LIB_SRC)/finiteVolume/lnInclude | ||
4 | |||
5 | LIB_LIBS = \ | ||
6 | -lOpenFOAM |
File multiphaseEulerPbeFoam/eigenSolver/eigenSolver.C added (mode: 100644) (index 0000000..e8c362e) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2014-2015 Alberto Passalacqua | ||
6 | \\/ M anipulation | | ||
7 | ------------------------------------------------------------------------------- | ||
8 | License | ||
9 | This file is derivative work 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 "eigenSolver.H" | ||
27 | #include "scalar.H" | ||
28 | #include "scalarMatrices.H" | ||
29 | |||
30 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | ||
31 | |||
32 | Foam::eigenSolver::eigenSolver | ||
33 | ( | ||
34 | const scalarSquareMatrix& A | ||
35 | ) | ||
36 | : | ||
37 | eigenvaluesRe_(A.n()), | ||
38 | eigenvaluesIm_(A.n()), | ||
39 | eigenvectors_(A.n(), A.n()), | ||
40 | H_(), | ||
41 | n_(A.n()) | ||
42 | { | ||
43 | if (isSymmetric(A)) | ||
44 | { | ||
45 | eigenvectors_ = A; | ||
46 | tridiagonaliseSymmMatrix(); | ||
47 | symmTridiagQL(); | ||
48 | } | ||
49 | else | ||
50 | { | ||
51 | H_ = A; | ||
52 | Hessenberg(); | ||
53 | realSchur(); | ||
54 | } | ||
55 | } | ||
56 | |||
57 | Foam::eigenSolver::eigenSolver(const scalarSquareMatrix& A, bool symmetric) | ||
58 | : | ||
59 | eigenvaluesRe_(A.n()), | ||
60 | eigenvaluesIm_(A.n()), | ||
61 | eigenvectors_(A.n(), A.n()), | ||
62 | H_(), | ||
63 | n_(A.n()) | ||
64 | { | ||
65 | if (symmetric) | ||
66 | { | ||
67 | eigenvectors_ = A; | ||
68 | tridiagonaliseSymmMatrix(); | ||
69 | symmTridiagQL(); | ||
70 | } | ||
71 | else | ||
72 | { | ||
73 | H_ = A; | ||
74 | Hessenberg(); | ||
75 | realSchur(); | ||
76 | } | ||
77 | } | ||
78 | |||
79 | bool Foam::eigenSolver::isSymmetric(const scalarSquareMatrix& A) | ||
80 | { | ||
81 | bool symm = true; | ||
82 | |||
83 | for (label j = 0; (j < n_) && symm; j++) | ||
84 | { | ||
85 | for (label i = 0; (i < n_) && symm; i++) | ||
86 | { | ||
87 | symm = (A[i][j] == A[j][i]); | ||
88 | } | ||
89 | } | ||
90 | |||
91 | return symm; | ||
92 | } | ||
93 | |||
94 | void Foam::eigenSolver::tridiagonaliseSymmMatrix() | ||
95 | { | ||
96 | for (label j = 0; j < n_; j++) | ||
97 | { | ||
98 | eigenvaluesRe_[j] = eigenvectors_[n_ - 1][j]; | ||
99 | } | ||
100 | |||
101 | // Householder reduction to tridiagonal form | ||
102 | for (label i = n_ - 1; i > 0; i--) | ||
103 | { | ||
104 | // Scale to avoid under/overflow. | ||
105 | scalar scale = scalar(0); | ||
106 | scalar h = scalar(0); | ||
107 | |||
108 | for (label k = 0; k < i; k++) | ||
109 | { | ||
110 | scale = scale + mag(eigenvaluesRe_[k]); | ||
111 | } | ||
112 | |||
113 | if (scale == 0.0) | ||
114 | { | ||
115 | eigenvaluesIm_[i] = eigenvaluesRe_[i - 1]; | ||
116 | |||
117 | for (label j = 0; j < i; j++) | ||
118 | { | ||
119 | eigenvaluesRe_[j] = eigenvectors_[i - 1][j]; | ||
120 | eigenvectors_[i][j] = scalar(0); | ||
121 | eigenvectors_[j][i] = scalar(0); | ||
122 | } | ||
123 | } | ||
124 | else | ||
125 | { | ||
126 | // Generate Householder vector | ||
127 | for (label k = 0; k < i; k++) | ||
128 | { | ||
129 | eigenvaluesRe_[k] /= scale; | ||
130 | h += eigenvaluesRe_[k]*eigenvaluesRe_[k]; | ||
131 | } | ||
132 | |||
133 | scalar f = eigenvaluesRe_[i - 1]; | ||
134 | scalar g = sqrt(h); | ||
135 | |||
136 | if (f > 0) | ||
137 | { | ||
138 | g = -g; | ||
139 | } | ||
140 | |||
141 | eigenvaluesIm_[i] = scale*g; | ||
142 | h -= f*g; | ||
143 | eigenvaluesRe_[i - 1] = f - g; | ||
144 | |||
145 | for (label j = 0; j < i; j++) | ||
146 | { | ||
147 | eigenvaluesIm_[j] = scalar(0); | ||
148 | } | ||
149 | |||
150 | // Apply similarity transformation to remaining columns | ||
151 | for (label j = 0; j < i; j++) | ||
152 | { | ||
153 | f = eigenvaluesRe_[j]; | ||
154 | eigenvectors_[j][i] = f; | ||
155 | g = eigenvaluesIm_[j] + eigenvectors_[j][j]*f; | ||
156 | |||
157 | for (label k = j + 1; k <= i - 1; k++) | ||
158 | { | ||
159 | g += eigenvectors_[k][j]*eigenvaluesRe_[k]; | ||
160 | eigenvaluesIm_[k] += eigenvectors_[k][j]*f; | ||
161 | } | ||
162 | |||
163 | eigenvaluesIm_[j] = g; | ||
164 | } | ||
165 | |||
166 | f = scalar(0); | ||
167 | |||
168 | for (label j = 0; j < i; j++) | ||
169 | { | ||
170 | eigenvaluesIm_[j] /= h; | ||
171 | f += eigenvaluesIm_[j]*eigenvaluesRe_[j]; | ||
172 | } | ||
173 | |||
174 | scalar hh = f/(2.0*h); | ||
175 | |||
176 | for (label j = 0; j < i; j++) | ||
177 | { | ||
178 | eigenvaluesIm_[j] -= hh*eigenvaluesRe_[j]; | ||
179 | } | ||
180 | |||
181 | for (label j = 0; j < i; j++) | ||
182 | { | ||
183 | f = eigenvaluesRe_[j]; | ||
184 | g = eigenvaluesIm_[j]; | ||
185 | |||
186 | for (label k = j; k <= i - 1; k++) | ||
187 | { | ||
188 | eigenvectors_[k][j] -= | ||
189 | (f*eigenvaluesIm_[k] + g*eigenvaluesRe_[k]); | ||
190 | } | ||
191 | |||
192 | eigenvaluesRe_[j] = eigenvectors_[i - 1][j]; | ||
193 | eigenvectors_[i][j] = scalar(0); | ||
194 | } | ||
195 | } | ||
196 | |||
197 | eigenvaluesRe_[i] = h; | ||
198 | } | ||
199 | |||
200 | // Accumulate transformations | ||
201 | for (label i = 0; i < n_ - 1; i++) | ||
202 | { | ||
203 | eigenvectors_[n_ - 1][i] = eigenvectors_[i][i]; | ||
204 | eigenvectors_[i][i] = scalar(1); | ||
205 | scalar h = eigenvaluesRe_[i + 1]; | ||
206 | |||
207 | if (h != 0.0) | ||
208 | { | ||
209 | for (label k = 0; k <= i; k++) | ||
210 | { | ||
211 | eigenvaluesRe_[k] = eigenvectors_[k][i + 1]/h; | ||
212 | } | ||
213 | |||
214 | for (label j = 0; j <= i; j++) | ||
215 | { | ||
216 | scalar g = scalar(0); | ||
217 | |||
218 | for (label k = 0; k <= i; k++) | ||
219 | { | ||
220 | g += eigenvectors_[k][i + 1]*eigenvectors_[k][j]; | ||
221 | } | ||
222 | |||
223 | for (label k = 0; k <= i; k++) | ||
224 | { | ||
225 | eigenvectors_[k][j] -= g*eigenvaluesRe_[k]; | ||
226 | } | ||
227 | } | ||
228 | } | ||
229 | |||
230 | for (label k = 0; k <= i; k++) | ||
231 | { | ||
232 | eigenvectors_[k][i + 1] = scalar(0); | ||
233 | } | ||
234 | } | ||
235 | |||
236 | for (label j = 0; j < n_; j++) | ||
237 | { | ||
238 | eigenvaluesRe_[j] = eigenvectors_[n_ - 1][j]; | ||
239 | eigenvectors_[n_ - 1][j] = scalar(0); | ||
240 | } | ||
241 | |||
242 | eigenvectors_[n_ - 1][n_ - 1] = scalar(1); | ||
243 | eigenvaluesIm_[0] = scalar(0); | ||
244 | } | ||
245 | |||
246 | void Foam::eigenSolver::symmTridiagQL() | ||
247 | { | ||
248 | for (label i = 1; i < n_; i++) | ||
249 | { | ||
250 | eigenvaluesIm_[i - 1] = eigenvaluesIm_[i]; | ||
251 | } | ||
252 | |||
253 | eigenvaluesIm_[n_-1] = scalar(0); | ||
254 | |||
255 | scalar f = scalar(0); | ||
256 | scalar tst1 = scalar(0); | ||
257 | scalar eps = pow(2.0, -52.0); | ||
258 | |||
259 | for (label l = 0; l < n_; l++) | ||
260 | { | ||
261 | // Find small subdiagonal element | ||
262 | tst1 = max(tst1, mag(eigenvaluesRe_[l]) + mag(eigenvaluesIm_[l])); | ||
263 | label m = l; | ||
264 | |||
265 | // Original while-loop from Java code | ||
266 | while (m < n_) | ||
267 | { | ||
268 | if (mag(eigenvaluesIm_[m]) <= eps*tst1) | ||
269 | { | ||
270 | break; | ||
271 | } | ||
272 | |||
273 | m++; | ||
274 | } | ||
275 | |||
276 | // If m == l, eigenvaluesRe_[l] is an eigenvalue, otherwise, iterate | ||
277 | if (m > l) | ||
278 | { | ||
279 | label iter = 0; | ||
280 | |||
281 | do | ||
282 | { | ||
283 | iter += 1; | ||
284 | |||
285 | // Compute implicit shift | ||
286 | scalar g = eigenvaluesRe_[l]; | ||
287 | scalar p = (eigenvaluesRe_[l + 1] - g)/(2.0*eigenvaluesIm_[l]); | ||
288 | scalar r = hypot(p, 1.0); | ||
289 | |||
290 | if (p < 0) | ||
291 | { | ||
292 | r = -r; | ||
293 | } | ||
294 | |||
295 | eigenvaluesRe_[l] = eigenvaluesIm_[l]/(p + r); | ||
296 | eigenvaluesRe_[l + 1] = eigenvaluesIm_[l]*(p + r); | ||
297 | scalar dl1 = eigenvaluesRe_[l + 1]; | ||
298 | scalar h = g - eigenvaluesRe_[l]; | ||
299 | |||
300 | for (label i = l + 2; i < n_; i++) | ||
301 | { | ||
302 | eigenvaluesRe_[i] -= h; | ||
303 | } | ||
304 | |||
305 | f += h; | ||
306 | |||
307 | // Implicit QL transformation. | ||
308 | p = eigenvaluesRe_[m]; | ||
309 | scalar c = scalar(1); | ||
310 | scalar c2 = c; | ||
311 | scalar c3 = c; | ||
312 | scalar el1 = eigenvaluesIm_[l + 1]; | ||
313 | scalar s = scalar(0); | ||
314 | scalar s2 = scalar(0); | ||
315 | |||
316 | for (label i = m - 1; i >= l; i--) | ||
317 | { | ||
318 | c3 = c2; | ||
319 | c2 = c; | ||
320 | s2 = s; | ||
321 | g = c*eigenvaluesIm_[i]; | ||
322 | h = c*p; | ||
323 | r = hypot(p, eigenvaluesIm_[i]); | ||
324 | eigenvaluesIm_[i + 1] = s*r; | ||
325 | s = eigenvaluesIm_[i]/r; | ||
326 | c = p/r; | ||
327 | p = c*eigenvaluesRe_[i] - s*g; | ||
328 | eigenvaluesRe_[i + 1] = h + s*(c*g + s*eigenvaluesRe_[i]); | ||
329 | |||
330 | // Accumulate transformation | ||
331 | for (label k = 0; k < n_; k++) | ||
332 | { | ||
333 | h = eigenvectors_[k][i + 1]; | ||
334 | eigenvectors_[k][i + 1] = s*eigenvectors_[k][i] + c*h; | ||
335 | eigenvectors_[k][i] = c*eigenvectors_[k][i] - s*h; | ||
336 | } | ||
337 | } | ||
338 | |||
339 | p = -s*s2*c3*el1*eigenvaluesIm_[l]/dl1; | ||
340 | eigenvaluesIm_[l] = s*p; | ||
341 | eigenvaluesRe_[l] = c*p; | ||
342 | } | ||
343 | while (mag(eigenvaluesIm_[l]) > eps*tst1); // Convergence check | ||
344 | } | ||
345 | |||
346 | eigenvaluesRe_[l] = eigenvaluesRe_[l] + f; | ||
347 | eigenvaluesIm_[l] = scalar(0); | ||
348 | } | ||
349 | |||
350 | // Sorting eigenvalues and corresponding vectors | ||
351 | for (label i = 0; i < n_ - 1; i++) | ||
352 | { | ||
353 | label k = i; | ||
354 | scalar p = eigenvaluesRe_[i]; | ||
355 | |||
356 | for (label j = i + 1; j < n_; j++) | ||
357 | { | ||
358 | if (eigenvaluesRe_[j] < p) | ||
359 | { | ||
360 | k = j; | ||
361 | p = eigenvaluesRe_[j]; | ||
362 | } | ||
363 | } | ||
364 | |||
365 | if (k != i) | ||
366 | { | ||
367 | eigenvaluesRe_[k] = eigenvaluesRe_[i]; | ||
368 | eigenvaluesRe_[i] = p; | ||
369 | |||
370 | for (label j = 0; j < n_; j++) | ||
371 | { | ||
372 | p = eigenvectors_[j][i]; | ||
373 | eigenvectors_[j][i] = eigenvectors_[j][k]; | ||
374 | eigenvectors_[j][k] = p; | ||
375 | } | ||
376 | } | ||
377 | } | ||
378 | } | ||
379 | |||
380 | void Foam::eigenSolver::Hessenberg() | ||
381 | { | ||
382 | scalarDiagonalMatrix orth_(n_); | ||
383 | |||
384 | label low = 0; | ||
385 | label high = n_ - 1; | ||
386 | |||
387 | for (label m = low + 1; m <= high - 1; m++) | ||
388 | { | ||
389 | // Scale column | ||
390 | scalar scale = scalar(0); | ||
391 | |||
392 | for (label i = m; i <= high; i++) | ||
393 | { | ||
394 | scale = scale + mag(H_[i][m - 1]); | ||
395 | } | ||
396 | |||
397 | if (scale != 0.0) | ||
398 | { | ||
399 | // Compute Householder transformation | ||
400 | scalar h = scalar(0); | ||
401 | |||
402 | for (label i = high; i >= m; i--) | ||
403 | { | ||
404 | orth_[i] = H_[i][m - 1]/scale; | ||
405 | h += orth_[i]*orth_[i]; | ||
406 | } | ||
407 | |||
408 | scalar g = sqrt(h); | ||
409 | |||
410 | if (orth_[m] > 0) | ||
411 | { | ||
412 | g = -g; | ||
413 | } | ||
414 | |||
415 | h -= orth_[m]*g; | ||
416 | orth_[m] -= g; | ||
417 | |||
418 | // Apply Householder similarity transformation | ||
419 | // H = (I - u*u'/h)*H*(I - u*u')/h) | ||
420 | for (label j = m; j < n_; j++) | ||
421 | { | ||
422 | scalar f = scalar(0); | ||
423 | |||
424 | for (label i = high; i >= m; i--) | ||
425 | { | ||
426 | f += orth_[i]*H_[i][j]; | ||
427 | } | ||
428 | |||
429 | f /= h; | ||
430 | |||
431 | for (label i = m; i <= high; i++) | ||
432 | { | ||
433 | H_[i][j] -= f*orth_[i]; | ||
434 | } | ||
435 | } | ||
436 | |||
437 | for (label i = 0; i <= high; i++) | ||
438 | { | ||
439 | scalar f = scalar(0); | ||
440 | |||
441 | for (label j = high; j >= m; j--) | ||
442 | { | ||
443 | f += orth_[j]*H_[i][j]; | ||
444 | } | ||
445 | |||
446 | f /= h; | ||
447 | |||
448 | for (label j = m; j <= high; j++) | ||
449 | { | ||
450 | H_[i][j] -= f*orth_[j]; | ||
451 | } | ||
452 | } | ||
453 | |||
454 | orth_[m] = scale*orth_[m]; | ||
455 | H_[m][m-1] = scale*g; | ||
456 | } | ||
457 | } | ||
458 | |||
459 | // Accumulate transformations | ||
460 | for (label i = 0; i < n_; i++) | ||
461 | { | ||
462 | for (label j = 0; j < n_; j++) | ||
463 | { | ||
464 | eigenvectors_[i][j] = (i == j ? 1.0 : 0.0); | ||
465 | } | ||
466 | } | ||
467 | |||
468 | for (label m = high - 1; m >= low + 1; m--) | ||
469 | { | ||
470 | if (H_[m][m - 1] != 0.0) | ||
471 | { | ||
472 | for (label i = m + 1; i <= high; i++) | ||
473 | { | ||
474 | orth_[i] = H_[i][m - 1]; | ||
475 | } | ||
476 | |||
477 | for (label j = m; j <= high; j++) | ||
478 | { | ||
479 | scalar g = scalar(0); | ||
480 | |||
481 | for (label i = m; i <= high; i++) | ||
482 | { | ||
483 | g += orth_[i]*eigenvectors_[i][j]; | ||
484 | } | ||
485 | |||
486 | // Double division avoids possible underflow | ||
487 | g = (g/orth_[m])/H_[m][m - 1]; | ||
488 | |||
489 | for (label i = m; i <= high; i++) | ||
490 | { | ||
491 | eigenvectors_[i][j] += g*orth_[i]; | ||
492 | } | ||
493 | } | ||
494 | } | ||
495 | } | ||
496 | } | ||
497 | |||
498 | void Foam::eigenSolver::realSchur() | ||
499 | { | ||
500 | // Initialize | ||
501 | label nn = n_; | ||
502 | label n = nn - 1; | ||
503 | label low = 0; | ||
504 | label high = nn - 1; | ||
505 | scalar eps = pow(2.0, -52.0); | ||
506 | scalar exshift = scalar(0); | ||
507 | scalar p = 0, q = 0, r = 0, s = 0, z = 0, t, w, x, y; | ||
508 | |||
509 | // Store roots isolated by balance and compute matrix norm | ||
510 | scalar norm = scalar(0); | ||
511 | |||
512 | for (label i = 0; i < nn; i++) | ||
513 | { | ||
514 | if ((i < low) || (i > high)) | ||
515 | { | ||
516 | eigenvaluesRe_[i] = H_[i][i]; | ||
517 | eigenvaluesIm_[i] = scalar(0); | ||
518 | } | ||
519 | |||
520 | for (label j = max(i - 1, 0); j < nn; j++) | ||
521 | { | ||
522 | norm += mag(H_[i][j]); | ||
523 | } | ||
524 | } | ||
525 | |||
526 | label iter = 0; | ||
527 | |||
528 | while (n >= low) | ||
529 | { | ||
530 | // Look for single small sub-diagonal element | ||
531 | label l = n; | ||
532 | |||
533 | while (l > low) | ||
534 | { | ||
535 | s = mag(H_[l - 1][l - 1]) + mag(H_[l][l]); | ||
536 | |||
537 | if (s == 0.0) | ||
538 | { | ||
539 | s = norm; | ||
540 | } | ||
541 | |||
542 | if (mag(H_[l][l - 1]) < eps*s) | ||
543 | { | ||
544 | break; | ||
545 | } | ||
546 | |||
547 | l--; | ||
548 | } | ||
549 | |||
550 | // Check for convergence | ||
551 | if (l == n) // One root found | ||
552 | { | ||
553 | H_[n][n] = H_[n][n] + exshift; | ||
554 | eigenvaluesRe_[n] = H_[n][n]; | ||
555 | eigenvaluesIm_[n] = scalar(0); | ||
556 | n--; | ||
557 | iter = 0; | ||
558 | } | ||
559 | else if (l == n - 1) // Two roots found | ||
560 | { | ||
561 | w = H_[n][n - 1]*H_[n - 1][n]; | ||
562 | p = (H_[n - 1][n - 1] - H_[n][n])/2.0; | ||
563 | q = p*p + w; | ||
564 | z = sqrt(mag(q)); | ||
565 | H_[n][n] += exshift; | ||
566 | H_[n - 1][n - 1] += exshift; | ||
567 | x = H_[n][n]; | ||
568 | |||
569 | // Scalar pair | ||
570 | if (q >= 0) | ||
571 | { | ||
572 | if (p >= 0) | ||
573 | { | ||
574 | z = p + z; | ||
575 | } | ||
576 | else | ||
577 | { | ||
578 | z = p - z; | ||
579 | } | ||
580 | |||
581 | eigenvaluesRe_[n - 1] = x + z; | ||
582 | eigenvaluesRe_[n] = eigenvaluesRe_[n - 1]; | ||
583 | |||
584 | if (z != 0.0) | ||
585 | { | ||
586 | eigenvaluesRe_[n] = x - w/z; | ||
587 | } | ||
588 | |||
589 | eigenvaluesIm_[n - 1] = scalar(0); | ||
590 | eigenvaluesIm_[n] = scalar(0); | ||
591 | x = H_[n][n - 1]; | ||
592 | s = mag(x) + mag(z); | ||
593 | p = x/s; | ||
594 | q = z/s; | ||
595 | r = sqrt(p*p + q*q); | ||
596 | p /= r; | ||
597 | q /= r; | ||
598 | |||
599 | // Row modification | ||
600 | for (label j = n - 1; j < nn; j++) | ||
601 | { | ||
602 | z = H_[n - 1][j]; | ||
603 | H_[n - 1][j] = q*z + p*H_[n][j]; | ||
604 | H_[n][j] = q*H_[n][j] - p*z; | ||
605 | } | ||
606 | |||
607 | // Column modification | ||
608 | for (label i = 0; i <= n; i++) | ||
609 | { | ||
610 | z = H_[i][n - 1]; | ||
611 | H_[i][n - 1] = q*z + p*H_[i][n]; | ||
612 | H_[i][n] = q*H_[i][n] - p*z; | ||
613 | } | ||
614 | |||
615 | // Accumulate transformations | ||
616 | for (label i = low; i <= high; i++) | ||
617 | { | ||
618 | z = eigenvectors_[i][n - 1]; | ||
619 | eigenvectors_[i][n - 1] = q*z + p*eigenvectors_[i][n]; | ||
620 | eigenvectors_[i][n] = q*eigenvectors_[i][n] - p*z; | ||
621 | } | ||
622 | } | ||
623 | else // Complex pair of roots | ||
624 | { | ||
625 | eigenvaluesRe_[n - 1] = x + p; | ||
626 | eigenvaluesRe_[n] = x + p; | ||
627 | eigenvaluesIm_[n - 1] = z; | ||
628 | eigenvaluesIm_[n] = -z; | ||
629 | } | ||
630 | |||
631 | n -= 2; | ||
632 | iter = 0; | ||
633 | } | ||
634 | else // No convergence yet | ||
635 | { | ||
636 | // Form shift | ||
637 | x = H_[n][n]; | ||
638 | y = scalar(0); | ||
639 | w = scalar(0); | ||
640 | |||
641 | if (l < n) | ||
642 | { | ||
643 | y = H_[n - 1][n - 1]; | ||
644 | w = H_[n][n - 1]*H_[n - 1][n]; | ||
645 | } | ||
646 | |||
647 | // Wilkinson's original ad-hoc shift | ||
648 | if (iter == 10) | ||
649 | { | ||
650 | exshift += x; | ||
651 | for (label i = low; i <= n; i++) | ||
652 | { | ||
653 | H_[i][i] -= x; | ||
654 | } | ||
655 | |||
656 | s = mag(H_[n][n - 1]) + mag(H_[n - 1][n - 2]); | ||
657 | x = 0.75*s; | ||
658 | y = 0.75*s; | ||
659 | w = -0.4375*s*s; | ||
660 | } | ||
661 | |||
662 | // New ad hoc shift | ||
663 | if (iter == 30) | ||
664 | { | ||
665 | s = (y - x)/2.0; | ||
666 | s = s*s + w; | ||
667 | |||
668 | if (s > 0) | ||
669 | { | ||
670 | s = sqrt(s); | ||
671 | |||
672 | if (y < x) | ||
673 | { | ||
674 | s = -s; | ||
675 | } | ||
676 | |||
677 | s = x - w/((y - x)/2.0 + s); | ||
678 | |||
679 | for (label i = low; i <= n; i++) | ||
680 | { | ||
681 | H_[i][i] -= s; | ||
682 | } | ||
683 | |||
684 | exshift += s; | ||
685 | x = 0.964; | ||
686 | y = 0.964; | ||
687 | w = 0.964; | ||
688 | } | ||
689 | } | ||
690 | |||
691 | iter += 1; | ||
692 | |||
693 | // Look for two consecutive small sub-diagonal elements | ||
694 | label m = n - 2; | ||
695 | |||
696 | while (m >= l) | ||
697 | { | ||
698 | z = H_[m][m]; | ||
699 | r = x - z; | ||
700 | s = y - z; | ||
701 | p = (r*s - w)/H_[m + 1][m] + H_[m][m + 1]; | ||
702 | q = H_[m + 1][m + 1] - z - r - s; | ||
703 | r = H_[m + 2][m + 1]; | ||
704 | s = mag(p) + mag(q) + mag(r); | ||
705 | p /= s; | ||
706 | q /= s; | ||
707 | r /= s; | ||
708 | |||
709 | if (m == l) | ||
710 | { | ||
711 | break; | ||
712 | } | ||
713 | |||
714 | if | ||
715 | ( | ||
716 | mag(H_[m][m - 1])*(mag(q) + mag(r)) | ||
717 | < eps*(mag(p)*(mag(H_[m - 1][m - 1]) | ||
718 | + mag(z) + mag(H_[m + 1][m + 1]))) | ||
719 | ) | ||
720 | { | ||
721 | break; | ||
722 | } | ||
723 | |||
724 | m--; | ||
725 | } | ||
726 | |||
727 | for (label i = m + 2; i <= n; i++) | ||
728 | { | ||
729 | H_[i][i - 2] = scalar(0); | ||
730 | |||
731 | if (i > m + 2) | ||
732 | { | ||
733 | H_[i][i - 3] = scalar(0); | ||
734 | } | ||
735 | } | ||
736 | |||
737 | // Double QR step involving rows l:n and columns m:n | ||
738 | for (label k = m; k <= n - 1; k++) | ||
739 | { | ||
740 | label notlast = (k != n - 1); | ||
741 | |||
742 | if (k != m) | ||
743 | { | ||
744 | p = H_[k][k - 1]; | ||
745 | q = H_[k + 1][k - 1]; | ||
746 | r = (notlast ? H_[k + 2][k - 1] : 0.0); | ||
747 | x = mag(p) + mag(q) + mag(r); | ||
748 | |||
749 | if (x != 0.0) | ||
750 | { | ||
751 | p /= x; | ||
752 | q /= x; | ||
753 | r /= x; | ||
754 | } | ||
755 | } | ||
756 | |||
757 | if (x == 0.0) | ||
758 | { | ||
759 | break; | ||
760 | } | ||
761 | |||
762 | s = sqrt(p*p + q*q + r*r); | ||
763 | |||
764 | if (p < 0) | ||
765 | { | ||
766 | s = -s; | ||
767 | } | ||
768 | |||
769 | if (s != 0) | ||
770 | { | ||
771 | if (k != m) | ||
772 | { | ||
773 | H_[k][k - 1] = -s*x; | ||
774 | } | ||
775 | else if (l != m) | ||
776 | { | ||
777 | H_[k][k - 1] = -H_[k][k - 1]; | ||
778 | } | ||
779 | |||
780 | p = p + s; | ||
781 | x = p/s; | ||
782 | y = q/s; | ||
783 | z = r/s; | ||
784 | q /= p; | ||
785 | r /= p; | ||
786 | |||
787 | // Row modification | ||
788 | for (label j = k; j < nn; j++) | ||
789 | { | ||
790 | p = H_[k][j] + q*H_[k + 1][j]; | ||
791 | |||
792 | if (notlast) | ||
793 | { | ||
794 | p += r*H_[k + 2][j]; | ||
795 | H_[k + 2][j] -= p*z; | ||
796 | } | ||
797 | |||
798 | H_[k][j] -= p*x; | ||
799 | H_[k + 1][j] -= p*y; | ||
800 | } | ||
801 | |||
802 | // Column modification | ||
803 | for (label i = 0; i <= min(n, k + 3); i++) | ||
804 | { | ||
805 | p = x*H_[i][k] + y*H_[i][k + 1]; | ||
806 | |||
807 | if (notlast) | ||
808 | { | ||
809 | p += z*H_[i][k + 2]; | ||
810 | H_[i][k + 2] -= p*r; | ||
811 | } | ||
812 | |||
813 | H_[i][k] -= p; | ||
814 | H_[i][k + 1] -= p*q; | ||
815 | } | ||
816 | |||
817 | // Accumulate transformations | ||
818 | for (label i = low; i <= high; i++) | ||
819 | { | ||
820 | p = x*eigenvectors_[i][k] + y*eigenvectors_[i][k + 1]; | ||
821 | |||
822 | if (notlast) | ||
823 | { | ||
824 | p += z*eigenvectors_[i][k + 2]; | ||
825 | eigenvectors_[i][k + 2] -= p*r; | ||
826 | } | ||
827 | |||
828 | eigenvectors_[i][k] -= p; | ||
829 | eigenvectors_[i][k + 1] -= p*q; | ||
830 | } | ||
831 | } | ||
832 | } | ||
833 | } | ||
834 | } | ||
835 | |||
836 | // Backsubstitute to find vectors of upper triangular form | ||
837 | if (norm == 0.0) | ||
838 | { | ||
839 | return; | ||
840 | } | ||
841 | |||
842 | for (n = nn-1; n >= 0; n--) | ||
843 | { | ||
844 | p = eigenvaluesRe_[n]; | ||
845 | q = eigenvaluesIm_[n]; | ||
846 | |||
847 | // scalar vector | ||
848 | if (q == 0) | ||
849 | { | ||
850 | label l = n; | ||
851 | H_[n][n] = scalar(1); | ||
852 | |||
853 | for (label i = n-1; i >= 0; i--) | ||
854 | { | ||
855 | w = H_[i][i] - p; | ||
856 | r = scalar(0); | ||
857 | |||
858 | for (label j = l; j <= n; j++) | ||
859 | { | ||
860 | r += H_[i][j]*H_[j][n]; | ||
861 | } | ||
862 | |||
863 | if (eigenvaluesIm_[i] < 0.0) | ||
864 | { | ||
865 | z = w; | ||
866 | s = r; | ||
867 | } | ||
868 | else | ||
869 | { | ||
870 | l = i; | ||
871 | |||
872 | if (eigenvaluesIm_[i] == 0.0) | ||
873 | { | ||
874 | if (w != 0.0) | ||
875 | { | ||
876 | H_[i][n] = -r/w; | ||
877 | } | ||
878 | else | ||
879 | { | ||
880 | H_[i][n] = -r/(eps*norm); | ||
881 | } | ||
882 | } | ||
883 | else // Solve real equations | ||
884 | { | ||
885 | x = H_[i][i + 1]; | ||
886 | y = H_[i + 1][i]; | ||
887 | q = (eigenvaluesRe_[i] - p)*(eigenvaluesRe_[i] - p) | ||
888 | + eigenvaluesIm_[i]*eigenvaluesIm_[i]; | ||
889 | |||
890 | t = (x*s - z*r)/q; | ||
891 | H_[i][n] = t; | ||
892 | |||
893 | if (mag(x) > mag(z)) | ||
894 | { | ||
895 | H_[i + 1][n] = (-r - w*t)/x; | ||
896 | } | ||
897 | else | ||
898 | { | ||
899 | H_[i + 1][n] = (-s - y*t)/z; | ||
900 | } | ||
901 | } | ||
902 | |||
903 | // Overflow control | ||
904 | t = mag(H_[i][n]); | ||
905 | |||
906 | if ((eps*t)*t > 1) | ||
907 | { | ||
908 | for (label j = i; j <= n; j++) | ||
909 | { | ||
910 | H_[j][n] /= t; | ||
911 | } | ||
912 | } | ||
913 | } | ||
914 | } | ||
915 | } | ||
916 | else if (q < 0) // Complex vector | ||
917 | { | ||
918 | label l = n - 1; | ||
919 | |||
920 | // Last vector component imaginary so matrix is triangular | ||
921 | if (mag(H_[n][n - 1]) > mag(H_[n - 1][n])) | ||
922 | { | ||
923 | H_[n - 1][n - 1] = q/H_[n][n - 1]; | ||
924 | H_[n - 1][n] = -(H_[n][n] - p)/H_[n][n - 1]; | ||
925 | } | ||
926 | else | ||
927 | { | ||
928 | complex cDiv = complex(0.0, -H_[n - 1][n]) | ||
929 | /complex(H_[n - 1][n-1]-p, q); | ||
930 | |||
931 | H_[n - 1][n - 1] = cDiv.Re(); | ||
932 | H_[n - 1][n] = cDiv.Im(); | ||
933 | } | ||
934 | |||
935 | H_[n][n - 1] = scalar(0); | ||
936 | H_[n][n] = scalar(1); | ||
937 | |||
938 | for (label i = n - 2; i >= 0; i--) | ||
939 | { | ||
940 | scalar ra,sa,vr,vi; | ||
941 | ra = scalar(0); | ||
942 | sa = scalar(0); | ||
943 | |||
944 | for (label j = l; j <= n; j++) | ||
945 | { | ||
946 | ra += H_[i][j]*H_[j][n-1]; | ||
947 | sa += H_[i][j]*H_[j][n]; | ||
948 | } | ||
949 | |||
950 | w = H_[i][i] - p; | ||
951 | |||
952 | if (eigenvaluesIm_[i] < 0.0) | ||
953 | { | ||
954 | z = w; | ||
955 | r = ra; | ||
956 | s = sa; | ||
957 | } | ||
958 | else | ||
959 | { | ||
960 | l = i; | ||
961 | |||
962 | if (eigenvaluesIm_[i] == 0) | ||
963 | { | ||
964 | complex cDiv = complex(-ra, -sa)/complex(w, q); | ||
965 | H_[i][n - 1] = cDiv.Re(); | ||
966 | H_[i][n] = cDiv.Im(); | ||
967 | } | ||
968 | else | ||
969 | { | ||
970 | // Solve complex equations | ||
971 | x = H_[i][i + 1]; | ||
972 | y = H_[i + 1][i]; | ||
973 | vr = (eigenvaluesRe_[i] - p)*(eigenvaluesRe_[i] - p) | ||
974 | + eigenvaluesIm_[i]*eigenvaluesIm_[i] - q*q; | ||
975 | |||
976 | vi = 2.0*(eigenvaluesRe_[i] - p)*q; | ||
977 | |||
978 | if ((vr == 0.0) && (vi == 0.0)) | ||
979 | { | ||
980 | vr = eps*norm*(mag(w) + mag(q) + mag(x) + mag(y) | ||
981 | + mag(z)); | ||
982 | } | ||
983 | |||
984 | complex cDiv = | ||
985 | complex(x*r - z*ra + q*sa, x*s - z*sa - q*ra) | ||
986 | /complex(vr, vi); | ||
987 | |||
988 | H_[i][n - 1] = cDiv.Re(); | ||
989 | H_[i][n] = cDiv.Im(); | ||
990 | |||
991 | if (mag(x) > (mag(z) + mag(q))) | ||
992 | { | ||
993 | H_[i + 1][n - 1] = (-ra - w*H_[i][n - 1] | ||
994 | + q*H_[i][n])/x; | ||
995 | |||
996 | H_[i + 1][n] = (-sa - w*H_[i][n] | ||
997 | - q*H_[i][n - 1])/x; | ||
998 | } | ||
999 | else | ||
1000 | { | ||
1001 | complex cDiv = complex(-r - y*H_[i][n - 1], -s | ||
1002 | - y*H_[i][n])/complex(z, q); | ||
1003 | |||
1004 | H_[i + 1][n - 1] = cDiv.Re(); | ||
1005 | H_[i + 1][n] = cDiv.Im(); | ||
1006 | } | ||
1007 | } | ||
1008 | |||
1009 | // Overflow control | ||
1010 | t = max(mag(H_[i][n - 1]), mag(H_[i][n])); | ||
1011 | |||
1012 | if ((eps*t)*t > 1) | ||
1013 | { | ||
1014 | for (label j = i; j <= n; j++) | ||
1015 | { | ||
1016 | H_[j][n - 1] /= t; | ||
1017 | H_[j][n] /= t; | ||
1018 | } | ||
1019 | } | ||
1020 | } | ||
1021 | } | ||
1022 | } | ||
1023 | } | ||
1024 | |||
1025 | // Vectors of isolated roots | ||
1026 | for (label i = 0; i < nn; i++) | ||
1027 | { | ||
1028 | if (i < low || i > high) | ||
1029 | { | ||
1030 | for (label j = i; j < nn; j++) | ||
1031 | { | ||
1032 | eigenvectors_[i][j] = H_[i][j]; | ||
1033 | } | ||
1034 | } | ||
1035 | } | ||
1036 | |||
1037 | // Back transformation to get eigenvectors of original matrix | ||
1038 | for (label j = nn - 1; j >= low; j--) | ||
1039 | { | ||
1040 | for (label i = low; i <= high; i++) | ||
1041 | { | ||
1042 | z = scalar(0); | ||
1043 | |||
1044 | for (label k = low; k <= min(j, high); k++) | ||
1045 | { | ||
1046 | z = z + eigenvectors_[i][k]*H_[k][j]; | ||
1047 | } | ||
1048 | |||
1049 | eigenvectors_[i][j] = z; | ||
1050 | } | ||
1051 | } | ||
1052 | } | ||
1053 | |||
1054 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/eigenSolver/eigenSolver.H added (mode: 100644) (index 0000000..dbcecec) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2012-2015 Alberto Passalacqua | ||
6 | \\/ M anipulation | | ||
7 | ------------------------------------------------------------------------------- | ||
8 | License | ||
9 | This file is derivative work 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 | Class | ||
25 | Foam::eigenSolver | ||
26 | |||
27 | Description | ||
28 | Eigenvalues and eigenvectors of a square real matrix | ||
29 | |||
30 | Acknowledgments | ||
31 | This implementation derives almost completely from TNT/JAMA, a public-domain | ||
32 | library developed at NIST, available at http://math.nist.gov/tnt/index.html | ||
33 | Their implementation was based upon EISPACK. | ||
34 | |||
35 | The tridiagonaliseSymmMatrix, symmTridiagQL, Hessemberg and realSchur | ||
36 | methods are based on the Algol procedures tred2 by Bowdler, Martin, Reinsch, | ||
37 | and Wilkinson, Handbook for Auto. Comp., Vol. II-Linear Algebra, and the | ||
38 | corresponding FORTRAN subroutine in EISPACK. | ||
39 | |||
40 | SourceFiles | ||
41 | eigenSolver.C | ||
42 | |||
43 | \*---------------------------------------------------------------------------*/ | ||
44 | |||
45 | #ifndef eigenSolver_H | ||
46 | #define eigenSolver_H | ||
47 | |||
48 | #include "scalar.H" | ||
49 | #include "scalarMatrices.H" | ||
50 | #include "complex.H" | ||
51 | |||
52 | |||
53 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
54 | |||
55 | namespace Foam | ||
56 | { | ||
57 | |||
58 | /*---------------------------------------------------------------------------*\ | ||
59 | Class eigenSolver Declaration | ||
60 | \*---------------------------------------------------------------------------*/ | ||
61 | |||
62 | class eigenSolver | ||
63 | { | ||
64 | private: | ||
65 | |||
66 | // Private data | ||
67 | |||
68 | //- Real part of eigenvalues | ||
69 | scalarDiagonalMatrix eigenvaluesRe_; | ||
70 | |||
71 | //- Imaginary part of eigenvalues | ||
72 | scalarDiagonalMatrix eigenvaluesIm_; | ||
73 | |||
74 | //- Eigenvectors matrix | ||
75 | scalarSquareMatrix eigenvectors_; | ||
76 | |||
77 | //- Matrix with the same size of original matrix | ||
78 | scalarSquareMatrix H_; | ||
79 | |||
80 | //- Number of rows and columns | ||
81 | label n_; | ||
82 | |||
83 | //- Private member functions | ||
84 | |||
85 | //- Disallow default bitwise copy construct | ||
86 | eigenSolver(const eigenSolver&); | ||
87 | |||
88 | //- Disallow default bitwise assignment | ||
89 | void operator=(const eigenSolver&); | ||
90 | |||
91 | //- Checks matrix for symmetry | ||
92 | bool isSymmetric(const scalarSquareMatrix& A); | ||
93 | |||
94 | //- Householder transform of a symmetric matrix to tri-diagonal form | ||
95 | void tridiagonaliseSymmMatrix(); | ||
96 | |||
97 | //- Symmetric tri-diagonal QL algorithm | ||
98 | void symmTridiagQL(); | ||
99 | |||
100 | //- Reduction of non-symmetric matrix to Hessemberg form | ||
101 | void Hessenberg(); | ||
102 | |||
103 | //- Reduction from Hessenberg to real Schur form | ||
104 | void realSchur(); | ||
105 | |||
106 | |||
107 | public: | ||
108 | |||
109 | // Constructors | ||
110 | |||
111 | //- Construct from a scalarSquareMatrix | ||
112 | eigenSolver(const scalarSquareMatrix& A); | ||
113 | |||
114 | //- Construct from a scalarSquareMatrix and symmetry information | ||
115 | // Does not perform symmetric check | ||
116 | eigenSolver(const scalarSquareMatrix& A, bool symmetric); | ||
117 | |||
118 | // Access Functions | ||
119 | |||
120 | //- Return real part of the eigenvalues | ||
121 | const scalarDiagonalMatrix& eigenvaluesRe() const | ||
122 | { | ||
123 | return eigenvaluesRe_; | ||
124 | } | ||
125 | |||
126 | const scalarDiagonalMatrix& eigenvaluesIm() const | ||
127 | { | ||
128 | return eigenvaluesIm_; | ||
129 | } | ||
130 | |||
131 | //- Return eigenvectors | ||
132 | const scalarSquareMatrix& eigenvectors() const | ||
133 | { | ||
134 | return eigenvectors_; | ||
135 | } | ||
136 | }; | ||
137 | |||
138 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
139 | |||
140 | } // End namespace Foam | ||
141 | |||
142 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
143 | |||
144 | #endif | ||
145 | |||
146 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/interfacialModels/Make/files added (mode: 100644) (index 0000000..ff81afc) | |||
1 | dragModels/dragModel/dragModel.C | ||
2 | dragModels/dragModel/newDragModel.C | ||
3 | dragModels/Ergun/Ergun.C | ||
4 | dragModels/GidaspowErgunWenYu/GidaspowErgunWenYu.C | ||
5 | dragModels/GidaspowSchillerNaumann/GidaspowSchillerNaumann.C | ||
6 | dragModels/SchillerNaumann/SchillerNaumann.C | ||
7 | dragModels/Gibilaro/Gibilaro.C | ||
8 | dragModels/WenYu/WenYu.C | ||
9 | dragModels/SyamlalOBrien/SyamlalOBrien.C | ||
10 | dragModels/blended/blended.C | ||
11 | dragModels/interface/interface.C | ||
12 | |||
13 | heatTransferModels/heatTransferModel/heatTransferModel.C | ||
14 | heatTransferModels/heatTransferModel/newHeatTransferModel.C | ||
15 | heatTransferModels/RanzMarshall/RanzMarshall.C | ||
16 | |||
17 | LIB = $(FOAM_LIBBIN)/libcompressibleMultiphaseEulerianInterfacialModels |
File multiphaseEulerPbeFoam/interfacialModels/Make/options added (mode: 100644) (index 0000000..682a236) | |||
1 | EXE_INC = \ | ||
2 | -I../multiphaseSystem/lnInclude \ | ||
3 | -I$(LIB_SRC)/finiteVolume/lnInclude | ||
4 | |||
5 | LIB_LIBS = \ | ||
6 | -lmultiphaseSystem |
File multiphaseEulerPbeFoam/interfacialModels/dragModels/Ergun/Ergun.C added (mode: 100644) (index 0000000..e640a40) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2011-2012 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 "Ergun.H" | ||
27 | #include "addToRunTimeSelectionTable.H" | ||
28 | |||
29 | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // | ||
30 | |||
31 | namespace Foam | ||
32 | { | ||
33 | namespace dragModels | ||
34 | { | ||
35 | defineTypeNameAndDebug(Ergun, 0); | ||
36 | |||
37 | addToRunTimeSelectionTable | ||
38 | ( | ||
39 | dragModel, | ||
40 | Ergun, | ||
41 | dictionary | ||
42 | ); | ||
43 | } | ||
44 | } | ||
45 | |||
46 | |||
47 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | ||
48 | |||
49 | Foam::dragModels::Ergun::Ergun | ||
50 | ( | ||
51 | const dictionary& interfaceDict, | ||
52 | const phaseModel& phase1, | ||
53 | const phaseModel& phase2 | ||
54 | ) | ||
55 | : | ||
56 | dragModel(interfaceDict, phase1, phase2) | ||
57 | {} | ||
58 | |||
59 | |||
60 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | ||
61 | |||
62 | Foam::dragModels::Ergun::~Ergun() | ||
63 | {} | ||
64 | |||
65 | |||
66 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | ||
67 | |||
68 | Foam::tmp<Foam::volScalarField> Foam::dragModels::Ergun::K | ||
69 | ( | ||
70 | const volScalarField& Ur | ||
71 | ) const | ||
72 | { | ||
73 | volScalarField alpha2(max(phase2_, scalar(1.0e-6))); | ||
74 | |||
75 | return | ||
76 | 150.0*phase1_*phase2_.nu()*phase2_.rho() | ||
77 | /sqr(alpha2*phase1_.d()) | ||
78 | + 1.75*phase2_.rho()*Ur/(alpha2*phase1_.d()); | ||
79 | } | ||
80 | |||
81 | |||
82 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/interfacialModels/dragModels/Ergun/Ergun.H added (mode: 100644) (index 0000000..8efc5d4) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2011 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 | Class | ||
25 | Foam::dragModels::Ergun | ||
26 | |||
27 | Description | ||
28 | H, Enwald, E. Peirano, A-E Almstedt | ||
29 | 'Eulerian Two-Phase Flow Theory Applied to Fluidization' | ||
30 | Int. J. Multiphase Flow, Vol. 22, Suppl, pp. 21-66 (1996) | ||
31 | Eq. 104, p. 42 | ||
32 | |||
33 | SourceFiles | ||
34 | Ergun.C | ||
35 | |||
36 | \*---------------------------------------------------------------------------*/ | ||
37 | |||
38 | #ifndef Ergun_H | ||
39 | #define Ergun_H | ||
40 | |||
41 | #include "dragModel.H" | ||
42 | |||
43 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
44 | |||
45 | namespace Foam | ||
46 | { | ||
47 | namespace dragModels | ||
48 | { | ||
49 | |||
50 | /*---------------------------------------------------------------------------*\ | ||
51 | Class Ergun Declaration | ||
52 | \*---------------------------------------------------------------------------*/ | ||
53 | |||
54 | class Ergun | ||
55 | : | ||
56 | public dragModel | ||
57 | { | ||
58 | |||
59 | public: | ||
60 | |||
61 | //- Runtime type information | ||
62 | TypeName("Ergun"); | ||
63 | |||
64 | |||
65 | // Constructors | ||
66 | |||
67 | //- Construct from components | ||
68 | Ergun | ||
69 | ( | ||
70 | const dictionary& interfaceDict, | ||
71 | const phaseModel& phase1, | ||
72 | const phaseModel& phase2 | ||
73 | ); | ||
74 | |||
75 | |||
76 | //- Destructor | ||
77 | virtual ~Ergun(); | ||
78 | |||
79 | |||
80 | // Member Functions | ||
81 | |||
82 | tmp<volScalarField> K(const volScalarField& Ur) const; | ||
83 | }; | ||
84 | |||
85 | |||
86 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
87 | |||
88 | } // End namespace dragModels | ||
89 | } // End namespace Foam | ||
90 | |||
91 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
92 | |||
93 | #endif | ||
94 | |||
95 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/interfacialModels/dragModels/Gibilaro/Gibilaro.C added (mode: 100644) (index 0000000..176985c) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2011-2012 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 "Gibilaro.H" | ||
27 | #include "addToRunTimeSelectionTable.H" | ||
28 | |||
29 | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // | ||
30 | |||
31 | namespace Foam | ||
32 | { | ||
33 | namespace dragModels | ||
34 | { | ||
35 | defineTypeNameAndDebug(Gibilaro, 0); | ||
36 | |||
37 | addToRunTimeSelectionTable | ||
38 | ( | ||
39 | dragModel, | ||
40 | Gibilaro, | ||
41 | dictionary | ||
42 | ); | ||
43 | } | ||
44 | } | ||
45 | |||
46 | |||
47 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | ||
48 | |||
49 | Foam::dragModels::Gibilaro::Gibilaro | ||
50 | ( | ||
51 | const dictionary& interfaceDict, | ||
52 | const phaseModel& phase1, | ||
53 | const phaseModel& phase2 | ||
54 | ) | ||
55 | : | ||
56 | dragModel(interfaceDict, phase1, phase2) | ||
57 | {} | ||
58 | |||
59 | |||
60 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | ||
61 | |||
62 | Foam::dragModels::Gibilaro::~Gibilaro() | ||
63 | {} | ||
64 | |||
65 | |||
66 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | ||
67 | |||
68 | Foam::tmp<Foam::volScalarField> Foam::dragModels::Gibilaro::K | ||
69 | ( | ||
70 | const volScalarField& Ur | ||
71 | ) const | ||
72 | { | ||
73 | volScalarField alpha2(max(phase2_, scalar(1.0e-6))); | ||
74 | volScalarField bp(pow(alpha2, -2.8)); | ||
75 | volScalarField Re(max(alpha2*Ur*phase1_.d()/phase2_.nu(), scalar(1.0e-3))); | ||
76 | |||
77 | return (17.3/Re + scalar(0.336))*phase2_.rho()*Ur*bp/phase1_.d(); | ||
78 | } | ||
79 | |||
80 | |||
81 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/interfacialModels/dragModels/Gibilaro/Gibilaro.H added (mode: 100644) (index 0000000..c6c0e3c) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2011 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 | Class | ||
25 | Foam::dragModels::Gibilaro | ||
26 | |||
27 | Description | ||
28 | H, Enwald, E. Peirano, A-E Almstedt | ||
29 | 'Eulerian Two-Phase Flow Theory Applied to Fluidization' | ||
30 | Int. J. Multiphase Flow, Vol. 22, Suppl, pp. 21-66 (1996) | ||
31 | Eq. 106, p. 43 | ||
32 | |||
33 | SourceFiles | ||
34 | Gibilaro.C | ||
35 | |||
36 | \*---------------------------------------------------------------------------*/ | ||
37 | |||
38 | #ifndef Gibilaro_H | ||
39 | #define Gibilaro_H | ||
40 | |||
41 | #include "dragModel.H" | ||
42 | |||
43 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
44 | |||
45 | namespace Foam | ||
46 | { | ||
47 | namespace dragModels | ||
48 | { | ||
49 | |||
50 | /*---------------------------------------------------------------------------*\ | ||
51 | Class Gibilaro Declaration | ||
52 | \*---------------------------------------------------------------------------*/ | ||
53 | |||
54 | class Gibilaro | ||
55 | : | ||
56 | public dragModel | ||
57 | { | ||
58 | |||
59 | public: | ||
60 | |||
61 | //- Runtime type information | ||
62 | TypeName("Gibilaro"); | ||
63 | |||
64 | |||
65 | // Constructors | ||
66 | |||
67 | //- Construct from components | ||
68 | Gibilaro | ||
69 | ( | ||
70 | const dictionary& interfaceDict, | ||
71 | const phaseModel& phase1, | ||
72 | const phaseModel& phase2 | ||
73 | ); | ||
74 | |||
75 | |||
76 | //- Destructor | ||
77 | virtual ~Gibilaro(); | ||
78 | |||
79 | |||
80 | // Member Functions | ||
81 | |||
82 | tmp<volScalarField> K(const volScalarField& Ur) const; | ||
83 | }; | ||
84 | |||
85 | |||
86 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
87 | |||
88 | } // End namespace dragModels | ||
89 | } // End namespace Foam | ||
90 | |||
91 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
92 | |||
93 | #endif | ||
94 | |||
95 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/interfacialModels/dragModels/GidaspowErgunWenYu/GidaspowErgunWenYu.C added (mode: 100644) (index 0000000..cc4c7f9) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2011-2012 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 "GidaspowErgunWenYu.H" | ||
27 | #include "addToRunTimeSelectionTable.H" | ||
28 | |||
29 | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // | ||
30 | |||
31 | namespace Foam | ||
32 | { | ||
33 | namespace dragModels | ||
34 | { | ||
35 | defineTypeNameAndDebug(GidaspowErgunWenYu, 0); | ||
36 | |||
37 | addToRunTimeSelectionTable | ||
38 | ( | ||
39 | dragModel, | ||
40 | GidaspowErgunWenYu, | ||
41 | dictionary | ||
42 | ); | ||
43 | } | ||
44 | } | ||
45 | |||
46 | |||
47 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | ||
48 | |||
49 | Foam::dragModels::GidaspowErgunWenYu::GidaspowErgunWenYu | ||
50 | ( | ||
51 | const dictionary& interfaceDict, | ||
52 | const phaseModel& phase1, | ||
53 | const phaseModel& phase2 | ||
54 | ) | ||
55 | : | ||
56 | dragModel(interfaceDict, phase1, phase2) | ||
57 | {} | ||
58 | |||
59 | |||
60 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | ||
61 | |||
62 | Foam::dragModels::GidaspowErgunWenYu::~GidaspowErgunWenYu() | ||
63 | {} | ||
64 | |||
65 | |||
66 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | ||
67 | |||
68 | Foam::tmp<Foam::volScalarField> Foam::dragModels::GidaspowErgunWenYu::K | ||
69 | ( | ||
70 | const volScalarField& Ur | ||
71 | ) const | ||
72 | { | ||
73 | volScalarField alpha2(max(phase2_, scalar(1.0e-6))); | ||
74 | volScalarField d(phase1_.d()); | ||
75 | volScalarField bp(pow(alpha2, -2.65)); | ||
76 | volScalarField Re(max(Ur*d/phase2_.nu(), scalar(1.0e-3))); | ||
77 | |||
78 | volScalarField Cds | ||
79 | ( | ||
80 | neg(Re - 1000)*(24.0*(1.0 + 0.15*pow(Re, 0.687))/Re) | ||
81 | + pos(Re - 1000)*0.44 | ||
82 | ); | ||
83 | |||
84 | // Wen and Yu (1966) | ||
85 | return | ||
86 | ( | ||
87 | pos(alpha2 - 0.8) | ||
88 | *(0.75*Cds*phase2_.rho()*Ur*bp/d) | ||
89 | + neg(alpha2 - 0.8) | ||
90 | *( | ||
91 | 150.0*phase1_*phase2_.nu()*phase2_.rho()/(sqr(alpha2*d)) | ||
92 | + 1.75*phase2_.rho()*Ur/(alpha2*d) | ||
93 | ) | ||
94 | ); | ||
95 | } | ||
96 | |||
97 | |||
98 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/interfacialModels/dragModels/GidaspowErgunWenYu/GidaspowErgunWenYu.H added (mode: 100644) (index 0000000..3e1812f) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2011 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 | Class | ||
25 | Foam::dragModels::GidaspowErgunWenYu | ||
26 | |||
27 | Description | ||
28 | D. Gidaspow, Multiphase flow and fluidization, | ||
29 | Academic Press, New York, 1994. | ||
30 | |||
31 | SourceFiles | ||
32 | GidaspowErgunWenYu.C | ||
33 | |||
34 | \*---------------------------------------------------------------------------*/ | ||
35 | |||
36 | #ifndef GidaspowErgunWenYu_H | ||
37 | #define GidaspowErgunWenYu_H | ||
38 | |||
39 | #include "dragModel.H" | ||
40 | |||
41 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
42 | |||
43 | namespace Foam | ||
44 | { | ||
45 | namespace dragModels | ||
46 | { | ||
47 | |||
48 | /*---------------------------------------------------------------------------*\ | ||
49 | Class GidaspowErgunWenYu Declaration | ||
50 | \*---------------------------------------------------------------------------*/ | ||
51 | |||
52 | class GidaspowErgunWenYu | ||
53 | : | ||
54 | public dragModel | ||
55 | { | ||
56 | |||
57 | public: | ||
58 | |||
59 | //- Runtime type information | ||
60 | TypeName("GidaspowErgunWenYu"); | ||
61 | |||
62 | |||
63 | // Constructors | ||
64 | |||
65 | //- Construct from components | ||
66 | GidaspowErgunWenYu | ||
67 | ( | ||
68 | const dictionary& interfaceDict, | ||
69 | const phaseModel& phase1, | ||
70 | const phaseModel& phase2 | ||
71 | ); | ||
72 | |||
73 | |||
74 | //- Destructor | ||
75 | virtual ~GidaspowErgunWenYu(); | ||
76 | |||
77 | |||
78 | // Member Functions | ||
79 | |||
80 | tmp<volScalarField> K(const volScalarField& Ur) const; | ||
81 | }; | ||
82 | |||
83 | |||
84 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
85 | |||
86 | } // End namespace dragModels | ||
87 | } // End namespace Foam | ||
88 | |||
89 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
90 | |||
91 | #endif | ||
92 | |||
93 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/interfacialModels/dragModels/GidaspowSchillerNaumann/GidaspowSchillerNaumann.C added (mode: 100644) (index 0000000..5e2048a) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2011-2012 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 "GidaspowSchillerNaumann.H" | ||
27 | #include "addToRunTimeSelectionTable.H" | ||
28 | |||
29 | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // | ||
30 | |||
31 | namespace Foam | ||
32 | { | ||
33 | namespace dragModels | ||
34 | { | ||
35 | defineTypeNameAndDebug(GidaspowSchillerNaumann, 0); | ||
36 | |||
37 | addToRunTimeSelectionTable | ||
38 | ( | ||
39 | dragModel, | ||
40 | GidaspowSchillerNaumann, | ||
41 | dictionary | ||
42 | ); | ||
43 | } | ||
44 | } | ||
45 | |||
46 | |||
47 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | ||
48 | |||
49 | Foam::dragModels::GidaspowSchillerNaumann::GidaspowSchillerNaumann | ||
50 | ( | ||
51 | const dictionary& interfaceDict, | ||
52 | const phaseModel& phase1, | ||
53 | const phaseModel& phase2 | ||
54 | ) | ||
55 | : | ||
56 | dragModel(interfaceDict, phase1, phase2) | ||
57 | {} | ||
58 | |||
59 | |||
60 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | ||
61 | |||
62 | Foam::dragModels::GidaspowSchillerNaumann::~GidaspowSchillerNaumann() | ||
63 | {} | ||
64 | |||
65 | |||
66 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | ||
67 | |||
68 | Foam::tmp<Foam::volScalarField> Foam::dragModels::GidaspowSchillerNaumann::K | ||
69 | ( | ||
70 | const volScalarField& Ur | ||
71 | ) const | ||
72 | { | ||
73 | volScalarField alpha2(max(phase2_, scalar(1e-6))); | ||
74 | volScalarField bp(pow(alpha2, -2.65)); | ||
75 | |||
76 | volScalarField Re(max(alpha2*Ur*phase1_.d()/phase2_.nu(), scalar(1.0e-3))); | ||
77 | volScalarField Cds | ||
78 | ( | ||
79 | neg(Re - 1000)*(24.0*(1.0 + 0.15*pow(Re, 0.687))/Re) | ||
80 | + pos(Re - 1000)*0.44 | ||
81 | ); | ||
82 | |||
83 | return 0.75*Cds*phase2_.rho()*Ur*bp/phase1_.d(); | ||
84 | } | ||
85 | |||
86 | |||
87 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/interfacialModels/dragModels/GidaspowSchillerNaumann/GidaspowSchillerNaumann.H added (mode: 100644) (index 0000000..d7c3165) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2011 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 | Class | ||
25 | Foam::dragModels::GidaspowSchillerNaumann | ||
26 | |||
27 | Description | ||
28 | H, Enwald, E. Peirano, A-E Almstedt | ||
29 | 'Eulerian Two-Phase Flow Theory Applied to Fluidization' | ||
30 | Int. J. Multiphase Flow, Vol. 22, Suppl, pp. 21-66 (1996) | ||
31 | Eq. 86-87, p. 40 | ||
32 | |||
33 | This is identical to the Wen and Yu, Rowe model Table 3.6 p.56 in | ||
34 | the Ph.D. thesis of Berend van Wachem | ||
35 | 'Derivation, Implementation and Validation | ||
36 | of | ||
37 | Computer Simulation Models | ||
38 | for Gas-Solid Fluidized Beds' | ||
39 | |||
40 | SourceFiles | ||
41 | GidaspowSchillerNaumann.C | ||
42 | |||
43 | \*---------------------------------------------------------------------------*/ | ||
44 | |||
45 | #ifndef GidaspowSchillerNaumann_H | ||
46 | #define GidaspowSchillerNaumann_H | ||
47 | |||
48 | #include "dragModel.H" | ||
49 | |||
50 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
51 | |||
52 | namespace Foam | ||
53 | { | ||
54 | namespace dragModels | ||
55 | { | ||
56 | |||
57 | /*---------------------------------------------------------------------------*\ | ||
58 | Class GidaspowSchillerNaumann Declaration | ||
59 | \*---------------------------------------------------------------------------*/ | ||
60 | |||
61 | class GidaspowSchillerNaumann | ||
62 | : | ||
63 | public dragModel | ||
64 | { | ||
65 | |||
66 | public: | ||
67 | |||
68 | //- Runtime type information | ||
69 | TypeName("GidaspowSchillerNaumann"); | ||
70 | |||
71 | |||
72 | // Constructors | ||
73 | |||
74 | //- Construct from components | ||
75 | GidaspowSchillerNaumann | ||
76 | ( | ||
77 | const dictionary& interfaceDict, | ||
78 | const phaseModel& phase1, | ||
79 | const phaseModel& phase2 | ||
80 | ); | ||
81 | |||
82 | |||
83 | //- Destructor | ||
84 | virtual ~GidaspowSchillerNaumann(); | ||
85 | |||
86 | |||
87 | // Member Functions | ||
88 | |||
89 | tmp<volScalarField> K(const volScalarField& Ur) const; | ||
90 | }; | ||
91 | |||
92 | |||
93 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
94 | |||
95 | } // End namespace dragModels | ||
96 | } // End namespace Foam | ||
97 | |||
98 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
99 | |||
100 | #endif | ||
101 | |||
102 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/interfacialModels/dragModels/SchillerNaumann/SchillerNaumann.C added (mode: 100644) (index 0000000..d4d77a2) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2011 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 "SchillerNaumann.H" | ||
27 | #include "addToRunTimeSelectionTable.H" | ||
28 | |||
29 | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // | ||
30 | |||
31 | namespace Foam | ||
32 | { | ||
33 | namespace dragModels | ||
34 | { | ||
35 | defineTypeNameAndDebug(SchillerNaumann, 0); | ||
36 | |||
37 | addToRunTimeSelectionTable | ||
38 | ( | ||
39 | dragModel, | ||
40 | SchillerNaumann, | ||
41 | dictionary | ||
42 | ); | ||
43 | } | ||
44 | } | ||
45 | |||
46 | |||
47 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | ||
48 | |||
49 | Foam::dragModels::SchillerNaumann::SchillerNaumann | ||
50 | ( | ||
51 | const dictionary& interfaceDict, | ||
52 | const phaseModel& phase1, | ||
53 | const phaseModel& phase2 | ||
54 | ) | ||
55 | : | ||
56 | dragModel(interfaceDict, phase1, phase2) | ||
57 | {} | ||
58 | |||
59 | |||
60 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | ||
61 | |||
62 | Foam::dragModels::SchillerNaumann::~SchillerNaumann() | ||
63 | {} | ||
64 | |||
65 | |||
66 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | ||
67 | |||
68 | Foam::tmp<Foam::volScalarField> Foam::dragModels::SchillerNaumann::K | ||
69 | ( | ||
70 | const volScalarField& Ur | ||
71 | ) const | ||
72 | { | ||
73 | volScalarField Re(max(Ur*phase1_.d()/phase2_.nu(), scalar(1.0e-3))); | ||
74 | volScalarField Cds | ||
75 | ( | ||
76 | neg(Re - 1000)*(24.0*(1.0 + 0.15*pow(Re, 0.687))/Re) | ||
77 | + pos(Re - 1000)*0.44 | ||
78 | ); | ||
79 | |||
80 | return 0.75*Cds*phase2_.rho()*Ur/phase1_.d(); | ||
81 | } | ||
82 | |||
83 | |||
84 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/interfacialModels/dragModels/SchillerNaumann/SchillerNaumann.H added (mode: 100644) (index 0000000..33d291d) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2011 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 | Class | ||
25 | Foam::dragModels::SchillerNaumann | ||
26 | |||
27 | Description | ||
28 | |||
29 | SourceFiles | ||
30 | SchillerNaumann.C | ||
31 | |||
32 | \*---------------------------------------------------------------------------*/ | ||
33 | |||
34 | #ifndef SchillerNaumann_H | ||
35 | #define SchillerNaumann_H | ||
36 | |||
37 | #include "dragModel.H" | ||
38 | |||
39 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
40 | |||
41 | namespace Foam | ||
42 | { | ||
43 | namespace dragModels | ||
44 | { | ||
45 | |||
46 | /*---------------------------------------------------------------------------*\ | ||
47 | Class SchillerNaumann Declaration | ||
48 | \*---------------------------------------------------------------------------*/ | ||
49 | |||
50 | class SchillerNaumann | ||
51 | : | ||
52 | public dragModel | ||
53 | { | ||
54 | |||
55 | public: | ||
56 | |||
57 | //- Runtime type information | ||
58 | TypeName("SchillerNaumann"); | ||
59 | |||
60 | |||
61 | // Constructors | ||
62 | |||
63 | //- Construct from components | ||
64 | SchillerNaumann | ||
65 | ( | ||
66 | const dictionary& interfaceDict, | ||
67 | const phaseModel& phase1, | ||
68 | const phaseModel& phase2 | ||
69 | ); | ||
70 | |||
71 | |||
72 | //- Destructor | ||
73 | virtual ~SchillerNaumann(); | ||
74 | |||
75 | |||
76 | // Member Functions | ||
77 | |||
78 | tmp<volScalarField> K(const volScalarField& Ur) const; | ||
79 | }; | ||
80 | |||
81 | |||
82 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
83 | |||
84 | } // End namespace dragModels | ||
85 | } // End namespace Foam | ||
86 | |||
87 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
88 | |||
89 | #endif | ||
90 | |||
91 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/interfacialModels/dragModels/SyamlalOBrien/SyamlalOBrien.C added (mode: 100644) (index 0000000..83419c5) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2011-2012 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 "SyamlalOBrien.H" | ||
27 | #include "addToRunTimeSelectionTable.H" | ||
28 | |||
29 | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // | ||
30 | |||
31 | namespace Foam | ||
32 | { | ||
33 | namespace dragModels | ||
34 | { | ||
35 | defineTypeNameAndDebug(SyamlalOBrien, 0); | ||
36 | |||
37 | addToRunTimeSelectionTable | ||
38 | ( | ||
39 | dragModel, | ||
40 | SyamlalOBrien, | ||
41 | dictionary | ||
42 | ); | ||
43 | } | ||
44 | } | ||
45 | |||
46 | |||
47 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | ||
48 | |||
49 | Foam::dragModels::SyamlalOBrien::SyamlalOBrien | ||
50 | ( | ||
51 | const dictionary& interfaceDict, | ||
52 | const phaseModel& phase1, | ||
53 | const phaseModel& phase2 | ||
54 | ) | ||
55 | : | ||
56 | dragModel(interfaceDict, phase1, phase2) | ||
57 | {} | ||
58 | |||
59 | |||
60 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | ||
61 | |||
62 | Foam::dragModels::SyamlalOBrien::~SyamlalOBrien() | ||
63 | {} | ||
64 | |||
65 | |||
66 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | ||
67 | |||
68 | Foam::tmp<Foam::volScalarField> Foam::dragModels::SyamlalOBrien::K | ||
69 | ( | ||
70 | const volScalarField& Ur | ||
71 | ) const | ||
72 | { | ||
73 | volScalarField alpha2(max(phase2_, scalar(1.0e-6))); | ||
74 | volScalarField A(pow(alpha2, 4.14)); | ||
75 | volScalarField B | ||
76 | ( | ||
77 | neg(alpha2 - 0.85)*(0.8*pow(alpha2, 1.28)) | ||
78 | + pos(alpha2 - 0.85)*(pow(alpha2, 2.65)) | ||
79 | ); | ||
80 | |||
81 | volScalarField Re(max(Ur*phase1_.d()/phase2_.nu(), scalar(1.0e-3))); | ||
82 | |||
83 | volScalarField Vr | ||
84 | ( | ||
85 | 0.5* | ||
86 | ( | ||
87 | A - 0.06*Re + sqrt(sqr(0.06*Re) + 0.12*Re*(2.0*B - A) + sqr(A)) | ||
88 | ) | ||
89 | ); | ||
90 | |||
91 | volScalarField Cds(sqr(0.63 + 4.8*sqrt(Vr/Re))); | ||
92 | |||
93 | return 0.75*Cds*phase2_.rho()*Ur/(phase1_.d()*sqr(Vr)); | ||
94 | } | ||
95 | |||
96 | |||
97 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/interfacialModels/dragModels/SyamlalOBrien/SyamlalOBrien.H added (mode: 100644) (index 0000000..05aaa96) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2011 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 | Class | ||
25 | Foam::dragModels::SyamlalOBrien | ||
26 | |||
27 | Description | ||
28 | Syamlal, M., Rogers, W. and O'Brien, T. J. (1993) MFIX documentation, | ||
29 | Theory Guide. Technical Note DOE/METC-94/1004. Morgantown, West Virginia, | ||
30 | USA. | ||
31 | |||
32 | SourceFiles | ||
33 | SyamlalOBrien.C | ||
34 | |||
35 | \*---------------------------------------------------------------------------*/ | ||
36 | |||
37 | #ifndef SyamlalOBrien_H | ||
38 | #define SyamlalOBrien_H | ||
39 | |||
40 | #include "dragModel.H" | ||
41 | |||
42 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
43 | |||
44 | namespace Foam | ||
45 | { | ||
46 | namespace dragModels | ||
47 | { | ||
48 | |||
49 | /*---------------------------------------------------------------------------*\ | ||
50 | Class SyamlalOBrien Declaration | ||
51 | \*---------------------------------------------------------------------------*/ | ||
52 | |||
53 | class SyamlalOBrien | ||
54 | : | ||
55 | public dragModel | ||
56 | { | ||
57 | |||
58 | public: | ||
59 | |||
60 | //- Runtime type information | ||
61 | TypeName("SyamlalOBrien"); | ||
62 | |||
63 | |||
64 | // Constructors | ||
65 | |||
66 | //- Construct from components | ||
67 | SyamlalOBrien | ||
68 | ( | ||
69 | const dictionary& interfaceDict, | ||
70 | const phaseModel& phase1, | ||
71 | const phaseModel& phase2 | ||
72 | ); | ||
73 | |||
74 | |||
75 | //- Destructor | ||
76 | virtual ~SyamlalOBrien(); | ||
77 | |||
78 | |||
79 | // Member Functions | ||
80 | |||
81 | tmp<volScalarField> K(const volScalarField& Ur) const; | ||
82 | }; | ||
83 | |||
84 | |||
85 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
86 | |||
87 | } // End namespace dragModels | ||
88 | } // End namespace Foam | ||
89 | |||
90 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
91 | |||
92 | #endif | ||
93 | |||
94 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/interfacialModels/dragModels/WenYu/WenYu.C added (mode: 100644) (index 0000000..fd644f5) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2011-2012 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 "WenYu.H" | ||
27 | #include "addToRunTimeSelectionTable.H" | ||
28 | |||
29 | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // | ||
30 | |||
31 | namespace Foam | ||
32 | { | ||
33 | namespace dragModels | ||
34 | { | ||
35 | defineTypeNameAndDebug(WenYu, 0); | ||
36 | |||
37 | addToRunTimeSelectionTable | ||
38 | ( | ||
39 | dragModel, | ||
40 | WenYu, | ||
41 | dictionary | ||
42 | ); | ||
43 | } | ||
44 | } | ||
45 | |||
46 | |||
47 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | ||
48 | |||
49 | Foam::dragModels::WenYu::WenYu | ||
50 | ( | ||
51 | const dictionary& interfaceDict, | ||
52 | const phaseModel& phase1, | ||
53 | const phaseModel& phase2 | ||
54 | ) | ||
55 | : | ||
56 | dragModel(interfaceDict, phase1, phase2) | ||
57 | {} | ||
58 | |||
59 | |||
60 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | ||
61 | |||
62 | Foam::dragModels::WenYu::~WenYu() | ||
63 | {} | ||
64 | |||
65 | |||
66 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | ||
67 | |||
68 | Foam::tmp<Foam::volScalarField> Foam::dragModels::WenYu::K | ||
69 | ( | ||
70 | const volScalarField& Ur | ||
71 | ) const | ||
72 | { | ||
73 | volScalarField alpha2(max(phase2_, scalar(1.0e-6))); | ||
74 | volScalarField bp(pow(alpha2, -2.65)); | ||
75 | |||
76 | volScalarField Re(max(Ur*phase1_.d()/phase2_.nu(), scalar(1.0e-3))); | ||
77 | volScalarField Cds | ||
78 | ( | ||
79 | neg(Re - 1000)*(24.0*(1.0 + 0.15*pow(Re, 0.687))/Re) | ||
80 | + pos(Re - 1000)*0.44 | ||
81 | ); | ||
82 | |||
83 | return 0.75*Cds*phase2_.rho()*Ur*bp/phase1_.d(); | ||
84 | } | ||
85 | |||
86 | |||
87 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/interfacialModels/dragModels/WenYu/WenYu.H added (mode: 100644) (index 0000000..ba32651) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2011 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 | Class | ||
25 | Foam::dragModels::WenYu | ||
26 | |||
27 | Description | ||
28 | H, Enwald, E. Peirano, A-E Almstedt | ||
29 | 'Eulerian Two-Phase Flow Theory Applied to Fluidization' | ||
30 | Int. J. Multiphase Flow, Vol. 22, Suppl, pp. 21-66 (1996) | ||
31 | Eq. 86-87, p. 40 | ||
32 | |||
33 | This is identical to the Wen and Yu, Rowe model Table 3.6 p.56 in | ||
34 | the Ph.D. thesis of Berend van Wachem | ||
35 | 'Derivation, Implementation and Validation | ||
36 | of | ||
37 | Computer Simulation Models | ||
38 | for Gas-Solid Fluidized Beds' | ||
39 | |||
40 | NB: The difference between the Gidaspow-version is the void-fraction | ||
41 | in the Re-number | ||
42 | |||
43 | SourceFiles | ||
44 | WenYu.C | ||
45 | |||
46 | \*---------------------------------------------------------------------------*/ | ||
47 | |||
48 | #ifndef WenYu_H | ||
49 | #define WenYu_H | ||
50 | |||
51 | #include "dragModel.H" | ||
52 | |||
53 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
54 | |||
55 | namespace Foam | ||
56 | { | ||
57 | namespace dragModels | ||
58 | { | ||
59 | |||
60 | /*---------------------------------------------------------------------------*\ | ||
61 | Class WenYu Declaration | ||
62 | \*---------------------------------------------------------------------------*/ | ||
63 | |||
64 | class WenYu | ||
65 | : | ||
66 | public dragModel | ||
67 | { | ||
68 | |||
69 | public: | ||
70 | |||
71 | //- Runtime type information | ||
72 | TypeName("WenYu"); | ||
73 | |||
74 | |||
75 | // Constructors | ||
76 | |||
77 | //- Construct from components | ||
78 | WenYu | ||
79 | ( | ||
80 | const dictionary& interfaceDict, | ||
81 | const phaseModel& phase1, | ||
82 | const phaseModel& phase2 | ||
83 | ); | ||
84 | |||
85 | |||
86 | //- Destructor | ||
87 | virtual ~WenYu(); | ||
88 | |||
89 | |||
90 | // Member Functions | ||
91 | |||
92 | tmp<volScalarField> K(const volScalarField& Ur) const; | ||
93 | }; | ||
94 | |||
95 | |||
96 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
97 | |||
98 | } // End namespace dragModels | ||
99 | } // End namespace Foam | ||
100 | |||
101 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
102 | |||
103 | #endif | ||
104 | |||
105 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/interfacialModels/dragModels/blended/blended.C added (mode: 100644) (index 0000000..49b2a01) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2011 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 "blended.H" | ||
27 | #include "addToRunTimeSelectionTable.H" | ||
28 | |||
29 | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // | ||
30 | |||
31 | namespace Foam | ||
32 | { | ||
33 | namespace dragModels | ||
34 | { | ||
35 | defineTypeNameAndDebug(blended, 0); | ||
36 | |||
37 | addToRunTimeSelectionTable | ||
38 | ( | ||
39 | dragModel, | ||
40 | blended, | ||
41 | dictionary | ||
42 | ); | ||
43 | } | ||
44 | } | ||
45 | |||
46 | |||
47 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | ||
48 | |||
49 | Foam::dragModels::blended::blended | ||
50 | ( | ||
51 | const dictionary& interfaceDict, | ||
52 | const phaseModel& phase1, | ||
53 | const phaseModel& phase2 | ||
54 | ) | ||
55 | : | ||
56 | dragModel(interfaceDict, phase1, phase2), | ||
57 | dragModel1_(New(interfaceDict.subDict(phase1.name()), phase1, phase2)), | ||
58 | dragModel2_(New(interfaceDict.subDict(phase2.name()), phase2, phase1)) | ||
59 | {} | ||
60 | |||
61 | |||
62 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | ||
63 | |||
64 | Foam::dragModels::blended::~blended() | ||
65 | {} | ||
66 | |||
67 | |||
68 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | ||
69 | |||
70 | Foam::tmp<Foam::volScalarField> Foam::dragModels::blended::K | ||
71 | ( | ||
72 | const volScalarField& Ur | ||
73 | ) const | ||
74 | { | ||
75 | return phase2()*dragModel1_->K(Ur) + phase1()*dragModel2_->K(Ur); | ||
76 | } | ||
77 | |||
78 | |||
79 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/interfacialModels/dragModels/blended/blended.H added (mode: 100644) (index 0000000..6836a22) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2011 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 | Class | ||
25 | Foam::dragModels::blended | ||
26 | |||
27 | Description | ||
28 | Blends two drag models based on the phase fractions to handle | ||
29 | phase-inversion. | ||
30 | |||
31 | SourceFiles | ||
32 | blended.C | ||
33 | |||
34 | \*---------------------------------------------------------------------------*/ | ||
35 | |||
36 | #ifndef blended_H | ||
37 | #define blended_H | ||
38 | |||
39 | #include "dragModel.H" | ||
40 | |||
41 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
42 | |||
43 | namespace Foam | ||
44 | { | ||
45 | namespace dragModels | ||
46 | { | ||
47 | |||
48 | /*---------------------------------------------------------------------------*\ | ||
49 | Class blended Declaration | ||
50 | \*---------------------------------------------------------------------------*/ | ||
51 | |||
52 | class blended | ||
53 | : | ||
54 | public dragModel | ||
55 | { | ||
56 | // Private data | ||
57 | |||
58 | // The two drag models to be blended | ||
59 | autoPtr<dragModel> dragModel1_; | ||
60 | autoPtr<dragModel> dragModel2_; | ||
61 | |||
62 | |||
63 | public: | ||
64 | |||
65 | //- Runtime type information | ||
66 | TypeName("blended"); | ||
67 | |||
68 | |||
69 | // Constructors | ||
70 | |||
71 | //- Construct from components | ||
72 | blended | ||
73 | ( | ||
74 | const dictionary& interfaceDict, | ||
75 | const phaseModel& phase1, | ||
76 | const phaseModel& phase2 | ||
77 | ); | ||
78 | |||
79 | |||
80 | //- Destructor | ||
81 | virtual ~blended(); | ||
82 | |||
83 | |||
84 | // Member Functions | ||
85 | |||
86 | tmp<volScalarField> K(const volScalarField& Ur) const; | ||
87 | }; | ||
88 | |||
89 | |||
90 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
91 | |||
92 | } // End namespace dragModels | ||
93 | } // End namespace Foam | ||
94 | |||
95 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
96 | |||
97 | #endif | ||
98 | |||
99 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/interfacialModels/dragModels/dragModel/dragModel.C added (mode: 100644) (index 0000000..acab521) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2011 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 "dragModel.H" | ||
27 | |||
28 | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // | ||
29 | |||
30 | namespace Foam | ||
31 | { | ||
32 | defineTypeNameAndDebug(dragModel, 0); | ||
33 | defineRunTimeSelectionTable(dragModel, dictionary); | ||
34 | } | ||
35 | |||
36 | |||
37 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | ||
38 | |||
39 | Foam::dragModel::dragModel | ||
40 | ( | ||
41 | const dictionary& interfaceDict, | ||
42 | const phaseModel& phase1, | ||
43 | const phaseModel& phase2 | ||
44 | ) | ||
45 | : | ||
46 | interfaceDict_(interfaceDict), | ||
47 | phase1_(phase1), | ||
48 | phase2_(phase2), | ||
49 | residualPhaseFraction_ | ||
50 | ( | ||
51 | "residualPhaseFraction", | ||
52 | dimless, | ||
53 | interfaceDict.lookup("residualPhaseFraction") | ||
54 | ), | ||
55 | residualSlip_ | ||
56 | ( | ||
57 | "residualSlip", | ||
58 | dimVelocity, | ||
59 | interfaceDict.lookup("residualSlip") | ||
60 | ) | ||
61 | {} | ||
62 | |||
63 | |||
64 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | ||
65 | |||
66 | Foam::dragModel::~dragModel() | ||
67 | {} | ||
68 | |||
69 | |||
70 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/interfacialModels/dragModels/dragModel/dragModel.H added (mode: 100644) (index 0000000..eff4c38) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2011-2015 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 | Class | ||
25 | Foam::dragModel | ||
26 | |||
27 | Description | ||
28 | |||
29 | SourceFiles | ||
30 | dragModel.C | ||
31 | newDragModel.C | ||
32 | |||
33 | \*---------------------------------------------------------------------------*/ | ||
34 | |||
35 | #ifndef dragModel_H | ||
36 | #define dragModel_H | ||
37 | |||
38 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
39 | |||
40 | #include "dictionary.H" | ||
41 | #include "phaseModel.H" | ||
42 | #include "runTimeSelectionTables.H" | ||
43 | |||
44 | namespace Foam | ||
45 | { | ||
46 | |||
47 | /*---------------------------------------------------------------------------*\ | ||
48 | Class dragModel Declaration | ||
49 | \*---------------------------------------------------------------------------*/ | ||
50 | |||
51 | class dragModel | ||
52 | { | ||
53 | protected: | ||
54 | |||
55 | // Protected data | ||
56 | |||
57 | const dictionary& interfaceDict_; | ||
58 | const phaseModel& phase1_; | ||
59 | const phaseModel& phase2_; | ||
60 | dimensionedScalar residualPhaseFraction_; | ||
61 | dimensionedScalar residualSlip_; | ||
62 | |||
63 | public: | ||
64 | |||
65 | //- Runtime type information | ||
66 | TypeName("dragModel"); | ||
67 | |||
68 | |||
69 | // Declare runtime construction | ||
70 | |||
71 | declareRunTimeSelectionTable | ||
72 | ( | ||
73 | autoPtr, | ||
74 | dragModel, | ||
75 | dictionary, | ||
76 | ( | ||
77 | const dictionary& interfaceDict, | ||
78 | const phaseModel& phase1, | ||
79 | const phaseModel& phase2 | ||
80 | ), | ||
81 | (interfaceDict, phase1, phase2) | ||
82 | ); | ||
83 | |||
84 | |||
85 | // Constructors | ||
86 | |||
87 | dragModel | ||
88 | ( | ||
89 | const dictionary& interfaceDict, | ||
90 | const phaseModel& phase1, | ||
91 | const phaseModel& phase2 | ||
92 | ); | ||
93 | |||
94 | |||
95 | //- Destructor | ||
96 | virtual ~dragModel(); | ||
97 | |||
98 | |||
99 | // Selectors | ||
100 | |||
101 | static autoPtr<dragModel> New | ||
102 | ( | ||
103 | const dictionary& interfaceDict, | ||
104 | const phaseModel& phase1, | ||
105 | const phaseModel& phase2 | ||
106 | ); | ||
107 | |||
108 | |||
109 | // Member Functions | ||
110 | |||
111 | const phaseModel& phase1() const | ||
112 | { | ||
113 | return phase1_; | ||
114 | } | ||
115 | |||
116 | const phaseModel& phase2() const | ||
117 | { | ||
118 | return phase2_; | ||
119 | } | ||
120 | |||
121 | const dimensionedScalar& residualPhaseFraction() const | ||
122 | { | ||
123 | return residualPhaseFraction_; | ||
124 | } | ||
125 | |||
126 | const dimensionedScalar& residualSlip() const | ||
127 | { | ||
128 | return residualSlip_; | ||
129 | } | ||
130 | |||
131 | //- The dragfunction K used in the momentum eq. | ||
132 | // ddt(alpha1*rho1*U1) + ... = ... alpha1*alpha2*K*(U1-U2) | ||
133 | // ddt(alpha2*rho2*U2) + ... = ... alpha1*alpha2*K*(U2-U1) | ||
134 | // ********************************** NB! ***************************** | ||
135 | // for numerical reasons alpha1 and alpha2 has been | ||
136 | // extracted from the dragFunction K, | ||
137 | // so you MUST divide K by alpha1*alpha2 when implemnting the drag | ||
138 | // function | ||
139 | // ********************************** NB! ***************************** | ||
140 | virtual tmp<volScalarField> K(const volScalarField& Ur) const = 0; | ||
141 | }; | ||
142 | |||
143 | |||
144 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
145 | |||
146 | } // End namespace Foam | ||
147 | |||
148 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
149 | |||
150 | #endif | ||
151 | |||
152 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/interfacialModels/dragModels/dragModel/newDragModel.C added (mode: 100644) (index 0000000..3bdd49e) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2011-2015 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 "dragModel.H" | ||
27 | |||
28 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
29 | |||
30 | Foam::autoPtr<Foam::dragModel> Foam::dragModel::New | ||
31 | ( | ||
32 | const dictionary& interfaceDict, | ||
33 | const phaseModel& phase1, | ||
34 | const phaseModel& phase2 | ||
35 | ) | ||
36 | { | ||
37 | word dragModelType(interfaceDict.lookup("type")); | ||
38 | |||
39 | Info << "Selecting dragModel for phase " | ||
40 | << phase1.name() | ||
41 | << ": " | ||
42 | << dragModelType << endl; | ||
43 | |||
44 | dictionaryConstructorTable::iterator cstrIter = | ||
45 | dictionaryConstructorTablePtr_->find(dragModelType); | ||
46 | |||
47 | if (cstrIter == dictionaryConstructorTablePtr_->end()) | ||
48 | { | ||
49 | FatalErrorInFunction | ||
50 | << "Unknown dragModelType type " | ||
51 | << dragModelType << endl << endl | ||
52 | << "Valid dragModel types are : " << endl | ||
53 | << dictionaryConstructorTablePtr_->sortedToc() | ||
54 | << exit(FatalError); | ||
55 | } | ||
56 | |||
57 | return cstrIter()(interfaceDict, phase1, phase2); | ||
58 | } | ||
59 | |||
60 | |||
61 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/interfacialModels/dragModels/interface/interface.C added (mode: 100644) (index 0000000..0ef07da) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2011 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 "interface.H" | ||
27 | #include "addToRunTimeSelectionTable.H" | ||
28 | |||
29 | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // | ||
30 | |||
31 | namespace Foam | ||
32 | { | ||
33 | namespace dragModels | ||
34 | { | ||
35 | defineTypeNameAndDebug(interface, 0); | ||
36 | |||
37 | addToRunTimeSelectionTable | ||
38 | ( | ||
39 | dragModel, | ||
40 | interface, | ||
41 | dictionary | ||
42 | ); | ||
43 | } | ||
44 | } | ||
45 | |||
46 | |||
47 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | ||
48 | |||
49 | Foam::dragModels::interface::interface | ||
50 | ( | ||
51 | const dictionary& interfaceDict, | ||
52 | const phaseModel& phase1, | ||
53 | const phaseModel& phase2 | ||
54 | ) | ||
55 | : | ||
56 | dragModel(interfaceDict, phase1, phase2) | ||
57 | {} | ||
58 | |||
59 | |||
60 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | ||
61 | |||
62 | Foam::dragModels::interface::~interface() | ||
63 | {} | ||
64 | |||
65 | |||
66 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | ||
67 | |||
68 | Foam::tmp<Foam::volScalarField> Foam::dragModels::interface::K | ||
69 | ( | ||
70 | const volScalarField& Ur | ||
71 | ) const | ||
72 | { | ||
73 | return tmp<volScalarField> | ||
74 | ( | ||
75 | new volScalarField | ||
76 | ( | ||
77 | IOobject | ||
78 | ( | ||
79 | "K", | ||
80 | Ur.mesh().time().timeName(), | ||
81 | Ur.mesh(), | ||
82 | IOobject::NO_READ, | ||
83 | IOobject::NO_WRITE, | ||
84 | false | ||
85 | ), | ||
86 | Ur.mesh(), | ||
87 | dimensionedScalar("K", dimDensity/dimTime, 0) | ||
88 | ) | ||
89 | ); | ||
90 | } | ||
91 | |||
92 | |||
93 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/interfacialModels/dragModels/interface/interface.H added (mode: 100644) (index 0000000..bc7c822) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2011 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 | Class | ||
25 | Foam::dragModels::interface | ||
26 | |||
27 | Description | ||
28 | Drag between phase separated by a VoF resolved interface. | ||
29 | |||
30 | SourceFiles | ||
31 | interface.C | ||
32 | |||
33 | \*---------------------------------------------------------------------------*/ | ||
34 | |||
35 | #ifndef interface_H | ||
36 | #define interface_H | ||
37 | |||
38 | #include "dragModel.H" | ||
39 | |||
40 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
41 | |||
42 | namespace Foam | ||
43 | { | ||
44 | namespace dragModels | ||
45 | { | ||
46 | |||
47 | /*---------------------------------------------------------------------------*\ | ||
48 | Class interface Declaration | ||
49 | \*---------------------------------------------------------------------------*/ | ||
50 | |||
51 | class interface | ||
52 | : | ||
53 | public dragModel | ||
54 | { | ||
55 | |||
56 | public: | ||
57 | |||
58 | //- Runtime type information | ||
59 | TypeName("interface"); | ||
60 | |||
61 | |||
62 | // Constructors | ||
63 | |||
64 | //- Construct from components | ||
65 | interface | ||
66 | ( | ||
67 | const dictionary& interfaceDict, | ||
68 | const phaseModel& phase1, | ||
69 | const phaseModel& phase2 | ||
70 | ); | ||
71 | |||
72 | |||
73 | //- Destructor | ||
74 | virtual ~interface(); | ||
75 | |||
76 | |||
77 | // Member Functions | ||
78 | |||
79 | tmp<volScalarField> K(const volScalarField& Ur) const; | ||
80 | }; | ||
81 | |||
82 | |||
83 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
84 | |||
85 | } // End namespace dragModels | ||
86 | } // End namespace Foam | ||
87 | |||
88 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
89 | |||
90 | #endif | ||
91 | |||
92 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/interfacialModels/heatTransferModels/RanzMarshall/RanzMarshall.C added (mode: 100644) (index 0000000..9bc6cad) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2011-2012 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 "RanzMarshall.H" | ||
27 | #include "addToRunTimeSelectionTable.H" | ||
28 | |||
29 | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // | ||
30 | |||
31 | namespace Foam | ||
32 | { | ||
33 | namespace heatTransferModels | ||
34 | { | ||
35 | defineTypeNameAndDebug(RanzMarshall, 0); | ||
36 | |||
37 | addToRunTimeSelectionTable | ||
38 | ( | ||
39 | heatTransferModel, | ||
40 | RanzMarshall, | ||
41 | dictionary | ||
42 | ); | ||
43 | } | ||
44 | } | ||
45 | |||
46 | |||
47 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | ||
48 | |||
49 | Foam::heatTransferModels::RanzMarshall::RanzMarshall | ||
50 | ( | ||
51 | const dictionary& interfaceDict, | ||
52 | const volScalarField& alpha1, | ||
53 | const phaseModel& phase1, | ||
54 | const phaseModel& phase2 | ||
55 | ) | ||
56 | : | ||
57 | heatTransferModel(interfaceDict, alpha1, phase1, phase2) | ||
58 | {} | ||
59 | |||
60 | |||
61 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | ||
62 | |||
63 | Foam::heatTransferModels::RanzMarshall::~RanzMarshall() | ||
64 | {} | ||
65 | |||
66 | |||
67 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | ||
68 | |||
69 | Foam::tmp<Foam::volScalarField> Foam::heatTransferModels::RanzMarshall::K | ||
70 | ( | ||
71 | const volScalarField& Ur | ||
72 | ) const | ||
73 | { | ||
74 | volScalarField Re(max(Ur*phase1_.d()/phase2_.nu(), scalar(1.0e-3))); | ||
75 | dimensionedScalar Prb = | ||
76 | phase2_.rho()*phase2_.nu()*phase2_.Cp()/phase2_.kappa(); | ||
77 | volScalarField Nu(scalar(2) + 0.6*sqrt(Re)*cbrt(Prb)); | ||
78 | |||
79 | return 6.0*phase2_.kappa()*Nu/sqr(phase1_.d()); | ||
80 | } | ||
81 | |||
82 | |||
83 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/interfacialModels/heatTransferModels/RanzMarshall/RanzMarshall.H added (mode: 100644) (index 0000000..6f3d3f9) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2011-2012 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 | Class | ||
25 | Foam::heatTransferModels::RanzMarshall | ||
26 | |||
27 | Description | ||
28 | |||
29 | SourceFiles | ||
30 | RanzMarshall.C | ||
31 | |||
32 | \*---------------------------------------------------------------------------*/ | ||
33 | |||
34 | #ifndef RanzMarshall_H | ||
35 | #define RanzMarshall_H | ||
36 | |||
37 | #include "heatTransferModel.H" | ||
38 | |||
39 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
40 | |||
41 | namespace Foam | ||
42 | { | ||
43 | namespace heatTransferModels | ||
44 | { | ||
45 | |||
46 | /*---------------------------------------------------------------------------*\ | ||
47 | Class RanzMarshall Declaration | ||
48 | \*---------------------------------------------------------------------------*/ | ||
49 | |||
50 | class RanzMarshall | ||
51 | : | ||
52 | public heatTransferModel | ||
53 | { | ||
54 | |||
55 | public: | ||
56 | |||
57 | //- Runtime type information | ||
58 | TypeName("RanzMarshall"); | ||
59 | |||
60 | |||
61 | // Constructors | ||
62 | |||
63 | //- Construct from components | ||
64 | RanzMarshall | ||
65 | ( | ||
66 | const dictionary& interfaceDict, | ||
67 | const volScalarField& alpha1, | ||
68 | const phaseModel& phase1, | ||
69 | const phaseModel& phase2 | ||
70 | ); | ||
71 | |||
72 | |||
73 | //- Destructor | ||
74 | virtual ~RanzMarshall(); | ||
75 | |||
76 | |||
77 | // Member Functions | ||
78 | |||
79 | tmp<volScalarField> K(const volScalarField& Ur) const; | ||
80 | }; | ||
81 | |||
82 | |||
83 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
84 | |||
85 | } // End namespace heatTransferModels | ||
86 | } // End namespace Foam | ||
87 | |||
88 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
89 | |||
90 | #endif | ||
91 | |||
92 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/interfacialModels/heatTransferModels/heatTransferModel/heatTransferModel.C added (mode: 100644) (index 0000000..b6a85e7) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2011-2012 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 "heatTransferModel.H" | ||
27 | |||
28 | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // | ||
29 | |||
30 | namespace Foam | ||
31 | { | ||
32 | defineTypeNameAndDebug(heatTransferModel, 0); | ||
33 | defineRunTimeSelectionTable(heatTransferModel, dictionary); | ||
34 | } | ||
35 | |||
36 | |||
37 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | ||
38 | |||
39 | Foam::heatTransferModel::heatTransferModel | ||
40 | ( | ||
41 | const dictionary& interfaceDict, | ||
42 | const volScalarField& alpha1, | ||
43 | const phaseModel& phase1, | ||
44 | const phaseModel& phase2 | ||
45 | ) | ||
46 | : | ||
47 | interfaceDict_(interfaceDict), | ||
48 | alpha1_(alpha1), | ||
49 | phase1_(phase1), | ||
50 | phase2_(phase2) | ||
51 | {} | ||
52 | |||
53 | |||
54 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | ||
55 | |||
56 | Foam::heatTransferModel::~heatTransferModel() | ||
57 | {} | ||
58 | |||
59 | |||
60 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/interfacialModels/heatTransferModels/heatTransferModel/heatTransferModel.H added (mode: 100644) (index 0000000..6ad7f13) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2011-2015 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 | Class | ||
25 | Foam::heatTransferModel | ||
26 | |||
27 | Description | ||
28 | |||
29 | SourceFiles | ||
30 | heatTransferModel.C | ||
31 | newHeatTransferModel.C | ||
32 | |||
33 | \*---------------------------------------------------------------------------*/ | ||
34 | |||
35 | #ifndef heatTransferModel_H | ||
36 | #define heatTransferModel_H | ||
37 | |||
38 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
39 | |||
40 | #include "dictionary.H" | ||
41 | #include "phaseModel.H" | ||
42 | #include "runTimeSelectionTables.H" | ||
43 | |||
44 | namespace Foam | ||
45 | { | ||
46 | |||
47 | /*---------------------------------------------------------------------------*\ | ||
48 | Class heatTransferModel Declaration | ||
49 | \*---------------------------------------------------------------------------*/ | ||
50 | |||
51 | class heatTransferModel | ||
52 | { | ||
53 | protected: | ||
54 | |||
55 | // Protected data | ||
56 | |||
57 | const dictionary& interfaceDict_; | ||
58 | const volScalarField& alpha1_; | ||
59 | const phaseModel& phase1_; | ||
60 | const phaseModel& phase2_; | ||
61 | |||
62 | |||
63 | public: | ||
64 | |||
65 | //- Runtime type information | ||
66 | TypeName("heatTransferModel"); | ||
67 | |||
68 | |||
69 | // Declare runtime construction | ||
70 | |||
71 | declareRunTimeSelectionTable | ||
72 | ( | ||
73 | autoPtr, | ||
74 | heatTransferModel, | ||
75 | dictionary, | ||
76 | ( | ||
77 | const dictionary& interfaceDict, | ||
78 | const volScalarField& alpha1, | ||
79 | const phaseModel& phase1, | ||
80 | const phaseModel& phase2 | ||
81 | ), | ||
82 | (interfaceDict, alpha1, phase1, phase2) | ||
83 | ); | ||
84 | |||
85 | |||
86 | // Constructors | ||
87 | |||
88 | heatTransferModel | ||
89 | ( | ||
90 | const dictionary& interfaceDict, | ||
91 | const volScalarField& alpha1, | ||
92 | const phaseModel& phase1, | ||
93 | const phaseModel& phase2 | ||
94 | ); | ||
95 | |||
96 | |||
97 | //- Destructor | ||
98 | virtual ~heatTransferModel(); | ||
99 | |||
100 | |||
101 | // Selectors | ||
102 | |||
103 | static autoPtr<heatTransferModel> New | ||
104 | ( | ||
105 | const dictionary& interfaceDict, | ||
106 | const volScalarField& alpha1, | ||
107 | const phaseModel& phase1, | ||
108 | const phaseModel& phase2 | ||
109 | ); | ||
110 | |||
111 | |||
112 | // Member Functions | ||
113 | |||
114 | //- The heat-transfer function K used in the enthalpy eq. | ||
115 | // ddt(alpha1*rho1*ha) + ... = ... alpha1*alpha2*K*(Ta - Tb) | ||
116 | // ddt(alpha2*rho2*hb) + ... = ... alpha1*alpha2*K*(Tb - Ta) | ||
117 | // ********************************** NB! ***************************** | ||
118 | // for numerical reasons alpha1 and alpha2 has been | ||
119 | // extracted from the heat-transfer function K, | ||
120 | // so you MUST divide K by alpha1*alpha2 when implementing the | ||
121 | // heat-transfer function | ||
122 | // ********************************** NB! ***************************** | ||
123 | virtual tmp<volScalarField> K(const volScalarField& Ur) const = 0; | ||
124 | }; | ||
125 | |||
126 | |||
127 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
128 | |||
129 | } // End namespace Foam | ||
130 | |||
131 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
132 | |||
133 | #endif | ||
134 | |||
135 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/interfacialModels/heatTransferModels/heatTransferModel/newHeatTransferModel.C added (mode: 100644) (index 0000000..deabfc9) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2011-2015 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 "heatTransferModel.H" | ||
27 | |||
28 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
29 | |||
30 | Foam::autoPtr<Foam::heatTransferModel> Foam::heatTransferModel::New | ||
31 | ( | ||
32 | const dictionary& interfaceDict, | ||
33 | const volScalarField& alpha1, | ||
34 | const phaseModel& phase1, | ||
35 | const phaseModel& phase2 | ||
36 | ) | ||
37 | { | ||
38 | word heatTransferModelType | ||
39 | ( | ||
40 | interfaceDict.lookup("heatTransferModel" + phase1.name()) | ||
41 | ); | ||
42 | |||
43 | Info<< "Selecting heatTransferModel for phase " | ||
44 | << phase1.name() | ||
45 | << ": " | ||
46 | << heatTransferModelType << endl; | ||
47 | |||
48 | dictionaryConstructorTable::iterator cstrIter = | ||
49 | dictionaryConstructorTablePtr_->find(heatTransferModelType); | ||
50 | |||
51 | if (cstrIter == dictionaryConstructorTablePtr_->end()) | ||
52 | { | ||
53 | FatalErrorInFunction | ||
54 | << "Unknown heatTransferModelType type " | ||
55 | << heatTransferModelType << endl << endl | ||
56 | << "Valid heatTransferModel types are : " << endl | ||
57 | << dictionaryConstructorTablePtr_->sortedToc() | ||
58 | << exit(FatalError); | ||
59 | } | ||
60 | |||
61 | return cstrIter()(interfaceDict, alpha1, phase1, phase2); | ||
62 | } | ||
63 | |||
64 | |||
65 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/multiphaseEulerPbeFoam.C added (mode: 100644) (index 0000000..a7e5910) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2011-2016 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 | Application | ||
25 | multiphaseEulerPbeFoam | ||
26 | |||
27 | Description | ||
28 | Solver for a system of many compressible fluid phases including | ||
29 | population balance. | ||
30 | |||
31 | \*---------------------------------------------------------------------------*/ | ||
32 | |||
33 | #include "fvCFD.H" | ||
34 | #include "multiphaseSystem.H" | ||
35 | #include "phaseModel.H" | ||
36 | #include "dragModel.H" | ||
37 | #include "heatTransferModel.H" | ||
38 | #include "singlePhaseTransportModel.H" | ||
39 | #include "turbulentTransportModel.H" | ||
40 | #include "pimpleControl.H" | ||
41 | #include "IOMRFZoneList.H" | ||
42 | #include "CorrectPhi.H" | ||
43 | #include "populationBalanceModel.H" | ||
44 | |||
45 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
46 | |||
47 | int main(int argc, char *argv[]) | ||
48 | { | ||
49 | #include "postProcess.H" | ||
50 | |||
51 | #include "setRootCase.H" | ||
52 | #include "createTime.H" | ||
53 | #include "createMesh.H" | ||
54 | #include "createControl.H" | ||
55 | #include "createFields.H" | ||
56 | #include "initContinuityErrs.H" | ||
57 | #include "createTimeControls.H" | ||
58 | #include "correctPhi.H" | ||
59 | #include "CourantNo.H" | ||
60 | #include "setInitialDeltaT.H" | ||
61 | |||
62 | scalar slamDampCoeff | ||
63 | ( | ||
64 | fluid.lookupOrDefault<scalar>("slamDampCoeff", 1) | ||
65 | ); | ||
66 | |||
67 | dimensionedScalar maxSlamVelocity | ||
68 | ( | ||
69 | "maxSlamVelocity", | ||
70 | dimVelocity, | ||
71 | fluid.lookupOrDefault<scalar>("maxSlamVelocity", GREAT) | ||
72 | ); | ||
73 | |||
74 | turbulence->validate(); | ||
75 | |||
76 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
77 | |||
78 | Info<< "\nStarting time loop\n" << endl; | ||
79 | |||
80 | while (runTime.run()) | ||
81 | { | ||
82 | #include "readTimeControls.H" | ||
83 | #include "CourantNo.H" | ||
84 | #include "setDeltaT.H" | ||
85 | |||
86 | runTime++; | ||
87 | Info<< "Time = " << runTime.timeName() << nl << endl; | ||
88 | |||
89 | // --- Pressure-velocity PIMPLE corrector loop | ||
90 | while (pimple.loop()) | ||
91 | { | ||
92 | turbulence->correct(); | ||
93 | fluid.solve(); | ||
94 | rho = fluid.rho(); | ||
95 | #include "zonePhaseVolumes.H" | ||
96 | |||
97 | //#include "TEqns.H" | ||
98 | #include "UEqns.H" | ||
99 | |||
100 | populationBalance->solve(); | ||
101 | |||
102 | // --- Pressure corrector loop | ||
103 | while (pimple.correct()) | ||
104 | { | ||
105 | #include "pEqn.H" | ||
106 | |||
107 | } | ||
108 | |||
109 | #include "DDtU.H" | ||
110 | } | ||
111 | |||
112 | runTime.write(); | ||
113 | |||
114 | Info<< "ExecutionTime = " | ||
115 | << runTime.elapsedCpuTime() | ||
116 | << " s\n\n" << endl; | ||
117 | } | ||
118 | |||
119 | Info<< "End\n" << endl; | ||
120 | |||
121 | return 0; | ||
122 | } | ||
123 | |||
124 | |||
125 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/multiphaseSystem/Make/files added (mode: 100644) (index 0000000..e14922c) | |||
1 | phaseModel/phaseModel.C | ||
2 | diameterModels/diameterModel/diameterModel.C | ||
3 | diameterModels/diameterModel/newDiameterModel.C | ||
4 | diameterModels/constantDiameter/constantDiameter.C | ||
5 | diameterModels/isothermalDiameter/isothermalDiameter.C | ||
6 | |||
7 | alphaContactAngle/alphaContactAngleFvPatchScalarField.C | ||
8 | multiphaseSystem.C | ||
9 | |||
10 | LIB = $(FOAM_LIBBIN)/libmultiphaseSystem |
File multiphaseEulerPbeFoam/multiphaseSystem/Make/options added (mode: 100644) (index 0000000..cccb315) | |||
1 | EXE_INC = \ | ||
2 | -I../phaseModel/lnInclude \ | ||
3 | -I../interfacialModels/lnInclude \ | ||
4 | -IalphaContactAngle \ | ||
5 | -I$(LIB_SRC)/transportModels \ | ||
6 | -I$(LIB_SRC)/transportModels/incompressible/lnInclude \ | ||
7 | -I$(LIB_SRC)/transportModels/interfaceProperties/lnInclude \ | ||
8 | -I$(LIB_SRC)/finiteVolume/lnInclude \ | ||
9 | -I$(LIB_SRC)/meshTools/lnInclude | ||
10 | |||
11 | LIB_LIBS = \ | ||
12 | -linterfaceProperties \ | ||
13 | -lincompressibleTransportModels \ | ||
14 | -lfiniteVolume \ | ||
15 | -lmeshTools |
File multiphaseEulerPbeFoam/multiphaseSystem/alphaContactAngle/alphaContactAngleFvPatchScalarField.C added (mode: 100644) (index 0000000..a0d433f) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2011 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 "alphaContactAngleFvPatchScalarField.H" | ||
27 | #include "addToRunTimeSelectionTable.H" | ||
28 | #include "fvPatchFieldMapper.H" | ||
29 | |||
30 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
31 | |||
32 | namespace Foam | ||
33 | { | ||
34 | |||
35 | alphaContactAngleFvPatchScalarField::interfaceThetaProps::interfaceThetaProps | ||
36 | ( | ||
37 | Istream& is | ||
38 | ) | ||
39 | : | ||
40 | theta0_(readScalar(is)), | ||
41 | uTheta_(readScalar(is)), | ||
42 | thetaA_(readScalar(is)), | ||
43 | thetaR_(readScalar(is)) | ||
44 | {} | ||
45 | |||
46 | |||
47 | Istream& operator>> | ||
48 | ( | ||
49 | Istream& is, | ||
50 | alphaContactAngleFvPatchScalarField::interfaceThetaProps& tp | ||
51 | ) | ||
52 | { | ||
53 | is >> tp.theta0_ >> tp.uTheta_ >> tp.thetaA_ >> tp.thetaR_; | ||
54 | return is; | ||
55 | } | ||
56 | |||
57 | |||
58 | Ostream& operator<< | ||
59 | ( | ||
60 | Ostream& os, | ||
61 | const alphaContactAngleFvPatchScalarField::interfaceThetaProps& tp | ||
62 | ) | ||
63 | { | ||
64 | os << tp.theta0_ << token::SPACE | ||
65 | << tp.uTheta_ << token::SPACE | ||
66 | << tp.thetaA_ << token::SPACE | ||
67 | << tp.thetaR_; | ||
68 | |||
69 | return os; | ||
70 | } | ||
71 | |||
72 | |||
73 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | ||
74 | |||
75 | alphaContactAngleFvPatchScalarField::alphaContactAngleFvPatchScalarField | ||
76 | ( | ||
77 | const fvPatch& p, | ||
78 | const DimensionedField<scalar, volMesh>& iF | ||
79 | ) | ||
80 | : | ||
81 | zeroGradientFvPatchScalarField(p, iF) | ||
82 | {} | ||
83 | |||
84 | |||
85 | alphaContactAngleFvPatchScalarField::alphaContactAngleFvPatchScalarField | ||
86 | ( | ||
87 | const alphaContactAngleFvPatchScalarField& gcpsf, | ||
88 | const fvPatch& p, | ||
89 | const DimensionedField<scalar, volMesh>& iF, | ||
90 | const fvPatchFieldMapper& mapper | ||
91 | ) | ||
92 | : | ||
93 | zeroGradientFvPatchScalarField(gcpsf, p, iF, mapper), | ||
94 | thetaProps_(gcpsf.thetaProps_) | ||
95 | {} | ||
96 | |||
97 | |||
98 | alphaContactAngleFvPatchScalarField::alphaContactAngleFvPatchScalarField | ||
99 | ( | ||
100 | const fvPatch& p, | ||
101 | const DimensionedField<scalar, volMesh>& iF, | ||
102 | const dictionary& dict | ||
103 | ) | ||
104 | : | ||
105 | zeroGradientFvPatchScalarField(p, iF), | ||
106 | thetaProps_(dict.lookup("thetaProperties")) | ||
107 | { | ||
108 | evaluate(); | ||
109 | } | ||
110 | |||
111 | |||
112 | alphaContactAngleFvPatchScalarField::alphaContactAngleFvPatchScalarField | ||
113 | ( | ||
114 | const alphaContactAngleFvPatchScalarField& gcpsf, | ||
115 | const DimensionedField<scalar, volMesh>& iF | ||
116 | ) | ||
117 | : | ||
118 | zeroGradientFvPatchScalarField(gcpsf, iF), | ||
119 | thetaProps_(gcpsf.thetaProps_) | ||
120 | {} | ||
121 | |||
122 | |||
123 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | ||
124 | |||
125 | void alphaContactAngleFvPatchScalarField::write(Ostream& os) const | ||
126 | { | ||
127 | fvPatchScalarField::write(os); | ||
128 | os.writeKeyword("thetaProperties") | ||
129 | << thetaProps_ << token::END_STATEMENT << nl; | ||
130 | writeEntry("value", os); | ||
131 | } | ||
132 | |||
133 | |||
134 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
135 | |||
136 | makePatchTypeField | ||
137 | ( | ||
138 | fvPatchScalarField, | ||
139 | alphaContactAngleFvPatchScalarField | ||
140 | ); | ||
141 | |||
142 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
143 | |||
144 | } // End namespace Foam | ||
145 | |||
146 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/multiphaseSystem/alphaContactAngle/alphaContactAngleFvPatchScalarField.H added (mode: 100644) (index 0000000..3245fa4) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2011-2012 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 | Class | ||
25 | Foam::alphaContactAngleFvPatchScalarField | ||
26 | |||
27 | Description | ||
28 | Contact-angle boundary condition for multi-phase interface-capturing | ||
29 | simulations. Used in conjuction with multiphaseSystem. | ||
30 | |||
31 | SourceFiles | ||
32 | alphaContactAngleFvPatchScalarField.C | ||
33 | |||
34 | \*---------------------------------------------------------------------------*/ | ||
35 | |||
36 | #ifndef alphaContactAngleFvPatchScalarField_H | ||
37 | #define alphaContactAngleFvPatchScalarField_H | ||
38 | |||
39 | #include "zeroGradientFvPatchFields.H" | ||
40 | #include "multiphaseSystem.H" | ||
41 | |||
42 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
43 | |||
44 | namespace Foam | ||
45 | { | ||
46 | |||
47 | /*---------------------------------------------------------------------------*\ | ||
48 | Class alphaContactAngleFvPatch Declaration | ||
49 | \*---------------------------------------------------------------------------*/ | ||
50 | |||
51 | class alphaContactAngleFvPatchScalarField | ||
52 | : | ||
53 | public zeroGradientFvPatchScalarField | ||
54 | { | ||
55 | public: | ||
56 | |||
57 | class interfaceThetaProps | ||
58 | { | ||
59 | //- Equilibrium contact angle | ||
60 | scalar theta0_; | ||
61 | |||
62 | //- Dynamic contact angle velocity scale | ||
63 | scalar uTheta_; | ||
64 | |||
65 | //- Limiting advancing contact angle | ||
66 | scalar thetaA_; | ||
67 | |||
68 | //- Limiting receeding contact angle | ||
69 | scalar thetaR_; | ||
70 | |||
71 | |||
72 | public: | ||
73 | |||
74 | // Constructors | ||
75 | interfaceThetaProps() | ||
76 | {} | ||
77 | |||
78 | interfaceThetaProps(Istream&); | ||
79 | |||
80 | |||
81 | // Member functions | ||
82 | |||
83 | //- Return the equilibrium contact angle theta0 | ||
84 | scalar theta0(bool matched=true) const | ||
85 | { | ||
86 | if (matched) return theta0_; | ||
87 | else return 180.0 - theta0_; | ||
88 | } | ||
89 | |||
90 | //- Return the dynamic contact angle velocity scale | ||
91 | scalar uTheta() const | ||
92 | { | ||
93 | return uTheta_; | ||
94 | } | ||
95 | |||
96 | //- Return the limiting advancing contact angle | ||
97 | scalar thetaA(bool matched=true) const | ||
98 | { | ||
99 | if (matched) return thetaA_; | ||
100 | else return 180.0 - thetaA_; | ||
101 | } | ||
102 | |||
103 | //- Return the limiting receeding contact angle | ||
104 | scalar thetaR(bool matched=true) const | ||
105 | { | ||
106 | if (matched) return thetaR_; | ||
107 | else return 180.0 - thetaR_; | ||
108 | } | ||
109 | |||
110 | |||
111 | // IO functions | ||
112 | |||
113 | friend Istream& operator>>(Istream&, interfaceThetaProps&); | ||
114 | friend Ostream& operator<<(Ostream&, const interfaceThetaProps&); | ||
115 | }; | ||
116 | |||
117 | typedef HashTable | ||
118 | < | ||
119 | interfaceThetaProps, | ||
120 | multiphaseSystem::interfacePair, | ||
121 | multiphaseSystem::interfacePair::symmHash | ||
122 | > thetaPropsTable; | ||
123 | |||
124 | |||
125 | private: | ||
126 | |||
127 | // Private data | ||
128 | |||
129 | thetaPropsTable thetaProps_; | ||
130 | |||
131 | |||
132 | public: | ||
133 | |||
134 | //- Runtime type information | ||
135 | TypeName("alphaContactAngle"); | ||
136 | |||
137 | |||
138 | // Constructors | ||
139 | |||
140 | //- Construct from patch and internal field | ||
141 | alphaContactAngleFvPatchScalarField | ||
142 | ( | ||
143 | const fvPatch&, | ||
144 | const DimensionedField<scalar, volMesh>& | ||
145 | ); | ||
146 | |||
147 | //- Construct from patch, internal field and dictionary | ||
148 | alphaContactAngleFvPatchScalarField | ||
149 | ( | ||
150 | const fvPatch&, | ||
151 | const DimensionedField<scalar, volMesh>&, | ||
152 | const dictionary& | ||
153 | ); | ||
154 | |||
155 | //- Construct by mapping given alphaContactAngleFvPatchScalarField | ||
156 | // onto a new patch | ||
157 | alphaContactAngleFvPatchScalarField | ||
158 | ( | ||
159 | const alphaContactAngleFvPatchScalarField&, | ||
160 | const fvPatch&, | ||
161 | const DimensionedField<scalar, volMesh>&, | ||
162 | const fvPatchFieldMapper& | ||
163 | ); | ||
164 | |||
165 | //- Construct and return a clone | ||
166 | virtual tmp<fvPatchScalarField> clone() const | ||
167 | { | ||
168 | return tmp<fvPatchScalarField> | ||
169 | ( | ||
170 | new alphaContactAngleFvPatchScalarField(*this) | ||
171 | ); | ||
172 | } | ||
173 | |||
174 | //- Construct as copy setting internal field reference | ||
175 | alphaContactAngleFvPatchScalarField | ||
176 | ( | ||
177 | const alphaContactAngleFvPatchScalarField&, | ||
178 | const DimensionedField<scalar, volMesh>& | ||
179 | ); | ||
180 | |||
181 | //- Construct and return a clone setting internal field reference | ||
182 | virtual tmp<fvPatchScalarField> clone | ||
183 | ( | ||
184 | const DimensionedField<scalar, volMesh>& iF | ||
185 | ) const | ||
186 | { | ||
187 | return tmp<fvPatchScalarField> | ||
188 | ( | ||
189 | new alphaContactAngleFvPatchScalarField(*this, iF) | ||
190 | ); | ||
191 | } | ||
192 | |||
193 | |||
194 | // Member functions | ||
195 | |||
196 | //- Return the contact angle properties | ||
197 | const thetaPropsTable& thetaProps() const | ||
198 | { | ||
199 | return thetaProps_; | ||
200 | } | ||
201 | |||
202 | //- Write | ||
203 | virtual void write(Ostream&) const; | ||
204 | }; | ||
205 | |||
206 | |||
207 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
208 | |||
209 | } // End namespace Foam | ||
210 | |||
211 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
212 | |||
213 | #endif | ||
214 | |||
215 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/multiphaseSystem/diameterModels/QBMMDiameter/QBMMDiameter.C added (mode: 100644) (index 0000000..b552641) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2011-2013 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 "QBMMDiameter.H" | ||
27 | #include "multiphasePbeSystem.H" | ||
28 | #include "mathematicalConstants.H" | ||
29 | #include "fundamentalConstants.H" | ||
30 | #include "addToRunTimeSelectionTable.H" | ||
31 | |||
32 | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // | ||
33 | |||
34 | namespace Foam | ||
35 | { | ||
36 | namespace diameterModels | ||
37 | { | ||
38 | defineTypeNameAndDebug(QBMM, 0); | ||
39 | |||
40 | addToRunTimeSelectionTable | ||
41 | ( | ||
42 | diameterModel, | ||
43 | QBMM, | ||
44 | dictionary | ||
45 | ); | ||
46 | } | ||
47 | } | ||
48 | |||
49 | |||
50 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | ||
51 | |||
52 | Foam::diameterModels::QBMM::QBMM | ||
53 | ( | ||
54 | const dictionary& dict, | ||
55 | const phaseModel& phase | ||
56 | ) | ||
57 | : | ||
58 | diameterModel(dict, phase), | ||
59 | d_ | ||
60 | ( | ||
61 | IOobject | ||
62 | ( | ||
63 | IOobject::groupName("d", phase.name()), | ||
64 | // phase_.U().time().timeName(), | ||
65 | phase.time().timeName(), | ||
66 | // phase_.U().mesh(), | ||
67 | phase.db(), | ||
68 | IOobject::MUST_READ, | ||
69 | IOobject::AUTO_WRITE | ||
70 | ), | ||
71 | // phase_.U().mesh() | ||
72 | phase.mesh() | ||
73 | ), | ||
74 | // d0_("d0", dimLength, dict.lookup("d0")), | ||
75 | No_("No", dimless/dimVol, dict_.lookup("No")), | ||
76 | Vo_("Vo", dimless, dict_.lookup("Vo")), | ||
77 | pNum_("pNum", dimless, dict_.lookup("pNum")) | ||
78 | // p0_("p0", dimPressure, dict.lookup("p0")) | ||
79 | {} | ||
80 | |||
81 | |||
82 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | ||
83 | |||
84 | Foam::diameterModels::QBMM::~QBMM() | ||
85 | {} | ||
86 | |||
87 | |||
88 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | ||
89 | |||
90 | Foam::tmp<Foam::volScalarField> Foam::diameterModels::QBMM::d() const | ||
91 | { | ||
92 | return d_; | ||
93 | } | ||
94 | |||
95 | void Foam::diameterModels::QBMM::correct() | ||
96 | { | ||
97 | scalar oneDivThree = 1.0/3.0; | ||
98 | const dimensionedScalar& CC = Foam::pow( 6.0 * Vo_ / constant::mathematical::pi / No_, oneDivThree ); | ||
99 | |||
100 | label n = pNum_.value(); | ||
101 | word fieldName = "ABSC" + Foam::name(n); | ||
102 | const volScalarField& absc = phase_.db().lookupObject<volScalarField>(fieldName); | ||
103 | |||
104 | // Update the diameter | ||
105 | d_ = CC * Foam::pow(absc, oneDivThree); | ||
106 | |||
107 | /* | ||
108 | forAll(d_, cellI) | ||
109 | { | ||
110 | d_[cellI] = CC.value() * Foam::pow(absc[cellI], oneDivThree); | ||
111 | } | ||
112 | */ | ||
113 | |||
114 | // A.internalField() = Foam::pow(B.internalField(),C.internalField()); | ||
115 | // A.boundaryField() = Foam::pow(B.boundaryField(),C.boundaryField()); | ||
116 | |||
117 | } | ||
118 | |||
119 | /* | ||
120 | Foam::tmp<Foam::volScalarField> Foam::diameterModels::QBMM::d() const | ||
121 | { | ||
122 | // const dictionary& populationBalanceProperties = db().lookupObject<dictionary>("populationBalanceProperties"); | ||
123 | // const volScalarField& p = phase_.U().db().lookupObject<volScalarField>("p"); | ||
124 | |||
125 | scalar oneDivThree = 1.0/3.0; | ||
126 | const dimensionedScalar& CC = Foam::pow( 6.0 * Vo_ / constant::mathematical::pi / No_, oneDivThree ); | ||
127 | |||
128 | label n = pNum_.value(); | ||
129 | word fieldName = "ABSC" + Foam::name(n); | ||
130 | const volScalarField& absc = phase_.db().lookupObject<volScalarField>(fieldName); | ||
131 | |||
132 | |||
133 | // wordList fieldName(n); | ||
134 | // PtrList<volScalarField> absc(n); | ||
135 | // for (label i=0; i<n; i++) | ||
136 | // { | ||
137 | // fieldName[i] = "ABSC" + Foam::name(i+1); | ||
138 | // absc.set | ||
139 | // ( | ||
140 | // i, new volScalarField(phase_.db().lookupObject<volScalarField>(fieldName[i])) | ||
141 | // ); | ||
142 | // } | ||
143 | |||
144 | return CC * Foam::pow(absc, oneDivThree); | ||
145 | |||
146 | } | ||
147 | */ | ||
148 | |||
149 | bool Foam::diameterModels::QBMM::read(const dictionary& populationBalanceProperties) | ||
150 | { | ||
151 | diameterModel::read(populationBalanceProperties); | ||
152 | |||
153 | dict_.lookup("No") >> No_; | ||
154 | dict_.lookup("Vo") >> Vo_; | ||
155 | dict_.lookup("pNum") >> pNum_; | ||
156 | |||
157 | // Re-create all the sources updating number, type and coefficients | ||
158 | /* PtrList<IATEsource> | ||
159 | ( | ||
160 | diameterProperties_.lookup("sources"), | ||
161 | IATEsource::iNew(*this) | ||
162 | ).transfer(sources_); | ||
163 | */ | ||
164 | |||
165 | return true; | ||
166 | } | ||
167 | |||
168 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/multiphaseSystem/diameterModels/QBMMDiameter/QBMMDiameter.H added (mode: 100644) (index 0000000..c6ce40d) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2011-2013 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 | Class | ||
25 | Foam::diameterModels::QBMM | ||
26 | |||
27 | Description | ||
28 | QBMM-based dispersed-phase particle diameter model. | ||
29 | |||
30 | Calculates the sauter-mean diameter of a phase based on time-evolution of | ||
31 | the moments of the distribution as evaluated using the OpenQBMM library. | ||
32 | |||
33 | SourceFiles | ||
34 | QBMM.C | ||
35 | |||
36 | \*---------------------------------------------------------------------------*/ | ||
37 | |||
38 | #ifndef QBMM_H | ||
39 | #define QBMM_H | ||
40 | |||
41 | #include "diameterModel.H" | ||
42 | |||
43 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
44 | |||
45 | namespace Foam | ||
46 | { | ||
47 | namespace diameterModels | ||
48 | { | ||
49 | |||
50 | /*---------------------------------------------------------------------------*\ | ||
51 | Class QBMM Declaration | ||
52 | \*---------------------------------------------------------------------------*/ | ||
53 | |||
54 | class QBMM | ||
55 | : | ||
56 | public diameterModel | ||
57 | { | ||
58 | // Private data | ||
59 | |||
60 | //- Reference diameter of the phase | ||
61 | volScalarField d_; | ||
62 | |||
63 | //- Initial number of particles | ||
64 | dimensionedScalar No_; | ||
65 | |||
66 | //- Initial global dispersed void fraction | ||
67 | dimensionedScalar Vo_; | ||
68 | |||
69 | //- Number assigned to the phase | ||
70 | dimensionedScalar pNum_; | ||
71 | |||
72 | public: | ||
73 | |||
74 | //- Runtime type information | ||
75 | TypeName("QBMM"); | ||
76 | |||
77 | |||
78 | // Constructors | ||
79 | |||
80 | //- Construct from components | ||
81 | QBMM | ||
82 | ( | ||
83 | const dictionary& dict, | ||
84 | const phaseModel& phase | ||
85 | ); | ||
86 | |||
87 | |||
88 | //- Destructor | ||
89 | virtual ~QBMM(); | ||
90 | |||
91 | |||
92 | // Member Functions | ||
93 | |||
94 | //- Update the diameter field | ||
95 | virtual tmp<volScalarField> d() const; | ||
96 | |||
97 | //- Correct the diameter field | ||
98 | virtual void correct(); | ||
99 | |||
100 | //- Read phaseProperties dictionary | ||
101 | virtual bool read(const dictionary& populationBalanceProperties); | ||
102 | }; | ||
103 | |||
104 | |||
105 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
106 | |||
107 | } // End namespace diameterModels | ||
108 | } // End namespace Foam | ||
109 | |||
110 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
111 | |||
112 | #endif | ||
113 | |||
114 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/multiphaseSystem/diameterModels/constantDiameter/constantDiameter.C added (mode: 100644) (index 0000000..88b867f) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2011-2015 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 "constantDiameter.H" | ||
27 | #include "addToRunTimeSelectionTable.H" | ||
28 | |||
29 | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // | ||
30 | |||
31 | namespace Foam | ||
32 | { | ||
33 | namespace diameterModels | ||
34 | { | ||
35 | defineTypeNameAndDebug(constant, 0); | ||
36 | |||
37 | addToRunTimeSelectionTable | ||
38 | ( | ||
39 | diameterModel, | ||
40 | constant, | ||
41 | dictionary | ||
42 | ); | ||
43 | } | ||
44 | } | ||
45 | |||
46 | |||
47 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | ||
48 | |||
49 | Foam::diameterModels::constant::constant | ||
50 | ( | ||
51 | const dictionary& dict, | ||
52 | const phaseModel& phase | ||
53 | ) | ||
54 | : | ||
55 | diameterModel(dict, phase), | ||
56 | d_("d", dimLength, dict) | ||
57 | {} | ||
58 | |||
59 | |||
60 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | ||
61 | |||
62 | Foam::diameterModels::constant::~constant() | ||
63 | {} | ||
64 | |||
65 | |||
66 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | ||
67 | |||
68 | Foam::tmp<Foam::volScalarField> Foam::diameterModels::constant::d() const | ||
69 | { | ||
70 | return tmp<Foam::volScalarField> | ||
71 | ( | ||
72 | new volScalarField | ||
73 | ( | ||
74 | IOobject | ||
75 | ( | ||
76 | "d", | ||
77 | phase_.U().time().timeName(), | ||
78 | phase_.U().mesh() | ||
79 | ), | ||
80 | phase_.U().mesh(), | ||
81 | d_ | ||
82 | ) | ||
83 | ); | ||
84 | } | ||
85 | |||
86 | |||
87 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/multiphaseSystem/diameterModels/constantDiameter/constantDiameter.H added (mode: 100644) (index 0000000..071820c) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2011-2013 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 | Class | ||
25 | Foam::constant | ||
26 | |||
27 | Description | ||
28 | Constant dispersed-phase particle diameter model. | ||
29 | |||
30 | SourceFiles | ||
31 | constant.C | ||
32 | |||
33 | \*---------------------------------------------------------------------------*/ | ||
34 | |||
35 | #ifndef constant_H | ||
36 | #define constant_H | ||
37 | |||
38 | #include "diameterModel.H" | ||
39 | |||
40 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
41 | |||
42 | namespace Foam | ||
43 | { | ||
44 | namespace diameterModels | ||
45 | { | ||
46 | |||
47 | /*---------------------------------------------------------------------------*\ | ||
48 | Class constant Declaration | ||
49 | \*---------------------------------------------------------------------------*/ | ||
50 | |||
51 | class constant | ||
52 | : | ||
53 | public diameterModel | ||
54 | { | ||
55 | // Private data | ||
56 | |||
57 | //- The constant diameter of the phase | ||
58 | dimensionedScalar d_; | ||
59 | |||
60 | |||
61 | public: | ||
62 | |||
63 | //- Runtime type information | ||
64 | TypeName("constant"); | ||
65 | |||
66 | |||
67 | // Constructors | ||
68 | |||
69 | //- Construct from components | ||
70 | constant | ||
71 | ( | ||
72 | const dictionary& dict, | ||
73 | const phaseModel& phase | ||
74 | ); | ||
75 | |||
76 | |||
77 | //- Destructor | ||
78 | virtual ~constant(); | ||
79 | |||
80 | |||
81 | // Member Functions | ||
82 | |||
83 | tmp<volScalarField> d() const; | ||
84 | }; | ||
85 | |||
86 | |||
87 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
88 | |||
89 | } // End namespace diameterModels | ||
90 | } // End namespace Foam | ||
91 | |||
92 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
93 | |||
94 | #endif | ||
95 | |||
96 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/multiphaseSystem/diameterModels/diameterModel/diameterModel.C added (mode: 100644) (index 0000000..2618815) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2011-2013 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 "diameterModel.H" | ||
27 | |||
28 | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // | ||
29 | |||
30 | namespace Foam | ||
31 | { | ||
32 | defineTypeNameAndDebug(diameterModel, 0); | ||
33 | defineRunTimeSelectionTable(diameterModel, dictionary); | ||
34 | } | ||
35 | |||
36 | |||
37 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | ||
38 | |||
39 | Foam::diameterModel::diameterModel | ||
40 | ( | ||
41 | const dictionary& dict, | ||
42 | const phaseModel& phase | ||
43 | ) | ||
44 | : | ||
45 | dict_(dict), | ||
46 | phase_(phase) | ||
47 | {} | ||
48 | |||
49 | |||
50 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | ||
51 | |||
52 | Foam::diameterModel::~diameterModel() | ||
53 | {} | ||
54 | |||
55 | |||
56 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/multiphaseSystem/diameterModels/diameterModel/diameterModel.H added (mode: 100644) (index 0000000..0c8364b) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2011-2013 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 | Class | ||
25 | Foam::diameterModel | ||
26 | |||
27 | Description | ||
28 | Abstract base-class for dispersed-phase particle diameter models. | ||
29 | |||
30 | SourceFiles | ||
31 | diameterModel.C | ||
32 | newDiameterModel.C | ||
33 | |||
34 | \*---------------------------------------------------------------------------*/ | ||
35 | |||
36 | #ifndef diameterModel_H | ||
37 | #define diameterModel_H | ||
38 | |||
39 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
40 | |||
41 | #include "dictionary.H" | ||
42 | #include "phaseModel.H" | ||
43 | #include "runTimeSelectionTables.H" | ||
44 | |||
45 | namespace Foam | ||
46 | { | ||
47 | |||
48 | /*---------------------------------------------------------------------------*\ | ||
49 | Class diameterModel Declaration | ||
50 | \*---------------------------------------------------------------------------*/ | ||
51 | |||
52 | class diameterModel | ||
53 | { | ||
54 | protected: | ||
55 | |||
56 | // Protected data | ||
57 | |||
58 | const dictionary& dict_; | ||
59 | const phaseModel& phase_; | ||
60 | |||
61 | |||
62 | public: | ||
63 | |||
64 | //- Runtime type information | ||
65 | TypeName("diameterModel"); | ||
66 | |||
67 | |||
68 | // Declare runtime construction | ||
69 | |||
70 | declareRunTimeSelectionTable | ||
71 | ( | ||
72 | autoPtr, | ||
73 | diameterModel, | ||
74 | dictionary, | ||
75 | ( | ||
76 | const dictionary& dict, | ||
77 | const phaseModel& phase | ||
78 | ), | ||
79 | (dict, phase) | ||
80 | ); | ||
81 | |||
82 | |||
83 | // Constructors | ||
84 | |||
85 | diameterModel | ||
86 | ( | ||
87 | const dictionary& dict, | ||
88 | const phaseModel& phase | ||
89 | ); | ||
90 | |||
91 | |||
92 | //- Destructor | ||
93 | virtual ~diameterModel(); | ||
94 | |||
95 | |||
96 | // Selectors | ||
97 | |||
98 | static autoPtr<diameterModel> New | ||
99 | ( | ||
100 | const dictionary& dict, | ||
101 | const phaseModel& phase | ||
102 | ); | ||
103 | |||
104 | |||
105 | // Member Functions | ||
106 | |||
107 | //- Return the phase mean diameter field | ||
108 | virtual tmp<volScalarField> d() const = 0; | ||
109 | }; | ||
110 | |||
111 | |||
112 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
113 | |||
114 | } // End namespace Foam | ||
115 | |||
116 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
117 | |||
118 | #endif | ||
119 | |||
120 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/multiphaseSystem/diameterModels/diameterModel/newDiameterModel.C added (mode: 100644) (index 0000000..b58f002) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2011-2015 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 "diameterModel.H" | ||
27 | |||
28 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
29 | |||
30 | Foam::autoPtr<Foam::diameterModel> Foam::diameterModel::New | ||
31 | ( | ||
32 | const dictionary& dict, | ||
33 | const phaseModel& phase | ||
34 | ) | ||
35 | { | ||
36 | word diameterModelType | ||
37 | ( | ||
38 | dict.lookup("diameterModel") | ||
39 | ); | ||
40 | |||
41 | Info << "Selecting diameterModel for phase " | ||
42 | << phase.name() | ||
43 | << ": " | ||
44 | << diameterModelType << endl; | ||
45 | |||
46 | dictionaryConstructorTable::iterator cstrIter = | ||
47 | dictionaryConstructorTablePtr_->find(diameterModelType); | ||
48 | |||
49 | if (cstrIter == dictionaryConstructorTablePtr_->end()) | ||
50 | { | ||
51 | FatalErrorInFunction | ||
52 | << "Unknown diameterModelType type " | ||
53 | << diameterModelType << endl << endl | ||
54 | << "Valid diameterModel types are : " << endl | ||
55 | << dictionaryConstructorTablePtr_->sortedToc() | ||
56 | << exit(FatalError); | ||
57 | } | ||
58 | |||
59 | return cstrIter()(dict.subDict(diameterModelType + "Coeffs"), phase); | ||
60 | } | ||
61 | |||
62 | |||
63 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/multiphaseSystem/diameterModels/isothermalDiameter/isothermalDiameter.C added (mode: 100644) (index 0000000..3375f22) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2011-2015 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 "isothermalDiameter.H" | ||
27 | #include "addToRunTimeSelectionTable.H" | ||
28 | |||
29 | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // | ||
30 | |||
31 | namespace Foam | ||
32 | { | ||
33 | namespace diameterModels | ||
34 | { | ||
35 | defineTypeNameAndDebug(isothermal, 0); | ||
36 | |||
37 | addToRunTimeSelectionTable | ||
38 | ( | ||
39 | diameterModel, | ||
40 | isothermal, | ||
41 | dictionary | ||
42 | ); | ||
43 | } | ||
44 | } | ||
45 | |||
46 | |||
47 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | ||
48 | |||
49 | Foam::diameterModels::isothermal::isothermal | ||
50 | ( | ||
51 | const dictionary& dict, | ||
52 | const phaseModel& phase | ||
53 | ) | ||
54 | : | ||
55 | diameterModel(dict, phase), | ||
56 | d0_("d0", dimLength, dict), | ||
57 | p0_("p0", dimPressure, dict) | ||
58 | {} | ||
59 | |||
60 | |||
61 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | ||
62 | |||
63 | Foam::diameterModels::isothermal::~isothermal() | ||
64 | {} | ||
65 | |||
66 | |||
67 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | ||
68 | |||
69 | Foam::tmp<Foam::volScalarField> Foam::diameterModels::isothermal::d() const | ||
70 | { | ||
71 | const volScalarField& p = phase_.U().db().lookupObject<volScalarField> | ||
72 | ( | ||
73 | "p" | ||
74 | ); | ||
75 | |||
76 | return d0_*pow(p0_/p, 1.0/3.0); | ||
77 | } | ||
78 | |||
79 | |||
80 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/multiphaseSystem/diameterModels/isothermalDiameter/isothermalDiameter.H added (mode: 100644) (index 0000000..0d155ad) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2011-2013 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 | Class | ||
25 | Foam::isothermal | ||
26 | |||
27 | Description | ||
28 | Isothermal dispersed-phase particle diameter model. | ||
29 | |||
30 | SourceFiles | ||
31 | isothermal.C | ||
32 | |||
33 | \*---------------------------------------------------------------------------*/ | ||
34 | |||
35 | #ifndef isothermal_H | ||
36 | #define isothermal_H | ||
37 | |||
38 | #include "diameterModel.H" | ||
39 | |||
40 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
41 | |||
42 | namespace Foam | ||
43 | { | ||
44 | namespace diameterModels | ||
45 | { | ||
46 | |||
47 | /*---------------------------------------------------------------------------*\ | ||
48 | Class isothermal Declaration | ||
49 | \*---------------------------------------------------------------------------*/ | ||
50 | |||
51 | class isothermal | ||
52 | : | ||
53 | public diameterModel | ||
54 | { | ||
55 | // Private data | ||
56 | |||
57 | //- Reference diameter for the isothermal expansion | ||
58 | dimensionedScalar d0_; | ||
59 | |||
60 | //- Reference pressure for the isothermal expansion | ||
61 | dimensionedScalar p0_; | ||
62 | |||
63 | |||
64 | public: | ||
65 | |||
66 | //- Runtime type information | ||
67 | TypeName("isothermal"); | ||
68 | |||
69 | |||
70 | // Constructors | ||
71 | |||
72 | //- Construct from components | ||
73 | isothermal | ||
74 | ( | ||
75 | const dictionary& dict, | ||
76 | const phaseModel& phase | ||
77 | ); | ||
78 | |||
79 | |||
80 | //- Destructor | ||
81 | virtual ~isothermal(); | ||
82 | |||
83 | |||
84 | // Member Functions | ||
85 | |||
86 | tmp<volScalarField> d() const; | ||
87 | }; | ||
88 | |||
89 | |||
90 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
91 | |||
92 | } // End namespace diameterModels | ||
93 | } // End namespace Foam | ||
94 | |||
95 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
96 | |||
97 | #endif | ||
98 | |||
99 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/multiphaseSystem/multiphaseSystem.C added (mode: 100644) (index 0000000..be4def5) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2011-2016 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 "multiphaseSystem.H" | ||
27 | #include "alphaContactAngleFvPatchScalarField.H" | ||
28 | #include "fixedValueFvsPatchFields.H" | ||
29 | #include "Time.H" | ||
30 | #include "subCycle.H" | ||
31 | #include "MULES.H" | ||
32 | #include "surfaceInterpolate.H" | ||
33 | #include "fvcGrad.H" | ||
34 | #include "fvcSnGrad.H" | ||
35 | #include "fvcDiv.H" | ||
36 | #include "fvcFlux.H" | ||
37 | #include "fvcAverage.H" | ||
38 | |||
39 | // * * * * * * * * * * * * * * * Static Member Data * * * * * * * * * * * * // | ||
40 | |||
41 | const Foam::scalar Foam::multiphaseSystem::convertToRad = | ||
42 | Foam::constant::mathematical::pi/180.0; | ||
43 | |||
44 | |||
45 | // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // | ||
46 | |||
47 | void Foam::multiphaseSystem::calcAlphas() | ||
48 | { | ||
49 | scalar level = 0.0; | ||
50 | alphas_ == 0.0; | ||
51 | |||
52 | forAllIter(PtrDictionary<phaseModel>, phases_, iter) | ||
53 | { | ||
54 | alphas_ += level*iter(); | ||
55 | level += 1.0; | ||
56 | } | ||
57 | } | ||
58 | |||
59 | |||
60 | void Foam::multiphaseSystem::solveAlphas() | ||
61 | { | ||
62 | PtrList<surfaceScalarField> alphaPhiCorrs(phases_.size()); | ||
63 | int phasei = 0; | ||
64 | |||
65 | forAllIter(PtrDictionary<phaseModel>, phases_, iter) | ||
66 | { | ||
67 | phaseModel& phase1 = iter(); | ||
68 | volScalarField& alpha1 = phase1; | ||
69 | |||
70 | phase1.alphaPhi() = | ||
71 | dimensionedScalar("0", dimensionSet(0, 3, -1, 0, 0), 0); | ||
72 | |||
73 | alphaPhiCorrs.set | ||
74 | ( | ||
75 | phasei, | ||
76 | new surfaceScalarField | ||
77 | ( | ||
78 | "phi" + alpha1.name() + "Corr", | ||
79 | fvc::flux | ||
80 | ( | ||
81 | phi_, | ||
82 | phase1, | ||
83 | "div(phi," + alpha1.name() + ')' | ||
84 | ) | ||
85 | ) | ||
86 | ); | ||
87 | |||
88 | surfaceScalarField& alphaPhiCorr = alphaPhiCorrs[phasei]; | ||
89 | |||
90 | forAllIter(PtrDictionary<phaseModel>, phases_, iter2) | ||
91 | { | ||
92 | phaseModel& phase2 = iter2(); | ||
93 | volScalarField& alpha2 = phase2; | ||
94 | |||
95 | if (&phase2 == &phase1) continue; | ||
96 | |||
97 | surfaceScalarField phir(phase1.phi() - phase2.phi()); | ||
98 | |||
99 | scalarCoeffSymmTable::const_iterator cAlpha | ||
100 | ( | ||
101 | cAlphas_.find(interfacePair(phase1, phase2)) | ||
102 | ); | ||
103 | |||
104 | if (cAlpha != cAlphas_.end()) | ||
105 | { | ||
106 | surfaceScalarField phic | ||
107 | ( | ||
108 | (mag(phi_) + mag(phir))/mesh_.magSf() | ||
109 | ); | ||
110 | |||
111 | phir += min(cAlpha()*phic, max(phic))*nHatf(phase1, phase2); | ||
112 | } | ||
113 | |||
114 | word phirScheme | ||
115 | ( | ||
116 | "div(phir," + alpha2.name() + ',' + alpha1.name() + ')' | ||
117 | ); | ||
118 | |||
119 | alphaPhiCorr += fvc::flux | ||
120 | ( | ||
121 | -fvc::flux(-phir, phase2, phirScheme), | ||
122 | phase1, | ||
123 | phirScheme | ||
124 | ); | ||
125 | } | ||
126 | |||
127 | surfaceScalarField::Boundary& alphaPhiCorrBf = | ||
128 | alphaPhiCorr.boundaryFieldRef(); | ||
129 | |||
130 | // Ensure that the flux at inflow BCs is preserved | ||
131 | forAll(alphaPhiCorrBf, patchi) | ||
132 | { | ||
133 | fvsPatchScalarField& alphaPhiCorrp = alphaPhiCorrBf[patchi]; | ||
134 | |||
135 | if (!alphaPhiCorrp.coupled()) | ||
136 | { | ||
137 | const scalarField& phi1p = phase1.phi().boundaryField()[patchi]; | ||
138 | const scalarField& alpha1p = alpha1.boundaryField()[patchi]; | ||
139 | |||
140 | forAll(alphaPhiCorrp, facei) | ||
141 | { | ||
142 | if (phi1p[facei] < 0) | ||
143 | { | ||
144 | alphaPhiCorrp[facei] = alpha1p[facei]*phi1p[facei]; | ||
145 | } | ||
146 | } | ||
147 | } | ||
148 | } | ||
149 | |||
150 | MULES::limit | ||
151 | ( | ||
152 | 1.0/mesh_.time().deltaT().value(), | ||
153 | geometricOneField(), | ||
154 | phase1, | ||
155 | phi_, | ||
156 | alphaPhiCorr, | ||
157 | zeroField(), | ||
158 | zeroField(), | ||
159 | 1, | ||
160 | 0, | ||
161 | true | ||
162 | ); | ||
163 | |||
164 | phasei++; | ||
165 | } | ||
166 | |||
167 | MULES::limitSum(alphaPhiCorrs); | ||
168 | |||
169 | volScalarField sumAlpha | ||
170 | ( | ||
171 | IOobject | ||
172 | ( | ||
173 | "sumAlpha", | ||
174 | mesh_.time().timeName(), | ||
175 | mesh_ | ||
176 | ), | ||
177 | mesh_, | ||
178 | dimensionedScalar("sumAlpha", dimless, 0) | ||
179 | ); | ||
180 | |||
181 | phasei = 0; | ||
182 | |||
183 | forAllIter(PtrDictionary<phaseModel>, phases_, iter) | ||
184 | { | ||
185 | phaseModel& phase1 = iter(); | ||
186 | |||
187 | surfaceScalarField& alphaPhi = alphaPhiCorrs[phasei]; | ||
188 | alphaPhi += upwind<scalar>(mesh_, phi_).flux(phase1); | ||
189 | |||
190 | MULES::explicitSolve | ||
191 | ( | ||
192 | geometricOneField(), | ||
193 | phase1, | ||
194 | alphaPhi, | ||
195 | zeroField(), | ||
196 | zeroField() | ||
197 | ); | ||
198 | |||
199 | phase1.alphaPhi() += alphaPhi; | ||
200 | |||
201 | Info<< phase1.name() << " volume fraction, min, max = " | ||
202 | << phase1.weightedAverage(mesh_.V()).value() | ||
203 | << ' ' << min(phase1).value() | ||
204 | << ' ' << max(phase1).value() | ||
205 | << endl; | ||
206 | |||
207 | sumAlpha += phase1; | ||
208 | |||
209 | phasei++; | ||
210 | } | ||
211 | |||
212 | Info<< "Phase-sum volume fraction, min, max = " | ||
213 | << sumAlpha.weightedAverage(mesh_.V()).value() | ||
214 | << ' ' << min(sumAlpha).value() | ||
215 | << ' ' << max(sumAlpha).value() | ||
216 | << endl; | ||
217 | |||
218 | calcAlphas(); | ||
219 | } | ||
220 | |||
221 | |||
222 | Foam::tmp<Foam::surfaceVectorField> Foam::multiphaseSystem::nHatfv | ||
223 | ( | ||
224 | const volScalarField& alpha1, | ||
225 | const volScalarField& alpha2 | ||
226 | ) const | ||
227 | { | ||
228 | /* | ||
229 | // Cell gradient of alpha | ||
230 | volVectorField gradAlpha = | ||
231 | alpha2*fvc::grad(alpha1) - alpha1*fvc::grad(alpha2); | ||
232 | |||
233 | // Interpolated face-gradient of alpha | ||
234 | surfaceVectorField gradAlphaf = fvc::interpolate(gradAlpha); | ||
235 | */ | ||
236 | |||
237 | surfaceVectorField gradAlphaf | ||
238 | ( | ||
239 | fvc::interpolate(alpha2)*fvc::interpolate(fvc::grad(alpha1)) | ||
240 | - fvc::interpolate(alpha1)*fvc::interpolate(fvc::grad(alpha2)) | ||
241 | ); | ||
242 | |||
243 | // Face unit interface normal | ||
244 | return gradAlphaf/(mag(gradAlphaf) + deltaN_); | ||
245 | } | ||
246 | |||
247 | |||
248 | Foam::tmp<Foam::surfaceScalarField> Foam::multiphaseSystem::nHatf | ||
249 | ( | ||
250 | const volScalarField& alpha1, | ||
251 | const volScalarField& alpha2 | ||
252 | ) const | ||
253 | { | ||
254 | // Face unit interface normal flux | ||
255 | return nHatfv(alpha1, alpha2) & mesh_.Sf(); | ||
256 | } | ||
257 | |||
258 | |||
259 | // Correction for the boundary condition on the unit normal nHat on | ||
260 | // walls to produce the correct contact angle. | ||
261 | |||
262 | // The dynamic contact angle is calculated from the component of the | ||
263 | // velocity on the direction of the interface, parallel to the wall. | ||
264 | |||
265 | void Foam::multiphaseSystem::correctContactAngle | ||
266 | ( | ||
267 | const phaseModel& phase1, | ||
268 | const phaseModel& phase2, | ||
269 | surfaceVectorField::Boundary& nHatb | ||
270 | ) const | ||
271 | { | ||
272 | const volScalarField::Boundary& gbf | ||
273 | = phase1.boundaryField(); | ||
274 | |||
275 | const fvBoundaryMesh& boundary = mesh_.boundary(); | ||
276 | |||
277 | forAll(boundary, patchi) | ||
278 | { | ||
279 | if (isA<alphaContactAngleFvPatchScalarField>(gbf[patchi])) | ||
280 | { | ||
281 | const alphaContactAngleFvPatchScalarField& acap = | ||
282 | refCast<const alphaContactAngleFvPatchScalarField>(gbf[patchi]); | ||
283 | |||
284 | vectorField& nHatPatch = nHatb[patchi]; | ||
285 | |||
286 | vectorField AfHatPatch | ||
287 | ( | ||
288 | mesh_.Sf().boundaryField()[patchi] | ||
289 | /mesh_.magSf().boundaryField()[patchi] | ||
290 | ); | ||
291 | |||
292 | alphaContactAngleFvPatchScalarField::thetaPropsTable:: | ||
293 | const_iterator tp = | ||
294 | acap.thetaProps().find(interfacePair(phase1, phase2)); | ||
295 | |||
296 | if (tp == acap.thetaProps().end()) | ||
297 | { | ||
298 | FatalErrorInFunction | ||
299 | << "Cannot find interface " << interfacePair(phase1, phase2) | ||
300 | << "\n in table of theta properties for patch " | ||
301 | << acap.patch().name() | ||
302 | << exit(FatalError); | ||
303 | } | ||
304 | |||
305 | bool matched = (tp.key().first() == phase1.name()); | ||
306 | |||
307 | scalar theta0 = convertToRad*tp().theta0(matched); | ||
308 | scalarField theta(boundary[patchi].size(), theta0); | ||
309 | |||
310 | scalar uTheta = tp().uTheta(); | ||
311 | |||
312 | // Calculate the dynamic contact angle if required | ||
313 | if (uTheta > SMALL) | ||
314 | { | ||
315 | scalar thetaA = convertToRad*tp().thetaA(matched); | ||
316 | scalar thetaR = convertToRad*tp().thetaR(matched); | ||
317 | |||
318 | // Calculated the component of the velocity parallel to the wall | ||
319 | vectorField Uwall | ||
320 | ( | ||
321 | phase1.U().boundaryField()[patchi].patchInternalField() | ||
322 | - phase1.U().boundaryField()[patchi] | ||
323 | ); | ||
324 | Uwall -= (AfHatPatch & Uwall)*AfHatPatch; | ||
325 | |||
326 | // Find the direction of the interface parallel to the wall | ||
327 | vectorField nWall | ||
328 | ( | ||
329 | nHatPatch - (AfHatPatch & nHatPatch)*AfHatPatch | ||
330 | ); | ||
331 | |||
332 | // Normalise nWall | ||
333 | nWall /= (mag(nWall) + SMALL); | ||
334 | |||
335 | // Calculate Uwall resolved normal to the interface parallel to | ||
336 | // the interface | ||
337 | scalarField uwall(nWall & Uwall); | ||
338 | |||
339 | theta += (thetaA - thetaR)*tanh(uwall/uTheta); | ||
340 | } | ||
341 | |||
342 | |||
343 | // Reset nHatPatch to correspond to the contact angle | ||
344 | |||
345 | scalarField a12(nHatPatch & AfHatPatch); | ||
346 | |||
347 | scalarField b1(cos(theta)); | ||
348 | |||
349 | scalarField b2(nHatPatch.size()); | ||
350 | |||
351 | forAll(b2, facei) | ||
352 | { | ||
353 | b2[facei] = cos(acos(a12[facei]) - theta[facei]); | ||
354 | } | ||
355 | |||
356 | scalarField det(1.0 - a12*a12); | ||
357 | |||
358 | scalarField a((b1 - a12*b2)/det); | ||
359 | scalarField b((b2 - a12*b1)/det); | ||
360 | |||
361 | nHatPatch = a*AfHatPatch + b*nHatPatch; | ||
362 | |||
363 | nHatPatch /= (mag(nHatPatch) + deltaN_.value()); | ||
364 | } | ||
365 | } | ||
366 | } | ||
367 | |||
368 | |||
369 | Foam::tmp<Foam::volScalarField> Foam::multiphaseSystem::K | ||
370 | ( | ||
371 | const phaseModel& phase1, | ||
372 | const phaseModel& phase2 | ||
373 | ) const | ||
374 | { | ||
375 | tmp<surfaceVectorField> tnHatfv = nHatfv(phase1, phase2); | ||
376 | |||
377 | correctContactAngle(phase1, phase2, tnHatfv.ref().boundaryFieldRef()); | ||
378 | |||
379 | // Simple expression for curvature | ||
380 | return -fvc::div(tnHatfv & mesh_.Sf()); | ||
381 | } | ||
382 | |||
383 | |||
384 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | ||
385 | |||
386 | Foam::multiphaseSystem::multiphaseSystem | ||
387 | ( | ||
388 | const volVectorField& U, | ||
389 | const surfaceScalarField& phi | ||
390 | ) | ||
391 | : | ||
392 | IOdictionary | ||
393 | ( | ||
394 | IOobject | ||
395 | ( | ||
396 | "transportProperties", | ||
397 | U.time().constant(), | ||
398 | U.db(), | ||
399 | IOobject::MUST_READ_IF_MODIFIED, | ||
400 | IOobject::NO_WRITE | ||
401 | ) | ||
402 | ), | ||
403 | |||
404 | phases_(lookup("phases"), phaseModel::iNew(U.mesh())), | ||
405 | |||
406 | mesh_(U.mesh()), | ||
407 | phi_(phi), | ||
408 | |||
409 | alphas_ | ||
410 | ( | ||
411 | IOobject | ||
412 | ( | ||
413 | "alphas", | ||
414 | mesh_.time().timeName(), | ||
415 | mesh_, | ||
416 | IOobject::NO_READ, | ||
417 | IOobject::AUTO_WRITE | ||
418 | ), | ||
419 | mesh_, | ||
420 | dimensionedScalar("alphas", dimless, 0.0) | ||
421 | ), | ||
422 | |||
423 | sigmas_(lookup("sigmas")), | ||
424 | dimSigma_(1, 0, -2, 0, 0), | ||
425 | cAlphas_(lookup("interfaceCompression")), | ||
426 | Cvms_(lookup("virtualMass")), | ||
427 | deltaN_ | ||
428 | ( | ||
429 | "deltaN", | ||
430 | 1e-8/pow(average(mesh_.V()), 1.0/3.0) | ||
431 | ) | ||
432 | { | ||
433 | calcAlphas(); | ||
434 | alphas_.write(); | ||
435 | |||
436 | interfaceDictTable dragModelsDict(lookup("drag")); | ||
437 | |||
438 | forAllConstIter(interfaceDictTable, dragModelsDict, iter) | ||
439 | { | ||
440 | dragModels_.insert | ||
441 | ( | ||
442 | iter.key(), | ||
443 | dragModel::New | ||
444 | ( | ||
445 | iter(), | ||
446 | *phases_.lookup(iter.key().first()), | ||
447 | *phases_.lookup(iter.key().second()) | ||
448 | ).ptr() | ||
449 | ); | ||
450 | } | ||
451 | |||
452 | forAllConstIter(PtrDictionary<phaseModel>, phases_, iter1) | ||
453 | { | ||
454 | const phaseModel& phase1 = iter1(); | ||
455 | |||
456 | forAllConstIter(PtrDictionary<phaseModel>, phases_, iter2) | ||
457 | { | ||
458 | const phaseModel& phase2 = iter2(); | ||
459 | |||
460 | if (&phase2 != &phase1) | ||
461 | { | ||
462 | scalarCoeffSymmTable::const_iterator sigma | ||
463 | ( | ||
464 | sigmas_.find(interfacePair(phase1, phase2)) | ||
465 | ); | ||
466 | |||
467 | if (sigma != sigmas_.end()) | ||
468 | { | ||
469 | scalarCoeffSymmTable::const_iterator cAlpha | ||
470 | ( | ||
471 | cAlphas_.find(interfacePair(phase1, phase2)) | ||
472 | ); | ||
473 | |||
474 | if (cAlpha == cAlphas_.end()) | ||
475 | { | ||
476 | WarningInFunction | ||
477 | << "Compression coefficient not specified for " | ||
478 | "phase pair (" | ||
479 | << phase1.name() << ' ' << phase2.name() | ||
480 | << ") for which a surface tension " | ||
481 | "coefficient is specified" | ||
482 | << endl; | ||
483 | } | ||
484 | } | ||
485 | } | ||
486 | } | ||
487 | } | ||
488 | } | ||
489 | |||
490 | |||
491 | // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // | ||
492 | |||
493 | Foam::tmp<Foam::volScalarField> Foam::multiphaseSystem::rho() const | ||
494 | { | ||
495 | PtrDictionary<phaseModel>::const_iterator iter = phases_.begin(); | ||
496 | |||
497 | tmp<volScalarField> trho = iter()*iter().rho(); | ||
498 | volScalarField& rho = trho.ref(); | ||
499 | |||
500 | for (++iter; iter != phases_.end(); ++iter) | ||
501 | { | ||
502 | rho += iter()*iter().rho(); | ||
503 | } | ||
504 | |||
505 | return trho; | ||
506 | } | ||
507 | |||
508 | |||
509 | Foam::tmp<Foam::scalarField> | ||
510 | Foam::multiphaseSystem::rho(const label patchi) const | ||
511 | { | ||
512 | PtrDictionary<phaseModel>::const_iterator iter = phases_.begin(); | ||
513 | |||
514 | tmp<scalarField> trho = iter().boundaryField()[patchi]*iter().rho().value(); | ||
515 | scalarField& rho = trho.ref(); | ||
516 | |||
517 | for (++iter; iter != phases_.end(); ++iter) | ||
518 | { | ||
519 | rho += iter().boundaryField()[patchi]*iter().rho().value(); | ||
520 | } | ||
521 | |||
522 | return trho; | ||
523 | } | ||
524 | |||
525 | |||
526 | Foam::tmp<Foam::volScalarField> Foam::multiphaseSystem::nu() const | ||
527 | { | ||
528 | PtrDictionary<phaseModel>::const_iterator iter = phases_.begin(); | ||
529 | |||
530 | tmp<volScalarField> tmu = iter()*(iter().rho()*iter().nu()); | ||
531 | volScalarField& mu = tmu.ref(); | ||
532 | |||
533 | for (++iter; iter != phases_.end(); ++iter) | ||
534 | { | ||
535 | mu += iter()*(iter().rho()*iter().nu()); | ||
536 | } | ||
537 | |||
538 | return tmu/rho(); | ||
539 | } | ||
540 | |||
541 | |||
542 | Foam::tmp<Foam::scalarField> | ||
543 | Foam::multiphaseSystem::nu(const label patchi) const | ||
544 | { | ||
545 | PtrDictionary<phaseModel>::const_iterator iter = phases_.begin(); | ||
546 | |||
547 | tmp<scalarField> tmu = | ||
548 | iter().boundaryField()[patchi] | ||
549 | *(iter().rho().value()*iter().nu().value()); | ||
550 | scalarField& mu = tmu.ref(); | ||
551 | |||
552 | for (++iter; iter != phases_.end(); ++iter) | ||
553 | { | ||
554 | mu += | ||
555 | iter().boundaryField()[patchi] | ||
556 | *(iter().rho().value()*iter().nu().value()); | ||
557 | } | ||
558 | |||
559 | return tmu/rho(patchi); | ||
560 | } | ||
561 | |||
562 | |||
563 | Foam::tmp<Foam::volScalarField> Foam::multiphaseSystem::Cvm | ||
564 | ( | ||
565 | const phaseModel& phase | ||
566 | ) const | ||
567 | { | ||
568 | tmp<volScalarField> tCvm | ||
569 | ( | ||
570 | new volScalarField | ||
571 | ( | ||
572 | IOobject | ||
573 | ( | ||
574 | "Cvm", | ||
575 | mesh_.time().timeName(), | ||
576 | mesh_ | ||
577 | ), | ||
578 | mesh_, | ||
579 | dimensionedScalar | ||
580 | ( | ||
581 | "Cvm", | ||
582 | dimensionSet(1, -3, 0, 0, 0), | ||
583 | 0 | ||
584 | ) | ||
585 | ) | ||
586 | ); | ||
587 | |||
588 | forAllConstIter(PtrDictionary<phaseModel>, phases_, iter) | ||
589 | { | ||
590 | const phaseModel& phase2 = iter(); | ||
591 | |||
592 | if (&phase2 != &phase) | ||
593 | { | ||
594 | scalarCoeffTable::const_iterator Cvm | ||
595 | ( | ||
596 | Cvms_.find(interfacePair(phase, phase2)) | ||
597 | ); | ||
598 | |||
599 | if (Cvm != Cvms_.end()) | ||
600 | { | ||
601 | tCvm.ref() += Cvm()*phase2.rho()*phase2; | ||
602 | } | ||
603 | else | ||
604 | { | ||
605 | Cvm = Cvms_.find(interfacePair(phase2, phase)); | ||
606 | |||
607 | if (Cvm != Cvms_.end()) | ||
608 | { | ||
609 | tCvm.ref() += Cvm()*phase.rho()*phase2; | ||
610 | } | ||
611 | } | ||
612 | } | ||
613 | } | ||
614 | |||
615 | return tCvm; | ||
616 | } | ||
617 | |||
618 | |||
619 | Foam::tmp<Foam::volVectorField> Foam::multiphaseSystem::Svm | ||
620 | ( | ||
621 | const phaseModel& phase | ||
622 | ) const | ||
623 | { | ||
624 | tmp<volVectorField> tSvm | ||
625 | ( | ||
626 | new volVectorField | ||
627 | ( | ||
628 | IOobject | ||
629 | ( | ||
630 | "Svm", | ||
631 | mesh_.time().timeName(), | ||
632 | mesh_ | ||
633 | ), | ||
634 | mesh_, | ||
635 | dimensionedVector | ||
636 | ( | ||
637 | "Svm", | ||
638 | dimensionSet(1, -2, -2, 0, 0), | ||
639 | Zero | ||
640 | ) | ||
641 | ) | ||
642 | ); | ||
643 | |||
644 | forAllConstIter(PtrDictionary<phaseModel>, phases_, iter) | ||
645 | { | ||
646 | const phaseModel& phase2 = iter(); | ||
647 | |||
648 | if (&phase2 != &phase) | ||
649 | { | ||
650 | scalarCoeffTable::const_iterator Cvm | ||
651 | ( | ||
652 | Cvms_.find(interfacePair(phase, phase2)) | ||
653 | ); | ||
654 | |||
655 | if (Cvm != Cvms_.end()) | ||
656 | { | ||
657 | tSvm.ref() += Cvm()*phase2.rho()*phase2*phase2.DDtU(); | ||
658 | } | ||
659 | else | ||
660 | { | ||
661 | Cvm = Cvms_.find(interfacePair(phase2, phase)); | ||
662 | |||
663 | if (Cvm != Cvms_.end()) | ||
664 | { | ||
665 | tSvm.ref() += Cvm()*phase.rho()*phase2*phase2.DDtU(); | ||
666 | } | ||
667 | } | ||
668 | } | ||
669 | } | ||
670 | |||
671 | volVectorField::Boundary& SvmBf = | ||
672 | tSvm.ref().boundaryFieldRef(); | ||
673 | |||
674 | // Remove virtual mass at fixed-flux boundaries | ||
675 | forAll(phase.phi().boundaryField(), patchi) | ||
676 | { | ||
677 | if | ||
678 | ( | ||
679 | isA<fixedValueFvsPatchScalarField> | ||
680 | ( | ||
681 | phase.phi().boundaryField()[patchi] | ||
682 | ) | ||
683 | ) | ||
684 | { | ||
685 | SvmBf[patchi] = Zero; | ||
686 | } | ||
687 | } | ||
688 | |||
689 | return tSvm; | ||
690 | } | ||
691 | |||
692 | |||
693 | Foam::autoPtr<Foam::multiphaseSystem::dragCoeffFields> | ||
694 | Foam::multiphaseSystem::dragCoeffs() const | ||
695 | { | ||
696 | autoPtr<dragCoeffFields> dragCoeffsPtr(new dragCoeffFields); | ||
697 | |||
698 | forAllConstIter(dragModelTable, dragModels_, iter) | ||
699 | { | ||
700 | const dragModel& dm = *iter(); | ||
701 | |||
702 | volScalarField* Kptr = | ||
703 | ( | ||
704 | max | ||
705 | ( | ||
706 | //fvc::average(dm.phase1()*dm.phase2()), | ||
707 | //fvc::average(dm.phase1())*fvc::average(dm.phase2()), | ||
708 | dm.phase1()*dm.phase2(), | ||
709 | dm.residualPhaseFraction() | ||
710 | ) | ||
711 | *dm.K | ||
712 | ( | ||
713 | max | ||
714 | ( | ||
715 | mag(dm.phase1().U() - dm.phase2().U()), | ||
716 | dm.residualSlip() | ||
717 | ) | ||
718 | ) | ||
719 | ).ptr(); | ||
720 | |||
721 | volScalarField::Boundary& Kbf = Kptr->boundaryFieldRef(); | ||
722 | |||
723 | // Remove drag at fixed-flux boundaries | ||
724 | forAll(dm.phase1().phi().boundaryField(), patchi) | ||
725 | { | ||
726 | if | ||
727 | ( | ||
728 | isA<fixedValueFvsPatchScalarField> | ||
729 | ( | ||
730 | dm.phase1().phi().boundaryField()[patchi] | ||
731 | ) | ||
732 | ) | ||
733 | { | ||
734 | Kbf[patchi] = 0.0; | ||
735 | } | ||
736 | } | ||
737 | |||
738 | dragCoeffsPtr().insert(iter.key(), Kptr); | ||
739 | } | ||
740 | |||
741 | return dragCoeffsPtr; | ||
742 | } | ||
743 | |||
744 | |||
745 | Foam::tmp<Foam::volScalarField> Foam::multiphaseSystem::dragCoeff | ||
746 | ( | ||
747 | const phaseModel& phase, | ||
748 | const dragCoeffFields& dragCoeffs | ||
749 | ) const | ||
750 | { | ||
751 | tmp<volScalarField> tdragCoeff | ||
752 | ( | ||
753 | new volScalarField | ||
754 | ( | ||
755 | IOobject | ||
756 | ( | ||
757 | "dragCoeff", | ||
758 | mesh_.time().timeName(), | ||
759 | mesh_ | ||
760 | ), | ||
761 | mesh_, | ||
762 | dimensionedScalar | ||
763 | ( | ||
764 | "dragCoeff", | ||
765 | dimensionSet(1, -3, -1, 0, 0), | ||
766 | 0 | ||
767 | ) | ||
768 | ) | ||
769 | ); | ||
770 | |||
771 | dragModelTable::const_iterator dmIter = dragModels_.begin(); | ||
772 | dragCoeffFields::const_iterator dcIter = dragCoeffs.begin(); | ||
773 | for | ||
774 | ( | ||
775 | ; | ||
776 | dmIter != dragModels_.end() && dcIter != dragCoeffs.end(); | ||
777 | ++dmIter, ++dcIter | ||
778 | ) | ||
779 | { | ||
780 | if | ||
781 | ( | ||
782 | &phase == &dmIter()->phase1() | ||
783 | || &phase == &dmIter()->phase2() | ||
784 | ) | ||
785 | { | ||
786 | tdragCoeff.ref() += *dcIter(); | ||
787 | } | ||
788 | } | ||
789 | |||
790 | return tdragCoeff; | ||
791 | } | ||
792 | |||
793 | |||
794 | Foam::tmp<Foam::surfaceScalarField> Foam::multiphaseSystem::surfaceTension | ||
795 | ( | ||
796 | const phaseModel& phase1 | ||
797 | ) const | ||
798 | { | ||
799 | tmp<surfaceScalarField> tSurfaceTension | ||
800 | ( | ||
801 | new surfaceScalarField | ||
802 | ( | ||
803 | IOobject | ||
804 | ( | ||
805 | "surfaceTension", | ||
806 | mesh_.time().timeName(), | ||
807 | mesh_ | ||
808 | ), | ||
809 | mesh_, | ||
810 | dimensionedScalar | ||
811 | ( | ||
812 | "surfaceTension", | ||
813 | dimensionSet(1, -2, -2, 0, 0), | ||
814 | 0 | ||
815 | ) | ||
816 | ) | ||
817 | ); | ||
818 | |||
819 | forAllConstIter(PtrDictionary<phaseModel>, phases_, iter) | ||
820 | { | ||
821 | const phaseModel& phase2 = iter(); | ||
822 | |||
823 | if (&phase2 != &phase1) | ||
824 | { | ||
825 | scalarCoeffSymmTable::const_iterator sigma | ||
826 | ( | ||
827 | sigmas_.find(interfacePair(phase1, phase2)) | ||
828 | ); | ||
829 | |||
830 | if (sigma != sigmas_.end()) | ||
831 | { | ||
832 | tSurfaceTension.ref() += | ||
833 | dimensionedScalar("sigma", dimSigma_, sigma()) | ||
834 | *fvc::interpolate(K(phase1, phase2))* | ||
835 | ( | ||
836 | fvc::interpolate(phase2)*fvc::snGrad(phase1) | ||
837 | - fvc::interpolate(phase1)*fvc::snGrad(phase2) | ||
838 | ); | ||
839 | } | ||
840 | } | ||
841 | } | ||
842 | |||
843 | return tSurfaceTension; | ||
844 | } | ||
845 | |||
846 | |||
847 | Foam::tmp<Foam::volScalarField> | ||
848 | Foam::multiphaseSystem::nearInterface() const | ||
849 | { | ||
850 | tmp<volScalarField> tnearInt | ||
851 | ( | ||
852 | new volScalarField | ||
853 | ( | ||
854 | IOobject | ||
855 | ( | ||
856 | "nearInterface", | ||
857 | mesh_.time().timeName(), | ||
858 | mesh_ | ||
859 | ), | ||
860 | mesh_, | ||
861 | dimensionedScalar("nearInterface", dimless, 0.0) | ||
862 | ) | ||
863 | ); | ||
864 | |||
865 | forAllConstIter(PtrDictionary<phaseModel>, phases_, iter) | ||
866 | { | ||
867 | tnearInt.ref() = max(tnearInt(), pos(iter() - 0.01)*pos(0.99 - iter())); | ||
868 | } | ||
869 | |||
870 | return tnearInt; | ||
871 | } | ||
872 | |||
873 | |||
874 | void Foam::multiphaseSystem::solve() | ||
875 | { | ||
876 | forAllIter(PtrDictionary<phaseModel>, phases_, iter) | ||
877 | { | ||
878 | iter().correct(); | ||
879 | } | ||
880 | |||
881 | const Time& runTime = mesh_.time(); | ||
882 | |||
883 | const dictionary& alphaControls = mesh_.solverDict("alpha"); | ||
884 | label nAlphaSubCycles(readLabel(alphaControls.lookup("nAlphaSubCycles"))); | ||
885 | |||
886 | if (nAlphaSubCycles > 1) | ||
887 | { | ||
888 | dimensionedScalar totalDeltaT = runTime.deltaT(); | ||
889 | |||
890 | PtrList<volScalarField> alpha0s(phases_.size()); | ||
891 | PtrList<surfaceScalarField> alphaPhiSums(phases_.size()); | ||
892 | |||
893 | int phasei = 0; | ||
894 | forAllIter(PtrDictionary<phaseModel>, phases_, iter) | ||
895 | { | ||
896 | phaseModel& phase = iter(); | ||
897 | volScalarField& alpha = phase; | ||
898 | |||
899 | alpha0s.set | ||
900 | ( | ||
901 | phasei, | ||
902 | new volScalarField(alpha.oldTime()) | ||
903 | ); | ||
904 | |||
905 | alphaPhiSums.set | ||
906 | ( | ||
907 | phasei, | ||
908 | new surfaceScalarField | ||
909 | ( | ||
910 | IOobject | ||
911 | ( | ||
912 | "phiSum" + alpha.name(), | ||
913 | runTime.timeName(), | ||
914 | mesh_ | ||
915 | ), | ||
916 | mesh_, | ||
917 | dimensionedScalar("0", dimensionSet(0, 3, -1, 0, 0), 0) | ||
918 | ) | ||
919 | ); | ||
920 | |||
921 | phasei++; | ||
922 | } | ||
923 | |||
924 | for | ||
925 | ( | ||
926 | subCycleTime alphaSubCycle | ||
927 | ( | ||
928 | const_cast<Time&>(runTime), | ||
929 | nAlphaSubCycles | ||
930 | ); | ||
931 | !(++alphaSubCycle).end(); | ||
932 | ) | ||
933 | { | ||
934 | solveAlphas(); | ||
935 | |||
936 | int phasei = 0; | ||
937 | forAllIter(PtrDictionary<phaseModel>, phases_, iter) | ||
938 | { | ||
939 | alphaPhiSums[phasei] += iter().alphaPhi()/nAlphaSubCycles; | ||
940 | phasei++; | ||
941 | } | ||
942 | } | ||
943 | |||
944 | phasei = 0; | ||
945 | forAllIter(PtrDictionary<phaseModel>, phases_, iter) | ||
946 | { | ||
947 | phaseModel& phase = iter(); | ||
948 | volScalarField& alpha = phase; | ||
949 | |||
950 | phase.alphaPhi() = alphaPhiSums[phasei]; | ||
951 | |||
952 | // Correct the time index of the field | ||
953 | // to correspond to the global time | ||
954 | alpha.timeIndex() = runTime.timeIndex(); | ||
955 | |||
956 | // Reset the old-time field value | ||
957 | alpha.oldTime() = alpha0s[phasei]; | ||
958 | alpha.oldTime().timeIndex() = runTime.timeIndex(); | ||
959 | |||
960 | phasei++; | ||
961 | } | ||
962 | } | ||
963 | else | ||
964 | { | ||
965 | solveAlphas(); | ||
966 | } | ||
967 | } | ||
968 | |||
969 | |||
970 | bool Foam::multiphaseSystem::read() | ||
971 | { | ||
972 | if (regIOobject::read()) | ||
973 | { | ||
974 | bool readOK = true; | ||
975 | |||
976 | PtrList<entry> phaseData(lookup("phases")); | ||
977 | label phasei = 0; | ||
978 | |||
979 | forAllIter(PtrDictionary<phaseModel>, phases_, iter) | ||
980 | { | ||
981 | readOK &= iter().read(phaseData[phasei++].dict()); | ||
982 | } | ||
983 | |||
984 | lookup("sigmas") >> sigmas_; | ||
985 | lookup("interfaceCompression") >> cAlphas_; | ||
986 | lookup("virtualMass") >> Cvms_; | ||
987 | |||
988 | return readOK; | ||
989 | } | ||
990 | else | ||
991 | { | ||
992 | return false; | ||
993 | } | ||
994 | } | ||
995 | |||
996 | |||
997 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/multiphaseSystem/multiphaseSystem.H added (mode: 100644) (index 0000000..02b5668) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2011-2016 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 | Class | ||
25 | Foam::multiphaseSystem | ||
26 | |||
27 | Description | ||
28 | Incompressible multi-phase mixture with built in solution for the | ||
29 | phase fractions with interface compression for interface-capturing. | ||
30 | |||
31 | Derived from transportModel so that it can be unsed in conjunction with | ||
32 | the incompressible turbulence models. | ||
33 | |||
34 | Surface tension and contact-angle is handled for the interface | ||
35 | between each phase-pair. | ||
36 | |||
37 | SourceFiles | ||
38 | multiphaseSystem.C | ||
39 | |||
40 | \*---------------------------------------------------------------------------*/ | ||
41 | |||
42 | #ifndef multiphaseSystem_H | ||
43 | #define multiphaseSystem_H | ||
44 | |||
45 | #include "incompressible/transportModel/transportModel.H" | ||
46 | #include "IOdictionary.H" | ||
47 | #include "phaseModel.H" | ||
48 | #include "PtrDictionary.H" | ||
49 | #include "volFields.H" | ||
50 | #include "surfaceFields.H" | ||
51 | #include "dragModel.H" | ||
52 | #include "HashPtrTable.H" | ||
53 | |||
54 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
55 | |||
56 | namespace Foam | ||
57 | { | ||
58 | |||
59 | /*---------------------------------------------------------------------------*\ | ||
60 | Class multiphaseSystem Declaration | ||
61 | \*---------------------------------------------------------------------------*/ | ||
62 | |||
63 | class multiphaseSystem | ||
64 | : | ||
65 | public IOdictionary, | ||
66 | public transportModel | ||
67 | { | ||
68 | |||
69 | public: | ||
70 | |||
71 | class interfacePair | ||
72 | : | ||
73 | public Pair<word> | ||
74 | { | ||
75 | public: | ||
76 | |||
77 | class symmHash | ||
78 | : | ||
79 | public Hash<interfacePair> | ||
80 | { | ||
81 | public: | ||
82 | |||
83 | symmHash() | ||
84 | {} | ||
85 | |||
86 | label operator()(const interfacePair& key) const | ||
87 | { | ||
88 | return word::hash()(key.first()) + word::hash()(key.second()); | ||
89 | } | ||
90 | }; | ||
91 | |||
92 | class hash | ||
93 | : | ||
94 | public Hash<interfacePair> | ||
95 | { | ||
96 | public: | ||
97 | |||
98 | hash() | ||
99 | {} | ||
100 | |||
101 | label operator()(const interfacePair& key) const | ||
102 | { | ||
103 | return word::hash()(key.first(), word::hash()(key.second())); | ||
104 | } | ||
105 | }; | ||
106 | |||
107 | |||
108 | // Constructors | ||
109 | |||
110 | interfacePair() | ||
111 | {} | ||
112 | |||
113 | interfacePair(const word& alpha1Name, const word& alpha2Name) | ||
114 | : | ||
115 | Pair<word>(alpha1Name, alpha2Name) | ||
116 | {} | ||
117 | |||
118 | interfacePair(const phaseModel& alpha1, const phaseModel& alpha2) | ||
119 | : | ||
120 | Pair<word>(alpha1.name(), alpha2.name()) | ||
121 | {} | ||
122 | |||
123 | |||
124 | // Friend Operators | ||
125 | |||
126 | friend bool operator== | ||
127 | ( | ||
128 | const interfacePair& a, | ||
129 | const interfacePair& b | ||
130 | ) | ||
131 | { | ||
132 | return | ||
133 | ( | ||
134 | ((a.first() == b.first()) && (a.second() == b.second())) | ||
135 | || ((a.first() == b.second()) && (a.second() == b.first())) | ||
136 | ); | ||
137 | } | ||
138 | |||
139 | friend bool operator!= | ||
140 | ( | ||
141 | const interfacePair& a, | ||
142 | const interfacePair& b | ||
143 | ) | ||
144 | { | ||
145 | return (!(a == b)); | ||
146 | } | ||
147 | }; | ||
148 | |||
149 | |||
150 | typedef HashPtrTable<dragModel, interfacePair, interfacePair::symmHash> | ||
151 | dragModelTable; | ||
152 | |||
153 | typedef HashPtrTable<volScalarField, interfacePair, interfacePair::symmHash> | ||
154 | dragCoeffFields; | ||
155 | |||
156 | |||
157 | private: | ||
158 | |||
159 | // Private data | ||
160 | |||
161 | //- Dictionary of phases | ||
162 | PtrDictionary<phaseModel> phases_; | ||
163 | |||
164 | const fvMesh& mesh_; | ||
165 | const surfaceScalarField& phi_; | ||
166 | |||
167 | volScalarField alphas_; | ||
168 | |||
169 | typedef HashTable<scalar, interfacePair, interfacePair::symmHash> | ||
170 | scalarCoeffSymmTable; | ||
171 | |||
172 | typedef HashTable<scalar, interfacePair, interfacePair::hash> | ||
173 | scalarCoeffTable; | ||
174 | |||
175 | scalarCoeffSymmTable sigmas_; | ||
176 | dimensionSet dimSigma_; | ||
177 | |||
178 | scalarCoeffSymmTable cAlphas_; | ||
179 | |||
180 | scalarCoeffTable Cvms_; | ||
181 | |||
182 | typedef HashTable<dictionary, interfacePair, interfacePair::symmHash> | ||
183 | interfaceDictTable; | ||
184 | |||
185 | dragModelTable dragModels_; | ||
186 | |||
187 | //- Stabilisation for normalisation of the interface normal | ||
188 | const dimensionedScalar deltaN_; | ||
189 | |||
190 | //- Conversion factor for degrees into radians | ||
191 | static const scalar convertToRad; | ||
192 | |||
193 | |||
194 | // Private member functions | ||
195 | |||
196 | void calcAlphas(); | ||
197 | |||
198 | void solveAlphas(); | ||
199 | |||
200 | tmp<surfaceVectorField> nHatfv | ||
201 | ( | ||
202 | const volScalarField& alpha1, | ||
203 | const volScalarField& alpha2 | ||
204 | ) const; | ||
205 | |||
206 | tmp<surfaceScalarField> nHatf | ||
207 | ( | ||
208 | const volScalarField& alpha1, | ||
209 | const volScalarField& alpha2 | ||
210 | ) const; | ||
211 | |||
212 | void correctContactAngle | ||
213 | ( | ||
214 | const phaseModel& alpha1, | ||
215 | const phaseModel& alpha2, | ||
216 | surfaceVectorField::Boundary& nHatb | ||
217 | ) const; | ||
218 | |||
219 | tmp<volScalarField> K | ||
220 | ( | ||
221 | const phaseModel& alpha1, | ||
222 | const phaseModel& alpha2 | ||
223 | ) const; | ||
224 | |||
225 | |||
226 | public: | ||
227 | |||
228 | // Constructors | ||
229 | |||
230 | //- Construct from components | ||
231 | multiphaseSystem | ||
232 | ( | ||
233 | const volVectorField& U, | ||
234 | const surfaceScalarField& phi | ||
235 | ); | ||
236 | |||
237 | |||
238 | //- Destructor | ||
239 | virtual ~multiphaseSystem() | ||
240 | {} | ||
241 | |||
242 | |||
243 | // Member Functions | ||
244 | |||
245 | //- Return the phases | ||
246 | const PtrDictionary<phaseModel>& phases() const | ||
247 | { | ||
248 | return phases_; | ||
249 | } | ||
250 | |||
251 | //- Return the phases | ||
252 | PtrDictionary<phaseModel>& phases() | ||
253 | { | ||
254 | return phases_; | ||
255 | } | ||
256 | |||
257 | //- Return the mixture density | ||
258 | tmp<volScalarField> rho() const; | ||
259 | |||
260 | //- Return the mixture density for patch | ||
261 | tmp<scalarField> rho(const label patchi) const; | ||
262 | |||
263 | //- Return the mixture laminar viscosity | ||
264 | tmp<volScalarField> nu() const; | ||
265 | |||
266 | //- Return the laminar viscosity for patch | ||
267 | tmp<scalarField> nu(const label patchi) const; | ||
268 | |||
269 | //- Return the virtual-mass coefficient for the given phase | ||
270 | tmp<volScalarField> Cvm(const phaseModel& phase) const; | ||
271 | |||
272 | //- Return the virtual-mass source for the given phase | ||
273 | tmp<volVectorField> Svm(const phaseModel& phase) const; | ||
274 | |||
275 | //- Return the table of drag models | ||
276 | const dragModelTable& dragModels() const | ||
277 | { | ||
278 | return dragModels_; | ||
279 | } | ||
280 | |||
281 | //- Return the drag coefficients for all of the interfaces | ||
282 | autoPtr<dragCoeffFields> dragCoeffs() const; | ||
283 | |||
284 | //- Return the sum of the drag coefficients for the given phase | ||
285 | tmp<volScalarField> dragCoeff | ||
286 | ( | ||
287 | const phaseModel& phase, | ||
288 | const dragCoeffFields& dragCoeffs | ||
289 | ) const; | ||
290 | |||
291 | tmp<surfaceScalarField> surfaceTension(const phaseModel& phase) const; | ||
292 | |||
293 | //- Indicator of the proximity of the interface | ||
294 | // Field values are 1 near and 0 away for the interface. | ||
295 | tmp<volScalarField> nearInterface() const; | ||
296 | |||
297 | //- Solve for the mixture phase-fractions | ||
298 | void solve(); | ||
299 | |||
300 | //- Dummy correct | ||
301 | void correct() | ||
302 | {} | ||
303 | |||
304 | //- Read base transportProperties dictionary | ||
305 | bool read(); | ||
306 | }; | ||
307 | |||
308 | |||
309 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
310 | |||
311 | } // End namespace Foam | ||
312 | |||
313 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
314 | |||
315 | #endif | ||
316 | |||
317 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/multiphaseSystem/phaseModel/phaseModel.C added (mode: 100644) (index 0000000..7929a9d) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2011-2016 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 "phaseModel.H" | ||
27 | #include "diameterModel.H" | ||
28 | #include "fixedValueFvPatchFields.H" | ||
29 | #include "slipFvPatchFields.H" | ||
30 | #include "partialSlipFvPatchFields.H" | ||
31 | #include "surfaceInterpolate.H" | ||
32 | #include "fvcFlux.H" | ||
33 | |||
34 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | ||
35 | |||
36 | Foam::phaseModel::phaseModel | ||
37 | ( | ||
38 | const word& phaseName, | ||
39 | const dictionary& phaseDict, | ||
40 | const fvMesh& mesh | ||
41 | ) | ||
42 | : | ||
43 | volScalarField | ||
44 | ( | ||
45 | IOobject | ||
46 | ( | ||
47 | IOobject::groupName("alpha", phaseName), | ||
48 | mesh.time().timeName(), | ||
49 | mesh, | ||
50 | IOobject::MUST_READ, | ||
51 | IOobject::AUTO_WRITE | ||
52 | ), | ||
53 | mesh | ||
54 | ), | ||
55 | name_(phaseName), | ||
56 | phaseDict_(phaseDict), | ||
57 | nu_ | ||
58 | ( | ||
59 | "nu", | ||
60 | dimensionSet(0, 2, -1, 0, 0), | ||
61 | phaseDict_ | ||
62 | ), | ||
63 | kappa_ | ||
64 | ( | ||
65 | "kappa", | ||
66 | dimensionSet(1, 1, -3, -1, 0), | ||
67 | phaseDict_ | ||
68 | ), | ||
69 | Cp_ | ||
70 | ( | ||
71 | "Cp", | ||
72 | dimensionSet(0, 2, -2, -1, 0), | ||
73 | phaseDict_ | ||
74 | ), | ||
75 | rho_ | ||
76 | ( | ||
77 | "rho", | ||
78 | dimDensity, | ||
79 | phaseDict_ | ||
80 | ), | ||
81 | U_ | ||
82 | ( | ||
83 | IOobject | ||
84 | ( | ||
85 | IOobject::groupName("U", phaseName), | ||
86 | mesh.time().timeName(), | ||
87 | mesh, | ||
88 | IOobject::MUST_READ, | ||
89 | IOobject::AUTO_WRITE | ||
90 | ), | ||
91 | mesh | ||
92 | ), | ||
93 | DDtU_ | ||
94 | ( | ||
95 | IOobject | ||
96 | ( | ||
97 | IOobject::groupName("DDtU", phaseName), | ||
98 | mesh.time().timeName(), | ||
99 | mesh | ||
100 | ), | ||
101 | mesh, | ||
102 | dimensionedVector("0", dimVelocity/dimTime, Zero) | ||
103 | ), | ||
104 | alphaPhi_ | ||
105 | ( | ||
106 | IOobject | ||
107 | ( | ||
108 | IOobject::groupName("alphaPhi", phaseName), | ||
109 | mesh.time().timeName(), | ||
110 | mesh | ||
111 | ), | ||
112 | mesh, | ||
113 | dimensionedScalar("0", dimensionSet(0, 3, -1, 0, 0), 0) | ||
114 | ) | ||
115 | { | ||
116 | const word phiName = IOobject::groupName("phi", name_); | ||
117 | |||
118 | IOobject phiHeader | ||
119 | ( | ||
120 | phiName, | ||
121 | mesh.time().timeName(), | ||
122 | mesh, | ||
123 | IOobject::NO_READ | ||
124 | ); | ||
125 | |||
126 | if (phiHeader.headerOk()) | ||
127 | { | ||
128 | Info<< "Reading face flux field " << phiName << endl; | ||
129 | |||
130 | phiPtr_.reset | ||
131 | ( | ||
132 | new surfaceScalarField | ||
133 | ( | ||
134 | IOobject | ||
135 | ( | ||
136 | phiName, | ||
137 | mesh.time().timeName(), | ||
138 | mesh, | ||
139 | IOobject::MUST_READ, | ||
140 | IOobject::AUTO_WRITE | ||
141 | ), | ||
142 | mesh | ||
143 | ) | ||
144 | ); | ||
145 | } | ||
146 | else | ||
147 | { | ||
148 | Info<< "Calculating face flux field " << phiName << endl; | ||
149 | |||
150 | wordList phiTypes | ||
151 | ( | ||
152 | U_.boundaryField().size(), | ||
153 | calculatedFvPatchScalarField::typeName | ||
154 | ); | ||
155 | |||
156 | forAll(U_.boundaryField(), i) | ||
157 | { | ||
158 | if | ||
159 | ( | ||
160 | isA<fixedValueFvPatchVectorField>(U_.boundaryField()[i]) | ||
161 | || isA<slipFvPatchVectorField>(U_.boundaryField()[i]) | ||
162 | || isA<partialSlipFvPatchVectorField>(U_.boundaryField()[i]) | ||
163 | ) | ||
164 | { | ||
165 | phiTypes[i] = fixedValueFvPatchScalarField::typeName; | ||
166 | } | ||
167 | } | ||
168 | |||
169 | phiPtr_.reset | ||
170 | ( | ||
171 | new surfaceScalarField | ||
172 | ( | ||
173 | IOobject | ||
174 | ( | ||
175 | phiName, | ||
176 | mesh.time().timeName(), | ||
177 | mesh, | ||
178 | IOobject::NO_READ, | ||
179 | IOobject::AUTO_WRITE | ||
180 | ), | ||
181 | fvc::flux(U_), | ||
182 | phiTypes | ||
183 | ) | ||
184 | ); | ||
185 | } | ||
186 | |||
187 | dPtr_ = diameterModel::New | ||
188 | ( | ||
189 | phaseDict_, | ||
190 | *this | ||
191 | ); | ||
192 | } | ||
193 | |||
194 | |||
195 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | ||
196 | |||
197 | Foam::phaseModel::~phaseModel() | ||
198 | {} | ||
199 | |||
200 | |||
201 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | ||
202 | |||
203 | Foam::autoPtr<Foam::phaseModel> Foam::phaseModel::clone() const | ||
204 | { | ||
205 | NotImplemented; | ||
206 | return autoPtr<phaseModel>(NULL); | ||
207 | } | ||
208 | |||
209 | |||
210 | |||
211 | void Foam::phaseModel::correct() | ||
212 | { | ||
213 | //nuModel_->correct(); | ||
214 | } | ||
215 | |||
216 | |||
217 | bool Foam::phaseModel::read(const dictionary& phaseDict) | ||
218 | { | ||
219 | phaseDict_ = phaseDict; | ||
220 | |||
221 | //if (nuModel_->read(phaseDict_)) | ||
222 | { | ||
223 | phaseDict_.lookup("nu") >> nu_.value(); | ||
224 | phaseDict_.lookup("kappa") >> kappa_.value(); | ||
225 | phaseDict_.lookup("Cp") >> Cp_.value(); | ||
226 | phaseDict_.lookup("rho") >> rho_.value(); | ||
227 | |||
228 | return true; | ||
229 | } | ||
230 | // else | ||
231 | // { | ||
232 | // return false; | ||
233 | // } | ||
234 | |||
235 | return true; | ||
236 | } | ||
237 | |||
238 | |||
239 | Foam::tmp<Foam::volScalarField> Foam::phaseModel::d() const | ||
240 | { | ||
241 | return dPtr_().d(); | ||
242 | } | ||
243 | |||
244 | |||
245 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/multiphaseSystem/phaseModel/phaseModel.H added (mode: 100644) (index 0000000..d1f1157) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2011-2015 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 | Class | ||
25 | Foam::phaseModel | ||
26 | |||
27 | SourceFiles | ||
28 | phaseModel.C | ||
29 | |||
30 | \*---------------------------------------------------------------------------*/ | ||
31 | |||
32 | #ifndef phaseModel_H | ||
33 | #define phaseModel_H | ||
34 | |||
35 | #include "dictionary.H" | ||
36 | #include "dictionaryEntry.H" | ||
37 | #include "dimensionedScalar.H" | ||
38 | #include "volFields.H" | ||
39 | #include "surfaceFields.H" | ||
40 | |||
41 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
42 | |||
43 | namespace Foam | ||
44 | { | ||
45 | |||
46 | // Forward declarations | ||
47 | class diameterModel; | ||
48 | |||
49 | /*---------------------------------------------------------------------------*\ | ||
50 | Class phaseModel Declaration | ||
51 | \*---------------------------------------------------------------------------*/ | ||
52 | |||
53 | class phaseModel | ||
54 | : | ||
55 | public volScalarField | ||
56 | { | ||
57 | // Private data | ||
58 | |||
59 | //- Name of phase | ||
60 | word name_; | ||
61 | |||
62 | dictionary phaseDict_; | ||
63 | |||
64 | //- Kinematic viscosity | ||
65 | dimensionedScalar nu_; | ||
66 | |||
67 | //- Thermal conductivity | ||
68 | dimensionedScalar kappa_; | ||
69 | |||
70 | //- Heat capacity | ||
71 | dimensionedScalar Cp_; | ||
72 | |||
73 | //- Density | ||
74 | dimensionedScalar rho_; | ||
75 | |||
76 | //- Velocity | ||
77 | volVectorField U_; | ||
78 | |||
79 | //- Substantive derivative of the velocity | ||
80 | volVectorField DDtU_; | ||
81 | |||
82 | //- Volumetric flux of the phase | ||
83 | surfaceScalarField alphaPhi_; | ||
84 | |||
85 | //- Volumetric flux for the phase | ||
86 | autoPtr<surfaceScalarField> phiPtr_; | ||
87 | |||
88 | //- Diameter model | ||
89 | autoPtr<diameterModel> dPtr_; | ||
90 | |||
91 | |||
92 | public: | ||
93 | |||
94 | // Constructors | ||
95 | |||
96 | phaseModel | ||
97 | ( | ||
98 | const word& phaseName, | ||
99 | const dictionary& phaseDict, | ||
100 | const fvMesh& mesh | ||
101 | ); | ||
102 | |||
103 | //- Return clone | ||
104 | autoPtr<phaseModel> clone() const; | ||
105 | |||
106 | //- Return a pointer to a new phase created on freestore | ||
107 | // from Istream | ||
108 | class iNew | ||
109 | { | ||
110 | const fvMesh& mesh_; | ||
111 | |||
112 | public: | ||
113 | |||
114 | iNew | ||
115 | ( | ||
116 | const fvMesh& mesh | ||
117 | ) | ||
118 | : | ||
119 | mesh_(mesh) | ||
120 | {} | ||
121 | |||
122 | autoPtr<phaseModel> operator()(Istream& is) const | ||
123 | { | ||
124 | dictionaryEntry ent(dictionary::null, is); | ||
125 | return autoPtr<phaseModel> | ||
126 | ( | ||
127 | new phaseModel(ent.keyword(), ent, mesh_) | ||
128 | ); | ||
129 | } | ||
130 | }; | ||
131 | |||
132 | |||
133 | //- Destructor | ||
134 | virtual ~phaseModel(); | ||
135 | |||
136 | |||
137 | // Member Functions | ||
138 | |||
139 | const word& name() const | ||
140 | { | ||
141 | return name_; | ||
142 | } | ||
143 | |||
144 | const word& keyword() const | ||
145 | { | ||
146 | return name(); | ||
147 | } | ||
148 | |||
149 | tmp<volScalarField> d() const; | ||
150 | |||
151 | const dimensionedScalar& nu() const | ||
152 | { | ||
153 | return nu_; | ||
154 | } | ||
155 | |||
156 | const dimensionedScalar& kappa() const | ||
157 | { | ||
158 | return kappa_; | ||
159 | } | ||
160 | |||
161 | const dimensionedScalar& Cp() const | ||
162 | { | ||
163 | return Cp_; | ||
164 | } | ||
165 | |||
166 | const dimensionedScalar& rho() const | ||
167 | { | ||
168 | return rho_; | ||
169 | } | ||
170 | |||
171 | const volVectorField& U() const | ||
172 | { | ||
173 | return U_; | ||
174 | } | ||
175 | |||
176 | volVectorField& U() | ||
177 | { | ||
178 | return U_; | ||
179 | } | ||
180 | |||
181 | const volVectorField& DDtU() const | ||
182 | { | ||
183 | return DDtU_; | ||
184 | } | ||
185 | |||
186 | volVectorField& DDtU() | ||
187 | { | ||
188 | return DDtU_; | ||
189 | } | ||
190 | |||
191 | const surfaceScalarField& phi() const | ||
192 | { | ||
193 | return phiPtr_(); | ||
194 | } | ||
195 | |||
196 | surfaceScalarField& phi() | ||
197 | { | ||
198 | return phiPtr_(); | ||
199 | } | ||
200 | |||
201 | const surfaceScalarField& alphaPhi() const | ||
202 | { | ||
203 | return alphaPhi_; | ||
204 | } | ||
205 | |||
206 | surfaceScalarField& alphaPhi() | ||
207 | { | ||
208 | return alphaPhi_; | ||
209 | } | ||
210 | |||
211 | //- Correct the phase properties | ||
212 | void correct(); | ||
213 | |||
214 | //-Inherit read from volScalarField | ||
215 | using volScalarField::read; | ||
216 | |||
217 | //- Read base transportProperties dictionary | ||
218 | bool read(const dictionary& phaseDict); | ||
219 | }; | ||
220 | |||
221 | |||
222 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
223 | |||
224 | } // End namespace Foam | ||
225 | |||
226 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
227 | |||
228 | #endif | ||
229 | |||
230 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/pEqn.H added (mode: 100644) (index 0000000..af4905a) | |||
1 | { | ||
2 | // rho1 = rho10 + psi1*p_rgh; | ||
3 | // rho2 = rho20 + psi2*p_rgh; | ||
4 | |||
5 | // tmp<fvScalarMatrix> pEqnComp1; | ||
6 | // tmp<fvScalarMatrix> pEqnComp2; | ||
7 | |||
8 | // //if (transonic) | ||
9 | // //{ | ||
10 | // //} | ||
11 | // //else | ||
12 | // { | ||
13 | // surfaceScalarField phid1("phid1", fvc::interpolate(psi1)*phi1); | ||
14 | // surfaceScalarField phid2("phid2", fvc::interpolate(psi2)*phi2); | ||
15 | |||
16 | // pEqnComp1 = | ||
17 | // fvc::ddt(rho1) + psi1*correction(fvm::ddt(p_rgh)) | ||
18 | // + fvc::div(phid1, p_rgh) | ||
19 | // - fvc::Sp(fvc::div(phid1), p_rgh); | ||
20 | |||
21 | // pEqnComp2 = | ||
22 | // fvc::ddt(rho2) + psi2*correction(fvm::ddt(p_rgh)) | ||
23 | // + fvc::div(phid2, p_rgh) | ||
24 | // - fvc::Sp(fvc::div(phid2), p_rgh); | ||
25 | // } | ||
26 | |||
27 | PtrList<surfaceScalarField> alphafs(fluid.phases().size()); | ||
28 | PtrList<volVectorField> HbyAs(fluid.phases().size()); | ||
29 | PtrList<surfaceScalarField> phiHbyAs(fluid.phases().size()); | ||
30 | PtrList<volScalarField> rAUs(fluid.phases().size()); | ||
31 | PtrList<surfaceScalarField> rAlphaAUfs(fluid.phases().size()); | ||
32 | |||
33 | phasei = 0; | ||
34 | forAllIter(PtrDictionary<phaseModel>, fluid.phases(), iter) | ||
35 | { | ||
36 | phaseModel& phase = iter(); | ||
37 | |||
38 | MRF.makeAbsolute(phase.phi().oldTime()); | ||
39 | MRF.makeAbsolute(phase.phi()); | ||
40 | |||
41 | HbyAs.set(phasei, new volVectorField(phase.U())); | ||
42 | phiHbyAs.set(phasei, new surfaceScalarField(1.0*phase.phi())); | ||
43 | |||
44 | phasei++; | ||
45 | } | ||
46 | |||
47 | surfaceScalarField phiHbyA | ||
48 | ( | ||
49 | IOobject | ||
50 | ( | ||
51 | "phiHbyA", | ||
52 | runTime.timeName(), | ||
53 | mesh, | ||
54 | IOobject::NO_READ, | ||
55 | IOobject::AUTO_WRITE | ||
56 | ), | ||
57 | mesh, | ||
58 | dimensionedScalar("phiHbyA", dimArea*dimVelocity, 0) | ||
59 | ); | ||
60 | |||
61 | volScalarField rho("rho", fluid.rho()); | ||
62 | surfaceScalarField ghSnGradRho(ghf*fvc::snGrad(rho)*mesh.magSf()); | ||
63 | |||
64 | phasei = 0; | ||
65 | forAllIter(PtrDictionary<phaseModel>, fluid.phases(), iter) | ||
66 | { | ||
67 | phaseModel& phase = iter(); | ||
68 | const volScalarField& alpha = phase; | ||
69 | |||
70 | alphafs.set(phasei, fvc::interpolate(alpha).ptr()); | ||
71 | alphafs[phasei].rename("hmm" + alpha.name()); | ||
72 | |||
73 | volScalarField dragCoeffi | ||
74 | ( | ||
75 | IOobject | ||
76 | ( | ||
77 | "dragCoeffi", | ||
78 | runTime.timeName(), | ||
79 | mesh | ||
80 | ), | ||
81 | fluid.dragCoeff(phase, dragCoeffs())/phase.rho(), | ||
82 | zeroGradientFvPatchScalarField::typeName | ||
83 | ); | ||
84 | dragCoeffi.correctBoundaryConditions(); | ||
85 | |||
86 | rAUs.set(phasei, (1.0/(UEqns[phasei].A() + dragCoeffi)).ptr()); | ||
87 | rAlphaAUfs.set | ||
88 | ( | ||
89 | phasei, | ||
90 | ( | ||
91 | alphafs[phasei] | ||
92 | /fvc::interpolate(UEqns[phasei].A() + dragCoeffi) | ||
93 | ).ptr() | ||
94 | ); | ||
95 | |||
96 | HbyAs[phasei] = rAUs[phasei]*UEqns[phasei].H(); | ||
97 | |||
98 | phiHbyAs[phasei] = | ||
99 | ( | ||
100 | fvc::flux(HbyAs[phasei]) | ||
101 | + rAlphaAUfs[phasei]*fvc::ddtCorr(phase.U(), phase.phi()) | ||
102 | ); | ||
103 | MRF.makeRelative(phiHbyAs[phasei]); | ||
104 | MRF.makeRelative(phase.phi().oldTime()); | ||
105 | MRF.makeRelative(phase.phi()); | ||
106 | |||
107 | phiHbyAs[phasei] += | ||
108 | rAlphaAUfs[phasei] | ||
109 | *( | ||
110 | fluid.surfaceTension(phase)*mesh.magSf() | ||
111 | + (phase.rho() - fvc::interpolate(rho))*(g & mesh.Sf()) | ||
112 | - ghSnGradRho | ||
113 | )/phase.rho(); | ||
114 | |||
115 | multiphaseSystem::dragModelTable::const_iterator dmIter = | ||
116 | fluid.dragModels().begin(); | ||
117 | multiphaseSystem::dragCoeffFields::const_iterator dcIter = | ||
118 | dragCoeffs().begin(); | ||
119 | for | ||
120 | ( | ||
121 | ; | ||
122 | dmIter != fluid.dragModels().end() && dcIter != dragCoeffs().end(); | ||
123 | ++dmIter, ++dcIter | ||
124 | ) | ||
125 | { | ||
126 | const phaseModel *phase2Ptr = NULL; | ||
127 | |||
128 | if (&phase == &dmIter()->phase1()) | ||
129 | { | ||
130 | phase2Ptr = &dmIter()->phase2(); | ||
131 | } | ||
132 | else if (&phase == &dmIter()->phase2()) | ||
133 | { | ||
134 | phase2Ptr = &dmIter()->phase1(); | ||
135 | } | ||
136 | else | ||
137 | { | ||
138 | continue; | ||
139 | } | ||
140 | |||
141 | phiHbyAs[phasei] += | ||
142 | fvc::interpolate((*dcIter())/phase.rho()) | ||
143 | /fvc::interpolate(UEqns[phasei].A() + dragCoeffi) | ||
144 | *phase2Ptr->phi(); | ||
145 | |||
146 | HbyAs[phasei] += | ||
147 | (1.0/phase.rho())*rAUs[phasei]*(*dcIter()) | ||
148 | *phase2Ptr->U(); | ||
149 | |||
150 | // Alternative flux-pressure consistent drag | ||
151 | // but not momentum conservative | ||
152 | // | ||
153 | // HbyAs[phasei] += fvc::reconstruct | ||
154 | // ( | ||
155 | // fvc::interpolate | ||
156 | // ( | ||
157 | // (1.0/phase.rho())*rAUs[phasei]*(*dcIter()) | ||
158 | // )*phase2Ptr->phi() | ||
159 | // ); | ||
160 | } | ||
161 | |||
162 | phiHbyA += alphafs[phasei]*phiHbyAs[phasei]; | ||
163 | |||
164 | phasei++; | ||
165 | } | ||
166 | |||
167 | surfaceScalarField rAUf | ||
168 | ( | ||
169 | IOobject | ||
170 | ( | ||
171 | "rAUf", | ||
172 | runTime.timeName(), | ||
173 | mesh | ||
174 | ), | ||
175 | mesh, | ||
176 | dimensionedScalar("rAUf", dimensionSet(-1, 3, 1, 0, 0), 0) | ||
177 | ); | ||
178 | |||
179 | phasei = 0; | ||
180 | forAllIter(PtrDictionary<phaseModel>, fluid.phases(), iter) | ||
181 | { | ||
182 | phaseModel& phase = iter(); | ||
183 | rAUf += mag(alphafs[phasei]*rAlphaAUfs[phasei])/phase.rho(); | ||
184 | |||
185 | phasei++; | ||
186 | } | ||
187 | |||
188 | // Update the fixedFluxPressure BCs to ensure flux consistency | ||
189 | { | ||
190 | surfaceScalarField::Boundary phib(phi.boundaryField()); | ||
191 | phib = 0; | ||
192 | phasei = 0; | ||
193 | forAllIter(PtrDictionary<phaseModel>, fluid.phases(), iter) | ||
194 | { | ||
195 | phaseModel& phase = iter(); | ||
196 | |||
197 | phib += | ||
198 | alphafs[phasei].boundaryField() | ||
199 | *(mesh.Sf().boundaryField() & phase.U().boundaryField()); | ||
200 | |||
201 | phasei++; | ||
202 | } | ||
203 | |||
204 | setSnGrad<fixedFluxPressureFvPatchScalarField> | ||
205 | ( | ||
206 | p_rgh.boundaryFieldRef(), | ||
207 | ( | ||
208 | phiHbyA.boundaryField() - MRF.relative(phib) | ||
209 | )/(mesh.magSf().boundaryField()*rAUf.boundaryField()) | ||
210 | ); | ||
211 | } | ||
212 | |||
213 | while (pimple.correctNonOrthogonal()) | ||
214 | { | ||
215 | fvScalarMatrix pEqnIncomp | ||
216 | ( | ||
217 | fvc::div(phiHbyA) | ||
218 | - fvm::laplacian(rAUf, p_rgh) | ||
219 | ); | ||
220 | |||
221 | pEqnIncomp.setReference(pRefCell, pRefValue); | ||
222 | |||
223 | solve | ||
224 | ( | ||
225 | // ( | ||
226 | // (alpha1/rho1)*pEqnComp1() | ||
227 | // + (alpha2/rho2)*pEqnComp2() | ||
228 | // ) + | ||
229 | pEqnIncomp, | ||
230 | mesh.solver(p_rgh.select(pimple.finalInnerIter())) | ||
231 | ); | ||
232 | |||
233 | if (pimple.finalNonOrthogonalIter()) | ||
234 | { | ||
235 | surfaceScalarField mSfGradp("mSfGradp", pEqnIncomp.flux()/rAUf); | ||
236 | |||
237 | phasei = 0; | ||
238 | phi = dimensionedScalar("phi", phi.dimensions(), 0); | ||
239 | forAllIter(PtrDictionary<phaseModel>, fluid.phases(), iter) | ||
240 | { | ||
241 | phaseModel& phase = iter(); | ||
242 | |||
243 | phase.phi() = | ||
244 | phiHbyAs[phasei] | ||
245 | + rAlphaAUfs[phasei]*mSfGradp/phase.rho(); | ||
246 | phi += | ||
247 | alphafs[phasei]*phiHbyAs[phasei] | ||
248 | + mag(alphafs[phasei]*rAlphaAUfs[phasei]) | ||
249 | *mSfGradp/phase.rho(); | ||
250 | |||
251 | phasei++; | ||
252 | } | ||
253 | |||
254 | // dgdt = | ||
255 | |||
256 | // ( | ||
257 | // pos(alpha2)*(pEqnComp2 & p)/rho2 | ||
258 | // - pos(alpha1)*(pEqnComp1 & p)/rho1 | ||
259 | // ); | ||
260 | |||
261 | p_rgh.relax(); | ||
262 | |||
263 | p = p_rgh + rho*gh; | ||
264 | |||
265 | mSfGradp = pEqnIncomp.flux()/rAUf; | ||
266 | |||
267 | U = dimensionedVector("U", dimVelocity, Zero); | ||
268 | |||
269 | phasei = 0; | ||
270 | forAllIter(PtrDictionary<phaseModel>, fluid.phases(), iter) | ||
271 | { | ||
272 | phaseModel& phase = iter(); | ||
273 | const volScalarField& alpha = phase; | ||
274 | |||
275 | phase.U() = | ||
276 | HbyAs[phasei] | ||
277 | + fvc::reconstruct | ||
278 | ( | ||
279 | rAlphaAUfs[phasei] | ||
280 | *( | ||
281 | (phase.rho() - fvc::interpolate(rho)) | ||
282 | *(g & mesh.Sf()) | ||
283 | - ghSnGradRho | ||
284 | + mSfGradp | ||
285 | ) | ||
286 | )/phase.rho(); | ||
287 | |||
288 | //phase.U() = fvc::reconstruct(phase.phi()); | ||
289 | phase.U().correctBoundaryConditions(); | ||
290 | |||
291 | U += alpha*phase.U(); | ||
292 | |||
293 | phasei++; | ||
294 | } | ||
295 | } | ||
296 | } | ||
297 | |||
298 | //p = max(p, pMin); | ||
299 | |||
300 | #include "continuityErrs.H" | ||
301 | |||
302 | // rho1 = rho10 + psi1*p_rgh; | ||
303 | // rho2 = rho20 + psi2*p_rgh; | ||
304 | |||
305 | // Dp1Dt = fvc::DDt(phi1, p_rgh); | ||
306 | // Dp2Dt = fvc::DDt(phi2, p_rgh); | ||
307 | } |
File multiphaseEulerPbeFoam/quadratureMethods/PDFTransportModels/Make/files added (mode: 100644) (index 0000000..b36df05) | |||
1 | PDFTransportModel/PDFTransportModel.C | ||
2 | univariatePDFTransportModel/univariatePDFTransportModel.C | ||
3 | |||
4 | LIB = $(FOAM_USER_LIBBIN)/libPDFTransportModel |
File multiphaseEulerPbeFoam/quadratureMethods/PDFTransportModels/Make/options added (mode: 100644) (index 0000000..8256cab) | |||
1 | EXE_INC = \ | ||
2 | -I$(LIB_SRC)/transportModels \ | ||
3 | -I$(LIB_SRC)/transportModels/compressible/lnInclude \ | ||
4 | -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ | ||
5 | -I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \ | ||
6 | -I$(LIB_SRC)/TurbulenceModels/incompressible/lnInclude \ | ||
7 | -I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \ | ||
8 | -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ | ||
9 | -I$(LIB_SRC)/finiteVolume/lnInclude \ | ||
10 | -I$(LIB_SRC)/meshTools/lnInclude \ | ||
11 | -I../../eigenSolver/lnInclude \ | ||
12 | -I../univariateMomentSet/lnInclude \ | ||
13 | -I../extentedMomentInversion/lnInclude \ | ||
14 | -I../quadratureNode \ | ||
15 | -I../moments \ | ||
16 | -I../quadratureApproximation/lnInclude | ||
17 | |||
18 | LIB_LIBS = \ | ||
19 | -lincompressibleTransportModels \ | ||
20 | -lcompressibleTransportModels \ | ||
21 | -lfluidThermophysicalModels \ | ||
22 | -lspecie \ | ||
23 | -lturbulenceModels \ | ||
24 | -lincompressibleTurbulenceModels \ | ||
25 | -lcompressibleTurbulenceModels \ | ||
26 | -lfiniteVolume \ | ||
27 | -lmeshTools \ | ||
28 | -L$(FOAM_USER_LIBBIN) \ | ||
29 | -leigenSolver \ | ||
30 | -lmomentSet \ | ||
31 | -lextendedMomentInversion \ | ||
32 | -lquadratureApproximation |
File multiphaseEulerPbeFoam/quadratureMethods/PDFTransportModels/PDFTransportModel/PDFTransportModel.C added (mode: 100644) (index 0000000..1336560) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2015-2016 Alberto Passalacqua | ||
6 | \\/ M anipulation | | ||
7 | ------------------------------------------------------------------------------- | ||
8 | License | ||
9 | This file is derivative work 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 "PDFTransportModel.H" | ||
27 | |||
28 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | ||
29 | |||
30 | Foam::PDFTransportModel::PDFTransportModel | ||
31 | ( | ||
32 | const word& name, | ||
33 | const dictionary& dict, | ||
34 | const fvMesh& mesh | ||
35 | ) | ||
36 | : | ||
37 | name_(name), | ||
38 | mesh_(mesh) | ||
39 | {} | ||
40 | |||
41 | |||
42 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | ||
43 | |||
44 | Foam::PDFTransportModel::~PDFTransportModel() | ||
45 | {} | ||
46 | |||
47 | |||
48 | // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // | ||
49 | |||
50 | |||
51 | |||
52 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/PDFTransportModels/PDFTransportModel/PDFTransportModel.H added (mode: 100644) (index 0000000..4b88e1e) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2015-2016 Alberto Passalacqua | ||
6 | \\/ M anipulation | | ||
7 | ------------------------------------------------------------------------------- | ||
8 | License | ||
9 | This file is derivative work 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 | Class | ||
25 | Foam::PDFTransportModel | ||
26 | |||
27 | Description | ||
28 | Abstract class for the run-time selection of the PDF transport model. | ||
29 | |||
30 | SourceFiles | ||
31 | PDFTransportModel.C | ||
32 | |||
33 | \*---------------------------------------------------------------------------*/ | ||
34 | |||
35 | #ifndef PDFTransportModel_H | ||
36 | #define PDFTransportModel_H | ||
37 | |||
38 | #include "dictionary.H" | ||
39 | #include "fvMesh.H" | ||
40 | #include "volFields.H" | ||
41 | #include "dimensionedTypes.H" | ||
42 | |||
43 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
44 | |||
45 | namespace Foam | ||
46 | { | ||
47 | |||
48 | /*---------------------------------------------------------------------------*\ | ||
49 | Class PDFTransportModel Declaration | ||
50 | \*---------------------------------------------------------------------------*/ | ||
51 | |||
52 | class PDFTransportModel | ||
53 | { | ||
54 | // Private data | ||
55 | |||
56 | //- Name of the PDFTransportModel | ||
57 | const word name_; | ||
58 | |||
59 | // Private Member Functions | ||
60 | |||
61 | //- Disallow default bitwise copy construct | ||
62 | PDFTransportModel(const PDFTransportModel&); | ||
63 | |||
64 | //- Disallow default bitwise assignment | ||
65 | void operator=(const PDFTransportModel&); | ||
66 | |||
67 | |||
68 | protected: | ||
69 | |||
70 | // Protected data | ||
71 | |||
72 | //- Constant reference to the mesh | ||
73 | const fvMesh& mesh_; | ||
74 | |||
75 | |||
76 | public: | ||
77 | |||
78 | // Constructors | ||
79 | |||
80 | //- Construct from components | ||
81 | PDFTransportModel | ||
82 | ( | ||
83 | const word& name, | ||
84 | const dictionary& dict, | ||
85 | const fvMesh& mesh | ||
86 | ); | ||
87 | |||
88 | //- Destructor | ||
89 | virtual ~PDFTransportModel(); | ||
90 | |||
91 | |||
92 | // Member Functions | ||
93 | |||
94 | //- Solve PDF transport equation | ||
95 | virtual void solve() = 0; | ||
96 | |||
97 | }; | ||
98 | |||
99 | |||
100 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
101 | |||
102 | } // End namespace Foam | ||
103 | |||
104 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
105 | |||
106 | #endif | ||
107 | |||
108 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/PDFTransportModels/univariatePDFTransportModel/univariatePDFTransportModel.C added (mode: 100644) (index 0000000..9611037) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2015-2016 Alberto Passalacqua | ||
6 | \\/ M anipulation | | ||
7 | ------------------------------------------------------------------------------- | ||
8 | License | ||
9 | This file is derivative work 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 "univariatePDFTransportModel.H" | ||
27 | |||
28 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | ||
29 | |||
30 | Foam::PDFTransportModels::univariatePDFTransportModel | ||
31 | ::univariatePDFTransportModel | ||
32 | ( | ||
33 | const word& name, | ||
34 | const dictionary& dict, | ||
35 | const fvMesh& mesh, | ||
36 | const volVectorField& U, | ||
37 | const surfaceScalarField& phi, | ||
38 | const word& support | ||
39 | ) | ||
40 | : | ||
41 | PDFTransportModel(name, dict, mesh), | ||
42 | name_(name), | ||
43 | quadrature_(name, mesh, support), | ||
44 | U_(U), | ||
45 | phi_(phi) | ||
46 | {} | ||
47 | |||
48 | |||
49 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | ||
50 | |||
51 | Foam::PDFTransportModels::univariatePDFTransportModel | ||
52 | ::~univariatePDFTransportModel() | ||
53 | {} | ||
54 | |||
55 | |||
56 | // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // | ||
57 | |||
58 | void Foam::PDFTransportModels::univariatePDFTransportModel | ||
59 | ::updatePhysicalSpaceConvection() | ||
60 | { | ||
61 | // Update interpolated nodes | ||
62 | quadrature_.interpolateNodes(); | ||
63 | |||
64 | // Updated reconstructed moments | ||
65 | quadrature_.momentsNei().update(); | ||
66 | quadrature_.momentsOwn().update(); | ||
67 | } | ||
68 | |||
69 | Foam::tmp<Foam::volScalarField> | ||
70 | Foam::PDFTransportModels::univariatePDFTransportModel::physicalSpaceConvection | ||
71 | ( | ||
72 | const volUnivariateMoment& moment | ||
73 | ) | ||
74 | { | ||
75 | dimensionedScalar zeroPhi("zero", phi_.dimensions(), 0.0); | ||
76 | |||
77 | tmp<volScalarField> divMoment | ||
78 | ( | ||
79 | new volScalarField | ||
80 | ( | ||
81 | IOobject | ||
82 | ( | ||
83 | "divMoment", | ||
84 | mesh_.time().timeName(), | ||
85 | mesh_, | ||
86 | IOobject::NO_READ, | ||
87 | IOobject::NO_WRITE, | ||
88 | false | ||
89 | ), | ||
90 | mesh_, | ||
91 | dimensionedScalar("zero", dimless, 0.0) | ||
92 | ) | ||
93 | ); | ||
94 | |||
95 | label order = moment.order(); | ||
96 | |||
97 | surfaceScalarField mFlux | ||
98 | ( | ||
99 | quadrature_.momentsNei()[order]*min(phi_, zeroPhi) | ||
100 | + quadrature_.momentsOwn()[order]*max(phi_, zeroPhi) | ||
101 | ); | ||
102 | |||
103 | fvc::surfaceIntegrate(divMoment.ref(), mFlux); | ||
104 | divMoment.ref().dimensions().reset(moment.dimensions()/dimTime); | ||
105 | |||
106 | return divMoment; | ||
107 | } | ||
108 | |||
109 | |||
110 | |||
111 | void Foam::PDFTransportModels::univariatePDFTransportModel::solve() | ||
112 | { | ||
113 | updatePhysicalSpaceConvection(); | ||
114 | |||
115 | // List of moment transport equations | ||
116 | PtrList<fvScalarMatrix> momentEqns(quadrature_.nMoments()); | ||
117 | |||
118 | // Solve moment transport equations | ||
119 | forAll(quadrature_.moments(), momenti) | ||
120 | { | ||
121 | volUnivariateMoment& m = quadrature_.moments()[momenti]; | ||
122 | |||
123 | momentEqns.set | ||
124 | ( | ||
125 | momenti, | ||
126 | new fvScalarMatrix | ||
127 | ( | ||
128 | fvm::ddt(m) | ||
129 | //+ fvm::div(phi_, m, "div(phi,moment)") | ||
130 | + physicalSpaceConvection(m) | ||
131 | - momentDiffusion(m) | ||
132 | == | ||
133 | momentSource(m) | ||
134 | + phaseSpaceConvection(m) | ||
135 | ) | ||
136 | ); | ||
137 | } | ||
138 | |||
139 | forAll (momentEqns, mEqnI) | ||
140 | { | ||
141 | momentEqns[mEqnI].relax(); | ||
142 | momentEqns[mEqnI].solve(); | ||
143 | } | ||
144 | |||
145 | quadrature_.updateQuadrature(); | ||
146 | } | ||
147 | |||
148 | |||
149 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/PDFTransportModels/univariatePDFTransportModel/univariatePDFTransportModel.H added (mode: 100644) (index 0000000..bca675d) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2015-2016 Alberto Passalacqua | ||
6 | \\/ M anipulation | | ||
7 | ------------------------------------------------------------------------------- | ||
8 | License | ||
9 | This file is derivative work 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 | Class | ||
25 | Foam::univariatePDFTransportModel | ||
26 | |||
27 | Description | ||
28 | Solve a univariate PDF transport equation with the extended quadrature | ||
29 | method of moments. | ||
30 | |||
31 | SourceFiles | ||
32 | univariatePDFTransportModel.C | ||
33 | |||
34 | \*---------------------------------------------------------------------------*/ | ||
35 | |||
36 | #ifndef univariatePDFTransportModel_H | ||
37 | #define univariatePDFTransportModel_H | ||
38 | |||
39 | #include "PDFTransportModel.H" | ||
40 | #include "univariateQuadratureApproximation.H" | ||
41 | |||
42 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
43 | |||
44 | namespace Foam | ||
45 | { | ||
46 | namespace PDFTransportModels | ||
47 | { | ||
48 | |||
49 | /*---------------------------------------------------------------------------*\ | ||
50 | Class univariatePDFTransportModel Declaration | ||
51 | \*---------------------------------------------------------------------------*/ | ||
52 | |||
53 | class univariatePDFTransportModel | ||
54 | : | ||
55 | public PDFTransportModel | ||
56 | { | ||
57 | // Private data | ||
58 | |||
59 | //- Name of the univariatePDFTransportModel | ||
60 | const word name_; | ||
61 | |||
62 | protected: | ||
63 | |||
64 | // Protected data | ||
65 | |||
66 | //- Univariate quadrature approximation used to solve PDF transport | ||
67 | univariateQuadratureApproximation quadrature_; | ||
68 | |||
69 | //- Velocity field | ||
70 | const volVectorField& U_; | ||
71 | |||
72 | //- Face velocity field | ||
73 | const surfaceScalarField& phi_; | ||
74 | |||
75 | // Protected member functions | ||
76 | |||
77 | //- Diffusion term | ||
78 | virtual tmp<fvScalarMatrix> momentDiffusion | ||
79 | ( | ||
80 | const volUnivariateMoment& moment | ||
81 | ) = 0; | ||
82 | |||
83 | //- Calculate source terms | ||
84 | virtual tmp<fvScalarMatrix> momentSource | ||
85 | ( | ||
86 | const volUnivariateMoment& moment | ||
87 | ) = 0; | ||
88 | |||
89 | //- Convect moments in phase space | ||
90 | virtual tmp<volScalarField> phaseSpaceConvection | ||
91 | ( | ||
92 | const volUnivariateMoment& moment | ||
93 | ) = 0; | ||
94 | |||
95 | //- Calculate explicit convection term in physical space | ||
96 | tmp<volScalarField> physicalSpaceConvection | ||
97 | ( | ||
98 | const volUnivariateMoment& moment | ||
99 | ); | ||
100 | |||
101 | //- Update fields required to compute kinetic fluxes | ||
102 | void updatePhysicalSpaceConvection(); | ||
103 | |||
104 | |||
105 | public: | ||
106 | |||
107 | // Constructors | ||
108 | |||
109 | //- Construct from components | ||
110 | univariatePDFTransportModel | ||
111 | ( | ||
112 | const word& name, | ||
113 | const dictionary& dict, | ||
114 | const fvMesh& mesh, | ||
115 | const volVectorField& U, | ||
116 | const surfaceScalarField& phi, | ||
117 | const word& support | ||
118 | ); | ||
119 | |||
120 | |||
121 | //- Destructor | ||
122 | virtual ~univariatePDFTransportModel(); | ||
123 | |||
124 | |||
125 | // Member Functions | ||
126 | |||
127 | //- Access | ||
128 | |||
129 | //- Returns a const reference to the quadrature approximation | ||
130 | inline const univariateQuadratureApproximation& quadrature() const; | ||
131 | |||
132 | //-Edit | ||
133 | |||
134 | //- Solve univariate PDF transport equation | ||
135 | virtual void solve(); | ||
136 | }; | ||
137 | |||
138 | |||
139 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
140 | |||
141 | } // End namespace PDFTransportModels | ||
142 | } // End namespace Foam | ||
143 | |||
144 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
145 | |||
146 | #include "univariatePDFTransportModelI.H" | ||
147 | |||
148 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
149 | |||
150 | #endif |
File multiphaseEulerPbeFoam/quadratureMethods/PDFTransportModels/univariatePDFTransportModel/univariatePDFTransportModelI.H added (mode: 100644) (index 0000000..ddb0a21) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2015-2016 Alberto Passalacqua | ||
6 | \\/ M anipulation | | ||
7 | ------------------------------------------------------------------------------- | ||
8 | License | ||
9 | This file is derivative work 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 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | ||
27 | |||
28 | const Foam::univariateQuadratureApproximation& | ||
29 | Foam::PDFTransportModels::univariatePDFTransportModel::quadrature() const | ||
30 | { | ||
31 | return quadrature_; | ||
32 | } | ||
33 | |||
34 | |||
35 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/extentedMomentInversion/Make/files added (mode: 100644) (index 0000000..db0e4e3) | |||
1 | extendedMomentInversion/extendedMomentInversion.C | ||
2 | extendedMomentInversion/newExtendedMomentInversion.C | ||
3 | gamma/gammaEQMOM.C | ||
4 | lognormal/lognormalEQMOM.C | ||
5 | beta/betaEQMOM.C | ||
6 | |||
7 | LIB = $(FOAM_USER_LIBBIN)/libextendedMomentInversion |
File multiphaseEulerPbeFoam/quadratureMethods/extentedMomentInversion/Make/options added (mode: 100644) (index 0000000..240fa11) | |||
1 | EXE_INC = \ | ||
2 | -I$(LIB_SRC)/finiteVolume/lnInclude \ | ||
3 | -I../../eigenSolver/lnInclude \ | ||
4 | -I../univariateMomentSet/lnInclude | ||
5 | |||
6 | LIB_LIBS = \ | ||
7 | -lfiniteVolume \ | ||
8 | -L$(FOAM_USER_LIBBIN) \ | ||
9 | -leigenSolver \ | ||
10 | -lmomentSet |
File multiphaseEulerPbeFoam/quadratureMethods/extentedMomentInversion/beta/betaEQMOM.C added (mode: 100644) (index 0000000..c6faa11) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2014-2016 Alberto Passalacqua | ||
6 | \\/ M anipulation | | ||
7 | ------------------------------------------------------------------------------- | ||
8 | License | ||
9 | This file is derivative work 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 "betaEQMOM.H" | ||
27 | #include "scalar.H" | ||
28 | #include "scalarMatrices.H" | ||
29 | #include "constants.H" | ||
30 | #include "addToRunTimeSelectionTable.H" | ||
31 | |||
32 | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // | ||
33 | |||
34 | namespace Foam | ||
35 | { | ||
36 | defineTypeNameAndDebug(betaEQMOM, 0); | ||
37 | |||
38 | addToRunTimeSelectionTable | ||
39 | ( | ||
40 | extendedMomentInversion, | ||
41 | betaEQMOM, | ||
42 | dictionary | ||
43 | ); | ||
44 | } | ||
45 | |||
46 | |||
47 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | ||
48 | |||
49 | Foam::betaEQMOM::betaEQMOM | ||
50 | ( | ||
51 | const dictionary& dict, | ||
52 | const label nMoments, | ||
53 | const label nSecondaryNodes | ||
54 | ) | ||
55 | : | ||
56 | extendedMomentInversion(dict, nMoments, nSecondaryNodes) | ||
57 | {} | ||
58 | |||
59 | |||
60 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | ||
61 | |||
62 | Foam::betaEQMOM::~betaEQMOM() | ||
63 | {} | ||
64 | |||
65 | |||
66 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | ||
67 | Foam::scalar Foam::betaEQMOM::secondaryAbscissa | ||
68 | ( | ||
69 | scalar primaryAbscissa, | ||
70 | scalar secondaryAbscissa, | ||
71 | scalar sigma | ||
72 | ) | ||
73 | { | ||
74 | return (1.0 + secondaryAbscissa)/2.0; | ||
75 | } | ||
76 | |||
77 | void Foam::betaEQMOM::momentsStarToMoments | ||
78 | ( | ||
79 | scalar sigma, | ||
80 | univariateMomentSet& moments, | ||
81 | const univariateMomentSet& momentsStar | ||
82 | ) | ||
83 | { | ||
84 | label nMom = moments.size(); | ||
85 | |||
86 | if (nMom >= 12) | ||
87 | { | ||
88 | FatalErrorInFunction | ||
89 | << "Moment transformation not implemented." | ||
90 | << abort(FatalError); | ||
91 | } | ||
92 | |||
93 | scalar factor = 1.0 + sigma; | ||
94 | |||
95 | moments[0] = momentsStar[0]; | ||
96 | moments[1] = momentsStar[1]; | ||
97 | moments[2] = (momentsStar[2] + sigma*momentsStar[1])/factor; | ||
98 | |||
99 | if (nMom >= 5) | ||
100 | { | ||
101 | factor *= 1.0 + 2.0*sigma; | ||
102 | moments[3] = (momentsStar[3] + sigma*(3.0*momentsStar[2] | ||
103 | + 2.0*sigma*momentsStar[1]) | ||
104 | )/factor; | ||
105 | |||
106 | factor *= 1.0 + 3.0*sigma; | ||
107 | moments[4] = (momentsStar[4] + sigma*(6.0*momentsStar[3] | ||
108 | + sigma*(11.0*momentsStar[2] + 6.0*momentsStar[1]*sigma)) | ||
109 | )/factor; | ||
110 | } | ||
111 | |||
112 | if (nMom >= 7) | ||
113 | { | ||
114 | factor *= 1.0 + 4.0*sigma; | ||
115 | moments[5] = (momentsStar[5] + sigma*(10.0*momentsStar[4] | ||
116 | + sigma*(35.0*momentsStar[3] + sigma*(50.0*momentsStar[2] | ||
117 | + 24.0*momentsStar[1]*sigma))) | ||
118 | )/factor; | ||
119 | |||
120 | factor *= 1.0 + 5.0*sigma; | ||
121 | moments[6] = (momentsStar[6] + sigma*(15.0*momentsStar[5] | ||
122 | + sigma*(85.0*momentsStar[4] + sigma*(225.0*momentsStar[3] | ||
123 | + sigma*(274.0*momentsStar[2] + 120.0*momentsStar[1]*sigma)))) | ||
124 | )/factor; | ||
125 | } | ||
126 | |||
127 | if (nMom >= 9) | ||
128 | { | ||
129 | factor *= 1.0 + 6.0*sigma; | ||
130 | moments[7] = (momentsStar[7] + sigma*(21.0*momentsStar[6] | ||
131 | + sigma*(175.0*momentsStar[5] + sigma*(735.0*momentsStar[4] | ||
132 | + sigma*(1624.0*momentsStar[3] + sigma*(1764.0*momentsStar[2] | ||
133 | + 720.0*momentsStar[1]*sigma))))) | ||
134 | )/factor; | ||
135 | |||
136 | factor *= 1.0 + 7.0*sigma; | ||
137 | moments[8] = (momentsStar[8] + sigma*(28.0*momentsStar[7] | ||
138 | + sigma*(322.0*momentsStar[6] + sigma*(1960.0*momentsStar[5] | ||
139 | + sigma*(6769.0*momentsStar[4] + sigma*(13132.0*momentsStar[3] | ||
140 | + sigma*(13068.0*momentsStar[2] | ||
141 | + 5040.0*momentsStar[1]*sigma)))))) | ||
142 | )/factor; | ||
143 | } | ||
144 | |||
145 | if (nMom >= 11) | ||
146 | { | ||
147 | factor *= 1.0 + 8.0*sigma; | ||
148 | moments[9] = (momentsStar[9] + sigma*(36.0*momentsStar[8] | ||
149 | + sigma*(546.0*momentsStar[7] + sigma*(4536.0*momentsStar[6] | ||
150 | + sigma*(22449.0*momentsStar[5] + sigma*(67284.0*momentsStar[4] | ||
151 | + sigma*(118124.0*momentsStar[3] | ||
152 | + sigma*(109584.0*momentsStar[2] | ||
153 | + 40320.0*momentsStar[1]*sigma))))))) | ||
154 | )/factor; | ||
155 | |||
156 | factor *= 1.0 + 9.0*sigma; | ||
157 | moments[10] = (momentsStar[10] + sigma*(45.0*momentsStar[9] | ||
158 | + sigma*(870.0*momentsStar[8] + sigma*(9450.0*momentsStar[7] | ||
159 | + sigma*(63273.0*momentsStar[6] | ||
160 | + sigma*(269325.0*momentsStar[5] | ||
161 | + sigma*(723680.0*momentsStar[4] | ||
162 | + sigma*(1172700.0*momentsStar[3] | ||
163 | + sigma*(1026576.0*momentsStar[2] | ||
164 | + 362880.0*momentsStar[1]*sigma)))))))) | ||
165 | )/factor; | ||
166 | } | ||
167 | } | ||
168 | |||
169 | void Foam::betaEQMOM::momentsToMomentsStar | ||
170 | ( | ||
171 | scalar sigma, | ||
172 | const univariateMomentSet& moments, | ||
173 | univariateMomentSet& momentsStar | ||
174 | ) | ||
175 | { | ||
176 | label nMom = moments.size(); | ||
177 | |||
178 | if (nMom >= 12) | ||
179 | { | ||
180 | FatalErrorInFunction | ||
181 | << "The number of moments is too large. The maximum number of" | ||
182 | << "moments allowed with the beta kernel density function is 11." | ||
183 | << "Moment transformation not implemented." | ||
184 | << abort(FatalError); | ||
185 | } | ||
186 | |||
187 | momentsStar[0] = moments[0]; | ||
188 | momentsStar[1] = moments[1]; | ||
189 | momentsStar[2] = (1.0 + sigma)*moments[2] - sigma*moments[1]; | ||
190 | |||
191 | if (nMom >= 5) | ||
192 | { | ||
193 | momentsStar[3] = (1.0 + 2.0*sigma)*(1.0 + sigma)*moments[3] | ||
194 | + sigma*(-3.0*(1.0 + sigma)*moments[2] | ||
195 | + moments[1]*sigma); | ||
196 | |||
197 | momentsStar[4] = (1.0 + 3.0*sigma)*(1.0 + 2.0*sigma)*(1.0 + sigma) | ||
198 | *moments[4] + sigma*(-6.0*(1.0 + 2.0*sigma)*(1.0 + sigma) | ||
199 | *moments[3] + sigma*(7.0*(1.0 + sigma)*moments[2] | ||
200 | - moments[1]*sigma)); | ||
201 | } | ||
202 | |||
203 | if (nMom >= 7) | ||
204 | { | ||
205 | momentsStar[5] = (1.0 + 4.0*sigma)*(1.0 + 3.0*sigma)*(1.0 + 2.0*sigma) | ||
206 | *(1.0 + sigma)*moments[5] + sigma*(-10.0*(1.0 + 3.0*sigma) | ||
207 | *(1.0 + 2.0*sigma)*(1.0 + sigma)*moments[4] | ||
208 | + sigma*(25.0*(1.0 + 2.0*sigma)*(1.0 + sigma)*moments[3] | ||
209 | + sigma*(-15.0*(1.0 + sigma)*moments[2] + moments[1]*sigma))); | ||
210 | |||
211 | momentsStar[6] = (1.0 + 5.0*sigma)*(1.0 + 4.0*sigma)*(1.0 + 3.0*sigma) | ||
212 | *(1.0 + 2.0*sigma)*(1.0 + sigma)*moments[6] | ||
213 | + sigma*(-15.0*(1.0 + 4.0*sigma)*(1.0 + 3.0*sigma) | ||
214 | *(1.0 + 2.0*sigma)*(1.0 + sigma)*moments[5] | ||
215 | + sigma*(65.0*(1.0 + 3.0*sigma)*(1.0 + 2.0*sigma)*(1.0 + sigma) | ||
216 | *moments[4] + sigma*(-90.0*(1.0 + 2.0*sigma)*(1.0 + sigma) | ||
217 | *moments[3] + sigma*(31.0*(1.0 + sigma)*moments[2] | ||
218 | - moments[1]*sigma)))); | ||
219 | } | ||
220 | |||
221 | if (nMom >= 9) | ||
222 | { | ||
223 | momentsStar[7] = (1.0 + 6.0*sigma)*(1.0 + 5.0*sigma)*(1.0 + 4.0*sigma) | ||
224 | *(1.0 + 3.0*sigma)*(1.0 + 2.0*sigma)*(1.0 + sigma)*moments[7] | ||
225 | + sigma*(-21.0*(1.0 + 5.0*sigma)*(1.0 + 4.0*sigma) | ||
226 | *(1.0 + 3.0*sigma)*(1.0 + 2.0*sigma)*(1.0 + sigma)*moments[6] | ||
227 | + sigma*(140.0*(1.0 + 4.0*sigma)*(1.0 + 3.0*sigma) | ||
228 | *(1.0 + 2.0*sigma)*(1.0 + sigma)*moments[5] | ||
229 | + sigma*(-350.0*(1.0 + 3.0*sigma)*(1.0 + 2.0*sigma) | ||
230 | *(1.0 + sigma)*moments[4] + sigma*(301.0*(1.0 + 2.0*sigma) | ||
231 | *(1.0 + sigma)*moments[3] + sigma*(-63.0*(1.0 + sigma) | ||
232 | *moments[2] + moments[1]*sigma))))); | ||
233 | |||
234 | momentsStar[8] = (1.0 + 7.0*sigma)*(1.0 + 6.0*sigma)*(1.0 + 5.0*sigma) | ||
235 | *(1.0 + 4.0*sigma)*(1.0 + 3.0*sigma)*(1.0 + 2.0*sigma) | ||
236 | *(1.0 + sigma)*moments[8] + sigma*(-28.0*(1.0 + 6.0*sigma) | ||
237 | *(1.0 + 5.0*sigma)*(1.0 + 4.0*sigma)*(1.0 + 3.0*sigma) | ||
238 | *(1.0 + 2.0*sigma)*(1.0 + sigma)*moments[7] | ||
239 | + sigma*(266.0*(1.0 + 5.0*sigma)*(1.0 + 4.0*sigma) | ||
240 | *(1.0 + 3.0*sigma)*(1.0 + 2.0*sigma)*(1.0 + sigma)*moments[6] | ||
241 | + sigma*(-1050.0*(1.0 + 4.0*sigma)*(1.0 + 3.0*sigma) | ||
242 | *(1.0 + 2.0*sigma)*(1.0 + sigma)*moments[5] | ||
243 | + sigma*(1701.0*(1.0 + 3.0*sigma)*(1.0 + 2.0*sigma) | ||
244 | *(1.0 + sigma)*moments[4] + sigma*(-966.0*(1.0 + 2.0*sigma) | ||
245 | *(1.0 + sigma)*moments[3] + sigma*(127.0*(1.0 + sigma) | ||
246 | *moments[2] - moments[1]*sigma)))))); | ||
247 | } | ||
248 | |||
249 | if (nMom >= 11) | ||
250 | { | ||
251 | momentsStar[9] = (1.0 + 8.0*sigma)*(1.0 + 7.0*sigma)*(1.0 + 6.0*sigma) | ||
252 | *(1.0 + 5.0*sigma)*(1.0 + 4.0*sigma)*(1.0 + 3.0*sigma) | ||
253 | *(1.0 + 2.0*sigma)*(1.0 + sigma)*moments[9] | ||
254 | + sigma*(-36.0*(1.0 + 7.0*sigma)*(1.0 + 6.0*sigma) | ||
255 | *(1.0 + 5.0*sigma)*(1.0 + 4.0*sigma)*(1.0 + 3.0*sigma) | ||
256 | *(1.0 + 2.0*sigma)*(1.0 + sigma)*moments[8] | ||
257 | + sigma*(462.0*(1.0 + 6.0*sigma)*(1.0 + 5.0*sigma) | ||
258 | *(1.0 + 4.0*sigma)*(1.0 + 3.0*sigma)*(1.0 + 2.0*sigma) | ||
259 | *(1.0 + sigma)*moments[7] + sigma*(-2646.0*(1.0 + 5.0*sigma) | ||
260 | *(1.0 + 4.0*sigma)*(1.0 + 3.0*sigma)*(1.0 + 2.0*sigma) | ||
261 | *(1.0 + sigma)*moments[6] + sigma*(6951.0*(1.0 + 4.0*sigma) | ||
262 | *(1.0 + 3.0*sigma)*(1.0 + 2.0*sigma)*(1.0 + sigma)*moments[5] | ||
263 | + sigma*(-7770.0*(1.0 + 3.0*sigma)*(1.0 + 2.0*sigma) | ||
264 | *(1.0 + sigma)*moments[4] + sigma*(3025.0*(1.0 + 2.0*sigma) | ||
265 | *(1.0 + sigma)*moments[3] + sigma*(-255.0*(1.0 + sigma) | ||
266 | *moments[2] + moments[1]*sigma))))))); | ||
267 | |||
268 | momentsStar[10] = (1.0 + 9.0*sigma)*(1.0 + 8.0*sigma)*(1.0 + 7.0*sigma) | ||
269 | *(1.0 + 6.0*sigma)*(1.0 + 5.0*sigma)*(1.0 + 4.0*sigma) | ||
270 | *(1.0 + 3.0*sigma)*(1.0 + 2.0*sigma)*(1.0 + sigma)*moments[10] | ||
271 | + sigma*(-45.0*(1.0 + 8.0*sigma)*(1.0 + 7.0*sigma) | ||
272 | *(1.0 + 6.0*sigma)*(1.0 + 5.0*sigma)*(1.0 + 4.0*sigma) | ||
273 | *(1.0 + 3.0*sigma)*(1.0 + 2.0*sigma)*(1.0 + sigma)*moments[9] | ||
274 | + sigma*(750.0*(1.0 + 7.0*sigma)*(1.0 + 6.0*sigma) | ||
275 | *(1.0 + 5.0*sigma)*(1.0 + 4.0*sigma)*(1.0 + 3.0*sigma) | ||
276 | *(1.0 + 2.0*sigma)*(1.0 + sigma)*moments[8] | ||
277 | + sigma*(-5880.0*(1.0 + 6.0*sigma)*(1.0 + 5.0*sigma) | ||
278 | *(1.0 + 4.0*sigma)*(1.0 + 3.0*sigma)*(1.0 + 2.0*sigma) | ||
279 | *(1.0 + sigma)*moments[7] + sigma*(22827.0*(1.0 + 5.0*sigma) | ||
280 | *(1.0 + 4.0*sigma)*(1.0 + 3.0*sigma)*(1.0 + 2.0*sigma) | ||
281 | *(1.0 + sigma)*moments[6] + sigma*(-42525.0*(1.0 + 4.0*sigma) | ||
282 | *(1.0 + 3.0*sigma)*(1.0 + 2.0*sigma)*(1.0 + sigma)*moments[5] | ||
283 | + sigma*(34105.0*(1.0 + 3.0*sigma)*(1.0 + 2.0*sigma) | ||
284 | *(1.0 + sigma)*moments[4] + sigma*(-9330.0*(1.0 + 2.0*sigma) | ||
285 | *(1.0 + sigma)*moments[3] + sigma*(511.0*(1.0 + sigma) | ||
286 | *moments[2] - moments[1]*sigma)))))))); | ||
287 | } | ||
288 | } | ||
289 | |||
290 | Foam::scalar Foam::betaEQMOM::m2N | ||
291 | ( | ||
292 | scalar sigma, | ||
293 | univariateMomentSet momentsStar | ||
294 | ) | ||
295 | { | ||
296 | label nMomentsStar = momentsStar.size(); | ||
297 | |||
298 | if (momentsStar.nRealizableMoments() >= nMomentsStar - 1) | ||
299 | { | ||
300 | univariateMomentSet m(nMomentsStar, 0.0, "Gauss", "01"); | ||
301 | momentsStarToMoments(sigma, m, momentsStar); | ||
302 | |||
303 | return m.last(); | ||
304 | } | ||
305 | |||
306 | return GREAT; | ||
307 | } | ||
308 | |||
309 | void Foam::betaEQMOM::recurrenceRelation | ||
310 | ( | ||
311 | scalarDiagonalMatrix& a, | ||
312 | scalarDiagonalMatrix& b, | ||
313 | scalar primaryAbscissa, | ||
314 | scalar sigma | ||
315 | ) | ||
316 | { | ||
317 | scalar alpha = (1.0 - primaryAbscissa)/sigma - 1.0; | ||
318 | scalar beta = primaryAbscissa/sigma - 1.0; | ||
319 | scalar nab = 0.0; | ||
320 | |||
321 | a[0] = (beta - alpha)/(alpha + beta + 2.0); | ||
322 | |||
323 | b[0] = exp((alpha + beta + 1.0)*log(2.0) + lgamma(alpha + 1.0) | ||
324 | + lgamma(beta + 1.0) - lgamma(alpha + beta + 2.0)); | ||
325 | |||
326 | a[1] = (sqr(beta) - sqr(alpha))/((alpha + beta + 2.0)*(alpha + beta + 4.0)); | ||
327 | |||
328 | b[1] = (4.0*(alpha + 1.0)*(beta + 1.0)) | ||
329 | /(sqr(alpha + beta + 2.0)*(alpha + beta + 3.0)); | ||
330 | |||
331 | for(label i = 2; i < a.size(); i++) | ||
332 | { | ||
333 | nab = 2.0*scalar(i) + alpha + beta; | ||
334 | |||
335 | a[i] = (sqr(beta) - sqr(alpha))/(nab*(nab + 2.0)); | ||
336 | |||
337 | b[i] = (4.0*(scalar(i) + alpha)*(scalar(i) + beta)*scalar(i) | ||
338 | *(scalar(i)+ alpha + beta))/(sqr(nab)*(nab + 1.0)*(nab - 1.0)); | ||
339 | } | ||
340 | } | ||
341 | |||
342 | Foam::scalar Foam::betaEQMOM::sigmaMax(univariateMomentSet& moments) | ||
343 | { | ||
344 | scalar p2 = (moments[0]*moments[2] - sqr(moments[1])) | ||
345 | /(moments[0]*moments[1] - sqr(moments[1])); | ||
346 | |||
347 | //Info << "p2 = " << p2 << endl; | ||
348 | |||
349 | return p2/(1.0 - p2); | ||
350 | } | ||
351 | |||
352 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/extentedMomentInversion/beta/betaEQMOM.H added (mode: 100644) (index 0000000..0aa1691) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2014-2016 Alberto Passalacqua | ||
6 | \\/ M anipulation | | ||
7 | ------------------------------------------------------------------------------- | ||
8 | License | ||
9 | This file is derivative work 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 | Class | ||
25 | Foam::betaEQMOM | ||
26 | |||
27 | Description | ||
28 | Extended quadrature method of moments with beta kernel density functions. | ||
29 | |||
30 | References | ||
31 | \verbatim | ||
32 | "An extended quadrature method of moments for population balance | ||
33 | equations" | ||
34 | C Yuan, F Laurent, R O Fox | ||
35 | Journal of Aerosol Science | ||
36 | Volume 51, Pages 1-23, 2012 | ||
37 | \endverbatim | ||
38 | |||
39 | \verbatim | ||
40 | "The theory of canonical moments with applications in Statistics, | ||
41 | Probability and Analysis" | ||
42 | H Dette, W J Studden | ||
43 | Wiley & Sons, 1997 | ||
44 | \endverbatim | ||
45 | |||
46 | \verbatim | ||
47 | "Orthogonal Polynomials: Computational and Approximation" | ||
48 | W Gautschi | ||
49 | Oxford University Press, USA, 2004 | ||
50 | \endverbatim | ||
51 | |||
52 | SourceFiles | ||
53 | betaEQMOM.C | ||
54 | |||
55 | \*---------------------------------------------------------------------------*/ | ||
56 | |||
57 | #ifndef betaEQMOM_H | ||
58 | #define betaEQMOM_H | ||
59 | |||
60 | #include "extendedMomentInversion.H" | ||
61 | |||
62 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
63 | |||
64 | namespace Foam | ||
65 | { | ||
66 | /*---------------------------------------------------------------------------*\ | ||
67 | Class betaEQMOM Declaration | ||
68 | \*---------------------------------------------------------------------------*/ | ||
69 | |||
70 | class betaEQMOM | ||
71 | : | ||
72 | public extendedMomentInversion | ||
73 | { | ||
74 | public: | ||
75 | |||
76 | //- Runtime type information | ||
77 | TypeName("beta"); | ||
78 | |||
79 | |||
80 | // Constructors | ||
81 | |||
82 | //- Construct from a dictionary and label | ||
83 | betaEQMOM | ||
84 | ( | ||
85 | const dictionary& dict, | ||
86 | const label nMoments, | ||
87 | const label nSecondaryNodes | ||
88 | ); | ||
89 | |||
90 | |||
91 | //- Destructor | ||
92 | virtual ~betaEQMOM(); | ||
93 | |||
94 | |||
95 | // Member Functions | ||
96 | |||
97 | //- Computes the secondary abscissa | ||
98 | virtual scalar secondaryAbscissa | ||
99 | ( | ||
100 | scalar primaryAbscissa, | ||
101 | scalar secondaryAbscissa, | ||
102 | scalar sigma | ||
103 | ); | ||
104 | |||
105 | //- Compute moments from starred moments | ||
106 | virtual void momentsStarToMoments | ||
107 | ( | ||
108 | scalar sigma, | ||
109 | univariateMomentSet& moments, | ||
110 | const univariateMomentSet& momentsStar | ||
111 | ); | ||
112 | |||
113 | //- Compute the starred moments | ||
114 | virtual void momentsToMomentsStar | ||
115 | ( | ||
116 | scalar sigma, | ||
117 | const univariateMomentSet& moments, | ||
118 | univariateMomentSet& momentsStar | ||
119 | ); | ||
120 | |||
121 | //- Compute the last moment from starred moments | ||
122 | virtual scalar m2N(scalar sigma, univariateMomentSet momentsStar); | ||
123 | |||
124 | //- Recurrence relation for polynomials orthogonal to kernel function | ||
125 | virtual void recurrenceRelation | ||
126 | ( | ||
127 | scalarDiagonalMatrix& a, | ||
128 | scalarDiagonalMatrix& b, | ||
129 | scalar primaryAbscissa, | ||
130 | scalar sigma | ||
131 | ); | ||
132 | |||
133 | //- Compute maximum value of sigma to ensure realizability | ||
134 | virtual scalar sigmaMax(univariateMomentSet& moments); | ||
135 | |||
136 | }; | ||
137 | |||
138 | |||
139 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
140 | |||
141 | } // End namespace Foam | ||
142 | |||
143 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
144 | |||
145 | #endif | ||
146 | |||
147 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/extentedMomentInversion/extendedMomentInversion/extendedMomentInversion.C added (mode: 100644) (index 0000000..8e01246) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2014-2016 Alberto Passalacqua | ||
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 "extendedMomentInversion.H" | ||
27 | #include "eigenSolver.H" | ||
28 | #include "IOmanip.H" | ||
29 | |||
30 | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // | ||
31 | |||
32 | namespace Foam | ||
33 | { | ||
34 | defineTypeNameAndDebug(extendedMomentInversion, 0); | ||
35 | defineRunTimeSelectionTable(extendedMomentInversion, dictionary); | ||
36 | } | ||
37 | |||
38 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | ||
39 | |||
40 | Foam::extendedMomentInversion::extendedMomentInversion | ||
41 | ( | ||
42 | const dictionary& dict, | ||
43 | const label nMoments, | ||
44 | const label nSecondaryNodes | ||
45 | ) | ||
46 | : | ||
47 | nMoments_(nMoments), | ||
48 | nPrimaryNodes_((nMoments_ - 1)/2), | ||
49 | nSecondaryNodes_(nSecondaryNodes), | ||
50 | primaryWeights_(nPrimaryNodes_, 0.0), | ||
51 | primaryAbscissae_(nPrimaryNodes_, 0.0), | ||
52 | sigma_(0.0), | ||
53 | secondaryWeights_(nPrimaryNodes_, nSecondaryNodes_), | ||
54 | secondaryAbscissae_(nPrimaryNodes_, nSecondaryNodes_), | ||
55 | minMean_(dict.lookupOrDefault("minMean", 1.0e-8)), | ||
56 | minVariance_(dict.lookupOrDefault("minVariance", 1.0e-8)), | ||
57 | maxSigmaIter_(dict.lookupOrDefault<label>("maxSigmaIter", 1000)), | ||
58 | momentsTol_(dict.lookupOrDefault("momentsTol", 1.0e-12)), | ||
59 | sigmaMin_(dict.lookupOrDefault("sigmaMin", 1.0e-6)), | ||
60 | sigmaTol_(dict.lookupOrDefault("sigmaTol", 1.0e-12)), | ||
61 | targetFunctionTol_(dict.lookupOrDefault("targetFunctionTol", 1.0e-12)), | ||
62 | foundUnrealizableSigma_(false), | ||
63 | nullSigma_(false) | ||
64 | {} | ||
65 | |||
66 | |||
67 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | ||
68 | |||
69 | Foam::extendedMomentInversion::~extendedMomentInversion() | ||
70 | {} | ||
71 | |||
72 | |||
73 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | ||
74 | void Foam::extendedMomentInversion::invert(const univariateMomentSet& moments) | ||
75 | { | ||
76 | univariateMomentSet m(moments); | ||
77 | |||
78 | reset(); | ||
79 | |||
80 | // Terminate execution if negative number density is encountered | ||
81 | if (m[0] < 0.0) | ||
82 | { | ||
83 | FatalErrorInFunction | ||
84 | << "The zero-order moment is negative." << nl | ||
85 | << " Moment set: " << m | ||
86 | << abort(FatalError); | ||
87 | } | ||
88 | |||
89 | // Exclude cases where the zero-order moment is very small to avoid | ||
90 | // problems in the inversion due to round-off error | ||
91 | if (m[0] < SMALL) | ||
92 | { | ||
93 | sigma_ = 0.0; | ||
94 | nullSigma_ = true; | ||
95 | |||
96 | return; | ||
97 | } | ||
98 | |||
99 | label nRealizableMoments = m.nRealizableMoments(); | ||
100 | |||
101 | // If the moment set is on the boundary of the moment space, the | ||
102 | // distribution will be reconstructed by a summation of Dirac delta, | ||
103 | // and no attempt to use the extended quadrature method of moments is made. | ||
104 | if (m.isOnMomentSpaceBoundary()) | ||
105 | { | ||
106 | sigma_ = 0.0; | ||
107 | nullSigma_ = true; | ||
108 | m.invert(); | ||
109 | secondaryQuadrature(m); | ||
110 | |||
111 | return; | ||
112 | } | ||
113 | |||
114 | if (nRealizableMoments % 2 == 0) | ||
115 | { | ||
116 | // If the number of realizable moments is even, we apply the standard | ||
117 | // QMOM directly to maximize the number of preserved moments. | ||
118 | |||
119 | m.invert(); | ||
120 | sigma_ = 0.0; | ||
121 | nullSigma_ = true; | ||
122 | secondaryQuadrature(m); | ||
123 | } | ||
124 | else | ||
125 | { | ||
126 | // Do not attempt the EQMOM reconstruction if mean or variance of the | ||
127 | // moment set are small to avoid numerical problems. These problems are | ||
128 | // particularly acute in the calculation of the recurrence relationship | ||
129 | // of the Jacobi orthogonal polynomials used for the beta kernel density | ||
130 | // function. | ||
131 | if (m[1]/m[0] < minMean_ || (m[2]/m[0] - sqr(m[1]/m[0])) < minVariance_) | ||
132 | { | ||
133 | sigma_ = 0.0; | ||
134 | nullSigma_ = true; | ||
135 | |||
136 | m.invert(); | ||
137 | secondaryQuadrature(m); | ||
138 | |||
139 | return; | ||
140 | } | ||
141 | |||
142 | // Resizing the moment set to avoid copying again | ||
143 | m.resize(nRealizableMoments); | ||
144 | |||
145 | // Local set of starred moments | ||
146 | univariateMomentSet mStar | ||
147 | ( | ||
148 | nRealizableMoments, | ||
149 | 0.0, | ||
150 | m.quadratureType(), | ||
151 | m.support() | ||
152 | ); | ||
153 | |||
154 | // Compute target function for sigma = 0 | ||
155 | scalar sigmaLow = 0.0; | ||
156 | scalar fLow = targetFunction(sigmaLow, m, mStar); | ||
157 | sigma_ = sigmaLow; | ||
158 | |||
159 | // Check if sigma = 0 is root | ||
160 | if (mag(fLow) <= targetFunctionTol_) | ||
161 | { | ||
162 | m.invert(); | ||
163 | sigma_ = 0.0; | ||
164 | nullSigma_ = true; | ||
165 | secondaryQuadrature(m); | ||
166 | |||
167 | return; | ||
168 | } | ||
169 | |||
170 | // Compute target function for sigma = sigmaMax | ||
171 | scalar sigMax = sigmaMax(m); | ||
172 | scalar sigmaHigh = sigMax; | ||
173 | scalar fHigh = targetFunction(sigmaHigh, m, mStar); | ||
174 | |||
175 | // This should not happen with the new algorithm | ||
176 | if (fLow*fHigh > 0) | ||
177 | { | ||
178 | // Root not found. Minimize target function in [0, sigma_] | ||
179 | sigma_ = minimizeTargetFunction(0, sigmaHigh, m, mStar); | ||
180 | |||
181 | // If sigma_ is small, use QMOM | ||
182 | if (mag(sigma_) < sigmaMin_) | ||
183 | { | ||
184 | m.invert(); | ||
185 | sigma_ = 0.0; | ||
186 | nullSigma_ = true; | ||
187 | secondaryQuadrature(m); | ||
188 | |||
189 | return; | ||
190 | } | ||
191 | |||
192 | targetFunction(sigma_, m, mStar); | ||
193 | secondaryQuadrature(mStar); | ||
194 | |||
195 | return; | ||
196 | } | ||
197 | |||
198 | // Apply Ridder's algorithm to find sigma | ||
199 | for (label iter = 0; iter < maxSigmaIter_; iter++) | ||
200 | { | ||
201 | scalar fMid, sigmaMid; | ||
202 | |||
203 | sigmaMid = (sigmaLow + sigmaHigh)/2.0; | ||
204 | fMid = targetFunction(sigmaMid, m, mStar); | ||
205 | |||
206 | scalar s = sqrt(sqr(fMid) - fLow*fHigh); | ||
207 | |||
208 | if (s == 0.0) | ||
209 | { | ||
210 | FatalErrorInFunction | ||
211 | << "Singular value encountered searching for root." << nl | ||
212 | << " Moment set = " << m << nl | ||
213 | << " sigma = " << sigma_ << nl | ||
214 | << " fLow = " << fLow << nl | ||
215 | << " fMid = " << fMid << nl | ||
216 | << " fHigh = " << fHigh | ||
217 | << abort(FatalError); | ||
218 | } | ||
219 | |||
220 | sigma_ = sigmaMid + (sigmaMid - sigmaLow)*sign(fLow - fHigh)*fMid/s; | ||
221 | |||
222 | momentsToMomentsStar(sigma_, m, mStar); | ||
223 | |||
224 | scalar fNew = targetFunction(sigma_, m, mStar); | ||
225 | scalar dSigma = (sigmaHigh - sigmaLow)/2.0; | ||
226 | |||
227 | // Check for convergence | ||
228 | if (mag(fNew) <= targetFunctionTol_ || mag(dSigma) <= sigmaTol_) | ||
229 | { | ||
230 | // Root finding converged | ||
231 | |||
232 | // If sigma_ is small, use QMOM | ||
233 | if (mag(sigma_) < sigmaMin_) | ||
234 | { | ||
235 | m.invert(); | ||
236 | sigma_ = 0.0; | ||
237 | nullSigma_ = true; | ||
238 | secondaryQuadrature(m); | ||
239 | |||
240 | return; | ||
241 | } | ||
242 | |||
243 | scalar momentError = normalizedMomentError(sigma_, m, mStar); | ||
244 | |||
245 | if | ||
246 | ( | ||
247 | momentError < momentsTol_ | ||
248 | ) | ||
249 | { | ||
250 | // Found a value of sigma that preserves all the moments | ||
251 | secondaryQuadrature(mStar); | ||
252 | |||
253 | return; | ||
254 | } | ||
255 | else | ||
256 | { | ||
257 | // Root not found. Minimize target function in [0, sigma_] | ||
258 | sigma_ = minimizeTargetFunction(0, sigma_, m, mStar); | ||
259 | |||
260 | // If sigma_ is small, use QMOM | ||
261 | if (mag(sigma_) < sigmaMin_) | ||
262 | { | ||
263 | m.invert(); | ||
264 | sigma_ = 0.0; | ||
265 | nullSigma_ = true; | ||
266 | secondaryQuadrature(m); | ||
267 | |||
268 | return; | ||
269 | } | ||
270 | |||
271 | targetFunction(sigma_, m, mStar); | ||
272 | secondaryQuadrature(mStar); | ||
273 | |||
274 | return; | ||
275 | } | ||
276 | } | ||
277 | else | ||
278 | { | ||
279 | // Root finding did not converge. Refine search. | ||
280 | |||
281 | if (fNew*fMid < 0 && sigma_ < sigmaMid) | ||
282 | { | ||
283 | sigmaLow = sigma_; | ||
284 | fLow = fNew; | ||
285 | sigmaHigh = sigmaMid; | ||
286 | fHigh = fMid; | ||
287 | } | ||
288 | else if (fNew*fMid < 0 && sigma_ > sigmaMid) | ||
289 | { | ||
290 | sigmaLow = sigmaMid; | ||
291 | fLow = fMid; | ||
292 | sigmaHigh = sigma_; | ||
293 | fHigh = fNew; | ||
294 | } | ||
295 | else if (fNew*fLow < 0) | ||
296 | { | ||
297 | sigmaHigh = sigma_; | ||
298 | fHigh = fNew; | ||
299 | } | ||
300 | else if (fNew*fHigh < 0) | ||
301 | { | ||
302 | sigmaLow = sigma_; | ||
303 | fLow = fNew; | ||
304 | } | ||
305 | } | ||
306 | } | ||
307 | |||
308 | FatalErrorInFunction | ||
309 | << "Number of iterations exceeded." << nl | ||
310 | << " Max allowed iterations = " << maxSigmaIter_ | ||
311 | << abort(FatalError); | ||
312 | } | ||
313 | } | ||
314 | |||
315 | void Foam::extendedMomentInversion::reset() | ||
316 | { | ||
317 | foundUnrealizableSigma_ = false; | ||
318 | nullSigma_ = false; | ||
319 | |||
320 | forAll(primaryWeights_, pNodei) | ||
321 | { | ||
322 | primaryWeights_[pNodei] = 0.0; | ||
323 | primaryAbscissae_[pNodei] = 0.0; | ||
324 | |||
325 | for (label sNodei = 0; sNodei < nSecondaryNodes_; sNodei++) | ||
326 | { | ||
327 | secondaryWeights_[pNodei][sNodei] = 0.0; | ||
328 | secondaryAbscissae_[pNodei][sNodei] = 0.0; | ||
329 | } | ||
330 | } | ||
331 | } | ||
332 | |||
333 | Foam::scalar Foam::extendedMomentInversion::minimizeTargetFunction | ||
334 | ( | ||
335 | scalar sigmaLow, | ||
336 | scalar sigmaHigh, | ||
337 | const univariateMomentSet& moments, | ||
338 | univariateMomentSet& momentsStar | ||
339 | ) | ||
340 | { | ||
341 | const scalar goldenRatio = (sqrt(5.0) - 1.0)/2.0; | ||
342 | |||
343 | scalar a = sigmaLow; | ||
344 | scalar b = sigmaHigh; | ||
345 | scalar x = b - goldenRatio*(b - a); | ||
346 | scalar y = a + goldenRatio*(b - a); | ||
347 | |||
348 | label iter = 0; | ||
349 | |||
350 | while (mag (x - y) > sigmaTol_ && iter < maxSigmaIter_) | ||
351 | { | ||
352 | // Square the target function to find closest value to zero, | ||
353 | // independently from the sign of the function | ||
354 | scalar fx = sqr(targetFunction(x, moments, momentsStar)); | ||
355 | scalar fy = sqr(targetFunction(y, moments, momentsStar)); | ||
356 | |||
357 | if (fx < fy) | ||
358 | { | ||
359 | b = y; | ||
360 | y = x; | ||
361 | x = b - goldenRatio*(b - a); | ||
362 | } | ||
363 | else | ||
364 | { | ||
365 | a = x; | ||
366 | x = y; | ||
367 | y = a + goldenRatio*(b - a); | ||
368 | } | ||
369 | |||
370 | iter++; | ||
371 | } | ||
372 | |||
373 | if (iter > maxSigmaIter_) | ||
374 | { | ||
375 | FatalErrorInFunction | ||
376 | << "Number of iterations exceeded." << nl | ||
377 | << " Max allowed iterations = " << maxSigmaIter_ | ||
378 | << abort(FatalError); | ||
379 | } | ||
380 | |||
381 | return (a + b)/2.0; | ||
382 | } | ||
383 | |||
384 | Foam::scalar Foam::extendedMomentInversion::normalizedMomentError | ||
385 | ( | ||
386 | scalar sigma, | ||
387 | const univariateMomentSet& moments, | ||
388 | univariateMomentSet& momentsStar | ||
389 | ) | ||
390 | { | ||
391 | scalar norm = 0.0; | ||
392 | |||
393 | targetFunction(sigma, moments, momentsStar); | ||
394 | |||
395 | univariateMomentSet approximatedMoments | ||
396 | ( | ||
397 | moments.size(), | ||
398 | 0.0, | ||
399 | moments.quadratureType(), | ||
400 | moments.support() | ||
401 | ); | ||
402 | |||
403 | momentsStarToMoments(sigma, approximatedMoments, momentsStar); | ||
404 | |||
405 | for (label momenti = 0; momenti < moments.size(); momenti++) | ||
406 | { | ||
407 | norm += mag(1.0 - approximatedMoments[momenti]/moments[momenti]); | ||
408 | } | ||
409 | |||
410 | return sqrt(norm); | ||
411 | } | ||
412 | |||
413 | void Foam::extendedMomentInversion::secondaryQuadrature | ||
414 | ( | ||
415 | const univariateMomentSet& moments | ||
416 | ) | ||
417 | { | ||
418 | const scalarDiagonalMatrix& pWeights(moments.weights()); | ||
419 | const scalarDiagonalMatrix& pAbscissae(moments.abscissae()); | ||
420 | |||
421 | // Copy primary weights and abscissae | ||
422 | forAll(pWeights, pNodei) | ||
423 | { | ||
424 | primaryWeights_[pNodei] = pWeights[pNodei]; | ||
425 | primaryAbscissae_[pNodei] = pAbscissae[pNodei]; | ||
426 | } | ||
427 | |||
428 | if (!nullSigma_) | ||
429 | { | ||
430 | // Coefficients of the recurrence relation | ||
431 | scalarDiagonalMatrix a(nSecondaryNodes_, 0.0); | ||
432 | scalarDiagonalMatrix b(nSecondaryNodes_, 0.0); | ||
433 | |||
434 | forAll(pWeights, pNodei) | ||
435 | { | ||
436 | // Compute coefficients of the recurrence relation | ||
437 | recurrenceRelation(a, b, primaryAbscissae_[pNodei], sigma_); | ||
438 | |||
439 | // Define the Jacobi matrix | ||
440 | scalarSquareMatrix J(nSecondaryNodes_, 0.0); | ||
441 | |||
442 | // Fill diagonal of Jacobi matrix | ||
443 | forAll(a, ai) | ||
444 | { | ||
445 | J[ai][ai] = a[ai]; | ||
446 | } | ||
447 | |||
448 | // Fill off-diagonal terms of the Jacobi matrix | ||
449 | for (label bi = 0; bi < nSecondaryNodes_ - 1; bi++) | ||
450 | { | ||
451 | J[bi][bi + 1] = Foam::sqrt(b[bi + 1]); | ||
452 | J[bi + 1][bi] = J[bi][bi + 1]; | ||
453 | } | ||
454 | |||
455 | // Compute Gaussian quadrature used to find secondary quadrature | ||
456 | eigenSolver JEig(J, true); | ||
457 | |||
458 | const scalarDiagonalMatrix& JEigenvaluesRe(JEig.eigenvaluesRe()); | ||
459 | |||
460 | // Compute secondary weights before normalization and calculate sum | ||
461 | for (label sNodei = 0; sNodei < nSecondaryNodes_; sNodei++) | ||
462 | { | ||
463 | secondaryWeights_[pNodei][sNodei] | ||
464 | = sqr(JEig.eigenvectors()[0][sNodei]); | ||
465 | |||
466 | secondaryAbscissae_[pNodei][sNodei] = | ||
467 | secondaryAbscissa(primaryAbscissae_[pNodei], | ||
468 | JEigenvaluesRe[sNodei], sigma_); | ||
469 | } | ||
470 | } | ||
471 | |||
472 | // Set weights and abscissae of unused nodes to zero | ||
473 | for (label pNodei = pWeights.size(); pNodei < nPrimaryNodes_; pNodei++) | ||
474 | { | ||
475 | primaryWeights_[pNodei] = 0.0; | ||
476 | primaryAbscissae_[pNodei] = 0.0; | ||
477 | |||
478 | for (label sNodei = 0; sNodei < nSecondaryNodes_; sNodei++) | ||
479 | { | ||
480 | secondaryWeights_[pNodei][sNodei] = 0.0; | ||
481 | secondaryAbscissae_[pNodei][sNodei] = 0.0; | ||
482 | } | ||
483 | } | ||
484 | } | ||
485 | else | ||
486 | { | ||
487 | // Manage case with null sigma to avoid redefining source terms | ||
488 | forAll(pWeights, pNodei) | ||
489 | { | ||
490 | secondaryWeights_[pNodei][0] = 1.0; | ||
491 | secondaryAbscissae_[pNodei][0] = primaryAbscissae_[pNodei]; | ||
492 | |||
493 | for (label sNodei = 1; sNodei < nSecondaryNodes_; sNodei++) | ||
494 | { | ||
495 | secondaryWeights_[pNodei][sNodei] = 0.0; | ||
496 | secondaryAbscissae_[pNodei][sNodei] = 0.0; | ||
497 | } | ||
498 | } | ||
499 | |||
500 | // Set weights and abscissae of unused nodes to zero | ||
501 | for (label pNodei = pWeights.size(); pNodei < nPrimaryNodes_; pNodei++) | ||
502 | { | ||
503 | primaryWeights_[pNodei] = 0.0; | ||
504 | primaryAbscissae_[pNodei] = 0.0; | ||
505 | |||
506 | for (label sNodei = 0; sNodei < nSecondaryNodes_; sNodei++) | ||
507 | { | ||
508 | secondaryWeights_[pNodei][sNodei] = 0.0; | ||
509 | secondaryAbscissae_[pNodei][sNodei] = 0.0; | ||
510 | } | ||
511 | } | ||
512 | } | ||
513 | } | ||
514 | |||
515 | Foam::scalar Foam::extendedMomentInversion::targetFunction | ||
516 | ( | ||
517 | scalar sigma, | ||
518 | const univariateMomentSet& moments, | ||
519 | univariateMomentSet& momentsStar | ||
520 | ) | ||
521 | { | ||
522 | momentsToMomentsStar(sigma, moments, momentsStar); | ||
523 | momentsStar.invert(); | ||
524 | momentsStar.update(); | ||
525 | |||
526 | scalar lastMoment = moments.last(); | ||
527 | |||
528 | return (lastMoment - m2N(sigma, momentsStar))/lastMoment; | ||
529 | } | ||
530 | |||
531 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/extentedMomentInversion/extendedMomentInversion/extendedMomentInversion.H added (mode: 100644) (index 0000000..899d9ac) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2014-2016 Alberto Passalacqua | ||
6 | \\/ M anipulation | | ||
7 | ------------------------------------------------------------------------------- | ||
8 | License | ||
9 | This file is derivative work 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 | Class | ||
25 | Foam::extendedMomentInversion | ||
26 | |||
27 | Description | ||
28 | Abstract class to allow run-time selection of the algorithm to be used | ||
29 | for the extended quadrature method of moments. | ||
30 | |||
31 | References | ||
32 | \verbatim | ||
33 | "An extended quadrature method of moments for population balance | ||
34 | equations" | ||
35 | C Yuan, F Laurent, R O Fox | ||
36 | Journal of Aerosol Science | ||
37 | Volume 51, Pages 1-23, 2012 | ||
38 | \endverbatim | ||
39 | |||
40 | \verbatim | ||
41 | "The theory of canonical moments with applications in Statistics, | ||
42 | Probability and Analysis" | ||
43 | H Dette, W J Studden | ||
44 | Wiley & Sons, 1997 | ||
45 | \endverbatim | ||
46 | |||
47 | \verbatim | ||
48 | "Orthogonal Polynomials: Computation and Approximation" | ||
49 | W Gautschi | ||
50 | Oxford University Press, 2004 | ||
51 | \endverbatim | ||
52 | |||
53 | SourceFiles | ||
54 | extendedMomentInversion.C | ||
55 | newExtendedMomentInversion.C | ||
56 | |||
57 | \*---------------------------------------------------------------------------*/ | ||
58 | |||
59 | #ifndef extendedMomentInversion_H | ||
60 | #define extendedMomentInversion_H | ||
61 | |||
62 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
63 | |||
64 | #include "scalar.H" | ||
65 | #include "scalarMatrices.H" | ||
66 | #include "dictionary.H" | ||
67 | #include "runTimeSelectionTables.H" | ||
68 | #include "univariateMomentSet.H" | ||
69 | |||
70 | namespace Foam | ||
71 | { | ||
72 | |||
73 | /*---------------------------------------------------------------------------*\ | ||
74 | Class extendedMomentInversion Declaration | ||
75 | \*---------------------------------------------------------------------------*/ | ||
76 | |||
77 | class extendedMomentInversion | ||
78 | { | ||
79 | // Private member functions | ||
80 | |||
81 | //- Attempt to find a min or max of the target function on an interval | ||
82 | scalar minimizeTargetFunction | ||
83 | ( | ||
84 | scalar sigmaLow, | ||
85 | scalar sigmaHigh, | ||
86 | const univariateMomentSet& moments, | ||
87 | univariateMomentSet& momentsStar | ||
88 | ); | ||
89 | |||
90 | //- Reset inverter | ||
91 | void reset(); | ||
92 | |||
93 | //- Compute secondary weigths and abscissae | ||
94 | void secondaryQuadrature(const univariateMomentSet& moments); | ||
95 | |||
96 | //- Compute target function whose root is sigma_ | ||
97 | scalar targetFunction | ||
98 | ( | ||
99 | scalar sigma, | ||
100 | const univariateMomentSet& moments, | ||
101 | univariateMomentSet& momentsStar | ||
102 | ); | ||
103 | |||
104 | //- Disallow default bitwise copy construct | ||
105 | extendedMomentInversion(const extendedMomentInversion&); | ||
106 | |||
107 | //- Disallow default bitwise assignment | ||
108 | void operator=(const extendedMomentInversion&); | ||
109 | |||
110 | |||
111 | protected: | ||
112 | |||
113 | // Protected data | ||
114 | |||
115 | //- Number of moments | ||
116 | label nMoments_; | ||
117 | |||
118 | //- Number of primary quadrature nodes | ||
119 | label nPrimaryNodes_; | ||
120 | |||
121 | //- Number of secondary quadrature nodes | ||
122 | label nSecondaryNodes_; | ||
123 | |||
124 | //- Primary quadrature weights | ||
125 | scalarDiagonalMatrix primaryWeights_; | ||
126 | |||
127 | //- Primary quadrature abscissae | ||
128 | scalarDiagonalMatrix primaryAbscissae_; | ||
129 | |||
130 | //- Parameter sigma of the kernel density function | ||
131 | scalar sigma_; | ||
132 | |||
133 | //- Secondary quadrature weights | ||
134 | scalarRectangularMatrix secondaryWeights_; | ||
135 | |||
136 | //- Secondary quadrature abscissae | ||
137 | scalarRectangularMatrix secondaryAbscissae_; | ||
138 | |||
139 | //- Minimum mean to perform EQMOM reconstruction | ||
140 | scalar minMean_; | ||
141 | |||
142 | //- Minimum variance to perform EQMOM reconstruction | ||
143 | scalar minVariance_; | ||
144 | |||
145 | //- Maximum number of iterations allowed to find sigma_ | ||
146 | label maxSigmaIter_; | ||
147 | |||
148 | //- Tolerance on moment conservation | ||
149 | scalar momentsTol_; | ||
150 | |||
151 | //- Minimum allowed value of the parameter sigma of the kernel density | ||
152 | // function. Below this value, QMOM is used. | ||
153 | scalar sigmaMin_; | ||
154 | |||
155 | //- Tolerance for the change in the sigma parameter | ||
156 | scalar sigmaTol_; | ||
157 | |||
158 | //- Tolerance for the target function | ||
159 | scalar targetFunctionTol_; | ||
160 | |||
161 | //- Bool to track values of sigma_ that lead to unrealizable moments | ||
162 | bool foundUnrealizableSigma_; | ||
163 | |||
164 | //- Bool to track if sigma = 0 is root | ||
165 | bool nullSigma_; | ||
166 | |||
167 | //- Protected member functions | ||
168 | |||
169 | //- Computes kernel density function from abscissa and sigma | ||
170 | virtual scalar secondaryAbscissa | ||
171 | ( | ||
172 | scalar primaryAbscissa, | ||
173 | scalar secondaryAbscissa, | ||
174 | scalar sigma | ||
175 | ) = 0; | ||
176 | |||
177 | //- Compute moments from starred moments | ||
178 | virtual void momentsStarToMoments | ||
179 | ( | ||
180 | scalar sigma, | ||
181 | univariateMomentSet& moments, | ||
182 | const univariateMomentSet& momentsStar | ||
183 | ) = 0; | ||
184 | |||
185 | //- Compute the starred moments from moments | ||
186 | virtual void momentsToMomentsStar | ||
187 | ( | ||
188 | scalar sigma, | ||
189 | const univariateMomentSet& moments, | ||
190 | univariateMomentSet& momentsStar | ||
191 | ) = 0; | ||
192 | |||
193 | //- Compute the last moment from starred moments | ||
194 | virtual scalar m2N(scalar sigma, univariateMomentSet momentsStar) = 0; | ||
195 | |||
196 | //- Compute the normalized moment error | ||
197 | scalar normalizedMomentError | ||
198 | ( | ||
199 | scalar sigma, | ||
200 | const univariateMomentSet& moments, | ||
201 | univariateMomentSet& momentsStar | ||
202 | ); | ||
203 | |||
204 | //- Recurrence relation for polynomials orthogonal to kernel function | ||
205 | virtual void recurrenceRelation | ||
206 | ( | ||
207 | scalarDiagonalMatrix& a, | ||
208 | scalarDiagonalMatrix& b, | ||
209 | scalar primaryAbscissa, | ||
210 | scalar sigma | ||
211 | ) = 0; | ||
212 | |||
213 | //- Compute maximum value of sigma to ensure realizability | ||
214 | // The value is exact for the two-node case. For cases with a larger | ||
215 | // number of nodes, this provides an over-estimation of the maximum | ||
216 | // value of the sigma parameter which ensures moment realizability. | ||
217 | virtual scalar sigmaMax | ||
218 | ( | ||
219 | univariateMomentSet& moments | ||
220 | ) = 0; | ||
221 | |||
222 | |||
223 | public: | ||
224 | |||
225 | //- Runtime type information | ||
226 | TypeName("extendedMomentInversion"); | ||
227 | |||
228 | |||
229 | // Declare runtime construction | ||
230 | |||
231 | declareRunTimeSelectionTable | ||
232 | ( | ||
233 | autoPtr, | ||
234 | extendedMomentInversion, | ||
235 | dictionary, | ||
236 | ( | ||
237 | const dictionary& dict, | ||
238 | const label nMoments, | ||
239 | const label nSecondaryNodes | ||
240 | ), | ||
241 | (dict, nMoments, nSecondaryNodes) | ||
242 | ); | ||
243 | |||
244 | // Constructors | ||
245 | |||
246 | // Construct from dictionary and label | ||
247 | extendedMomentInversion | ||
248 | ( | ||
249 | const dictionary& dict, | ||
250 | const label nMoments, | ||
251 | const label nSecondaryNodes | ||
252 | ); | ||
253 | |||
254 | |||
255 | //- Destructor | ||
256 | virtual ~extendedMomentInversion(); | ||
257 | |||
258 | |||
259 | // Selectors | ||
260 | |||
261 | static autoPtr<extendedMomentInversion> New | ||
262 | ( | ||
263 | const dictionary& dict, | ||
264 | const label nMoments, | ||
265 | const label nSecondaryNodes | ||
266 | ); | ||
267 | |||
268 | |||
269 | // Member Functions | ||
270 | |||
271 | //- Invert moments to find weight, abscissae and sigma | ||
272 | void invert(const univariateMomentSet& moments); | ||
273 | |||
274 | //- Return number of moments | ||
275 | inline label nMoments() | ||
276 | { | ||
277 | return nMoments_; | ||
278 | } | ||
279 | |||
280 | //- Return number of primary quadrature nodes | ||
281 | inline label nPrimaryNodes() | ||
282 | { | ||
283 | return nPrimaryNodes_; | ||
284 | } | ||
285 | |||
286 | //- Return number of secondary quadrature nodes | ||
287 | inline label nSecondaryNodes() | ||
288 | { | ||
289 | return nSecondaryNodes_; | ||
290 | } | ||
291 | |||
292 | //- Return the value of the sigma parameter | ||
293 | inline scalar sigma() const | ||
294 | { | ||
295 | return sigma_; | ||
296 | } | ||
297 | |||
298 | //- Return primary quadrature weights | ||
299 | inline const scalarDiagonalMatrix& primaryWeights() const | ||
300 | { | ||
301 | return primaryWeights_; | ||
302 | } | ||
303 | |||
304 | //- Return primary quadrature abscissae | ||
305 | inline const scalarDiagonalMatrix& primaryAbscissae() const | ||
306 | { | ||
307 | return primaryAbscissae_; | ||
308 | } | ||
309 | |||
310 | //- Return secondary quadrature weights | ||
311 | inline const scalarRectangularMatrix& secondaryWeights() const | ||
312 | { | ||
313 | return secondaryWeights_; | ||
314 | } | ||
315 | |||
316 | //- Return secondary quadrature abscissae | ||
317 | inline const scalarRectangularMatrix& secondaryAbscissae() const | ||
318 | { | ||
319 | return secondaryAbscissae_; | ||
320 | } | ||
321 | |||
322 | }; | ||
323 | |||
324 | |||
325 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
326 | |||
327 | } // End namespace Foam | ||
328 | |||
329 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
330 | |||
331 | #endif | ||
332 | |||
333 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/extentedMomentInversion/extendedMomentInversion/newExtendedMomentInversion.C added (mode: 100644) (index 0000000..8a0f1ec) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2014-2016 Alberto Passalacqua | ||
6 | \\/ M anipulation | | ||
7 | ------------------------------------------------------------------------------- | ||
8 | License | ||
9 | This file is derivative work 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 "extendedMomentInversion.H" | ||
27 | |||
28 | // * * * * * * * * * * * * * * * * Selector * * * * * * * * * * * * * * * * // | ||
29 | |||
30 | Foam::autoPtr<Foam::extendedMomentInversion> Foam::extendedMomentInversion::New | ||
31 | ( | ||
32 | const dictionary& dict, | ||
33 | const label nMoments, | ||
34 | const label nSecondaryNodes | ||
35 | ) | ||
36 | { | ||
37 | word extendedMomentInversionType(dict.lookup("extendedMomentInversion")); | ||
38 | |||
39 | Info<< "Selecting extendedMomentInversion: " | ||
40 | << extendedMomentInversionType << endl; | ||
41 | |||
42 | dictionaryConstructorTable::iterator cstrIter = | ||
43 | dictionaryConstructorTablePtr_->find(extendedMomentInversionType); | ||
44 | |||
45 | if (cstrIter == dictionaryConstructorTablePtr_->end()) | ||
46 | { | ||
47 | FatalErrorInFunction | ||
48 | << "Unknown extendedMomentInversionType type " | ||
49 | << extendedMomentInversionType << endl << endl | ||
50 | << "Valid extendedMomentInversion types are : " << endl | ||
51 | << dictionaryConstructorTablePtr_->sortedToc() | ||
52 | << exit(FatalError); | ||
53 | } | ||
54 | |||
55 | return cstrIter()(dict, nMoments, nSecondaryNodes); | ||
56 | } | ||
57 | |||
58 | |||
59 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/extentedMomentInversion/gamma/gammaEQMOM.C added (mode: 100644) (index 0000000..d41dd7c) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2014-2015 Alberto Passalacqua | ||
6 | \\/ M anipulation | | ||
7 | ------------------------------------------------------------------------------- | ||
8 | License | ||
9 | This file is derivative work 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 "gammaEQMOM.H" | ||
27 | #include "scalar.H" | ||
28 | #include "scalarMatrices.H" | ||
29 | #include "constants.H" | ||
30 | #include "addToRunTimeSelectionTable.H" | ||
31 | |||
32 | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // | ||
33 | |||
34 | namespace Foam | ||
35 | { | ||
36 | defineTypeNameAndDebug(gammaEQMOM, 0); | ||
37 | |||
38 | addToRunTimeSelectionTable | ||
39 | ( | ||
40 | extendedMomentInversion, | ||
41 | gammaEQMOM, | ||
42 | dictionary | ||
43 | ); | ||
44 | } | ||
45 | |||
46 | |||
47 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | ||
48 | |||
49 | Foam::gammaEQMOM::gammaEQMOM | ||
50 | ( | ||
51 | const dictionary& dict, | ||
52 | const label nMoments, | ||
53 | const label nSecondaryNodes | ||
54 | ) | ||
55 | : | ||
56 | extendedMomentInversion(dict, nMoments, nSecondaryNodes) | ||
57 | {} | ||
58 | |||
59 | |||
60 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | ||
61 | |||
62 | Foam::gammaEQMOM::~gammaEQMOM() | ||
63 | {} | ||
64 | |||
65 | |||
66 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | ||
67 | Foam::scalar Foam::gammaEQMOM::secondaryAbscissa | ||
68 | ( | ||
69 | scalar primaryAbscissa, | ||
70 | scalar secondaryAbscissa, | ||
71 | scalar sigma | ||
72 | ) | ||
73 | { | ||
74 | return sigma*secondaryAbscissa; | ||
75 | } | ||
76 | |||
77 | void Foam::gammaEQMOM::momentsStarToMoments | ||
78 | ( | ||
79 | scalar sigma, | ||
80 | univariateMomentSet& moments, | ||
81 | const univariateMomentSet& momentsStar | ||
82 | ) | ||
83 | { | ||
84 | label nMom = moments.size(); | ||
85 | |||
86 | if (nMom >= 12) | ||
87 | { | ||
88 | FatalErrorInFunction | ||
89 | << "The number of moments is too large. The maximum number of" | ||
90 | << "moments allowed with the gamma kernel density function is 11.\n" | ||
91 | << "Moment transformation not implemented." | ||
92 | << abort(FatalError); | ||
93 | } | ||
94 | |||
95 | moments[0] = momentsStar[0]; | ||
96 | moments[1] = momentsStar[1]; | ||
97 | moments[2] = momentsStar[2] + sigma*momentsStar[1]; | ||
98 | |||
99 | if (nMom >= 5) | ||
100 | { | ||
101 | moments[3] = momentsStar[3] + sigma*(3.0*momentsStar[2] | ||
102 | + 2.0*sigma*momentsStar[1]); | ||
103 | |||
104 | moments[4] = momentsStar[4] + sigma*(6.0*momentsStar[3] | ||
105 | + sigma*(11.0*momentsStar[2] + 6.0*momentsStar[1]*sigma)); | ||
106 | } | ||
107 | |||
108 | if (nMom >= 7) | ||
109 | { | ||
110 | moments[5] = momentsStar[5] + sigma*(10.0*momentsStar[4] | ||
111 | + sigma*(35.0*momentsStar[3] + sigma*(50.0*momentsStar[2] | ||
112 | + 24.0*momentsStar[1]*sigma))); | ||
113 | |||
114 | moments[6] = momentsStar[6] + sigma*(15.0*momentsStar[5] | ||
115 | + sigma*(85.0*momentsStar[4] + sigma*(225.0*momentsStar[3] | ||
116 | + sigma*(274.0*momentsStar[2] + 120.0*momentsStar[1]*sigma)))); | ||
117 | } | ||
118 | |||
119 | if (nMom >= 9) | ||
120 | { | ||
121 | moments[7] = momentsStar[7] + sigma*(21.0*momentsStar[6] | ||
122 | + sigma*(175.0*momentsStar[5] + sigma*(735.0*momentsStar[4] | ||
123 | + sigma*(1624.0*momentsStar[3] + sigma*(1764.0*momentsStar[2] | ||
124 | + 720.0*momentsStar[1]*sigma))))); | ||
125 | |||
126 | moments[8] = momentsStar[8] + sigma*(28.0*momentsStar[7] | ||
127 | + sigma*(322.0*momentsStar[6] + sigma*(1960.0*momentsStar[5] | ||
128 | + sigma*(6769.0*momentsStar[4] + sigma*(13132.0*momentsStar[3] | ||
129 | + sigma*(13068.0*momentsStar[2] | ||
130 | + 5040.0*momentsStar[1]*sigma)))))); | ||
131 | } | ||
132 | |||
133 | if (nMom >= 11) | ||
134 | { | ||
135 | moments[9] = momentsStar[9] + sigma*(36.0*momentsStar[8] | ||
136 | + sigma*(546.0*momentsStar[7] + sigma*(4536.0*momentsStar[6] | ||
137 | + sigma*(22449.0*momentsStar[5] + sigma*(67284.0*momentsStar[4] | ||
138 | + sigma*(118124.0*momentsStar[3] | ||
139 | + sigma*(109584.0*momentsStar[2] | ||
140 | + 40320.0*momentsStar[1]*sigma))))))); | ||
141 | |||
142 | moments[10] = momentsStar[10] + sigma*(45.0*momentsStar[9] | ||
143 | + sigma*(870.0*momentsStar[8] + sigma*(9450.0*momentsStar[7] | ||
144 | + sigma*(63273.0*momentsStar[6] | ||
145 | + sigma*(269325.0*momentsStar[5] | ||
146 | + sigma*(723680.0*momentsStar[4] | ||
147 | + sigma*(1172700.0*momentsStar[3] | ||
148 | + sigma*(1026576.0*momentsStar[2] | ||
149 | + 362880.0*momentsStar[1]*sigma)))))))); | ||
150 | } | ||
151 | } | ||
152 | |||
153 | void Foam::gammaEQMOM::momentsToMomentsStar | ||
154 | ( | ||
155 | scalar sigma, | ||
156 | const univariateMomentSet& moments, | ||
157 | univariateMomentSet& momentsStar | ||
158 | ) | ||
159 | { | ||
160 | label nMom = moments.size(); | ||
161 | |||
162 | if (nMom >= 12) | ||
163 | { | ||
164 | FatalErrorInFunction | ||
165 | << "Moment transformation not implemented." | ||
166 | << abort(FatalError); | ||
167 | } | ||
168 | |||
169 | momentsStar[0] = moments[0]; | ||
170 | momentsStar[1] = moments[1]; | ||
171 | momentsStar[2] = moments[2] - sigma*moments[1]; | ||
172 | |||
173 | if (nMom >= 5) | ||
174 | { | ||
175 | momentsStar[3] = moments[3] + sigma*(-3.0*moments[2] | ||
176 | + moments[1]*sigma); | ||
177 | |||
178 | momentsStar[4] = moments[4] + sigma*(-6.0*moments[3] | ||
179 | + sigma*(7.0*moments[2] - moments[1]*sigma)); | ||
180 | } | ||
181 | |||
182 | if (nMom >= 7) | ||
183 | { | ||
184 | momentsStar[5] = moments[5] + sigma*(-10.0*moments[4] | ||
185 | + sigma*(25.0*moments[3] + sigma*(-15.0*moments[2] | ||
186 | + moments[1]*sigma))); | ||
187 | |||
188 | momentsStar[6] = moments[6] + sigma*(-15.0*moments[5] | ||
189 | + sigma*(65.0*moments[4] + sigma*(-90.0*moments[3] | ||
190 | + sigma*(31.0*moments[2] - moments[1]*sigma)))); | ||
191 | } | ||
192 | |||
193 | if (nMom >= 9) | ||
194 | { | ||
195 | momentsStar[7] = moments[7] + sigma*(-21.0*moments[6] | ||
196 | + sigma*(140.0*moments[5] + sigma*(-350.0*moments[4] | ||
197 | + sigma*(301.0*moments[3] + sigma*(-63.0*moments[2] | ||
198 | + moments[1]*sigma))))); | ||
199 | |||
200 | momentsStar[8] = moments[8] + sigma*(-28.0*moments[7] | ||
201 | + sigma*(266.0*moments[6] + sigma*(-1050.0*moments[5] | ||
202 | + sigma*(1701.0*moments[4] + sigma*(-966.0*moments[3] | ||
203 | + sigma*(127.0*moments[2] - moments[1]*sigma)))))); | ||
204 | } | ||
205 | |||
206 | if (nMom >= 11) | ||
207 | { | ||
208 | momentsStar[9] = moments[9] + sigma*(-36.0*moments[8] | ||
209 | + sigma*(462.0*moments[7] + sigma*(-2646.0*moments[6] | ||
210 | + sigma*(6951.0*moments[5] + sigma*(-7770.0*moments[4] | ||
211 | + sigma*(3025.0*moments[3] + sigma*(-255.0*moments[2] | ||
212 | + moments[1]*sigma))))))); | ||
213 | |||
214 | momentsStar[10] = moments[10] + sigma*(-45.0*moments[9] | ||
215 | + sigma*(750.0*moments[8] + sigma*(-5880.0*moments[7] | ||
216 | + sigma*(22827.0*moments[6] + sigma*(-42525.0*moments[5] | ||
217 | + sigma*(34105.0*moments[4] + sigma*(-9330.0*moments[3] | ||
218 | + sigma*(511.0*moments[2] - moments[1]*sigma)))))))); | ||
219 | } | ||
220 | } | ||
221 | |||
222 | Foam::scalar Foam::gammaEQMOM::m2N | ||
223 | ( | ||
224 | scalar sigma, | ||
225 | univariateMomentSet momentsStar | ||
226 | ) | ||
227 | { | ||
228 | label nMomentsStar = momentsStar.size(); | ||
229 | |||
230 | if (momentsStar.nRealizableMoments() >= nMomentsStar - 1) | ||
231 | { | ||
232 | univariateMomentSet m(nMomentsStar, 0.0, "Gauss", "RPlus"); | ||
233 | momentsStarToMoments(sigma, m, momentsStar); | ||
234 | |||
235 | return m.last(); | ||
236 | } | ||
237 | |||
238 | return GREAT; | ||
239 | } | ||
240 | |||
241 | void Foam::gammaEQMOM::recurrenceRelation | ||
242 | ( | ||
243 | scalarDiagonalMatrix& a, | ||
244 | scalarDiagonalMatrix& b, | ||
245 | scalar primaryAbscissa, | ||
246 | scalar sigma | ||
247 | ) | ||
248 | { | ||
249 | scalar alpha = primaryAbscissa/sigma - 1.0; | ||
250 | |||
251 | forAll(a, ai) | ||
252 | { | ||
253 | a[ai] = (2.0*scalar(ai) + alpha + 1.0); | ||
254 | } | ||
255 | |||
256 | b[0] = gamma(1.0 + alpha); | ||
257 | |||
258 | for (label bi = 1; bi < b.size(); bi++) | ||
259 | { | ||
260 | b[bi] = scalar(bi)*(scalar(bi) + alpha); | ||
261 | } | ||
262 | } | ||
263 | |||
264 | Foam::scalar Foam::gammaEQMOM::sigmaMax(univariateMomentSet& moments) | ||
265 | { | ||
266 | scalar sigmaZeta1 = | ||
267 | (moments[0]*moments[2] - moments[1]*moments[1])/(moments[0]*moments[1]); | ||
268 | |||
269 | return sigmaZeta1;//min(sigmaZeta1, sigmaZeta2); | ||
270 | } | ||
271 | |||
272 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/extentedMomentInversion/gamma/gammaEQMOM.H added (mode: 100644) (index 0000000..77fb3e8) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2014-2015 Alberto Passalacqua | ||
6 | \\/ M anipulation | | ||
7 | ------------------------------------------------------------------------------- | ||
8 | License | ||
9 | This file is derivative work 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 | Class | ||
25 | Foam::gammaEQMOM | ||
26 | |||
27 | Description | ||
28 | Extended quadrature method of moments with gamma kernel density functions. | ||
29 | |||
30 | References | ||
31 | \verbatim | ||
32 | "An extended quadrature method of moments for population balance | ||
33 | equations" | ||
34 | C Yuan, F Laurent, R O Fox | ||
35 | Journal of Aerosol Science | ||
36 | Volume 51, Pages 1-23, 2012 | ||
37 | \endverbatim | ||
38 | |||
39 | \verbatim | ||
40 | "The theory of canonical moments with applications in Statistics, | ||
41 | Probability and Analysis" | ||
42 | H Dette, W J Studden | ||
43 | Wiley & Sons, 1997 | ||
44 | \endverbatim | ||
45 | |||
46 | SourceFiles | ||
47 | gammaEQMOM.C | ||
48 | |||
49 | \*---------------------------------------------------------------------------*/ | ||
50 | |||
51 | #ifndef gammaEQMOM_H | ||
52 | #define gammaEQMOM_H | ||
53 | |||
54 | #include "extendedMomentInversion.H" | ||
55 | |||
56 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
57 | |||
58 | namespace Foam | ||
59 | { | ||
60 | /*---------------------------------------------------------------------------*\ | ||
61 | Class gammaEQMOM Declaration | ||
62 | \*---------------------------------------------------------------------------*/ | ||
63 | |||
64 | class gammaEQMOM | ||
65 | : | ||
66 | public extendedMomentInversion | ||
67 | { | ||
68 | public: | ||
69 | |||
70 | //- Runtime type information | ||
71 | TypeName("gamma"); | ||
72 | |||
73 | |||
74 | // Constructors | ||
75 | |||
76 | //- Construct from a dictionary and label | ||
77 | gammaEQMOM | ||
78 | ( | ||
79 | const dictionary& dict, | ||
80 | const label nMoments, | ||
81 | const label nSecondaryNodes | ||
82 | ); | ||
83 | |||
84 | |||
85 | //- Destructor | ||
86 | virtual ~gammaEQMOM(); | ||
87 | |||
88 | |||
89 | // Member Functions | ||
90 | |||
91 | //- Computes the secondary abscissa | ||
92 | virtual scalar secondaryAbscissa | ||
93 | ( | ||
94 | scalar primaryAbscissa, | ||
95 | scalar secondaryAbscissa, | ||
96 | scalar sigma | ||
97 | ); | ||
98 | |||
99 | //- Compute moments from starred moments | ||
100 | virtual void momentsStarToMoments | ||
101 | ( | ||
102 | scalar sigma, | ||
103 | univariateMomentSet& moments, | ||
104 | const univariateMomentSet& momentsStar | ||
105 | ); | ||
106 | |||
107 | //- Compute the starred moments | ||
108 | virtual void momentsToMomentsStar | ||
109 | ( | ||
110 | scalar sigma, | ||
111 | const univariateMomentSet& moments, | ||
112 | univariateMomentSet& momentsStar | ||
113 | ); | ||
114 | |||
115 | //- Compute the last moment from starred moments | ||
116 | virtual scalar m2N(scalar sigma, univariateMomentSet momentsStar); | ||
117 | |||
118 | //- Recurrence relation for polynomials orthogonal to kernel function | ||
119 | virtual void recurrenceRelation | ||
120 | ( | ||
121 | scalarDiagonalMatrix& a, | ||
122 | scalarDiagonalMatrix& b, | ||
123 | scalar primaryAbscissa, | ||
124 | scalar sigma | ||
125 | ); | ||
126 | |||
127 | //- Compute maximum value of sigma to ensure realizability | ||
128 | virtual scalar sigmaMax(univariateMomentSet& moments); | ||
129 | }; | ||
130 | |||
131 | |||
132 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
133 | |||
134 | } // End namespace Foam | ||
135 | |||
136 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
137 | |||
138 | #endif | ||
139 | |||
140 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/extentedMomentInversion/lognormal/lognormalEQMOM.C added (mode: 100644) (index 0000000..6fd39bc) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2014-2015 Alberto Passalacqua | ||
6 | \\/ M anipulation | | ||
7 | ------------------------------------------------------------------------------- | ||
8 | License | ||
9 | This file is derivative work 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 "lognormalEQMOM.H" | ||
27 | #include "scalar.H" | ||
28 | #include "scalarMatrices.H" | ||
29 | #include "constants.H" | ||
30 | #include "addToRunTimeSelectionTable.H" | ||
31 | |||
32 | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // | ||
33 | |||
34 | namespace Foam | ||
35 | { | ||
36 | defineTypeNameAndDebug(lognormalEQMOM, 0); | ||
37 | |||
38 | addToRunTimeSelectionTable | ||
39 | ( | ||
40 | extendedMomentInversion, | ||
41 | lognormalEQMOM, | ||
42 | dictionary | ||
43 | ); | ||
44 | } | ||
45 | |||
46 | |||
47 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | ||
48 | |||
49 | Foam::lognormalEQMOM::lognormalEQMOM | ||
50 | ( | ||
51 | const dictionary& dict, | ||
52 | const label nMoments, | ||
53 | const label nSecondaryNodes | ||
54 | ) | ||
55 | : | ||
56 | extendedMomentInversion(dict, nMoments, nSecondaryNodes) | ||
57 | {} | ||
58 | |||
59 | |||
60 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | ||
61 | |||
62 | Foam::lognormalEQMOM::~lognormalEQMOM() | ||
63 | {} | ||
64 | |||
65 | |||
66 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | ||
67 | Foam::scalar Foam::lognormalEQMOM::secondaryAbscissa | ||
68 | ( | ||
69 | scalar primaryAbscissa, | ||
70 | scalar secondaryAbscissa, | ||
71 | scalar sigma | ||
72 | ) | ||
73 | { | ||
74 | return primaryAbscissa*secondaryAbscissa; | ||
75 | } | ||
76 | |||
77 | void Foam::lognormalEQMOM::momentsStarToMoments | ||
78 | ( | ||
79 | scalar sigma, | ||
80 | univariateMomentSet& moments, | ||
81 | const univariateMomentSet& momentsStar | ||
82 | ) | ||
83 | { | ||
84 | scalar z = exp(sqr(sigma)/2.0); | ||
85 | |||
86 | forAll(moments, momenti) | ||
87 | { | ||
88 | moments[momenti] = momentsStar[momenti]*pow(z, momenti*momenti); | ||
89 | } | ||
90 | } | ||
91 | |||
92 | void Foam::lognormalEQMOM::momentsToMomentsStar | ||
93 | ( | ||
94 | scalar sigma, | ||
95 | const univariateMomentSet& moments, | ||
96 | univariateMomentSet& momentsStar | ||
97 | ) | ||
98 | { | ||
99 | scalar z = exp(-sqr(sigma)/2.0); | ||
100 | |||
101 | forAll(moments, momenti) | ||
102 | { | ||
103 | momentsStar[momenti] = moments[momenti]*pow(z, momenti*momenti); | ||
104 | } | ||
105 | } | ||
106 | |||
107 | Foam::scalar Foam::lognormalEQMOM::m2N | ||
108 | ( | ||
109 | scalar sigma, | ||
110 | univariateMomentSet momentsStar | ||
111 | ) | ||
112 | { | ||
113 | if (momentsStar.nRealizableMoments() >= momentsStar.size() - 1) | ||
114 | { | ||
115 | scalar z = exp(sqr(sigma)/2.0); | ||
116 | label nNod = momentsStar.size() - 1; | ||
117 | |||
118 | return momentsStar.last()*pow(z, nNod*nNod); | ||
119 | } | ||
120 | |||
121 | return GREAT; | ||
122 | } | ||
123 | |||
124 | void Foam::lognormalEQMOM::recurrenceRelation | ||
125 | ( | ||
126 | scalarDiagonalMatrix& a, | ||
127 | scalarDiagonalMatrix& b, | ||
128 | scalar primaryAbscissa, | ||
129 | scalar sigma | ||
130 | ) | ||
131 | { | ||
132 | scalar eta = exp(sqr(sigma)/2.0); | ||
133 | scalar sqEta = sqr(eta); | ||
134 | |||
135 | a[0] = eta; | ||
136 | |||
137 | for (label ai = 1; ai < a.size(); ai++) | ||
138 | { | ||
139 | a[ai] = ((sqEta + 1)*pow(sqEta, scalar(ai)) - 1.0) | ||
140 | *pow(eta, 2.0*scalar(ai) - 1.0); | ||
141 | } | ||
142 | |||
143 | b[0] = 0.0; | ||
144 | |||
145 | for (label bi = 1; bi < b.size(); bi++) | ||
146 | { | ||
147 | b[bi] = pow(eta, 6.0*scalar(bi) - 4.0)*(pow(sqEta, scalar(bi)) - 1.0); | ||
148 | } | ||
149 | } | ||
150 | |||
151 | Foam::scalar Foam::lognormalEQMOM::sigmaMax(univariateMomentSet& moments) | ||
152 | { | ||
153 | label nRealizableMoments = moments.nRealizableMoments(); | ||
154 | |||
155 | scalar sigmaZeta1 = | ||
156 | sqrt(2.0*log(sqrt(moments[0]*moments[2]/(sqr(moments[1]))))); | ||
157 | |||
158 | if (nRealizableMoments > 3) | ||
159 | { | ||
160 | scalar sigmaZeta2 = | ||
161 | sqrt(2.0*log(sqrt(moments[1]*moments[3]/(sqr(moments[2]))))); | ||
162 | |||
163 | return min(sigmaZeta1, sigmaZeta2); | ||
164 | } | ||
165 | |||
166 | return sigmaZeta1; | ||
167 | } | ||
168 | |||
169 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/extentedMomentInversion/lognormal/lognormalEQMOM.H added (mode: 100644) (index 0000000..c686f0a) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2014-2015 Alberto Passalacqua | ||
6 | \\/ M anipulation | | ||
7 | ------------------------------------------------------------------------------- | ||
8 | License | ||
9 | This file is derivative work 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 | Class | ||
25 | Foam::lognormalEQMOM | ||
26 | |||
27 | Description | ||
28 | Extended quadrature method of moments with log-normal kernel density | ||
29 | functions. | ||
30 | |||
31 | References | ||
32 | \verbatim | ||
33 | "An extended quadrature-based moment method with log-normal kernel | ||
34 | density functions" | ||
35 | E Madadi-Kandjani, A Passalacqua | ||
36 | Chemical Engineering Science | ||
37 | Volume 131, Pages 323-339, 2015 | ||
38 | \endverbatim | ||
39 | |||
40 | \verbatim | ||
41 | "The theory of canonical moments with applications in Statistics, | ||
42 | Probability and Analysis" | ||
43 | H Dette, W J Studden | ||
44 | Wiley & Sons, 1997 | ||
45 | \endverbatim | ||
46 | |||
47 | \verbatim | ||
48 | "A general approximation method for solving integrals containing a | ||
49 | lognormal weighting function" | ||
50 | M Wilck | ||
51 | Journal of Aerosol Science | ||
52 | Volume 32, Pages 1111-1116, 2001 | ||
53 | \endverbatim | ||
54 | |||
55 | SourceFiles | ||
56 | lognormalEQMOM.C | ||
57 | |||
58 | \*---------------------------------------------------------------------------*/ | ||
59 | |||
60 | #ifndef lognormalEQMOM_H | ||
61 | #define lognormalEQMOM_H | ||
62 | |||
63 | #include "extendedMomentInversion.H" | ||
64 | |||
65 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
66 | |||
67 | namespace Foam | ||
68 | { | ||
69 | /*---------------------------------------------------------------------------*\ | ||
70 | Class lognormalEQMOM Declaration | ||
71 | \*---------------------------------------------------------------------------*/ | ||
72 | |||
73 | class lognormalEQMOM | ||
74 | : | ||
75 | public extendedMomentInversion | ||
76 | { | ||
77 | public: | ||
78 | |||
79 | //- Runtime type information | ||
80 | TypeName("lognormal"); | ||
81 | |||
82 | |||
83 | // Constructors | ||
84 | |||
85 | //- Construct from a dictionary and label | ||
86 | lognormalEQMOM | ||
87 | ( | ||
88 | const dictionary& dict, | ||
89 | const label nMoments, | ||
90 | const label nSecondaryNodes | ||
91 | ); | ||
92 | |||
93 | |||
94 | //- Destructor | ||
95 | virtual ~lognormalEQMOM(); | ||
96 | |||
97 | |||
98 | // Member Functions | ||
99 | |||
100 | //- Computes the secondary abscissa | ||
101 | virtual scalar secondaryAbscissa | ||
102 | ( | ||
103 | scalar primaryAbscissa, | ||
104 | scalar secondaryAbscissa, | ||
105 | scalar sigma | ||
106 | ); | ||
107 | |||
108 | //- Compute moments from starred moments | ||
109 | virtual void momentsStarToMoments | ||
110 | ( | ||
111 | scalar sigma, | ||
112 | univariateMomentSet& moments, | ||
113 | const univariateMomentSet& momentsStar | ||
114 | ); | ||
115 | |||
116 | //- Compute the starred moments | ||
117 | virtual void momentsToMomentsStar | ||
118 | ( | ||
119 | scalar sigma, | ||
120 | const univariateMomentSet& moments, | ||
121 | univariateMomentSet& momentsStar | ||
122 | ); | ||
123 | |||
124 | //- Compute the last moment from starred moments | ||
125 | virtual scalar m2N(scalar sigma, univariateMomentSet momentsStar); | ||
126 | |||
127 | //- Recurrence relation for polynomials orthogonal to kernel function | ||
128 | virtual void recurrenceRelation | ||
129 | ( | ||
130 | scalarDiagonalMatrix& a, | ||
131 | scalarDiagonalMatrix& b, | ||
132 | scalar primaryAbscissa, | ||
133 | scalar sigma | ||
134 | ); | ||
135 | |||
136 | //- Compute maximum value of sigma to ensure realizability | ||
137 | virtual scalar sigmaMax(univariateMomentSet& moments); | ||
138 | }; | ||
139 | |||
140 | |||
141 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
142 | |||
143 | } // End namespace Foam | ||
144 | |||
145 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
146 | |||
147 | #endif | ||
148 | |||
149 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/mixingModels/Make/files added (mode: 100644) (index 0000000..be402eb) | |||
1 | mixingModel/mixingModel.C | ||
2 | mixingModel/newMixingModel.C | ||
3 | |||
4 | mixingSubModels/diffusionModels/diffusionModel/diffusionModel.C | ||
5 | mixingSubModels/diffusionModels/diffusionModel/newDiffusionModel.C | ||
6 | mixingSubModels/diffusionModels/noDiffusion/noDiffusion.C | ||
7 | mixingSubModels/diffusionModels/turbulentDiffusion/turbulentDiffusion.C | ||
8 | mixingSubModels/diffusionModels/molecularDiffusion/molecularDiffusion.C | ||
9 | |||
10 | mixingSubModels/mixingKernels/mixingKernel/mixingKernel.C | ||
11 | mixingSubModels/mixingKernels/mixingKernel/newMixingKernel.C | ||
12 | mixingSubModels/mixingKernels/IEM/IEM.C | ||
13 | mixingSubModels/mixingKernels/FokkerPlanck/FokkerPlanck.C | ||
14 | |||
15 | noMixing/noMixing.C | ||
16 | turbulentMixing/turbulentMixing.C | ||
17 | |||
18 | LIB = $(FOAM_USER_LIBBIN)/libmixing |
File multiphaseEulerPbeFoam/quadratureMethods/mixingModels/Make/options added (mode: 100644) (index 0000000..8cb9c4e) | |||
1 | EXE_INC = \ | ||
2 | -I$(LIB_SRC)/transportModels \ | ||
3 | -I$(LIB_SRC)/transportModels/compressible/lnInclude \ | ||
4 | -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ | ||
5 | -I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \ | ||
6 | -I$(LIB_SRC)/TurbulenceModels/incompressible/lnInclude \ | ||
7 | -I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \ | ||
8 | -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ | ||
9 | -I$(LIB_SRC)/finiteVolume/lnInclude \ | ||
10 | -I$(LIB_SRC)/meshTools/lnInclude \ | ||
11 | -I../../eigenSolver/lnInclude \ | ||
12 | -I../univariateMomentSet/lnInclude \ | ||
13 | -I../extentedMomentInversion/lnInclude \ | ||
14 | -I../quadratureNode \ | ||
15 | -I../moments \ | ||
16 | -I../quadratureApproximation/lnInclude \ | ||
17 | -I../PDFTransportModels/lnInclude | ||
18 | |||
19 | LIB_LIBS = \ | ||
20 | -lincompressibleTransportModels \ | ||
21 | -lcompressibleTransportModels \ | ||
22 | -lfluidThermophysicalModels \ | ||
23 | -lspecie \ | ||
24 | -lturbulenceModels \ | ||
25 | -lincompressibleTurbulenceModels \ | ||
26 | -lcompressibleTurbulenceModels \ | ||
27 | -lfiniteVolume \ | ||
28 | -lmeshTools \ | ||
29 | -L$(FOAM_USER_LIBBIN) \ | ||
30 | -leigenSolver \ | ||
31 | -lmomentSet \ | ||
32 | -lextendedMomentInversion \ | ||
33 | -lquadratureApproximation \ | ||
34 | -lPDFTransportModel |
File multiphaseEulerPbeFoam/quadratureMethods/mixingModels/mixingModel/mixingModel.C added (mode: 100644) (index 0000000..e110bf9) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2015-2016 Alberto Passalacqua | ||
6 | \\/ M anipulation | | ||
7 | ------------------------------------------------------------------------------- | ||
8 | License | ||
9 | This file is derivative work 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 "mixingModel.H" | ||
27 | |||
28 | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // | ||
29 | |||
30 | namespace Foam | ||
31 | { | ||
32 | defineTypeNameAndDebug(mixingModel, 0); | ||
33 | defineRunTimeSelectionTable(mixingModel, dictionary); | ||
34 | } | ||
35 | |||
36 | |||
37 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | ||
38 | |||
39 | Foam::mixingModel::mixingModel | ||
40 | ( | ||
41 | const word& name, | ||
42 | const dictionary& dict, | ||
43 | const volVectorField& U, | ||
44 | const surfaceScalarField& phi | ||
45 | ) | ||
46 | : | ||
47 | name_(name), | ||
48 | phi_(phi) | ||
49 | {} | ||
50 | |||
51 | |||
52 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | ||
53 | |||
54 | Foam::mixingModel::~mixingModel() | ||
55 | {} | ||
56 | |||
57 | |||
58 | // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // | ||
59 | |||
60 | |||
61 | |||
62 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/mixingModels/mixingModel/mixingModel.H added (mode: 100644) (index 0000000..4e63d1c) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2015-2016 Alberto Passalacqua | ||
6 | \\/ M anipulation | | ||
7 | ------------------------------------------------------------------------------- | ||
8 | License | ||
9 | This file is derivative work 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 | Class | ||
25 | Foam::mixingModel | ||
26 | |||
27 | Description | ||
28 | Abstract class for the run-time selection of mixing models. | ||
29 | |||
30 | SourceFiles | ||
31 | mixingModel.C | ||
32 | |||
33 | \*---------------------------------------------------------------------------*/ | ||
34 | |||
35 | #ifndef mixingModel_H | ||
36 | #define mixingModel_H | ||
37 | |||
38 | #include "dictionary.H" | ||
39 | #include "volFields.H" | ||
40 | #include "dimensionedTypes.H" | ||
41 | #include "runTimeSelectionTables.H" | ||
42 | |||
43 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
44 | |||
45 | namespace Foam | ||
46 | { | ||
47 | |||
48 | /*---------------------------------------------------------------------------*\ | ||
49 | Class mixingModel Declaration | ||
50 | \*---------------------------------------------------------------------------*/ | ||
51 | |||
52 | class mixingModel | ||
53 | { | ||
54 | // Private data | ||
55 | |||
56 | //- Name of the mixingModel | ||
57 | const word name_; | ||
58 | |||
59 | // Private Member Functions | ||
60 | |||
61 | //- Disallow default bitwise copy construct | ||
62 | mixingModel(const mixingModel&); | ||
63 | |||
64 | //- Disallow default bitwise assignment | ||
65 | void operator=(const mixingModel&); | ||
66 | |||
67 | |||
68 | protected: | ||
69 | |||
70 | // Protected data | ||
71 | |||
72 | //- Fluid-phase face-normal velocity | ||
73 | const surfaceScalarField& phi_; | ||
74 | |||
75 | |||
76 | public: | ||
77 | |||
78 | //- Runtime type information | ||
79 | TypeName("mixingModel"); | ||
80 | |||
81 | // Declare runtime constructor selection table | ||
82 | declareRunTimeSelectionTable | ||
83 | ( | ||
84 | autoPtr, | ||
85 | mixingModel, | ||
86 | dictionary, | ||
87 | ( | ||
88 | const word& name, | ||
89 | const dictionary& dict, | ||
90 | const volVectorField& U, | ||
91 | const surfaceScalarField& phi | ||
92 | ), | ||
93 | (name, dict, U, phi) | ||
94 | ); | ||
95 | |||
96 | |||
97 | // Constructors | ||
98 | |||
99 | //- Construct from components | ||
100 | mixingModel | ||
101 | ( | ||
102 | const word& name, | ||
103 | const dictionary& dict, | ||
104 | const volVectorField& U, | ||
105 | const surfaceScalarField& phi | ||
106 | ); | ||
107 | |||
108 | |||
109 | // Selectors | ||
110 | |||
111 | //- Select null constructed | ||
112 | static autoPtr<mixingModel> New | ||
113 | ( | ||
114 | const word& name, | ||
115 | const dictionary& dict, | ||
116 | const volVectorField& U, | ||
117 | const surfaceScalarField& phi | ||
118 | ); | ||
119 | |||
120 | |||
121 | //- Destructor | ||
122 | virtual ~mixingModel(); | ||
123 | |||
124 | |||
125 | // Member Functions | ||
126 | |||
127 | //- Solve mixing model | ||
128 | virtual void solve() = 0; | ||
129 | |||
130 | }; | ||
131 | |||
132 | |||
133 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
134 | |||
135 | } // End namespace Foam | ||
136 | |||
137 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
138 | |||
139 | #endif | ||
140 | |||
141 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/mixingModels/mixingModel/newMixingModel.C added (mode: 100644) (index 0000000..f13c124) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2015-2016 Alberto Passalacqua | ||
6 | \\/ M anipulation | | ||
7 | ------------------------------------------------------------------------------- | ||
8 | License | ||
9 | This file is derivative work 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 "mixingModel.H" | ||
27 | |||
28 | // * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * // | ||
29 | |||
30 | Foam::autoPtr<Foam::mixingModel> Foam::mixingModel::New | ||
31 | ( | ||
32 | const word& name, | ||
33 | const dictionary& dict, | ||
34 | const volVectorField& U, | ||
35 | const surfaceScalarField& phi | ||
36 | ) | ||
37 | { | ||
38 | word mixingModelType(dict.lookup("mixingModel")); | ||
39 | |||
40 | Info<< "Selecting mixingModel " | ||
41 | << mixingModelType << endl; | ||
42 | |||
43 | dictionaryConstructorTable::iterator cstrIter = | ||
44 | dictionaryConstructorTablePtr_->find(mixingModelType); | ||
45 | |||
46 | if (cstrIter == dictionaryConstructorTablePtr_->end()) | ||
47 | { | ||
48 | FatalErrorInFunction | ||
49 | << "Unknown mixingModelType type " | ||
50 | << mixingModelType << endl << endl | ||
51 | << "Valid mixingModelType types are :" << endl | ||
52 | << dictionaryConstructorTablePtr_->sortedToc() | ||
53 | << abort(FatalError); | ||
54 | } | ||
55 | |||
56 | return | ||
57 | autoPtr<mixingModel> | ||
58 | ( | ||
59 | cstrIter() | ||
60 | ( | ||
61 | name, | ||
62 | dict.subDict(mixingModelType + "Coeffs"), | ||
63 | U, | ||
64 | phi | ||
65 | ) | ||
66 | ); | ||
67 | } | ||
68 | |||
69 | |||
70 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/mixingModels/mixingSubModels/diffusionModels/diffusionModel/diffusionModel.C added (mode: 100644) (index 0000000..a533ae3) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2015-2016 Alberto Passalacqua | ||
6 | \\/ M anipulation | | ||
7 | ------------------------------------------------------------------------------- | ||
8 | License | ||
9 | This file is derivative work 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 "diffusionModel.H" | ||
27 | |||
28 | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // | ||
29 | |||
30 | namespace Foam | ||
31 | { | ||
32 | namespace mixingSubModels | ||
33 | { | ||
34 | defineTypeNameAndDebug(diffusionModel, 0); | ||
35 | |||
36 | defineRunTimeSelectionTable(diffusionModel, dictionary); | ||
37 | } | ||
38 | } | ||
39 | |||
40 | |||
41 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | ||
42 | |||
43 | Foam::mixingSubModels::diffusionModel::diffusionModel | ||
44 | ( | ||
45 | const dictionary& dict | ||
46 | ) | ||
47 | : | ||
48 | dict_(dict) | ||
49 | {} | ||
50 | |||
51 | |||
52 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | ||
53 | |||
54 | Foam::mixingSubModels::diffusionModel::~diffusionModel() | ||
55 | {} | ||
56 | |||
57 | |||
58 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/mixingModels/mixingSubModels/diffusionModels/diffusionModel/diffusionModel.H added (mode: 100644) (index 0000000..1e9a208) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2015-2016 Alberto Passalacqua | ||
6 | \\/ M anipulation | | ||
7 | ------------------------------------------------------------------------------- | ||
8 | License | ||
9 | This file is derivative work 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 | Class | ||
25 | Foam::mixingSubModels::diffusionModel | ||
26 | |||
27 | Description | ||
28 | Abstract class for moment diffusion models. | ||
29 | |||
30 | SourceFiles | ||
31 | diffusionModel.C | ||
32 | |||
33 | \*---------------------------------------------------------------------------*/ | ||
34 | |||
35 | #ifndef diffusionModel_H | ||
36 | #define diffusionModel_H | ||
37 | |||
38 | #include "dictionary.H" | ||
39 | #include "volFields.H" | ||
40 | #include "fvMatrix.H" | ||
41 | #include "dimensionedTypes.H" | ||
42 | #include "runTimeSelectionTables.H" | ||
43 | |||
44 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
45 | |||
46 | namespace Foam | ||
47 | { | ||
48 | namespace mixingSubModels | ||
49 | { | ||
50 | |||
51 | /*---------------------------------------------------------------------------*\ | ||
52 | Class diffusionModel Declaration | ||
53 | \*---------------------------------------------------------------------------*/ | ||
54 | |||
55 | class diffusionModel | ||
56 | { | ||
57 | // Private member functions | ||
58 | |||
59 | //- Disallow default bitwise copy construct | ||
60 | diffusionModel(const diffusionModel&); | ||
61 | |||
62 | //- Disallow default bitwise assignment | ||
63 | void operator=(const diffusionModel&); | ||
64 | |||
65 | |||
66 | protected: | ||
67 | |||
68 | // Protected data | ||
69 | |||
70 | const dictionary& dict_; | ||
71 | |||
72 | |||
73 | public: | ||
74 | |||
75 | //- Runtime type information | ||
76 | TypeName("diffusionModel"); | ||
77 | |||
78 | // Declare runtime constructor selection table | ||
79 | declareRunTimeSelectionTable | ||
80 | ( | ||
81 | autoPtr, | ||
82 | diffusionModel, | ||
83 | dictionary, | ||
84 | ( | ||
85 | const dictionary& dict | ||
86 | ), | ||
87 | (dict) | ||
88 | ); | ||
89 | |||
90 | |||
91 | // Constructors | ||
92 | |||
93 | //- Construct from components | ||
94 | diffusionModel(const dictionary& dict); | ||
95 | |||
96 | |||
97 | // Selectors | ||
98 | |||
99 | static autoPtr<diffusionModel> New | ||
100 | ( | ||
101 | const dictionary& dict | ||
102 | ); | ||
103 | |||
104 | |||
105 | //- Destructor | ||
106 | virtual ~diffusionModel(); | ||
107 | |||
108 | |||
109 | // Member Functions | ||
110 | |||
111 | //- Return the source term for diffusion term in the moment equation | ||
112 | virtual tmp<fvScalarMatrix> momentDiff | ||
113 | ( | ||
114 | const volScalarField& moment | ||
115 | ) const = 0; | ||
116 | }; | ||
117 | |||
118 | |||
119 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
120 | |||
121 | } // End namespace mixingSubModels | ||
122 | } // End namespace Foam | ||
123 | |||
124 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
125 | |||
126 | #endif | ||
127 | |||
128 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/mixingModels/mixingSubModels/diffusionModels/diffusionModel/newDiffusionModel.C added (mode: 100644) (index 0000000..0e0564c) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2015-2016 Alberto Passalacqua | ||
6 | \\/ M anipulation | | ||
7 | ------------------------------------------------------------------------------- | ||
8 | License | ||
9 | This file is derivative work 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 "diffusionModel.H" | ||
27 | |||
28 | // * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * // | ||
29 | |||
30 | Foam::autoPtr<Foam::mixingSubModels::diffusionModel> | ||
31 | Foam::mixingSubModels::diffusionModel::New | ||
32 | ( | ||
33 | const dictionary& dict | ||
34 | ) | ||
35 | { | ||
36 | word diffusionModelType(dict.lookup("diffusionModel")); | ||
37 | |||
38 | Info<< "Selecting diffusionModel " | ||
39 | << diffusionModelType << endl; | ||
40 | |||
41 | dictionaryConstructorTable::iterator cstrIter = | ||
42 | dictionaryConstructorTablePtr_->find(diffusionModelType); | ||
43 | |||
44 | if (cstrIter == dictionaryConstructorTablePtr_->end()) | ||
45 | { | ||
46 | FatalError | ||
47 | << "diffusionModel::New(const dictionary&) : " << endl | ||
48 | << " unknown diffusionModelType type " | ||
49 | << diffusionModelType | ||
50 | << ", constructor not in hash table" << endl << endl | ||
51 | << " Valid diffusionModelType types are :" << endl; | ||
52 | Info<< dictionaryConstructorTablePtr_->sortedToc() << abort(FatalError); | ||
53 | } | ||
54 | |||
55 | return autoPtr<diffusionModel>(cstrIter()(dict)); | ||
56 | } | ||
57 | |||
58 | |||
59 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/mixingModels/mixingSubModels/diffusionModels/molecularDiffusion/molecularDiffusion.C added (mode: 100644) (index 0000000..c92b561) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2016 Alberto Passalacqua | ||
6 | \\/ M anipulation | | ||
7 | ------------------------------------------------------------------------------- | ||
8 | License | ||
9 | This file is derivative work 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 "molecularDiffusion.H" | ||
27 | #include "addToRunTimeSelectionTable.H" | ||
28 | |||
29 | #include "turbulentTransportModel.H" | ||
30 | #include "turbulentFluidThermoModel.H" | ||
31 | |||
32 | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // | ||
33 | |||
34 | namespace Foam | ||
35 | { | ||
36 | namespace mixingSubModels | ||
37 | { | ||
38 | namespace diffusionModels | ||
39 | { | ||
40 | defineTypeNameAndDebug(molecularDiffusion, 0); | ||
41 | |||
42 | addToRunTimeSelectionTable | ||
43 | ( | ||
44 | diffusionModel, | ||
45 | molecularDiffusion, | ||
46 | dictionary | ||
47 | ); | ||
48 | } | ||
49 | } | ||
50 | } | ||
51 | |||
52 | |||
53 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | ||
54 | |||
55 | Foam::mixingSubModels::diffusionModels::molecularDiffusion | ||
56 | ::molecularDiffusion | ||
57 | ( | ||
58 | const dictionary& dict | ||
59 | ) | ||
60 | : | ||
61 | diffusionModel(dict), | ||
62 | gammaLam_(dict.lookup("gammaLam")) | ||
63 | {} | ||
64 | |||
65 | |||
66 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | ||
67 | |||
68 | Foam::mixingSubModels::diffusionModels::molecularDiffusion | ||
69 | ::~molecularDiffusion() | ||
70 | {} | ||
71 | |||
72 | |||
73 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | ||
74 | |||
75 | Foam::tmp<Foam::fvScalarMatrix> | ||
76 | Foam::mixingSubModels::diffusionModels::molecularDiffusion | ||
77 | ::momentDiff | ||
78 | ( | ||
79 | const volScalarField& moment | ||
80 | ) const | ||
81 | { | ||
82 | |||
83 | return fvm::laplacian(gammaLam_, moment); | ||
84 | } | ||
85 | |||
86 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/mixingModels/mixingSubModels/diffusionModels/molecularDiffusion/molecularDiffusion.H added (mode: 100644) (index 0000000..33ca88f) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2016 Alberto Passalacqua | ||
6 | \\/ M anipulation | | ||
7 | ------------------------------------------------------------------------------- | ||
8 | License | ||
9 | This file is derivative work 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 | Class | ||
25 | Foam::mixingSubModels::diffusionModels::molecularDiffusion | ||
26 | |||
27 | Description | ||
28 | Molecular diffusion model. | ||
29 | |||
30 | SourceFiles | ||
31 | molecularDiffusion.C | ||
32 | |||
33 | \*---------------------------------------------------------------------------*/ | ||
34 | |||
35 | #ifndef molecularDiffusion_H | ||
36 | #define molecularDiffusion_H | ||
37 | |||
38 | #include "diffusionModel.H" | ||
39 | #include "fvm.H" | ||
40 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
41 | |||
42 | namespace Foam | ||
43 | { | ||
44 | namespace mixingSubModels | ||
45 | { | ||
46 | namespace diffusionModels | ||
47 | { | ||
48 | |||
49 | /*---------------------------------------------------------------------------*\ | ||
50 | Class molecularDiffusion Declaration | ||
51 | \*---------------------------------------------------------------------------*/ | ||
52 | |||
53 | class molecularDiffusion | ||
54 | : | ||
55 | public diffusionModel | ||
56 | { | ||
57 | //- Private member functions | ||
58 | tmp<volScalarField> turbViscosity(const volScalarField& moment) const; | ||
59 | |||
60 | //- Private data | ||
61 | |||
62 | //- Laminar diffusivity | ||
63 | dimensionedScalar gammaLam_; | ||
64 | |||
65 | public: | ||
66 | |||
67 | //- Runtime type information | ||
68 | TypeName("molecularDiffusion"); | ||
69 | |||
70 | |||
71 | // Constructors | ||
72 | |||
73 | //- Construct from components | ||
74 | molecularDiffusion(const dictionary& dict); | ||
75 | |||
76 | |||
77 | //- Destructor | ||
78 | virtual ~molecularDiffusion(); | ||
79 | |||
80 | |||
81 | // Member Functions | ||
82 | |||
83 | //- Moments of the daughter distribution | ||
84 | virtual tmp<fvScalarMatrix> momentDiff | ||
85 | ( | ||
86 | const volScalarField& moment | ||
87 | ) const; | ||
88 | |||
89 | }; | ||
90 | |||
91 | |||
92 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
93 | |||
94 | } // End namespace diffusionModels | ||
95 | } // End namespace mixingSubModels | ||
96 | } // End namespace Foam | ||
97 | |||
98 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
99 | |||
100 | #endif | ||
101 | |||
102 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/mixingModels/mixingSubModels/diffusionModels/noDiffusion/noDiffusion.C added (mode: 100644) (index 0000000..6159949) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2015-2016 Alberto Passalacqua | ||
6 | \\/ M anipulation | | ||
7 | ------------------------------------------------------------------------------- | ||
8 | License | ||
9 | This file is derivative work 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 "noDiffusion.H" | ||
27 | #include "addToRunTimeSelectionTable.H" | ||
28 | |||
29 | #include "turbulentFluidThermoModel.H" | ||
30 | |||
31 | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // | ||
32 | |||
33 | namespace Foam | ||
34 | { | ||
35 | namespace mixingSubModels | ||
36 | { | ||
37 | namespace diffusionModels | ||
38 | { | ||
39 | defineTypeNameAndDebug(noDiffusion, 0); | ||
40 | |||
41 | addToRunTimeSelectionTable | ||
42 | ( | ||
43 | diffusionModel, | ||
44 | noDiffusion, | ||
45 | dictionary | ||
46 | ); | ||
47 | } | ||
48 | } | ||
49 | } | ||
50 | |||
51 | |||
52 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | ||
53 | |||
54 | Foam::mixingSubModels::diffusionModels::noDiffusion | ||
55 | ::noDiffusion | ||
56 | ( | ||
57 | const dictionary& dict | ||
58 | ) | ||
59 | : | ||
60 | diffusionModel(dict) | ||
61 | {} | ||
62 | |||
63 | |||
64 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | ||
65 | |||
66 | Foam::mixingSubModels::diffusionModels::noDiffusion | ||
67 | ::~noDiffusion() | ||
68 | {} | ||
69 | |||
70 | |||
71 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | ||
72 | |||
73 | Foam::tmp<Foam::fvScalarMatrix> | ||
74 | Foam::mixingSubModels::diffusionModels::noDiffusion | ||
75 | ::momentDiff | ||
76 | ( | ||
77 | const volScalarField& moment | ||
78 | ) const | ||
79 | { | ||
80 | tmp<volScalarField> noDiff | ||
81 | ( | ||
82 | new volScalarField | ||
83 | ( | ||
84 | IOobject | ||
85 | ( | ||
86 | "noDiff", | ||
87 | moment.mesh().time().timeName(), | ||
88 | moment.mesh(), | ||
89 | IOobject::NO_READ, | ||
90 | IOobject::NO_WRITE, | ||
91 | false | ||
92 | ), | ||
93 | moment.mesh(), | ||
94 | dimensionedScalar("zero", inv(dimTime), 0.0) | ||
95 | ) | ||
96 | ); | ||
97 | |||
98 | return fvm::Sp(noDiff, moment); | ||
99 | } | ||
100 | |||
101 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/mixingModels/mixingSubModels/diffusionModels/noDiffusion/noDiffusion.H added (mode: 100644) (index 0000000..6073c66) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2015-2016 Alberto Passalacqua | ||
6 | \\/ M anipulation | | ||
7 | ------------------------------------------------------------------------------- | ||
8 | License | ||
9 | This file is derivative work 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 | Class | ||
25 | Foam::mixingSubModels::diffusionModels::noDiffusion | ||
26 | |||
27 | Description | ||
28 | No diffusion model. | ||
29 | |||
30 | SourceFiles | ||
31 | noDiffusion.C | ||
32 | |||
33 | \*---------------------------------------------------------------------------*/ | ||
34 | |||
35 | #ifndef noDiffusion_H | ||
36 | #define noDiffusion_H | ||
37 | |||
38 | #include "diffusionModel.H" | ||
39 | #include "fvm.H" | ||
40 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
41 | |||
42 | namespace Foam | ||
43 | { | ||
44 | namespace mixingSubModels | ||
45 | { | ||
46 | namespace diffusionModels | ||
47 | { | ||
48 | |||
49 | /*---------------------------------------------------------------------------*\ | ||
50 | Class noDiffusion Declaration | ||
51 | \*---------------------------------------------------------------------------*/ | ||
52 | |||
53 | class noDiffusion | ||
54 | : | ||
55 | public diffusionModel | ||
56 | { | ||
57 | public: | ||
58 | |||
59 | //- Runtime type information | ||
60 | TypeName("none"); | ||
61 | |||
62 | |||
63 | // Constructors | ||
64 | |||
65 | //- Construct from components | ||
66 | noDiffusion(const dictionary& dict); | ||
67 | |||
68 | |||
69 | //- Destructor | ||
70 | virtual ~noDiffusion(); | ||
71 | |||
72 | |||
73 | // Member Functions | ||
74 | |||
75 | //- Moments of the daughter distribution | ||
76 | virtual tmp<fvScalarMatrix> momentDiff | ||
77 | ( | ||
78 | const volScalarField& moment | ||
79 | ) const; | ||
80 | |||
81 | }; | ||
82 | |||
83 | |||
84 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
85 | |||
86 | } // End namespace diffusionModels | ||
87 | } // End namespace mixingSubModels | ||
88 | } // End namespace Foam | ||
89 | |||
90 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
91 | |||
92 | #endif | ||
93 | |||
94 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/mixingModels/mixingSubModels/diffusionModels/turbulentDiffusion/turbulentDiffusion.C added (mode: 100644) (index 0000000..d0a1183) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2015-2016 Alberto Passalacqua | ||
6 | \\/ M anipulation | | ||
7 | ------------------------------------------------------------------------------- | ||
8 | License | ||
9 | This file is derivative work 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 "turbulentDiffusion.H" | ||
27 | #include "addToRunTimeSelectionTable.H" | ||
28 | |||
29 | #include "turbulentTransportModel.H" | ||
30 | #include "turbulentFluidThermoModel.H" | ||
31 | |||
32 | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // | ||
33 | |||
34 | namespace Foam | ||
35 | { | ||
36 | namespace mixingSubModels | ||
37 | { | ||
38 | namespace diffusionModels | ||
39 | { | ||
40 | defineTypeNameAndDebug(turbulentDiffusion, 0); | ||
41 | |||
42 | addToRunTimeSelectionTable | ||
43 | ( | ||
44 | diffusionModel, | ||
45 | turbulentDiffusion, | ||
46 | dictionary | ||
47 | ); | ||
48 | } | ||
49 | } | ||
50 | } | ||
51 | |||
52 | |||
53 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | ||
54 | |||
55 | Foam::mixingSubModels::diffusionModels::turbulentDiffusion | ||
56 | ::turbulentDiffusion | ||
57 | ( | ||
58 | const dictionary& dict | ||
59 | ) | ||
60 | : | ||
61 | diffusionModel(dict), | ||
62 | gammaLam_(dict.lookup("gammaLam")), | ||
63 | Sc_(readScalar(dict.lookup("Sc"))) | ||
64 | {} | ||
65 | |||
66 | |||
67 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | ||
68 | |||
69 | Foam::mixingSubModels::diffusionModels::turbulentDiffusion | ||
70 | ::~turbulentDiffusion() | ||
71 | {} | ||
72 | |||
73 | |||
74 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | ||
75 | |||
76 | Foam::tmp<Foam::fvScalarMatrix> | ||
77 | Foam::mixingSubModels::diffusionModels::turbulentDiffusion | ||
78 | ::momentDiff | ||
79 | ( | ||
80 | const volScalarField& moment | ||
81 | ) const | ||
82 | { | ||
83 | volScalarField gamma(turbViscosity(moment)/Sc_ + gammaLam_); | ||
84 | |||
85 | return fvm::laplacian(gamma, moment); | ||
86 | } | ||
87 | |||
88 | Foam::tmp<Foam::volScalarField> | ||
89 | Foam::mixingSubModels::diffusionModels::turbulentDiffusion:: | ||
90 | turbViscosity(const volScalarField& moment) const | ||
91 | { | ||
92 | typedef compressible::turbulenceModel cmpTurbModel; | ||
93 | typedef incompressible::turbulenceModel icoTurbModel; | ||
94 | |||
95 | if (moment.mesh().foundObject<cmpTurbModel>(cmpTurbModel::propertiesName)) | ||
96 | { | ||
97 | const cmpTurbModel& turb = | ||
98 | moment.mesh().lookupObject<cmpTurbModel> | ||
99 | ( | ||
100 | cmpTurbModel::propertiesName | ||
101 | ); | ||
102 | |||
103 | return turb.mut()/turb.rho(); | ||
104 | } | ||
105 | else if | ||
106 | ( | ||
107 | moment.mesh().foundObject<icoTurbModel>(icoTurbModel::propertiesName) | ||
108 | ) | ||
109 | { | ||
110 | const incompressible::turbulenceModel& turb = | ||
111 | moment.mesh().lookupObject<icoTurbModel> | ||
112 | ( | ||
113 | icoTurbModel::propertiesName | ||
114 | ); | ||
115 | |||
116 | return turb.nut(); | ||
117 | } | ||
118 | else | ||
119 | { | ||
120 | FatalErrorInFunction | ||
121 | << "No valid turbulence model for turbulent diffusion calculation." | ||
122 | << exit(FatalError); | ||
123 | |||
124 | return volScalarField::null(); | ||
125 | } | ||
126 | } | ||
127 | |||
128 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/mixingModels/mixingSubModels/diffusionModels/turbulentDiffusion/turbulentDiffusion.H added (mode: 100644) (index 0000000..21240d1) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2015-2016 Alberto Passalacqua | ||
6 | \\/ M anipulation | | ||
7 | ------------------------------------------------------------------------------- | ||
8 | License | ||
9 | This file is derivative work 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 | Class | ||
25 | Foam::mixingSubModels::diffusionModels::turbulentDiffusion | ||
26 | |||
27 | Description | ||
28 | Turbulent diffusion model. | ||
29 | |||
30 | SourceFiles | ||
31 | turbulentDiffusion.C | ||
32 | |||
33 | \*---------------------------------------------------------------------------*/ | ||
34 | |||
35 | #ifndef turbulentDiffusion_H | ||
36 | #define turbulentDiffusion_H | ||
37 | |||
38 | #include "diffusionModel.H" | ||
39 | #include "fvm.H" | ||
40 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
41 | |||
42 | namespace Foam | ||
43 | { | ||
44 | namespace mixingSubModels | ||
45 | { | ||
46 | namespace diffusionModels | ||
47 | { | ||
48 | |||
49 | /*---------------------------------------------------------------------------*\ | ||
50 | Class turbulentDiffusion Declaration | ||
51 | \*---------------------------------------------------------------------------*/ | ||
52 | |||
53 | class turbulentDiffusion | ||
54 | : | ||
55 | public diffusionModel | ||
56 | { | ||
57 | //- Private member functions | ||
58 | tmp<volScalarField> turbViscosity(const volScalarField& moment) const; | ||
59 | |||
60 | //- Private data | ||
61 | |||
62 | //- Laminar diffusivity | ||
63 | dimensionedScalar gammaLam_; | ||
64 | |||
65 | //- Turbulent Schmidt number | ||
66 | scalar Sc_; | ||
67 | |||
68 | public: | ||
69 | |||
70 | //- Runtime type information | ||
71 | TypeName("turbulentDiffusion"); | ||
72 | |||
73 | |||
74 | // Constructors | ||
75 | |||
76 | //- Construct from components | ||
77 | turbulentDiffusion(const dictionary& dict); | ||
78 | |||
79 | |||
80 | //- Destructor | ||
81 | virtual ~turbulentDiffusion(); | ||
82 | |||
83 | |||
84 | // Member Functions | ||
85 | |||
86 | //- Moments of the daughter distribution | ||
87 | virtual tmp<fvScalarMatrix> momentDiff | ||
88 | ( | ||
89 | const volScalarField& moment | ||
90 | ) const; | ||
91 | |||
92 | }; | ||
93 | |||
94 | |||
95 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
96 | |||
97 | } // End namespace diffusionModels | ||
98 | } // End namespace mixingSubModels | ||
99 | } // End namespace Foam | ||
100 | |||
101 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
102 | |||
103 | #endif | ||
104 | |||
105 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/mixingModels/mixingSubModels/mixingKernels/FokkerPlanck/FokkerPlanck.C added (mode: 100644) (index 0000000..6a0fd06) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2016 Alberto Passalacqua | ||
6 | \\/ M anipulation | | ||
7 | ------------------------------------------------------------------------------- | ||
8 | License | ||
9 | This file is derivative work 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 "FokkerPlanck.H" | ||
27 | #include "addToRunTimeSelectionTable.H" | ||
28 | #include "turbulentFluidThermoModel.H" | ||
29 | #include "fundamentalConstants.H" | ||
30 | |||
31 | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // | ||
32 | |||
33 | namespace Foam | ||
34 | { | ||
35 | namespace mixingSubModels | ||
36 | { | ||
37 | namespace mixingKernels | ||
38 | { | ||
39 | defineTypeNameAndDebug(FokkerPlanck, 0); | ||
40 | |||
41 | addToRunTimeSelectionTable | ||
42 | ( | ||
43 | mixingKernel, | ||
44 | FokkerPlanck, | ||
45 | dictionary | ||
46 | ); | ||
47 | } | ||
48 | } | ||
49 | } | ||
50 | |||
51 | |||
52 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | ||
53 | |||
54 | Foam::mixingSubModels::mixingKernels::FokkerPlanck | ||
55 | ::FokkerPlanck | ||
56 | ( | ||
57 | const dictionary& dict | ||
58 | ) | ||
59 | : | ||
60 | mixingKernel(dict) | ||
61 | {} | ||
62 | |||
63 | |||
64 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | ||
65 | |||
66 | Foam::mixingSubModels::mixingKernels::FokkerPlanck | ||
67 | ::~FokkerPlanck() | ||
68 | {} | ||
69 | |||
70 | |||
71 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | ||
72 | |||
73 | Foam::tmp<Foam::fvScalarMatrix> | ||
74 | Foam::mixingSubModels::mixingKernels::FokkerPlanck::K | ||
75 | ( | ||
76 | const volUnivariateMoment& moment, | ||
77 | const volUnivariateMomentFieldSet& moments | ||
78 | ) const | ||
79 | { | ||
80 | typedef compressible::turbulenceModel cmpTurbModel; | ||
81 | |||
82 | if | ||
83 | ( | ||
84 | !moment.mesh().foundObject<cmpTurbModel> | ||
85 | ( | ||
86 | cmpTurbModel::propertiesName | ||
87 | ) | ||
88 | ) | ||
89 | { | ||
90 | FatalErrorInFunction | ||
91 | << "No valid compressible turbulence model found." | ||
92 | << abort(FatalError); | ||
93 | } | ||
94 | |||
95 | const compressible::turbulenceModel& flTurb = | ||
96 | moment.mesh().lookupObject<compressible::turbulenceModel> | ||
97 | ( | ||
98 | turbulenceModel::propertiesName | ||
99 | ); | ||
100 | |||
101 | label momentOrder = moment.order(); | ||
102 | |||
103 | tmp<fvScalarMatrix> mixingK | ||
104 | ( | ||
105 | new fvScalarMatrix | ||
106 | ( | ||
107 | moment, | ||
108 | moment.dimensions()*dimVol/dimTime | ||
109 | ) | ||
110 | ); | ||
111 | |||
112 | dimensionedScalar oneMoment("oneMoment", moments[1].dimensions(), 1.0); | ||
113 | |||
114 | if (momentOrder == 0) | ||
115 | { | ||
116 | return mixingK; | ||
117 | } | ||
118 | else | ||
119 | { | ||
120 | mixingK.ref() += momentOrder*Cphi_*flTurb.epsilon()/flTurb.k() | ||
121 | *moments[momentOrder - 1] | ||
122 | *((Cmixing_ + 1.0)*moments[1] + Cmixing_*(momentOrder - 1)*oneMoment | ||
123 | *((moments[2] - sqr(moments[1]))/(moments[1]*oneMoment | ||
124 | - moments[2]))) - fvm::SuSp(momentOrder*Cphi_*flTurb.epsilon() | ||
125 | /flTurb.k()*((Cmixing_ + 1.0) + Cmixing_*(momentOrder - 1) | ||
126 | *((moments[2] - sqr(moments[1]))/(moments[1]*oneMoment | ||
127 | - moments[2]))), moment); | ||
128 | } | ||
129 | |||
130 | return mixingK; | ||
131 | } | ||
132 | |||
133 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/mixingModels/mixingSubModels/mixingKernels/FokkerPlanck/FokkerPlanck.H added (mode: 100644) (index 0000000..b37c894) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2016 Alberto Passalacqua | ||
6 | \\/ M anipulation | | ||
7 | ------------------------------------------------------------------------------- | ||
8 | License | ||
9 | This file is derivative work 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 | Class | ||
25 | Fokker-Planck mixing model. | ||
26 | |||
27 | Description | ||
28 | Brownian aggregation kernel supplemented kernel for particles in turbulent | ||
29 | flows in conditions when the particle size is smaller than the local | ||
30 | Kolmogorov scale. | ||
31 | |||
32 | References | ||
33 | \verbatim | ||
34 | "Computational Models for Turbulent Reacting Flows" | ||
35 | R O Fox | ||
36 | Cambridge University Press | ||
37 | \endverbatim | ||
38 | |||
39 | \verbatim | ||
40 | "Solution of the Fokker-Planck Equation Using the Extended | ||
41 | Quadrature Method of Moments" | ||
42 | E Madadi-Kandjani and A Passalacqua | ||
43 | 2015 AIChE Annual Meeting, Salt Lake City, UT | ||
44 | \endverbatim | ||
45 | |||
46 | SourceFiles | ||
47 | FokkerPlanck.C | ||
48 | |||
49 | \*---------------------------------------------------------------------------*/ | ||
50 | |||
51 | #ifndef FokkerPlanck_H | ||
52 | #define FokkerPlanck_H | ||
53 | |||
54 | #include "mixingKernel.H" | ||
55 | |||
56 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
57 | |||
58 | namespace Foam | ||
59 | { | ||
60 | namespace mixingSubModels | ||
61 | { | ||
62 | namespace mixingKernels | ||
63 | { | ||
64 | |||
65 | /*---------------------------------------------------------------------------*\ | ||
66 | Class FokkerPlanck Declaration | ||
67 | \*---------------------------------------------------------------------------*/ | ||
68 | |||
69 | class FokkerPlanck | ||
70 | : | ||
71 | public mixingKernel | ||
72 | { | ||
73 | public: | ||
74 | |||
75 | //- Runtime type information | ||
76 | TypeName("FokkerPlanck"); | ||
77 | |||
78 | |||
79 | // Constructors | ||
80 | |||
81 | //- Construct from components | ||
82 | FokkerPlanck(const dictionary& dict); | ||
83 | |||
84 | |||
85 | //- Destructor | ||
86 | virtual ~FokkerPlanck(); | ||
87 | |||
88 | |||
89 | // Member Functions | ||
90 | |||
91 | //- Aggregation kernel | ||
92 | virtual tmp<fvScalarMatrix> K | ||
93 | ( | ||
94 | const volUnivariateMoment& moment, | ||
95 | const volUnivariateMomentFieldSet& moments | ||
96 | ) const; | ||
97 | |||
98 | }; | ||
99 | |||
100 | |||
101 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
102 | |||
103 | } // End namespace mixingKernels | ||
104 | } // End namespace mixingSubModels | ||
105 | } // End namespace Foam | ||
106 | |||
107 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
108 | |||
109 | #endif | ||
110 | |||
111 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/mixingModels/mixingSubModels/mixingKernels/IEM/IEM.C added (mode: 100644) (index 0000000..f87f8f4) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2016 Alberto Passalacqua | ||
6 | \\/ M anipulation | | ||
7 | ------------------------------------------------------------------------------- | ||
8 | License | ||
9 | This file is derivative work 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 "IEM.H" | ||
27 | #include "addToRunTimeSelectionTable.H" | ||
28 | #include "turbulentFluidThermoModel.H" | ||
29 | #include "fundamentalConstants.H" | ||
30 | |||
31 | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // | ||
32 | |||
33 | namespace Foam | ||
34 | { | ||
35 | namespace mixingSubModels | ||
36 | { | ||
37 | namespace mixingKernels | ||
38 | { | ||
39 | defineTypeNameAndDebug(IEM, 0); | ||
40 | |||
41 | addToRunTimeSelectionTable | ||
42 | ( | ||
43 | mixingKernel, | ||
44 | IEM, | ||
45 | dictionary | ||
46 | ); | ||
47 | } | ||
48 | } | ||
49 | } | ||
50 | |||
51 | |||
52 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | ||
53 | |||
54 | Foam::mixingSubModels::mixingKernels::IEM | ||
55 | ::IEM | ||
56 | ( | ||
57 | const dictionary& dict | ||
58 | ) | ||
59 | : | ||
60 | mixingKernel(dict) | ||
61 | {} | ||
62 | |||
63 | |||
64 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | ||
65 | |||
66 | Foam::mixingSubModels::mixingKernels::IEM | ||
67 | ::~IEM() | ||
68 | {} | ||
69 | |||
70 | |||
71 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | ||
72 | |||
73 | Foam::tmp<Foam::fvScalarMatrix> | ||
74 | Foam::mixingSubModels::mixingKernels::IEM::K | ||
75 | ( | ||
76 | const volUnivariateMoment& moment, | ||
77 | const volUnivariateMomentFieldSet& moments | ||
78 | ) const | ||
79 | { | ||
80 | typedef compressible::turbulenceModel cmpTurbModel; | ||
81 | |||
82 | if | ||
83 | ( | ||
84 | !moment.mesh().foundObject<cmpTurbModel> | ||
85 | ( | ||
86 | cmpTurbModel::propertiesName | ||
87 | ) | ||
88 | ) | ||
89 | { | ||
90 | FatalErrorInFunction | ||
91 | << "No valid compressible turbulence model found." | ||
92 | << abort(FatalError); | ||
93 | } | ||
94 | |||
95 | const compressible::turbulenceModel& flTurb = | ||
96 | moment.mesh().lookupObject<compressible::turbulenceModel> | ||
97 | ( | ||
98 | turbulenceModel::propertiesName | ||
99 | ); | ||
100 | |||
101 | label momentOrder = moment.order(); | ||
102 | |||
103 | tmp<fvScalarMatrix> mixingK | ||
104 | ( | ||
105 | new fvScalarMatrix | ||
106 | ( | ||
107 | moment, | ||
108 | moment.dimensions()*dimVol/dimTime | ||
109 | ) | ||
110 | ); | ||
111 | |||
112 | if (momentOrder == 0) | ||
113 | { | ||
114 | return mixingK; | ||
115 | } | ||
116 | else | ||
117 | { | ||
118 | mixingK.ref() += momentOrder*Cphi_*flTurb.epsilon()/flTurb.k() | ||
119 | *(moments[momentOrder - 1]*moments[1]) | ||
120 | - fvm::SuSp(momentOrder*Cphi_*flTurb.epsilon()/flTurb.k(), moment); | ||
121 | } | ||
122 | |||
123 | return mixingK; | ||
124 | } | ||
125 | |||
126 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/mixingModels/mixingSubModels/mixingKernels/IEM/IEM.H added (mode: 100644) (index 0000000..d122951) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2016 Alberto Passalacqua | ||
6 | \\/ M anipulation | | ||
7 | ------------------------------------------------------------------------------- | ||
8 | License | ||
9 | This file is derivative work 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 | Class | ||
25 | Interaction by exchange with the mean mixing model. | ||
26 | |||
27 | Description | ||
28 | Brownian aggregation kernel supplemented kernel for particles in turbulent | ||
29 | flows in conditions when the particle size is smaller than the local | ||
30 | Kolmogorov scale. | ||
31 | |||
32 | References | ||
33 | \verbatim | ||
34 | "Computational Models for Turbulent Reacting Flows" | ||
35 | R O Fox | ||
36 | Cambridge University Press | ||
37 | \endverbatim | ||
38 | |||
39 | SourceFiles | ||
40 | IEM.C | ||
41 | |||
42 | \*---------------------------------------------------------------------------*/ | ||
43 | |||
44 | #ifndef IEM_H | ||
45 | #define IEM_H | ||
46 | |||
47 | #include "mixingKernel.H" | ||
48 | |||
49 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
50 | |||
51 | namespace Foam | ||
52 | { | ||
53 | namespace mixingSubModels | ||
54 | { | ||
55 | namespace mixingKernels | ||
56 | { | ||
57 | |||
58 | /*---------------------------------------------------------------------------*\ | ||
59 | Class IEM Declaration | ||
60 | \*---------------------------------------------------------------------------*/ | ||
61 | |||
62 | class IEM | ||
63 | : | ||
64 | public mixingKernel | ||
65 | { | ||
66 | public: | ||
67 | |||
68 | //- Runtime type information | ||
69 | TypeName("IEM"); | ||
70 | |||
71 | |||
72 | // Constructors | ||
73 | |||
74 | //- Construct from components | ||
75 | IEM(const dictionary& dict); | ||
76 | |||
77 | |||
78 | //- Destructor | ||
79 | virtual ~IEM(); | ||
80 | |||
81 | |||
82 | // Member Functions | ||
83 | |||
84 | //- Aggregation kernel | ||
85 | virtual tmp<fvScalarMatrix> K | ||
86 | ( | ||
87 | const volUnivariateMoment& moment, | ||
88 | const volUnivariateMomentFieldSet& moments | ||
89 | ) const; | ||
90 | |||
91 | }; | ||
92 | |||
93 | |||
94 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
95 | |||
96 | } // End namespace mixingKernels | ||
97 | } // End namespace mixingSubModels | ||
98 | } // End namespace Foam | ||
99 | |||
100 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
101 | |||
102 | #endif | ||
103 | |||
104 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/mixingModels/mixingSubModels/mixingKernels/mixingKernel/mixingKernel.C added (mode: 100644) (index 0000000..efdf990) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2015-2016 Alberto Passalacqua | ||
6 | \\/ M anipulation | | ||
7 | ------------------------------------------------------------------------------- | ||
8 | License | ||
9 | This file is derivative work 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 "mixingKernel.H" | ||
27 | |||
28 | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // | ||
29 | |||
30 | namespace Foam | ||
31 | { | ||
32 | namespace mixingSubModels | ||
33 | { | ||
34 | defineTypeNameAndDebug(mixingKernel, 0); | ||
35 | |||
36 | defineRunTimeSelectionTable(mixingKernel, dictionary); | ||
37 | } | ||
38 | } | ||
39 | |||
40 | |||
41 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | ||
42 | |||
43 | Foam::mixingSubModels::mixingKernel::mixingKernel | ||
44 | ( | ||
45 | const dictionary& dict | ||
46 | ) | ||
47 | : | ||
48 | dict_(dict), | ||
49 | Cphi_ | ||
50 | ( | ||
51 | dict.lookupOrDefault | ||
52 | ( | ||
53 | "Cphi", | ||
54 | dimensionedScalar("CPhiDefault", dimless, 2.0) | ||
55 | ) | ||
56 | ), | ||
57 | Cmixing_ | ||
58 | ( | ||
59 | dict.lookupOrDefault | ||
60 | ( | ||
61 | "Cmixing", | ||
62 | dimensionedScalar("CmixingDefault", dimless, 1.0) | ||
63 | ) | ||
64 | ) | ||
65 | {} | ||
66 | |||
67 | |||
68 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | ||
69 | |||
70 | Foam::mixingSubModels::mixingKernel::~mixingKernel() | ||
71 | {} | ||
72 | |||
73 | |||
74 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/mixingModels/mixingSubModels/mixingKernels/mixingKernel/mixingKernel.H added (mode: 100644) (index 0000000..c9a5e2a) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2015-2016 Alberto Passalacqua | ||
6 | \\/ M anipulation | | ||
7 | ------------------------------------------------------------------------------- | ||
8 | License | ||
9 | This file is derivative work 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 | Class | ||
25 | Foam::mixingSubModels::mixingKernel | ||
26 | |||
27 | Description | ||
28 | Abstract class for mixing model kernels. | ||
29 | |||
30 | SourceFiles | ||
31 | mixingKernel.C | ||
32 | |||
33 | \*---------------------------------------------------------------------------*/ | ||
34 | |||
35 | #ifndef mixingKernel_H | ||
36 | #define mixingKernel_H | ||
37 | |||
38 | #include "dictionary.H" | ||
39 | #include "volFields.H" | ||
40 | #include "dimensionedTypes.H" | ||
41 | #include "fvMatrices.H" | ||
42 | #include "fvm.H" | ||
43 | #include "momentFieldSets.H" | ||
44 | #include "runTimeSelectionTables.H" | ||
45 | |||
46 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
47 | |||
48 | namespace Foam | ||
49 | { | ||
50 | namespace mixingSubModels | ||
51 | { | ||
52 | |||
53 | /*---------------------------------------------------------------------------*\ | ||
54 | Class mixingKernel Declaration | ||
55 | \*---------------------------------------------------------------------------*/ | ||
56 | |||
57 | class mixingKernel | ||
58 | { | ||
59 | // Private member functions | ||
60 | |||
61 | //- Disallow default bitwise copy construct | ||
62 | mixingKernel(const mixingKernel&); | ||
63 | |||
64 | //- Disallow default bitwise assignment | ||
65 | void operator=(const mixingKernel&); | ||
66 | |||
67 | |||
68 | protected: | ||
69 | |||
70 | // Protected data | ||
71 | |||
72 | const dictionary& dict_; | ||
73 | |||
74 | //- Coefficient of aggregation kernel | ||
75 | const dimensionedScalar Cphi_; | ||
76 | |||
77 | //- Coefficient of relaxation control | ||
78 | const dimensionedScalar Cmixing_; | ||
79 | |||
80 | |||
81 | public: | ||
82 | |||
83 | //- Runtime type information | ||
84 | TypeName("mixingKernel"); | ||
85 | |||
86 | // Declare runtime constructor selection table | ||
87 | declareRunTimeSelectionTable | ||
88 | ( | ||
89 | autoPtr, | ||
90 | mixingKernel, | ||
91 | dictionary, | ||
92 | ( | ||
93 | const dictionary& dict | ||
94 | ), | ||
95 | (dict) | ||
96 | ); | ||
97 | |||
98 | |||
99 | // Constructors | ||
100 | |||
101 | //- Construct from components | ||
102 | mixingKernel(const dictionary& dict); | ||
103 | |||
104 | |||
105 | // Selectors | ||
106 | |||
107 | static autoPtr<mixingKernel> New | ||
108 | ( | ||
109 | const dictionary& dict | ||
110 | ); | ||
111 | |||
112 | |||
113 | //- Destructor | ||
114 | virtual ~mixingKernel(); | ||
115 | |||
116 | |||
117 | // Member Functions | ||
118 | |||
119 | //- Aggregation kernel | ||
120 | virtual tmp<fvScalarMatrix> K | ||
121 | ( | ||
122 | const volUnivariateMoment& moment, | ||
123 | const volUnivariateMomentFieldSet& moments | ||
124 | ) const = 0; | ||
125 | }; | ||
126 | |||
127 | |||
128 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
129 | |||
130 | } // End namespace mixingSubModels | ||
131 | } // End namespace Foam | ||
132 | |||
133 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
134 | |||
135 | #endif | ||
136 | |||
137 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/mixingModels/mixingSubModels/mixingKernels/mixingKernel/newMixingKernel.C added (mode: 100644) (index 0000000..6c21bc7) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2015-2016 Alberto Passalacqua | ||
6 | \\/ M anipulation | | ||
7 | ------------------------------------------------------------------------------- | ||
8 | License | ||
9 | This file is derivative work 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 "mixingKernel.H" | ||
27 | |||
28 | // * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * // | ||
29 | |||
30 | Foam::autoPtr<Foam::mixingSubModels::mixingKernel> | ||
31 | Foam::mixingSubModels::mixingKernel::New | ||
32 | ( | ||
33 | const dictionary& dict | ||
34 | ) | ||
35 | { | ||
36 | word mixingKernelType(dict.lookup("mixingKernel")); | ||
37 | |||
38 | Info<< "Selecting mixingKernel " | ||
39 | << mixingKernelType << endl; | ||
40 | |||
41 | dictionaryConstructorTable::iterator cstrIter = | ||
42 | dictionaryConstructorTablePtr_->find(mixingKernelType); | ||
43 | |||
44 | if (cstrIter == dictionaryConstructorTablePtr_->end()) | ||
45 | { | ||
46 | FatalError | ||
47 | << "mixingKernel::New(const dictionary&) : " << endl | ||
48 | << " unknown mixingKernelType type " | ||
49 | << mixingKernelType | ||
50 | << ", constructor not in hash table" << endl << endl | ||
51 | << " Valid mixingKernelType types are :" << endl; | ||
52 | Info<< dictionaryConstructorTablePtr_->sortedToc() << abort(FatalError); | ||
53 | } | ||
54 | |||
55 | return autoPtr<mixingKernel>(cstrIter()(dict)); | ||
56 | } | ||
57 | |||
58 | |||
59 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/mixingModels/noMixing/noMixing.C added (mode: 100644) (index 0000000..2c8834d) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2015-2016 Alberto Passalacqua | ||
6 | \\/ M anipulation | | ||
7 | ------------------------------------------------------------------------------- | ||
8 | License | ||
9 | This file is derivative work 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 "noMixing.H" | ||
27 | #include "addToRunTimeSelectionTable.H" | ||
28 | |||
29 | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // | ||
30 | |||
31 | namespace Foam | ||
32 | { | ||
33 | namespace mixingModels | ||
34 | { | ||
35 | defineTypeNameAndDebug(noMixing, 0); | ||
36 | addToRunTimeSelectionTable | ||
37 | ( | ||
38 | mixingModel, | ||
39 | noMixing, | ||
40 | dictionary | ||
41 | ); | ||
42 | } | ||
43 | } | ||
44 | |||
45 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | ||
46 | |||
47 | Foam::mixingModels::noMixing::noMixing | ||
48 | ( | ||
49 | const word& name, | ||
50 | const dictionary& dict, | ||
51 | const volVectorField& U, | ||
52 | const surfaceScalarField& phi | ||
53 | ) | ||
54 | : | ||
55 | mixingModel(name, dict, U, phi), | ||
56 | name_(name) | ||
57 | {} | ||
58 | |||
59 | |||
60 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | ||
61 | |||
62 | Foam::mixingModels::noMixing::~noMixing() | ||
63 | {} | ||
64 | |||
65 | |||
66 | // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // | ||
67 | |||
68 | void Foam::mixingModels::noMixing::solve() | ||
69 | { | ||
70 | return; | ||
71 | } | ||
72 | |||
73 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/mixingModels/noMixing/noMixing.H added (mode: 100644) (index 0000000..9254c4b) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2015-2016 Alberto Passalacqua | ||
6 | \\/ M anipulation | | ||
7 | ------------------------------------------------------------------------------- | ||
8 | License | ||
9 | This file is derivative work 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 | Class | ||
25 | Foam::mixingModels::noMixing | ||
26 | |||
27 | Description | ||
28 | Disables the solution of the mixing model. | ||
29 | |||
30 | SourceFiles | ||
31 | noMixing.C | ||
32 | |||
33 | \*---------------------------------------------------------------------------*/ | ||
34 | |||
35 | #ifndef noMixing_H | ||
36 | #define noMixing_H | ||
37 | |||
38 | #include "mixingModel.H" | ||
39 | |||
40 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
41 | |||
42 | namespace Foam | ||
43 | { | ||
44 | namespace mixingModels | ||
45 | { | ||
46 | |||
47 | /*---------------------------------------------------------------------------*\ | ||
48 | Class noMixing Declaration | ||
49 | \*---------------------------------------------------------------------------*/ | ||
50 | |||
51 | class noMixing | ||
52 | : | ||
53 | public mixingModel | ||
54 | { | ||
55 | // Private data | ||
56 | |||
57 | //- Name of the noMixing | ||
58 | const word name_; | ||
59 | |||
60 | |||
61 | public: | ||
62 | |||
63 | //- Runtime type information | ||
64 | TypeName("none"); | ||
65 | |||
66 | |||
67 | // Constructors | ||
68 | |||
69 | //- Construct from components | ||
70 | noMixing | ||
71 | ( | ||
72 | const word& name, | ||
73 | const dictionary& dict, | ||
74 | const volVectorField& U, | ||
75 | const surfaceScalarField& phi | ||
76 | ); | ||
77 | |||
78 | |||
79 | //- Destructor | ||
80 | virtual ~noMixing(); | ||
81 | |||
82 | // Member Functions | ||
83 | |||
84 | //- Solve mixing model | ||
85 | void solve(); | ||
86 | }; | ||
87 | |||
88 | |||
89 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
90 | |||
91 | } // End namespace mixingModels | ||
92 | } // End namespace Foam | ||
93 | |||
94 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
95 | |||
96 | #endif | ||
97 | |||
98 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/mixingModels/turbulentMixing/turbulentMixing.C added (mode: 100644) (index 0000000..0f02056) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2015-2016 Alberto Passalacqua | ||
6 | \\/ M anipulation | | ||
7 | ------------------------------------------------------------------------------- | ||
8 | License | ||
9 | This file is derivative work 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 "turbulentMixing.H" | ||
27 | #include "addToRunTimeSelectionTable.H" | ||
28 | |||
29 | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // | ||
30 | |||
31 | namespace Foam | ||
32 | { | ||
33 | namespace PDFTransportModels | ||
34 | { | ||
35 | namespace mixingModels | ||
36 | { | ||
37 | defineTypeNameAndDebug(turbulentMixing, 0); | ||
38 | addToRunTimeSelectionTable | ||
39 | ( | ||
40 | mixingModel, | ||
41 | turbulentMixing, | ||
42 | dictionary | ||
43 | ); | ||
44 | } | ||
45 | } | ||
46 | } | ||
47 | |||
48 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | ||
49 | |||
50 | Foam::PDFTransportModels::mixingModels::turbulentMixing::turbulentMixing | ||
51 | ( | ||
52 | const word& name, | ||
53 | const dictionary& dict, | ||
54 | const volVectorField& U, | ||
55 | const surfaceScalarField& phi | ||
56 | ) | ||
57 | : | ||
58 | univariatePDFTransportModel(name, dict, U.mesh(), U, phi, "01"), | ||
59 | mixingModel(name, dict, U, phi), | ||
60 | name_(name), | ||
61 | mixingKernel_ | ||
62 | ( | ||
63 | Foam::mixingSubModels::mixingKernel::New | ||
64 | ( | ||
65 | dict.subDict("mixingKernel") | ||
66 | ) | ||
67 | ), | ||
68 | diffusionModel_ | ||
69 | ( | ||
70 | Foam::mixingSubModels::diffusionModel::New | ||
71 | ( | ||
72 | dict.subDict("diffusionModel") | ||
73 | ) | ||
74 | ) | ||
75 | {} | ||
76 | |||
77 | |||
78 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | ||
79 | |||
80 | Foam::PDFTransportModels::mixingModels::turbulentMixing::~turbulentMixing() | ||
81 | {} | ||
82 | |||
83 | |||
84 | // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // | ||
85 | |||
86 | Foam::tmp<fvScalarMatrix> Foam::PDFTransportModels::mixingModels | ||
87 | ::turbulentMixing::momentDiffusion | ||
88 | ( | ||
89 | const volUnivariateMoment& moment | ||
90 | ) | ||
91 | { | ||
92 | return diffusionModel_->momentDiff(moment); | ||
93 | } | ||
94 | |||
95 | Foam::tmp<Foam::volScalarField> | ||
96 | Foam::PDFTransportModels::mixingModels::turbulentMixing | ||
97 | ::phaseSpaceConvection | ||
98 | ( | ||
99 | const volUnivariateMoment& moment | ||
100 | ) | ||
101 | { | ||
102 | tmp<volScalarField> gSource | ||
103 | ( | ||
104 | new volScalarField | ||
105 | ( | ||
106 | IOobject | ||
107 | ( | ||
108 | "gSource", | ||
109 | U_.mesh().time().timeName(), | ||
110 | U_.mesh(), | ||
111 | IOobject::NO_READ, | ||
112 | IOobject::NO_WRITE, | ||
113 | false | ||
114 | ), | ||
115 | U_.mesh(), | ||
116 | dimensionedScalar("zero", moment.dimensions()/dimTime, 0.0) | ||
117 | ) | ||
118 | ); | ||
119 | |||
120 | return gSource; | ||
121 | } | ||
122 | |||
123 | Foam::tmp<Foam::fvScalarMatrix> | ||
124 | Foam::PDFTransportModels::mixingModels::turbulentMixing | ||
125 | ::momentSource | ||
126 | ( | ||
127 | const volUnivariateMoment& moment | ||
128 | ) | ||
129 | { | ||
130 | const volUnivariateMomentFieldSet& moments = (*this).quadrature().moments(); | ||
131 | |||
132 | return mixingKernel_->K(moment, moments); | ||
133 | } | ||
134 | |||
135 | void Foam::PDFTransportModels::mixingModels::turbulentMixing::solve | ||
136 | () | ||
137 | { | ||
138 | univariatePDFTransportModel::solve(); | ||
139 | } | ||
140 | |||
141 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/mixingModels/turbulentMixing/turbulentMixing.H added (mode: 100644) (index 0000000..b11ca47) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2015-2016 Alberto Passalacqua | ||
6 | \\/ M anipulation | | ||
7 | ------------------------------------------------------------------------------- | ||
8 | License | ||
9 | This file is derivative work 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 | Class | ||
25 | Foam::mixingModels:turbulentMixing | ||
26 | |||
27 | Description | ||
28 | Solve a turbulent mixing model. | ||
29 | |||
30 | SourceFiles | ||
31 | turbulentMixing.C | ||
32 | |||
33 | \*---------------------------------------------------------------------------*/ | ||
34 | |||
35 | #ifndef turbulentMixing_H | ||
36 | #define turbulentMixing_H | ||
37 | |||
38 | #include "univariatePDFTransportModel.H" | ||
39 | #include "mixingModel.H" | ||
40 | #include "mixingKernel.H" | ||
41 | #include "diffusionModel.H" | ||
42 | |||
43 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
44 | |||
45 | namespace Foam | ||
46 | { | ||
47 | namespace PDFTransportModels | ||
48 | { | ||
49 | namespace mixingModels | ||
50 | { | ||
51 | |||
52 | /*---------------------------------------------------------------------------*\ | ||
53 | Class mixingModel Declaration | ||
54 | \*---------------------------------------------------------------------------*/ | ||
55 | |||
56 | class turbulentMixing | ||
57 | : | ||
58 | public univariatePDFTransportModel, public mixingModel | ||
59 | { | ||
60 | // Private data | ||
61 | |||
62 | const word name_; | ||
63 | |||
64 | //- Aggregation kernel model | ||
65 | autoPtr | ||
66 | < | ||
67 | Foam::mixingSubModels::mixingKernel | ||
68 | > mixingKernel_; | ||
69 | |||
70 | //- Diffusion model | ||
71 | autoPtr | ||
72 | < | ||
73 | Foam::mixingSubModels::diffusionModel | ||
74 | > diffusionModel_; | ||
75 | |||
76 | // Private member functions | ||
77 | |||
78 | //- Diffusion term | ||
79 | virtual tmp<fvScalarMatrix> momentDiffusion | ||
80 | ( | ||
81 | const volUnivariateMoment& moment | ||
82 | ); | ||
83 | |||
84 | //- Convect moments in phase space | ||
85 | virtual tmp<volScalarField> phaseSpaceConvection | ||
86 | ( | ||
87 | const volUnivariateMoment& moment | ||
88 | ); | ||
89 | |||
90 | //- Calculate source terms | ||
91 | virtual tmp<fvScalarMatrix> momentSource | ||
92 | ( | ||
93 | const volUnivariateMoment& moment | ||
94 | ); | ||
95 | |||
96 | |||
97 | public: | ||
98 | |||
99 | //- Runtime type information | ||
100 | TypeName("turbulentMixing"); | ||
101 | |||
102 | |||
103 | // Constructors | ||
104 | |||
105 | //- Construct from components | ||
106 | turbulentMixing | ||
107 | ( | ||
108 | const word& name, | ||
109 | const dictionary& dict, | ||
110 | const volVectorField& U, | ||
111 | const surfaceScalarField& phi | ||
112 | ); | ||
113 | |||
114 | |||
115 | //- Destructor | ||
116 | virtual ~turbulentMixing(); | ||
117 | |||
118 | // Member Functions | ||
119 | |||
120 | //- Solve mixing model | ||
121 | void solve(); | ||
122 | }; | ||
123 | |||
124 | |||
125 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
126 | |||
127 | } // End namespace mixingModels | ||
128 | } // End namespace univariatePDFTransportModel | ||
129 | } // End namespace Foam | ||
130 | |||
131 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
132 | |||
133 | #endif | ||
134 | |||
135 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/moments/moment.C added (mode: 100644) (index 0000000..03377cb) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation | ||
6 | \\/ M anipulation | | ||
7 | ------------------------------------------------------------------------------- | ||
8 | 2015-03-09 Alberto Passalacqua: Templated class on the type of field used to | ||
9 | store the moment and on the type of quadrature | ||
10 | node. | ||
11 | 2015-05-23 Alberto Passalacqua: Added IOobject::groupname for improved naming | ||
12 | of files associated to moments. | ||
13 | 2015-05-24 Alberto Passalacqua: Generalized moment update function to deal with | ||
14 | standard and extended nodes. | ||
15 | 2015-06-13 Alberto Passalacqua: Introduced autoPtr to the PtrList of nodes to | ||
16 | improve initialization of nodes. | ||
17 | ------------------------------------------------------------------------------- | ||
18 | License | ||
19 | This file is derivative work of OpenFOAM. | ||
20 | |||
21 | OpenFOAM is free software: you can redistribute it and/or modify it | ||
22 | under the terms of the GNU General Public License as published by | ||
23 | the Free Software Foundation, either version 3 of the License, or | ||
24 | (at your option) any later version. | ||
25 | |||
26 | OpenFOAM is distributed in the hope that it will be useful, but WITHOUT | ||
27 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
28 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
29 | for more details. | ||
30 | |||
31 | You should have received a copy of the GNU General Public License | ||
32 | along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. | ||
33 | |||
34 | \*---------------------------------------------------------------------------*/ | ||
35 | |||
36 | #include "moment.H" | ||
37 | |||
38 | // * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * // | ||
39 | |||
40 | template <class fieldType, class nodeType> | ||
41 | Foam::word | ||
42 | Foam::moment<fieldType, nodeType>::listToWord(const labelList& lst) | ||
43 | { | ||
44 | word w; | ||
45 | |||
46 | forAll(lst, dimi) | ||
47 | { | ||
48 | w += Foam::name(lst[dimi]); | ||
49 | } | ||
50 | |||
51 | return w; | ||
52 | } | ||
53 | |||
54 | template <class fieldType, class nodeType> | ||
55 | Foam::label | ||
56 | Foam::moment<fieldType, nodeType>::listToLabel(const labelList& lst) | ||
57 | { | ||
58 | label l = 0; | ||
59 | |||
60 | forAll(lst, dimi) | ||
61 | { | ||
62 | l += lst[dimi]*pow(10, lst.size() - dimi - 1); | ||
63 | } | ||
64 | |||
65 | return l; | ||
66 | } | ||
67 | |||
68 | |||
69 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | ||
70 | |||
71 | template <class fieldType, class nodeType> | ||
72 | Foam::moment<fieldType, nodeType>::moment | ||
73 | ( | ||
74 | const word& distributionName, | ||
75 | const labelList& cmptOrders, | ||
76 | const fvMesh& mesh, | ||
77 | const autoPtr<PtrList<nodeType> >& nodes | ||
78 | ) | ||
79 | : | ||
80 | fieldType | ||
81 | ( | ||
82 | IOobject | ||
83 | ( | ||
84 | momentName(listToWord(cmptOrders), distributionName), | ||
85 | mesh.time().timeName(), | ||
86 | mesh, | ||
87 | IOobject::MUST_READ, | ||
88 | IOobject::AUTO_WRITE | ||
89 | ), | ||
90 | mesh | ||
91 | ), | ||
92 | distributionName_(distributionName), | ||
93 | nodes_(nodes), | ||
94 | cmptOrders_(cmptOrders), | ||
95 | name_(momentName(listToWord(cmptOrders_), distributionName_)), | ||
96 | nDimensions_(cmptOrders_.size()), | ||
97 | order_(sum(cmptOrders_)) | ||
98 | {} | ||
99 | |||
100 | template <class fieldType, class nodeType> | ||
101 | Foam::moment<fieldType, nodeType>::moment | ||
102 | ( | ||
103 | const word& distributionName, | ||
104 | const labelList& cmptOrders, | ||
105 | const autoPtr<PtrList<nodeType> >& nodes, | ||
106 | const fieldType& initMoment | ||
107 | ) | ||
108 | : | ||
109 | fieldType(initMoment), | ||
110 | distributionName_(distributionName), | ||
111 | nodes_(nodes), | ||
112 | cmptOrders_(cmptOrders), | ||
113 | name_(momentName(listToWord(cmptOrders_), distributionName_)), | ||
114 | nDimensions_(cmptOrders_.size()), | ||
115 | order_(sum(cmptOrders_)) | ||
116 | {} | ||
117 | |||
118 | |||
119 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | ||
120 | |||
121 | template <class fieldType, class nodeType> | ||
122 | Foam::moment<fieldType, nodeType>::~moment() | ||
123 | {} | ||
124 | |||
125 | |||
126 | // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // | ||
127 | |||
128 | template <class fieldType, class nodeType> | ||
129 | Foam::autoPtr<Foam::moment<fieldType, nodeType> > | ||
130 | Foam::moment<fieldType, nodeType>::clone() const | ||
131 | { | ||
132 | NotImplemented; | ||
133 | return autoPtr<moment<fieldType, nodeType> >(NULL); | ||
134 | } | ||
135 | |||
136 | template <class fieldType, class nodeType> | ||
137 | void Foam::moment<fieldType, nodeType>::update() | ||
138 | { | ||
139 | // Resetting the moment to zero | ||
140 | *this == dimensionedScalar("moment", (*this).dimensions(), 0); | ||
141 | |||
142 | const PtrList<nodeType>& nodes = nodes_(); | ||
143 | |||
144 | bool extendedNode = nodes[0].extended(); | ||
145 | |||
146 | // If nodes do not have extended status, only use primary quadrature. | ||
147 | if (!extendedNode) | ||
148 | { | ||
149 | forAll(nodes, pNodei) | ||
150 | { | ||
151 | const nodeType& node = nodes[pNodei]; | ||
152 | |||
153 | if (!node.extended()) | ||
154 | { | ||
155 | fieldType m = node.primaryWeight(); | ||
156 | |||
157 | for (label cmpt = 0; cmpt < nDimensions_; cmpt++) | ||
158 | { | ||
159 | const label cmptMomentOrder = cmptOrders()[cmpt]; | ||
160 | |||
161 | tmp<fieldType> abscissaCmpt | ||
162 | = node.primaryAbscissa().component(cmpt); | ||
163 | |||
164 | tmp<fieldType> mPow = m*pow(abscissaCmpt, cmptMomentOrder); | ||
165 | m.dimensions().reset(mPow().dimensions()); | ||
166 | |||
167 | m == mPow; | ||
168 | } | ||
169 | |||
170 | *this == *this + m; | ||
171 | } | ||
172 | } | ||
173 | |||
174 | return; | ||
175 | } | ||
176 | |||
177 | // Extended quadrature case | ||
178 | forAll(nodes, pNodei) | ||
179 | { | ||
180 | const nodeType& node = nodes[pNodei]; | ||
181 | |||
182 | const fieldType& pW = node.primaryWeight(); | ||
183 | |||
184 | for (label sNodei = 0; sNodei < node.nSecondaryNodes(); sNodei++) | ||
185 | { | ||
186 | fieldType m(pW*node.secondaryWeights()[sNodei]); | ||
187 | |||
188 | for (label cmpt = 0; cmpt < nDimensions_; cmpt++) | ||
189 | { | ||
190 | const label cmptMomentOrder = cmptOrders()[cmpt]; | ||
191 | |||
192 | tmp<fieldType> abscissaCmpt | ||
193 | = node.secondaryAbscissae()[sNodei].component(cmpt); | ||
194 | |||
195 | tmp<fieldType> mPow = m*pow(abscissaCmpt, cmptMomentOrder); | ||
196 | |||
197 | m.dimensions().reset(mPow().dimensions()); | ||
198 | |||
199 | m == mPow; | ||
200 | } | ||
201 | |||
202 | *this == *this + m; | ||
203 | } | ||
204 | } | ||
205 | } | ||
206 | |||
207 | |||
208 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/moments/moment.H added (mode: 100644) (index 0000000..b0401d6) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation | ||
6 | \\/ M anipulation | | ||
7 | ------------------------------------------------------------------------------- | ||
8 | 2015-03-09 Alberto Passalacqua: Templated class on the type of field used to | ||
9 | store the moment and on the type of quadrature | ||
10 | node. | ||
11 | 2015-05-23 Alberto Passalacqua: Added IOobject::groupname for improved naming | ||
12 | of files associated to moments. | ||
13 | 2015-05-24 Alberto Passalacqua: Generalized moment update function to deal with | ||
14 | standard and extended nodes. | ||
15 | 2015-06-13 Alberto Passalacqua: Introduced autoPtr to the PtrList of nodes to | ||
16 | improve initialization of nodes. | ||
17 | ------------------------------------------------------------------------------- | ||
18 | License | ||
19 | This file is derivative work of OpenFOAM. | ||
20 | |||
21 | OpenFOAM is free software: you can redistribute it and/or modify it | ||
22 | under the terms of the GNU General Public License as published by | ||
23 | the Free Software Foundation, either version 3 of the License, or | ||
24 | (at your option) any later version. | ||
25 | |||
26 | OpenFOAM is distributed in the hope that it will be useful, but WITHOUT | ||
27 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
28 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
29 | for more details. | ||
30 | |||
31 | You should have received a copy of the GNU General Public License | ||
32 | along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. | ||
33 | |||
34 | Class | ||
35 | Foam::moment | ||
36 | |||
37 | Description | ||
38 | Stores a moment of a distribution function with arbitrary dimensionality. | ||
39 | |||
40 | SourceFiles | ||
41 | momentI.H | ||
42 | moment.C | ||
43 | |||
44 | \*---------------------------------------------------------------------------*/ | ||
45 | |||
46 | #ifndef moment_H | ||
47 | #define moment_H | ||
48 | |||
49 | #include "PtrList.H" | ||
50 | #include "quadratureNodes.H" | ||
51 | #include "volFields.H" | ||
52 | #include "labelList.H" | ||
53 | |||
54 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
55 | |||
56 | namespace Foam | ||
57 | { | ||
58 | |||
59 | /*---------------------------------------------------------------------------*\ | ||
60 | Class moment Declaration | ||
61 | \*---------------------------------------------------------------------------*/ | ||
62 | |||
63 | template <class fieldType, class nodeType> | ||
64 | class moment | ||
65 | : | ||
66 | public fieldType | ||
67 | { | ||
68 | //- Name of the distribution associated to the moment | ||
69 | const word distributionName_; | ||
70 | |||
71 | //- Reference to the quadrature nodes | ||
72 | const autoPtr<PtrList<nodeType> >& nodes_; | ||
73 | |||
74 | //- Order of each dimension of the moment | ||
75 | const labelList cmptOrders_; | ||
76 | |||
77 | //- Name of the moment | ||
78 | const word name_; | ||
79 | |||
80 | //- Number of dimensions of the distribution function | ||
81 | const label nDimensions_; | ||
82 | |||
83 | //- Overall order of the moment | ||
84 | const label order_; | ||
85 | |||
86 | |||
87 | public: | ||
88 | |||
89 | //- Convert a list of labels to a word. {1, 2, 3} -> 123 | ||
90 | static word listToWord(const labelList& lst); | ||
91 | |||
92 | //- Convert a list of labels to a single label. {0, 2, 3} -> 23 | ||
93 | static label listToLabel(const labelList& lst); | ||
94 | |||
95 | |||
96 | // Constructors | ||
97 | |||
98 | //- Construct from a list of orders of each dimension of the moment | ||
99 | // and the quadrature nodes | ||
100 | moment | ||
101 | ( | ||
102 | const word& distributionName, | ||
103 | const labelList& cmptOrders, | ||
104 | const fvMesh& mesh, | ||
105 | const autoPtr<PtrList<nodeType> >& nodes | ||
106 | ); | ||
107 | |||
108 | //- Construct from name, orders, and quadrature nodes | ||
109 | moment | ||
110 | ( | ||
111 | const word& distributionName, | ||
112 | const labelList& cmptOrders, | ||
113 | const autoPtr<PtrList<nodeType> >& nodes, | ||
114 | const fieldType& initMoment | ||
115 | ); | ||
116 | |||
117 | //- Return clone | ||
118 | autoPtr<moment> clone() const; | ||
119 | |||
120 | |||
121 | //- Return a pointer to a new moment created on freestore | ||
122 | // from Istream | ||
123 | class iNew | ||
124 | { | ||
125 | const word& distributionName_; | ||
126 | const fvMesh& mesh_; | ||
127 | const autoPtr<PtrList<nodeType> >& nodes_; | ||
128 | |||
129 | public: | ||
130 | |||
131 | iNew | ||
132 | ( | ||
133 | const word& distributionName, | ||
134 | const fvMesh& mesh, | ||
135 | const autoPtr<PtrList<nodeType> >& nodes | ||
136 | ) | ||
137 | : | ||
138 | distributionName_(distributionName), | ||
139 | mesh_(mesh), | ||
140 | nodes_(nodes) | ||
141 | {} | ||
142 | |||
143 | autoPtr<moment<fieldType, nodeType> > operator()(Istream& is) const | ||
144 | { | ||
145 | labelList ent(is); | ||
146 | return autoPtr<moment<fieldType, nodeType> > | ||
147 | ( | ||
148 | new moment<fieldType, nodeType> | ||
149 | ( | ||
150 | distributionName_, | ||
151 | ent, | ||
152 | mesh_, | ||
153 | nodes_ | ||
154 | ) | ||
155 | ); | ||
156 | } | ||
157 | }; | ||
158 | |||
159 | |||
160 | //- Destructor | ||
161 | ~moment(); | ||
162 | |||
163 | |||
164 | // Member Functions | ||
165 | |||
166 | //- Creates the name of the moment | ||
167 | word momentName | ||
168 | ( | ||
169 | const word& order, | ||
170 | const word& distributionName | ||
171 | ) | ||
172 | { | ||
173 | word tmpName = IOobject::groupName("moment", order); | ||
174 | |||
175 | return IOobject::groupName(tmpName, distributionName); | ||
176 | } | ||
177 | |||
178 | // Access | ||
179 | |||
180 | //- Return the name of the moment | ||
181 | inline const word& name() const; | ||
182 | |||
183 | //- Return the name of the moment | ||
184 | inline const word& keyword() const; | ||
185 | |||
186 | //- Return the dimensionality of the distribution | ||
187 | inline label nDimensions() const; | ||
188 | |||
189 | //- Return the overall order of the moment | ||
190 | inline label order() const; | ||
191 | |||
192 | //- Return the order of each dimension | ||
193 | inline const labelList& cmptOrders() const; | ||
194 | |||
195 | |||
196 | // Edit | ||
197 | |||
198 | //- Update the moment from the quadrature nodes | ||
199 | void update(); | ||
200 | }; | ||
201 | |||
202 | |||
203 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
204 | |||
205 | } // End namespace Foam | ||
206 | |||
207 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
208 | |||
209 | #ifdef NoRepository | ||
210 | # include "momentI.H" | ||
211 | # include "moment.C" | ||
212 | #endif | ||
213 | |||
214 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
215 | |||
216 | #endif | ||
217 | |||
218 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/moments/momentFieldSet.C added (mode: 100644) (index 0000000..25b79ee) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation | ||
6 | \\/ M anipulation | | ||
7 | ------------------------------------------------------------------------------- | ||
8 | 2015-03-10 Alberto Passalacqua: Templated class on the type of moment and of | ||
9 | quadrature node. | ||
10 | ------------------------------------------------------------------------------- | ||
11 | License | ||
12 | This file is derivative work 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 | |||
29 | #include "momentFieldSet.H" | ||
30 | |||
31 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | ||
32 | |||
33 | template <class momentType, class nodeType> | ||
34 | Foam::momentFieldSet<momentType, nodeType>::momentFieldSet | ||
35 | ( | ||
36 | const word& distributionName, | ||
37 | const dictionary& dict, | ||
38 | const fvMesh& mesh, | ||
39 | const autoPtr<PtrList<nodeType> >& nodes | ||
40 | ) | ||
41 | : | ||
42 | PtrList<momentType> | ||
43 | ( | ||
44 | dict.lookup("moments"), | ||
45 | typename momentType::iNew(distributionName, mesh, nodes) | ||
46 | ), | ||
47 | name_(IOobject::groupName("moments", distributionName)), | ||
48 | nodes_(nodes), | ||
49 | nDimensions_((*this)[0].nDimensions()), | ||
50 | nMoments_((*this).size()), | ||
51 | momentMap_(nMoments_) | ||
52 | { | ||
53 | // Check on the number of moments and nodes may go here. | ||
54 | // However, to keep the implementation generic, it is moved to a | ||
55 | // higher-level class where the specific quadrature method is implemented. | ||
56 | |||
57 | // Populate the moment set | ||
58 | forAll(*this, mI) | ||
59 | { | ||
60 | momentMap_.insert | ||
61 | ( | ||
62 | moment<momentType, nodeType>::listToLabel | ||
63 | ( | ||
64 | this->operator[](mI).cmptOrders() | ||
65 | ), | ||
66 | mI | ||
67 | ); | ||
68 | } | ||
69 | } | ||
70 | |||
71 | |||
72 | template <class momentType, class nodeType> | ||
73 | Foam::momentFieldSet<momentType, nodeType>::momentFieldSet | ||
74 | ( | ||
75 | const word& distributionName, | ||
76 | const label nMoments, | ||
77 | const autoPtr<PtrList<nodeType> >& nodes, | ||
78 | const label nDimensions, | ||
79 | const Map<label>& momentMap | ||
80 | ) | ||
81 | : | ||
82 | PtrList<momentType>(nMoments), | ||
83 | name_(IOobject::groupName("moments", distributionName)), | ||
84 | nodes_(nodes), | ||
85 | nDimensions_(nDimensions), | ||
86 | nMoments_(nMoments), | ||
87 | momentMap_(momentMap) | ||
88 | {} | ||
89 | |||
90 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | ||
91 | |||
92 | template <class momentType, class nodeType> | ||
93 | Foam::momentFieldSet<momentType, nodeType>::~momentFieldSet() | ||
94 | {} | ||
95 | |||
96 | |||
97 | // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // | ||
98 | |||
99 | template <class momentType, class nodeType> | ||
100 | void Foam::momentFieldSet<momentType, nodeType>::update() | ||
101 | { | ||
102 | forAll(*this, mI) | ||
103 | { | ||
104 | this->operator[](mI).update(); | ||
105 | } | ||
106 | } | ||
107 | |||
108 | |||
109 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/moments/momentFieldSet.H added (mode: 100644) (index 0000000..6b46040) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation | ||
6 | \\/ M anipulation | | ||
7 | ------------------------------------------------------------------------------- | ||
8 | 2015-03-10 Alberto Passalacqua: Templated class on the type of moment and of | ||
9 | quadrature node. | ||
10 | 2015-06-13 Alberto Passalacqua: Introduced autoPtr to the PtrList of nodes to | ||
11 | improve initialization of nodes. | ||
12 | ------------------------------------------------------------------------------- | ||
13 | License | ||
14 | This file is derivative work of OpenFOAM. | ||
15 | |||
16 | OpenFOAM is free software: you can redistribute it and/or modify it | ||
17 | under the terms of the GNU General Public License as published by | ||
18 | the Free Software Foundation, either version 3 of the License, or | ||
19 | (at your option) any later version. | ||
20 | |||
21 | OpenFOAM is distributed in the hope that it will be useful, but WITHOUT | ||
22 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
23 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
24 | for more details. | ||
25 | |||
26 | You should have received a copy of the GNU General Public License | ||
27 | along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. | ||
28 | |||
29 | Class | ||
30 | Foam::momentFieldSet | ||
31 | |||
32 | Description | ||
33 | Stores a list of moments, with a Map<label> that takes a label key and | ||
34 | returns the index into the list of moments. | ||
35 | |||
36 | Example | ||
37 | |||
38 | Moment | Label Key | Index | ||
39 | 0 0 0 0 0 | ||
40 | 1 0 0 100 1 | ||
41 | 0 1 0 10 2 | ||
42 | 0 0 1 1 3 | ||
43 | 2 0 0 200 4 | ||
44 | 2 1 0 210 5 | ||
45 | |||
46 | operator() is overloaded in order to hide the above mapping. | ||
47 | |||
48 | SourceFiles | ||
49 | momentFieldSetI.H | ||
50 | momentFieldSet.C | ||
51 | |||
52 | \*---------------------------------------------------------------------------*/ | ||
53 | |||
54 | #ifndef momentFieldSet_H | ||
55 | #define momentFieldSet_H | ||
56 | |||
57 | #include "PtrList.H" | ||
58 | #include "volFields.H" | ||
59 | #include "Map.H" | ||
60 | |||
61 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
62 | |||
63 | namespace Foam | ||
64 | { | ||
65 | |||
66 | /*---------------------------------------------------------------------------*\ | ||
67 | Class momentFieldSet Declaration | ||
68 | \*---------------------------------------------------------------------------*/ | ||
69 | |||
70 | template <class momentType, class nodeType> | ||
71 | class momentFieldSet | ||
72 | : | ||
73 | public PtrList<momentType> | ||
74 | { | ||
75 | // Private data | ||
76 | |||
77 | //- Name of the momentFieldSet | ||
78 | const word name_; | ||
79 | |||
80 | //- Reference to the quadrature nodes | ||
81 | const autoPtr<PtrList<nodeType> >& nodes_; | ||
82 | |||
83 | //- The number of dimensions of the distribution function | ||
84 | const label nDimensions_; | ||
85 | |||
86 | //- The number of moments | ||
87 | const label nMoments_; | ||
88 | |||
89 | //- Map from the label representation of the moment name to its index | ||
90 | // within the List of moments | ||
91 | Map<label> momentMap_; | ||
92 | |||
93 | |||
94 | // Private Member Functions | ||
95 | |||
96 | //- Given the desired dimension, convert to a label. | ||
97 | // e.g., If nDimensions_ = 3; | ||
98 | // 0 -> 100 | ||
99 | // 1 -> 10 | ||
100 | // 2 -> 1 | ||
101 | //inline label dimToCmptOrder(label dim) const; | ||
102 | |||
103 | //- Disallow default bitwise copy construct | ||
104 | momentFieldSet(const momentFieldSet&); | ||
105 | |||
106 | //- Disallow default bitwise assignment | ||
107 | void operator=(const momentFieldSet&); | ||
108 | |||
109 | |||
110 | public: | ||
111 | |||
112 | // Constructors | ||
113 | |||
114 | //- Construct from dictionary and the quadrature nodes | ||
115 | momentFieldSet | ||
116 | ( | ||
117 | const word& distributionName, | ||
118 | const dictionary& dict, | ||
119 | const fvMesh& mesh, | ||
120 | const autoPtr<PtrList<nodeType> >& nodes | ||
121 | ); | ||
122 | |||
123 | //- Construct from size, quadrature nodes, dimensions and moment map | ||
124 | // The list of moments is initialised but moment fields are not | ||
125 | // automatically allocated. | ||
126 | momentFieldSet | ||
127 | ( | ||
128 | const word& distributionName, | ||
129 | const label nMoments, | ||
130 | const autoPtr<PtrList<nodeType> >& nodes, | ||
131 | const label nDimensions, | ||
132 | const Map<label>& momentMap | ||
133 | ); | ||
134 | |||
135 | |||
136 | //- Destructor | ||
137 | ~momentFieldSet(); | ||
138 | |||
139 | |||
140 | // Member Functions | ||
141 | |||
142 | // Access | ||
143 | |||
144 | //- Const access to the zeroth moment | ||
145 | inline const momentType& operator()() const; | ||
146 | |||
147 | //- Non-const access to the zeroth moment | ||
148 | inline momentType& operator()(); | ||
149 | |||
150 | //- Const access to the first order moment in dimension a | ||
151 | inline const momentType& operator()(label a) const; | ||
152 | |||
153 | //- Non-const access to the first order moment in dimension a | ||
154 | inline momentType& operator()(label a); | ||
155 | |||
156 | //- Const access to the second order moment in dimension a+b | ||
157 | inline const momentType& operator()(label a, label b) const; | ||
158 | |||
159 | //- Non-const access to the second order moment in dimension a+b | ||
160 | inline momentType& operator()(label a, label b); | ||
161 | |||
162 | //- Const access to the third order moment in dimension a+b+c | ||
163 | inline const momentType& operator() | ||
164 | ( | ||
165 | label a, | ||
166 | label b, | ||
167 | label c | ||
168 | ) const; | ||
169 | |||
170 | //- Non-const access to the third order moment in dimension a+b+c | ||
171 | inline momentType& operator()(label a, label b, label c); | ||
172 | |||
173 | //- Returns const access to the moment map | ||
174 | inline const Map<label>& momentMap() const; | ||
175 | |||
176 | //- Return the dimensionality of the distribution | ||
177 | inline label nDimensions() const; | ||
178 | |||
179 | //- Recalculate the moments from the quadrature nodes | ||
180 | void update(); | ||
181 | |||
182 | //- Return the map label of a moment | ||
183 | label map(label a, label b, label c) const | ||
184 | { | ||
185 | return momentMap_ | ||
186 | [ | ||
187 | 100*a | ||
188 | + 10*b | ||
189 | + c | ||
190 | ]; | ||
191 | }; | ||
192 | }; | ||
193 | |||
194 | |||
195 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
196 | |||
197 | } // End namespace Foam | ||
198 | |||
199 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
200 | |||
201 | #ifdef NoRepository | ||
202 | # include "momentFieldSetI.H" | ||
203 | # include "momentFieldSet.C" | ||
204 | #endif | ||
205 | |||
206 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
207 | |||
208 | #endif | ||
209 | |||
210 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/moments/momentFieldSetI.H added (mode: 100644) (index 0000000..d24fa7e) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation | ||
6 | \\/ M anipulation | | ||
7 | ------------------------------------------------------------------------------- | ||
8 | 2015-03-10 Alberto Passalacqua: Templated class on the type of moment and of | ||
9 | quadrature node. | ||
10 | ------------------------------------------------------------------------------- | ||
11 | License | ||
12 | This file is derivative work 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 | |||
29 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | ||
30 | // template <class momentType, class nodeType> | ||
31 | // Foam::label | ||
32 | // Foam::momentFieldSet<momentType, nodeType>::dimToCmptOrder(label dim) const | ||
33 | // { | ||
34 | // dim = nDimensions_ - dim - 1; | ||
35 | // | ||
36 | // return pow(10, dim); | ||
37 | // } | ||
38 | |||
39 | template <class momentType, class nodeType> | ||
40 | momentType& Foam::momentFieldSet<momentType, nodeType>::operator()() | ||
41 | { | ||
42 | return this->operator[](momentMap_[0]); | ||
43 | } | ||
44 | |||
45 | template <class momentType, class nodeType> | ||
46 | const momentType& | ||
47 | Foam::momentFieldSet<momentType, nodeType>::operator()() const | ||
48 | { | ||
49 | return this->operator[](momentMap_[0]); | ||
50 | } | ||
51 | |||
52 | template <class momentType, class nodeType> | ||
53 | momentType& Foam::momentFieldSet<momentType, nodeType>::operator()(label a) | ||
54 | { | ||
55 | return this->operator[](map(0, 0, a)); | ||
56 | } | ||
57 | |||
58 | template <class momentType, class nodeType> | ||
59 | const momentType& | ||
60 | Foam::momentFieldSet<momentType, nodeType>::operator()(label a) const | ||
61 | { | ||
62 | return this->operator[](map(0, 0, a)); | ||
63 | } | ||
64 | |||
65 | template <class momentType, class nodeType> | ||
66 | momentType& Foam::momentFieldSet<momentType, nodeType>::operator() | ||
67 | ( | ||
68 | label a, | ||
69 | label b | ||
70 | ) | ||
71 | { | ||
72 | return this->operator[](map(0, a, b)); | ||
73 | } | ||
74 | |||
75 | template <class momentType, class nodeType> | ||
76 | const momentType& Foam::momentFieldSet<momentType, nodeType>::operator() | ||
77 | ( | ||
78 | label a, | ||
79 | label b | ||
80 | ) const | ||
81 | { | ||
82 | return this->operator[](map(0, a, b)); | ||
83 | } | ||
84 | |||
85 | template <class momentType, class nodeType> | ||
86 | momentType& Foam::momentFieldSet<momentType, nodeType>::operator() | ||
87 | ( | ||
88 | label a, | ||
89 | label b, | ||
90 | label c | ||
91 | ) | ||
92 | { | ||
93 | return this->operator[](map(a, b, c)); | ||
94 | } | ||
95 | |||
96 | template <class momentType, class nodeType> | ||
97 | const momentType& Foam::momentFieldSet<momentType, nodeType>::operator() | ||
98 | ( | ||
99 | label a, | ||
100 | label b, | ||
101 | label c | ||
102 | ) const | ||
103 | { | ||
104 | return this->operator[](map(a, b, c)); | ||
105 | } | ||
106 | |||
107 | |||
108 | template <class momentType, class nodeType> const Foam::Map<Foam::label>& | ||
109 | Foam::momentFieldSet<momentType, nodeType>::momentMap() const | ||
110 | { | ||
111 | return momentMap_; | ||
112 | } | ||
113 | |||
114 | |||
115 | template <class momentType, class nodeType> | ||
116 | Foam::label Foam::momentFieldSet<momentType, nodeType>::nDimensions() const | ||
117 | { | ||
118 | return nDimensions_; | ||
119 | } | ||
120 | |||
121 | |||
122 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/moments/momentFieldSets.H added (mode: 100644) (index 0000000..6227b32) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2015-2016 Alberto Passalacqua | ||
6 | \\/ M anipulation | | ||
7 | ------------------------------------------------------------------------------- | ||
8 | License | ||
9 | This file is derivative work 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 | Class | ||
25 | Foam::momentFieldSets | ||
26 | |||
27 | Description | ||
28 | |||
29 | SourceFiles | ||
30 | |||
31 | \*---------------------------------------------------------------------------*/ | ||
32 | |||
33 | #ifndef momentFieldSets_H | ||
34 | #define momentFieldSets_H | ||
35 | |||
36 | #include "volFields.H" | ||
37 | #include "quadratureNodes.H" | ||
38 | #include "moments.H" | ||
39 | #include "momentFieldSet.H" | ||
40 | |||
41 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
42 | |||
43 | namespace Foam | ||
44 | { | ||
45 | |||
46 | typedef momentFieldSet<volUnivariateMoment, extendedVolScalarNode> | ||
47 | volUnivariateMomentFieldSet; | ||
48 | |||
49 | typedef momentFieldSet<surfaceUnivariateMoment, extendedSurfaceScalarNode> | ||
50 | surfaceUnivariateMomentFieldSet; | ||
51 | |||
52 | typedef momentFieldSet<basicVolUnivariateMoment, basicVolScalarNode> | ||
53 | basicVolUnivariateMomentFieldSet; | ||
54 | |||
55 | typedef momentFieldSet<basicSurfaceUnivariateMoment, basicSurfaceScalarNode> | ||
56 | basicSurfaceUnivariateMomentFieldSet; | ||
57 | |||
58 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
59 | |||
60 | } // End namespace Foam | ||
61 | |||
62 | |||
63 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
64 | |||
65 | #endif | ||
66 | |||
67 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/moments/momentI.H added (mode: 100644) (index 0000000..f7da5c9) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation | ||
6 | \\/ M anipulation | | ||
7 | ------------------------------------------------------------------------------- | ||
8 | 2015-03-09 Alberto Passalacqua: Templated class on the type of field used to | ||
9 | store the moment and on the type of quadrature | ||
10 | node. | ||
11 | ------------------------------------------------------------------------------- | ||
12 | License | ||
13 | This file is derivative work of OpenFOAM. | ||
14 | |||
15 | OpenFOAM is free software: you can redistribute it and/or modify it | ||
16 | under the terms of the GNU General Public License as published by | ||
17 | the Free Software Foundation, either version 3 of the License, or | ||
18 | (at your option) any later version. | ||
19 | |||
20 | OpenFOAM is distributed in the hope that it will be useful, but WITHOUT | ||
21 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
22 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
23 | for more details. | ||
24 | |||
25 | You should have received a copy of the GNU General Public License | ||
26 | along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. | ||
27 | |||
28 | \*---------------------------------------------------------------------------*/ | ||
29 | |||
30 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | ||
31 | |||
32 | template <class fieldType, class nodeType> | ||
33 | const Foam::word& Foam::moment<fieldType, nodeType>::name() const | ||
34 | { | ||
35 | return name_; | ||
36 | } | ||
37 | |||
38 | template <class fieldType, class nodeType> | ||
39 | const Foam::word& Foam::moment<fieldType, nodeType>::keyword() const | ||
40 | { | ||
41 | return name(); | ||
42 | } | ||
43 | |||
44 | template <class fieldType, class nodeType> | ||
45 | Foam::label Foam::moment<fieldType, nodeType>::nDimensions() const | ||
46 | { | ||
47 | return nDimensions_; | ||
48 | } | ||
49 | |||
50 | template <class fieldType, class nodeType> | ||
51 | Foam::label Foam::moment<fieldType, nodeType>::order() const | ||
52 | { | ||
53 | return order_; | ||
54 | } | ||
55 | |||
56 | template <class fieldType, class nodeType> | ||
57 | const Foam::labelList& | ||
58 | Foam::moment<fieldType, nodeType>::cmptOrders() const | ||
59 | { | ||
60 | return cmptOrders_; | ||
61 | } | ||
62 | |||
63 | |||
64 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/moments/moments.H added (mode: 100644) (index 0000000..46e0acc) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2015-2016 Alberto Passalacqua | ||
6 | \\/ M anipulation | | ||
7 | ------------------------------------------------------------------------------- | ||
8 | License | ||
9 | This file is derivative work 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 | Class | ||
25 | Foam::moments | ||
26 | |||
27 | Description | ||
28 | |||
29 | SourceFiles | ||
30 | |||
31 | \*---------------------------------------------------------------------------*/ | ||
32 | |||
33 | #ifndef moments_H | ||
34 | #define moments_H | ||
35 | |||
36 | #include "volFields.H" | ||
37 | #include "quadratureNodes.H" | ||
38 | #include "moment.H" | ||
39 | |||
40 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
41 | |||
42 | namespace Foam | ||
43 | { | ||
44 | |||
45 | typedef moment<volScalarField, extendedVolScalarNode> volUnivariateMoment; | ||
46 | |||
47 | typedef moment<surfaceScalarField, extendedSurfaceScalarNode> | ||
48 | surfaceUnivariateMoment; | ||
49 | |||
50 | typedef moment<volScalarField, extendedVolScalarNode> basicVolUnivariateMoment; | ||
51 | |||
52 | typedef moment<surfaceScalarField, basicSurfaceScalarNode> | ||
53 | basicSurfaceUnivariateMoment; | ||
54 | |||
55 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
56 | |||
57 | } // End namespace Foam | ||
58 | |||
59 | |||
60 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
61 | |||
62 | #endif | ||
63 | |||
64 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/multivariateMomentInversion/Make/files added (mode: 100644) (index 0000000..82f5895) | |||
1 | multivariateMomentInversion.C | ||
2 | |||
3 | LIB = $(FOAM_USER_LIBBIN)/libmultivariateInversion |
File multiphaseEulerPbeFoam/quadratureMethods/multivariateMomentInversion/Make/options added (mode: 100644) (index 0000000..7ddbb38) | |||
1 | EXE_INC = \ | ||
2 | -I$(LIB_SRC)/finiteVolume/lnInclude \ | ||
3 | -I../univariateMomentSet/lnInclude \ | ||
4 | -I../nDimensionalMappedList \ | ||
5 | -I../../Vandermonde/lnInclude | ||
6 | |||
7 | LIB_LIBS = \ | ||
8 | -lfiniteVolume \ | ||
9 | -L$(FOAM_USER_LIBBIN) \ | ||
10 | -lmomentSet \ | ||
11 | -lvandermonde |
File multiphaseEulerPbeFoam/quadratureMethods/multivariateMomentInversion/multivariateMomentInversion.C added (mode: 100644) (index 0000000..298be0f) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2015-2016 Alberto Passalacqua | ||
6 | \\/ M anipulation | | ||
7 | ------------------------------------------------------------------------------- | ||
8 | License | ||
9 | This file is derivative work 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 "multivariateMomentInversion.H" | ||
27 | |||
28 | |||
29 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | ||
30 | |||
31 | Foam::multivariateMomentInversion::multivariateMomentInversion | ||
32 | ( | ||
33 | const label nMoments, | ||
34 | const Map<label> map, | ||
35 | const labelList& nNodes, | ||
36 | const List<word>& support | ||
37 | ) | ||
38 | : | ||
39 | nMoments_(nMoments), | ||
40 | nNodes_(nNodes), | ||
41 | nDims_(nNodes_.size()), | ||
42 | support_(support), | ||
43 | abscissae_(nDims_), | ||
44 | weights_(nDims_), | ||
45 | moments_(nMoments_, nDims_, map), | ||
46 | conditionalMoments_(nDims_), | ||
47 | invVR_(nDims_ - 1) | ||
48 | { | ||
49 | labelList nNodesCM = nNodes_; | ||
50 | |||
51 | forAll(nNodes_, dimi) | ||
52 | { | ||
53 | weights_.set | ||
54 | ( | ||
55 | dimi, | ||
56 | new nDimensionalMappedList<scalar> | ||
57 | ( | ||
58 | dimi + 1, | ||
59 | nNodes_ | ||
60 | ) | ||
61 | ); | ||
62 | |||
63 | abscissae_.set | ||
64 | ( | ||
65 | dimi, | ||
66 | new nDimensionalMappedList<scalar> | ||
67 | ( | ||
68 | dimi + 1, | ||
69 | nNodes_ | ||
70 | ) | ||
71 | ); | ||
72 | |||
73 | forAll(abscissae_[dimi], ai) | ||
74 | { | ||
75 | weights_[dimi].set | ||
76 | ( | ||
77 | ai, | ||
78 | new scalar(0.0) | ||
79 | ); | ||
80 | |||
81 | abscissae_[dimi].set | ||
82 | ( | ||
83 | ai, | ||
84 | new scalar(0.0) | ||
85 | ); | ||
86 | } | ||
87 | |||
88 | } | ||
89 | |||
90 | forAll(conditionalMoments_, dimi) | ||
91 | { | ||
92 | conditionalMoments_.set | ||
93 | ( | ||
94 | dimi, | ||
95 | new PtrList<nDimensionalMappedList<scalar> > | ||
96 | ( | ||
97 | dimi + 1 | ||
98 | ) | ||
99 | ); | ||
100 | |||
101 | nNodesCM = nNodes_; | ||
102 | nNodesCM[dimi] = 2*nNodes_[dimi]; | ||
103 | |||
104 | forAll(conditionalMoments_[dimi], dimj) | ||
105 | { | ||
106 | conditionalMoments_[dimi].set | ||
107 | ( | ||
108 | dimj, | ||
109 | new nDimensionalMappedList<scalar> | ||
110 | ( | ||
111 | dimi + 1, | ||
112 | nNodesCM | ||
113 | ) | ||
114 | ); | ||
115 | |||
116 | forAll(conditionalMoments_[dimi][dimj], ai) | ||
117 | { | ||
118 | conditionalMoments_[dimi][dimj].set | ||
119 | ( | ||
120 | ai, | ||
121 | new scalar(0.0) | ||
122 | ); | ||
123 | } | ||
124 | } | ||
125 | } | ||
126 | forAll(invVR_, dimi) | ||
127 | { | ||
128 | invVR_.set | ||
129 | ( | ||
130 | dimi, | ||
131 | new nDimensionalMappedList<scalarSquareMatrix> | ||
132 | ( | ||
133 | dimi, | ||
134 | nNodes_ | ||
135 | ) | ||
136 | ); | ||
137 | |||
138 | forAll(invVR_[dimi], ai) | ||
139 | { | ||
140 | invVR_[dimi].set | ||
141 | ( | ||
142 | ai, | ||
143 | new scalarSquareMatrix | ||
144 | ( | ||
145 | nNodes_[dimi], | ||
146 | scalar(0.0) | ||
147 | ) | ||
148 | ); | ||
149 | } | ||
150 | } | ||
151 | |||
152 | forAll(moments_, mi) | ||
153 | { | ||
154 | moments_.set | ||
155 | ( | ||
156 | mi, | ||
157 | new scalar(0.0) | ||
158 | ); | ||
159 | } | ||
160 | |||
161 | // Set all lists to zero | ||
162 | reset(); | ||
163 | } | ||
164 | |||
165 | |||
166 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | ||
167 | |||
168 | Foam::multivariateMomentInversion::~multivariateMomentInversion() | ||
169 | {} | ||
170 | |||
171 | |||
172 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | ||
173 | |||
174 | void Foam::multivariateMomentInversion | ||
175 | ::invert(const nDimensionalMappedList<scalar>& moments) | ||
176 | { | ||
177 | reset(); | ||
178 | |||
179 | forAll(moments, mi) | ||
180 | { | ||
181 | moments_[mi] = moments[mi]; | ||
182 | } | ||
183 | |||
184 | // Invert primary direction first | ||
185 | labelList pos(nDims_, 0); | ||
186 | univariateMomentSet momentsToInvert | ||
187 | ( | ||
188 | 2*nNodes_[0], | ||
189 | 0.0, | ||
190 | "Gauss", | ||
191 | support_[0] | ||
192 | ); | ||
193 | |||
194 | for (label mi = 0; mi < 2*nNodes_[0]; mi++) | ||
195 | { | ||
196 | pos[0] = mi; | ||
197 | momentsToInvert[mi] = moments_(pos); | ||
198 | } | ||
199 | |||
200 | momentsToInvert.invert(); | ||
201 | |||
202 | for (label nodei = 0; nodei < nNodes_[0]; nodei++) | ||
203 | { | ||
204 | // First component of the weights and abscissae only have one direction | ||
205 | // Copy from univariateMomentSet to stored copy | ||
206 | weights_[0](nodei) = momentsToInvert.weights()[nodei]; | ||
207 | abscissae_[0](nodei) = momentsToInvert.abscissae()[nodei]; | ||
208 | } | ||
209 | |||
210 | // Solve remaining directions | ||
211 | for (label dimi = 1; dimi < nDims_; dimi++) | ||
212 | { | ||
213 | for (label dimj = 0; dimj < dimi; dimj++) | ||
214 | { | ||
215 | if (dimj == 0) | ||
216 | { | ||
217 | labelList pos(dimi, 0); | ||
218 | setVR(dimi - 1, pos, 0); | ||
219 | } | ||
220 | labelList posC(dimi + 1, 0); | ||
221 | cycleAlphaCM(dimi, dimj, 0, posC); | ||
222 | } | ||
223 | |||
224 | labelList posW(dimi + 1, 0); | ||
225 | cycleAlphaWheeler(dimi, 0, posW); | ||
226 | } | ||
227 | } | ||
228 | |||
229 | void Foam::multivariateMomentInversion::cycleAlphaCM | ||
230 | ( | ||
231 | const label dimi, | ||
232 | const label dimj, | ||
233 | label ai, | ||
234 | labelList& pos | ||
235 | ) | ||
236 | { | ||
237 | if (dimj == ai) | ||
238 | { | ||
239 | cycleAlphaCM(dimi,dimj,ai+1,pos); | ||
240 | return; | ||
241 | } | ||
242 | else if (ai < dimi) | ||
243 | { | ||
244 | for (label i = 0; i < nNodes_[ai]; i++) | ||
245 | { | ||
246 | pos[ai] = i; | ||
247 | cycleAlphaCM(dimi,dimj,ai+1,pos); | ||
248 | } | ||
249 | return; | ||
250 | } | ||
251 | else if (ai == dimi) | ||
252 | { | ||
253 | for (label i = 0; i < 2*nNodes_[dimi]; i++) | ||
254 | { | ||
255 | pos[dimi] = i; | ||
256 | cycleAlphaCM(dimi,dimj,ai+1,pos); | ||
257 | } | ||
258 | return; | ||
259 | } | ||
260 | else | ||
261 | { | ||
262 | scalarRectangularMatrix Yold(nNodes_[dimj], 1, 0.0); | ||
263 | |||
264 | for (label i = 0; i < nNodes_[dimj]; i++) | ||
265 | { | ||
266 | pos[dimj] = i; | ||
267 | |||
268 | if (dimj == 0) | ||
269 | { | ||
270 | labelList posM(nDims_,0); | ||
271 | for (label mi = 0; mi < pos.size(); mi++) | ||
272 | { | ||
273 | posM[mi] = pos[mi]; | ||
274 | } | ||
275 | Yold(i,0) = moments_(posM); | ||
276 | } | ||
277 | else | ||
278 | { | ||
279 | Yold(i,0) = | ||
280 | conditionalMoments_[dimi][dimj - 1](pos); | ||
281 | } | ||
282 | } | ||
283 | |||
284 | labelList posVR(max(1, dimj), 0); | ||
285 | if (dimj != 0) | ||
286 | { | ||
287 | for (label i = 0; i < posVR.size(); i++) | ||
288 | { | ||
289 | posVR[i] = pos[i]; | ||
290 | } | ||
291 | } | ||
292 | |||
293 | scalarRectangularMatrix Ynew = invVR_[dimj](posVR)*Yold; | ||
294 | |||
295 | for (label i = 0; i < nNodes_[dimj]; i++) | ||
296 | { | ||
297 | pos[dimj] = i; | ||
298 | conditionalMoments_[dimi][dimj](pos) = Ynew(i,0); | ||
299 | } | ||
300 | } | ||
301 | } | ||
302 | |||
303 | void Foam::multivariateMomentInversion::setVR | ||
304 | ( | ||
305 | const label dimi, | ||
306 | labelList& pos, | ||
307 | label ai | ||
308 | ) | ||
309 | { | ||
310 | if (ai < dimi) | ||
311 | { | ||
312 | for (label i = 0; i < nNodes_[ai]; i++) | ||
313 | { | ||
314 | pos[ai] = i; | ||
315 | |||
316 | setVR(dimi,pos,ai + 1); | ||
317 | } | ||
318 | } | ||
319 | else | ||
320 | { | ||
321 | scalarDiagonalMatrix x(nNodes_[dimi], 0.0); | ||
322 | scalarSquareMatrix invR(nNodes_[dimi], 0.0); | ||
323 | |||
324 | for (label i = 0; i < nNodes_[dimi]; i++) | ||
325 | { | ||
326 | pos[dimi] = i; | ||
327 | x[i] = abscissae_[dimi](pos); | ||
328 | invR[i][i] = 1.0/weights_[dimi](pos); | ||
329 | } | ||
330 | |||
331 | Vandermonde V(x); | ||
332 | |||
333 | scalarSquareMatrix invV(V.inv()); | ||
334 | |||
335 | labelList posVR(max(1, dimi), 0); | ||
336 | |||
337 | if (dimi > 0) | ||
338 | { | ||
339 | for (label ai = 0; ai < pos.size(); ai++) | ||
340 | { | ||
341 | posVR[ai] = pos[ai]; | ||
342 | } | ||
343 | } | ||
344 | |||
345 | invVR_[dimi](posVR) = invR*invV; | ||
346 | } | ||
347 | } | ||
348 | |||
349 | void Foam::multivariateMomentInversion::cycleAlphaWheeler | ||
350 | ( | ||
351 | const label dimi, | ||
352 | label ai, | ||
353 | labelList& pos | ||
354 | ) | ||
355 | { | ||
356 | if (ai < dimi) | ||
357 | { | ||
358 | for (label i = 0; i < nNodes_[ai]; i++) | ||
359 | { | ||
360 | pos[ai] = i; | ||
361 | |||
362 | cycleAlphaWheeler(dimi,ai+1,pos); | ||
363 | } | ||
364 | |||
365 | return; | ||
366 | } | ||
367 | else | ||
368 | { | ||
369 | univariateMomentSet momentsToInvert | ||
370 | ( | ||
371 | 2*nNodes_[dimi], | ||
372 | 0.0, | ||
373 | "Gauss", | ||
374 | support_[dimi] | ||
375 | ); | ||
376 | |||
377 | forAll(momentsToInvert, mi) | ||
378 | { | ||
379 | pos[dimi] = mi; | ||
380 | momentsToInvert[mi] = | ||
381 | conditionalMoments_[dimi][dimi - 1](pos); | ||
382 | } | ||
383 | |||
384 | momentsToInvert.invert(); | ||
385 | |||
386 | for (label nodei = 0; nodei < nNodes_[ai]; nodei++) | ||
387 | { | ||
388 | pos[dimi] = nodei; | ||
389 | |||
390 | weights_[dimi](pos) = | ||
391 | momentsToInvert.weights()[nodei]; | ||
392 | |||
393 | abscissae_[dimi](pos) = | ||
394 | momentsToInvert.abscissae()[nodei]; | ||
395 | } | ||
396 | return; | ||
397 | } | ||
398 | } | ||
399 | |||
400 | void Foam::multivariateMomentInversion::reset() | ||
401 | { | ||
402 | forAll(moments_, mi) | ||
403 | { | ||
404 | moments_[mi] = 0.0; | ||
405 | } | ||
406 | |||
407 | forAll(invVR_, dimi) | ||
408 | { | ||
409 | forAll(invVR_[dimi], ai) | ||
410 | { | ||
411 | for (label i = 0; i < nNodes_[dimi]; i++) | ||
412 | { | ||
413 | for (label j = 0; j < nNodes_[dimi]; j++) | ||
414 | { | ||
415 | invVR_[dimi][ai](i,j) = 0.0; | ||
416 | } | ||
417 | } | ||
418 | } | ||
419 | |||
420 | forAll(conditionalMoments_[dimi], dimj) | ||
421 | { | ||
422 | forAll(conditionalMoments_[dimi][dimj], ai) | ||
423 | { | ||
424 | conditionalMoments_[dimi][dimj][ai] = 0.0; | ||
425 | } | ||
426 | } | ||
427 | } | ||
428 | |||
429 | forAll(abscissae_, dimi) | ||
430 | { | ||
431 | forAll(abscissae_[dimi], ai) | ||
432 | { | ||
433 | weights_[dimi][ai] = 0.0; | ||
434 | abscissae_[dimi][ai] = 0.0; | ||
435 | } | ||
436 | } | ||
437 | } | ||
438 | |||
439 | |||
440 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/multivariateMomentInversion/multivariateMomentInversion.H added (mode: 100644) (index 0000000..76f3b57) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2015-2016 Alberto Passalacqua | ||
6 | \\/ M anipulation | | ||
7 | ------------------------------------------------------------------------------- | ||
8 | License | ||
9 | This file is derivative work 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 | Class | ||
25 | Foam::multivariateMomentInversion | ||
26 | |||
27 | Description | ||
28 | Abstract class to allow run-time selection of the algorithm to be used | ||
29 | for the extended quadrature method of moments. | ||
30 | |||
31 | References | ||
32 | \verbatim | ||
33 | "Conditional quadrature method of moments for kinetic equations" | ||
34 | C Yuan, R O Fox | ||
35 | Journal of Computational Physics | ||
36 | Volume 230, Pages 8216-8246, 2011 | ||
37 | \endverbatim | ||
38 | |||
39 | SourceFiles | ||
40 | multivariateMomentInversion.C | ||
41 | multivariateMomentInversionI.C | ||
42 | |||
43 | \*---------------------------------------------------------------------------*/ | ||
44 | |||
45 | #ifndef multivariateMomentInversion_H | ||
46 | #define multivariateMomentInversion_H | ||
47 | |||
48 | |||
49 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
50 | |||
51 | #include "scalar.H" | ||
52 | #include "scalarMatrices.H" | ||
53 | #include "dictionary.H" | ||
54 | #include "univariateMomentSet.H" | ||
55 | #include "Vandermonde.H" | ||
56 | #include "nDimensionalMappedList.H" | ||
57 | |||
58 | namespace Foam | ||
59 | { | ||
60 | |||
61 | /*---------------------------------------------------------------------------*\ | ||
62 | Class multivariateMomentInversion Declaration | ||
63 | \*---------------------------------------------------------------------------*/ | ||
64 | class multivariateMomentInversion | ||
65 | { | ||
66 | // Private member data | ||
67 | |||
68 | //- Number of moments | ||
69 | const label nMoments_; | ||
70 | |||
71 | //- List of the number of nodes | ||
72 | const labelList nNodes_; | ||
73 | |||
74 | //- Number of dimensions | ||
75 | const label nDims_; | ||
76 | |||
77 | //- Type of support for each direction | ||
78 | const List<word> support_; | ||
79 | |||
80 | //- Quadratrure abscissae | ||
81 | PtrList< nDimensionalMappedList<scalar> > abscissae_; | ||
82 | |||
83 | //- Quadratrure weights | ||
84 | PtrList< nDimensionalMappedList<scalar> > weights_; | ||
85 | |||
86 | //- Stored moments | ||
87 | nDimensionalMappedList<scalar> moments_; | ||
88 | |||
89 | //- Stored conditional moments | ||
90 | PtrList<PtrList<nDimensionalMappedList<scalar> > > conditionalMoments_; | ||
91 | |||
92 | //- Inverted VanderMonde matricies | ||
93 | PtrList< nDimensionalMappedList<scalarSquareMatrix> > invVR_; | ||
94 | |||
95 | // Private member functions | ||
96 | |||
97 | //- Cycles through all alphas and solves the given conditional moments | ||
98 | void cycleAlphaCM | ||
99 | ( | ||
100 | const label dimi, | ||
101 | const label dimJ, | ||
102 | label ai, | ||
103 | labelList& pos | ||
104 | ); | ||
105 | |||
106 | //- Sets the Vandermonde matricies for the previous dimension | ||
107 | void setVR | ||
108 | ( | ||
109 | const label dimi, | ||
110 | labelList& pos, | ||
111 | label ai | ||
112 | ); | ||
113 | |||
114 | //- Once all of the conditional moments are known, said moments are | ||
115 | // inverted to find the weights and abscissae | ||
116 | void cycleAlphaWheeler | ||
117 | ( | ||
118 | const label dimi, | ||
119 | label alphai, | ||
120 | labelList& pos | ||
121 | ); | ||
122 | |||
123 | //- Reset inverter | ||
124 | void reset(); | ||
125 | |||
126 | //- Disallow default bitwise copy construct | ||
127 | //multivariateMomentInversion(const multivariateMomentInversion&); | ||
128 | |||
129 | //- Disallow default bitwise assignment | ||
130 | //void operator=(const multivariateMomentInversion&); | ||
131 | |||
132 | |||
133 | public: | ||
134 | |||
135 | // Constructors | ||
136 | |||
137 | // Construct from nMoments, momentMap, nNodes, and support type | ||
138 | multivariateMomentInversion | ||
139 | ( | ||
140 | const label nMoments, | ||
141 | const Map<label> map, | ||
142 | const labelList& nNodes, | ||
143 | const List<word>& support | ||
144 | ); | ||
145 | |||
146 | |||
147 | //- Destructor | ||
148 | virtual ~multivariateMomentInversion(); | ||
149 | |||
150 | |||
151 | // Member Functions | ||
152 | |||
153 | //- Invert moments to find weights and abscissae | ||
154 | void invert(const nDimensionalMappedList<scalar>& moments); | ||
155 | |||
156 | //- Return number of moments | ||
157 | inline label nMoments(); | ||
158 | |||
159 | //- Return number of number of nodes in each dimension | ||
160 | inline const labelList& nNodes(); | ||
161 | |||
162 | //- Return mapped quadrature weights for each dimension | ||
163 | inline const PtrList<nDimensionalMappedList<scalar> >& weights() const; | ||
164 | |||
165 | //- Return mapped quadrature abscissae for each dimension | ||
166 | inline const PtrList<nDimensionalMappedList<scalar> >& abscissae() const; | ||
167 | }; | ||
168 | |||
169 | |||
170 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
171 | |||
172 | } // End namespace Foam | ||
173 | |||
174 | |||
175 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
176 | |||
177 | #include "multivariateMomentInversionI.H" | ||
178 | |||
179 | #endif | ||
180 | |||
181 | |||
182 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/multivariateMomentInversion/multivariateMomentInversionI.H added (mode: 100644) (index 0000000..a9be43b) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2015-2016 Alberto Passalacqua | ||
6 | \\/ M anipulation | | ||
7 | ------------------------------------------------------------------------------- | ||
8 | License | ||
9 | This file is derivative work 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 | |||
27 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | ||
28 | |||
29 | //- Return the total number of moments | ||
30 | Foam::label Foam::multivariateMomentInversion::nMoments() | ||
31 | { | ||
32 | return nMoments_; | ||
33 | } | ||
34 | |||
35 | //- Return the list of nNodes | ||
36 | const Foam::labelList& Foam::multivariateMomentInversion::nNodes() | ||
37 | { | ||
38 | return nNodes_; | ||
39 | } | ||
40 | |||
41 | //- Return mapped list of weights | ||
42 | const Foam::PtrList< Foam::nDimensionalMappedList< Foam::scalar> >& | ||
43 | Foam::multivariateMomentInversion::weights() const | ||
44 | { | ||
45 | return weights_; | ||
46 | } | ||
47 | |||
48 | //- Return mapped list of abscissae | ||
49 | const Foam::PtrList< Foam::nDimensionalMappedList< Foam::scalar> >& | ||
50 | Foam::multivariateMomentInversion::abscissae() const | ||
51 | { | ||
52 | return abscissae_; | ||
53 | } | ||
54 | |||
55 | |||
56 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/nDimensionalMappedList/nDimensionalMappedList.C added (mode: 100644) (index 0000000..19ccba5) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2015-2016 Alberto Passalacqua | ||
6 | \\/ M anipulation | | ||
7 | ------------------------------------------------------------------------------- | ||
8 | License | ||
9 | This file is derivative work 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 "nDimensionalMappedList.H" | ||
27 | |||
28 | |||
29 | // * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * * // | ||
30 | |||
31 | template <class mappedType> | ||
32 | Foam::word | ||
33 | Foam::nDimensionalMappedList<mappedType>::listToWord(const labelList& lst) | ||
34 | { | ||
35 | word w; | ||
36 | |||
37 | forAll(lst, dimi) | ||
38 | { | ||
39 | w += Foam::name(lst[dimi]); | ||
40 | } | ||
41 | |||
42 | return w; | ||
43 | } | ||
44 | |||
45 | template <class mappedType> | ||
46 | Foam::label | ||
47 | Foam::nDimensionalMappedList<mappedType>::listToLabel(const labelList& lst) | ||
48 | { | ||
49 | label l = 0; | ||
50 | |||
51 | forAll(lst, dimi) | ||
52 | { | ||
53 | l += lst[dimi]*pow(10, lst.size() - dimi - 1); | ||
54 | } | ||
55 | |||
56 | return l; | ||
57 | } | ||
58 | |||
59 | |||
60 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | ||
61 | |||
62 | template <class mappedType> | ||
63 | Foam::nDimensionalMappedList<mappedType>::nDimensionalMappedList | ||
64 | ( | ||
65 | const label nCmpt, | ||
66 | const label nDims, | ||
67 | const Map<label>& map | ||
68 | ) | ||
69 | : | ||
70 | PtrList<mappedType>(nCmpt), | ||
71 | nDims_(nDims), | ||
72 | map_(map) | ||
73 | {} | ||
74 | |||
75 | template <class mappedType> | ||
76 | Foam::nDimensionalMappedList<mappedType>::nDimensionalMappedList | ||
77 | ( | ||
78 | const label nDims, | ||
79 | const labelList& nNodes | ||
80 | ) | ||
81 | : | ||
82 | PtrList<mappedType>(nDimensionalListLength(nDims, nNodes)), | ||
83 | nDims_(nDims), | ||
84 | map_(this->size()) | ||
85 | { | ||
86 | labelList pos(nDims); | ||
87 | label mi = 0; | ||
88 | setMappedPositions(nNodes, 0, mi, pos); | ||
89 | } | ||
90 | |||
91 | |||
92 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | ||
93 | |||
94 | template <class mappedType> | ||
95 | Foam::nDimensionalMappedList<mappedType>::~nDimensionalMappedList() | ||
96 | {} | ||
97 | |||
98 | |||
99 | // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // | ||
100 | |||
101 | template <class mappedType> | ||
102 | void Foam::nDimensionalMappedList<mappedType>::setMappedPositions | ||
103 | ( | ||
104 | const labelList& nNodes, | ||
105 | label dimi, | ||
106 | label& mi, | ||
107 | labelList& pos | ||
108 | ) | ||
109 | { | ||
110 | if (dimi < nDims_) | ||
111 | { | ||
112 | for (label i = 0; i < nNodes[dimi]; i++) | ||
113 | { | ||
114 | pos[dimi] = i; | ||
115 | setMappedPositions(nNodes, dimi+1, mi, pos); | ||
116 | } | ||
117 | } | ||
118 | else | ||
119 | { | ||
120 | map_.insert | ||
121 | ( | ||
122 | listToLabel | ||
123 | ( | ||
124 | pos | ||
125 | ), | ||
126 | mi | ||
127 | ); | ||
128 | mi++; | ||
129 | } | ||
130 | } | ||
131 | |||
132 | template <class mappedType> | ||
133 | Foam::label Foam::nDimensionalMappedList<mappedType>::nDimensionalListLength | ||
134 | ( | ||
135 | const label nDims, | ||
136 | const labelList nNodes | ||
137 | ) | ||
138 | { | ||
139 | label totalProduct = 1; | ||
140 | for(label nodei = 0; nodei < nDims; nodei++) | ||
141 | { | ||
142 | totalProduct *= nNodes[nodei]; | ||
143 | } | ||
144 | return totalProduct; | ||
145 | } | ||
146 | |||
147 | |||
148 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/nDimensionalMappedList/nDimensionalMappedList.H added (mode: 100644) (index 0000000..94192cf) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2015-2016 Alberto Passalacqua | ||
6 | \\/ M anipulation | | ||
7 | ------------------------------------------------------------------------------- | ||
8 | License | ||
9 | This file is derivative work 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 | Class | ||
25 | Foam::nDimensionalMappedList | ||
26 | |||
27 | Description | ||
28 | Stores a list, with a Map<label> that takes a label key and | ||
29 | returns the index into the list. | ||
30 | |||
31 | Example | ||
32 | |||
33 | Lookup | Label Key | Index | ||
34 | 0 0 0 0 0 | ||
35 | 1 0 0 100 1 | ||
36 | 0 1 0 10 2 | ||
37 | 0 0 1 1 3 | ||
38 | 2 0 0 200 4 | ||
39 | 2 1 0 210 5 | ||
40 | |||
41 | operator() is overloaded in order to hide the above mapping. | ||
42 | |||
43 | SourceFiles | ||
44 | nDimensionalMappedListI.H | ||
45 | nDimensionalMappedList.C | ||
46 | |||
47 | \*---------------------------------------------------------------------------*/ | ||
48 | |||
49 | #ifndef nDimensionalMappedList_H | ||
50 | #define nDimensionalMappedList_H | ||
51 | |||
52 | #include "scalar.H" | ||
53 | #include "PtrList.H" | ||
54 | #include "volFields.H" | ||
55 | #include "Map.H" | ||
56 | |||
57 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
58 | |||
59 | namespace Foam | ||
60 | { | ||
61 | |||
62 | /*---------------------------------------------------------------------------*\ | ||
63 | Class nDimensionalMappedList Declaration | ||
64 | \*---------------------------------------------------------------------------*/ | ||
65 | |||
66 | template <class mappedType> | ||
67 | class nDimensionalMappedList | ||
68 | : | ||
69 | public PtrList<mappedType> | ||
70 | { | ||
71 | // Private data | ||
72 | |||
73 | //- The number of dimensions for the mapped data set | ||
74 | const label nDims_; | ||
75 | |||
76 | //- Map from the label representation of the moment name to its index | ||
77 | // within the List | ||
78 | Map<label> map_; | ||
79 | |||
80 | |||
81 | // Private Member Functions | ||
82 | |||
83 | //- Given the desired dimension, and nNodes, create a map. | ||
84 | // e.g., If nNodes = [2,2]; | ||
85 | // 0 -> 00 | ||
86 | // 1 -> 10 | ||
87 | // 2 -> 01 | ||
88 | // 3 -> 11 | ||
89 | inline void setMappedPositions | ||
90 | ( | ||
91 | const labelList& nNodes, | ||
92 | label dimI, | ||
93 | label& mI, | ||
94 | labelList& pos | ||
95 | ); | ||
96 | |||
97 | //- Calculate the length of the PtrList given nNodes, and nDimensions | ||
98 | label nDimensionalListLength | ||
99 | ( | ||
100 | const label nDims, | ||
101 | const labelList nNodes | ||
102 | ); | ||
103 | |||
104 | //- Disallow default bitwise copy construct | ||
105 | nDimensionalMappedList(const nDimensionalMappedList&); | ||
106 | |||
107 | //- Disallow default bitwise assignment | ||
108 | void operator=(const nDimensionalMappedList&); | ||
109 | |||
110 | |||
111 | public: | ||
112 | |||
113 | // Constructors | ||
114 | |||
115 | //- Construct from size, dimensions, and map | ||
116 | // The list is initialised | ||
117 | nDimensionalMappedList | ||
118 | ( | ||
119 | const label nCmpt, | ||
120 | const label nDimensions, | ||
121 | const Map<label>& momentMap | ||
122 | ); | ||
123 | |||
124 | //- Construct mapped list using the number of nodes in each direction, | ||
125 | // nDims is not necessarily equal to nNodes.size() | ||
126 | nDimensionalMappedList | ||
127 | ( | ||
128 | const label nDims, | ||
129 | const labelList& nNodes | ||
130 | ); | ||
131 | |||
132 | //- Destructor | ||
133 | ~nDimensionalMappedList(); | ||
134 | |||
135 | |||
136 | // Member Functions | ||
137 | |||
138 | // Static member functions | ||
139 | //- Convert a list of labels to a word. {1, 2, 3} -> 123 | ||
140 | static word listToWord(const labelList& lst); | ||
141 | |||
142 | //- Convert a list of labels to a single label. {0, 2, 3} -> 23 | ||
143 | static label listToLabel(const labelList& lst); | ||
144 | |||
145 | |||
146 | // Access | ||
147 | |||
148 | //- Const access to the first element | ||
149 | inline const mappedType& operator()() const; | ||
150 | |||
151 | //- Non-const access to the first element | ||
152 | inline mappedType& operator()(); | ||
153 | |||
154 | //- Const access to the first dimension | ||
155 | inline const mappedType& operator()(label a) const; | ||
156 | |||
157 | //- Non-const access to the first dimension | ||
158 | inline mappedType& operator()(label a); | ||
159 | |||
160 | //- Const access to the second dimension | ||
161 | inline const mappedType& operator()(label a, label b) const; | ||
162 | |||
163 | //- Non-const access to the second dimension | ||
164 | inline mappedType& operator()(label a, label b); | ||
165 | |||
166 | //- Const access to the third dimension | ||
167 | inline const mappedType& operator() | ||
168 | ( | ||
169 | label a, | ||
170 | label b, | ||
171 | label c | ||
172 | ) const; | ||
173 | |||
174 | //- Non-const access to the third dimension | ||
175 | inline mappedType& operator() | ||
176 | ( | ||
177 | label a, | ||
178 | label b, | ||
179 | label c | ||
180 | ); | ||
181 | |||
182 | //- Const access to the fourth dimension | ||
183 | inline const mappedType& operator() | ||
184 | ( | ||
185 | label a, | ||
186 | label b, | ||
187 | label c, | ||
188 | label d | ||
189 | ) const; | ||
190 | |||
191 | //- Non-const access to the fourth dimension | ||
192 | inline mappedType& operator() | ||
193 | ( | ||
194 | label a, | ||
195 | label b, | ||
196 | label c, | ||
197 | label d | ||
198 | ); | ||
199 | |||
200 | //- Const access to the fith dimension | ||
201 | inline const mappedType& operator() | ||
202 | ( | ||
203 | label a, | ||
204 | label b, | ||
205 | label c, | ||
206 | label d, | ||
207 | label e | ||
208 | ) const; | ||
209 | |||
210 | //- Non-const access to the fith dimension | ||
211 | inline mappedType& operator() | ||
212 | ( | ||
213 | label a, | ||
214 | label b, | ||
215 | label c, | ||
216 | label d, | ||
217 | label e | ||
218 | ); | ||
219 | |||
220 | //- Constant access given a label list | ||
221 | inline const mappedType& operator()(const labelList& l) const; | ||
222 | |||
223 | //- Non-constant access given a label list | ||
224 | inline mappedType& operator()(const labelList& l); | ||
225 | |||
226 | //- Returns const access to the moment map | ||
227 | inline const Map<label>& map() const; | ||
228 | |||
229 | //- Return the number of dimensions of the data set | ||
230 | inline label nDims() const; | ||
231 | |||
232 | //- Return the map label of a lookup | ||
233 | label map(label a, label b, label c, label d, label e) const | ||
234 | { | ||
235 | return map_ | ||
236 | [ | ||
237 | 10000*a | ||
238 | + 1000*b | ||
239 | + 100*c | ||
240 | + 10*d | ||
241 | + e | ||
242 | ]; | ||
243 | }; | ||
244 | }; | ||
245 | |||
246 | |||
247 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
248 | |||
249 | } // End namespace Foam | ||
250 | |||
251 | |||
252 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
253 | |||
254 | #ifdef NoRepository | ||
255 | # include "nDimensionalMappedListI.H" | ||
256 | # include "nDimensionalMappedList.C" | ||
257 | #endif | ||
258 | |||
259 | |||
260 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
261 | |||
262 | #endif | ||
263 | |||
264 | |||
265 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/nDimensionalMappedList/nDimensionalMappedListI.H added (mode: 100644) (index 0000000..516ff1f) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2015-2016 Alberto Passalacqua | ||
6 | \\/ M anipulation | | ||
7 | ------------------------------------------------------------------------------- | ||
8 | License | ||
9 | This file is derivative work 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 | |||
27 | |||
28 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | ||
29 | |||
30 | template <class mappedType> | ||
31 | mappedType& Foam::nDimensionalMappedList<mappedType>::operator()() | ||
32 | { | ||
33 | return this->operator[](map_[0]); | ||
34 | } | ||
35 | |||
36 | template <class mappedType> | ||
37 | const mappedType& | ||
38 | Foam::nDimensionalMappedList<mappedType>::operator()() const | ||
39 | { | ||
40 | return this->operator[](map_[0]); | ||
41 | } | ||
42 | |||
43 | template <class mappedType> | ||
44 | mappedType& Foam::nDimensionalMappedList<mappedType>::operator()(label a) | ||
45 | { | ||
46 | return this->operator[](map(0, 0, 0, 0, a)); | ||
47 | } | ||
48 | |||
49 | template <class mappedType> | ||
50 | const mappedType& | ||
51 | Foam::nDimensionalMappedList<mappedType>::operator()(label a) const | ||
52 | { | ||
53 | return this->operator[](map(0, 0, 0, 0, a)); | ||
54 | } | ||
55 | |||
56 | template <class mappedType> | ||
57 | mappedType& Foam::nDimensionalMappedList<mappedType>::operator() | ||
58 | ( | ||
59 | label a, | ||
60 | label b | ||
61 | ) | ||
62 | { | ||
63 | return this->operator[](map(0, 0, 0, a, b)); | ||
64 | } | ||
65 | |||
66 | template <class mappedType> | ||
67 | const mappedType& Foam::nDimensionalMappedList<mappedType>::operator() | ||
68 | ( | ||
69 | label a, | ||
70 | label b | ||
71 | ) const | ||
72 | { | ||
73 | return this->operator[](map(0, 0, 0, a, b)); | ||
74 | } | ||
75 | |||
76 | template <class mappedType> | ||
77 | mappedType& Foam::nDimensionalMappedList<mappedType>::operator() | ||
78 | ( | ||
79 | label a, | ||
80 | label b, | ||
81 | label c | ||
82 | ) | ||
83 | { | ||
84 | return this->operator[](map(0, 0, a, b, c)); | ||
85 | } | ||
86 | |||
87 | template <class mappedType> | ||
88 | const mappedType& Foam::nDimensionalMappedList<mappedType>::operator() | ||
89 | ( | ||
90 | label a, | ||
91 | label b, | ||
92 | label c | ||
93 | ) const | ||
94 | { | ||
95 | return this->operator[](map(0, 0, a, b, c)); | ||
96 | } | ||
97 | |||
98 | template <class mappedType> | ||
99 | mappedType& Foam::nDimensionalMappedList<mappedType>::operator() | ||
100 | ( | ||
101 | label a, | ||
102 | label b, | ||
103 | label c, | ||
104 | label d | ||
105 | ) | ||
106 | { | ||
107 | return this->operator[](map(0, a, b, c, d)); | ||
108 | } | ||
109 | |||
110 | template <class mappedType> | ||
111 | const mappedType& Foam::nDimensionalMappedList<mappedType>::operator() | ||
112 | ( | ||
113 | label a, | ||
114 | label b, | ||
115 | label c, | ||
116 | label d | ||
117 | ) const | ||
118 | { | ||
119 | return this->operator[](map(0, a, b, c, d)); | ||
120 | } | ||
121 | |||
122 | template <class mappedType> | ||
123 | mappedType& Foam::nDimensionalMappedList<mappedType>::operator() | ||
124 | ( | ||
125 | label a, | ||
126 | label b, | ||
127 | label c, | ||
128 | label d, | ||
129 | label e | ||
130 | ) | ||
131 | { | ||
132 | return this->operator[](map(a, b, c, d, e)); | ||
133 | } | ||
134 | |||
135 | template <class mappedType> | ||
136 | const mappedType& Foam::nDimensionalMappedList<mappedType>::operator() | ||
137 | ( | ||
138 | label a, | ||
139 | label b, | ||
140 | label c, | ||
141 | label d, | ||
142 | label e | ||
143 | ) const | ||
144 | { | ||
145 | return this->operator[](map(a, b, c, d, e)); | ||
146 | } | ||
147 | |||
148 | template <class mappedType> | ||
149 | const mappedType& | ||
150 | Foam::nDimensionalMappedList<mappedType>::operator() | ||
151 | ( | ||
152 | const Foam::labelList& l | ||
153 | ) const | ||
154 | { | ||
155 | return this->operator[](map_[listToLabel(l)]); | ||
156 | } | ||
157 | |||
158 | template <class mappedType> | ||
159 | mappedType& | ||
160 | Foam::nDimensionalMappedList<mappedType>::operator() | ||
161 | ( | ||
162 | const Foam::labelList& l | ||
163 | ) | ||
164 | { | ||
165 | return this->operator[](map_[listToLabel(l)]); | ||
166 | } | ||
167 | |||
168 | template <class mappedType> const Foam::Map<Foam::label>& | ||
169 | Foam::nDimensionalMappedList<mappedType>::map() const | ||
170 | { | ||
171 | return map_; | ||
172 | } | ||
173 | |||
174 | |||
175 | template <class mappedType> | ||
176 | Foam::label Foam::nDimensionalMappedList<mappedType>::nDims() const | ||
177 | { | ||
178 | return nDims_; | ||
179 | } | ||
180 | |||
181 | |||
182 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/Make/files added (mode: 100644) (index 0000000..d5feed4) | |||
1 | populationBalanceModel/populationBalanceModel.C | ||
2 | populationBalanceModel/newPopulationBalanceModel.C | ||
3 | |||
4 | populationBalanceSubModels/daugtherDistributions/daughterDistribution/daughterDistribution.C | ||
5 | populationBalanceSubModels/daugtherDistributions/daughterDistribution/newDaughterDistribution.C | ||
6 | populationBalanceSubModels/daugtherDistributions/erosion/erosion.C | ||
7 | populationBalanceSubModels/daugtherDistributions/oneQuarterMassRatio/oneQuarterMassRatio.C | ||
8 | populationBalanceSubModels/daugtherDistributions/symmetricFragmentation/symmetricFragmentation.C | ||
9 | populationBalanceSubModels/daugtherDistributions/uniform/uniform.C | ||
10 | populationBalanceSubModels/daugtherDistributions/fullFragmentation/fullFragmentation.C | ||
11 | |||
12 | |||
13 | populationBalanceSubModels/aggregationKernels/aggregationKernel/aggregationKernel.C | ||
14 | populationBalanceSubModels/aggregationKernels/aggregationKernel/newAggregationKernel.C | ||
15 | populationBalanceSubModels/aggregationKernels/Brownian/Brownian.C | ||
16 | populationBalanceSubModels/aggregationKernels/constantAggregation/constantAggregation.C | ||
17 | populationBalanceSubModels/aggregationKernels/differentialForceAggregation/differentialForceAggregation.C | ||
18 | populationBalanceSubModels/aggregationKernels/hydrodynamicAggregation/hydrodynamicAggregation.C | ||
19 | populationBalanceSubModels/aggregationKernels/sumAggregation/sumAggregation.C | ||
20 | populationBalanceSubModels/aggregationKernels/turbulentBrownian/turbulentBrownian.C | ||
21 | |||
22 | populationBalanceSubModels/breakupKernels/breakupKernel/breakupKernel.C | ||
23 | populationBalanceSubModels/breakupKernels/breakupKernel/newBreakupKernel.C | ||
24 | populationBalanceSubModels/breakupKernels/AyaziShamlou/AyaziShamlou.C | ||
25 | populationBalanceSubModels/breakupKernels/constantBreakup/constantBreakup.C | ||
26 | populationBalanceSubModels/breakupKernels/exponentialBreakup/exponentialBreakup.C | ||
27 | populationBalanceSubModels/breakupKernels/LuoSvendsen/LuoSvendsen.C | ||
28 | populationBalanceSubModels/breakupKernels/powerLawBreakup/powerLawBreakup.C | ||
29 | |||
30 | populationBalanceSubModels/growthModels/growthModel/growthModel.C | ||
31 | populationBalanceSubModels/growthModels/growthModel/newGrowthModel.C | ||
32 | populationBalanceSubModels/growthModels/constantGrowth/constantGrowth.C | ||
33 | |||
34 | populationBalanceSubModels/diffusionModels/diffusionModel/diffusionModel.C | ||
35 | populationBalanceSubModels/diffusionModels/diffusionModel/newDiffusionModel.C | ||
36 | populationBalanceSubModels/diffusionModels/noDiffusion/noDiffusion.C | ||
37 | populationBalanceSubModels/diffusionModels/turbulentDiffusion/turbulentDiffusion.C | ||
38 | populationBalanceSubModels/diffusionModels/molecularDiffusion/molecularDiffusion.C | ||
39 | |||
40 | populationBalanceSubModels/nucleationModels/nucleationModel/nucleationModel.C | ||
41 | populationBalanceSubModels/nucleationModels/nucleationModel/newNucleationModel.C | ||
42 | populationBalanceSubModels/nucleationModels/noNucleation/noNucleation.C | ||
43 | populationBalanceSubModels/nucleationModels/Miller/Miller.C | ||
44 | |||
45 | noPopulationBalance/noPopulationBalance.C | ||
46 | univariatePopulationBalance/univariatePopulationBalance.C | ||
47 | |||
48 | LIB = $(FOAM_USER_LIBBIN)/libpopulationBalance |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/Make/options added (mode: 100644) (index 0000000..5d17201) | |||
1 | EXE_INC = \ | ||
2 | -I$(LIB_SRC)/transportModels \ | ||
3 | -I$(LIB_SRC)/transportModels/compressible/lnInclude \ | ||
4 | -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ | ||
5 | -I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \ | ||
6 | -I$(LIB_SRC)/TurbulenceModels/incompressible/lnInclude \ | ||
7 | -I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \ | ||
8 | -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ | ||
9 | -I$(LIB_SRC)/finiteVolume/lnInclude \ | ||
10 | -I$(LIB_SRC)/meshTools/lnInclude \ | ||
11 | -I../../eigenSolver/lnInclude \ | ||
12 | -I../univariateMomentSet/lnInclude \ | ||
13 | -I../extentedMomentInversion/lnInclude \ | ||
14 | -I../quadratureNode \ | ||
15 | -I../moments \ | ||
16 | -I../quadratureApproximation/lnInclude \ | ||
17 | -I../PDFTransportModels/lnInclude | ||
18 | |||
19 | LIB_LIBS = \ | ||
20 | -lincompressibleTransportModels \ | ||
21 | -lcompressibleTransportModels \ | ||
22 | -lfluidThermophysicalModels \ | ||
23 | -lspecie \ | ||
24 | -lturbulenceModels \ | ||
25 | -lincompressibleTurbulenceModels \ | ||
26 | -lcompressibleTurbulenceModels \ | ||
27 | -lfiniteVolume \ | ||
28 | -lmeshTools \ | ||
29 | -L$(FOAM_USER_LIBBIN) \ | ||
30 | -leigenSolver \ | ||
31 | -lmomentSet \ | ||
32 | -lextendedMomentInversion \ | ||
33 | -lquadratureApproximation \ | ||
34 | -lPDFTransportModel |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/noPopulationBalance/noPopulationBalance.C added (mode: 100644) (index 0000000..0fc493d) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2015-2016 Alberto Passalacqua | ||
6 | \\/ M anipulation | | ||
7 | ------------------------------------------------------------------------------- | ||
8 | License | ||
9 | This file is derivative work 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 "noPopulationBalance.H" | ||
27 | #include "addToRunTimeSelectionTable.H" | ||
28 | |||
29 | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // | ||
30 | |||
31 | namespace Foam | ||
32 | { | ||
33 | namespace populationBalanceModels | ||
34 | { | ||
35 | defineTypeNameAndDebug(noPopulationBalance, 0); | ||
36 | addToRunTimeSelectionTable | ||
37 | ( | ||
38 | populationBalanceModel, | ||
39 | noPopulationBalance, | ||
40 | dictionary | ||
41 | ); | ||
42 | } | ||
43 | } | ||
44 | |||
45 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | ||
46 | |||
47 | Foam::populationBalanceModels::noPopulationBalance::noPopulationBalance | ||
48 | ( | ||
49 | const word& name, | ||
50 | const dictionary& dict, | ||
51 | const volVectorField& U, | ||
52 | const surfaceScalarField& phi | ||
53 | ) | ||
54 | : | ||
55 | populationBalanceModel(name, dict, U, phi), | ||
56 | name_(name) | ||
57 | {} | ||
58 | |||
59 | |||
60 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | ||
61 | |||
62 | Foam::populationBalanceModels::noPopulationBalance::~noPopulationBalance() | ||
63 | {} | ||
64 | |||
65 | |||
66 | // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // | ||
67 | |||
68 | void Foam::populationBalanceModels::noPopulationBalance::solve() | ||
69 | { | ||
70 | return; | ||
71 | } | ||
72 | |||
73 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/noPopulationBalance/noPopulationBalance.H added (mode: 100644) (index 0000000..c7f660c) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2015-2016 Alberto Passalacqua | ||
6 | \\/ M anipulation | | ||
7 | ------------------------------------------------------------------------------- | ||
8 | License | ||
9 | This file is derivative work 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 | Class | ||
25 | Foam::populationBalanceModels::noPopulationBalance | ||
26 | |||
27 | Description | ||
28 | Disables the solution of the population balance model. | ||
29 | |||
30 | SourceFiles | ||
31 | noPopulationBalance.C | ||
32 | |||
33 | \*---------------------------------------------------------------------------*/ | ||
34 | |||
35 | #ifndef noPopulationBalance_H | ||
36 | #define noPopulationBalance_H | ||
37 | |||
38 | #include "populationBalanceModel.H" | ||
39 | |||
40 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
41 | |||
42 | namespace Foam | ||
43 | { | ||
44 | namespace populationBalanceModels | ||
45 | { | ||
46 | |||
47 | /*---------------------------------------------------------------------------*\ | ||
48 | Class noPopulationBalance Declaration | ||
49 | \*---------------------------------------------------------------------------*/ | ||
50 | |||
51 | class noPopulationBalance | ||
52 | : | ||
53 | public populationBalanceModel | ||
54 | { | ||
55 | // Private data | ||
56 | |||
57 | //- Name of the noPopulationBalance | ||
58 | const word name_; | ||
59 | |||
60 | |||
61 | public: | ||
62 | |||
63 | //- Runtime type information | ||
64 | TypeName("none"); | ||
65 | |||
66 | |||
67 | // Constructors | ||
68 | |||
69 | //- Construct from components | ||
70 | noPopulationBalance | ||
71 | ( | ||
72 | const word& name, | ||
73 | const dictionary& dict, | ||
74 | const volVectorField& U, | ||
75 | const surfaceScalarField& phi | ||
76 | ); | ||
77 | |||
78 | |||
79 | //- Destructor | ||
80 | virtual ~noPopulationBalance(); | ||
81 | |||
82 | // Member Functions | ||
83 | |||
84 | //- Solve population balance equation | ||
85 | void solve(); | ||
86 | }; | ||
87 | |||
88 | |||
89 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
90 | |||
91 | } // End namespace populationBalanceModels | ||
92 | } // End namespace Foam | ||
93 | |||
94 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
95 | |||
96 | #endif | ||
97 | |||
98 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceModel/newPopulationBalanceModel.C added (mode: 100644) (index 0000000..e66adc1) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2015-2016 Alberto Passalacqua | ||
6 | \\/ M anipulation | | ||
7 | ------------------------------------------------------------------------------- | ||
8 | License | ||
9 | This file is derivative work 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 "populationBalanceModel.H" | ||
27 | |||
28 | // * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * // | ||
29 | |||
30 | Foam::autoPtr<Foam::populationBalanceModel> | ||
31 | Foam::populationBalanceModel::New | ||
32 | ( | ||
33 | const word& name, | ||
34 | const dictionary& dict, | ||
35 | const volVectorField& U, | ||
36 | const surfaceScalarField& phi | ||
37 | ) | ||
38 | { | ||
39 | word populationBalanceModelType(dict.lookup("populationBalanceModel")); | ||
40 | |||
41 | Info<< "Selecting populationBalanceModel " | ||
42 | << populationBalanceModelType << endl; | ||
43 | |||
44 | dictionaryConstructorTable::iterator cstrIter = | ||
45 | dictionaryConstructorTablePtr_->find(populationBalanceModelType); | ||
46 | |||
47 | if (cstrIter == dictionaryConstructorTablePtr_->end()) | ||
48 | { | ||
49 | FatalErrorInFunction | ||
50 | << "Unknown populationBalanceModelType type " | ||
51 | << populationBalanceModelType << endl << endl | ||
52 | << "Valid populationBalanceModelType types are :" << endl | ||
53 | << dictionaryConstructorTablePtr_->sortedToc() | ||
54 | << abort(FatalError); | ||
55 | } | ||
56 | |||
57 | return | ||
58 | autoPtr<populationBalanceModel> | ||
59 | ( | ||
60 | cstrIter() | ||
61 | ( | ||
62 | name, | ||
63 | dict.subDict(populationBalanceModelType + "Coeffs"), | ||
64 | U, | ||
65 | phi | ||
66 | ) | ||
67 | ); | ||
68 | } | ||
69 | |||
70 | |||
71 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceModel/populationBalanceModel.C added (mode: 100644) (index 0000000..52ed744) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2015-2016 Alberto Passalacqua | ||
6 | \\/ M anipulation | | ||
7 | ------------------------------------------------------------------------------- | ||
8 | License | ||
9 | This file is derivative work 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 "populationBalanceModel.H" | ||
27 | |||
28 | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // | ||
29 | |||
30 | namespace Foam | ||
31 | { | ||
32 | defineTypeNameAndDebug(populationBalanceModel, 0); | ||
33 | defineRunTimeSelectionTable(populationBalanceModel, dictionary); | ||
34 | } | ||
35 | |||
36 | |||
37 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | ||
38 | |||
39 | Foam::populationBalanceModel::populationBalanceModel | ||
40 | ( | ||
41 | const word& name, | ||
42 | const dictionary& dict, | ||
43 | const volVectorField& U, | ||
44 | const surfaceScalarField& phi | ||
45 | ) | ||
46 | : | ||
47 | name_(name), | ||
48 | phi_(phi) | ||
49 | {} | ||
50 | |||
51 | |||
52 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | ||
53 | |||
54 | Foam::populationBalanceModel::~populationBalanceModel() | ||
55 | {} | ||
56 | |||
57 | |||
58 | // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // | ||
59 | |||
60 | |||
61 | |||
62 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceModel/populationBalanceModel.H added (mode: 100644) (index 0000000..5b4bea9) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2015-2016 Alberto Passalacqua | ||
6 | \\/ M anipulation | | ||
7 | ------------------------------------------------------------------------------- | ||
8 | License | ||
9 | This file is derivative work 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 | Class | ||
25 | Foam::populationBalanceModel | ||
26 | |||
27 | Description | ||
28 | Abstract class for the run-time selection of the population balance model. | ||
29 | |||
30 | SourceFiles | ||
31 | populationBalanceModel.C | ||
32 | |||
33 | \*---------------------------------------------------------------------------*/ | ||
34 | |||
35 | #ifndef populationBalanceModel_H | ||
36 | #define populationBalanceModel_H | ||
37 | |||
38 | #include "dictionary.H" | ||
39 | #include "volFields.H" | ||
40 | #include "dimensionedTypes.H" | ||
41 | #include "runTimeSelectionTables.H" | ||
42 | |||
43 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
44 | |||
45 | namespace Foam | ||
46 | { | ||
47 | |||
48 | /*---------------------------------------------------------------------------*\ | ||
49 | Class populationBalanceModel Declaration | ||
50 | \*---------------------------------------------------------------------------*/ | ||
51 | |||
52 | class populationBalanceModel | ||
53 | { | ||
54 | // Private data | ||
55 | |||
56 | //- Name of the populationBalanceModel | ||
57 | const word name_; | ||
58 | |||
59 | // Private Member Functions | ||
60 | |||
61 | //- Disallow default bitwise copy construct | ||
62 | populationBalanceModel(const populationBalanceModel&); | ||
63 | |||
64 | //- Disallow default bitwise assignment | ||
65 | void operator=(const populationBalanceModel&); | ||
66 | |||
67 | |||
68 | protected: | ||
69 | |||
70 | // Protected data | ||
71 | |||
72 | //- Fluid-phase face-normal velocity | ||
73 | const surfaceScalarField& phi_; | ||
74 | |||
75 | |||
76 | public: | ||
77 | |||
78 | //- Runtime type information | ||
79 | TypeName("populationBalanceModel"); | ||
80 | |||
81 | // Declare runtime constructor selection table | ||
82 | declareRunTimeSelectionTable | ||
83 | ( | ||
84 | autoPtr, | ||
85 | populationBalanceModel, | ||
86 | dictionary, | ||
87 | ( | ||
88 | const word& name, | ||
89 | const dictionary& dict, | ||
90 | const volVectorField& U, | ||
91 | const surfaceScalarField& phi | ||
92 | ), | ||
93 | (name, dict, U, phi) | ||
94 | ); | ||
95 | |||
96 | |||
97 | // Constructors | ||
98 | |||
99 | //- Construct from components | ||
100 | populationBalanceModel | ||
101 | ( | ||
102 | const word& name, | ||
103 | const dictionary& dict, | ||
104 | const volVectorField& U, | ||
105 | const surfaceScalarField& phi | ||
106 | ); | ||
107 | |||
108 | |||
109 | // Selectors | ||
110 | |||
111 | //- Select null constructed | ||
112 | static autoPtr<populationBalanceModel> New | ||
113 | ( | ||
114 | const word& name, | ||
115 | const dictionary& dict, | ||
116 | const volVectorField& U, | ||
117 | const surfaceScalarField& phi | ||
118 | ); | ||
119 | |||
120 | |||
121 | //- Destructor | ||
122 | virtual ~populationBalanceModel(); | ||
123 | |||
124 | |||
125 | // Member Functions | ||
126 | |||
127 | //- Solve population balance equation | ||
128 | virtual void solve() = 0; | ||
129 | |||
130 | }; | ||
131 | |||
132 | |||
133 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
134 | |||
135 | } // End namespace Foam | ||
136 | |||
137 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
138 | |||
139 | #endif | ||
140 | |||
141 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/aggregationKernels/Brownian/Brownian.C added (mode: 100644) (index 0000000..d677437) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2015 Alberto Passalacqua | ||
6 | \\/ M anipulation | | ||
7 | ------------------------------------------------------------------------------- | ||
8 | License | ||
9 | This file is derivative work 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 "Brownian.H" | ||
27 | #include "addToRunTimeSelectionTable.H" | ||
28 | #include "turbulentFluidThermoModel.H" | ||
29 | #include "fundamentalConstants.H" | ||
30 | |||
31 | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // | ||
32 | |||
33 | namespace Foam | ||
34 | { | ||
35 | namespace populationBalanceSubModels | ||
36 | { | ||
37 | namespace aggregationKernels | ||
38 | { | ||
39 | defineTypeNameAndDebug(Brownian, 0); | ||
40 | |||
41 | addToRunTimeSelectionTable | ||
42 | ( | ||
43 | aggregationKernel, | ||
44 | Brownian, | ||
45 | dictionary | ||
46 | ); | ||
47 | } | ||
48 | } | ||
49 | } | ||
50 | |||
51 | |||
52 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | ||
53 | |||
54 | Foam::populationBalanceSubModels::aggregationKernels::Brownian | ||
55 | ::Brownian | ||
56 | ( | ||
57 | const dictionary& dict | ||
58 | ) | ||
59 | : | ||
60 | aggregationKernel(dict) | ||
61 | {} | ||
62 | |||
63 | |||
64 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | ||
65 | |||
66 | Foam::populationBalanceSubModels::aggregationKernels::Brownian | ||
67 | ::~Brownian() | ||
68 | {} | ||
69 | |||
70 | |||
71 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | ||
72 | |||
73 | Foam::tmp<Foam::volScalarField> | ||
74 | Foam::populationBalanceSubModels::aggregationKernels::Brownian::Ka | ||
75 | ( | ||
76 | const volScalarField& abscissa1, | ||
77 | const volScalarField& abscissa2 | ||
78 | ) const | ||
79 | { | ||
80 | if (!abscissa1.mesh().foundObject<fluidThermo>(basicThermo::dictName)) | ||
81 | { | ||
82 | FatalErrorInFunction | ||
83 | << "No valid thermophysical model found." | ||
84 | << abort(FatalError); | ||
85 | } | ||
86 | |||
87 | const fluidThermo& flThermo = | ||
88 | abscissa1.mesh().lookupObject<fluidThermo>(basicThermo::dictName); | ||
89 | |||
90 | dimensionedScalar smallAbs("smallAbs", sqr(abscissa1.dimensions()), SMALL); | ||
91 | |||
92 | return | ||
93 | 2.0*Foam::constant::physicoChemical::k*flThermo.T() | ||
94 | *sqr(abscissa1 + abscissa2)/(3.0*flThermo.mu() | ||
95 | *max(abscissa1*abscissa2, smallAbs)); | ||
96 | } | ||
97 | |||
98 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/aggregationKernels/Brownian/Brownian.H added (mode: 100644) (index 0000000..0f4ecbb) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2015 Alberto Passalacqua | ||
6 | \\/ M anipulation | | ||
7 | ------------------------------------------------------------------------------- | ||
8 | License | ||
9 | This file is derivative work 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 | Class | ||
25 | Foam::populationBalanceSubModels::aggregationKernels::Brownian | ||
26 | |||
27 | Description | ||
28 | Brownian aggregation kernel. | ||
29 | |||
30 | Reference | ||
31 | \verbatim | ||
32 | "Versuch Einer Mathematischen Theorie Der Koagulationskinetic Kolloider | ||
33 | Losunger" | ||
34 | M X Smoluchowski | ||
35 | Zeitschrift fur Physikalische Chemie | ||
36 | Volume 92, Pages 129-142, 1917 | ||
37 | \endverbatim | ||
38 | |||
39 | SourceFiles | ||
40 | Brownian.C | ||
41 | |||
42 | \*---------------------------------------------------------------------------*/ | ||
43 | |||
44 | #ifndef Brownian_H | ||
45 | #define Brownian_H | ||
46 | |||
47 | #include "aggregationKernel.H" | ||
48 | |||
49 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
50 | |||
51 | namespace Foam | ||
52 | { | ||
53 | namespace populationBalanceSubModels | ||
54 | { | ||
55 | namespace aggregationKernels | ||
56 | { | ||
57 | |||
58 | /*---------------------------------------------------------------------------*\ | ||
59 | Class Brownian Declaration | ||
60 | \*---------------------------------------------------------------------------*/ | ||
61 | |||
62 | class Brownian | ||
63 | : | ||
64 | public aggregationKernel | ||
65 | { | ||
66 | public: | ||
67 | |||
68 | //- Runtime type information | ||
69 | TypeName("Brownian"); | ||
70 | |||
71 | |||
72 | // Constructors | ||
73 | |||
74 | //- Construct from components | ||
75 | Brownian(const dictionary& dict); | ||
76 | |||
77 | |||
78 | //- Destructor | ||
79 | virtual ~Brownian(); | ||
80 | |||
81 | |||
82 | // Member Functions | ||
83 | |||
84 | //- Aggregation kernel | ||
85 | virtual tmp<volScalarField> Ka | ||
86 | ( | ||
87 | const volScalarField& abscissa1, | ||
88 | const volScalarField& abscissa2 | ||
89 | ) const; | ||
90 | |||
91 | }; | ||
92 | |||
93 | |||
94 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
95 | |||
96 | } // End namespace aggregationKernels | ||
97 | } // End namespace populationBalanceSubModels | ||
98 | } // End namespace Foam | ||
99 | |||
100 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
101 | |||
102 | #endif | ||
103 | |||
104 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/aggregationKernels/aggregationKernel/aggregationKernel.C added (mode: 100644) (index 0000000..a3aef66) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2015 Alberto Passalacqua | ||
6 | \\/ M anipulation | | ||
7 | ------------------------------------------------------------------------------- | ||
8 | License | ||
9 | This file is derivative work 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 "aggregationKernel.H" | ||
27 | |||
28 | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // | ||
29 | |||
30 | namespace Foam | ||
31 | { | ||
32 | namespace populationBalanceSubModels | ||
33 | { | ||
34 | defineTypeNameAndDebug(aggregationKernel, 0); | ||
35 | |||
36 | defineRunTimeSelectionTable(aggregationKernel, dictionary); | ||
37 | } | ||
38 | } | ||
39 | |||
40 | |||
41 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | ||
42 | |||
43 | Foam::populationBalanceSubModels::aggregationKernel::aggregationKernel | ||
44 | ( | ||
45 | const dictionary& dict | ||
46 | ) | ||
47 | : | ||
48 | dict_(dict), | ||
49 | Ca_ | ||
50 | ( | ||
51 | dict.lookupOrDefault | ||
52 | ( | ||
53 | "Ca", | ||
54 | dimensionedScalar("one", inv(dimTime), 1.0) | ||
55 | ) | ||
56 | ) | ||
57 | {} | ||
58 | |||
59 | |||
60 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | ||
61 | |||
62 | Foam::populationBalanceSubModels::aggregationKernel::~aggregationKernel() | ||
63 | {} | ||
64 | |||
65 | |||
66 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/aggregationKernels/aggregationKernel/aggregationKernel.H added (mode: 100644) (index 0000000..eb6de34) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2015 Alberto Passalacqua | ||
6 | \\/ M anipulation | | ||
7 | ------------------------------------------------------------------------------- | ||
8 | License | ||
9 | This file is derivative work 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 | Class | ||
25 | Foam::populationBalanceSubModels::aggregationKernel | ||
26 | |||
27 | Description | ||
28 | Abstract class for aggregation kernels. | ||
29 | |||
30 | SourceFiles | ||
31 | aggregationKernel.C | ||
32 | |||
33 | \*---------------------------------------------------------------------------*/ | ||
34 | |||
35 | #ifndef aggregationKernel_H | ||
36 | #define aggregationKernel_H | ||
37 | |||
38 | #include "dictionary.H" | ||
39 | #include "volFields.H" | ||
40 | #include "dimensionedTypes.H" | ||
41 | #include "runTimeSelectionTables.H" | ||
42 | |||
43 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
44 | |||
45 | namespace Foam | ||
46 | { | ||
47 | namespace populationBalanceSubModels | ||
48 | { | ||
49 | |||
50 | /*---------------------------------------------------------------------------*\ | ||
51 | Class aggregationKernel Declaration | ||
52 | \*---------------------------------------------------------------------------*/ | ||
53 | |||
54 | class aggregationKernel | ||
55 | { | ||
56 | // Private member functions | ||
57 | |||
58 | //- Disallow default bitwise copy construct | ||
59 | aggregationKernel(const aggregationKernel&); | ||
60 | |||
61 | //- Disallow default bitwise assignment | ||
62 | void operator=(const aggregationKernel&); | ||
63 | |||
64 | |||
65 | protected: | ||
66 | |||
67 | // Protected data | ||
68 | |||
69 | const dictionary& dict_; | ||
70 | |||
71 | //- Coefficient of aggregation kernel | ||
72 | const dimensionedScalar Ca_; | ||
73 | |||
74 | |||
75 | public: | ||
76 | |||
77 | //- Runtime type information | ||
78 | TypeName("aggregationKernel"); | ||
79 | |||
80 | // Declare runtime constructor selection table | ||
81 | declareRunTimeSelectionTable | ||
82 | ( | ||
83 | autoPtr, | ||
84 | aggregationKernel, | ||
85 | dictionary, | ||
86 | ( | ||
87 | const dictionary& dict | ||
88 | ), | ||
89 | (dict) | ||
90 | ); | ||
91 | |||
92 | |||
93 | // Constructors | ||
94 | |||
95 | //- Construct from components | ||
96 | aggregationKernel(const dictionary& dict); | ||
97 | |||
98 | |||
99 | // Selectors | ||
100 | |||
101 | static autoPtr<aggregationKernel> New | ||
102 | ( | ||
103 | const dictionary& dict | ||
104 | ); | ||
105 | |||
106 | |||
107 | //- Destructor | ||
108 | virtual ~aggregationKernel(); | ||
109 | |||
110 | |||
111 | // Member Functions | ||
112 | |||
113 | //- Aggregation kernel | ||
114 | virtual tmp<volScalarField> Ka | ||
115 | ( | ||
116 | const volScalarField& abscissa1, | ||
117 | const volScalarField& abscissa2 | ||
118 | ) const = 0; | ||
119 | }; | ||
120 | |||
121 | |||
122 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
123 | |||
124 | } // End namespace populationBalanceSubModels | ||
125 | } // End namespace Foam | ||
126 | |||
127 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
128 | |||
129 | #endif | ||
130 | |||
131 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/aggregationKernels/aggregationKernel/newAggregationKernel.C added (mode: 100644) (index 0000000..aeca6b7) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2015 Alberto Passalacqua | ||
6 | \\/ M anipulation | | ||
7 | ------------------------------------------------------------------------------- | ||
8 | License | ||
9 | This file is derivative work 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 "aggregationKernel.H" | ||
27 | |||
28 | // * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * // | ||
29 | |||
30 | Foam::autoPtr<Foam::populationBalanceSubModels::aggregationKernel> | ||
31 | Foam::populationBalanceSubModels::aggregationKernel::New | ||
32 | ( | ||
33 | const dictionary& dict | ||
34 | ) | ||
35 | { | ||
36 | word aggregationKernelType(dict.lookup("aggregationKernel")); | ||
37 | |||
38 | Info<< "Selecting aggregationKernel " | ||
39 | << aggregationKernelType << endl; | ||
40 | |||
41 | dictionaryConstructorTable::iterator cstrIter = | ||
42 | dictionaryConstructorTablePtr_->find(aggregationKernelType); | ||
43 | |||
44 | if (cstrIter == dictionaryConstructorTablePtr_->end()) | ||
45 | { | ||
46 | FatalErrorInFunction | ||
47 | << "Unknown aggregationKernelType type " | ||
48 | << aggregationKernelType << endl << endl | ||
49 | << "Valid aggregationKernelType types are :" << endl | ||
50 | << dictionaryConstructorTablePtr_->sortedToc() | ||
51 | << abort(FatalError); | ||
52 | } | ||
53 | |||
54 | return autoPtr<aggregationKernel>(cstrIter()(dict)); | ||
55 | } | ||
56 | |||
57 | |||
58 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/aggregationKernels/constantAggregation/constantAggregation.C added (mode: 100644) (index 0000000..31f6fbb) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2015 Alberto Passalacqua | ||
6 | \\/ M anipulation | | ||
7 | ------------------------------------------------------------------------------- | ||
8 | License | ||
9 | This file is derivative work 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 "constantAggregation.H" | ||
27 | #include "addToRunTimeSelectionTable.H" | ||
28 | |||
29 | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // | ||
30 | |||
31 | namespace Foam | ||
32 | { | ||
33 | namespace populationBalanceSubModels | ||
34 | { | ||
35 | namespace aggregationKernels | ||
36 | { | ||
37 | defineTypeNameAndDebug(constantAggregation, 0); | ||
38 | |||
39 | addToRunTimeSelectionTable | ||
40 | ( | ||
41 | aggregationKernel, | ||
42 | constantAggregation, | ||
43 | dictionary | ||
44 | ); | ||
45 | } | ||
46 | } | ||
47 | } | ||
48 | |||
49 | |||
50 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | ||
51 | |||
52 | Foam::populationBalanceSubModels::aggregationKernels::constantAggregation | ||
53 | ::constantAggregation | ||
54 | ( | ||
55 | const dictionary& dict | ||
56 | ) | ||
57 | : | ||
58 | aggregationKernel(dict) | ||
59 | {} | ||
60 | |||
61 | |||
62 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | ||
63 | |||
64 | Foam::populationBalanceSubModels::aggregationKernels::constantAggregation | ||
65 | ::~constantAggregation() | ||
66 | {} | ||
67 | |||
68 | |||
69 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | ||
70 | |||
71 | Foam::tmp<Foam::volScalarField> | ||
72 | Foam::populationBalanceSubModels::aggregationKernels::constantAggregation::Ka | ||
73 | ( | ||
74 | const volScalarField& abscissa1, | ||
75 | const volScalarField& abscissa2 | ||
76 | ) const | ||
77 | { | ||
78 | return | ||
79 | tmp<volScalarField> | ||
80 | ( | ||
81 | new volScalarField | ||
82 | ( | ||
83 | IOobject | ||
84 | ( | ||
85 | "constantAggregationK", | ||
86 | abscissa1.mesh().time().timeName(), | ||
87 | abscissa1.mesh() | ||
88 | ), | ||
89 | abscissa1.mesh(), | ||
90 | dimensionedScalar | ||
91 | ( | ||
92 | "constAggK", | ||
93 | pow3(abscissa1.dimensions())/dimTime, | ||
94 | Ca_.value() | ||
95 | ) | ||
96 | ) | ||
97 | ); | ||
98 | } | ||
99 | |||
100 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/aggregationKernels/constantAggregation/constantAggregation.H added (mode: 100644) (index 0000000..254bd89) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2015 Alberto Passalacqua | ||
6 | \\/ M anipulation | | ||
7 | ------------------------------------------------------------------------------- | ||
8 | License | ||
9 | This file is derivative work 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 | Class | ||
25 | Foam::populationBalanceSubModels::aggregationKernels::constantAggregation | ||
26 | |||
27 | Description | ||
28 | Constant aggregation kernel. The value of the kernel is read from dictionary | ||
29 | or assumed equal to 1. | ||
30 | |||
31 | SourceFiles | ||
32 | constantAggregation.C | ||
33 | |||
34 | \*---------------------------------------------------------------------------*/ | ||
35 | |||
36 | #ifndef constantAggregation_H | ||
37 | #define constantAggregation_H | ||
38 | |||
39 | #include "aggregationKernel.H" | ||
40 | |||
41 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
42 | |||
43 | namespace Foam | ||
44 | { | ||
45 | namespace populationBalanceSubModels | ||
46 | { | ||
47 | namespace aggregationKernels | ||
48 | { | ||
49 | |||
50 | /*---------------------------------------------------------------------------*\ | ||
51 | Class constantAggregation Declaration | ||
52 | \*---------------------------------------------------------------------------*/ | ||
53 | |||
54 | class constantAggregation | ||
55 | : | ||
56 | public aggregationKernel | ||
57 | { | ||
58 | public: | ||
59 | |||
60 | //- Runtime type information | ||
61 | TypeName("constant"); | ||
62 | |||
63 | |||
64 | // Constructors | ||
65 | |||
66 | //- Construct from components | ||
67 | constantAggregation(const dictionary& dict); | ||
68 | |||
69 | |||
70 | //- Destructor | ||
71 | virtual ~constantAggregation(); | ||
72 | |||
73 | |||
74 | // Member Functions | ||
75 | |||
76 | //- Aggregation kernel | ||
77 | virtual tmp<volScalarField> Ka | ||
78 | ( | ||
79 | const volScalarField& abscissa1, | ||
80 | const volScalarField& abscissa2 | ||
81 | ) const; | ||
82 | |||
83 | }; | ||
84 | |||
85 | |||
86 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
87 | |||
88 | } // End namespace aggregationKernels | ||
89 | } // End namespace populationBalanceSubModels | ||
90 | } // End namespace Foam | ||
91 | |||
92 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
93 | |||
94 | #endif | ||
95 | |||
96 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/aggregationKernels/differentialForceAggregation/differentialForceAggregation.C added (mode: 100644) (index 0000000..91748e3) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2015 Alberto Passalacqua | ||
6 | \\/ M anipulation | | ||
7 | ------------------------------------------------------------------------------- | ||
8 | License | ||
9 | This file is derivative work 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 "differentialForceAggregation.H" | ||
27 | #include "addToRunTimeSelectionTable.H" | ||
28 | |||
29 | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // | ||
30 | |||
31 | namespace Foam | ||
32 | { | ||
33 | namespace populationBalanceSubModels | ||
34 | { | ||
35 | namespace aggregationKernels | ||
36 | { | ||
37 | defineTypeNameAndDebug(differentialForceAggregation, 0); | ||
38 | |||
39 | addToRunTimeSelectionTable | ||
40 | ( | ||
41 | aggregationKernel, | ||
42 | differentialForceAggregation, | ||
43 | dictionary | ||
44 | ); | ||
45 | } | ||
46 | } | ||
47 | } | ||
48 | |||
49 | |||
50 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | ||
51 | |||
52 | Foam::populationBalanceSubModels::aggregationKernels | ||
53 | ::differentialForceAggregation::differentialForceAggregation | ||
54 | ( | ||
55 | const dictionary& dict | ||
56 | ) | ||
57 | : | ||
58 | aggregationKernel(dict) | ||
59 | {} | ||
60 | |||
61 | |||
62 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | ||
63 | |||
64 | Foam::populationBalanceSubModels::aggregationKernels | ||
65 | ::differentialForceAggregation::~differentialForceAggregation() | ||
66 | {} | ||
67 | |||
68 | |||
69 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | ||
70 | |||
71 | Foam::tmp<Foam::volScalarField> Foam::populationBalanceSubModels | ||
72 | ::aggregationKernels::differentialForceAggregation::Ka | ||
73 | ( | ||
74 | const volScalarField& abscissa1, | ||
75 | const volScalarField& abscissa2 | ||
76 | ) const | ||
77 | { | ||
78 | tmp<volScalarField> aggK | ||
79 | = Ca_*sqr(abscissa1 + abscissa2)*mag(sqr(abscissa1) - sqr(abscissa2)); | ||
80 | |||
81 | aggK.ref().dimensions().reset(pow3(abscissa1.dimensions())/dimTime); | ||
82 | |||
83 | return aggK; | ||
84 | } | ||
85 | |||
86 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/aggregationKernels/differentialForceAggregation/differentialForceAggregation.H added (mode: 100644) (index 0000000..0c59b3b) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2015 Alberto Passalacqua | ||
6 | \\/ M anipulation | | ||
7 | ------------------------------------------------------------------------------- | ||
8 | License | ||
9 | This file is derivative work 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 | Class | ||
25 | Foam::populationBalanceSubModels::aggregationKernels | ||
26 | ::differentialForceAggregation | ||
27 | |||
28 | Description | ||
29 | Differential force aggregation kernel with user defined coefficient | ||
30 | (default Cagg = 1). | ||
31 | |||
32 | SourceFiles | ||
33 | differentialForceAggregation.C | ||
34 | |||
35 | \*---------------------------------------------------------------------------*/ | ||
36 | |||
37 | #ifndef differentialForceAggregation_H | ||
38 | #define differentialForceAggregation_H | ||
39 | |||
40 | #include "aggregationKernel.H" | ||
41 | |||
42 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
43 | |||
44 | namespace Foam | ||
45 | { | ||
46 | namespace populationBalanceSubModels | ||
47 | { | ||
48 | namespace aggregationKernels | ||
49 | { | ||
50 | |||
51 | /*---------------------------------------------------------------------------*\ | ||
52 | Class differentialForceAggregation Declaration | ||
53 | \*---------------------------------------------------------------------------*/ | ||
54 | |||
55 | class differentialForceAggregation | ||
56 | : | ||
57 | public aggregationKernel | ||
58 | { | ||
59 | public: | ||
60 | |||
61 | //- Runtime type information | ||
62 | TypeName("differentialForce"); | ||
63 | |||
64 | |||
65 | // Constructors | ||
66 | |||
67 | //- Construct from components | ||
68 | differentialForceAggregation(const dictionary& dict); | ||
69 | |||
70 | |||
71 | //- Destructor | ||
72 | virtual ~differentialForceAggregation(); | ||
73 | |||
74 | |||
75 | // Member Functions | ||
76 | |||
77 | //- Aggregation kernel | ||
78 | virtual tmp<volScalarField> Ka | ||
79 | ( | ||
80 | const volScalarField& abscissa1, | ||
81 | const volScalarField& abscissa2 | ||
82 | ) const; | ||
83 | |||
84 | }; | ||
85 | |||
86 | |||
87 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
88 | |||
89 | } // End namespace aggregationKernels | ||
90 | } // End namespace populationBalanceSubModels | ||
91 | } // End namespace Foam | ||
92 | |||
93 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
94 | |||
95 | #endif | ||
96 | |||
97 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/aggregationKernels/hydrodynamicAggregation/hydrodynamicAggregation.C added (mode: 100644) (index 0000000..be80659) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2015 Alberto Passalacqua | ||
6 | \\/ M anipulation | | ||
7 | ------------------------------------------------------------------------------- | ||
8 | License | ||
9 | This file is derivative work 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 "hydrodynamicAggregation.H" | ||
27 | #include "addToRunTimeSelectionTable.H" | ||
28 | |||
29 | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // | ||
30 | |||
31 | namespace Foam | ||
32 | { | ||
33 | namespace populationBalanceSubModels | ||
34 | { | ||
35 | namespace aggregationKernels | ||
36 | { | ||
37 | defineTypeNameAndDebug(hydrodynamicAggregation, 0); | ||
38 | |||
39 | addToRunTimeSelectionTable | ||
40 | ( | ||
41 | aggregationKernel, | ||
42 | hydrodynamicAggregation, | ||
43 | dictionary | ||
44 | ); | ||
45 | } | ||
46 | } | ||
47 | } | ||
48 | |||
49 | |||
50 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | ||
51 | |||
52 | Foam::populationBalanceSubModels::aggregationKernels::hydrodynamicAggregation | ||
53 | ::hydrodynamicAggregation | ||
54 | ( | ||
55 | const dictionary& dict | ||
56 | ) | ||
57 | : | ||
58 | aggregationKernel(dict) | ||
59 | {} | ||
60 | |||
61 | |||
62 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | ||
63 | |||
64 | Foam::populationBalanceSubModels::aggregationKernels::hydrodynamicAggregation | ||
65 | ::~hydrodynamicAggregation() | ||
66 | {} | ||
67 | |||
68 | |||
69 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | ||
70 | |||
71 | Foam::tmp<Foam::volScalarField> | ||
72 | Foam::populationBalanceSubModels::aggregationKernels::hydrodynamicAggregation | ||
73 | ::Ka | ||
74 | ( | ||
75 | const volScalarField& abscissa1, | ||
76 | const volScalarField& abscissa2 | ||
77 | ) const | ||
78 | { | ||
79 | return Ca_*pow3(abscissa1 + abscissa2); | ||
80 | } | ||
81 | |||
82 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/aggregationKernels/hydrodynamicAggregation/hydrodynamicAggregation.H added (mode: 100644) (index 0000000..c8e203d) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2015 Alberto Passalacqua | ||
6 | \\/ M anipulation | | ||
7 | ------------------------------------------------------------------------------- | ||
8 | License | ||
9 | This file is derivative work 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 | Class | ||
25 | Foam::populationBalanceSubModels::aggregationKernels | ||
26 | ::hydrodynamicAggregationAggregation | ||
27 | |||
28 | Description | ||
29 | Hydrodynamic aggregation kernel with user defined coefficient | ||
30 | (default Cagg = 1). | ||
31 | |||
32 | SourceFiles | ||
33 | hydrodynamicAggregation.C | ||
34 | |||
35 | \*---------------------------------------------------------------------------*/ | ||
36 | |||
37 | #ifndef hydrodynamicAggregation_H | ||
38 | #define hydrodynamicAggregation_H | ||
39 | |||
40 | #include "aggregationKernel.H" | ||
41 | |||
42 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
43 | |||
44 | namespace Foam | ||
45 | { | ||
46 | namespace populationBalanceSubModels | ||
47 | { | ||
48 | namespace aggregationKernels | ||
49 | { | ||
50 | |||
51 | /*---------------------------------------------------------------------------*\ | ||
52 | Class hydrodynamicAggregation Declaration | ||
53 | \*---------------------------------------------------------------------------*/ | ||
54 | |||
55 | class hydrodynamicAggregation | ||
56 | : | ||
57 | public aggregationKernel | ||
58 | { | ||
59 | public: | ||
60 | |||
61 | //- Runtime type information | ||
62 | TypeName("hydrodynamic"); | ||
63 | |||
64 | |||
65 | // Constructors | ||
66 | |||
67 | //- Construct from components | ||
68 | hydrodynamicAggregation(const dictionary& dict); | ||
69 | |||
70 | |||
71 | //- Destructor | ||
72 | virtual ~hydrodynamicAggregation(); | ||
73 | |||
74 | |||
75 | // Member Functions | ||
76 | |||
77 | //- Aggregation kernel | ||
78 | virtual tmp<volScalarField> Ka | ||
79 | ( | ||
80 | const volScalarField& abscissa1, | ||
81 | const volScalarField& abscissa2 | ||
82 | ) const; | ||
83 | |||
84 | }; | ||
85 | |||
86 | |||
87 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
88 | |||
89 | } // End namespace aggregationKernels | ||
90 | } // End namespace populationBalanceSubModels | ||
91 | } // End namespace Foam | ||
92 | |||
93 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
94 | |||
95 | #endif | ||
96 | |||
97 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/aggregationKernels/sumAggregation/sumAggregation.C added (mode: 100644) (index 0000000..6e91fe6) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2015 Alberto Passalacqua | ||
6 | \\/ M anipulation | | ||
7 | ------------------------------------------------------------------------------- | ||
8 | License | ||
9 | This file is derivative work 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 "sumAggregation.H" | ||
27 | #include "addToRunTimeSelectionTable.H" | ||
28 | |||
29 | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // | ||
30 | |||
31 | namespace Foam | ||
32 | { | ||
33 | namespace populationBalanceSubModels | ||
34 | { | ||
35 | namespace aggregationKernels | ||
36 | { | ||
37 | defineTypeNameAndDebug(sumAggregation, 0); | ||
38 | |||
39 | addToRunTimeSelectionTable | ||
40 | ( | ||
41 | aggregationKernel, | ||
42 | sumAggregation, | ||
43 | dictionary | ||
44 | ); | ||
45 | } | ||
46 | } | ||
47 | } | ||
48 | |||
49 | |||
50 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | ||
51 | |||
52 | Foam::populationBalanceSubModels::aggregationKernels::sumAggregation | ||
53 | ::sumAggregation | ||
54 | ( | ||
55 | const dictionary& dict | ||
56 | ) | ||
57 | : | ||
58 | aggregationKernel(dict) | ||
59 | {} | ||
60 | |||
61 | |||
62 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | ||
63 | |||
64 | Foam::populationBalanceSubModels::aggregationKernels::sumAggregation | ||
65 | ::~sumAggregation() | ||
66 | {} | ||
67 | |||
68 | |||
69 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | ||
70 | |||
71 | Foam::tmp<Foam::volScalarField> | ||
72 | Foam::populationBalanceSubModels::aggregationKernels::sumAggregation::Ka | ||
73 | ( | ||
74 | const volScalarField& abscissa1, | ||
75 | const volScalarField& abscissa2 | ||
76 | ) const | ||
77 | { | ||
78 | return Ca_*(pow3(abscissa1) + pow3(abscissa2)); | ||
79 | } | ||
80 | |||
81 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/aggregationKernels/sumAggregation/sumAggregation.H added (mode: 100644) (index 0000000..a5e3f2e) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2015 Alberto Passalacqua | ||
6 | \\/ M anipulation | | ||
7 | ------------------------------------------------------------------------------- | ||
8 | License | ||
9 | This file is derivative work 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 | Class | ||
25 | Foam::populationBalanceSubModels::aggregationKernels::sumAggregation | ||
26 | |||
27 | Description | ||
28 | Sum aggregation kernel with user defined coefficient (default Cagg = 1). | ||
29 | |||
30 | SourceFiles | ||
31 | sumAggregation.C | ||
32 | |||
33 | \*---------------------------------------------------------------------------*/ | ||
34 | |||
35 | #ifndef sumAggregation_H | ||
36 | #define sumAggregation_H | ||
37 | |||
38 | #include "aggregationKernel.H" | ||
39 | |||
40 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
41 | |||
42 | namespace Foam | ||
43 | { | ||
44 | namespace populationBalanceSubModels | ||
45 | { | ||
46 | namespace aggregationKernels | ||
47 | { | ||
48 | |||
49 | /*---------------------------------------------------------------------------*\ | ||
50 | Class sumAggregation Declaration | ||
51 | \*---------------------------------------------------------------------------*/ | ||
52 | |||
53 | class sumAggregation | ||
54 | : | ||
55 | public aggregationKernel | ||
56 | { | ||
57 | public: | ||
58 | |||
59 | //- Runtime type information | ||
60 | TypeName("sum"); | ||
61 | |||
62 | |||
63 | // Constructors | ||
64 | |||
65 | //- Construct from components | ||
66 | sumAggregation(const dictionary& dict); | ||
67 | |||
68 | |||
69 | //- Destructor | ||
70 | virtual ~sumAggregation(); | ||
71 | |||
72 | |||
73 | // Member Functions | ||
74 | |||
75 | //- Aggregation kernel | ||
76 | virtual tmp<volScalarField> Ka | ||
77 | ( | ||
78 | const volScalarField& abscissa1, | ||
79 | const volScalarField& abscissa2 | ||
80 | ) const; | ||
81 | |||
82 | }; | ||
83 | |||
84 | |||
85 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
86 | |||
87 | } // End namespace aggregationKernels | ||
88 | } // End namespace populationBalanceSubModels | ||
89 | } // End namespace Foam | ||
90 | |||
91 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
92 | |||
93 | #endif | ||
94 | |||
95 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/aggregationKernels/turbulentBrownian/turbulentBrownian.C added (mode: 100644) (index 0000000..11bf958) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2015 Alberto Passalacqua | ||
6 | \\/ M anipulation | | ||
7 | ------------------------------------------------------------------------------- | ||
8 | License | ||
9 | This file is derivative work 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 "turbulentBrownian.H" | ||
27 | #include "addToRunTimeSelectionTable.H" | ||
28 | #include "turbulentFluidThermoModel.H" | ||
29 | #include "fundamentalConstants.H" | ||
30 | |||
31 | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // | ||
32 | |||
33 | namespace Foam | ||
34 | { | ||
35 | namespace populationBalanceSubModels | ||
36 | { | ||
37 | namespace aggregationKernels | ||
38 | { | ||
39 | defineTypeNameAndDebug(turbulentBrownian, 0); | ||
40 | |||
41 | addToRunTimeSelectionTable | ||
42 | ( | ||
43 | aggregationKernel, | ||
44 | turbulentBrownian, | ||
45 | dictionary | ||
46 | ); | ||
47 | } | ||
48 | } | ||
49 | } | ||
50 | |||
51 | |||
52 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | ||
53 | |||
54 | Foam::populationBalanceSubModels::aggregationKernels::turbulentBrownian | ||
55 | ::turbulentBrownian | ||
56 | ( | ||
57 | const dictionary& dict | ||
58 | ) | ||
59 | : | ||
60 | aggregationKernel(dict) | ||
61 | {} | ||
62 | |||
63 | |||
64 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | ||
65 | |||
66 | Foam::populationBalanceSubModels::aggregationKernels::turbulentBrownian | ||
67 | ::~turbulentBrownian() | ||
68 | {} | ||
69 | |||
70 | |||
71 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | ||
72 | |||
73 | Foam::tmp<Foam::volScalarField> | ||
74 | Foam::populationBalanceSubModels::aggregationKernels::turbulentBrownian::Ka | ||
75 | ( | ||
76 | const volScalarField& abscissa1, | ||
77 | const volScalarField& abscissa2 | ||
78 | ) const | ||
79 | { | ||
80 | if (!abscissa1.mesh().foundObject<fluidThermo>(basicThermo::dictName)) | ||
81 | { | ||
82 | FatalErrorInFunction | ||
83 | << "No valid thermophysical model found." | ||
84 | << abort(FatalError); | ||
85 | } | ||
86 | |||
87 | const fluidThermo& flThermo = | ||
88 | abscissa1.mesh().lookupObject<fluidThermo>(basicThermo::dictName); | ||
89 | |||
90 | typedef compressible::turbulenceModel cmpTurbModel; | ||
91 | |||
92 | if | ||
93 | ( | ||
94 | !abscissa1.mesh().foundObject<cmpTurbModel> | ||
95 | ( | ||
96 | cmpTurbModel::propertiesName | ||
97 | ) | ||
98 | ) | ||
99 | { | ||
100 | FatalErrorInFunction | ||
101 | << "No valid compressible turbulence model found." | ||
102 | << abort(FatalError); | ||
103 | } | ||
104 | |||
105 | const compressible::turbulenceModel& flTurb = | ||
106 | abscissa1.mesh().lookupObject<compressible::turbulenceModel> | ||
107 | ( | ||
108 | turbulenceModel::propertiesName | ||
109 | ); | ||
110 | |||
111 | dimensionedScalar smallAbs("smallAbs", sqr(abscissa1.dimensions()), SMALL); | ||
112 | |||
113 | return | ||
114 | 2.0*Foam::constant::physicoChemical::k*flThermo.T() | ||
115 | *sqr(abscissa1 + abscissa2)/(3.0*flThermo.mu() | ||
116 | *max(abscissa1*abscissa2, smallAbs)) | ||
117 | + 4.0/3.0*pow3(abscissa1 + abscissa2) | ||
118 | *sqrt(3.0*Foam::constant::mathematical::pi*flTurb.epsilon() | ||
119 | /(10.0*flTurb.nu())); | ||
120 | } | ||
121 | |||
122 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/aggregationKernels/turbulentBrownian/turbulentBrownian.H added (mode: 100644) (index 0000000..103dc66) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2015 Alberto Passalacqua | ||
6 | \\/ M anipulation | | ||
7 | ------------------------------------------------------------------------------- | ||
8 | License | ||
9 | This file is derivative work 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 | Class | ||
25 | Foam::populationBalanceSubModels::aggregationKernels::turbulentBrownian | ||
26 | |||
27 | Description | ||
28 | Brownian aggregation kernel supplemented kernel for particles in turbulent | ||
29 | flows in conditions when the particle size is smaller than the local | ||
30 | Kolmogorov scale. | ||
31 | |||
32 | References | ||
33 | \verbatim | ||
34 | "Versuch Einer Mathematischen Theorie Der Koagulationskinetic Kolloider | ||
35 | Losunger" | ||
36 | M X Smoluchowski | ||
37 | Zeitschrift fur Physikalische Chemie | ||
38 | Volume 92, Pages 129-142, 1917 | ||
39 | \endverbatim | ||
40 | |||
41 | \verbatim | ||
42 | "Kinetics of turbulent coagulation studied by means of end-over-end | ||
43 | rotation" | ||
44 | Y Adachi, M A Cohen Stuart, R Fokkink | ||
45 | Journal of Colloid and Interface Science | ||
46 | Volume 165, Pages 310-317, 1994 | ||
47 | \endverbatim | ||
48 | |||
49 | SourceFiles | ||
50 | turbulentBrownian.C | ||
51 | |||
52 | \*---------------------------------------------------------------------------*/ | ||
53 | |||
54 | #ifndef turbulentBrownian_H | ||
55 | #define turbulentBrownian_H | ||
56 | |||
57 | #include "aggregationKernel.H" | ||
58 | |||
59 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
60 | |||
61 | namespace Foam | ||
62 | { | ||
63 | namespace populationBalanceSubModels | ||
64 | { | ||
65 | namespace aggregationKernels | ||
66 | { | ||
67 | |||
68 | /*---------------------------------------------------------------------------*\ | ||
69 | Class turbulentBrownian Declaration | ||
70 | \*---------------------------------------------------------------------------*/ | ||
71 | |||
72 | class turbulentBrownian | ||
73 | : | ||
74 | public aggregationKernel | ||
75 | { | ||
76 | public: | ||
77 | |||
78 | //- Runtime type information | ||
79 | TypeName("turbulentBrownian"); | ||
80 | |||
81 | |||
82 | // Constructors | ||
83 | |||
84 | //- Construct from components | ||
85 | turbulentBrownian(const dictionary& dict); | ||
86 | |||
87 | |||
88 | //- Destructor | ||
89 | virtual ~turbulentBrownian(); | ||
90 | |||
91 | |||
92 | // Member Functions | ||
93 | |||
94 | //- Aggregation kernel | ||
95 | virtual tmp<volScalarField> Ka | ||
96 | ( | ||
97 | const volScalarField& abscissa1, | ||
98 | const volScalarField& abscissa2 | ||
99 | ) const; | ||
100 | |||
101 | }; | ||
102 | |||
103 | |||
104 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
105 | |||
106 | } // End namespace aggregationKernels | ||
107 | } // End namespace populationBalanceSubModels | ||
108 | } // End namespace Foam | ||
109 | |||
110 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
111 | |||
112 | #endif | ||
113 | |||
114 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/breakupKernels/AyaziShamlou/AyaziShamlou.C added (mode: 100644) (index 0000000..fd10ec5) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2015 Alberto Passalacqua | ||
6 | \\/ M anipulation | | ||
7 | ------------------------------------------------------------------------------- | ||
8 | License | ||
9 | This file is derivative work 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 "AyaziShamlou.H" | ||
27 | #include "addToRunTimeSelectionTable.H" | ||
28 | #include "turbulentFluidThermoModel.H" | ||
29 | |||
30 | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // | ||
31 | |||
32 | namespace Foam | ||
33 | { | ||
34 | namespace populationBalanceSubModels | ||
35 | { | ||
36 | namespace breakupKernels | ||
37 | { | ||
38 | defineTypeNameAndDebug(AyaziShamlou, 0); | ||
39 | |||
40 | addToRunTimeSelectionTable | ||
41 | ( | ||
42 | breakupKernel, | ||
43 | AyaziShamlou, | ||
44 | dictionary | ||
45 | ); | ||
46 | } | ||
47 | } | ||
48 | } | ||
49 | |||
50 | |||
51 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | ||
52 | |||
53 | Foam::populationBalanceSubModels::breakupKernels::AyaziShamlou | ||
54 | ::AyaziShamlou | ||
55 | ( | ||
56 | const dictionary& dict | ||
57 | ) | ||
58 | : | ||
59 | breakupKernel(dict), | ||
60 | A_(dict.lookup("A")), | ||
61 | df_(dict.lookup("df")), | ||
62 | H0_(dict.lookup("H0")), | ||
63 | primarySize_(dict.lookup("primarySize")) | ||
64 | {} | ||
65 | |||
66 | |||
67 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | ||
68 | |||
69 | Foam::populationBalanceSubModels::breakupKernels::AyaziShamlou::~AyaziShamlou() | ||
70 | {} | ||
71 | |||
72 | |||
73 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | ||
74 | |||
75 | Foam::tmp<Foam::volScalarField> | ||
76 | Foam::populationBalanceSubModels::breakupKernels::AyaziShamlou::Kb | ||
77 | ( | ||
78 | const volScalarField& abscissa | ||
79 | ) const | ||
80 | { | ||
81 | const compressible::turbulenceModel& flTurb = | ||
82 | abscissa.mesh().lookupObject<compressible::turbulenceModel> | ||
83 | ( | ||
84 | turbulenceModel::propertiesName | ||
85 | ); | ||
86 | |||
87 | // Interparticle force | ||
88 | dimensionedScalar F = A_*primarySize_/(12.0*sqr(H0_)); | ||
89 | |||
90 | // Coefficient of volume fraction (Vanni, 2000) | ||
91 | dimensionedScalar C = 0.41*df_ - 0.211; | ||
92 | |||
93 | // Volume fraction of solid within aggregates | ||
94 | volScalarField phiL(C*pow(abscissa/primarySize_, df_ - 3.0)); | ||
95 | |||
96 | // Coordination number | ||
97 | volScalarField kc(15.0*pow(phiL, 1.2)); | ||
98 | |||
99 | // Aggregation strength | ||
100 | volScalarField tauf(9.0*kc*phiL*F/(8.0*sqr(primarySize_) | ||
101 | *Foam::constant::mathematical::pi)); | ||
102 | |||
103 | const volScalarField& mu = flTurb.mu(); | ||
104 | |||
105 | volScalarField epsilonByNu(flTurb.epsilon()*flTurb.rho()/mu); | ||
106 | |||
107 | return sqrt(epsilonByNu/15.0)*exp(-tauf/(mu*sqrt(epsilonByNu))); | ||
108 | } | ||
109 | |||
110 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/breakupKernels/AyaziShamlou/AyaziShamlou.H added (mode: 100644) (index 0000000..dd3f6c6) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2015 Alberto Passalacqua | ||
6 | \\/ M anipulation | | ||
7 | ------------------------------------------------------------------------------- | ||
8 | License | ||
9 | This file is derivative work 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 | Class | ||
25 | Foam::populationBalanceSubModels::breakupKernels::AyaziShamlou | ||
26 | |||
27 | Description | ||
28 | Breakup kernel for liquid-solid systems. | ||
29 | |||
30 | Reference | ||
31 | \verbatim | ||
32 | "Growth-independent breakage frequency of protein precipitates in | ||
33 | turbulently agitated bioreactors" | ||
34 | P Ayazi Shamlou, S Stravrinides, N Titchener-Hooker, M Hoare | ||
35 | Chemical Engineering Science | ||
36 | Volume 49, Pages 2647-2656, 1994 | ||
37 | \endverbatim | ||
38 | |||
39 | SourceFiles | ||
40 | AyaziShamlou.C | ||
41 | |||
42 | \*---------------------------------------------------------------------------*/ | ||
43 | |||
44 | #ifndef AyaziShamlou_H | ||
45 | #define AyaziShamlou_H | ||
46 | |||
47 | #include "breakupKernel.H" | ||
48 | |||
49 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
50 | |||
51 | namespace Foam | ||
52 | { | ||
53 | namespace populationBalanceSubModels | ||
54 | { | ||
55 | namespace breakupKernels | ||
56 | { | ||
57 | |||
58 | /*---------------------------------------------------------------------------*\ | ||
59 | Class AyaziShamlou Declaration | ||
60 | \*---------------------------------------------------------------------------*/ | ||
61 | |||
62 | class AyaziShamlou | ||
63 | : | ||
64 | public breakupKernel | ||
65 | { | ||
66 | private: | ||
67 | |||
68 | // Private data | ||
69 | |||
70 | //- Hamaker constant | ||
71 | dimensionedScalar A_; | ||
72 | |||
73 | //- Fractal dimension of the aggregates | ||
74 | dimensionedScalar df_; | ||
75 | |||
76 | //- Distance between primary particles | ||
77 | dimensionedScalar H0_; | ||
78 | |||
79 | //- Primary particle size | ||
80 | dimensionedScalar primarySize_; | ||
81 | |||
82 | public: | ||
83 | |||
84 | //- Runtime type information | ||
85 | TypeName("AyaziShamlou"); | ||
86 | |||
87 | |||
88 | // Constructors | ||
89 | |||
90 | //- Construct from components | ||
91 | AyaziShamlou(const dictionary& dict); | ||
92 | |||
93 | |||
94 | //- Destructor | ||
95 | virtual ~AyaziShamlou(); | ||
96 | |||
97 | |||
98 | // Member Functions | ||
99 | |||
100 | //- Breakup kernel | ||
101 | virtual tmp<volScalarField> Kb | ||
102 | ( | ||
103 | const volScalarField& abscissa | ||
104 | ) const; | ||
105 | |||
106 | }; | ||
107 | |||
108 | |||
109 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
110 | |||
111 | } // End namespace breakupKernels | ||
112 | } // End namespace populationBalanceSubModels | ||
113 | } // End namespace Foam | ||
114 | |||
115 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
116 | |||
117 | #endif | ||
118 | |||
119 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/breakupKernels/LuoSvendsen/LuoSvendsen.C added (mode: 100644) (index 0000000..5fda936) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2015 Alberto Passalacqua | ||
6 | \\/ M anipulation | | ||
7 | ------------------------------------------------------------------------------- | ||
8 | License | ||
9 | This file is derivative work 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 "LuoSvendsen.H" | ||
27 | #include "addToRunTimeSelectionTable.H" | ||
28 | #include "turbulentFluidThermoModel.H" | ||
29 | |||
30 | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // | ||
31 | |||
32 | namespace Foam | ||
33 | { | ||
34 | namespace populationBalanceSubModels | ||
35 | { | ||
36 | namespace breakupKernels | ||
37 | { | ||
38 | defineTypeNameAndDebug(LuoSvendsen, 0); | ||
39 | |||
40 | addToRunTimeSelectionTable | ||
41 | ( | ||
42 | breakupKernel, | ||
43 | LuoSvendsen, | ||
44 | dictionary | ||
45 | ); | ||
46 | } | ||
47 | } | ||
48 | } | ||
49 | |||
50 | |||
51 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | ||
52 | |||
53 | Foam::populationBalanceSubModels::breakupKernels::LuoSvendsen | ||
54 | ::LuoSvendsen | ||
55 | ( | ||
56 | const dictionary& dict | ||
57 | ) | ||
58 | : | ||
59 | breakupKernel(dict), | ||
60 | Cb_(dict.lookup("Cb")), | ||
61 | epsilonExp_(readScalar(dict.lookup("epsilonExp"))), | ||
62 | nuExp_(readScalar(dict.lookup("nuExp"))), | ||
63 | sizeExp_(readScalar(dict.lookup("sizeExp"))) | ||
64 | {} | ||
65 | |||
66 | |||
67 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | ||
68 | |||
69 | Foam::populationBalanceSubModels::breakupKernels::LuoSvendsen::~LuoSvendsen() | ||
70 | {} | ||
71 | |||
72 | |||
73 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | ||
74 | |||
75 | Foam::tmp<Foam::volScalarField> | ||
76 | Foam::populationBalanceSubModels::breakupKernels::LuoSvendsen::Kb | ||
77 | ( | ||
78 | const volScalarField& abscissa | ||
79 | ) const | ||
80 | { | ||
81 | const compressible::turbulenceModel& fluidTurb = | ||
82 | abscissa.mesh().lookupObject<compressible::turbulenceModel> | ||
83 | ( | ||
84 | turbulenceModel::propertiesName | ||
85 | ); | ||
86 | |||
87 | return Cb_*pow(fluidTurb.epsilon(), epsilonExp_) | ||
88 | *pow(fluidTurb.nu(), nuExp_)*pow(abscissa, sizeExp_); | ||
89 | } | ||
90 | |||
91 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/breakupKernels/LuoSvendsen/LuoSvendsen.H added (mode: 100644) (index 0000000..809b615) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2015 Alberto Passalacqua | ||
6 | \\/ M anipulation | | ||
7 | ------------------------------------------------------------------------------- | ||
8 | License | ||
9 | This file is derivative work 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 | Class | ||
25 | Foam::populationBalanceSubModels::breakupKernels::LuoSvendsen | ||
26 | |||
27 | Description | ||
28 | Breakup kernel for liquid-solid systems. | ||
29 | |||
30 | Reference | ||
31 | \verbatim | ||
32 | "Theoretical model for drop and bubble breakup in turbulent dispersion" | ||
33 | H Luo, H F Svendsen | ||
34 | AIChE Journal | ||
35 | Volume 42, Pages 1225-1233, 1996 | ||
36 | \endverbatim | ||
37 | |||
38 | |||
39 | |||
40 | SourceFiles | ||
41 | LuoSvendsen.C | ||
42 | |||
43 | \*---------------------------------------------------------------------------*/ | ||
44 | |||
45 | #ifndef LuoSvendsen_H | ||
46 | #define LuoSvendsen_H | ||
47 | |||
48 | #include "breakupKernel.H" | ||
49 | |||
50 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
51 | |||
52 | namespace Foam | ||
53 | { | ||
54 | namespace populationBalanceSubModels | ||
55 | { | ||
56 | namespace breakupKernels | ||
57 | { | ||
58 | |||
59 | /*---------------------------------------------------------------------------*\ | ||
60 | Class LuoSvendsen Declaration | ||
61 | \*---------------------------------------------------------------------------*/ | ||
62 | |||
63 | class LuoSvendsen | ||
64 | : | ||
65 | public breakupKernel | ||
66 | { | ||
67 | private: | ||
68 | |||
69 | // Private data | ||
70 | |||
71 | //- Model coefficient | ||
72 | dimensionedScalar Cb_; | ||
73 | |||
74 | //- Exponent of the turbulent dissipation rate | ||
75 | scalar epsilonExp_; | ||
76 | |||
77 | //- Exponent of the kinematic viscosity | ||
78 | scalar nuExp_; | ||
79 | |||
80 | //- Exponent of the abscissa | ||
81 | scalar sizeExp_; | ||
82 | |||
83 | public: | ||
84 | |||
85 | //- Runtime type information | ||
86 | TypeName("LuoSvendsen"); | ||
87 | |||
88 | |||
89 | // Constructors | ||
90 | |||
91 | //- Construct from components | ||
92 | LuoSvendsen(const dictionary& dict); | ||
93 | |||
94 | |||
95 | //- Destructor | ||
96 | virtual ~LuoSvendsen(); | ||
97 | |||
98 | |||
99 | // Member Functions | ||
100 | |||
101 | //- Breakup kernel | ||
102 | virtual tmp<volScalarField> Kb | ||
103 | ( | ||
104 | const volScalarField& abscissa | ||
105 | ) const; | ||
106 | |||
107 | }; | ||
108 | |||
109 | |||
110 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
111 | |||
112 | } // End namespace breakupKernels | ||
113 | } // End namespace populationBalanceSubModels | ||
114 | } // End namespace Foam | ||
115 | |||
116 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
117 | |||
118 | #endif | ||
119 | |||
120 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/breakupKernels/breakupKernel/breakupKernel.C added (mode: 100644) (index 0000000..5da20f6) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2015 Alberto Passalacqua | ||
6 | \\/ M anipulation | | ||
7 | ------------------------------------------------------------------------------- | ||
8 | License | ||
9 | This file is derivative work 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 "breakupKernel.H" | ||
27 | |||
28 | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // | ||
29 | |||
30 | namespace Foam | ||
31 | { | ||
32 | namespace populationBalanceSubModels | ||
33 | { | ||
34 | defineTypeNameAndDebug(breakupKernel, 0); | ||
35 | |||
36 | defineRunTimeSelectionTable(breakupKernel, dictionary); | ||
37 | } | ||
38 | } | ||
39 | |||
40 | |||
41 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | ||
42 | |||
43 | Foam::populationBalanceSubModels::breakupKernel::breakupKernel | ||
44 | ( | ||
45 | const dictionary& dict | ||
46 | ) | ||
47 | : | ||
48 | dict_(dict), | ||
49 | Cb_ | ||
50 | ( | ||
51 | dict.lookupOrDefault | ||
52 | ( | ||
53 | "Cb", | ||
54 | dimensionedScalar("one", inv(dimTime), 1.0) | ||
55 | ) | ||
56 | ) | ||
57 | {} | ||
58 | |||
59 | |||
60 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | ||
61 | |||
62 | Foam::populationBalanceSubModels::breakupKernel::~breakupKernel() | ||
63 | {} | ||
64 | |||
65 | |||
66 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/breakupKernels/breakupKernel/breakupKernel.H added (mode: 100644) (index 0000000..dcba2f7) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2015 Alberto Passalacqua | ||
6 | \\/ M anipulation | | ||
7 | ------------------------------------------------------------------------------- | ||
8 | License | ||
9 | This file is derivative work 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 | Class | ||
25 | Foam::populationBalanceSubModels::breakupKernel | ||
26 | |||
27 | Description | ||
28 | Abstract class for breakup kernels. | ||
29 | |||
30 | SourceFiles | ||
31 | breakupKernel.C | ||
32 | |||
33 | \*---------------------------------------------------------------------------*/ | ||
34 | |||
35 | #ifndef breakupKernel_H | ||
36 | #define breakupKernel_H | ||
37 | |||
38 | #include "dictionary.H" | ||
39 | #include "volFields.H" | ||
40 | #include "dimensionedTypes.H" | ||
41 | #include "runTimeSelectionTables.H" | ||
42 | |||
43 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
44 | |||
45 | namespace Foam | ||
46 | { | ||
47 | namespace populationBalanceSubModels | ||
48 | { | ||
49 | |||
50 | /*---------------------------------------------------------------------------*\ | ||
51 | Class breakupKernel Declaration | ||
52 | \*---------------------------------------------------------------------------*/ | ||
53 | |||
54 | class breakupKernel | ||
55 | { | ||
56 | // Private member functions | ||
57 | |||
58 | //- Disallow default bitwise copy construct | ||
59 | breakupKernel(const breakupKernel&); | ||
60 | |||
61 | //- Disallow default bitwise assignment | ||
62 | void operator=(const breakupKernel&); | ||
63 | |||
64 | |||
65 | protected: | ||
66 | |||
67 | // Protected data | ||
68 | |||
69 | const dictionary& dict_; | ||
70 | |||
71 | //- Coefficient of aggregation kernel | ||
72 | const dimensionedScalar Cb_; | ||
73 | |||
74 | |||
75 | public: | ||
76 | |||
77 | //- Runtime type information | ||
78 | TypeName("breakupKernel"); | ||
79 | |||
80 | // Declare runtime constructor selection table | ||
81 | declareRunTimeSelectionTable | ||
82 | ( | ||
83 | autoPtr, | ||
84 | breakupKernel, | ||
85 | dictionary, | ||
86 | ( | ||
87 | const dictionary& dict | ||
88 | ), | ||
89 | (dict) | ||
90 | ); | ||
91 | |||
92 | |||
93 | // Constructors | ||
94 | |||
95 | //- Construct from components | ||
96 | breakupKernel(const dictionary& dict); | ||
97 | |||
98 | |||
99 | // Selectors | ||
100 | |||
101 | static autoPtr<breakupKernel> New | ||
102 | ( | ||
103 | const dictionary& dict | ||
104 | ); | ||
105 | |||
106 | |||
107 | //- Destructor | ||
108 | virtual ~breakupKernel(); | ||
109 | |||
110 | |||
111 | // Member Functions | ||
112 | |||
113 | //- Breakup kernel | ||
114 | virtual tmp<volScalarField> Kb | ||
115 | ( | ||
116 | const volScalarField& abscissa | ||
117 | ) const = 0; | ||
118 | }; | ||
119 | |||
120 | |||
121 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
122 | |||
123 | } // End namespace populationBalanceSubModels | ||
124 | } // End namespace Foam | ||
125 | |||
126 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
127 | |||
128 | #endif | ||
129 | |||
130 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/breakupKernels/breakupKernel/newBreakupKernel.C added (mode: 100644) (index 0000000..714a1c2) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2015 Alberto Passalacqua | ||
6 | \\/ M anipulation | | ||
7 | ------------------------------------------------------------------------------- | ||
8 | License | ||
9 | This file is derivative work 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 "breakupKernel.H" | ||
27 | |||
28 | // * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * // | ||
29 | |||
30 | Foam::autoPtr<Foam::populationBalanceSubModels::breakupKernel> | ||
31 | Foam::populationBalanceSubModels::breakupKernel::New | ||
32 | ( | ||
33 | const dictionary& dict | ||
34 | ) | ||
35 | { | ||
36 | word breakupKernelType(dict.lookup("breakupKernel")); | ||
37 | |||
38 | Info<< "Selecting breakupKernel " | ||
39 | << breakupKernelType << endl; | ||
40 | |||
41 | dictionaryConstructorTable::iterator cstrIter = | ||
42 | dictionaryConstructorTablePtr_->find(breakupKernelType); | ||
43 | |||
44 | if (cstrIter == dictionaryConstructorTablePtr_->end()) | ||
45 | { | ||
46 | FatalErrorInFunction | ||
47 | << "Unknown breakupKernelType type " | ||
48 | << breakupKernelType << endl << endl | ||
49 | << "Valid breakupKernelType types are :" << endl | ||
50 | << dictionaryConstructorTablePtr_->sortedToc() | ||
51 | << abort(FatalError); | ||
52 | } | ||
53 | |||
54 | return autoPtr<breakupKernel>(cstrIter()(dict)); | ||
55 | } | ||
56 | |||
57 | |||
58 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/breakupKernels/constantBreakup/constantBreakup.C added (mode: 100644) (index 0000000..c48e964) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2015 Alberto Passalacqua | ||
6 | \\/ M anipulation | | ||
7 | ------------------------------------------------------------------------------- | ||
8 | License | ||
9 | This file is derivative work 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 "constantBreakup.H" | ||
27 | #include "addToRunTimeSelectionTable.H" | ||
28 | |||
29 | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // | ||
30 | |||
31 | namespace Foam | ||
32 | { | ||
33 | namespace populationBalanceSubModels | ||
34 | { | ||
35 | namespace breakupKernels | ||
36 | { | ||
37 | defineTypeNameAndDebug(constantBreakup, 0); | ||
38 | |||
39 | addToRunTimeSelectionTable | ||
40 | ( | ||
41 | breakupKernel, | ||
42 | constantBreakup, | ||
43 | dictionary | ||
44 | ); | ||
45 | } | ||
46 | } | ||
47 | } | ||
48 | |||
49 | |||
50 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | ||
51 | |||
52 | Foam::populationBalanceSubModels::breakupKernels::constantBreakup | ||
53 | ::constantBreakup | ||
54 | ( | ||
55 | const dictionary& dict | ||
56 | ) | ||
57 | : | ||
58 | breakupKernel(dict), | ||
59 | minAbscissa_(dict.lookupOrDefault("minAbscissa", 1.0)) | ||
60 | {} | ||
61 | |||
62 | |||
63 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | ||
64 | |||
65 | Foam::populationBalanceSubModels::breakupKernels::constantBreakup | ||
66 | ::~constantBreakup() | ||
67 | {} | ||
68 | |||
69 | |||
70 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | ||
71 | |||
72 | Foam::tmp<Foam::volScalarField> | ||
73 | Foam::populationBalanceSubModels::breakupKernels::constantBreakup::Kb | ||
74 | ( | ||
75 | const volScalarField& abscissa | ||
76 | ) const | ||
77 | { | ||
78 | dimensionedScalar minAbs | ||
79 | ( | ||
80 | "minAbs", | ||
81 | abscissa.dimensions(), | ||
82 | minAbscissa_.value() | ||
83 | ); | ||
84 | |||
85 | return Cb_*pos(abscissa - minAbs); | ||
86 | } | ||
87 | |||
88 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/breakupKernels/constantBreakup/constantBreakup.H added (mode: 100644) (index 0000000..e392ae3) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2015 Alberto Passalacqua | ||
6 | \\/ M anipulation | | ||
7 | ------------------------------------------------------------------------------- | ||
8 | License | ||
9 | This file is derivative work 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 | Class | ||
25 | Foam::populationBalanceSubModels::breakupKernels::constantBreakup | ||
26 | |||
27 | Description | ||
28 | Constant breakup kernel. The value of the kernel is read from dictionary | ||
29 | or assumed equal to 1. The minimum value of the abscissa after which the | ||
30 | model is applied can be defined by the user or it is assumed to be 1. | ||
31 | |||
32 | SourceFiles | ||
33 | constantBreakup.C | ||
34 | |||
35 | \*---------------------------------------------------------------------------*/ | ||
36 | |||
37 | #ifndef constantBreakup_H | ||
38 | #define constantBreakup_H | ||
39 | |||
40 | #include "breakupKernel.H" | ||
41 | |||
42 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
43 | |||
44 | namespace Foam | ||
45 | { | ||
46 | namespace populationBalanceSubModels | ||
47 | { | ||
48 | namespace breakupKernels | ||
49 | { | ||
50 | |||
51 | /*---------------------------------------------------------------------------*\ | ||
52 | Class constantBreakup Declaration | ||
53 | \*---------------------------------------------------------------------------*/ | ||
54 | |||
55 | class constantBreakup | ||
56 | : | ||
57 | public breakupKernel | ||
58 | { | ||
59 | private: | ||
60 | |||
61 | // Private data | ||
62 | |||
63 | //- Minimum value of the abscissa to apply the model | ||
64 | dimensionedScalar minAbscissa_; | ||
65 | |||
66 | public: | ||
67 | |||
68 | //- Runtime type information | ||
69 | TypeName("constant"); | ||
70 | |||
71 | |||
72 | // Constructors | ||
73 | |||
74 | //- Construct from components | ||
75 | constantBreakup(const dictionary& dict); | ||
76 | |||
77 | |||
78 | //- Destructor | ||
79 | virtual ~constantBreakup(); | ||
80 | |||
81 | |||
82 | // Member Functions | ||
83 | |||
84 | //- Breakup kernel | ||
85 | virtual tmp<volScalarField> Kb | ||
86 | ( | ||
87 | const volScalarField& abscissa | ||
88 | ) const; | ||
89 | |||
90 | }; | ||
91 | |||
92 | |||
93 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
94 | |||
95 | } // End namespace breakupKernels | ||
96 | } // End namespace populationBalanceSubModels | ||
97 | } // End namespace Foam | ||
98 | |||
99 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
100 | |||
101 | #endif | ||
102 | |||
103 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/breakupKernels/exponentialBreakup/exponentialBreakup.C added (mode: 100644) (index 0000000..5f3ab45) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2015 Alberto Passalacqua | ||
6 | \\/ M anipulation | | ||
7 | ------------------------------------------------------------------------------- | ||
8 | License | ||
9 | This file is derivative work 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 "exponentialBreakup.H" | ||
27 | #include "addToRunTimeSelectionTable.H" | ||
28 | |||
29 | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // | ||
30 | |||
31 | namespace Foam | ||
32 | { | ||
33 | namespace populationBalanceSubModels | ||
34 | { | ||
35 | namespace breakupKernels | ||
36 | { | ||
37 | defineTypeNameAndDebug(exponentialBreakup, 0); | ||
38 | |||
39 | addToRunTimeSelectionTable | ||
40 | ( | ||
41 | breakupKernel, | ||
42 | exponentialBreakup, | ||
43 | dictionary | ||
44 | ); | ||
45 | } | ||
46 | } | ||
47 | } | ||
48 | |||
49 | |||
50 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | ||
51 | |||
52 | Foam::populationBalanceSubModels::breakupKernels::exponentialBreakup | ||
53 | ::exponentialBreakup | ||
54 | ( | ||
55 | const dictionary& dict | ||
56 | ) | ||
57 | : | ||
58 | breakupKernel(dict), | ||
59 | minAbscissa_(dict.lookupOrDefault("minAbscissa", 1.0)), | ||
60 | expCoeff_ | ||
61 | ( | ||
62 | dict.lookupOrDefault | ||
63 | ( | ||
64 | "expCoeff", | ||
65 | dimensionedScalar("expC", inv(pow3(dimLength)), 0.1) | ||
66 | ) | ||
67 | ) | ||
68 | {} | ||
69 | |||
70 | |||
71 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | ||
72 | |||
73 | Foam::populationBalanceSubModels::breakupKernels::exponentialBreakup | ||
74 | ::~exponentialBreakup() | ||
75 | {} | ||
76 | |||
77 | |||
78 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | ||
79 | |||
80 | Foam::tmp<Foam::volScalarField> | ||
81 | Foam::populationBalanceSubModels::breakupKernels::exponentialBreakup::Kb | ||
82 | ( | ||
83 | const volScalarField& abscissa | ||
84 | ) const | ||
85 | { | ||
86 | dimensionedScalar minAbs | ||
87 | ( | ||
88 | "minAbs", | ||
89 | abscissa.dimensions(), | ||
90 | minAbscissa_.value() | ||
91 | ); | ||
92 | |||
93 | return Cb_*pos(abscissa - minAbs)*exp(expCoeff_*pow3(abscissa)); | ||
94 | } | ||
95 | |||
96 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/breakupKernels/exponentialBreakup/exponentialBreakup.H added (mode: 100644) (index 0000000..0d36ebd) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2015 Alberto Passalacqua | ||
6 | \\/ M anipulation | | ||
7 | ------------------------------------------------------------------------------- | ||
8 | License | ||
9 | This file is derivative work 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 | Class | ||
25 | Foam::populationBalanceSubModels::breakupKernels::exponentialBreakup | ||
26 | |||
27 | Description | ||
28 | Exponential breakup kernel. The value of the kernel is read from dictionary | ||
29 | or assumed equal to 1. The minimum value of the abscissa after which the | ||
30 | model is applied can be defined by the user or it is assumed to be 1. | ||
31 | |||
32 | SourceFiles | ||
33 | exponentialBreakup.C | ||
34 | |||
35 | \*---------------------------------------------------------------------------*/ | ||
36 | |||
37 | #ifndef exponentialBreakup_H | ||
38 | #define exponentialBreakup_H | ||
39 | |||
40 | #include "breakupKernel.H" | ||
41 | |||
42 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
43 | |||
44 | namespace Foam | ||
45 | { | ||
46 | namespace populationBalanceSubModels | ||
47 | { | ||
48 | namespace breakupKernels | ||
49 | { | ||
50 | |||
51 | /*---------------------------------------------------------------------------*\ | ||
52 | Class exponentialBreakup Declaration | ||
53 | \*---------------------------------------------------------------------------*/ | ||
54 | |||
55 | class exponentialBreakup | ||
56 | : | ||
57 | public breakupKernel | ||
58 | { | ||
59 | private: | ||
60 | |||
61 | // Private data | ||
62 | |||
63 | //- Minimum value of the abscissa to apply the model | ||
64 | dimensionedScalar minAbscissa_; | ||
65 | |||
66 | //- Exponent of the kernel | ||
67 | dimensionedScalar expCoeff_; | ||
68 | |||
69 | public: | ||
70 | |||
71 | //- Runtime type information | ||
72 | TypeName("exponential"); | ||
73 | |||
74 | |||
75 | // Constructors | ||
76 | |||
77 | //- Construct from components | ||
78 | exponentialBreakup(const dictionary& dict); | ||
79 | |||
80 | |||
81 | //- Destructor | ||
82 | virtual ~exponentialBreakup(); | ||
83 | |||
84 | |||
85 | // Member Functions | ||
86 | |||
87 | //- Breakup kernel | ||
88 | virtual tmp<volScalarField> Kb | ||
89 | ( | ||
90 | const volScalarField& abscissa | ||
91 | ) const; | ||
92 | |||
93 | }; | ||
94 | |||
95 | |||
96 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
97 | |||
98 | } // End namespace breakupKernels | ||
99 | } // End namespace populationBalanceSubModels | ||
100 | } // End namespace Foam | ||
101 | |||
102 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
103 | |||
104 | #endif | ||
105 | |||
106 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/breakupKernels/powerLawBreakup/powerLawBreakup.C added (mode: 100644) (index 0000000..9b9185a) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2015 Alberto Passalacqua | ||
6 | \\/ M anipulation | | ||
7 | ------------------------------------------------------------------------------- | ||
8 | License | ||
9 | This file is derivative work 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 "powerLawBreakup.H" | ||
27 | #include "addToRunTimeSelectionTable.H" | ||
28 | |||
29 | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // | ||
30 | |||
31 | namespace Foam | ||
32 | { | ||
33 | namespace populationBalanceSubModels | ||
34 | { | ||
35 | namespace breakupKernels | ||
36 | { | ||
37 | defineTypeNameAndDebug(powerLawBreakup, 0); | ||
38 | |||
39 | addToRunTimeSelectionTable | ||
40 | ( | ||
41 | breakupKernel, | ||
42 | powerLawBreakup, | ||
43 | dictionary | ||
44 | ); | ||
45 | } | ||
46 | } | ||
47 | } | ||
48 | |||
49 | |||
50 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | ||
51 | |||
52 | Foam::populationBalanceSubModels::breakupKernels::powerLawBreakup | ||
53 | ::powerLawBreakup | ||
54 | ( | ||
55 | const dictionary& dict | ||
56 | ) | ||
57 | : | ||
58 | breakupKernel(dict), | ||
59 | minAbscissa_(dict.lookupOrDefault("minAbscissa", 1.0)), | ||
60 | abscissaExponent_(dict.lookupOrDefault("abscissaExponent", 3)) | ||
61 | {} | ||
62 | |||
63 | |||
64 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | ||
65 | |||
66 | Foam::populationBalanceSubModels::breakupKernels::powerLawBreakup | ||
67 | ::~powerLawBreakup() | ||
68 | {} | ||
69 | |||
70 | |||
71 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | ||
72 | |||
73 | Foam::tmp<Foam::volScalarField> | ||
74 | Foam::populationBalanceSubModels::breakupKernels::powerLawBreakup::Kb | ||
75 | ( | ||
76 | const volScalarField& abscissa | ||
77 | ) const | ||
78 | { | ||
79 | dimensionedScalar minAbs | ||
80 | ( | ||
81 | "minAbs", | ||
82 | abscissa.dimensions(), | ||
83 | minAbscissa_.value() | ||
84 | ); | ||
85 | |||
86 | tmp<volScalarField> brK = | ||
87 | Cb_*pos(abscissa - minAbs)*pow(abscissa, abscissaExponent_); | ||
88 | |||
89 | brK.ref().dimensions().reset(pow(dimTime, -1)); | ||
90 | |||
91 | return brK; | ||
92 | } | ||
93 | |||
94 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/breakupKernels/powerLawBreakup/powerLawBreakup.H added (mode: 100644) (index 0000000..faee468) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2015 Alberto Passalacqua | ||
6 | \\/ M anipulation | | ||
7 | ------------------------------------------------------------------------------- | ||
8 | License | ||
9 | This file is derivative work 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 | Class | ||
25 | Foam::populationBalanceSubModels::breakupKernels::powerLawBreakup | ||
26 | |||
27 | Description | ||
28 | Power law breakup kernel. The value of the kernel is read from dictionary | ||
29 | or assumed equal to 1. The minimum value of the abscissa after which the | ||
30 | model is applied can be defined by the user or it is assumed to be 1. | ||
31 | |||
32 | SourceFiles | ||
33 | powerLawBreakup.C | ||
34 | |||
35 | \*---------------------------------------------------------------------------*/ | ||
36 | |||
37 | #ifndef powerLawBreakup_H | ||
38 | #define powerLawBreakup_H | ||
39 | |||
40 | #include "breakupKernel.H" | ||
41 | |||
42 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
43 | |||
44 | namespace Foam | ||
45 | { | ||
46 | namespace populationBalanceSubModels | ||
47 | { | ||
48 | namespace breakupKernels | ||
49 | { | ||
50 | |||
51 | /*---------------------------------------------------------------------------*\ | ||
52 | Class powerLawBreakup Declaration | ||
53 | \*---------------------------------------------------------------------------*/ | ||
54 | |||
55 | class powerLawBreakup | ||
56 | : | ||
57 | public breakupKernel | ||
58 | { | ||
59 | private: | ||
60 | |||
61 | // Private data | ||
62 | |||
63 | //- Minimum value of the abscissa to apply the model | ||
64 | dimensionedScalar minAbscissa_; | ||
65 | |||
66 | //- Exponent of the kernel | ||
67 | scalar abscissaExponent_; | ||
68 | |||
69 | public: | ||
70 | |||
71 | //- Runtime type information | ||
72 | TypeName("powerLaw"); | ||
73 | |||
74 | |||
75 | // Constructors | ||
76 | |||
77 | //- Construct from components | ||
78 | powerLawBreakup(const dictionary& dict); | ||
79 | |||
80 | |||
81 | //- Destructor | ||
82 | virtual ~powerLawBreakup(); | ||
83 | |||
84 | |||
85 | // Member Functions | ||
86 | |||
87 | //- Breakup kernel | ||
88 | virtual tmp<volScalarField> Kb | ||
89 | ( | ||
90 | const volScalarField& abscissa | ||
91 | ) const; | ||
92 | |||
93 | }; | ||
94 | |||
95 | |||
96 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
97 | |||
98 | } // End namespace breakupKernels | ||
99 | } // End namespace populationBalanceSubModels | ||
100 | } // End namespace Foam | ||
101 | |||
102 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
103 | |||
104 | #endif | ||
105 | |||
106 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/daugtherDistributions/daughterDistribution/daughterDistribution.C added (mode: 100644) (index 0000000..d420f36) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2015 Alberto Passalacqua | ||
6 | \\/ M anipulation | | ||
7 | ------------------------------------------------------------------------------- | ||
8 | License | ||
9 | This file is derivative work 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 "daughterDistribution.H" | ||
27 | |||
28 | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // | ||
29 | |||
30 | namespace Foam | ||
31 | { | ||
32 | namespace populationBalanceSubModels | ||
33 | { | ||
34 | defineTypeNameAndDebug(daughterDistribution, 0); | ||
35 | |||
36 | defineRunTimeSelectionTable(daughterDistribution, dictionary); | ||
37 | } | ||
38 | } | ||
39 | |||
40 | |||
41 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | ||
42 | |||
43 | Foam::populationBalanceSubModels::daughterDistribution::daughterDistribution | ||
44 | ( | ||
45 | const dictionary& dict | ||
46 | ) | ||
47 | : | ||
48 | dict_(dict) | ||
49 | {} | ||
50 | |||
51 | |||
52 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | ||
53 | |||
54 | Foam::populationBalanceSubModels::daughterDistribution::~daughterDistribution() | ||
55 | {} | ||
56 | |||
57 | |||
58 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/daugtherDistributions/daughterDistribution/daughterDistribution.H added (mode: 100644) (index 0000000..e0118db) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2015 Alberto Passalacqua | ||
6 | \\/ M anipulation | | ||
7 | ------------------------------------------------------------------------------- | ||
8 | License | ||
9 | This file is derivative work 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 | Class | ||
25 | Foam::populationBalanceSubModels::daughterDistribution | ||
26 | |||
27 | Description | ||
28 | Abstract class for the daughter distribution of fragments in breakup | ||
29 | processes. | ||
30 | |||
31 | SourceFiles | ||
32 | daughterDistribution.C | ||
33 | |||
34 | \*---------------------------------------------------------------------------*/ | ||
35 | |||
36 | #ifndef daughterDistribution_H | ||
37 | #define daughterDistribution_H | ||
38 | |||
39 | #include "dictionary.H" | ||
40 | #include "volFields.H" | ||
41 | #include "dimensionedTypes.H" | ||
42 | #include "runTimeSelectionTables.H" | ||
43 | |||
44 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
45 | |||
46 | namespace Foam | ||
47 | { | ||
48 | namespace populationBalanceSubModels | ||
49 | { | ||
50 | |||
51 | /*---------------------------------------------------------------------------*\ | ||
52 | Class daughterDistribution Declaration | ||
53 | \*---------------------------------------------------------------------------*/ | ||
54 | |||
55 | class daughterDistribution | ||
56 | { | ||
57 | // Private member functions | ||
58 | |||
59 | //- Disallow default bitwise copy construct | ||
60 | daughterDistribution(const daughterDistribution&); | ||
61 | |||
62 | //- Disallow default bitwise assignment | ||
63 | void operator=(const daughterDistribution&); | ||
64 | |||
65 | |||
66 | protected: | ||
67 | |||
68 | // Protected data | ||
69 | |||
70 | const dictionary& dict_; | ||
71 | |||
72 | |||
73 | public: | ||
74 | |||
75 | //- Runtime type information | ||
76 | TypeName("daughterDistribution"); | ||
77 | |||
78 | // Declare runtime constructor selection table | ||
79 | declareRunTimeSelectionTable | ||
80 | ( | ||
81 | autoPtr, | ||
82 | daughterDistribution, | ||
83 | dictionary, | ||
84 | ( | ||
85 | const dictionary& dict | ||
86 | ), | ||
87 | (dict) | ||
88 | ); | ||
89 | |||
90 | |||
91 | // Constructors | ||
92 | |||
93 | //- Construct from components | ||
94 | daughterDistribution(const dictionary& dict); | ||
95 | |||
96 | |||
97 | // Selectors | ||
98 | |||
99 | static autoPtr<daughterDistribution> New | ||
100 | ( | ||
101 | const dictionary& dict | ||
102 | ); | ||
103 | |||
104 | |||
105 | //- Destructor | ||
106 | virtual ~daughterDistribution(); | ||
107 | |||
108 | |||
109 | // Member Functions | ||
110 | |||
111 | //- Moment of the daughter distribution function | ||
112 | virtual tmp<volScalarField> mD | ||
113 | ( | ||
114 | const label order, | ||
115 | const volScalarField& abscissa | ||
116 | ) const = 0; | ||
117 | }; | ||
118 | |||
119 | |||
120 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
121 | |||
122 | } // End namespace populationBalanceSubModels | ||
123 | } // End namespace Foam | ||
124 | |||
125 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
126 | |||
127 | #endif | ||
128 | |||
129 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/daugtherDistributions/daughterDistribution/newDaughterDistribution.C added (mode: 100644) (index 0000000..6164d29) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2015 Alberto Passalacqua | ||
6 | \\/ M anipulation | | ||
7 | ------------------------------------------------------------------------------- | ||
8 | License | ||
9 | This file is derivative work 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 "daughterDistribution.H" | ||
27 | |||
28 | // * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * // | ||
29 | |||
30 | Foam::autoPtr<Foam::populationBalanceSubModels::daughterDistribution> | ||
31 | Foam::populationBalanceSubModels::daughterDistribution::New | ||
32 | ( | ||
33 | const dictionary& dict | ||
34 | ) | ||
35 | { | ||
36 | word daughterDistributionType(dict.lookup("daughterDistribution")); | ||
37 | |||
38 | Info<< "Selecting daughterDistribution " | ||
39 | << daughterDistributionType << endl; | ||
40 | |||
41 | dictionaryConstructorTable::iterator cstrIter = | ||
42 | dictionaryConstructorTablePtr_->find(daughterDistributionType); | ||
43 | |||
44 | if (cstrIter == dictionaryConstructorTablePtr_->end()) | ||
45 | { | ||
46 | FatalErrorInFunction | ||
47 | << "Unknown daughterDistributionType type " | ||
48 | << daughterDistributionType << endl << endl | ||
49 | << "Valid daughterDistributionType types are :" << endl | ||
50 | << dictionaryConstructorTablePtr_->sortedToc() | ||
51 | << abort(FatalError); | ||
52 | } | ||
53 | |||
54 | return autoPtr<daughterDistribution>(cstrIter()(dict)); | ||
55 | } | ||
56 | |||
57 | |||
58 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/daugtherDistributions/erosion/erosion.C added (mode: 100644) (index 0000000..1839548) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2015 Alberto Passalacqua | ||
6 | \\/ M anipulation | | ||
7 | ------------------------------------------------------------------------------- | ||
8 | License | ||
9 | This file is derivative work 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 "erosion.H" | ||
27 | #include "addToRunTimeSelectionTable.H" | ||
28 | |||
29 | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // | ||
30 | |||
31 | namespace Foam | ||
32 | { | ||
33 | namespace populationBalanceSubModels | ||
34 | { | ||
35 | namespace daughterDistributions | ||
36 | { | ||
37 | defineTypeNameAndDebug(erosion, 0); | ||
38 | |||
39 | addToRunTimeSelectionTable | ||
40 | ( | ||
41 | daughterDistribution, | ||
42 | erosion, | ||
43 | dictionary | ||
44 | ); | ||
45 | } | ||
46 | } | ||
47 | } | ||
48 | |||
49 | |||
50 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | ||
51 | |||
52 | Foam::populationBalanceSubModels::daughterDistributions::erosion | ||
53 | ::erosion | ||
54 | ( | ||
55 | const dictionary& dict | ||
56 | ) | ||
57 | : | ||
58 | daughterDistribution(dict), | ||
59 | primarySize_(dict.lookup("primarySize")) | ||
60 | {} | ||
61 | |||
62 | |||
63 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | ||
64 | |||
65 | Foam::populationBalanceSubModels::daughterDistributions::erosion | ||
66 | ::~erosion() | ||
67 | {} | ||
68 | |||
69 | |||
70 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | ||
71 | |||
72 | Foam::tmp<Foam::volScalarField> | ||
73 | Foam::populationBalanceSubModels::daughterDistributions::erosion::mD | ||
74 | ( | ||
75 | const label order, | ||
76 | const volScalarField& abscissa | ||
77 | ) const | ||
78 | { | ||
79 | return pow(primarySize_, order) | ||
80 | + pow(pow3(abscissa) - pow3(primarySize_) , order/3.0); | ||
81 | } | ||
82 | |||
83 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/daugtherDistributions/erosion/erosion.H added (mode: 100644) (index 0000000..18932f2) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2015 Alberto Passalacqua | ||
6 | \\/ M anipulation | | ||
7 | ------------------------------------------------------------------------------- | ||
8 | License | ||
9 | This file is derivative work 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 | Class | ||
25 | Foam::populationBalanceSubModels::daughterDistribution::erosion | ||
26 | |||
27 | Description | ||
28 | Daughter distribution of fragments for erosion. | ||
29 | |||
30 | SourceFiles | ||
31 | erosion.C | ||
32 | |||
33 | \*---------------------------------------------------------------------------*/ | ||
34 | |||
35 | #ifndef erosion_H | ||
36 | #define erosion_H | ||
37 | |||
38 | #include "daughterDistribution.H" | ||
39 | |||
40 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
41 | |||
42 | namespace Foam | ||
43 | { | ||
44 | namespace populationBalanceSubModels | ||
45 | { | ||
46 | namespace daughterDistributions | ||
47 | { | ||
48 | |||
49 | /*---------------------------------------------------------------------------*\ | ||
50 | Class erosion Declaration | ||
51 | \*---------------------------------------------------------------------------*/ | ||
52 | |||
53 | class erosion | ||
54 | : | ||
55 | public daughterDistribution | ||
56 | { | ||
57 | private: | ||
58 | |||
59 | // Private data | ||
60 | |||
61 | //- Primary particle size | ||
62 | dimensionedScalar primarySize_; | ||
63 | |||
64 | |||
65 | public: | ||
66 | |||
67 | //- Runtime type information | ||
68 | TypeName("erosion"); | ||
69 | |||
70 | |||
71 | // Constructors | ||
72 | |||
73 | //- Construct from components | ||
74 | erosion(const dictionary& dict); | ||
75 | |||
76 | |||
77 | //- Destructor | ||
78 | virtual ~erosion(); | ||
79 | |||
80 | |||
81 | // Member Functions | ||
82 | |||
83 | //- Moment of the daughter distribution function | ||
84 | virtual tmp<volScalarField> mD | ||
85 | ( | ||
86 | const label order, | ||
87 | const volScalarField& abscissa | ||
88 | ) const; | ||
89 | |||
90 | }; | ||
91 | |||
92 | |||
93 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
94 | |||
95 | } // End namespace daughterDistributions | ||
96 | } // End namespace populationBalanceSubModels | ||
97 | } // End namespace Foam | ||
98 | |||
99 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
100 | |||
101 | #endif | ||
102 | |||
103 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/daugtherDistributions/fullFragmentation/fullFragmentation.C added (mode: 100644) (index 0000000..8f0d444) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2015 Alberto Passalacqua | ||
6 | \\/ M anipulation | | ||
7 | ------------------------------------------------------------------------------- | ||
8 | License | ||
9 | This file is derivative work 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 "fullFragmentation.H" | ||
27 | #include "addToRunTimeSelectionTable.H" | ||
28 | |||
29 | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // | ||
30 | |||
31 | namespace Foam | ||
32 | { | ||
33 | namespace populationBalanceSubModels | ||
34 | { | ||
35 | namespace daughterDistributions | ||
36 | { | ||
37 | defineTypeNameAndDebug(fullFragmentation, 0); | ||
38 | |||
39 | addToRunTimeSelectionTable | ||
40 | ( | ||
41 | daughterDistribution, | ||
42 | fullFragmentation, | ||
43 | dictionary | ||
44 | ); | ||
45 | } | ||
46 | } | ||
47 | } | ||
48 | |||
49 | |||
50 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | ||
51 | |||
52 | Foam::populationBalanceSubModels::daughterDistributions::fullFragmentation | ||
53 | ::fullFragmentation | ||
54 | ( | ||
55 | const dictionary& dict | ||
56 | ) | ||
57 | : | ||
58 | daughterDistribution(dict) | ||
59 | {} | ||
60 | |||
61 | |||
62 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | ||
63 | |||
64 | Foam::populationBalanceSubModels::daughterDistributions::fullFragmentation | ||
65 | ::~fullFragmentation() | ||
66 | {} | ||
67 | |||
68 | |||
69 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | ||
70 | |||
71 | Foam::tmp<Foam::volScalarField> | ||
72 | Foam::populationBalanceSubModels::daughterDistributions::fullFragmentation | ||
73 | ::mD | ||
74 | ( | ||
75 | const label order, | ||
76 | const volScalarField& abscissa | ||
77 | ) const | ||
78 | { | ||
79 | |||
80 | return (pow3(abscissa)/pow3(primarySize_))*pow(primarySize_, order); | ||
81 | } | ||
82 | |||
83 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/daugtherDistributions/fullFragmentation/fullFragmentation.H added (mode: 100644) (index 0000000..9b027f7) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2015 Alberto Passalacqua | ||
6 | \\/ M anipulation | | ||
7 | ------------------------------------------------------------------------------- | ||
8 | License | ||
9 | This file is derivative work 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 | Class | ||
25 | Foam::populationBalanceModels::daughterDistribution::fullFragmentation | ||
26 | |||
27 | Description | ||
28 | Daughter distribution of fragments with full fragmentation. | ||
29 | |||
30 | SourceFiles | ||
31 | fullFragmentation.C | ||
32 | |||
33 | \*---------------------------------------------------------------------------*/ | ||
34 | |||
35 | #ifndef fullFragmentation_H | ||
36 | #define fullFragmentation_H | ||
37 | |||
38 | #include "daughterDistribution.H" | ||
39 | |||
40 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
41 | |||
42 | namespace Foam | ||
43 | { | ||
44 | namespace populationBalanceSubModels | ||
45 | { | ||
46 | namespace daughterDistributions | ||
47 | { | ||
48 | |||
49 | /*---------------------------------------------------------------------------*\ | ||
50 | Class fullFragmentation Declaration | ||
51 | \*---------------------------------------------------------------------------*/ | ||
52 | |||
53 | class fullFragmentation | ||
54 | : | ||
55 | public daughterDistribution | ||
56 | { | ||
57 | private: | ||
58 | |||
59 | // Private data | ||
60 | |||
61 | //- Primary particle size | ||
62 | dimensionedScalar primarySize_; | ||
63 | |||
64 | |||
65 | public: | ||
66 | |||
67 | //- Runtime type information | ||
68 | TypeName("fullFragmentation"); | ||
69 | |||
70 | |||
71 | // Constructors | ||
72 | |||
73 | //- Construct from components | ||
74 | fullFragmentation(const dictionary& dict); | ||
75 | |||
76 | |||
77 | //- Destructor | ||
78 | virtual ~fullFragmentation(); | ||
79 | |||
80 | |||
81 | // Member Functions | ||
82 | |||
83 | //- Moment of the daughter distribution function | ||
84 | virtual tmp<volScalarField> mD | ||
85 | ( | ||
86 | const label order, | ||
87 | const volScalarField& abscissa | ||
88 | ) const; | ||
89 | |||
90 | }; | ||
91 | |||
92 | |||
93 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
94 | |||
95 | } // End namespace daughterDistributions | ||
96 | } // End namespace populationBalanceSubModels | ||
97 | } // End namespace Foam | ||
98 | |||
99 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
100 | |||
101 | #endif | ||
102 | |||
103 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/daugtherDistributions/oneQuarterMassRatio/oneQuarterMassRatio.C added (mode: 100644) (index 0000000..383674c) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2015 Alberto Passalacqua | ||
6 | \\/ M anipulation | | ||
7 | ------------------------------------------------------------------------------- | ||
8 | License | ||
9 | This file is derivative work 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 "oneQuarterMassRatio.H" | ||
27 | #include "addToRunTimeSelectionTable.H" | ||
28 | |||
29 | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // | ||
30 | |||
31 | namespace Foam | ||
32 | { | ||
33 | namespace populationBalanceSubModels | ||
34 | { | ||
35 | namespace daughterDistributions | ||
36 | { | ||
37 | defineTypeNameAndDebug(oneQuarterMassRatio, 0); | ||
38 | |||
39 | addToRunTimeSelectionTable | ||
40 | ( | ||
41 | daughterDistribution, | ||
42 | oneQuarterMassRatio, | ||
43 | dictionary | ||
44 | ); | ||
45 | } | ||
46 | } | ||
47 | } | ||
48 | |||
49 | |||
50 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | ||
51 | |||
52 | Foam::populationBalanceSubModels::daughterDistributions::oneQuarterMassRatio | ||
53 | ::oneQuarterMassRatio | ||
54 | ( | ||
55 | const dictionary& dict | ||
56 | ) | ||
57 | : | ||
58 | daughterDistribution(dict) | ||
59 | {} | ||
60 | |||
61 | |||
62 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | ||
63 | |||
64 | Foam::populationBalanceSubModels::daughterDistributions::oneQuarterMassRatio | ||
65 | ::~oneQuarterMassRatio() | ||
66 | {} | ||
67 | |||
68 | |||
69 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | ||
70 | |||
71 | Foam::tmp<Foam::volScalarField> | ||
72 | Foam::populationBalanceSubModels::daughterDistributions::oneQuarterMassRatio::mD | ||
73 | ( | ||
74 | const label order, | ||
75 | const volScalarField& abscissa | ||
76 | ) const | ||
77 | { | ||
78 | scalar exponent = order/3.0; | ||
79 | |||
80 | return (pow(4.0, exponent) + 1.0)*pow(abscissa, order)/pow(5, exponent); | ||
81 | } | ||
82 | |||
83 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/daugtherDistributions/oneQuarterMassRatio/oneQuarterMassRatio.H added (mode: 100644) (index 0000000..cd5fb39) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2015 Alberto Passalacqua | ||
6 | \\/ M anipulation | | ||
7 | ------------------------------------------------------------------------------- | ||
8 | License | ||
9 | This file is derivative work 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 | Class | ||
25 | Foam::populationBalanceSubModels::daughterDistribution::oneQuarterMassRatio | ||
26 | |||
27 | Description | ||
28 | Daughter distribution of fragments with one quarter mass ratio | ||
29 | fragmentation. | ||
30 | |||
31 | SourceFiles | ||
32 | oneQuarterMassRatio.C | ||
33 | |||
34 | \*---------------------------------------------------------------------------*/ | ||
35 | |||
36 | #ifndef oneQuarterMassRatio_H | ||
37 | #define oneQuarterMassRatio_H | ||
38 | |||
39 | #include "daughterDistribution.H" | ||
40 | |||
41 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
42 | |||
43 | namespace Foam | ||
44 | { | ||
45 | namespace populationBalanceSubModels | ||
46 | { | ||
47 | namespace daughterDistributions | ||
48 | { | ||
49 | |||
50 | /*---------------------------------------------------------------------------*\ | ||
51 | Class oneQuarterMassRatio Declaration | ||
52 | \*---------------------------------------------------------------------------*/ | ||
53 | |||
54 | class oneQuarterMassRatio | ||
55 | : | ||
56 | public daughterDistribution | ||
57 | { | ||
58 | public: | ||
59 | |||
60 | //- Runtime type information | ||
61 | TypeName("oneQuarterMassRatio"); | ||
62 | |||
63 | |||
64 | // Constructors | ||
65 | |||
66 | //- Construct from components | ||
67 | oneQuarterMassRatio(const dictionary& dict); | ||
68 | |||
69 | |||
70 | //- Destructor | ||
71 | virtual ~oneQuarterMassRatio(); | ||
72 | |||
73 | |||
74 | // Member Functions | ||
75 | |||
76 | //- Moment of the daughter distribution function | ||
77 | virtual tmp<volScalarField> mD | ||
78 | ( | ||
79 | const label order, | ||
80 | const volScalarField& abscissa | ||
81 | ) const; | ||
82 | |||
83 | }; | ||
84 | |||
85 | |||
86 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
87 | |||
88 | } // End namespace daughterDistributions | ||
89 | } // End namespace populationBalanceSubModels | ||
90 | } // End namespace Foam | ||
91 | |||
92 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
93 | |||
94 | #endif | ||
95 | |||
96 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/daugtherDistributions/symmetricFragmentation/symmetricFragmentation.C added (mode: 100644) (index 0000000..ac89528) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2015 Alberto Passalacqua | ||
6 | \\/ M anipulation | | ||
7 | ------------------------------------------------------------------------------- | ||
8 | License | ||
9 | This file is derivative work 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 "symmetricFragmentation.H" | ||
27 | #include "addToRunTimeSelectionTable.H" | ||
28 | |||
29 | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // | ||
30 | |||
31 | namespace Foam | ||
32 | { | ||
33 | namespace populationBalanceSubModels | ||
34 | { | ||
35 | namespace daughterDistributions | ||
36 | { | ||
37 | defineTypeNameAndDebug(symmetricFragmentation, 0); | ||
38 | |||
39 | addToRunTimeSelectionTable | ||
40 | ( | ||
41 | daughterDistribution, | ||
42 | symmetricFragmentation, | ||
43 | dictionary | ||
44 | ); | ||
45 | } | ||
46 | } | ||
47 | } | ||
48 | |||
49 | |||
50 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | ||
51 | |||
52 | Foam::populationBalanceSubModels::daughterDistributions::symmetricFragmentation | ||
53 | ::symmetricFragmentation | ||
54 | ( | ||
55 | const dictionary& dict | ||
56 | ) | ||
57 | : | ||
58 | daughterDistribution(dict) | ||
59 | {} | ||
60 | |||
61 | |||
62 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | ||
63 | |||
64 | Foam::populationBalanceSubModels::daughterDistributions::symmetricFragmentation | ||
65 | ::~symmetricFragmentation() | ||
66 | {} | ||
67 | |||
68 | |||
69 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | ||
70 | |||
71 | Foam::tmp<Foam::volScalarField> | ||
72 | Foam::populationBalanceSubModels::daughterDistributions::symmetricFragmentation | ||
73 | ::mD | ||
74 | ( | ||
75 | const label order, | ||
76 | const volScalarField& abscissa | ||
77 | ) const | ||
78 | { | ||
79 | return pow(2.0, (3.0 - order)/3.0)*pow(abscissa, order); | ||
80 | } | ||
81 | |||
82 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/daugtherDistributions/symmetricFragmentation/symmetricFragmentation.H added (mode: 100644) (index 0000000..e6ca9d4) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2015 Alberto Passalacqua | ||
6 | \\/ M anipulation | | ||
7 | ------------------------------------------------------------------------------- | ||
8 | License | ||
9 | This file is derivative work 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 | Class | ||
25 | Foam::populationBalanceSubModels::daughterDistribution::symmetricFragmentation | ||
26 | |||
27 | Description | ||
28 | Daughter distribution of fragments with symmetric fragmentation. | ||
29 | |||
30 | SourceFiles | ||
31 | symmetricFragmentation.C | ||
32 | |||
33 | \*---------------------------------------------------------------------------*/ | ||
34 | |||
35 | #ifndef symmetricFragmentation_H | ||
36 | #define symmetricFragmentation_H | ||
37 | |||
38 | #include "daughterDistribution.H" | ||
39 | |||
40 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
41 | |||
42 | namespace Foam | ||
43 | { | ||
44 | namespace populationBalanceSubModels | ||
45 | { | ||
46 | namespace daughterDistributions | ||
47 | { | ||
48 | |||
49 | /*---------------------------------------------------------------------------*\ | ||
50 | Class symmetricFragmentation Declaration | ||
51 | \*---------------------------------------------------------------------------*/ | ||
52 | |||
53 | class symmetricFragmentation | ||
54 | : | ||
55 | public daughterDistribution | ||
56 | { | ||
57 | public: | ||
58 | |||
59 | //- Runtime type information | ||
60 | TypeName("symmetricFragmentation"); | ||
61 | |||
62 | |||
63 | // Constructors | ||
64 | |||
65 | //- Construct from components | ||
66 | symmetricFragmentation(const dictionary& dict); | ||
67 | |||
68 | |||
69 | //- Destructor | ||
70 | virtual ~symmetricFragmentation(); | ||
71 | |||
72 | |||
73 | // Member Functions | ||
74 | |||
75 | //- Moment of the daughter distribution function | ||
76 | virtual tmp<volScalarField> mD | ||
77 | ( | ||
78 | const label order, | ||
79 | const volScalarField& abscissa | ||
80 | ) const; | ||
81 | |||
82 | }; | ||
83 | |||
84 | |||
85 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
86 | |||
87 | } // End namespace daughterDistributions | ||
88 | } // End namespace populationBalanceSubModels | ||
89 | } // End namespace Foam | ||
90 | |||
91 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
92 | |||
93 | #endif | ||
94 | |||
95 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/daugtherDistributions/uniform/uniform.C added (mode: 100644) (index 0000000..cac80ca) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2015 Alberto Passalacqua | ||
6 | \\/ M anipulation | | ||
7 | ------------------------------------------------------------------------------- | ||
8 | License | ||
9 | This file is derivative work 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 "uniform.H" | ||
27 | #include "addToRunTimeSelectionTable.H" | ||
28 | |||
29 | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // | ||
30 | |||
31 | namespace Foam | ||
32 | { | ||
33 | namespace populationBalanceSubModels | ||
34 | { | ||
35 | namespace daughterDistributions | ||
36 | { | ||
37 | defineTypeNameAndDebug(uniform, 0); | ||
38 | |||
39 | addToRunTimeSelectionTable | ||
40 | ( | ||
41 | daughterDistribution, | ||
42 | uniform, | ||
43 | dictionary | ||
44 | ); | ||
45 | } | ||
46 | } | ||
47 | } | ||
48 | |||
49 | |||
50 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | ||
51 | |||
52 | Foam::populationBalanceSubModels::daughterDistributions::uniform | ||
53 | ::uniform | ||
54 | ( | ||
55 | const dictionary& dict | ||
56 | ) | ||
57 | : | ||
58 | daughterDistribution(dict) | ||
59 | {} | ||
60 | |||
61 | |||
62 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | ||
63 | |||
64 | Foam::populationBalanceSubModels::daughterDistributions::uniform | ||
65 | ::~uniform() | ||
66 | {} | ||
67 | |||
68 | |||
69 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | ||
70 | |||
71 | Foam::tmp<Foam::volScalarField> | ||
72 | Foam::populationBalanceSubModels::daughterDistributions::uniform::mD | ||
73 | ( | ||
74 | const label order, | ||
75 | const volScalarField& abscissa | ||
76 | ) const | ||
77 | { | ||
78 | return 6.0*pow(abscissa, order)/(order + 3.0); | ||
79 | } | ||
80 | |||
81 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/daugtherDistributions/uniform/uniform.H added (mode: 100644) (index 0000000..680cf82) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2015 Alberto Passalacqua | ||
6 | \\/ M anipulation | | ||
7 | ------------------------------------------------------------------------------- | ||
8 | License | ||
9 | This file is derivative work 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 | Class | ||
25 | Foam::populationBalanceSubModels::daughterDistribution::uniform | ||
26 | |||
27 | Description | ||
28 | Daughter distribution of fragments with uniform fragmentation. | ||
29 | |||
30 | SourceFiles | ||
31 | uniform.C | ||
32 | |||
33 | \*---------------------------------------------------------------------------*/ | ||
34 | |||
35 | #ifndef uniform_H | ||
36 | #define uniform_H | ||
37 | |||
38 | #include "daughterDistribution.H" | ||
39 | |||
40 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
41 | |||
42 | namespace Foam | ||
43 | { | ||
44 | namespace populationBalanceSubModels | ||
45 | { | ||
46 | namespace daughterDistributions | ||
47 | { | ||
48 | |||
49 | /*---------------------------------------------------------------------------*\ | ||
50 | Class uniform Declaration | ||
51 | \*---------------------------------------------------------------------------*/ | ||
52 | |||
53 | class uniform | ||
54 | : | ||
55 | public daughterDistribution | ||
56 | { | ||
57 | public: | ||
58 | |||
59 | //- Runtime type information | ||
60 | TypeName("uniform"); | ||
61 | |||
62 | |||
63 | // Constructors | ||
64 | |||
65 | //- Construct from components | ||
66 | uniform(const dictionary& dict); | ||
67 | |||
68 | |||
69 | //- Destructor | ||
70 | virtual ~uniform(); | ||
71 | |||
72 | |||
73 | // Member Functions | ||
74 | |||
75 | //- Moment of the daughter distribution function | ||
76 | virtual tmp<volScalarField> mD | ||
77 | ( | ||
78 | const label order, | ||
79 | const volScalarField& abscissa | ||
80 | ) const; | ||
81 | |||
82 | }; | ||
83 | |||
84 | |||
85 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
86 | |||
87 | } // End namespace daughterDistributions | ||
88 | } // End namespace populationBalanceSubModels | ||
89 | } // End namespace Foam | ||
90 | |||
91 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
92 | |||
93 | #endif | ||
94 | |||
95 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/diffusionModels/diffusionModel/diffusionModel.C added (mode: 100644) (index 0000000..f1adc0f) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2015 Alberto Passalacqua | ||
6 | \\/ M anipulation | | ||
7 | ------------------------------------------------------------------------------- | ||
8 | License | ||
9 | This file is derivative work 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 "diffusionModel.H" | ||
27 | |||
28 | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // | ||
29 | |||
30 | namespace Foam | ||
31 | { | ||
32 | namespace populationBalanceSubModels | ||
33 | { | ||
34 | defineTypeNameAndDebug(diffusionModel, 0); | ||
35 | |||
36 | defineRunTimeSelectionTable(diffusionModel, dictionary); | ||
37 | } | ||
38 | } | ||
39 | |||
40 | |||
41 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | ||
42 | |||
43 | Foam::populationBalanceSubModels::diffusionModel::diffusionModel | ||
44 | ( | ||
45 | const dictionary& dict | ||
46 | ) | ||
47 | : | ||
48 | dict_(dict) | ||
49 | {} | ||
50 | |||
51 | |||
52 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | ||
53 | |||
54 | Foam::populationBalanceSubModels::diffusionModel::~diffusionModel() | ||
55 | {} | ||
56 | |||
57 | |||
58 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/diffusionModels/diffusionModel/diffusionModel.H added (mode: 100644) (index 0000000..7b59158) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2015 Alberto Passalacqua | ||
6 | \\/ M anipulation | | ||
7 | ------------------------------------------------------------------------------- | ||
8 | License | ||
9 | This file is derivative work 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 | Class | ||
25 | Foam::populationBalanceSubModels::diffusionModel | ||
26 | |||
27 | Description | ||
28 | Abstract class for turbulent diffusion models. | ||
29 | |||
30 | SourceFiles | ||
31 | diffusionModel.C | ||
32 | |||
33 | \*---------------------------------------------------------------------------*/ | ||
34 | |||
35 | #ifndef diffusionModel_H | ||
36 | #define diffusionModel_H | ||
37 | |||
38 | #include "dictionary.H" | ||
39 | #include "volFields.H" | ||
40 | #include "fvMatrix.H" | ||
41 | #include "dimensionedTypes.H" | ||
42 | #include "runTimeSelectionTables.H" | ||
43 | |||
44 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
45 | |||
46 | namespace Foam | ||
47 | { | ||
48 | namespace populationBalanceSubModels | ||
49 | { | ||
50 | |||
51 | /*---------------------------------------------------------------------------*\ | ||
52 | Class diffusionModel Declaration | ||
53 | \*---------------------------------------------------------------------------*/ | ||
54 | |||
55 | class diffusionModel | ||
56 | { | ||
57 | // Private member functions | ||
58 | |||
59 | //- Disallow default bitwise copy construct | ||
60 | diffusionModel(const diffusionModel&); | ||
61 | |||
62 | //- Disallow default bitwise assignment | ||
63 | void operator=(const diffusionModel&); | ||
64 | |||
65 | |||
66 | protected: | ||
67 | |||
68 | // Protected data | ||
69 | |||
70 | const dictionary& dict_; | ||
71 | |||
72 | |||
73 | public: | ||
74 | |||
75 | //- Runtime type information | ||
76 | TypeName("diffusionModel"); | ||
77 | |||
78 | // Declare runtime constructor selection table | ||
79 | declareRunTimeSelectionTable | ||
80 | ( | ||
81 | autoPtr, | ||
82 | diffusionModel, | ||
83 | dictionary, | ||
84 | ( | ||
85 | const dictionary& dict | ||
86 | ), | ||
87 | (dict) | ||
88 | ); | ||
89 | |||
90 | |||
91 | // Constructors | ||
92 | |||
93 | //- Construct from components | ||
94 | diffusionModel(const dictionary& dict); | ||
95 | |||
96 | |||
97 | // Selectors | ||
98 | |||
99 | static autoPtr<diffusionModel> New | ||
100 | ( | ||
101 | const dictionary& dict | ||
102 | ); | ||
103 | |||
104 | |||
105 | //- Destructor | ||
106 | virtual ~diffusionModel(); | ||
107 | |||
108 | |||
109 | // Member Functions | ||
110 | |||
111 | //- Return the source term for diffusion term in the moment equation | ||
112 | virtual tmp<fvScalarMatrix> momentDiff | ||
113 | ( | ||
114 | const volScalarField& moment | ||
115 | ) const = 0; | ||
116 | }; | ||
117 | |||
118 | |||
119 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
120 | |||
121 | } // End namespace populationBalanceSubModels | ||
122 | } // End namespace Foam | ||
123 | |||
124 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
125 | |||
126 | #endif | ||
127 | |||
128 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/diffusionModels/diffusionModel/newDiffusionModel.C added (mode: 100644) (index 0000000..df298ee) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2015 Alberto Passalacqua | ||
6 | \\/ M anipulation | | ||
7 | ------------------------------------------------------------------------------- | ||
8 | License | ||
9 | This file is derivative work 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 "diffusionModel.H" | ||
27 | |||
28 | // * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * // | ||
29 | |||
30 | Foam::autoPtr<Foam::populationBalanceSubModels::diffusionModel> | ||
31 | Foam::populationBalanceSubModels::diffusionModel::New | ||
32 | ( | ||
33 | const dictionary& dict | ||
34 | ) | ||
35 | { | ||
36 | word diffusionModelType(dict.lookup("diffusionModel")); | ||
37 | |||
38 | Info<< "Selecting diffusionModel " | ||
39 | << diffusionModelType << endl; | ||
40 | |||
41 | dictionaryConstructorTable::iterator cstrIter = | ||
42 | dictionaryConstructorTablePtr_->find(diffusionModelType); | ||
43 | |||
44 | if (cstrIter == dictionaryConstructorTablePtr_->end()) | ||
45 | { | ||
46 | FatalErrorInFunction | ||
47 | << "Unknown diffusionModelType type " | ||
48 | << diffusionModelType << endl << endl | ||
49 | << "Valid diffusionModelType types are :" << endl | ||
50 | << dictionaryConstructorTablePtr_->sortedToc() | ||
51 | << abort(FatalError); | ||
52 | } | ||
53 | |||
54 | return autoPtr<diffusionModel>(cstrIter()(dict)); | ||
55 | } | ||
56 | |||
57 | |||
58 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/diffusionModels/molecularDiffusion/molecularDiffusion.C added (mode: 100644) (index 0000000..eedd750) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2015 Matteo Icardi | ||
6 | \\/ M anipulation | | ||
7 | ------------------------------------------------------------------------------- | ||
8 | License | ||
9 | This file is derivative work 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 "molecularDiffusion.H" | ||
27 | #include "addToRunTimeSelectionTable.H" | ||
28 | |||
29 | #include "turbulentTransportModel.H" | ||
30 | #include "turbulentFluidThermoModel.H" | ||
31 | |||
32 | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // | ||
33 | |||
34 | namespace Foam | ||
35 | { | ||
36 | namespace populationBalanceSubModels | ||
37 | { | ||
38 | namespace diffusionModels | ||
39 | { | ||
40 | defineTypeNameAndDebug(molecularDiffusion, 0); | ||
41 | |||
42 | addToRunTimeSelectionTable | ||
43 | ( | ||
44 | diffusionModel, | ||
45 | molecularDiffusion, | ||
46 | dictionary | ||
47 | ); | ||
48 | } | ||
49 | } | ||
50 | } | ||
51 | |||
52 | |||
53 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | ||
54 | |||
55 | Foam::populationBalanceSubModels::diffusionModels::molecularDiffusion | ||
56 | ::molecularDiffusion | ||
57 | ( | ||
58 | const dictionary& dict | ||
59 | ) | ||
60 | : | ||
61 | diffusionModel(dict), | ||
62 | gammaLam_(dict.lookup("gammaLam")) | ||
63 | {} | ||
64 | |||
65 | |||
66 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | ||
67 | |||
68 | Foam::populationBalanceSubModels::diffusionModels::molecularDiffusion | ||
69 | ::~molecularDiffusion() | ||
70 | {} | ||
71 | |||
72 | |||
73 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | ||
74 | |||
75 | Foam::tmp<Foam::fvScalarMatrix> | ||
76 | Foam::populationBalanceSubModels::diffusionModels::molecularDiffusion | ||
77 | ::momentDiff | ||
78 | ( | ||
79 | const volScalarField& moment | ||
80 | ) const | ||
81 | { | ||
82 | |||
83 | return fvm::laplacian(gammaLam_, moment); | ||
84 | } | ||
85 | |||
86 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/diffusionModels/molecularDiffusion/molecularDiffusion.H added (mode: 100644) (index 0000000..8fbdd6e) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2015 Matteo Icardi | ||
6 | \\/ M anipulation | | ||
7 | ------------------------------------------------------------------------------- | ||
8 | License | ||
9 | This file is derivative work 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 | Class | ||
25 | Foam::populationBalanceSubModels::diffusionModels::molecularDiffusion | ||
26 | |||
27 | Description | ||
28 | Molecular diffusion model. | ||
29 | |||
30 | SourceFiles | ||
31 | molecularDiffusion.C | ||
32 | |||
33 | \*---------------------------------------------------------------------------*/ | ||
34 | |||
35 | #ifndef molecularDiffusion_H | ||
36 | #define molecularDiffusion_H | ||
37 | |||
38 | #include "diffusionModel.H" | ||
39 | #include "fvm.H" | ||
40 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
41 | |||
42 | namespace Foam | ||
43 | { | ||
44 | namespace populationBalanceSubModels | ||
45 | { | ||
46 | namespace diffusionModels | ||
47 | { | ||
48 | |||
49 | /*---------------------------------------------------------------------------*\ | ||
50 | Class molecularDiffusion Declaration | ||
51 | \*---------------------------------------------------------------------------*/ | ||
52 | |||
53 | class molecularDiffusion | ||
54 | : | ||
55 | public diffusionModel | ||
56 | { | ||
57 | //- Private member functions | ||
58 | tmp<volScalarField> turbViscosity(const volScalarField& moment) const; | ||
59 | |||
60 | //- Private data | ||
61 | |||
62 | //- Laminar diffusivity | ||
63 | dimensionedScalar gammaLam_; | ||
64 | |||
65 | public: | ||
66 | |||
67 | //- Runtime type information | ||
68 | TypeName("molecularDiffusion"); | ||
69 | |||
70 | |||
71 | // Constructors | ||
72 | |||
73 | //- Construct from components | ||
74 | molecularDiffusion(const dictionary& dict); | ||
75 | |||
76 | |||
77 | //- Destructor | ||
78 | virtual ~molecularDiffusion(); | ||
79 | |||
80 | |||
81 | // Member Functions | ||
82 | |||
83 | //- Moments of the daughter distribution | ||
84 | virtual tmp<fvScalarMatrix> momentDiff | ||
85 | ( | ||
86 | const volScalarField& moment | ||
87 | ) const; | ||
88 | |||
89 | }; | ||
90 | |||
91 | |||
92 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
93 | |||
94 | } // End namespace diffusionModels | ||
95 | } // End namespace populationBalanceSubModels | ||
96 | } // End namespace Foam | ||
97 | |||
98 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
99 | |||
100 | #endif | ||
101 | |||
102 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/diffusionModels/noDiffusion/noDiffusion.C added (mode: 100644) (index 0000000..1437979) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2015-2016 Alberto Passalacqua | ||
6 | \\/ M anipulation | | ||
7 | ------------------------------------------------------------------------------- | ||
8 | License | ||
9 | This file is derivative work 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 "noDiffusion.H" | ||
27 | #include "addToRunTimeSelectionTable.H" | ||
28 | |||
29 | #include "turbulentFluidThermoModel.H" | ||
30 | |||
31 | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // | ||
32 | |||
33 | namespace Foam | ||
34 | { | ||
35 | namespace populationBalanceSubModels | ||
36 | { | ||
37 | namespace diffusionModels | ||
38 | { | ||
39 | defineTypeNameAndDebug(noDiffusion, 0); | ||
40 | |||
41 | addToRunTimeSelectionTable | ||
42 | ( | ||
43 | diffusionModel, | ||
44 | noDiffusion, | ||
45 | dictionary | ||
46 | ); | ||
47 | } | ||
48 | } | ||
49 | } | ||
50 | |||
51 | |||
52 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | ||
53 | |||
54 | Foam::populationBalanceSubModels::diffusionModels::noDiffusion | ||
55 | ::noDiffusion | ||
56 | ( | ||
57 | const dictionary& dict | ||
58 | ) | ||
59 | : | ||
60 | diffusionModel(dict) | ||
61 | {} | ||
62 | |||
63 | |||
64 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | ||
65 | |||
66 | Foam::populationBalanceSubModels::diffusionModels::noDiffusion | ||
67 | ::~noDiffusion() | ||
68 | {} | ||
69 | |||
70 | |||
71 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | ||
72 | |||
73 | Foam::tmp<Foam::fvScalarMatrix> | ||
74 | Foam::populationBalanceSubModels::diffusionModels::noDiffusion | ||
75 | ::momentDiff | ||
76 | ( | ||
77 | const volScalarField& moment | ||
78 | ) const | ||
79 | { | ||
80 | tmp<volScalarField> noDiff | ||
81 | ( | ||
82 | new volScalarField | ||
83 | ( | ||
84 | IOobject | ||
85 | ( | ||
86 | "noDiff", | ||
87 | moment.mesh().time().timeName(), | ||
88 | moment.mesh(), | ||
89 | IOobject::NO_READ, | ||
90 | IOobject::NO_WRITE, | ||
91 | false | ||
92 | ), | ||
93 | moment.mesh(), | ||
94 | dimensionedScalar("zero", inv(dimTime), 0.0) | ||
95 | ) | ||
96 | ); | ||
97 | |||
98 | return fvm::Sp(noDiff, moment); | ||
99 | } | ||
100 | |||
101 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/diffusionModels/noDiffusion/noDiffusion.H added (mode: 100644) (index 0000000..a1ec9d9) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2015-2016 Alberto Passalacqua | ||
6 | \\/ M anipulation | | ||
7 | ------------------------------------------------------------------------------- | ||
8 | License | ||
9 | This file is derivative work 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 | Class | ||
25 | Foam::populationBalanceSubModels::diffusionModels::noDiffusion | ||
26 | |||
27 | Description | ||
28 | No diffusion model. | ||
29 | |||
30 | SourceFiles | ||
31 | noDiffusion.C | ||
32 | |||
33 | \*---------------------------------------------------------------------------*/ | ||
34 | |||
35 | #ifndef noDiffusion_H | ||
36 | #define noDiffusion_H | ||
37 | |||
38 | #include "diffusionModel.H" | ||
39 | #include "fvm.H" | ||
40 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
41 | |||
42 | namespace Foam | ||
43 | { | ||
44 | namespace populationBalanceSubModels | ||
45 | { | ||
46 | namespace diffusionModels | ||
47 | { | ||
48 | |||
49 | /*---------------------------------------------------------------------------*\ | ||
50 | Class noDiffusion Declaration | ||
51 | \*---------------------------------------------------------------------------*/ | ||
52 | |||
53 | class noDiffusion | ||
54 | : | ||
55 | public diffusionModel | ||
56 | { | ||
57 | public: | ||
58 | |||
59 | //- Runtime type information | ||
60 | TypeName("none"); | ||
61 | |||
62 | |||
63 | // Constructors | ||
64 | |||
65 | //- Construct from components | ||
66 | noDiffusion(const dictionary& dict); | ||
67 | |||
68 | |||
69 | //- Destructor | ||
70 | virtual ~noDiffusion(); | ||
71 | |||
72 | |||
73 | // Member Functions | ||
74 | |||
75 | //- Moments of the daughter distribution | ||
76 | virtual tmp<fvScalarMatrix> momentDiff | ||
77 | ( | ||
78 | const volScalarField& moment | ||
79 | ) const; | ||
80 | |||
81 | }; | ||
82 | |||
83 | |||
84 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
85 | |||
86 | } // End namespace diffusionModels | ||
87 | } // End namespace populationBalanceSubModels | ||
88 | } // End namespace Foam | ||
89 | |||
90 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
91 | |||
92 | #endif | ||
93 | |||
94 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/diffusionModels/turbulentDiffusion/turbulentDiffusion.C added (mode: 100644) (index 0000000..92a75ea) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2015-2016 Alberto Passalacqua | ||
6 | \\/ M anipulation | | ||
7 | ------------------------------------------------------------------------------- | ||
8 | License | ||
9 | This file is derivative work 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 "turbulentDiffusion.H" | ||
27 | #include "addToRunTimeSelectionTable.H" | ||
28 | |||
29 | #include "turbulentTransportModel.H" | ||
30 | #include "turbulentFluidThermoModel.H" | ||
31 | |||
32 | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // | ||
33 | |||
34 | namespace Foam | ||
35 | { | ||
36 | namespace populationBalanceSubModels | ||
37 | { | ||
38 | namespace diffusionModels | ||
39 | { | ||
40 | defineTypeNameAndDebug(turbulentDiffusion, 0); | ||
41 | |||
42 | addToRunTimeSelectionTable | ||
43 | ( | ||
44 | diffusionModel, | ||
45 | turbulentDiffusion, | ||
46 | dictionary | ||
47 | ); | ||
48 | } | ||
49 | } | ||
50 | } | ||
51 | |||
52 | |||
53 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | ||
54 | |||
55 | Foam::populationBalanceSubModels::diffusionModels::turbulentDiffusion | ||
56 | ::turbulentDiffusion | ||
57 | ( | ||
58 | const dictionary& dict | ||
59 | ) | ||
60 | : | ||
61 | diffusionModel(dict), | ||
62 | gammaLam_(dict.lookup("gammaLam")), | ||
63 | Sc_(readScalar(dict.lookup("Sc"))) | ||
64 | {} | ||
65 | |||
66 | |||
67 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | ||
68 | |||
69 | Foam::populationBalanceSubModels::diffusionModels::turbulentDiffusion | ||
70 | ::~turbulentDiffusion() | ||
71 | {} | ||
72 | |||
73 | |||
74 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | ||
75 | |||
76 | Foam::tmp<Foam::fvScalarMatrix> | ||
77 | Foam::populationBalanceSubModels::diffusionModels::turbulentDiffusion | ||
78 | ::momentDiff | ||
79 | ( | ||
80 | const volScalarField& moment | ||
81 | ) const | ||
82 | { | ||
83 | volScalarField gamma(turbViscosity(moment)/Sc_ + gammaLam_); | ||
84 | |||
85 | return fvm::laplacian(gamma, moment); | ||
86 | } | ||
87 | |||
88 | Foam::tmp<Foam::volScalarField> Foam::populationBalanceSubModels::diffusionModels::turbulentDiffusion:: | ||
89 | turbViscosity(const volScalarField& moment) const | ||
90 | { | ||
91 | typedef compressible::turbulenceModel cmpTurbModel; | ||
92 | typedef incompressible::turbulenceModel icoTurbModel; | ||
93 | |||
94 | if (moment.mesh().foundObject<cmpTurbModel>(cmpTurbModel::propertiesName)) | ||
95 | { | ||
96 | const cmpTurbModel& turb = | ||
97 | moment.mesh().lookupObject<cmpTurbModel> | ||
98 | ( | ||
99 | cmpTurbModel::propertiesName | ||
100 | ); | ||
101 | |||
102 | return turb.mut()/turb.rho(); | ||
103 | } | ||
104 | else if | ||
105 | ( | ||
106 | moment.mesh().foundObject<icoTurbModel>(icoTurbModel::propertiesName) | ||
107 | ) | ||
108 | { | ||
109 | const incompressible::turbulenceModel& turb = | ||
110 | moment.mesh().lookupObject<icoTurbModel> | ||
111 | ( | ||
112 | icoTurbModel::propertiesName | ||
113 | ); | ||
114 | |||
115 | return turb.nut(); | ||
116 | } | ||
117 | else | ||
118 | { | ||
119 | FatalErrorInFunction | ||
120 | << "No valid turbulence model for turbulent diffusion calculation." | ||
121 | << exit(FatalError); | ||
122 | |||
123 | return volScalarField::null(); | ||
124 | } | ||
125 | } | ||
126 | |||
127 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/diffusionModels/turbulentDiffusion/turbulentDiffusion.H added (mode: 100644) (index 0000000..456356b) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2015-2016 Alberto Passalacqua | ||
6 | \\/ M anipulation | | ||
7 | ------------------------------------------------------------------------------- | ||
8 | License | ||
9 | This file is derivative work 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 | Class | ||
25 | Foam::populationBalanceSubModels::diffusionModels::turbulentDiffusion | ||
26 | |||
27 | Description | ||
28 | Turbulent diffusion model. | ||
29 | |||
30 | SourceFiles | ||
31 | turbulentDiffusion.C | ||
32 | |||
33 | \*---------------------------------------------------------------------------*/ | ||
34 | |||
35 | #ifndef turbulentDiffusion_H | ||
36 | #define turbulentDiffusion_H | ||
37 | |||
38 | #include "diffusionModel.H" | ||
39 | #include "fvm.H" | ||
40 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
41 | |||
42 | namespace Foam | ||
43 | { | ||
44 | namespace populationBalanceSubModels | ||
45 | { | ||
46 | namespace diffusionModels | ||
47 | { | ||
48 | |||
49 | /*---------------------------------------------------------------------------*\ | ||
50 | Class turbulentDiffusion Declaration | ||
51 | \*---------------------------------------------------------------------------*/ | ||
52 | |||
53 | class turbulentDiffusion | ||
54 | : | ||
55 | public diffusionModel | ||
56 | { | ||
57 | //- Private member functions | ||
58 | tmp<volScalarField> turbViscosity(const volScalarField& moment) const; | ||
59 | |||
60 | //- Private data | ||
61 | |||
62 | //- Laminar diffusivity | ||
63 | dimensionedScalar gammaLam_; | ||
64 | |||
65 | //- Turbulent Schmidt number | ||
66 | scalar Sc_; | ||
67 | |||
68 | public: | ||
69 | |||
70 | //- Runtime type information | ||
71 | TypeName("turbulentDiffusion"); | ||
72 | |||
73 | |||
74 | // Constructors | ||
75 | |||
76 | //- Construct from components | ||
77 | turbulentDiffusion(const dictionary& dict); | ||
78 | |||
79 | |||
80 | //- Destructor | ||
81 | virtual ~turbulentDiffusion(); | ||
82 | |||
83 | |||
84 | // Member Functions | ||
85 | |||
86 | //- Moments of the daughter distribution | ||
87 | virtual tmp<fvScalarMatrix> momentDiff | ||
88 | ( | ||
89 | const volScalarField& moment | ||
90 | ) const; | ||
91 | |||
92 | }; | ||
93 | |||
94 | |||
95 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
96 | |||
97 | } // End namespace diffusionModels | ||
98 | } // End namespace populationBalanceSubModels | ||
99 | } // End namespace Foam | ||
100 | |||
101 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
102 | |||
103 | #endif | ||
104 | |||
105 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/growthModels/constantGrowth/constantGrowth.C added (mode: 100644) (index 0000000..251af0f) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2015 Matteo Icardi | ||
6 | \\/ M anipulation | | ||
7 | ------------------------------------------------------------------------------- | ||
8 | License | ||
9 | This file is derivative work 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 "constantGrowth.H" | ||
27 | #include "addToRunTimeSelectionTable.H" | ||
28 | |||
29 | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // | ||
30 | |||
31 | namespace Foam | ||
32 | { | ||
33 | namespace populationBalanceSubModels | ||
34 | { | ||
35 | namespace growthModels | ||
36 | { | ||
37 | defineTypeNameAndDebug(constantGrowth, 0); | ||
38 | |||
39 | addToRunTimeSelectionTable | ||
40 | ( | ||
41 | growthModel, | ||
42 | constantGrowth, | ||
43 | dictionary | ||
44 | ); | ||
45 | } | ||
46 | } | ||
47 | } | ||
48 | |||
49 | |||
50 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | ||
51 | |||
52 | Foam::populationBalanceSubModels::growthModels::constantGrowth | ||
53 | ::constantGrowth | ||
54 | ( | ||
55 | const dictionary& dict | ||
56 | ) | ||
57 | : | ||
58 | growthModel(dict), | ||
59 | minAbscissa_(dict.lookup("minAbscissa")), | ||
60 | maxAbscissa_(dict.lookup("maxAbscissa")) | ||
61 | {} | ||
62 | |||
63 | |||
64 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | ||
65 | |||
66 | Foam::populationBalanceSubModels::growthModels::constantGrowth | ||
67 | ::~constantGrowth() | ||
68 | {} | ||
69 | |||
70 | |||
71 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | ||
72 | |||
73 | Foam::tmp<Foam::volScalarField> | ||
74 | Foam::populationBalanceSubModels::growthModels::constantGrowth::Kg | ||
75 | ( | ||
76 | const volScalarField& abscissa | ||
77 | ) const | ||
78 | { | ||
79 | dimensionedScalar oneAbs | ||
80 | ( | ||
81 | "oneAbs", | ||
82 | dimVolume/sqr(abscissa.dimensions()), | ||
83 | 1.0 | ||
84 | ); | ||
85 | |||
86 | return Cg_*pos(-abscissa + maxAbscissa_) | ||
87 | *pos(abscissa - minAbscissa_)*oneAbs; | ||
88 | } | ||
89 | |||
90 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/growthModels/constantGrowth/constantGrowth.H added (mode: 100644) (index 0000000..5cebb84) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2015 Matteo Icardi | ||
6 | \\/ M anipulation | | ||
7 | ------------------------------------------------------------------------------- | ||
8 | License | ||
9 | This file is derivative work 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 | Class | ||
25 | Foam::populationBalanceSubModels::growthModels::constantGrowth | ||
26 | |||
27 | Description | ||
28 | Constant growth model. The value of the constant is read from dictionary | ||
29 | or assumed equal to 1. The minimum and maximum value of the abscissa to which the | ||
30 | model is applied can be defined by the user or it is assumed to be 1e-10 and 1e10. | ||
31 | |||
32 | SourceFiles | ||
33 | constantGrowth.C | ||
34 | |||
35 | \*---------------------------------------------------------------------------*/ | ||
36 | |||
37 | #ifndef constantGrowth_H | ||
38 | #define constantGrowth_H | ||
39 | |||
40 | #include "growthModel.H" | ||
41 | |||
42 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
43 | |||
44 | namespace Foam | ||
45 | { | ||
46 | namespace populationBalanceSubModels | ||
47 | { | ||
48 | namespace growthModels | ||
49 | { | ||
50 | |||
51 | /*---------------------------------------------------------------------------*\ | ||
52 | Class constantGrowth Declaration | ||
53 | \*---------------------------------------------------------------------------*/ | ||
54 | |||
55 | class constantGrowth | ||
56 | : | ||
57 | public growthModel | ||
58 | { | ||
59 | private: | ||
60 | |||
61 | // Private data | ||
62 | |||
63 | //- Minimum value of the abscissa to apply the model | ||
64 | dimensionedScalar minAbscissa_; | ||
65 | |||
66 | //- Maximum value of the abscissa to apply the model | ||
67 | dimensionedScalar maxAbscissa_; | ||
68 | |||
69 | public: | ||
70 | |||
71 | //- Runtime type information | ||
72 | TypeName("constant"); | ||
73 | |||
74 | |||
75 | // Constructors | ||
76 | |||
77 | //- Construct from components | ||
78 | constantGrowth(const dictionary& dict); | ||
79 | |||
80 | |||
81 | //- Destructor | ||
82 | virtual ~constantGrowth(); | ||
83 | |||
84 | |||
85 | // Member Functions | ||
86 | |||
87 | //- Growth model | ||
88 | virtual tmp<volScalarField> Kg | ||
89 | ( | ||
90 | const volScalarField& abscissa | ||
91 | ) const; | ||
92 | |||
93 | }; | ||
94 | |||
95 | |||
96 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
97 | |||
98 | } // End namespace growthModels | ||
99 | } // End namespace populationBalanceSubModels | ||
100 | } // End namespace Foam | ||
101 | |||
102 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
103 | |||
104 | #endif | ||
105 | |||
106 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/growthModels/growthModel/growthModel.C added (mode: 100644) (index 0000000..3cf48db) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2015 Matteo Icardi | ||
6 | \\/ M anipulation | | ||
7 | ------------------------------------------------------------------------------- | ||
8 | License | ||
9 | This file is derivative work 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 "growthModel.H" | ||
27 | |||
28 | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // | ||
29 | |||
30 | namespace Foam | ||
31 | { | ||
32 | namespace populationBalanceSubModels | ||
33 | { | ||
34 | defineTypeNameAndDebug(growthModel, 0); | ||
35 | |||
36 | defineRunTimeSelectionTable(growthModel, dictionary); | ||
37 | } | ||
38 | } | ||
39 | |||
40 | |||
41 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | ||
42 | |||
43 | Foam::populationBalanceSubModels::growthModel::growthModel | ||
44 | ( | ||
45 | const dictionary& dict | ||
46 | ) | ||
47 | : | ||
48 | dict_(dict), | ||
49 | Cg_ | ||
50 | ( | ||
51 | dict.lookupOrDefault | ||
52 | ( | ||
53 | "Cg", | ||
54 | dimensionedScalar("one", inv(dimTime), 1.0) | ||
55 | ) | ||
56 | ) | ||
57 | {} | ||
58 | |||
59 | |||
60 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | ||
61 | |||
62 | Foam::populationBalanceSubModels::growthModel::~growthModel() | ||
63 | {} | ||
64 | |||
65 | |||
66 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/growthModels/growthModel/growthModel.H added (mode: 100644) (index 0000000..e4f4e1b) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2015 Matteo Icardi | ||
6 | \\/ M anipulation | | ||
7 | ------------------------------------------------------------------------------- | ||
8 | License | ||
9 | This file is derivative work 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 | Class | ||
25 | Foam::populationBalanceSubModels::growthModel | ||
26 | |||
27 | Description | ||
28 | Abstract class for growth model. | ||
29 | |||
30 | SourceFiles | ||
31 | growthModel.C | ||
32 | |||
33 | \*---------------------------------------------------------------------------*/ | ||
34 | |||
35 | #ifndef growthModel_H | ||
36 | #define growthModel_H | ||
37 | |||
38 | #include "dictionary.H" | ||
39 | #include "volFields.H" | ||
40 | #include "dimensionedTypes.H" | ||
41 | #include "runTimeSelectionTables.H" | ||
42 | |||
43 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
44 | |||
45 | namespace Foam | ||
46 | { | ||
47 | namespace populationBalanceSubModels | ||
48 | { | ||
49 | |||
50 | /*---------------------------------------------------------------------------*\ | ||
51 | Class growthModel Declaration | ||
52 | \*---------------------------------------------------------------------------*/ | ||
53 | |||
54 | class growthModel | ||
55 | { | ||
56 | // Private member functions | ||
57 | |||
58 | //- Disallow default bitwise copy construct | ||
59 | growthModel(const growthModel&); | ||
60 | |||
61 | //- Disallow default bitwise assignment | ||
62 | void operator=(const growthModel&); | ||
63 | |||
64 | |||
65 | protected: | ||
66 | |||
67 | // Protected data | ||
68 | |||
69 | const dictionary& dict_; | ||
70 | |||
71 | //- Coefficient of aggregation kernel | ||
72 | const dimensionedScalar Cg_; | ||
73 | |||
74 | |||
75 | public: | ||
76 | |||
77 | //- Runtime type information | ||
78 | TypeName("growthModel"); | ||
79 | |||
80 | // Declare runtime constructor selection table | ||
81 | declareRunTimeSelectionTable | ||
82 | ( | ||
83 | autoPtr, | ||
84 | growthModel, | ||
85 | dictionary, | ||
86 | ( | ||
87 | const dictionary& dict | ||
88 | ), | ||
89 | (dict) | ||
90 | ); | ||
91 | |||
92 | |||
93 | // Constructors | ||
94 | |||
95 | //- Construct from components | ||
96 | growthModel(const dictionary& dict); | ||
97 | |||
98 | |||
99 | // Selectors | ||
100 | |||
101 | static autoPtr<growthModel> New | ||
102 | ( | ||
103 | const dictionary& dict | ||
104 | ); | ||
105 | |||
106 | |||
107 | //- Destructor | ||
108 | virtual ~growthModel(); | ||
109 | |||
110 | |||
111 | // Member Functions | ||
112 | |||
113 | //- Growth model | ||
114 | virtual tmp<volScalarField> Kg | ||
115 | ( | ||
116 | const volScalarField& abscissa | ||
117 | ) const = 0; | ||
118 | }; | ||
119 | |||
120 | |||
121 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
122 | |||
123 | } // End namespace populationBalanceSubModels | ||
124 | } // End namespace Foam | ||
125 | |||
126 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
127 | |||
128 | #endif | ||
129 | |||
130 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/growthModels/growthModel/newGrowthModel.C added (mode: 100644) (index 0000000..ba5d438) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2015 Matteo Icardi | ||
6 | \\/ M anipulation | | ||
7 | ------------------------------------------------------------------------------- | ||
8 | License | ||
9 | This file is derivative work 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 "growthModel.H" | ||
27 | |||
28 | // * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * // | ||
29 | |||
30 | Foam::autoPtr<Foam::populationBalanceSubModels::growthModel> | ||
31 | Foam::populationBalanceSubModels::growthModel::New | ||
32 | ( | ||
33 | const dictionary& dict | ||
34 | ) | ||
35 | { | ||
36 | word growthModelType(dict.lookup("growthModel")); | ||
37 | |||
38 | Info<< "Selecting growthModel " | ||
39 | << growthModelType << endl; | ||
40 | |||
41 | dictionaryConstructorTable::iterator cstrIter = | ||
42 | dictionaryConstructorTablePtr_->find(growthModelType); | ||
43 | |||
44 | if (cstrIter == dictionaryConstructorTablePtr_->end()) | ||
45 | { | ||
46 | FatalErrorInFunction | ||
47 | << "Unknown growthModelType type " | ||
48 | << growthModelType << endl << endl | ||
49 | << "Valid growthModelType types are :" << endl | ||
50 | << dictionaryConstructorTablePtr_->sortedToc() | ||
51 | << abort(FatalError); | ||
52 | } | ||
53 | |||
54 | return autoPtr<growthModel>(cstrIter()(dict)); | ||
55 | } | ||
56 | |||
57 | |||
58 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/nucleationModels/Miller/Miller.C added (mode: 100644) (index 0000000..e453fd8) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2016 Alberto Passalacqua | ||
6 | \\/ M anipulation | | ||
7 | ------------------------------------------------------------------------------- | ||
8 | License | ||
9 | This file is derivative work 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 "Miller.H" | ||
27 | #include "addToRunTimeSelectionTable.H" | ||
28 | #include "turbulentFluidThermoModel.H" | ||
29 | #include "fundamentalConstants.H" | ||
30 | |||
31 | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // | ||
32 | |||
33 | namespace Foam | ||
34 | { | ||
35 | namespace populationBalanceSubModels | ||
36 | { | ||
37 | namespace nucleationModels | ||
38 | { | ||
39 | defineTypeNameAndDebug(Miller, 0); | ||
40 | |||
41 | addToRunTimeSelectionTable | ||
42 | ( | ||
43 | nucleationModel, | ||
44 | Miller, | ||
45 | dictionary | ||
46 | ); | ||
47 | } | ||
48 | } | ||
49 | } | ||
50 | |||
51 | |||
52 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | ||
53 | |||
54 | Foam::populationBalanceSubModels::nucleationModels::Miller::Miller | ||
55 | ( | ||
56 | const dictionary& dict, | ||
57 | const fvMesh& mesh | ||
58 | ) | ||
59 | : | ||
60 | nucleationModel(dict, mesh), | ||
61 | MCarbon_(dict.lookup("MCarbon")), | ||
62 | nCarbonDimer_(dict.lookup("nCarbonDimer")), | ||
63 | nCarbonPAM_(dict.lookup("nCarbonPAM")), | ||
64 | rhoSoot_(dict.lookup("rhoSoot")), | ||
65 | pamConcentration_ | ||
66 | ( | ||
67 | IOobject | ||
68 | ( | ||
69 | "YPAM", | ||
70 | mesh_.time().timeName(), | ||
71 | mesh_, | ||
72 | IOobject::MUST_READ, | ||
73 | IOobject::AUTO_WRITE | ||
74 | ), | ||
75 | mesh | ||
76 | ) | ||
77 | {} | ||
78 | |||
79 | |||
80 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | ||
81 | |||
82 | Foam::populationBalanceSubModels::nucleationModels::Miller::~Miller() | ||
83 | {} | ||
84 | |||
85 | |||
86 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | ||
87 | |||
88 | Foam::tmp<Foam::volScalarField> | ||
89 | Foam::populationBalanceSubModels::nucleationModels::Miller | ||
90 | ::nucleationSource(const volUnivariateMoment& moment) const | ||
91 | { | ||
92 | const fluidThermo& flThermo = | ||
93 | mesh_.lookupObject<fluidThermo>(basicThermo::dictName); | ||
94 | |||
95 | dimensionedScalar abscissaNucleation = | ||
96 | 2.0*MCarbon_*nCarbonDimer_ | ||
97 | /(rhoSoot_*Foam::constant::physicoChemical::NA); | ||
98 | |||
99 | return 4.4*sqrt(Foam::constant::mathematical::pi | ||
100 | *Foam::constant::physicoChemical::k*flThermo.T() | ||
101 | *Foam::constant::physicoChemical::NA | ||
102 | /nCarbonPAM_*MCarbon_)*pow(6.0*nCarbonPAM_*MCarbon_ | ||
103 | /(Foam::constant::mathematical::pi*rhoSoot_ | ||
104 | *Foam::constant::physicoChemical::NA), 2.0/3.0) | ||
105 | *Foam::constant::physicoChemical::NA*sqr(pamConcentration_) | ||
106 | *pow(abscissaNucleation, moment.order()); | ||
107 | } | ||
108 | |||
109 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/nucleationModels/Miller/Miller.H added (mode: 100644) (index 0000000..a6afb35) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2016 Alberto Passalacqua | ||
6 | \\/ M anipulation | | ||
7 | ------------------------------------------------------------------------------- | ||
8 | License | ||
9 | This file is derivative work 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 | Class | ||
25 | Foam::populationBalanceSubModels::nucleationModels::Miller | ||
26 | |||
27 | Description | ||
28 | Miller nucleation model for soot formation. | ||
29 | |||
30 | SourceFiles | ||
31 | Miller.C | ||
32 | |||
33 | \*---------------------------------------------------------------------------*/ | ||
34 | |||
35 | #ifndef Miller_H | ||
36 | #define Miller_H | ||
37 | |||
38 | #include "nucleationModel.H" | ||
39 | |||
40 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
41 | |||
42 | namespace Foam | ||
43 | { | ||
44 | namespace populationBalanceSubModels | ||
45 | { | ||
46 | namespace nucleationModels | ||
47 | { | ||
48 | |||
49 | /*---------------------------------------------------------------------------*\ | ||
50 | Class Miller Declaration | ||
51 | \*---------------------------------------------------------------------------*/ | ||
52 | |||
53 | class Miller | ||
54 | : | ||
55 | public nucleationModel | ||
56 | { | ||
57 | private: | ||
58 | |||
59 | // Private data | ||
60 | |||
61 | //- Molecular mass of one carbon atom | ||
62 | dimensionedScalar MCarbon_; | ||
63 | |||
64 | //- Number of carbon atoms in dimer species | ||
65 | dimensionedScalar nCarbonDimer_; | ||
66 | |||
67 | //- Number of carbon atoms in PAM species | ||
68 | dimensionedScalar nCarbonPAM_; | ||
69 | |||
70 | //- Soot density | ||
71 | dimensionedScalar rhoSoot_; | ||
72 | |||
73 | //- PAM concentration field | ||
74 | volScalarField pamConcentration_; | ||
75 | |||
76 | |||
77 | public: | ||
78 | |||
79 | //- Runtime type information | ||
80 | TypeName("Miller"); | ||
81 | |||
82 | |||
83 | // Constructors | ||
84 | |||
85 | //- Construct from components | ||
86 | Miller | ||
87 | ( | ||
88 | const dictionary& dict, | ||
89 | const fvMesh& mesh | ||
90 | ); | ||
91 | |||
92 | |||
93 | //- Destructor | ||
94 | virtual ~Miller(); | ||
95 | |||
96 | |||
97 | // Member Functions | ||
98 | |||
99 | //- Growth model | ||
100 | virtual tmp<volScalarField> nucleationSource | ||
101 | ( | ||
102 | const volUnivariateMoment& moment | ||
103 | ) const; | ||
104 | }; | ||
105 | |||
106 | |||
107 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
108 | |||
109 | } // End namespace nucleationModels | ||
110 | } // End namespace populationBalanceSubModels | ||
111 | } // End namespace Foam | ||
112 | |||
113 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
114 | |||
115 | #endif | ||
116 | |||
117 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/nucleationModels/noNucleation/noNucleation.C added (mode: 100644) (index 0000000..33dfaf4) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2016 Alberto Passalacqua | ||
6 | \\/ M anipulation | | ||
7 | ------------------------------------------------------------------------------- | ||
8 | License | ||
9 | This file is derivative work 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 "noNucleation.H" | ||
27 | #include "addToRunTimeSelectionTable.H" | ||
28 | |||
29 | |||
30 | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // | ||
31 | |||
32 | namespace Foam | ||
33 | { | ||
34 | namespace populationBalanceSubModels | ||
35 | { | ||
36 | namespace nucleationModels | ||
37 | { | ||
38 | defineTypeNameAndDebug(noNucleation, 0); | ||
39 | |||
40 | addToRunTimeSelectionTable | ||
41 | ( | ||
42 | nucleationModel, | ||
43 | noNucleation, | ||
44 | dictionary | ||
45 | ); | ||
46 | } | ||
47 | } | ||
48 | } | ||
49 | |||
50 | |||
51 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | ||
52 | |||
53 | Foam::populationBalanceSubModels::nucleationModels::noNucleation::noNucleation | ||
54 | ( | ||
55 | const dictionary& dict, | ||
56 | const fvMesh& mesh | ||
57 | ) | ||
58 | : | ||
59 | nucleationModel(dict, mesh) | ||
60 | {} | ||
61 | |||
62 | |||
63 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | ||
64 | |||
65 | Foam::populationBalanceSubModels::nucleationModels::noNucleation::~noNucleation() | ||
66 | {} | ||
67 | |||
68 | |||
69 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | ||
70 | |||
71 | Foam::tmp<Foam::volScalarField> | ||
72 | Foam::populationBalanceSubModels::nucleationModels::noNucleation | ||
73 | ::nucleationSource(const volUnivariateMoment& moment) const | ||
74 | { | ||
75 | tmp<volScalarField> noNucl | ||
76 | ( | ||
77 | new volScalarField | ||
78 | ( | ||
79 | IOobject | ||
80 | ( | ||
81 | "noNucl", | ||
82 | moment.mesh().time().timeName(), | ||
83 | moment.mesh(), | ||
84 | IOobject::NO_READ, | ||
85 | IOobject::NO_WRITE, | ||
86 | false | ||
87 | ), | ||
88 | moment.mesh(), | ||
89 | dimensionedScalar("zero", moment.dimensions()/dimTime, 0.0) | ||
90 | ) | ||
91 | ); | ||
92 | |||
93 | return noNucl; | ||
94 | } | ||
95 | |||
96 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/nucleationModels/noNucleation/noNucleation.H added (mode: 100644) (index 0000000..9bb0132) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2016 Alberto Passalacqua | ||
6 | \\/ M anipulation | | ||
7 | ------------------------------------------------------------------------------- | ||
8 | License | ||
9 | This file is derivative work 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 | Class | ||
25 | Foam::populationBalanceSubModels::nucleationModels::noNucleation | ||
26 | |||
27 | Description | ||
28 | No nucleation model. | ||
29 | |||
30 | SourceFiles | ||
31 | noNucleation.C | ||
32 | |||
33 | \*---------------------------------------------------------------------------*/ | ||
34 | |||
35 | #ifndef noNucleation_H | ||
36 | #define noNucleation_H | ||
37 | |||
38 | #include "nucleationModel.H" | ||
39 | |||
40 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
41 | |||
42 | namespace Foam | ||
43 | { | ||
44 | namespace populationBalanceSubModels | ||
45 | { | ||
46 | namespace nucleationModels | ||
47 | { | ||
48 | |||
49 | /*---------------------------------------------------------------------------*\ | ||
50 | Class noNucleation Declaration | ||
51 | \*---------------------------------------------------------------------------*/ | ||
52 | |||
53 | class noNucleation | ||
54 | : | ||
55 | public nucleationModel | ||
56 | { | ||
57 | public: | ||
58 | |||
59 | //- Runtime type information | ||
60 | TypeName("none"); | ||
61 | |||
62 | |||
63 | // Constructors | ||
64 | |||
65 | //- Construct from components | ||
66 | noNucleation | ||
67 | ( | ||
68 | const dictionary& dict, | ||
69 | const fvMesh& mesh | ||
70 | ); | ||
71 | |||
72 | |||
73 | //- Destructor | ||
74 | virtual ~noNucleation(); | ||
75 | |||
76 | |||
77 | // Member Functions | ||
78 | |||
79 | //- Growth model | ||
80 | virtual tmp<volScalarField> nucleationSource | ||
81 | ( | ||
82 | const volUnivariateMoment& moment | ||
83 | ) const; | ||
84 | }; | ||
85 | |||
86 | |||
87 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
88 | |||
89 | } // End namespace nucleationModels | ||
90 | } // End namespace populationBalanceSubModels | ||
91 | } // End namespace Foam | ||
92 | |||
93 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
94 | |||
95 | #endif | ||
96 | |||
97 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/nucleationModels/nucleationModel/newNucleationModel.C added (mode: 100644) (index 0000000..08a1796) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2016 Alberto Passalacqua | ||
6 | \\/ M anipulation | | ||
7 | ------------------------------------------------------------------------------- | ||
8 | License | ||
9 | This file is derivative work 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 "nucleationModel.H" | ||
27 | |||
28 | // * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * // | ||
29 | |||
30 | Foam::autoPtr<Foam::populationBalanceSubModels::nucleationModel> | ||
31 | Foam::populationBalanceSubModels::nucleationModel::New | ||
32 | ( | ||
33 | const dictionary& dict, | ||
34 | const fvMesh& mesh | ||
35 | ) | ||
36 | { | ||
37 | word nucleationModelType(dict.lookup("nucleationModel")); | ||
38 | |||
39 | Info<< "Selecting nucleationModel " | ||
40 | << nucleationModelType << endl; | ||
41 | |||
42 | dictionaryConstructorTable::iterator cstrIter = | ||
43 | dictionaryConstructorTablePtr_->find(nucleationModelType); | ||
44 | |||
45 | if (cstrIter == dictionaryConstructorTablePtr_->end()) | ||
46 | { | ||
47 | FatalErrorInFunction | ||
48 | << "Unknown nucleationModelType type " | ||
49 | << nucleationModelType << endl << endl | ||
50 | << "Valid nucleationModelType types are :" << endl | ||
51 | << dictionaryConstructorTablePtr_->sortedToc() | ||
52 | << abort(FatalError); | ||
53 | } | ||
54 | |||
55 | return autoPtr<nucleationModel>(cstrIter()(dict, mesh)); | ||
56 | } | ||
57 | |||
58 | |||
59 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/nucleationModels/nucleationModel/nucleationModel.C added (mode: 100644) (index 0000000..38f9456) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2016 Alberto Passalacqua | ||
6 | \\/ M anipulation | | ||
7 | ------------------------------------------------------------------------------- | ||
8 | License | ||
9 | This file is derivative work 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 "nucleationModel.H" | ||
27 | |||
28 | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // | ||
29 | |||
30 | namespace Foam | ||
31 | { | ||
32 | namespace populationBalanceSubModels | ||
33 | { | ||
34 | defineTypeNameAndDebug(nucleationModel, 0); | ||
35 | |||
36 | defineRunTimeSelectionTable(nucleationModel, dictionary); | ||
37 | } | ||
38 | } | ||
39 | |||
40 | |||
41 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | ||
42 | |||
43 | Foam::populationBalanceSubModels::nucleationModel::nucleationModel | ||
44 | ( | ||
45 | const dictionary& dict, | ||
46 | const fvMesh& mesh | ||
47 | ) | ||
48 | : | ||
49 | dict_(dict), | ||
50 | mesh_(mesh) | ||
51 | {} | ||
52 | |||
53 | |||
54 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | ||
55 | |||
56 | Foam::populationBalanceSubModels::nucleationModel::~nucleationModel() | ||
57 | {} | ||
58 | |||
59 | |||
60 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/nucleationModels/nucleationModel/nucleationModel.H added (mode: 100644) (index 0000000..e6a90d3) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2016 Alberto Passalacqua | ||
6 | \\/ M anipulation | | ||
7 | ------------------------------------------------------------------------------- | ||
8 | License | ||
9 | This file is derivative work 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 | Class | ||
25 | Foam::populationBalanceSubModels::nucleationModel | ||
26 | |||
27 | Description | ||
28 | Abstract class for nucleation model. | ||
29 | |||
30 | SourceFiles | ||
31 | nucleationModel.C | ||
32 | |||
33 | \*---------------------------------------------------------------------------*/ | ||
34 | |||
35 | #ifndef nucleationModel_H | ||
36 | #define nucleationModel_H | ||
37 | |||
38 | #include "dictionary.H" | ||
39 | #include "volFields.H" | ||
40 | #include "moments.H" | ||
41 | #include "dimensionedTypes.H" | ||
42 | #include "runTimeSelectionTables.H" | ||
43 | |||
44 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
45 | |||
46 | namespace Foam | ||
47 | { | ||
48 | namespace populationBalanceSubModels | ||
49 | { | ||
50 | |||
51 | /*---------------------------------------------------------------------------*\ | ||
52 | Class nucleationModel Declaration | ||
53 | \*---------------------------------------------------------------------------*/ | ||
54 | |||
55 | class nucleationModel | ||
56 | { | ||
57 | // Private member functions | ||
58 | |||
59 | //- Disallow default bitwise copy construct | ||
60 | nucleationModel(const nucleationModel&); | ||
61 | |||
62 | //- Disallow default bitwise assignment | ||
63 | void operator=(const nucleationModel&); | ||
64 | |||
65 | |||
66 | protected: | ||
67 | |||
68 | // Protected data | ||
69 | |||
70 | const dictionary& dict_; | ||
71 | |||
72 | //- Reference to mesh | ||
73 | const fvMesh& mesh_; | ||
74 | |||
75 | |||
76 | public: | ||
77 | |||
78 | //- Runtime type information | ||
79 | TypeName("nucleationModel"); | ||
80 | |||
81 | // Declare runtime constructor selection table | ||
82 | declareRunTimeSelectionTable | ||
83 | ( | ||
84 | autoPtr, | ||
85 | nucleationModel, | ||
86 | dictionary, | ||
87 | ( | ||
88 | const dictionary& dict, | ||
89 | const fvMesh& mesh | ||
90 | ), | ||
91 | (dict, mesh) | ||
92 | ); | ||
93 | |||
94 | |||
95 | // Constructors | ||
96 | |||
97 | //- Construct from components | ||
98 | nucleationModel | ||
99 | ( | ||
100 | const dictionary& dict, | ||
101 | const fvMesh& mesh | ||
102 | ); | ||
103 | |||
104 | |||
105 | // Selectors | ||
106 | |||
107 | static autoPtr<nucleationModel> New | ||
108 | ( | ||
109 | const dictionary& dict, | ||
110 | const fvMesh& mesh | ||
111 | ); | ||
112 | |||
113 | |||
114 | //- Destructor | ||
115 | virtual ~nucleationModel(); | ||
116 | |||
117 | |||
118 | // Member Functions | ||
119 | |||
120 | //- Nucleation rate | ||
121 | virtual tmp<volScalarField> nucleationSource | ||
122 | ( | ||
123 | const volUnivariateMoment& moment | ||
124 | ) const = 0; | ||
125 | }; | ||
126 | |||
127 | |||
128 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
129 | |||
130 | } // End namespace populationBalanceSubModels | ||
131 | } // End namespace Foam | ||
132 | |||
133 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
134 | |||
135 | #endif | ||
136 | |||
137 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/univariatePopulationBalance/univariatePopulationBalance.C added (mode: 100644) (index 0000000..3d9880c) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2015-2016 Alberto Passalacqua | ||
6 | \\/ M anipulation | | ||
7 | ------------------------------------------------------------------------------- | ||
8 | License | ||
9 | This file is derivative work 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 "univariatePopulationBalance.H" | ||
27 | #include "addToRunTimeSelectionTable.H" | ||
28 | |||
29 | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // | ||
30 | |||
31 | namespace Foam | ||
32 | { | ||
33 | namespace PDFTransportModels | ||
34 | { | ||
35 | namespace populationBalanceModels | ||
36 | { | ||
37 | defineTypeNameAndDebug(univariatePopulationBalance, 0); | ||
38 | addToRunTimeSelectionTable | ||
39 | ( | ||
40 | populationBalanceModel, | ||
41 | univariatePopulationBalance, | ||
42 | dictionary | ||
43 | ); | ||
44 | } | ||
45 | } | ||
46 | } | ||
47 | |||
48 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | ||
49 | |||
50 | Foam::PDFTransportModels::populationBalanceModels::univariatePopulationBalance | ||
51 | ::univariatePopulationBalance | ||
52 | ( | ||
53 | const word& name, | ||
54 | const dictionary& dict, | ||
55 | const volVectorField& U, | ||
56 | const surfaceScalarField& phi | ||
57 | ) | ||
58 | : | ||
59 | univariatePDFTransportModel(name, dict, U.mesh(), U, phi, "RPlus"), | ||
60 | populationBalanceModel(name, dict, U, phi), | ||
61 | name_(name), | ||
62 | aggregation_(dict.lookup("aggregation")), | ||
63 | breakup_(dict.lookup("breakup")), | ||
64 | growth_(dict.lookup("growth")), | ||
65 | aggregationKernel_ | ||
66 | ( | ||
67 | Foam::populationBalanceSubModels::aggregationKernel::New | ||
68 | ( | ||
69 | dict.subDict("aggregationKernel") | ||
70 | ) | ||
71 | ), | ||
72 | breakupKernel_ | ||
73 | ( | ||
74 | Foam::populationBalanceSubModels::breakupKernel::New | ||
75 | ( | ||
76 | dict.subDict("breakupKernel") | ||
77 | ) | ||
78 | ), | ||
79 | daughterDistribution_ | ||
80 | ( | ||
81 | Foam::populationBalanceSubModels::daughterDistribution::New | ||
82 | ( | ||
83 | dict.subDict("daughterDistribution") | ||
84 | ) | ||
85 | ), | ||
86 | growthModel_ | ||
87 | ( | ||
88 | Foam::populationBalanceSubModels::growthModel::New | ||
89 | ( | ||
90 | dict.subDict("growthModel") | ||
91 | ) | ||
92 | ), | ||
93 | diffusionModel_ | ||
94 | ( | ||
95 | Foam::populationBalanceSubModels::diffusionModel::New | ||
96 | ( | ||
97 | dict.subDict("diffusionModel") | ||
98 | ) | ||
99 | ), | ||
100 | nucleationModel_ | ||
101 | ( | ||
102 | Foam::populationBalanceSubModels::nucleationModel::New | ||
103 | ( | ||
104 | dict.subDict("nucleationModel"), | ||
105 | U.mesh() | ||
106 | ) | ||
107 | ) | ||
108 | {} | ||
109 | |||
110 | |||
111 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | ||
112 | |||
113 | Foam::PDFTransportModels::populationBalanceModels::univariatePopulationBalance | ||
114 | ::~univariatePopulationBalance() | ||
115 | {} | ||
116 | |||
117 | |||
118 | // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // | ||
119 | |||
120 | Foam::tmp<Foam::volScalarField> | ||
121 | Foam::PDFTransportModels::populationBalanceModels::univariatePopulationBalance | ||
122 | ::aggregationSource | ||
123 | ( | ||
124 | const volUnivariateMoment& moment | ||
125 | ) | ||
126 | { | ||
127 | tmp<volScalarField> aSource | ||
128 | ( | ||
129 | new volScalarField | ||
130 | ( | ||
131 | IOobject | ||
132 | ( | ||
133 | "aSource", | ||
134 | U_.mesh().time().timeName(), | ||
135 | U_.mesh(), | ||
136 | IOobject::NO_READ, | ||
137 | IOobject::NO_WRITE, | ||
138 | false | ||
139 | ), | ||
140 | U_.mesh(), | ||
141 | dimensionedScalar("zero", dimless, 0.0) | ||
142 | ) | ||
143 | ); | ||
144 | |||
145 | if (!aggregation_) | ||
146 | { | ||
147 | aSource.ref().dimensions().reset(moment.dimensions()/dimTime); | ||
148 | |||
149 | return aSource; | ||
150 | } | ||
151 | |||
152 | label order = moment.order(); | ||
153 | |||
154 | volScalarField& aggregationSource = aSource.ref(); | ||
155 | |||
156 | forAll(quadrature_.nodes(), pNode1i) | ||
157 | { | ||
158 | const extendedVolScalarNode& node1 = quadrature_.nodes()[pNode1i]; | ||
159 | |||
160 | const volScalarField& pWeight1 = node1.primaryWeight(); | ||
161 | |||
162 | forAll(node1.secondaryWeights(), sNode1i) | ||
163 | { | ||
164 | const volScalarField& sWeight1 = node1.secondaryWeights()[sNode1i]; | ||
165 | |||
166 | const volScalarField& sAbscissa1 | ||
167 | = node1.secondaryAbscissae()[sNode1i]; | ||
168 | |||
169 | forAll(quadrature_.nodes(), pNode2i) | ||
170 | { | ||
171 | const extendedVolScalarNode& node2 = quadrature_.nodes()[pNode2i]; | ||
172 | |||
173 | const volScalarField& pWeight2 = node2.primaryWeight(); | ||
174 | |||
175 | forAll(node2.secondaryWeights(), sNode2i) | ||
176 | { | ||
177 | const volScalarField& sWeight2 | ||
178 | = node2.secondaryWeights()[sNode2i]; | ||
179 | |||
180 | const volScalarField& sAbscissa2 | ||
181 | = node2.secondaryAbscissae()[sNode2i]; | ||
182 | |||
183 | tmp<volScalarField> aggInnerSum = | ||
184 | pWeight1*sWeight1* | ||
185 | ( | ||
186 | pWeight2*sWeight2* | ||
187 | ( | ||
188 | 0.5*pow // Birth | ||
189 | ( | ||
190 | pow3(sAbscissa1) + pow3(sAbscissa2), | ||
191 | order/3.0 | ||
192 | ) | ||
193 | - pow(sAbscissa1, order) | ||
194 | )*aggregationKernel_->Ka(sAbscissa1, sAbscissa2) | ||
195 | ); | ||
196 | |||
197 | aggregationSource.dimensions().reset | ||
198 | ( | ||
199 | aggInnerSum().dimensions() | ||
200 | ); | ||
201 | |||
202 | aggregationSource == aggregationSource + aggInnerSum(); | ||
203 | } | ||
204 | } | ||
205 | } | ||
206 | } | ||
207 | |||
208 | return aSource; | ||
209 | } | ||
210 | |||
211 | Foam::tmp<Foam::volScalarField> | ||
212 | Foam::PDFTransportModels::populationBalanceModels::univariatePopulationBalance | ||
213 | ::breakupSource | ||
214 | ( | ||
215 | const volUnivariateMoment& moment | ||
216 | ) | ||
217 | { | ||
218 | tmp<volScalarField> bSource | ||
219 | ( | ||
220 | new volScalarField | ||
221 | ( | ||
222 | IOobject | ||
223 | ( | ||
224 | "bSource", | ||
225 | U_.mesh().time().timeName(), | ||
226 | U_.mesh(), | ||
227 | IOobject::NO_READ, | ||
228 | IOobject::NO_WRITE, | ||
229 | false | ||
230 | ), | ||
231 | U_.mesh(), | ||
232 | dimensionedScalar("zero", dimless, 0.0) | ||
233 | ) | ||
234 | ); | ||
235 | |||
236 | if (!breakup_) | ||
237 | { | ||
238 | bSource.ref().dimensions().reset(moment.dimensions()/dimTime); | ||
239 | |||
240 | return bSource; | ||
241 | } | ||
242 | |||
243 | label order = moment.order(); | ||
244 | |||
245 | volScalarField& breakupSource = bSource.ref(); | ||
246 | |||
247 | forAll(quadrature_.nodes(), pNodeI) | ||
248 | { | ||
249 | const extendedVolScalarNode& node = quadrature_.nodes()[pNodeI]; | ||
250 | |||
251 | forAll(node.secondaryWeights(), sNodei) | ||
252 | { | ||
253 | tmp<volScalarField> bSrc = node.primaryWeight() | ||
254 | *node.secondaryWeights()[sNodei] | ||
255 | *breakupKernel_->Kb(node.secondaryAbscissae()[sNodei]) | ||
256 | *( | ||
257 | daughterDistribution_->mD //Birth | ||
258 | ( | ||
259 | order, | ||
260 | node.secondaryAbscissae()[sNodei] | ||
261 | ) | ||
262 | - pow(node.secondaryAbscissae()[sNodei], order) //Death | ||
263 | ); | ||
264 | |||
265 | breakupSource.dimensions().reset(bSrc().dimensions()); | ||
266 | breakupSource == breakupSource + bSrc; | ||
267 | } | ||
268 | } | ||
269 | |||
270 | return bSource; | ||
271 | } | ||
272 | |||
273 | Foam::tmp<fvScalarMatrix> Foam::PDFTransportModels::populationBalanceModels | ||
274 | ::univariatePopulationBalance::momentDiffusion | ||
275 | ( | ||
276 | const volUnivariateMoment& moment | ||
277 | ) | ||
278 | { | ||
279 | return diffusionModel_->momentDiff(moment); | ||
280 | } | ||
281 | |||
282 | Foam::tmp<Foam::volScalarField> | ||
283 | Foam::PDFTransportModels::populationBalanceModels::univariatePopulationBalance | ||
284 | ::phaseSpaceConvection | ||
285 | ( | ||
286 | const volUnivariateMoment& moment | ||
287 | ) | ||
288 | { | ||
289 | tmp<volScalarField> gSource | ||
290 | ( | ||
291 | new volScalarField | ||
292 | ( | ||
293 | IOobject | ||
294 | ( | ||
295 | "gSource", | ||
296 | U_.mesh().time().timeName(), | ||
297 | U_.mesh(), | ||
298 | IOobject::NO_READ, | ||
299 | IOobject::NO_WRITE, | ||
300 | false | ||
301 | ), | ||
302 | U_.mesh(), | ||
303 | dimensionedScalar("zero", dimless, 0.0) | ||
304 | ) | ||
305 | ); | ||
306 | |||
307 | if (!growth_) | ||
308 | { | ||
309 | gSource.ref().dimensions().reset(moment.dimensions()/dimTime); | ||
310 | |||
311 | return gSource; | ||
312 | } | ||
313 | |||
314 | label order = moment.order(); | ||
315 | |||
316 | if (order < 1) | ||
317 | { | ||
318 | gSource.ref().dimensions().reset(moment.dimensions()/dimTime); | ||
319 | |||
320 | return gSource; | ||
321 | } | ||
322 | |||
323 | volScalarField& growthSource = gSource.ref(); | ||
324 | |||
325 | forAll(quadrature_.nodes(), pNodeI) | ||
326 | { | ||
327 | const extendedVolScalarNode& node = quadrature_.nodes()[pNodeI]; | ||
328 | |||
329 | forAll(node.secondaryWeights(), sNodei) | ||
330 | { | ||
331 | tmp<volScalarField> gSrc = node.primaryWeight() | ||
332 | *node.secondaryWeights()[sNodei] | ||
333 | *growthModel_->Kg(node.secondaryAbscissae()[sNodei]) | ||
334 | *order*pow(node.secondaryAbscissae()[sNodei],order-1); | ||
335 | |||
336 | growthSource.dimensions().reset(gSrc().dimensions()); | ||
337 | growthSource == growthSource + gSrc; | ||
338 | } | ||
339 | } | ||
340 | |||
341 | return gSource; | ||
342 | } | ||
343 | |||
344 | Foam::tmp<Foam::fvScalarMatrix> | ||
345 | Foam::PDFTransportModels::populationBalanceModels::univariatePopulationBalance | ||
346 | ::momentSource | ||
347 | ( | ||
348 | const volUnivariateMoment& moment | ||
349 | ) | ||
350 | { | ||
351 | tmp<fvScalarMatrix> mSource | ||
352 | ( | ||
353 | new fvScalarMatrix | ||
354 | ( | ||
355 | moment, | ||
356 | moment.dimensions()*dimVol/dimTime | ||
357 | ) | ||
358 | ); | ||
359 | |||
360 | mSource.ref() += | ||
361 | aggregationSource(moment) + breakupSource(moment) | ||
362 | + nucleationModel_->nucleationSource(moment); | ||
363 | |||
364 | return mSource; | ||
365 | } | ||
366 | |||
367 | void Foam::PDFTransportModels::populationBalanceModels | ||
368 | ::univariatePopulationBalance::solve | ||
369 | () | ||
370 | { | ||
371 | univariatePDFTransportModel::solve(); | ||
372 | } | ||
373 | |||
374 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/univariatePopulationBalance/univariatePopulationBalance.H added (mode: 100644) (index 0000000..75eff45) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2015-2016 Alberto Passalacqua | ||
6 | \\/ M anipulation | | ||
7 | ------------------------------------------------------------------------------- | ||
8 | License | ||
9 | This file is derivative work 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 | Class | ||
25 | Foam::populationBalanceModels::univariatePopulationBalance | ||
26 | |||
27 | Description | ||
28 | Solve a univariate population balance equation with the extended quadrature | ||
29 | method of moments. | ||
30 | |||
31 | SourceFiles | ||
32 | univariatePopulationBalance.C | ||
33 | |||
34 | \*---------------------------------------------------------------------------*/ | ||
35 | |||
36 | #ifndef univariatePopulationBalance_H | ||
37 | #define univariatePopulationBalance_H | ||
38 | |||
39 | #include "univariatePDFTransportModel.H" | ||
40 | #include "populationBalanceModel.H" | ||
41 | #include "aggregationKernel.H" | ||
42 | #include "breakupKernel.H" | ||
43 | #include "daughterDistribution.H" | ||
44 | #include "growthModel.H" | ||
45 | #include "diffusionModel.H" | ||
46 | #include "nucleationModel.H" | ||
47 | |||
48 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
49 | |||
50 | namespace Foam | ||
51 | { | ||
52 | namespace PDFTransportModels | ||
53 | { | ||
54 | namespace populationBalanceModels | ||
55 | { | ||
56 | |||
57 | /*---------------------------------------------------------------------------*\ | ||
58 | Class univariatePopulationBalance Declaration | ||
59 | \*---------------------------------------------------------------------------*/ | ||
60 | |||
61 | class univariatePopulationBalance | ||
62 | : | ||
63 | public univariatePDFTransportModel, public populationBalanceModel | ||
64 | { | ||
65 | // Private data | ||
66 | |||
67 | //- Name of the univariatePopulationBalance | ||
68 | const word name_; | ||
69 | |||
70 | //- Switch indicating the status of the aggregation model | ||
71 | Switch aggregation_; | ||
72 | |||
73 | //- Switch indicating the status of the breakup model | ||
74 | Switch breakup_; | ||
75 | |||
76 | //- Switch indicating the status of the growth model | ||
77 | Switch growth_; | ||
78 | |||
79 | //- Aggregation kernel model | ||
80 | autoPtr | ||
81 | < | ||
82 | Foam::populationBalanceSubModels::aggregationKernel | ||
83 | > aggregationKernel_; | ||
84 | |||
85 | //- Breakup kernel model | ||
86 | autoPtr | ||
87 | < | ||
88 | Foam::populationBalanceSubModels::breakupKernel | ||
89 | > breakupKernel_; | ||
90 | |||
91 | //- Daughter distribution function | ||
92 | autoPtr | ||
93 | < | ||
94 | Foam::populationBalanceSubModels::daughterDistribution | ||
95 | > daughterDistribution_; | ||
96 | |||
97 | //- Growth model function | ||
98 | autoPtr | ||
99 | < | ||
100 | Foam::populationBalanceSubModels::growthModel | ||
101 | > growthModel_; | ||
102 | |||
103 | //- Diffusion model | ||
104 | autoPtr | ||
105 | < | ||
106 | Foam::populationBalanceSubModels::diffusionModel | ||
107 | > diffusionModel_; | ||
108 | |||
109 | autoPtr | ||
110 | < | ||
111 | Foam::populationBalanceSubModels::nucleationModel | ||
112 | > nucleationModel_; | ||
113 | |||
114 | // Private member functions | ||
115 | |||
116 | //- Calculate aggregation source terms | ||
117 | tmp<volScalarField> aggregationSource | ||
118 | ( | ||
119 | const volUnivariateMoment& moment | ||
120 | ); | ||
121 | |||
122 | //- Calculate Breakup source term | ||
123 | tmp<volScalarField> breakupSource(const volUnivariateMoment& moment); | ||
124 | |||
125 | //- Diffusion term | ||
126 | virtual tmp<fvScalarMatrix> momentDiffusion | ||
127 | ( | ||
128 | const volUnivariateMoment& moment | ||
129 | ); | ||
130 | |||
131 | //- Convect moments in phase space | ||
132 | virtual tmp<volScalarField> phaseSpaceConvection | ||
133 | ( | ||
134 | const volUnivariateMoment& moment | ||
135 | ); | ||
136 | |||
137 | //- Calculate source terms | ||
138 | virtual tmp<fvScalarMatrix> momentSource | ||
139 | ( | ||
140 | const volUnivariateMoment& moment | ||
141 | ); | ||
142 | |||
143 | |||
144 | public: | ||
145 | |||
146 | //- Runtime type information | ||
147 | TypeName("univariate"); | ||
148 | |||
149 | |||
150 | // Constructors | ||
151 | |||
152 | //- Construct from components | ||
153 | univariatePopulationBalance | ||
154 | ( | ||
155 | const word& name, | ||
156 | const dictionary& dict, | ||
157 | const volVectorField& U, | ||
158 | const surfaceScalarField& phi | ||
159 | ); | ||
160 | |||
161 | |||
162 | //- Destructor | ||
163 | virtual ~univariatePopulationBalance(); | ||
164 | |||
165 | // Member Functions | ||
166 | |||
167 | //- Solve population balance equation | ||
168 | void solve(); | ||
169 | }; | ||
170 | |||
171 | |||
172 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
173 | |||
174 | } // End namespace populationBalanceModels | ||
175 | } // End namespace univariatePDFTransportModel | ||
176 | } // End namespace Foam | ||
177 | |||
178 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
179 | |||
180 | #endif | ||
181 | |||
182 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/quadratureApproximation/Make/files added (mode: 100644) (index 0000000..655c0ad) | |||
1 | univariateQuadratureApproximation/univariateQuadratureApproximation.C | ||
2 | |||
3 | LIB = $(FOAM_USER_LIBBIN)/libquadratureApproximation |
File multiphaseEulerPbeFoam/quadratureMethods/quadratureApproximation/Make/options added (mode: 100644) (index 0000000..de2f4fa) | |||
1 | EXE_INC = \ | ||
2 | -I$(LIB_SRC)/finiteVolume/lnInclude \ | ||
3 | -I$(LIB_SRC)/meshTools/lnInclude \ | ||
4 | -I../univariateMomentSet/lnInclude \ | ||
5 | -I../extentedMomentInversion/lnInclude \ | ||
6 | -I../quadratureNode \ | ||
7 | -I../moments | ||
8 | |||
9 | LIB_LIBS = \ | ||
10 | -lfiniteVolume \ | ||
11 | -lmeshTools \ | ||
12 | -L$(FOAM_USER_LIBBIN) \ | ||
13 | -lmomentSet \ | ||
14 | -lextendedMomentInversion |
File multiphaseEulerPbeFoam/quadratureMethods/quadratureApproximation/univariateQuadratureApproximation/univariateQuadratureApproximation.C added (mode: 100644) (index 0000000..dd26d2b) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2015-2016 Alberto Passalacqua | ||
6 | \\/ M anipulation | | ||
7 | ------------------------------------------------------------------------------- | ||
8 | License | ||
9 | This file is derivative work 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 "univariateQuadratureApproximation.H" | ||
27 | |||
28 | // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // | ||
29 | |||
30 | |||
31 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | ||
32 | |||
33 | Foam::univariateQuadratureApproximation::univariateQuadratureApproximation | ||
34 | ( | ||
35 | const word& name, | ||
36 | const fvMesh& mesh, | ||
37 | const word& support | ||
38 | ) | ||
39 | : | ||
40 | IOdictionary | ||
41 | ( | ||
42 | IOobject | ||
43 | ( | ||
44 | IOobject::groupName("quadratureProperties", name), | ||
45 | mesh.time().constant(), | ||
46 | mesh, | ||
47 | IOobject::MUST_READ, | ||
48 | IOobject::NO_WRITE | ||
49 | ) | ||
50 | ), | ||
51 | name_(name), | ||
52 | mesh_(mesh), | ||
53 | nodes_(), | ||
54 | nodesRadau_(), | ||
55 | moments_(name_, *this, mesh_, nodes_), | ||
56 | nPrimaryNodes_(0), | ||
57 | nSecondaryNodes_(0), | ||
58 | nNodesRadau_(0), | ||
59 | nodesNei_(), | ||
60 | nodesOwn_(), | ||
61 | nDimensions_(1), | ||
62 | nMoments_(moments_.size()), | ||
63 | momentsNei_ | ||
64 | ( | ||
65 | name_, nMoments_, nodesNei_, nDimensions_, moments_.momentMap() | ||
66 | ), | ||
67 | momentsOwn_ | ||
68 | ( | ||
69 | name_, nMoments_, nodesOwn_, nDimensions_, moments_.momentMap() | ||
70 | ), | ||
71 | momentInverter_(), | ||
72 | support_(support) | ||
73 | { | ||
74 | // Allocating nodes | ||
75 | nodes_ = autoPtr<PtrList<extendedVolScalarNode>> | ||
76 | ( | ||
77 | new PtrList<extendedVolScalarNode> | ||
78 | ( | ||
79 | lookup("nodes"), | ||
80 | Foam::extendedVolScalarNode::iNew | ||
81 | ( | ||
82 | name_, | ||
83 | mesh_, | ||
84 | moments_[0].dimensions(), | ||
85 | moments_[1].dimensions()/moments_[0].dimensions(), | ||
86 | moments_[0].boundaryField().types() | ||
87 | ) | ||
88 | ) | ||
89 | ); | ||
90 | |||
91 | nPrimaryNodes_ = nodes_().size(); | ||
92 | nSecondaryNodes_ = nodes_()[0].nSecondaryNodes(); | ||
93 | |||
94 | if (nMoments_ != 2*nPrimaryNodes_ + 1) | ||
95 | { | ||
96 | FatalErrorInFunction | ||
97 | << "Number of moments from dictionary different from number" << nl | ||
98 | << " of moments calculated from primary quadrature nodes." | ||
99 | << abort(FatalError); | ||
100 | } | ||
101 | |||
102 | nNodesRadau_ = nPrimaryNodes_ + 1; | ||
103 | |||
104 | nodesRadau_ = autoPtr<PtrList<basicVolScalarNode>> | ||
105 | ( | ||
106 | new PtrList<basicVolScalarNode>(nNodesRadau_) | ||
107 | ); | ||
108 | |||
109 | nodesNei_ = autoPtr<PtrList<basicSurfaceScalarNode>> | ||
110 | ( | ||
111 | new PtrList<basicSurfaceScalarNode>(nNodesRadau_) | ||
112 | ); | ||
113 | |||
114 | nodesOwn_ = autoPtr<PtrList<basicSurfaceScalarNode>> | ||
115 | ( | ||
116 | new PtrList<basicSurfaceScalarNode>(nNodesRadau_) | ||
117 | ); | ||
118 | |||
119 | PtrList<basicVolScalarNode>& nodesRadau = nodesRadau_(); | ||
120 | PtrList<basicSurfaceScalarNode>& nodesNei = nodesNei_(); | ||
121 | PtrList<basicSurfaceScalarNode>& nodesOwn = nodesOwn_(); | ||
122 | |||
123 | // Populating Radau and interpolated nodes | ||
124 | forAll(nodesRadau, rNodei) | ||
125 | { | ||
126 | nodesRadau.set | ||
127 | ( | ||
128 | rNodei, | ||
129 | new basicVolScalarNode | ||
130 | ( | ||
131 | "nodeRadau" + Foam::name(rNodei), | ||
132 | name_, | ||
133 | mesh_, | ||
134 | moments_[0].dimensions(), | ||
135 | moments_[1].dimensions()/moments_[0].dimensions() | ||
136 | ) | ||
137 | ); | ||
138 | |||
139 | nodesNei.set | ||
140 | ( | ||
141 | rNodei, | ||
142 | new basicSurfaceScalarNode | ||
143 | ( | ||
144 | "nodeRadau" + Foam::name(rNodei) + "Nei", | ||
145 | name_, | ||
146 | mesh_, | ||
147 | moments_[0].dimensions(), | ||
148 | moments_[1].dimensions()/moments_[0].dimensions() | ||
149 | ) | ||
150 | ); | ||
151 | |||
152 | nodesOwn.set | ||
153 | ( | ||
154 | rNodei, | ||
155 | new basicSurfaceScalarNode | ||
156 | ( | ||
157 | "nodeRadau" + Foam::name(rNodei) + "Own", | ||
158 | name_, | ||
159 | mesh_, | ||
160 | moments_[0].dimensions(), | ||
161 | moments_[1].dimensions()/moments_[0].dimensions() | ||
162 | ) | ||
163 | ); | ||
164 | } | ||
165 | |||
166 | // Setting face values of moments | ||
167 | forAll(momentsNei_, momenti) | ||
168 | { | ||
169 | momentsNei_.set | ||
170 | ( | ||
171 | momenti, | ||
172 | new Foam::basicSurfaceUnivariateMoment | ||
173 | ( | ||
174 | name_, | ||
175 | moments_[momenti].cmptOrders(), | ||
176 | nodesNei_, | ||
177 | fvc::interpolate(moments_[momenti]) | ||
178 | ) | ||
179 | ); | ||
180 | |||
181 | momentsOwn_.set | ||
182 | ( | ||
183 | momenti, | ||
184 | new Foam::basicSurfaceUnivariateMoment | ||
185 | ( | ||
186 | name_, | ||
187 | moments_[momenti].cmptOrders(), | ||
188 | nodesOwn_, | ||
189 | fvc::interpolate(moments_[momenti]) | ||
190 | ) | ||
191 | ); | ||
192 | } | ||
193 | |||
194 | momentInverter_ = autoPtr<Foam::extendedMomentInversion> | ||
195 | ( | ||
196 | Foam::extendedMomentInversion::New | ||
197 | ( | ||
198 | subDict("extendedMomentInversionCoeff"), | ||
199 | nMoments_, | ||
200 | nSecondaryNodes_ | ||
201 | ) | ||
202 | ); | ||
203 | |||
204 | updateQuadrature(); | ||
205 | interpolateNodes(); | ||
206 | updateBoundaryQuadrature(); | ||
207 | momentsNei_.update(); | ||
208 | momentsOwn_.update(); | ||
209 | } | ||
210 | |||
211 | |||
212 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | ||
213 | |||
214 | Foam::univariateQuadratureApproximation::~univariateQuadratureApproximation() | ||
215 | {} | ||
216 | |||
217 | |||
218 | // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // | ||
219 | |||
220 | void Foam::univariateQuadratureApproximation::interpolateNodes() | ||
221 | { | ||
222 | surfaceScalarField nei | ||
223 | ( | ||
224 | IOobject | ||
225 | ( | ||
226 | "nei", | ||
227 | mesh_.time().timeName(), | ||
228 | mesh_ | ||
229 | ), | ||
230 | mesh_, | ||
231 | dimensionedScalar("nei", dimless, -1.0) | ||
232 | ); | ||
233 | |||
234 | surfaceScalarField own | ||
235 | ( | ||
236 | IOobject | ||
237 | ( | ||
238 | "own", | ||
239 | mesh_.time().timeName(), | ||
240 | mesh_ | ||
241 | ), | ||
242 | mesh_, | ||
243 | dimensionedScalar("own", dimless, 1.0) | ||
244 | ); | ||
245 | |||
246 | const PtrList<basicVolScalarNode>& nodesRadau = nodesRadau_(); | ||
247 | PtrList<basicSurfaceScalarNode>& nodesNei = nodesNei_(); | ||
248 | PtrList<basicSurfaceScalarNode>& nodesOwn = nodesOwn_(); | ||
249 | |||
250 | forAll(nodesRadau, rNodei) | ||
251 | { | ||
252 | const basicVolScalarNode& node(nodesRadau[rNodei]); | ||
253 | basicSurfaceScalarNode& nodeNei(nodesNei[rNodei]); | ||
254 | basicSurfaceScalarNode& nodeOwn(nodesOwn[rNodei]); | ||
255 | |||
256 | nodeOwn.primaryWeight() = | ||
257 | fvc::interpolate(node.primaryWeight(), own, "reconstruct(weight)"); | ||
258 | |||
259 | nodeOwn.primaryAbscissa() = | ||
260 | fvc::interpolate | ||
261 | ( | ||
262 | node.primaryAbscissa(), | ||
263 | own, | ||
264 | "reconstruct(abscissa)" | ||
265 | ); | ||
266 | |||
267 | nodeNei.primaryWeight() = | ||
268 | fvc::interpolate(node.primaryWeight(), nei, "reconstruct(weight)"); | ||
269 | |||
270 | nodeNei.primaryAbscissa() = | ||
271 | fvc::interpolate | ||
272 | ( | ||
273 | node.primaryAbscissa(), | ||
274 | nei, | ||
275 | "reconstruct(abscissa)" | ||
276 | ); | ||
277 | } | ||
278 | } | ||
279 | |||
280 | void Foam::univariateQuadratureApproximation::updateBoundaryQuadrature() | ||
281 | { | ||
282 | // Recover reference to boundaryField of zero-order moment. | ||
283 | // All moments will share the same BC types at a given boundary. | ||
284 | const volScalarField::Boundary& bf = moments_().boundaryFieldRef(); | ||
285 | |||
286 | forAll(bf, patchi) | ||
287 | { | ||
288 | const fvPatchScalarField& m0Patch = bf[patchi]; | ||
289 | |||
290 | if (m0Patch.fixesValue()) | ||
291 | { | ||
292 | forAll(m0Patch, facei) | ||
293 | { | ||
294 | univariateMomentSet momentsToInvert | ||
295 | ( | ||
296 | nMoments_, | ||
297 | 0.0, | ||
298 | "Gauss", | ||
299 | support_ | ||
300 | ); | ||
301 | |||
302 | univariateMomentSet momentsToInvertRadau | ||
303 | ( | ||
304 | nMoments_, | ||
305 | 0.0, | ||
306 | "GaussRadau", | ||
307 | support_ | ||
308 | ); | ||
309 | |||
310 | // Copying moments from a face | ||
311 | forAll(momentsToInvert, momenti) | ||
312 | { | ||
313 | momentsToInvert[momenti] | ||
314 | = moments_[momenti].boundaryField()[patchi][facei]; | ||
315 | |||
316 | momentsToInvertRadau[momenti] = momentsToInvert[momenti]; | ||
317 | } | ||
318 | |||
319 | // Inverting moments for EQMOM | ||
320 | momentInverter_->invert(momentsToInvert); | ||
321 | |||
322 | // Finding Gauss-Radau quadrature | ||
323 | momentsToInvertRadau.invert(); | ||
324 | |||
325 | // Copying quadrature data to boundary face | ||
326 | for (label pNodei = 0; pNodei < nPrimaryNodes_; pNodei++) | ||
327 | { | ||
328 | extendedVolScalarNode& node = nodes_()[pNodei]; | ||
329 | |||
330 | node.primaryWeight().boundaryFieldRef()[patchi][facei] | ||
331 | = momentInverter_->primaryWeights()[pNodei]; | ||
332 | |||
333 | node.primaryAbscissa().boundaryFieldRef()[patchi][facei] | ||
334 | = momentInverter_->primaryAbscissae()[pNodei]; | ||
335 | |||
336 | node.sigma().boundaryFieldRef()[patchi][facei] | ||
337 | = momentInverter_->sigma(); | ||
338 | |||
339 | for (label sNodei = 0; sNodei < nSecondaryNodes_; sNodei++) | ||
340 | { | ||
341 | node.secondaryWeights()[sNodei].boundaryFieldRef()[patchi][facei] | ||
342 | = momentInverter_->secondaryWeights()[pNodei][sNodei]; | ||
343 | |||
344 | node.secondaryAbscissae()[sNodei].boundaryFieldRef()[patchi][facei] | ||
345 | = momentInverter_->secondaryAbscissae()[pNodei][sNodei]; | ||
346 | } | ||
347 | } | ||
348 | |||
349 | // Copying Radau quadrature data to boundary face | ||
350 | for (label rNodei = 0; rNodei < nNodesRadau_; rNodei++) | ||
351 | { | ||
352 | basicVolScalarNode& nodeRadau = nodesRadau_()[rNodei]; | ||
353 | |||
354 | if (rNodei < momentsToInvertRadau.nNodes()) | ||
355 | { | ||
356 | nodeRadau.primaryWeight().boundaryFieldRef()[patchi][facei] | ||
357 | = momentsToInvertRadau.weights()[rNodei]; | ||
358 | |||
359 | nodeRadau.primaryAbscissa().boundaryFieldRef()[patchi][facei] | ||
360 | = momentsToInvertRadau.abscissae()[rNodei]; | ||
361 | } | ||
362 | else | ||
363 | { | ||
364 | nodeRadau.primaryWeight().boundaryFieldRef()[patchi][facei] | ||
365 | = 0.0; | ||
366 | |||
367 | nodeRadau.primaryAbscissa().boundaryFieldRef()[patchi][facei] | ||
368 | = 0.0; | ||
369 | } | ||
370 | } | ||
371 | } | ||
372 | } | ||
373 | } | ||
374 | } | ||
375 | |||
376 | void Foam::univariateQuadratureApproximation::updateQuadrature() | ||
377 | { | ||
378 | const volScalarField& m0(moments_[0]); | ||
379 | |||
380 | PtrList<extendedVolScalarNode>& nodes(nodes_()); | ||
381 | PtrList<basicVolScalarNode>& nodesRadau(nodesRadau_()); | ||
382 | |||
383 | forAll(m0, celli) | ||
384 | { | ||
385 | univariateMomentSet momentsToInvert | ||
386 | ( | ||
387 | nMoments_, | ||
388 | 0.0, | ||
389 | "Gauss", | ||
390 | support_ | ||
391 | ); | ||
392 | |||
393 | univariateMomentSet momentsToInvertRadau | ||
394 | ( | ||
395 | nMoments_, | ||
396 | 0.0, | ||
397 | "GaussRadau", | ||
398 | support_ | ||
399 | ); | ||
400 | |||
401 | // Copying moment set from a cell to univariateMomentSet | ||
402 | forAll(momentsToInvert, momenti) | ||
403 | { | ||
404 | momentsToInvert[momenti] = moments_[momenti][celli]; | ||
405 | momentsToInvertRadau[momenti] = momentsToInvert[momenti]; | ||
406 | } | ||
407 | |||
408 | // Inverting moments and updating EQMOM | ||
409 | momentInverter_->invert(momentsToInvert); | ||
410 | |||
411 | // Finding Gauss-Radau quadrature | ||
412 | momentsToInvertRadau.invert(); | ||
413 | |||
414 | // Recovering primary weights and abscissae from moment inverter | ||
415 | const scalarDiagonalMatrix& pWeights(momentInverter_->primaryWeights()); | ||
416 | |||
417 | const scalarDiagonalMatrix& pAbscissae | ||
418 | ( | ||
419 | momentInverter_->primaryAbscissae() | ||
420 | ); | ||
421 | |||
422 | // Recovering Gauss-Radau quadrature | ||
423 | const scalarDiagonalMatrix& rWeights(momentsToInvertRadau.weights()); | ||
424 | |||
425 | const scalarDiagonalMatrix& rAbscissae | ||
426 | ( | ||
427 | momentsToInvertRadau.abscissae() | ||
428 | ); | ||
429 | |||
430 | // Copying EQMOM quadrature to fields | ||
431 | for (label pNodei = 0; pNodei < nPrimaryNodes_; pNodei++) | ||
432 | { | ||
433 | extendedVolScalarNode& node(nodes[pNodei]); | ||
434 | |||
435 | // Copy primary node | ||
436 | node.primaryWeight()[celli] = pWeights[pNodei]; | ||
437 | node.primaryAbscissa()[celli] = pAbscissae[pNodei]; | ||
438 | |||
439 | // Copy secondary nodes | ||
440 | PtrList<volScalarField>& sWeightFields(node.secondaryWeights()); | ||
441 | PtrList<volScalarField>& sAbscissaFields(node.secondaryAbscissae()); | ||
442 | |||
443 | const scalarRectangularMatrix& sWeights | ||
444 | ( | ||
445 | momentInverter_->secondaryWeights() | ||
446 | ); | ||
447 | |||
448 | const scalarRectangularMatrix& sAbscissae | ||
449 | ( | ||
450 | momentInverter_->secondaryAbscissae() | ||
451 | ); | ||
452 | |||
453 | for (label sNodei = 0; sNodei < nSecondaryNodes_; sNodei++) | ||
454 | { | ||
455 | sWeightFields[sNodei][celli] = sWeights[pNodei][sNodei]; | ||
456 | sAbscissaFields[sNodei][celli] = sAbscissae[pNodei][sNodei]; | ||
457 | } | ||
458 | |||
459 | // Copy sigma | ||
460 | node.sigma()[celli] = momentInverter_->sigma(); | ||
461 | } | ||
462 | |||
463 | for (label rNodei = 0; rNodei < nNodesRadau_; rNodei++) | ||
464 | { | ||
465 | basicVolScalarNode& node(nodesRadau[rNodei]); | ||
466 | |||
467 | if (rNodei < momentsToInvertRadau.nNodes()) | ||
468 | { | ||
469 | node.primaryWeight()[celli] = rWeights[rNodei]; | ||
470 | node.primaryAbscissa()[celli] = rAbscissae[rNodei]; | ||
471 | } | ||
472 | else | ||
473 | { | ||
474 | node.primaryWeight()[celli] = 0.0; | ||
475 | node.primaryAbscissa()[celli] = 0.0; | ||
476 | } | ||
477 | } | ||
478 | } | ||
479 | |||
480 | // Updating boundary conditions | ||
481 | forAll(nodes, pNodei) | ||
482 | { | ||
483 | extendedVolScalarNode& pNode(nodes[pNodei]); | ||
484 | |||
485 | pNode.primaryWeight().correctBoundaryConditions(); | ||
486 | pNode.primaryAbscissa().correctBoundaryConditions(); | ||
487 | pNode.sigma().correctBoundaryConditions(); | ||
488 | |||
489 | |||
490 | for (label sNodei = 0; sNodei < nSecondaryNodes_; sNodei++) | ||
491 | { | ||
492 | pNode.secondaryWeights()[sNodei].correctBoundaryConditions(); | ||
493 | pNode.secondaryAbscissae()[sNodei].correctBoundaryConditions(); | ||
494 | } | ||
495 | } | ||
496 | |||
497 | forAll(nodesRadau, rNodei) | ||
498 | { | ||
499 | basicVolScalarNode& rNode(nodesRadau[rNodei]); | ||
500 | |||
501 | rNode.primaryWeight().correctBoundaryConditions(); | ||
502 | rNode.primaryAbscissa().correctBoundaryConditions(); | ||
503 | } | ||
504 | |||
505 | updateBoundaryQuadrature(); | ||
506 | updateMoments(); | ||
507 | } | ||
508 | |||
509 | |||
510 | void Foam::univariateQuadratureApproximation::updateMoments() | ||
511 | { | ||
512 | moments_.update(); | ||
513 | } | ||
514 | |||
515 | |||
516 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/quadratureApproximation/univariateQuadratureApproximation/univariateQuadratureApproximation.H added (mode: 100644) (index 0000000..ee0b300) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2015-2016 Alberto Passalacqua | ||
6 | \\/ M anipulation | | ||
7 | ------------------------------------------------------------------------------- | ||
8 | License | ||
9 | This file is derivative work 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 | Class | ||
25 | Foam::univariateQuadratureApproximation | ||
26 | |||
27 | Description | ||
28 | Provides storage for the moments and the corresponding quadrature | ||
29 | approximation of a univariate distribution function. | ||
30 | Methods to update the moments and the quadrature approximation are | ||
31 | provided. | ||
32 | |||
33 | SourceFiles | ||
34 | univariateQuadratureApproximation.C | ||
35 | univariateQuadratureApproximationI.H | ||
36 | |||
37 | \*---------------------------------------------------------------------------*/ | ||
38 | |||
39 | #ifndef univariateQuadratureApproximation_H | ||
40 | #define univariateQuadratureApproximation_H | ||
41 | |||
42 | #include "fvCFD.H" | ||
43 | #include "IOdictionary.H" | ||
44 | #include "PtrList.H" | ||
45 | #include "fvMesh.H" | ||
46 | #include "volFields.H" | ||
47 | #include "surfaceFields.H" | ||
48 | #include "univariateMomentSet.H" | ||
49 | #include "extendedMomentInversion.H" | ||
50 | #include "quadratureNodes.H" | ||
51 | #include "momentFieldSets.H" | ||
52 | |||
53 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
54 | |||
55 | namespace Foam | ||
56 | { | ||
57 | |||
58 | /*---------------------------------------------------------------------------*\ | ||
59 | Class univariateQuadratureApproximation Declaration | ||
60 | \*---------------------------------------------------------------------------*/ | ||
61 | |||
62 | class univariateQuadratureApproximation | ||
63 | : | ||
64 | public IOdictionary | ||
65 | { | ||
66 | // Private data | ||
67 | |||
68 | //- Name of the quadrature approximation | ||
69 | const word name_; | ||
70 | |||
71 | //- Reference to the mesh | ||
72 | const fvMesh& mesh_; | ||
73 | |||
74 | //- AutoPtr to the PtrList of quadrature nodes | ||
75 | autoPtr<PtrList<extendedVolScalarNode>> nodes_; | ||
76 | |||
77 | //- AutoPtr to the PtrList of Radau quadrature nodes | ||
78 | autoPtr<PtrList<basicVolScalarNode>> nodesRadau_; | ||
79 | |||
80 | //- List of moments | ||
81 | volUnivariateMomentFieldSet moments_; | ||
82 | |||
83 | //- Number of primary quadrature nodes | ||
84 | label nPrimaryNodes_; | ||
85 | |||
86 | //- Number of secondary quadrature nodes | ||
87 | label nSecondaryNodes_; | ||
88 | |||
89 | //- Number of Radau quadrature nodes | ||
90 | label nNodesRadau_; | ||
91 | |||
92 | //- List of interpolated nodes (neighbour) | ||
93 | autoPtr<PtrList<basicSurfaceScalarNode>> nodesNei_; | ||
94 | |||
95 | //- List of interpolated nodes (owner) | ||
96 | autoPtr<PtrList<basicSurfaceScalarNode>> nodesOwn_; | ||
97 | |||
98 | //- Dimensionality of the distribution function | ||
99 | const label nDimensions_; | ||
100 | |||
101 | //- Number of moments | ||
102 | const label nMoments_; | ||
103 | |||
104 | //- List of interpolated moments (neighbour) | ||
105 | basicSurfaceUnivariateMomentFieldSet momentsNei_; | ||
106 | |||
107 | //- List of interpolated moments (owner) | ||
108 | basicSurfaceUnivariateMomentFieldSet momentsOwn_; | ||
109 | |||
110 | //- Moment inversion method | ||
111 | autoPtr<extendedMomentInversion> momentInverter_; | ||
112 | |||
113 | //- Support of the distribution function | ||
114 | word support_; | ||
115 | |||
116 | |||
117 | public: | ||
118 | |||
119 | // Constructors | ||
120 | |||
121 | //- Construct from mesh | ||
122 | explicit univariateQuadratureApproximation | ||
123 | ( | ||
124 | const word& name, | ||
125 | const fvMesh& mesh, | ||
126 | const word& support | ||
127 | ); | ||
128 | |||
129 | |||
130 | //- Destructor | ||
131 | virtual ~univariateQuadratureApproximation(); | ||
132 | |||
133 | |||
134 | // Member Functions | ||
135 | |||
136 | // Access | ||
137 | |||
138 | //- Return the nodes | ||
139 | inline const PtrList<extendedVolScalarNode>& nodes() const; | ||
140 | |||
141 | //- Const access to the moments | ||
142 | inline const volUnivariateMomentFieldSet& moments() const; | ||
143 | |||
144 | //- Non-const access to the moments | ||
145 | inline volUnivariateMomentFieldSet& moments(); | ||
146 | |||
147 | //- Const access to the interpolated moments (neighbour) | ||
148 | inline const basicSurfaceUnivariateMomentFieldSet& | ||
149 | momentsNei() const; | ||
150 | |||
151 | //- Non-const access to the interpolated moments (neighbour) | ||
152 | inline basicSurfaceUnivariateMomentFieldSet& momentsNei(); | ||
153 | |||
154 | //- Const access to the interpolated moments (owner) | ||
155 | inline const basicSurfaceUnivariateMomentFieldSet& | ||
156 | momentsOwn() const; | ||
157 | |||
158 | //- Non-const access to the interpolated moments (owner) | ||
159 | inline basicSurfaceUnivariateMomentFieldSet& momentsOwn(); | ||
160 | |||
161 | //- Return the number of dimensions in the distribution | ||
162 | inline label nDimensions() const; | ||
163 | |||
164 | //- Return the number of moments | ||
165 | inline label nMoments() const; | ||
166 | |||
167 | |||
168 | // Edit | ||
169 | |||
170 | //- Interpolate nodes | ||
171 | void interpolateNodes(); | ||
172 | |||
173 | //- Update quadrature nodes on fixed-value boundaries | ||
174 | void updateBoundaryQuadrature(); | ||
175 | |||
176 | //- Recalculate the quadrature nodes from the moments | ||
177 | void updateQuadrature(); | ||
178 | |||
179 | //- Recalculate the moments from the quadrature nodes | ||
180 | void updateMoments(); | ||
181 | }; | ||
182 | |||
183 | |||
184 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
185 | |||
186 | } // End namespace Foam | ||
187 | |||
188 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
189 | |||
190 | #include "univariateQuadratureApproximationI.H" | ||
191 | |||
192 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
193 | |||
194 | #endif | ||
195 | |||
196 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/quadratureApproximation/univariateQuadratureApproximation/univariateQuadratureApproximationI.H added (mode: 100644) (index 0000000..d757dae) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2015-2016 Alberto Passalacqua | ||
6 | \\/ M anipulation | | ||
7 | ------------------------------------------------------------------------------- | ||
8 | License | ||
9 | This file is derivative work 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 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | ||
27 | |||
28 | const Foam::PtrList<Foam::extendedVolScalarNode>& | ||
29 | Foam::univariateQuadratureApproximation::nodes() const | ||
30 | { | ||
31 | return nodes_(); | ||
32 | } | ||
33 | |||
34 | const Foam::volUnivariateMomentFieldSet& | ||
35 | Foam::univariateQuadratureApproximation::moments() const | ||
36 | { | ||
37 | return moments_; | ||
38 | } | ||
39 | |||
40 | Foam::volUnivariateMomentFieldSet& | ||
41 | Foam::univariateQuadratureApproximation::moments() | ||
42 | { | ||
43 | return moments_; | ||
44 | } | ||
45 | |||
46 | const Foam::basicSurfaceUnivariateMomentFieldSet& | ||
47 | Foam::univariateQuadratureApproximation::momentsNei() const | ||
48 | { | ||
49 | return momentsNei_; | ||
50 | } | ||
51 | |||
52 | Foam::basicSurfaceUnivariateMomentFieldSet& | ||
53 | Foam::univariateQuadratureApproximation::momentsNei() | ||
54 | { | ||
55 | return momentsNei_; | ||
56 | } | ||
57 | |||
58 | const Foam::basicSurfaceUnivariateMomentFieldSet& | ||
59 | Foam::univariateQuadratureApproximation::momentsOwn() const | ||
60 | { | ||
61 | return momentsOwn_; | ||
62 | } | ||
63 | |||
64 | Foam::basicSurfaceUnivariateMomentFieldSet& | ||
65 | Foam::univariateQuadratureApproximation::momentsOwn() | ||
66 | { | ||
67 | return momentsOwn_; | ||
68 | } | ||
69 | |||
70 | Foam::label Foam::univariateQuadratureApproximation::nDimensions() const | ||
71 | { | ||
72 | return nDimensions_; | ||
73 | } | ||
74 | |||
75 | Foam::label Foam::univariateQuadratureApproximation::nMoments() const | ||
76 | { | ||
77 | return nMoments_; | ||
78 | } | ||
79 | |||
80 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/quadratureNode/extendedQuadratureNode.C added (mode: 100644) (index 0000000..3da6786) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2015 Alberto Passalacqua | ||
6 | \\/ M anipulation | | ||
7 | ------------------------------------------------------------------------------- | ||
8 | License | ||
9 | This file is derivative work 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 "extendedQuadratureNode.H" | ||
27 | |||
28 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | ||
29 | template <class weightType, class abscissaType, class sigmaType> | ||
30 | Foam::extendedQuadratureNode<weightType, abscissaType, sigmaType>:: | ||
31 | extendedQuadratureNode | ||
32 | ( | ||
33 | const word& name, | ||
34 | const word& distributionName, | ||
35 | const label nSecondaryNodes, | ||
36 | const fvMesh& mesh, | ||
37 | const dimensionSet& weightDimensions, | ||
38 | const dimensionSet& abscissaDimensions | ||
39 | ) | ||
40 | : | ||
41 | quadratureNode<weightType, abscissaType> | ||
42 | ( | ||
43 | name, | ||
44 | distributionName, | ||
45 | mesh, | ||
46 | weightDimensions, | ||
47 | abscissaDimensions | ||
48 | ), | ||
49 | name_(IOobject::groupName(name, distributionName)), | ||
50 | nSecondaryNodes_(nSecondaryNodes), | ||
51 | secondaryWeights_(nSecondaryNodes_), | ||
52 | secondaryAbscissae_(nSecondaryNodes_), | ||
53 | sigma_ | ||
54 | ( | ||
55 | IOobject | ||
56 | ( | ||
57 | IOobject::groupName(name_, "sigma"), | ||
58 | mesh.time().timeName(), | ||
59 | mesh, | ||
60 | IOobject::NO_READ, | ||
61 | IOobject::NO_WRITE | ||
62 | ), | ||
63 | mesh, | ||
64 | dimensioned<typename sigmaType::value_type> | ||
65 | ( | ||
66 | "zeroSigma", | ||
67 | dimless, | ||
68 | pTraits<typename sigmaType::value_type>::zero | ||
69 | ) | ||
70 | ), | ||
71 | extended_(true) | ||
72 | { | ||
73 | forAll(secondaryWeights_, nodei) | ||
74 | { | ||
75 | secondaryWeights_.set | ||
76 | ( | ||
77 | nodei, | ||
78 | new weightType | ||
79 | ( | ||
80 | IOobject | ||
81 | ( | ||
82 | IOobject::groupName | ||
83 | ( | ||
84 | name_, | ||
85 | "secondaryWeight." + Foam::name(nodei) | ||
86 | ), | ||
87 | mesh.time().timeName(), | ||
88 | mesh, | ||
89 | IOobject::NO_READ, | ||
90 | IOobject::NO_WRITE | ||
91 | ), | ||
92 | mesh, | ||
93 | dimensioned<typename weightType::value_type> | ||
94 | ( | ||
95 | "zeroWeight", | ||
96 | dimless, | ||
97 | pTraits<typename weightType::value_type>::zero | ||
98 | ) | ||
99 | ) | ||
100 | ); | ||
101 | |||
102 | secondaryAbscissae_.set | ||
103 | ( | ||
104 | nodei, | ||
105 | new abscissaType | ||
106 | ( | ||
107 | IOobject | ||
108 | ( | ||
109 | IOobject::groupName | ||
110 | ( | ||
111 | name_, | ||
112 | "secondaryAbscissa." + Foam::name(nodei) | ||
113 | ), | ||
114 | mesh.time().timeName(), | ||
115 | mesh, | ||
116 | IOobject::NO_READ, | ||
117 | IOobject::NO_WRITE | ||
118 | ), | ||
119 | mesh, | ||
120 | dimensioned<typename abscissaType::value_type> | ||
121 | ( | ||
122 | "zeroAbscissa", | ||
123 | abscissaDimensions, | ||
124 | pTraits<typename abscissaType::value_type>::zero | ||
125 | ) | ||
126 | ) | ||
127 | ); | ||
128 | } | ||
129 | } | ||
130 | |||
131 | |||
132 | template <class weightType, class abscissaType, class sigmaType> | ||
133 | Foam::extendedQuadratureNode<weightType, abscissaType, sigmaType>:: | ||
134 | extendedQuadratureNode | ||
135 | ( | ||
136 | const word& name, | ||
137 | const word& distributionName, | ||
138 | const dictionary& nodeDict, | ||
139 | const fvMesh& mesh, | ||
140 | const dimensionSet& weightDimensions, | ||
141 | const dimensionSet& abscissaDimensions, | ||
142 | const wordList& boundaryTypes | ||
143 | ) | ||
144 | : | ||
145 | quadratureNode<weightType, abscissaType> | ||
146 | ( | ||
147 | name, | ||
148 | distributionName, | ||
149 | nodeDict, | ||
150 | mesh, | ||
151 | weightDimensions, | ||
152 | abscissaDimensions, | ||
153 | boundaryTypes | ||
154 | ), | ||
155 | name_(IOobject::groupName(name, distributionName)), | ||
156 | nSecondaryNodes_ | ||
157 | ( | ||
158 | nodeDict.lookupOrDefault("nSecondaryNodes", 10) | ||
159 | ), | ||
160 | secondaryWeights_(nSecondaryNodes_), | ||
161 | secondaryAbscissae_(nSecondaryNodes_), | ||
162 | sigma_ | ||
163 | ( | ||
164 | IOobject | ||
165 | ( | ||
166 | IOobject::groupName(name_, "sigma"), | ||
167 | mesh.time().timeName(), | ||
168 | mesh, | ||
169 | IOobject::NO_READ, | ||
170 | IOobject::NO_WRITE | ||
171 | ), | ||
172 | mesh, | ||
173 | dimensioned<typename sigmaType::value_type> | ||
174 | ( | ||
175 | "zeroSigma", | ||
176 | dimless, | ||
177 | pTraits<typename sigmaType::value_type>::zero | ||
178 | ), | ||
179 | boundaryTypes | ||
180 | ), | ||
181 | extended_(true) | ||
182 | { | ||
183 | forAll(secondaryWeights_, nodei) | ||
184 | { | ||
185 | secondaryWeights_.set | ||
186 | ( | ||
187 | nodei, | ||
188 | new weightType | ||
189 | ( | ||
190 | IOobject | ||
191 | ( | ||
192 | IOobject::groupName | ||
193 | ( | ||
194 | name_, | ||
195 | "secondaryWeight." + Foam::name(nodei) | ||
196 | ), | ||
197 | mesh.time().timeName(), | ||
198 | mesh, | ||
199 | IOobject::NO_READ, | ||
200 | IOobject::NO_WRITE | ||
201 | ), | ||
202 | mesh, | ||
203 | dimensioned<typename weightType::value_type> | ||
204 | ( | ||
205 | "zeroWeight", | ||
206 | dimless, | ||
207 | pTraits<typename weightType::value_type>::zero | ||
208 | ), | ||
209 | boundaryTypes | ||
210 | ) | ||
211 | ); | ||
212 | |||
213 | secondaryAbscissae_.set | ||
214 | ( | ||
215 | nodei, | ||
216 | new abscissaType | ||
217 | ( | ||
218 | IOobject | ||
219 | ( | ||
220 | IOobject::groupName | ||
221 | ( | ||
222 | name_, | ||
223 | "secondaryAbscissa." + Foam::name(nodei) | ||
224 | ), | ||
225 | mesh.time().timeName(), | ||
226 | mesh, | ||
227 | IOobject::NO_READ, | ||
228 | IOobject::NO_WRITE | ||
229 | ), | ||
230 | mesh, | ||
231 | dimensioned<typename abscissaType::value_type> | ||
232 | ( | ||
233 | "zeroAbscissa", | ||
234 | abscissaDimensions, | ||
235 | pTraits<typename abscissaType::value_type>::zero | ||
236 | ), | ||
237 | boundaryTypes | ||
238 | ) | ||
239 | ); | ||
240 | } | ||
241 | } | ||
242 | |||
243 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | ||
244 | |||
245 | template <class weightType, class abscissaType, class sigmaType> | ||
246 | Foam::extendedQuadratureNode<weightType, abscissaType, sigmaType>:: | ||
247 | ~extendedQuadratureNode() | ||
248 | {} | ||
249 | |||
250 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | ||
251 | |||
252 | template <class weightType, class abscissaType, class sigmaType> | ||
253 | Foam::autoPtr | ||
254 | < | ||
255 | Foam::extendedQuadratureNode<weightType, abscissaType, sigmaType> | ||
256 | > | ||
257 | Foam::extendedQuadratureNode<weightType, abscissaType, sigmaType>::clone() const | ||
258 | { | ||
259 | notImplemented("extendedQuadratureNode::clone() const"); | ||
260 | return autoPtr | ||
261 | < | ||
262 | extendedQuadratureNode<weightType, abscissaType, sigmaType> | ||
263 | >(NULL); | ||
264 | } | ||
265 | |||
266 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/quadratureNode/extendedQuadratureNode.H added (mode: 100644) (index 0000000..05ff5f5) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2015 Alberto Passalacqua | ||
6 | \\/ M anipulation | | ||
7 | ------------------------------------------------------------------------------- | ||
8 | License | ||
9 | This file is derivative work 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 | Class | ||
25 | Foam::extendedQuadratureNode | ||
26 | |||
27 | Description | ||
28 | Extended version of the quadrature node, which stores the list of secondary | ||
29 | weights and abscissae associated to the primary weight and abscissa, and | ||
30 | the sigma parameter. | ||
31 | |||
32 | SourceFiles | ||
33 | extendedQuadratureNode.C | ||
34 | extendedQuadratureNodeI.H | ||
35 | |||
36 | \*---------------------------------------------------------------------------*/ | ||
37 | |||
38 | #ifndef extendedQuadratureNode_H | ||
39 | #define extendedQuadratureNode_H | ||
40 | |||
41 | #include "fvMesh.H" | ||
42 | #include "PtrList.H" | ||
43 | #include "dictionary.H" | ||
44 | #include "dictionaryEntry.H" | ||
45 | #include "quadratureNode.H" | ||
46 | |||
47 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
48 | |||
49 | namespace Foam | ||
50 | { | ||
51 | |||
52 | /*---------------------------------------------------------------------------*\ | ||
53 | Class extendedQuadratureNode Declaration | ||
54 | \*---------------------------------------------------------------------------*/ | ||
55 | template <class weightType, class abscissaType, class sigmaType> | ||
56 | class extendedQuadratureNode | ||
57 | : | ||
58 | public quadratureNode<weightType, abscissaType> | ||
59 | { | ||
60 | // Private data | ||
61 | |||
62 | //- Name of the quadrature node | ||
63 | word name_; | ||
64 | |||
65 | //- Number of secondary nodes | ||
66 | label nSecondaryNodes_; | ||
67 | |||
68 | //- List of secondary weights of the node | ||
69 | PtrList<weightType> secondaryWeights_; | ||
70 | |||
71 | //- List of secondary abscissae of the node | ||
72 | PtrList<abscissaType> secondaryAbscissae_; | ||
73 | |||
74 | //- Parameter of the kernel density function used in EQMOM | ||
75 | sigmaType sigma_; | ||
76 | |||
77 | //- Boolean variable to identify extended nodes | ||
78 | bool extended_; | ||
79 | |||
80 | public: | ||
81 | |||
82 | // Constructors | ||
83 | |||
84 | //- Construct from name, dictionary, mesh and dimensions | ||
85 | extendedQuadratureNode | ||
86 | ( | ||
87 | const word& name, | ||
88 | const word& distributionName, | ||
89 | const dictionary& nodeDict, | ||
90 | const fvMesh& mesh, | ||
91 | const dimensionSet& weightDimensions, | ||
92 | const dimensionSet& abscissaDimensions, | ||
93 | const wordList& boundaryTypes | ||
94 | ); | ||
95 | |||
96 | //- Construct from name, number of secondary nodes, mesh and dimensions | ||
97 | extendedQuadratureNode | ||
98 | ( | ||
99 | const word& name, | ||
100 | const word& distributionName, | ||
101 | const label nSecondaryNodes, | ||
102 | const fvMesh& mesh, | ||
103 | const dimensionSet& weightDimensions, | ||
104 | const dimensionSet& abscissaDimensions | ||
105 | ); | ||
106 | |||
107 | //- Return clone | ||
108 | autoPtr<extendedQuadratureNode<weightType, abscissaType, sigmaType> > | ||
109 | clone() const; | ||
110 | |||
111 | //- Return a pointer to a new quadrature node created on freestore | ||
112 | // from Istream | ||
113 | class iNew | ||
114 | { | ||
115 | const word distributionName_; | ||
116 | const fvMesh& mesh_; | ||
117 | const dimensionSet& weightDimensions_; | ||
118 | const dimensionSet& abscissaDimensions_; | ||
119 | const wordList& boundaryTypes_; | ||
120 | |||
121 | public: | ||
122 | |||
123 | iNew | ||
124 | ( | ||
125 | const word& distributionName, | ||
126 | const fvMesh& mesh, | ||
127 | const dimensionSet& weightDimensions, | ||
128 | const dimensionSet& abscissaDimensions, | ||
129 | const wordList& boundaryTypes | ||
130 | ) | ||
131 | : | ||
132 | distributionName_(distributionName), | ||
133 | mesh_(mesh), | ||
134 | weightDimensions_(weightDimensions), | ||
135 | abscissaDimensions_(abscissaDimensions), | ||
136 | boundaryTypes_(boundaryTypes) | ||
137 | {} | ||
138 | |||
139 | autoPtr | ||
140 | < | ||
141 | extendedQuadratureNode<weightType, abscissaType, sigmaType> | ||
142 | > | ||
143 | operator() | ||
144 | ( | ||
145 | Istream& is | ||
146 | ) const | ||
147 | { | ||
148 | dictionaryEntry ent(dictionary::null, is); | ||
149 | return autoPtr | ||
150 | < | ||
151 | extendedQuadratureNode<weightType, abscissaType, sigmaType> | ||
152 | > | ||
153 | ( | ||
154 | new extendedQuadratureNode | ||
155 | < | ||
156 | weightType, abscissaType, sigmaType | ||
157 | > | ||
158 | ( | ||
159 | ent.keyword(), | ||
160 | distributionName_, | ||
161 | ent, | ||
162 | mesh_, | ||
163 | weightDimensions_, | ||
164 | abscissaDimensions_, | ||
165 | boundaryTypes_ | ||
166 | ) | ||
167 | ); | ||
168 | } | ||
169 | }; | ||
170 | |||
171 | |||
172 | //- Destructor | ||
173 | virtual ~extendedQuadratureNode(); | ||
174 | |||
175 | |||
176 | // Member Functions | ||
177 | |||
178 | // Access | ||
179 | |||
180 | //- Return the name of the node | ||
181 | inline const word& name() const; | ||
182 | |||
183 | inline bool extended() const; | ||
184 | |||
185 | //- Returns the number of secondary nodes | ||
186 | inline label nSecondaryNodes() const; | ||
187 | |||
188 | //- Const access to the secondary weights of the node | ||
189 | inline const PtrList<weightType>& secondaryWeights() const; | ||
190 | |||
191 | //- Non-const access to the secondary weights of the node | ||
192 | inline PtrList<weightType>& secondaryWeights(); | ||
193 | |||
194 | //- Const access to the list of secondary abscissae of the node | ||
195 | inline const PtrList<abscissaType>& secondaryAbscissae() const; | ||
196 | |||
197 | //- Non-const access to the list of secondary abscissae of the node | ||
198 | inline PtrList<abscissaType>& secondaryAbscissae(); | ||
199 | |||
200 | //- Const access to sigma | ||
201 | inline const sigmaType& sigma() const; | ||
202 | |||
203 | //- Non-const access to sigma | ||
204 | inline sigmaType& sigma(); | ||
205 | }; | ||
206 | |||
207 | |||
208 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
209 | |||
210 | } // End namespace Foam | ||
211 | |||
212 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
213 | #ifdef NoRepository | ||
214 | # include "extendedQuadratureNodeI.H" | ||
215 | # include "extendedQuadratureNode.C" | ||
216 | #endif | ||
217 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
218 | |||
219 | #endif | ||
220 | |||
221 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/quadratureNode/extendedQuadratureNodeI.H added (mode: 100644) (index 0000000..7542e19) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2015 Alberto Passalacqua | ||
6 | ------------------------------------------------------------------------------- | ||
7 | License | ||
8 | This file is derivative work of OpenFOAM. | ||
9 | |||
10 | OpenFOAM is free software: you can redistribute it and/or modify it | ||
11 | under the terms of the GNU General Public License as published by | ||
12 | the Free Software Foundation, either version 3 of the License, or | ||
13 | (at your option) any later version. | ||
14 | |||
15 | OpenFOAM is distributed in the hope that it will be useful, but WITHOUT | ||
16 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
17 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
18 | for more details. | ||
19 | |||
20 | You should have received a copy of the GNU General Public License | ||
21 | along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. | ||
22 | |||
23 | \*---------------------------------------------------------------------------*/ | ||
24 | |||
25 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | ||
26 | |||
27 | template <class weightType, class abscissaType, class sigmaType> | ||
28 | const Foam::word& | ||
29 | Foam::extendedQuadratureNode<weightType, abscissaType, sigmaType>::name() const | ||
30 | { | ||
31 | return name_; | ||
32 | } | ||
33 | |||
34 | template <class weightType, class abscissaType, class sigmaType> | ||
35 | inline bool Foam::extendedQuadratureNode<weightType, abscissaType, sigmaType>:: | ||
36 | extended() const | ||
37 | { | ||
38 | return extended_; | ||
39 | } | ||
40 | |||
41 | template <class weightType, class abscissaType, class sigmaType> | ||
42 | Foam::label | ||
43 | Foam::extendedQuadratureNode<weightType, abscissaType, sigmaType>:: | ||
44 | nSecondaryNodes() const | ||
45 | { | ||
46 | return nSecondaryNodes_; | ||
47 | } | ||
48 | |||
49 | template <class weightType, class abscissaType, class sigmaType> | ||
50 | const Foam::PtrList<weightType>& | ||
51 | Foam::extendedQuadratureNode<weightType, abscissaType, sigmaType>:: | ||
52 | secondaryWeights() const | ||
53 | { | ||
54 | return secondaryWeights_; | ||
55 | } | ||
56 | |||
57 | template <class weightType, class abscissaType, class sigmaType> | ||
58 | Foam::PtrList<weightType>& | ||
59 | Foam::extendedQuadratureNode<weightType, abscissaType, sigmaType>:: | ||
60 | secondaryWeights() | ||
61 | { | ||
62 | return secondaryWeights_; | ||
63 | } | ||
64 | |||
65 | template <class weightType, class abscissaType, class sigmaType> | ||
66 | const Foam::PtrList<abscissaType>& | ||
67 | Foam::extendedQuadratureNode<weightType, abscissaType, sigmaType> | ||
68 | ::secondaryAbscissae() const | ||
69 | { | ||
70 | return secondaryAbscissae_; | ||
71 | } | ||
72 | |||
73 | template <class weightType, class abscissaType, class sigmaType> | ||
74 | Foam::PtrList<abscissaType>& | ||
75 | Foam::extendedQuadratureNode<weightType, abscissaType, sigmaType> | ||
76 | ::secondaryAbscissae() | ||
77 | { | ||
78 | return secondaryAbscissae_; | ||
79 | } | ||
80 | |||
81 | template <class weightType, class abscissaType, class sigmaType> | ||
82 | const sigmaType& | ||
83 | Foam::extendedQuadratureNode<weightType, abscissaType, sigmaType> | ||
84 | ::sigma() const | ||
85 | { | ||
86 | return sigma_; | ||
87 | } | ||
88 | |||
89 | template <class weightType, class abscissaType, class sigmaType> | ||
90 | sigmaType& | ||
91 | Foam::extendedQuadratureNode<weightType, abscissaType, sigmaType>::sigma() | ||
92 | { | ||
93 | return sigma_; | ||
94 | } | ||
95 | |||
96 | |||
97 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/quadratureNode/quadratureNode.C added (mode: 100644) (index 0000000..0952765) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation | ||
6 | \\/ M anipulation | | ||
7 | ------------------------------------------------------------------------------- | ||
8 | 2015-02-19 Alberto Passalacqua: Templated class on type of weight and abscissa. | ||
9 | 2015-11-02 Alberto Passalacqua: Generalized initialization of fields based on | ||
10 | value_type of the field. | ||
11 | ------------------------------------------------------------------------------- | ||
12 | License | ||
13 | This file is derivative work of OpenFOAM. | ||
14 | |||
15 | OpenFOAM is free software: you can redistribute it and/or modify it | ||
16 | under the terms of the GNU General Public License as published by | ||
17 | the Free Software Foundation, either version 3 of the License, or | ||
18 | (at your option) any later version. | ||
19 | |||
20 | OpenFOAM is distributed in the hope that it will be useful, but WITHOUT | ||
21 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
22 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
23 | for more details. | ||
24 | |||
25 | You should have received a copy of the GNU General Public License | ||
26 | along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. | ||
27 | |||
28 | \*---------------------------------------------------------------------------*/ | ||
29 | |||
30 | #include "quadratureNode.H" | ||
31 | |||
32 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | ||
33 | template <class weightType, class abscissaType> | ||
34 | Foam::quadratureNode<weightType, abscissaType>::quadratureNode | ||
35 | ( | ||
36 | const word& name, | ||
37 | const word& distributionName, | ||
38 | const fvMesh& mesh, | ||
39 | const dimensionSet& weightDimensions, | ||
40 | const dimensionSet& abscissaDimensions | ||
41 | ) | ||
42 | : | ||
43 | name_(IOobject::groupName(name, distributionName)), | ||
44 | weight_ | ||
45 | ( | ||
46 | IOobject | ||
47 | ( | ||
48 | IOobject::groupName(name_, "weight"), | ||
49 | mesh.time().timeName(), | ||
50 | mesh, | ||
51 | IOobject::NO_READ, | ||
52 | IOobject::NO_WRITE | ||
53 | ), | ||
54 | mesh, | ||
55 | dimensioned<typename weightType::value_type> | ||
56 | ( | ||
57 | "zeroWeight", | ||
58 | weightDimensions, | ||
59 | pTraits<typename weightType::value_type>::zero | ||
60 | ) | ||
61 | ), | ||
62 | abscissa_ | ||
63 | ( | ||
64 | IOobject | ||
65 | ( | ||
66 | IOobject::groupName(name_, "abscissa"), | ||
67 | mesh.time().timeName(), | ||
68 | mesh, | ||
69 | IOobject::NO_READ, | ||
70 | IOobject::NO_WRITE | ||
71 | ), | ||
72 | mesh, | ||
73 | dimensioned<typename abscissaType::value_type> | ||
74 | ( | ||
75 | "zeroAbscissa", | ||
76 | abscissaDimensions, | ||
77 | pTraits<typename abscissaType::value_type>::zero | ||
78 | ) | ||
79 | ), | ||
80 | extended_(false) | ||
81 | {} | ||
82 | |||
83 | |||
84 | template <class weightType, class abscissaType> | ||
85 | Foam::quadratureNode<weightType, abscissaType>::quadratureNode | ||
86 | ( | ||
87 | const word& name, | ||
88 | const word& distributionName, | ||
89 | const dictionary& nodeDict, | ||
90 | const fvMesh& mesh, | ||
91 | const dimensionSet& weightDimensions, | ||
92 | const dimensionSet& abscissaDimensions, | ||
93 | const wordList& boundaryTypes | ||
94 | ) | ||
95 | : | ||
96 | name_(IOobject::groupName(name, distributionName)), | ||
97 | nodeDict_(nodeDict), | ||
98 | weight_ | ||
99 | ( | ||
100 | IOobject | ||
101 | ( | ||
102 | IOobject::groupName(name_, "weight"), | ||
103 | mesh.time().timeName(), | ||
104 | mesh, | ||
105 | IOobject::NO_READ, | ||
106 | IOobject::NO_WRITE | ||
107 | ), | ||
108 | mesh, | ||
109 | dimensioned<typename weightType::value_type> | ||
110 | ( | ||
111 | "zeroWeight", | ||
112 | weightDimensions, | ||
113 | pTraits<typename weightType::value_type>::zero | ||
114 | ), | ||
115 | boundaryTypes | ||
116 | ), | ||
117 | abscissa_ | ||
118 | ( | ||
119 | IOobject | ||
120 | ( | ||
121 | IOobject::groupName(name_, "abscissa"), | ||
122 | mesh.time().timeName(), | ||
123 | mesh, | ||
124 | IOobject::NO_READ, | ||
125 | IOobject::NO_WRITE | ||
126 | ), | ||
127 | mesh, | ||
128 | dimensioned<typename abscissaType::value_type> | ||
129 | ( | ||
130 | "zeroAbscissa", | ||
131 | abscissaDimensions, | ||
132 | pTraits<typename abscissaType::value_type>::zero | ||
133 | ), | ||
134 | boundaryTypes | ||
135 | ), | ||
136 | extended_(false) | ||
137 | {} | ||
138 | |||
139 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | ||
140 | |||
141 | template <class weightType, class abscissaType> | ||
142 | Foam::quadratureNode<weightType, abscissaType>::~quadratureNode() | ||
143 | {} | ||
144 | |||
145 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | ||
146 | |||
147 | template <class weightType, class abscissaType> | ||
148 | Foam::autoPtr<Foam::quadratureNode<weightType, abscissaType> > | ||
149 | Foam::quadratureNode<weightType, abscissaType>::clone() const | ||
150 | { | ||
151 | notImplemented("quadratureNode::clone() const"); | ||
152 | return autoPtr<quadratureNode<weightType, abscissaType> >(NULL); | ||
153 | } | ||
154 | |||
155 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/quadratureNode/quadratureNode.H added (mode: 100644) (index 0000000..6d34088) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation | ||
6 | \\/ M anipulation | | ||
7 | ------------------------------------------------------------------------------- | ||
8 | 2015-02-19 Alberto Passalacqua: Templated class on type of weight and abscissa | ||
9 | to store a basic quadrature node made of weight | ||
10 | and abscissa. | ||
11 | 2015-11-02 Alberto Passalacqua: Generalized initialization of fields based on | ||
12 | value_type of the field. | ||
13 | 2015-11-05 Alberto Passalacqua: Added interface functions for secondary | ||
14 | quadrature (not implemented). | ||
15 | ------------------------------------------------------------------------------- | ||
16 | License | ||
17 | This file is derivative work of OpenFOAM. | ||
18 | |||
19 | OpenFOAM is free software: you can redistribute it and/or modify it | ||
20 | under the terms of the GNU General Public License as published by | ||
21 | the Free Software Foundation, either version 3 of the License, or | ||
22 | (at your option) any later version. | ||
23 | |||
24 | OpenFOAM is distributed in the hope that it will be useful, but WITHOUT | ||
25 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
26 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
27 | for more details. | ||
28 | |||
29 | You should have received a copy of the GNU General Public License | ||
30 | along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. | ||
31 | |||
32 | Class | ||
33 | Foam::quadratureNode | ||
34 | |||
35 | Description | ||
36 | Stores a quadrature weight and a quadrature abscissa, whose type is | ||
37 | templated. | ||
38 | |||
39 | SourceFiles | ||
40 | quadratureNode.C | ||
41 | quadratureNodeI.H | ||
42 | |||
43 | \*---------------------------------------------------------------------------*/ | ||
44 | |||
45 | #ifndef quadratureNode_H | ||
46 | #define quadratureNode_H | ||
47 | |||
48 | #include "fvMesh.H" | ||
49 | #include "PtrList.H" | ||
50 | #include "dictionary.H" | ||
51 | #include "dictionaryEntry.H" | ||
52 | |||
53 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
54 | |||
55 | namespace Foam | ||
56 | { | ||
57 | |||
58 | /*---------------------------------------------------------------------------*\ | ||
59 | Class quadratureNode Declaration | ||
60 | \*---------------------------------------------------------------------------*/ | ||
61 | template <class weightType, class abscissaType> | ||
62 | class quadratureNode | ||
63 | { | ||
64 | // Private data | ||
65 | |||
66 | //- Name of node | ||
67 | const word name_; | ||
68 | |||
69 | //- Node dictionary | ||
70 | dictionary nodeDict_; | ||
71 | |||
72 | //- Primary weight of the node | ||
73 | weightType weight_; | ||
74 | |||
75 | //- Primary abscissa of the node | ||
76 | abscissaType abscissa_; | ||
77 | |||
78 | //- Boolean variable to identify extended nodes | ||
79 | bool extended_; | ||
80 | |||
81 | public: | ||
82 | |||
83 | // Constructors | ||
84 | |||
85 | //- Construct from name, dictionary, mesh and dimensions | ||
86 | quadratureNode | ||
87 | ( | ||
88 | const word& name, | ||
89 | const word& distributionName, | ||
90 | const dictionary& nodeDict, | ||
91 | const fvMesh& mesh, | ||
92 | const dimensionSet& weightDimensions, | ||
93 | const dimensionSet& abscissaDimensions, | ||
94 | const wordList& boundaryTypes | ||
95 | ); | ||
96 | |||
97 | //- Construct from name, mesh and dimensions | ||
98 | quadratureNode | ||
99 | ( | ||
100 | const word& name, | ||
101 | const word& distributionName, | ||
102 | const fvMesh& mesh, | ||
103 | const dimensionSet& weightDimensions, | ||
104 | const dimensionSet& abscissaDimensions | ||
105 | ); | ||
106 | |||
107 | //- Return clone | ||
108 | autoPtr<quadratureNode<weightType, abscissaType> > clone() const; | ||
109 | |||
110 | //- Return a pointer to a new quadrature node created on freestore | ||
111 | // from Istream | ||
112 | class iNew | ||
113 | { | ||
114 | const word distributionName_; | ||
115 | const fvMesh& mesh_; | ||
116 | const dimensionSet& weightDimensions_; | ||
117 | const dimensionSet& abscissaDimensions_; | ||
118 | const wordList& boundaryTypes_; | ||
119 | |||
120 | public: | ||
121 | |||
122 | iNew | ||
123 | ( | ||
124 | const word& distributionName, | ||
125 | const fvMesh& mesh, | ||
126 | const dimensionSet& weightDimensions, | ||
127 | const dimensionSet& abscissaDimensions, | ||
128 | const wordList& boundaryTypes | ||
129 | ) | ||
130 | : | ||
131 | distributionName_(distributionName), | ||
132 | mesh_(mesh), | ||
133 | weightDimensions_(weightDimensions), | ||
134 | abscissaDimensions_(abscissaDimensions), | ||
135 | boundaryTypes_(boundaryTypes) | ||
136 | {} | ||
137 | |||
138 | autoPtr<quadratureNode<weightType, abscissaType> > operator() | ||
139 | ( | ||
140 | Istream& is | ||
141 | ) const | ||
142 | { | ||
143 | dictionaryEntry ent(dictionary::null, is); | ||
144 | return autoPtr<quadratureNode<weightType, abscissaType> > | ||
145 | ( | ||
146 | new quadratureNode<weightType, abscissaType> | ||
147 | ( | ||
148 | ent.keyword(), | ||
149 | distributionName_, | ||
150 | ent, | ||
151 | mesh_, | ||
152 | weightDimensions_, | ||
153 | abscissaDimensions_, | ||
154 | boundaryTypes_ | ||
155 | ) | ||
156 | ); | ||
157 | } | ||
158 | }; | ||
159 | |||
160 | |||
161 | //- Destructor | ||
162 | virtual ~quadratureNode(); | ||
163 | |||
164 | |||
165 | // Member Functions | ||
166 | |||
167 | // Access | ||
168 | |||
169 | //- Return the name of the node | ||
170 | inline const word& name() const; | ||
171 | |||
172 | inline bool extended() const; | ||
173 | |||
174 | //- Returns the number of secondary nodes | ||
175 | inline label nSecondaryNodes() const; | ||
176 | |||
177 | //- Const access to the weight of the node | ||
178 | inline const weightType& primaryWeight() const; | ||
179 | |||
180 | //- Non-const access to the weight of the node | ||
181 | inline weightType& primaryWeight(); | ||
182 | |||
183 | //- Const access to the abscissa of the node | ||
184 | inline const abscissaType& primaryAbscissa() const; | ||
185 | |||
186 | //- Non-const access to the abscissa of the node | ||
187 | inline abscissaType& primaryAbscissa(); | ||
188 | |||
189 | //- Const access to the secondary weight of the node | ||
190 | inline const PtrList<weightType>& secondaryWeights() const; | ||
191 | |||
192 | //- Non-const access to the secondary weight of the node | ||
193 | inline PtrList<weightType>& secondaryWeights(); | ||
194 | |||
195 | //- Const access to the list of secondary abscissae of the node | ||
196 | inline const PtrList<abscissaType>& secondaryAbscissae() const; | ||
197 | |||
198 | //- Non-const access to the list of secondary abscissae of the node | ||
199 | inline PtrList<abscissaType>& secondaryAbscissae(); | ||
200 | }; | ||
201 | |||
202 | |||
203 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
204 | |||
205 | } // End namespace Foam | ||
206 | |||
207 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
208 | #ifdef NoRepository | ||
209 | # include "quadratureNodeI.H" | ||
210 | # include "quadratureNode.C" | ||
211 | #endif | ||
212 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
213 | |||
214 | #endif | ||
215 | |||
216 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/quadratureNode/quadratureNodeI.H added (mode: 100644) (index 0000000..c919fb8) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation | ||
6 | ------------------------------------------------------------------------------- | ||
7 | 2015-02-19 Alberto Passalacqua: Templated class on type of weight and abscissa. | ||
8 | 2015-11-05 Alberto Passalacqua: Added interface functions for secondary | ||
9 | quadrature (not implemented). | ||
10 | ------------------------------------------------------------------------------- | ||
11 | License | ||
12 | This file is derivative work 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 | |||
29 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | ||
30 | |||
31 | template <class weightType, class abscissaType> | ||
32 | const Foam::word& Foam::quadratureNode<weightType, abscissaType>::name() const | ||
33 | { | ||
34 | return name_; | ||
35 | } | ||
36 | |||
37 | template <class weightType, class abscissaType> | ||
38 | inline bool Foam::quadratureNode<weightType, abscissaType>::extended() const | ||
39 | { | ||
40 | return extended_; | ||
41 | } | ||
42 | |||
43 | template <class weightType, class abscissaType> | ||
44 | Foam::label Foam::quadratureNode<weightType, abscissaType>:: | ||
45 | nSecondaryNodes() const | ||
46 | { | ||
47 | NotImplemented; | ||
48 | return 0; | ||
49 | } | ||
50 | |||
51 | template <class weightType, class abscissaType> | ||
52 | const weightType& | ||
53 | Foam::quadratureNode<weightType, abscissaType>::primaryWeight() const | ||
54 | { | ||
55 | return weight_; | ||
56 | } | ||
57 | |||
58 | template <class weightType, class abscissaType> | ||
59 | weightType& Foam::quadratureNode<weightType, abscissaType>::primaryWeight() | ||
60 | { | ||
61 | return weight_; | ||
62 | } | ||
63 | |||
64 | template <class weightType, class abscissaType> | ||
65 | const abscissaType& | ||
66 | Foam::quadratureNode<weightType, abscissaType>::primaryAbscissa() const | ||
67 | { | ||
68 | return abscissa_; | ||
69 | } | ||
70 | |||
71 | template <class weightType, class abscissaType> | ||
72 | abscissaType& Foam::quadratureNode<weightType, abscissaType>::primaryAbscissa() | ||
73 | { | ||
74 | return abscissa_; | ||
75 | } | ||
76 | |||
77 | template <class weightType, class abscissaType> | ||
78 | const Foam::PtrList<weightType>& | ||
79 | Foam::quadratureNode<weightType, abscissaType>::secondaryWeights() const | ||
80 | { | ||
81 | NotImplemented; | ||
82 | return NullObjectRef<Foam::PtrList<weightType> >(); | ||
83 | } | ||
84 | |||
85 | template <class weightType, class abscissaType> | ||
86 | Foam::PtrList<weightType>& | ||
87 | Foam::quadratureNode<weightType, abscissaType>::secondaryWeights() | ||
88 | { | ||
89 | NotImplemented; | ||
90 | return NullObjectRef<Foam::PtrList<weightType> >(); | ||
91 | } | ||
92 | |||
93 | template <class weightType, class abscissaType> | ||
94 | const Foam::PtrList<abscissaType>& | ||
95 | Foam::quadratureNode<weightType, abscissaType>::secondaryAbscissae() const | ||
96 | { | ||
97 | NotImplemented; | ||
98 | return NullObjectRef<Foam::PtrList<abscissaType> >(); | ||
99 | } | ||
100 | |||
101 | template <class weightType, class abscissaType> | ||
102 | Foam::PtrList<abscissaType>& | ||
103 | Foam::quadratureNode<weightType, abscissaType>::secondaryAbscissae() | ||
104 | { | ||
105 | NotImplemented; | ||
106 | return NullObjectRef<Foam::PtrList<abscissaType> >(); | ||
107 | } | ||
108 | |||
109 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/quadratureNode/quadratureNodes.H added (mode: 100644) (index 0000000..36da3a4) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2015-2016 Alberto Passalacqua | ||
6 | \\/ M anipulation | | ||
7 | ------------------------------------------------------------------------------- | ||
8 | License | ||
9 | This file is derivative work 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 | InClass | ||
25 | Foam::quadratureNodes | ||
26 | |||
27 | Description | ||
28 | |||
29 | SourceFiles | ||
30 | |||
31 | \*---------------------------------------------------------------------------*/ | ||
32 | |||
33 | #ifndef quadratureNodes_H | ||
34 | #define quadratureNodes_H | ||
35 | |||
36 | #include "volFields.H" | ||
37 | #include "quadratureNode.H" | ||
38 | #include "extendedQuadratureNode.H" | ||
39 | |||
40 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
41 | |||
42 | namespace Foam | ||
43 | { | ||
44 | |||
45 | typedef quadratureNode<volScalarField, volScalarField> basicVolScalarNode; | ||
46 | |||
47 | typedef quadratureNode<surfaceScalarField, surfaceScalarField> | ||
48 | basicSurfaceScalarNode; | ||
49 | |||
50 | typedef quadratureNode<volScalarField, volVectorField> basicVolVectorNode; | ||
51 | |||
52 | typedef quadratureNode<surfaceScalarField, surfaceVectorField> | ||
53 | basicSurfaceVectorNode; | ||
54 | |||
55 | typedef extendedQuadratureNode<volScalarField, volScalarField, volScalarField> | ||
56 | extendedVolScalarNode; | ||
57 | |||
58 | typedef extendedQuadratureNode | ||
59 | < | ||
60 | surfaceScalarField, surfaceScalarField, surfaceScalarField | ||
61 | > | ||
62 | extendedSurfaceScalarNode; | ||
63 | |||
64 | typedef extendedQuadratureNode<volScalarField, volVectorField, volScalarField> | ||
65 | extendedVolVectorNode; | ||
66 | |||
67 | typedef extendedQuadratureNode | ||
68 | < | ||
69 | surfaceScalarField, surfaceVectorField, surfaceScalarField | ||
70 | > | ||
71 | extendedSurfaceVectorNode; | ||
72 | |||
73 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
74 | |||
75 | } // End namespace Foam | ||
76 | |||
77 | |||
78 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
79 | |||
80 | #endif | ||
81 | |||
82 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/univariateMomentSet/Make/files added (mode: 100644) (index 0000000..2bee21b) | |||
1 | univariateMomentSet.C | ||
2 | |||
3 | LIB = $(FOAM_USER_LIBBIN)/libmomentSet |
File multiphaseEulerPbeFoam/quadratureMethods/univariateMomentSet/Make/options added (mode: 100644) (index 0000000..d1b5d52) | |||
1 | EXE_INC = \ | ||
2 | -I$(LIB_SRC)/finiteVolume/lnInclude \ | ||
3 | -I../../eigenSolver/lnInclude | ||
4 | |||
5 | LIB_LIBS = \ | ||
6 | -lfiniteVolume \ | ||
7 | -L$(FOAM_USER_LIBBIN) \ | ||
8 | -leigenSolver |
File multiphaseEulerPbeFoam/quadratureMethods/univariateMomentSet/univariateMomentSet.C added (mode: 100644) (index 0000000..9ee3af0) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2014-2016 Alberto Passalacqua | ||
6 | \\/ M anipulation | | ||
7 | ------------------------------------------------------------------------------- | ||
8 | License | ||
9 | This file is derivative work 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 "univariateMomentSet.H" | ||
27 | |||
28 | #include "eigenSolver.H" | ||
29 | |||
30 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | ||
31 | |||
32 | Foam::univariateMomentSet::univariateMomentSet | ||
33 | ( | ||
34 | const label nMoments, | ||
35 | const scalar initValue, | ||
36 | const word& quadratureType, | ||
37 | const word& support, | ||
38 | const scalar knownAbscissa | ||
39 | ) | ||
40 | : | ||
41 | scalarDiagonalMatrix(nMoments, initValue), | ||
42 | nMoments_(nMoments), | ||
43 | alpha_(), | ||
44 | beta_(), | ||
45 | quadratureType_(quadratureType), | ||
46 | support_(support), | ||
47 | negativeZeta_(0), | ||
48 | degenerate_(false), | ||
49 | inverted_(false), | ||
50 | fullyRealizable_(true), | ||
51 | subsetRealizable_(true), | ||
52 | onMomentSpaceBoundary_(false), | ||
53 | realizabilityChecked_(false), | ||
54 | quadratureSetUp_(false), | ||
55 | forceGauss_(false), | ||
56 | nInvertibleMoments_(nMoments_), | ||
57 | nRealizableMoments_(0), | ||
58 | nNodes_(0), | ||
59 | knownAbscissa_(knownAbscissa), | ||
60 | weights_(), | ||
61 | abscissae_() | ||
62 | { | ||
63 | if (support_ != "R" && support_ != "RPlus" && support_ != "01") | ||
64 | { | ||
65 | FatalErrorInFunction | ||
66 | << "The specified support is invalid." << nl | ||
67 | << " Valid supports are: R, RPlus and 01." << nl | ||
68 | << " Moment set: " << (*this) | ||
69 | << abort(FatalError); | ||
70 | } | ||
71 | |||
72 | if (quadratureType_ != "Gauss" && quadratureType_ != "GaussRadau") | ||
73 | { | ||
74 | FatalErrorInFunction | ||
75 | << "The specified quadrature type is invalid." << endl | ||
76 | << "Valid quadrature types are: Gauss and GaussRadau." | ||
77 | << abort(FatalError); | ||
78 | } | ||
79 | |||
80 | label recurrenceSize = label((nMoments_ - 2)/2) + 1; | ||
81 | |||
82 | if (quadratureType_ == "GaussRadau") | ||
83 | { | ||
84 | recurrenceSize += 1; | ||
85 | } | ||
86 | |||
87 | alpha_.setSize(recurrenceSize, scalar(0)); | ||
88 | beta_.setSize(recurrenceSize + 1, scalar(0)); | ||
89 | } | ||
90 | |||
91 | Foam::univariateMomentSet::univariateMomentSet | ||
92 | ( | ||
93 | const scalarDiagonalMatrix& m, | ||
94 | const word& quadratureType, | ||
95 | const word& support, | ||
96 | const scalar knownAbscissa | ||
97 | ) | ||
98 | : | ||
99 | scalarDiagonalMatrix(m), | ||
100 | nMoments_(m.size()), | ||
101 | alpha_(), | ||
102 | beta_(), | ||
103 | quadratureType_(quadratureType), | ||
104 | support_(support), | ||
105 | negativeZeta_(0), | ||
106 | degenerate_(false), | ||
107 | inverted_(false), | ||
108 | fullyRealizable_(true), | ||
109 | subsetRealizable_(true), | ||
110 | onMomentSpaceBoundary_(false), | ||
111 | realizabilityChecked_(false), | ||
112 | quadratureSetUp_(false), | ||
113 | forceGauss_(false), | ||
114 | nInvertibleMoments_(nMoments_), | ||
115 | nRealizableMoments_(0), | ||
116 | nNodes_(0), | ||
117 | knownAbscissa_(knownAbscissa), | ||
118 | weights_(), | ||
119 | abscissae_() | ||
120 | { | ||
121 | if (support_ != "R" && support_ != "RPlus" && support_ != "01") | ||
122 | { | ||
123 | FatalErrorInFunction | ||
124 | << "The specified support is invalid." << nl | ||
125 | << " Valid supports are: R, RPlus and 01." | ||
126 | << abort(FatalError); | ||
127 | } | ||
128 | |||
129 | if (quadratureType_ != "Gauss" && quadratureType_ != "GaussRadau") | ||
130 | { | ||
131 | FatalErrorInFunction | ||
132 | << "The specified quadrature type is invalid." << endl | ||
133 | << "Valid quadrature types are: Gauss and GaussRadau." | ||
134 | << abort(FatalError); | ||
135 | } | ||
136 | |||
137 | label recurrenceSize = label((nMoments_ - 2)/2) + 1; | ||
138 | |||
139 | alpha_.setSize(recurrenceSize, scalar(0)); | ||
140 | beta_.setSize(recurrenceSize + 1, scalar(0)); | ||
141 | } | ||
142 | |||
143 | |||
144 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | ||
145 | |||
146 | Foam::univariateMomentSet::~univariateMomentSet() | ||
147 | {} | ||
148 | |||
149 | |||
150 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | ||
151 | |||
152 | void Foam::univariateMomentSet::invert() | ||
153 | { | ||
154 | if (inverted_) | ||
155 | { | ||
156 | return; | ||
157 | } | ||
158 | |||
159 | if ((*this)[0] < SMALL) | ||
160 | { | ||
161 | nNodes_ = 0; | ||
162 | |||
163 | return; | ||
164 | } | ||
165 | |||
166 | if (isDegenerate()) // || (*this)[0] <= 0.0) | ||
167 | { | ||
168 | //degenerate_ = true; | ||
169 | setupQuadrature(); | ||
170 | weights_[0] = (*this)[0]; | ||
171 | abscissae_[0] = 0.0; | ||
172 | inverted_ = true; | ||
173 | |||
174 | return; | ||
175 | } | ||
176 | |||
177 | if (!realizabilityChecked_) | ||
178 | { | ||
179 | checkRealizability(); | ||
180 | setupQuadrature(true); | ||
181 | } | ||
182 | |||
183 | if (!quadratureSetUp_) | ||
184 | { | ||
185 | setupQuadrature(true); | ||
186 | } | ||
187 | |||
188 | if (nInvertibleMoments_ < 2) | ||
189 | { | ||
190 | FatalErrorInFunction | ||
191 | << "Insufficient number (" << nInvertibleMoments_ | ||
192 | << ") of moments to define quadrature." << nl | ||
193 | << " Moment set: " << (*this) | ||
194 | << abort(FatalError); | ||
195 | } | ||
196 | |||
197 | if (forceGauss_) | ||
198 | { | ||
199 | WarningInFunction | ||
200 | << "Forcing Gauss quadrature. " << nl | ||
201 | << " Originally requested quadrature type: " | ||
202 | << quadratureType_ << nl | ||
203 | << " Number of realizable moments: " | ||
204 | << nRealizableMoments_ << nl | ||
205 | << " Moment set: " << (*this) | ||
206 | << endl; | ||
207 | } | ||
208 | |||
209 | if (nInvertibleMoments_ == 2) | ||
210 | { | ||
211 | weights_[0] = (*this)[0]; | ||
212 | abscissae_[0] = (*this)[1]/(*this)[0]; | ||
213 | |||
214 | inverted_ = true; | ||
215 | |||
216 | return; | ||
217 | } | ||
218 | |||
219 | if (quadratureType_ == "GaussRadau" && !forceGauss_) | ||
220 | { | ||
221 | // Compute P_{N-1} and P_{N-2} by recurrence | ||
222 | // It is assumed the added point has abscissa in zero (xi0 = 0) | ||
223 | scalar p = knownAbscissa_ - alpha_[0]; | ||
224 | scalar pMinus1 = 1.0; | ||
225 | scalar p1 = p; | ||
226 | |||
227 | for (label i = 1; i < nNodes_ - 1; i++) | ||
228 | { | ||
229 | p = knownAbscissa_ - alpha_[0]*p1 - beta_[i]*pMinus1; | ||
230 | pMinus1 = p1; | ||
231 | p1 = p; | ||
232 | } | ||
233 | |||
234 | alpha_[nNodes_ - 1] = knownAbscissa_ - beta_[nNodes_ - 1]*pMinus1/p; | ||
235 | } | ||
236 | |||
237 | scalarSquareMatrix z(nNodes_, scalar(0)); | ||
238 | |||
239 | for (label i = 0; i < nNodes_ - 1; i++) | ||
240 | { | ||
241 | z[i][i] = alpha_[i]; | ||
242 | z[i][i+1] = Foam::sqrt(beta_[i+1]); | ||
243 | z[i+1][i] = z[i][i+1]; | ||
244 | } | ||
245 | |||
246 | z[nNodes_ - 1][nNodes_ - 1] = alpha_[nNodes_ - 1]; | ||
247 | |||
248 | // Computing weights and abscissae | ||
249 | eigenSolver zEig(z, true); | ||
250 | |||
251 | // Computing weights and abscissae | ||
252 | for (label i = 0; i < nNodes_; i++) | ||
253 | { | ||
254 | weights_[i] = (*this)[0]*sqr(zEig.eigenvectors()[0][i]); | ||
255 | abscissae_[i] = zEig.eigenvaluesRe()[i]; | ||
256 | } | ||
257 | |||
258 | inverted_ = true; | ||
259 | } | ||
260 | |||
261 | void Foam::univariateMomentSet::checkCanonicalMoments | ||
262 | ( | ||
263 | const scalarDiagonalMatrix& zeta, | ||
264 | const label nZeta | ||
265 | ) | ||
266 | { | ||
267 | scalarDiagonalMatrix canonicalMoments(nZeta, 0.0); | ||
268 | |||
269 | canonicalMoments[0] = zeta[0]; | ||
270 | |||
271 | if (canonicalMoments[0] == 1.0) | ||
272 | { | ||
273 | nRealizableMoments_ = 2; | ||
274 | onMomentSpaceBoundary_ = true; | ||
275 | |||
276 | return; | ||
277 | } | ||
278 | |||
279 | for (label zetai = 1; zetai < nZeta; zetai++) | ||
280 | { | ||
281 | canonicalMoments[zetai] = zeta[zetai]/(1.0 - canonicalMoments[zetai-1]); | ||
282 | |||
283 | if (canonicalMoments[zetai] < 0.0 || canonicalMoments[zetai] > 1.0) | ||
284 | { | ||
285 | nRealizableMoments_ = zetai + 1; | ||
286 | |||
287 | return; | ||
288 | } | ||
289 | else if | ||
290 | ( | ||
291 | canonicalMoments[zetai] == 0.0 | ||
292 | || canonicalMoments[zetai] == 1.0 | ||
293 | ) | ||
294 | { | ||
295 | nRealizableMoments_ = zetai + 2; | ||
296 | onMomentSpaceBoundary_ = true; | ||
297 | |||
298 | return; | ||
299 | } | ||
300 | } | ||
301 | |||
302 | onMomentSpaceBoundary_ = false; | ||
303 | nRealizableMoments_ = nZeta + 1; | ||
304 | } | ||
305 | |||
306 | void Foam::univariateMomentSet::checkRealizability() | ||
307 | { | ||
308 | if (realizabilityChecked_) | ||
309 | { | ||
310 | return; | ||
311 | } | ||
312 | |||
313 | // If the zero-order moment is negative, exit immediately. | ||
314 | if ((*this)[0] < 0.0) | ||
315 | { | ||
316 | FatalErrorInFunction | ||
317 | << "The zero-order moment is negative." << nl | ||
318 | << " Moment set: " << (*this) | ||
319 | << abort(FatalError); | ||
320 | } | ||
321 | |||
322 | // Check for the degenerate case where only m0 is defined | ||
323 | if (nMoments_ <= 1) | ||
324 | { | ||
325 | FatalErrorInFunction | ||
326 | << "The moment has size less or equal to 1." << nl | ||
327 | << " Moment set: " << (*this) | ||
328 | << abort(FatalError); | ||
329 | } | ||
330 | |||
331 | label nN = nMoments_ - 1; | ||
332 | label nD = label(nN/2); | ||
333 | label nR = nN - 2*nD; | ||
334 | |||
335 | // Vector of zeta values used to check moment realizability | ||
336 | scalarDiagonalMatrix zeta(nN); | ||
337 | |||
338 | // Check for the case with only two moments, if support is R+ or [0,1] | ||
339 | // In the case of support over R, only check if beta < 0 | ||
340 | if (nMoments_ == 2) | ||
341 | { | ||
342 | if (support_ == "R") | ||
343 | { | ||
344 | negativeZeta_ = 0; | ||
345 | nRealizableMoments_ = 2; | ||
346 | nInvertibleMoments_ = 2; | ||
347 | fullyRealizable_ = true; | ||
348 | subsetRealizable_ = true; | ||
349 | |||
350 | return; | ||
351 | } | ||
352 | |||
353 | zeta[0] = (*this)[1]/(*this)[0]; | ||
354 | |||
355 | if (zeta[0] <= 0.0) | ||
356 | { | ||
357 | if (isDegenerate() || zeta[0] == 0.0) | ||
358 | { | ||
359 | negativeZeta_ = 0; | ||
360 | nRealizableMoments_ = 2; | ||
361 | nInvertibleMoments_ = 2; | ||
362 | fullyRealizable_ = true; | ||
363 | subsetRealizable_ = true; | ||
364 | onMomentSpaceBoundary_ = true; | ||
365 | |||
366 | return; | ||
367 | } | ||
368 | |||
369 | negativeZeta_ = 1; | ||
370 | nRealizableMoments_ = 1; | ||
371 | nInvertibleMoments_ = 0; | ||
372 | fullyRealizable_ = false; | ||
373 | subsetRealizable_ = true; | ||
374 | onMomentSpaceBoundary_ = false; | ||
375 | |||
376 | FatalErrorInFunction | ||
377 | << "Moment set with dimension 2 and only one realizable moment." | ||
378 | << nl << " Moment set: " << (*this) | ||
379 | << abort(FatalError); | ||
380 | } | ||
381 | |||
382 | if (support_ == "RPlus") | ||
383 | { | ||
384 | negativeZeta_ = 0; | ||
385 | nRealizableMoments_ = 2; | ||
386 | nInvertibleMoments_ = 2; | ||
387 | fullyRealizable_ = true; | ||
388 | subsetRealizable_ = true; | ||
389 | realizabilityChecked_ = true; | ||
390 | onMomentSpaceBoundary_ = false; | ||
391 | |||
392 | return; | ||
393 | } | ||
394 | else // Support on [0, 1] - Check if canonical moments belong to [0,1] | ||
395 | { | ||
396 | if (zeta[0] <= 1.0) | ||
397 | { | ||
398 | nRealizableMoments_ = 2; | ||
399 | nInvertibleMoments_ = 2; | ||
400 | fullyRealizable_ = true; | ||
401 | subsetRealizable_ = true; | ||
402 | realizabilityChecked_ = true; | ||
403 | |||
404 | if (zeta[0] < 1.0) | ||
405 | { | ||
406 | onMomentSpaceBoundary_ = false; | ||
407 | } | ||
408 | else | ||
409 | { | ||
410 | onMomentSpaceBoundary_ = true; | ||
411 | } | ||
412 | |||
413 | return; | ||
414 | } | ||
415 | else | ||
416 | { | ||
417 | if (isDegenerate()) | ||
418 | { | ||
419 | negativeZeta_ = 0; | ||
420 | nRealizableMoments_ = 2; | ||
421 | nInvertibleMoments_ = 2; | ||
422 | fullyRealizable_ = true; | ||
423 | subsetRealizable_ = true; | ||
424 | onMomentSpaceBoundary_ = true; | ||
425 | |||
426 | return; | ||
427 | } | ||
428 | |||
429 | negativeZeta_ = 1; | ||
430 | nRealizableMoments_ = 1; | ||
431 | nInvertibleMoments_ = 0; | ||
432 | fullyRealizable_ = false; | ||
433 | subsetRealizable_ = true; | ||
434 | |||
435 | FatalErrorInFunction | ||
436 | << "Moment set with dimension 2 and only one " | ||
437 | << "realizable moment." << nl | ||
438 | << " Moment set: " << (*this) | ||
439 | << abort(FatalError); | ||
440 | } | ||
441 | } | ||
442 | } | ||
443 | |||
444 | // Matrix used to build the recurrence relation | ||
445 | scalarRectangularMatrix zRecurrence(nD + 1, nMoments_, 0.0); | ||
446 | |||
447 | for (label columnI = 0; columnI < nMoments_; columnI++) | ||
448 | { | ||
449 | zRecurrence[0][columnI] = (*this)[columnI]; | ||
450 | } | ||
451 | |||
452 | alpha_[0] = (*this)[1]/(*this)[0]; | ||
453 | beta_[0] = (*this)[0]; | ||
454 | |||
455 | for (label columnI = 1; columnI < nMoments_ - 1; columnI++) | ||
456 | { | ||
457 | zRecurrence[1][columnI] = zRecurrence[0][columnI + 1] | ||
458 | - alpha_[0]*zRecurrence[0][columnI]; | ||
459 | } | ||
460 | |||
461 | zeta[0] = alpha_[0]; | ||
462 | |||
463 | if (!(support_ == "R") && zeta[0] <= 0.0) | ||
464 | { | ||
465 | if (isDegenerate() || zeta[0] == 0.0) | ||
466 | { | ||
467 | negativeZeta_ = 0; | ||
468 | nRealizableMoments_ = 2; | ||
469 | nInvertibleMoments_ = 2; | ||
470 | fullyRealizable_ = false; | ||
471 | subsetRealizable_ = true; | ||
472 | onMomentSpaceBoundary_ = true; | ||
473 | |||
474 | return; | ||
475 | } | ||
476 | |||
477 | negativeZeta_ = 1; | ||
478 | nRealizableMoments_ = 1; | ||
479 | nInvertibleMoments_ = 0; | ||
480 | fullyRealizable_ = false; | ||
481 | subsetRealizable_ = true; | ||
482 | onMomentSpaceBoundary_ = false; | ||
483 | |||
484 | FatalErrorInFunction | ||
485 | << "Moment set with only one realizable moment." << nl | ||
486 | << " Moment set: " << (*this) | ||
487 | << abort(FatalError); | ||
488 | } | ||
489 | |||
490 | for (label zetai = 1; zetai <= nD - 1; zetai++) | ||
491 | { | ||
492 | beta_[zetai] = zRecurrence[zetai][zetai] | ||
493 | /zRecurrence[zetai - 1][zetai - 1]; | ||
494 | |||
495 | if (support_ == "R") | ||
496 | { | ||
497 | if (beta_[zetai] < 0.0) | ||
498 | { | ||
499 | nRealizableMoments_ = 2*zetai; | ||
500 | calcNInvertibleMoments(); | ||
501 | fullyRealizable_ = false; | ||
502 | subsetRealizable_ = true; | ||
503 | realizabilityChecked_ = true; | ||
504 | |||
505 | return; | ||
506 | } | ||
507 | } | ||
508 | else | ||
509 | { | ||
510 | zeta[2*zetai - 1] = beta_[zetai]/zeta[2*zetai - 2]; | ||
511 | |||
512 | if (zeta[2*zetai - 1] <= 0.0) | ||
513 | { | ||
514 | if (support_ == "RPlus") | ||
515 | { | ||
516 | if (zeta[2*zetai - 1] < 0.0) | ||
517 | { | ||
518 | negativeZeta_ = 2*zetai; | ||
519 | nRealizableMoments_ = negativeZeta_; | ||
520 | onMomentSpaceBoundary_ = false; | ||
521 | } | ||
522 | else | ||
523 | { | ||
524 | negativeZeta_ = 2*zetai + 1; | ||
525 | nRealizableMoments_ = negativeZeta_; | ||
526 | onMomentSpaceBoundary_ = true; | ||
527 | } | ||
528 | } | ||
529 | else // Support on [0,1] | ||
530 | { | ||
531 | checkCanonicalMoments(zeta, 2*zetai); | ||
532 | } | ||
533 | |||
534 | calcNInvertibleMoments(); | ||
535 | fullyRealizable_ = false; | ||
536 | subsetRealizable_ = true; | ||
537 | realizabilityChecked_ = true; | ||
538 | |||
539 | return; | ||
540 | } | ||
541 | } | ||
542 | |||
543 | alpha_[zetai] = zRecurrence[zetai][zetai + 1]/zRecurrence[zetai][zetai] | ||
544 | - zRecurrence[zetai - 1][zetai] | ||
545 | /zRecurrence[zetai - 1][zetai - 1]; | ||
546 | |||
547 | if (!(support_ == "R")) | ||
548 | { | ||
549 | zeta[2*zetai] = alpha_[zetai] - zeta[2*zetai - 1]; | ||
550 | |||
551 | if (zeta[2*zetai] <= 0.0) | ||
552 | { | ||
553 | if (support_ == "RPlus") | ||
554 | { | ||
555 | if (zeta[2*zetai] < 0.0) | ||
556 | { | ||
557 | negativeZeta_ = 2*zetai + 1; | ||
558 | nRealizableMoments_ = negativeZeta_; | ||
559 | onMomentSpaceBoundary_ = false; | ||
560 | } | ||
561 | else | ||
562 | { | ||
563 | negativeZeta_ = 2*zetai + 2; | ||
564 | nRealizableMoments_ = negativeZeta_; | ||
565 | onMomentSpaceBoundary_ = true; | ||
566 | } | ||
567 | } | ||
568 | else // Support on [0,1] | ||
569 | { | ||
570 | checkCanonicalMoments(zeta, 2*zetai + 1); | ||
571 | } | ||
572 | |||
573 | calcNInvertibleMoments(); | ||
574 | fullyRealizable_ = false; | ||
575 | subsetRealizable_ = true; | ||
576 | realizabilityChecked_ = true; | ||
577 | |||
578 | return; | ||
579 | } | ||
580 | } | ||
581 | |||
582 | for (label columnI = zetai + 1; columnI <= nN - zetai - 1; columnI++) | ||
583 | { | ||
584 | zRecurrence[zetai + 1][columnI] = zRecurrence[zetai][columnI + 1] | ||
585 | - alpha_[zetai]*zRecurrence[zetai][columnI] | ||
586 | - beta_[zetai]*zRecurrence[zetai - 1][columnI]; | ||
587 | } | ||
588 | } | ||
589 | |||
590 | beta_[nD] = zRecurrence[nD][nD]/zRecurrence[nD - 1][nD - 1]; | ||
591 | |||
592 | if (support_ == "R") | ||
593 | { | ||
594 | if (beta_[nD] < 0.0) | ||
595 | { | ||
596 | nRealizableMoments_ = 2*nD; | ||
597 | calcNInvertibleMoments(); | ||
598 | fullyRealizable_ = false; | ||
599 | subsetRealizable_ = true; | ||
600 | realizabilityChecked_ = true; | ||
601 | |||
602 | return; | ||
603 | } | ||
604 | else | ||
605 | { | ||
606 | nRealizableMoments_ = nMoments_; | ||
607 | calcNInvertibleMoments(); | ||
608 | fullyRealizable_ = true; | ||
609 | subsetRealizable_ = true; | ||
610 | realizabilityChecked_ = true; | ||
611 | |||
612 | return; | ||
613 | } | ||
614 | } | ||
615 | else | ||
616 | { | ||
617 | zeta[2*nD - 1] = beta_[nD]/zeta[2*nD - 2]; | ||
618 | |||
619 | if (zeta[2*nD - 1] <= 0.0) | ||
620 | { | ||
621 | if (support_ == "RPlus") | ||
622 | { | ||
623 | if (zeta[2*nD - 1] < 0.0) | ||
624 | { | ||
625 | negativeZeta_ = 2*nD; | ||
626 | nRealizableMoments_ = negativeZeta_; | ||
627 | onMomentSpaceBoundary_ = false; | ||
628 | } | ||
629 | else | ||
630 | { | ||
631 | negativeZeta_ = 2*nD + 1; | ||
632 | nRealizableMoments_ = negativeZeta_; | ||
633 | onMomentSpaceBoundary_ = true; | ||
634 | } | ||
635 | } | ||
636 | else // Support on [0,1] | ||
637 | { | ||
638 | checkCanonicalMoments(zeta, 2*nD); | ||
639 | } | ||
640 | |||
641 | calcNInvertibleMoments(); | ||
642 | fullyRealizable_ = false; | ||
643 | subsetRealizable_ = true; | ||
644 | realizabilityChecked_ = true; | ||
645 | |||
646 | return; | ||
647 | } | ||
648 | |||
649 | if (nR == 1) | ||
650 | { | ||
651 | alpha_[nD] = zRecurrence[nD][nD + 1]/zRecurrence[nD][nD] | ||
652 | - zRecurrence[nD - 1][nD]/zRecurrence[nD - 1][nD - 1]; | ||
653 | |||
654 | zeta[2*nD] = alpha_[nD] - zeta[2*nD - 1]; | ||
655 | |||
656 | if (zeta[2*nD] <= 0.0) | ||
657 | { | ||
658 | if (support_ == "RPlus") | ||
659 | { | ||
660 | if (zeta[2*nD] < 0.0) | ||
661 | { | ||
662 | negativeZeta_ = 2*nD + 1; | ||
663 | nRealizableMoments_ = negativeZeta_; | ||
664 | fullyRealizable_ = false; | ||
665 | onMomentSpaceBoundary_ = false; | ||
666 | } | ||
667 | else | ||
668 | { | ||
669 | negativeZeta_ = 0; | ||
670 | nRealizableMoments_ = nMoments_; | ||
671 | fullyRealizable_ = true; | ||
672 | onMomentSpaceBoundary_ = true; | ||
673 | } | ||
674 | } | ||
675 | else // Support on [0,1] | ||
676 | { | ||
677 | checkCanonicalMoments(zeta, 2*nD + 1); | ||
678 | |||
679 | if (onMomentSpaceBoundary_) | ||
680 | { | ||
681 | fullyRealizable_ = true; | ||
682 | } | ||
683 | else | ||
684 | { | ||
685 | fullyRealizable_ = false; | ||
686 | } | ||
687 | } | ||
688 | |||
689 | calcNInvertibleMoments(); | ||
690 | |||
691 | subsetRealizable_ = true; | ||
692 | realizabilityChecked_ = true; | ||
693 | |||
694 | return; | ||
695 | } | ||
696 | else // zeta[2*nD] > 0.0 | ||
697 | { | ||
698 | if (support_ == "RPlus") | ||
699 | { | ||
700 | negativeZeta_ = 0; | ||
701 | nRealizableMoments_ = nMoments_; | ||
702 | fullyRealizable_ = true; | ||
703 | onMomentSpaceBoundary_ = false; | ||
704 | } | ||
705 | else // Support on [0,1] | ||
706 | { | ||
707 | checkCanonicalMoments(zeta, 2*nD + 1); | ||
708 | |||
709 | if (onMomentSpaceBoundary_) | ||
710 | { | ||
711 | fullyRealizable_ = true; | ||
712 | } | ||
713 | else | ||
714 | { | ||
715 | fullyRealizable_ = false; | ||
716 | } | ||
717 | } | ||
718 | |||
719 | calcNInvertibleMoments(); | ||
720 | |||
721 | subsetRealizable_ = true; | ||
722 | realizabilityChecked_ = true; | ||
723 | |||
724 | return; | ||
725 | } | ||
726 | } | ||
727 | else | ||
728 | { | ||
729 | // If support is [0, + inf[ and this level is reached, the full set | ||
730 | // of moments is realizable | ||
731 | if (support_ == "RPlus") | ||
732 | { | ||
733 | fullyRealizable_ = true; | ||
734 | subsetRealizable_ = true; | ||
735 | nRealizableMoments_ = nMoments_; | ||
736 | onMomentSpaceBoundary_ = false; | ||
737 | } | ||
738 | else | ||
739 | { | ||
740 | checkCanonicalMoments(zeta, nN); | ||
741 | |||
742 | if (nRealizableMoments_ == nMoments_) | ||
743 | { | ||
744 | fullyRealizable_ = true; | ||
745 | subsetRealizable_ = true; | ||
746 | } | ||
747 | else | ||
748 | { | ||
749 | fullyRealizable_ = false; | ||
750 | subsetRealizable_ = true; | ||
751 | } | ||
752 | } | ||
753 | |||
754 | calcNInvertibleMoments(); | ||
755 | realizabilityChecked_ = true; | ||
756 | |||
757 | return; | ||
758 | } | ||
759 | } | ||
760 | } | ||
761 | |||
762 | void Foam::univariateMomentSet::calcNInvertibleMoments() | ||
763 | { | ||
764 | if (quadratureType_ == "Gauss") | ||
765 | { | ||
766 | if (nRealizableMoments_ % 2 != 0) | ||
767 | { | ||
768 | nInvertibleMoments_ = nRealizableMoments_ - 1; | ||
769 | } | ||
770 | else | ||
771 | { | ||
772 | nInvertibleMoments_ = nRealizableMoments_; | ||
773 | } | ||
774 | |||
775 | return; | ||
776 | } | ||
777 | else | ||
778 | { | ||
779 | forceGauss_ = false; | ||
780 | nInvertibleMoments_ = nRealizableMoments_; | ||
781 | |||
782 | if (nRealizableMoments_ % 2 == 0) | ||
783 | { | ||
784 | forceGauss_ = true; | ||
785 | } | ||
786 | } | ||
787 | } | ||
788 | |||
789 | void Foam::univariateMomentSet::setupQuadrature | ||
790 | ( | ||
791 | bool clear, | ||
792 | bool nullMomentSet | ||
793 | ) | ||
794 | { | ||
795 | if (!realizabilityChecked_) | ||
796 | { | ||
797 | checkRealizability(); | ||
798 | } | ||
799 | |||
800 | if (degenerate_) | ||
801 | { | ||
802 | nNodes_ = 1; | ||
803 | } | ||
804 | else | ||
805 | { | ||
806 | nNodes_ = nInvertibleMoments_/2; | ||
807 | |||
808 | if (quadratureType_ == "GaussRadau" && !forceGauss_) | ||
809 | { | ||
810 | nNodes_ += 1; | ||
811 | } | ||
812 | } | ||
813 | |||
814 | if (clear) | ||
815 | { | ||
816 | weights_.clear(); | ||
817 | abscissae_.clear(); | ||
818 | } | ||
819 | |||
820 | weights_.resize(nNodes_, 0.0); | ||
821 | abscissae_.resize(nNodes_, 0.0); | ||
822 | |||
823 | //quadratureSetUp_ = true; | ||
824 | } | ||
825 | |||
826 | void Foam::univariateMomentSet::update() | ||
827 | { | ||
828 | // Recomputing all the moments (even if they originally were not realizable) | ||
829 | // from quadrature (projection step). | ||
830 | for (label momenti = 0; momenti < nMoments_; momenti++) | ||
831 | { | ||
832 | (*this)[momenti] = 0.0; | ||
833 | |||
834 | for (label nodei = 0; nodei < nNodes_; nodei++) | ||
835 | { | ||
836 | (*this)[momenti] += weights_[nodei]*pow(abscissae_[nodei], momenti); | ||
837 | } | ||
838 | } | ||
839 | |||
840 | realizabilityChecked_ = false; | ||
841 | inverted_ = false; | ||
842 | } | ||
843 | |||
844 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/univariateMomentSet/univariateMomentSet.H added (mode: 100644) (index 0000000..c7cc687) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2014-2016 Alberto Passalacqua | ||
6 | \\/ M anipulation | | ||
7 | ------------------------------------------------------------------------------- | ||
8 | License | ||
9 | This file is derivative work 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 | Class | ||
25 | Foam::univariateMomentSet | ||
26 | |||
27 | Description | ||
28 | Stores, checks realizability and calculates the quadrature representation of | ||
29 | a measure from a set of univariate moments. | ||
30 | |||
31 | References | ||
32 | \verbatim | ||
33 | "Modified moments and Gaussian quadratures" | ||
34 | J C Wheeler | ||
35 | Rocky Mountain Journal of Mathematics | ||
36 | Volume 4, Pages 287-296, 1974 | ||
37 | \endverbatim | ||
38 | |||
39 | \verbatim | ||
40 | "Numerical Recipes in C++" | ||
41 | W H Press, S A Teukolsky, W Vetterling, B P Flannery | ||
42 | Cambridge University Press, 2007 | ||
43 | \endverbatim | ||
44 | |||
45 | \verbatim | ||
46 | "The theory of canonical moments with applications in Statistics, | ||
47 | Probability and Analysis" | ||
48 | H Dette, W. J. Studden | ||
49 | Wiley & Sons, 1997 | ||
50 | \endverbatim | ||
51 | |||
52 | \verbatim | ||
53 | "Matrix measures, moment spaces and Favard’s theorem for the interval | ||
54 | [0, 1] and [0,∞)" | ||
55 | H Dette, W. J. Studden | ||
56 | Linear algebra and its applications | ||
57 | Issue 345, Pages 169-193, 2002 | ||
58 | \endverbatim | ||
59 | |||
60 | SourceFiles | ||
61 | univariateMomentSet.C | ||
62 | univariateMomentSetI.H | ||
63 | |||
64 | \*---------------------------------------------------------------------------*/ | ||
65 | |||
66 | #ifndef univariateMomentSet_H | ||
67 | #define univariateMomentSet_H | ||
68 | |||
69 | #include "scalarMatrices.H" | ||
70 | |||
71 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
72 | |||
73 | namespace Foam | ||
74 | { | ||
75 | |||
76 | /*---------------------------------------------------------------------------*\ | ||
77 | Class univariateMomentSet Declaration | ||
78 | \*---------------------------------------------------------------------------*/ | ||
79 | |||
80 | class univariateMomentSet | ||
81 | : | ||
82 | public scalarDiagonalMatrix | ||
83 | { | ||
84 | // Private data | ||
85 | |||
86 | //- Number of moments | ||
87 | label nMoments_; | ||
88 | |||
89 | //- Alpha coefficients of the recurrence relation | ||
90 | scalarDiagonalMatrix alpha_; | ||
91 | |||
92 | //- Beta coefficients of the recurrence relation | ||
93 | scalarDiagonalMatrix beta_; | ||
94 | |||
95 | //- Type of quadrature formula computed when inverting the moment set | ||
96 | word quadratureType_; | ||
97 | |||
98 | //- Type of support of the measure associated to the moment set | ||
99 | word support_; | ||
100 | |||
101 | //- Position of first negative zeta | ||
102 | label negativeZeta_; | ||
103 | |||
104 | //- Bool to indicate if moment set is degenerate, with only the | ||
105 | // zero-order moment realizable | ||
106 | bool degenerate_; | ||
107 | |||
108 | //- Bool to indicate if moments were inverted | ||
109 | bool inverted_; | ||
110 | |||
111 | //- Bool to indicate if the full moment set is realizable | ||
112 | bool fullyRealizable_; | ||
113 | |||
114 | //- Bool to indicate if a subset of the full moment set is realizable | ||
115 | bool subsetRealizable_; | ||
116 | |||
117 | //- Bool to indicate if the moment set is on the boundary of the | ||
118 | // moment space | ||
119 | bool onMomentSpaceBoundary_; | ||
120 | |||
121 | //- Bool to indicate moment realizability was checked | ||
122 | bool realizabilityChecked_; | ||
123 | |||
124 | //- Bool to indicate quadrature setup was completed | ||
125 | bool quadratureSetUp_; | ||
126 | |||
127 | //- Bool to force Gauss quadrature when using other quadrature | ||
128 | // formulae. Usually needed to preserve the largest possible | ||
129 | // number of moments. | ||
130 | bool forceGauss_; | ||
131 | |||
132 | //- Number of invertible moments | ||
133 | label nInvertibleMoments_; | ||
134 | |||
135 | //- Number of realizable moments | ||
136 | label nRealizableMoments_; | ||
137 | |||
138 | //- Number of quadrature nodes | ||
139 | label nNodes_; | ||
140 | |||
141 | //- Known abscissa for Gauss-Radau quadrature | ||
142 | // Optionally specified at construction. If not specified, it is | ||
143 | // assumed to be zero. | ||
144 | scalar knownAbscissa_; | ||
145 | |||
146 | //- Quadrature weights | ||
147 | scalarDiagonalMatrix weights_; | ||
148 | |||
149 | //- Quadrature abscissae | ||
150 | scalarDiagonalMatrix abscissae_; | ||
151 | |||
152 | // Private member functions | ||
153 | |||
154 | //- Check moment realizability | ||
155 | void checkRealizability(); | ||
156 | |||
157 | //- Checks canonical moments for measures with support over [0,1] | ||
158 | void checkCanonicalMoments | ||
159 | ( | ||
160 | const scalarDiagonalMatrix& zeta, | ||
161 | const label nZeta | ||
162 | ); | ||
163 | |||
164 | //- Computes the number of invertible moments | ||
165 | inline void calcNInvertibleMoments(); | ||
166 | |||
167 | //- Setup quadrature storage based on realizability | ||
168 | void setupQuadrature(bool clear = false, bool nullMomentSet = false); | ||
169 | |||
170 | public: | ||
171 | |||
172 | // Constructors | ||
173 | |||
174 | //- Construct from number of moments and initial value | ||
175 | univariateMomentSet | ||
176 | ( | ||
177 | const label nMoments, | ||
178 | const scalar initValue, | ||
179 | const word& quadratureType, | ||
180 | const word& support, | ||
181 | const scalar knownAbscissa = 0.0 | ||
182 | ); | ||
183 | |||
184 | //- Construct from diagonalMatrix | ||
185 | univariateMomentSet | ||
186 | ( | ||
187 | const scalarDiagonalMatrix& m, | ||
188 | const word& quadratureType, | ||
189 | const word& support, | ||
190 | const scalar knownAbscissa = 0.0 | ||
191 | ); | ||
192 | |||
193 | //- Destructor | ||
194 | virtual ~univariateMomentSet(); | ||
195 | |||
196 | |||
197 | // Member Functions | ||
198 | |||
199 | //- Return quadrature abscissae | ||
200 | inline const scalarDiagonalMatrix& abscissae() const; | ||
201 | |||
202 | //- Invert the set of moments to compute weights and abscissae | ||
203 | void invert(); | ||
204 | |||
205 | //- Update moments from weights and abscissae | ||
206 | void update(); | ||
207 | |||
208 | //- Returns degenerate status of the moment set | ||
209 | inline bool isDegenerate(); | ||
210 | |||
211 | //- Returns the status of inversion | ||
212 | inline bool isInverted() const; | ||
213 | |||
214 | //- Return realizability status of the moment set | ||
215 | inline bool isFullyRealizable(); | ||
216 | |||
217 | //- Return realizability status of the moment subsets | ||
218 | inline bool isSubsetRealizable(); | ||
219 | |||
220 | //- Return true if the moment set is on the boundary of the moment space | ||
221 | inline bool isOnMomentSpaceBoundary(); | ||
222 | |||
223 | //- Return the number of invertible moments | ||
224 | inline label nInvertibleMoments(); | ||
225 | |||
226 | //- Return the number of realizable moments | ||
227 | inline label nRealizableMoments(); | ||
228 | |||
229 | //- Return the number of moments | ||
230 | inline label nMoments() const; | ||
231 | |||
232 | //- Return the number of nodes | ||
233 | inline label nNodes() const; | ||
234 | |||
235 | //- Return quadrature weights | ||
236 | inline const scalarDiagonalMatrix& weights() const; | ||
237 | |||
238 | //- Return support | ||
239 | inline const word quadratureType() const; | ||
240 | |||
241 | //- Return support | ||
242 | inline const word support() const; | ||
243 | }; | ||
244 | |||
245 | |||
246 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
247 | |||
248 | } // End namespace Foam | ||
249 | |||
250 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
251 | |||
252 | #include "univariateMomentSetI.H" | ||
253 | |||
254 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
255 | |||
256 | #endif | ||
257 | |||
258 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/univariateMomentSet/univariateMomentSetI.H added (mode: 100644) (index 0000000..5ba3cdb) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2014-2016 Alberto Passalacqua | ||
6 | \\/ M anipulation | | ||
7 | ------------------------------------------------------------------------------- | ||
8 | License | ||
9 | This file is derivative work 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 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | ||
27 | bool Foam::univariateMomentSet::isDegenerate() | ||
28 | { | ||
29 | // Checking if moments of order higher than zero are null | ||
30 | // The case when m0 = 0 is already managed | ||
31 | for (label momentI = 1; momentI < nMoments_; momentI++) | ||
32 | { | ||
33 | if (mag((*this)[momentI]) > SMALL) | ||
34 | { | ||
35 | degenerate_ = false; | ||
36 | |||
37 | return degenerate_; | ||
38 | } | ||
39 | } | ||
40 | |||
41 | degenerate_ = true; | ||
42 | |||
43 | return degenerate_; | ||
44 | } | ||
45 | |||
46 | bool Foam::univariateMomentSet::isInverted() const | ||
47 | { | ||
48 | return inverted_; | ||
49 | } | ||
50 | |||
51 | bool Foam::univariateMomentSet::isFullyRealizable() | ||
52 | { | ||
53 | if (!realizabilityChecked_) | ||
54 | { | ||
55 | checkRealizability(); | ||
56 | } | ||
57 | |||
58 | return fullyRealizable_; | ||
59 | } | ||
60 | |||
61 | bool Foam::univariateMomentSet::isSubsetRealizable() | ||
62 | { | ||
63 | if (!realizabilityChecked_) | ||
64 | { | ||
65 | checkRealizability(); | ||
66 | } | ||
67 | |||
68 | return subsetRealizable_; | ||
69 | } | ||
70 | |||
71 | bool Foam::univariateMomentSet::isOnMomentSpaceBoundary() | ||
72 | { | ||
73 | if (!realizabilityChecked_) | ||
74 | { | ||
75 | checkRealizability(); | ||
76 | } | ||
77 | |||
78 | return onMomentSpaceBoundary_; | ||
79 | } | ||
80 | |||
81 | Foam::label Foam::univariateMomentSet::nInvertibleMoments() | ||
82 | { | ||
83 | if (!realizabilityChecked_) | ||
84 | { | ||
85 | checkRealizability(); | ||
86 | } | ||
87 | |||
88 | return nInvertibleMoments_; | ||
89 | } | ||
90 | |||
91 | Foam::label Foam::univariateMomentSet::nRealizableMoments() | ||
92 | { | ||
93 | if (!realizabilityChecked_) | ||
94 | { | ||
95 | checkRealizability(); | ||
96 | } | ||
97 | |||
98 | return nRealizableMoments_; | ||
99 | } | ||
100 | |||
101 | Foam::label Foam::univariateMomentSet::nMoments() const | ||
102 | { | ||
103 | return nMoments_; | ||
104 | } | ||
105 | |||
106 | Foam::label Foam::univariateMomentSet::nNodes() const | ||
107 | { | ||
108 | return nNodes_; | ||
109 | } | ||
110 | |||
111 | //- Return primary quadrature weights | ||
112 | const Foam::scalarDiagonalMatrix& Foam::univariateMomentSet::weights() const | ||
113 | { | ||
114 | return weights_; | ||
115 | } | ||
116 | |||
117 | //- Return primary quadrature abscissae | ||
118 | const Foam::scalarDiagonalMatrix& Foam::univariateMomentSet::abscissae() const | ||
119 | { | ||
120 | return abscissae_; | ||
121 | } | ||
122 | |||
123 | //- Return support of the measure associated to the moment set | ||
124 | const Foam::word Foam::univariateMomentSet::support() const | ||
125 | { | ||
126 | return support_; | ||
127 | } | ||
128 | |||
129 | //- Return type of quadrature | ||
130 | const Foam::word Foam::univariateMomentSet::quadratureType() const | ||
131 | { | ||
132 | return quadratureType_; | ||
133 | } | ||
134 | |||
135 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/zonePhaseVolumes.H added (mode: 100644) (index 0000000..5f8f3fb) | |||
1 | { | ||
2 | const scalarField& V = mesh.V(); | ||
3 | |||
4 | forAll(mesh.cellZones(), czi) | ||
5 | { | ||
6 | const labelList& cellLabels = mesh.cellZones()[czi]; | ||
7 | |||
8 | forAllConstIter(PtrDictionary<phaseModel>, fluid.phases(), iter) | ||
9 | { | ||
10 | const volScalarField& alpha = iter(); | ||
11 | scalar phaseVolume = 0; | ||
12 | |||
13 | forAll(cellLabels, cli) | ||
14 | { | ||
15 | label celli = cellLabels[cli]; | ||
16 | phaseVolume += alpha[celli]*V[celli]; | ||
17 | } | ||
18 | |||
19 | reduce(phaseVolume, sumOp<scalar>()); | ||
20 | |||
21 | Info<< alpha.name() | ||
22 | << " phase volume in zone " << mesh.cellZones()[czi].name() | ||
23 | << " = " << phaseVolume*1e6 << " ml " << endl; | ||
24 | } | ||
25 | } | ||
26 | } |